Friday, August 1, 2008

Fixing tsocks 1.8 Beta

I was trying to use tsocks 1.8 beta5 on Fedora 8. After installing
I was able to use it. But, on next day, what I found is: I was not
able to access any website, messenger service. Although, I was
able to ping websites. Then I realized the tsocks is interfering
with direct connection to Internet. I was not using ssh tunnel at
that moment.

I have created patch for Makefile and tsocks script.

$ vi patch_Makefile

5c5

< prefix=/usr

---

> prefix=/usr/local

9c9

< libdir = /lib

---

> libdir = ${prefix}/lib

31c31

< CFLAGS = -g -O2 -Wall

---

> CFLAGS = -O3 -Wall



$ vi patch_tsocks
6c6

< # /usr/bin/tsocks program [program arguments...]

---

> # $PREFIX/bin/tsocks program [program arguments...]

13c13

< # /usr/bin/tsocks telnet www.foo.org

---

> # $PREFIX/bin/tsocks telnet www.foo.org

20c20

< # . /usr/bin/tsocks on

---

> # . $PREFIX/bin/tsocks on

22c22

< # . /usr/bin/tsocks off

---

> # . $PREFIX/bin/tsocks off

26c26

< # source /usr/bin/tsocks on

---

> # source $PREFIX/bin/tsocks on

28c28

< # source /usr/bin/tsocks off

---

> # source $PREFIX/bin/tsocks off

33c33

< # /usr/bin/tsocks

---

> # $PREFIX/bin/tsocks

39a40,41

> PREFIX="/usr/local"

>

49c51

< export LD_PRELOAD="/usr/lib/libtsocks.so"

---

> export LD_PRELOAD="$PREFIX/lib/libtsocks.so"

51,52c53,54

< echo $LD_PRELOAD | grep -q "/usr/lib/libtsocks\.so" || \

< export LD_PRELOAD="/usr/lib/libtsocks.so $LD_PRELOAD"

---

> echo $LD_PRELOAD | grep -q "$PREFIX/lib/libtsocks\.so" || \

> export LD_PRELOAD="$PREFIX/lib/libtsocks.so $LD_PRELOAD"

56c58

< export LD_PRELOAD=`echo -n $LD_PRELOAD | sed 's/\/usr\/lib\/libtsocks.so \?//'`

---

> export LD_PRELOAD=`echo -n $LD_PRELOAD | sed 's/\$PREFIX\/lib\/libtsocks.so \?//'`

71c73

< export LD_PRELOAD="/usr/lib/libtsocks.so"

---

> export LD_PRELOAD="$PREFIX/lib/libtsocks.so"

73,74c75,76

< echo $LD_PRELOAD | grep -q "/usr/lib/libtsocks\.so" || \

< export LD_PRELOAD="/usr/lib/libtsocks.so $LD_PRELOAD"

---

> echo $LD_PRELOAD | grep -q "$PREFIX/lib/libtsocks\.so" || \

> export LD_PRELOAD="$PREFIX/lib/libtsocks.so $LD_PRELOAD"


How to apply patch and install tsocks?

$ tar -zxvf tsocks-1.8beta5.tar.gz


$ cd tsocks-1.8


$ ./configure


$ patch Makefile < patch_Makefile

$ patch tsocks < patch_tsocks


$ make


$ sudo make install


PS: If you do not find patches working, please mail me
at mitesh[dot]singh[dot]jat[at]gmail[dot]com . I will
send both patches to you.

No comments: