Tuesday, November 13, 2007

Fun with LD_PRELOAD, libtsocks and Tor

I`m getting some troubles during the finals in UTP. Due to some of my sadistical slapstick joke.. regardless that i found it`s quite annoying as there are no compiz-manager for compiz fusion for ubuntu gutsy. So i prepare myself to download from gits and found out that :


Sigh .. owh well looks like we need to look around a little bit.. Kagesenshi mention it to me that we can sockcified the connection using tor. But wait a minute gits doesn`t support sockcification by default!!
So we must find a way to wrap non socks aware program into it.

Hence after googling around we can use LD_PRELOAD enviromental variable with tsocks library.
Taken from both sites:

Tsocks:

Tsocks' role is to allow these non SOCKS aware applications (e.g telnet, ssh, ftp etc) to use SOCKS without any modification. It does this by intercepting the calls that applications make to establish network connections and negotating them through a SOCKS server as necessary.

LD_PRELOAD:

LD_PRELOAD is an environment variable that affects the runtime linker. It allows you to put a dynamic object, that will create some sort
of a buffer layer, between the application references and the dependencies. It also grants you the possibility of linking with the
application and relocating symbols/references.

Install tor and tsocks respectively from your repository or compile from source (ubuntu apt-get install tor tsocks or fedora yum install tor tsocks

Next step is taken to configure /etc/tsocks.conf something like this

#Local-Address local = 165.0.0.0/255.255.255.0 # Otherwise we use the server server = 127.0.0.1 server_port = 9050


Done now let`s test our connection.


More info on LD_PRELOAD : http://neworder.box.sk/newsread.php?newsid=13857

2 comments:

azwan082 said...

fedora got tor package, but don't have tsocks package

<~!@#> said...

http://tsocks.sourceforge.net/index.php


So get it and compile yerself mofo :p