• Apfeltalk ändert einen Teil seiner Allgemeinen Geschäftsbedingungen (AGB), das Löschen von Useraccounts betreffend.
    Näheres könnt Ihr hier nachlesen: AGB-Änderung
  • Im Monat Februar heisst es: Ab in die Welt und Quadrate aufspüren und fotografieren! Quadrat zum Quadrat ist unser Motto und wieder einmal setzen wir auf Eure Kreativität. Hier geht es lang --> Klick

socat als Brücke zwischen tun/tap device & socks proxy

derspacy

Gala
Registriert
19.07.08
Beiträge
50
Hi,

ich habe mir gerade überlegt eine bessere Lösung für das iPhone-Tethering-"Problem" zu finden. Momentan ist es ja, dass man nur via Socks-Proxy die iPhone-Internetverbindung nutzen kann - sei es via OpenSSHD via Jailbreak oder mit Netshare.

Dann hab ich mich an das UNIX-Tool socat erinnert und mir folgendes Szenario gedacht:

Ab socat 1.6 ist der Support für tun/tap hinzugekommen. Meine Idee ist es nun, dass socat ein virtuelles tun/tap-Netzwerkinterface mit dem Socks-Proxy verbindet und man dann jenes Interface als Default-Gateway setzt, so dass beliebige Programme - eben auch die ohne Socks-Proxy-Support - die iPhone-Verbindung nutzen können. Die Theorie klingt schon mal ganz gut, glaub ich...

tun/tap Support für Leopard gibt es auch: http://www-user.rhrk.uni-kl.de/~nissler/tuntap/tuntap_leopard_20080607.tar.gz

Ich bekomme socat 1.6.0.1 nur nicht kompiliert, habe zwar einen Patch - der ist aber nur für Tiger (http://www.dest-unreach.org/socat/contrib/socat-macos.html) und führt zu:

Code:
error.c: In function 'msg':
error.c:188: warning: format '%06ld' expects type 'long int', but argument 3 has type '__darwin_suseconds_t'
gcc -O -D_GNU_SOURCE  -Wall -Wno-parentheses -DHAVE_CONFIG_H -I.  -I.   -c -o dalan.o dalan.c
gcc -O -D_GNU_SOURCE  -Wall -Wno-parentheses -DHAVE_CONFIG_H -I.  -I.   -c -o procan.o procan.c
gcc -O -D_GNU_SOURCE  -Wall -Wno-parentheses -DHAVE_CONFIG_H -I.  -I.   -c -o procan-cdefs.o procan-cdefs.c
procan-cdefs.c: In function 'procan_cdefs':
procan-cdefs.c:23: warning: format '%u' expects type 'unsigned int', but argument 3 has type 'long unsigned int'
gcc -O -D_GNU_SOURCE  -Wall -Wno-parentheses -DHAVE_CONFIG_H -I.  -I.   -c -o hostan.o hostan.c
gcc -O -D_GNU_SOURCE  -Wall -Wno-parentheses -DHAVE_CONFIG_H -I.  -I.   -c -o fdname.o fdname.c
gcc -O -D_GNU_SOURCE  -Wall -Wno-parentheses -DHAVE_CONFIG_H -I.  -I.   -c -o sysutils.o sysutils.c
gcc -O -D_GNU_SOURCE  -Wall -Wno-parentheses -DHAVE_CONFIG_H -I.  -I.   -c -o utils.o utils.c
gcc -O -D_GNU_SOURCE  -Wall -Wno-parentheses -DHAVE_CONFIG_H -I.  -I.   -c -o nestlex.o nestlex.c
gcc -O -D_GNU_SOURCE  -Wall -Wno-parentheses -DHAVE_CONFIG_H -I.  -I.   -c -o filan.o filan.c
filan.c: In function 'cdevan':
filan.c:435: warning: format '%08x' expects type 'unsigned int', but argument 3 has type 'tcflag_t'
filan.c:435: warning: format '%08x' expects type 'unsigned int', but argument 4 has type 'tcflag_t'
filan.c:435: warning: format '%08x' expects type 'unsigned int', but argument 5 has type 'tcflag_t'
filan.c:435: warning: format '%08x' expects type 'unsigned int', but argument 6 has type 'tcflag_t'
gcc -O -D_GNU_SOURCE  -Wall -Wno-parentheses -DHAVE_CONFIG_H -I.  -I.   -c -o sycls.o sycls.c
sycls.c: In function 'Append_history':
sycls.c:1477: warning: implicit declaration of function 'append_history'
gcc -O -D_GNU_SOURCE  -Wall -Wno-parentheses -DHAVE_CONFIG_H -I.  -I.   -c -o sslcls.o sslcls.c
ar r libxio.a xioinitialize.o xiohelp.o xioparam.o xiodiag.o xioopen.o xioopts.o xiosignal.o xiosigchld.o xioread.o xiowrite.o xiolayer.o xioshutdown.o xioclose.o xioexit.o xio-process.o xio-fd.o xio-fdnum.o xio-stdio.o xio-pipe.o xio-gopen.o xio-creat.o xio-file.o xio-named.o xio-socket.o xio-listen.o xio-unix.o xio-ip.o xio-ip4.o xio-ip6.o xio-ipapp.o xio-tcp.o xio-socks.o xio-proxy.o xio-udp.o xio-rawip.o xio-progcall.o xio-exec.o xio-system.o xio-termios.o xio-readline.o xio-pty.o xio-openssl.o xio-ascii.o xiolockfile.o xio-tcpwrap.o xio-ext2.o xio-tun.o error.o dalan.o procan.o procan-cdefs.o hostan.o fdname.o sysutils.o utils.o nestlex.o filan.o sycls.o sslcls.o
ar: creating archive libxio.a
ranlib libxio.a
ranlib: file: libxio.a(xio-ext2.o) has no symbols
ranlib: file: libxio.a(xio-tun.o) has no symbols
gcc -O -D_GNU_SOURCE  -Wall -Wno-parentheses -DHAVE_CONFIG_H -I.   -o socat socat.o libxio.a -lwrap -lutil  -lreadline -lssl -lcrypto
Undefined symbols:
  "_append_history", referenced from:
      _Append_history in libxio.a(sycls.o)
  "_res_9_init", referenced from:
      _Res_init in libxio.a(xio-ip.o)
ld: symbol(s) not found
collect2: ld returned 1 exit status
make: *** [socat] Error 1
Vielleicht hat da jemand von euch den Durchblick und kann einen Patch bereitstellen.

socat Source: http://www.dest-unreach.org/socat/download/socat-1.6.0.1.tar.bz2

socat tun/tap Documentation: http://www.dest-unreach.org/socat/doc/socat-tun.html
 

derspacy

Gala
Registriert
19.07.08
Beiträge
50
Ok, ich bin gerade im Kontakt mit dem Entwickler und unabhängig zum Compile-Problem wird es mit socat schwierig einen transparenten Proxy-Zugriff zu ermögichen.

socat kann über das tun/tap interface nur raw ip traffic weiterleiten, d.h. um diesen traffic in socks-requests umzuformulieren, müsste man den raw traffic erst interpretieren - z.B. mit einem kleinen script. Das wäre natürlich ziemlich viel arbeit - wenn auch nicht unmöglich.

Vllt. kennt jemand von euch noch andere werkzeuge, die solch einen transparenten proxy-zugriff ermöglichen. Ich werde mal weiter Ausschau halten.

Edith hat noch was gefunden, was ich mir anschauen werde: http://www.linux.com/feature/54894