old blog,

Using Tsocks to tranparently use SOCKS proxies in applications

Izhar Firdaus Izhar Firdaus Follow Support Dec 30, 2006 · 1 min read
Using Tsocks to tranparently use SOCKS proxies in applications
Creative Commons License
This work is licensed under a Creative Commons Attribution 4.0 International License.
There are not many applications out there supports SOCKS proxy for traffics. Usually people will try to find similar application that have SOCKS support if they need it. To Linux/BSD users, there is a dirty trick to do make virtually any console and some X applications to use SOCKS proxy transparently by preloading certain libraries before executing the application. One of those libraries is Tsocks.

Step 1 : Installing
Simply extract the tarball, then, use the magic spell everyone familiar with to install it.
 ./configure
make
sudo make install

Afterwards, create a config file named tsocks.conf in /etc/ . Refer the examples given together with the source tarball for guidance on how to write the config. For those who just want a quick and basic config and lazy to open the examples, I've provided it below.

# This is the configuration for libtsocks (transparent socks)
# Lines beginning with # and blank lines are ignored
#
# This sample configuration shows the simplest (and most common) use of
# tsocks. This is a basic LAN, this machine can access anything on the
# local ethernet (192.168.0.*) but anything else has to use the SOCKS version
# 4 server on the firewall. Further details can be found in the man pages,
# tsocks(8) and tsocks.conf(5) and a more complex example is presented in
# tsocks.conf.complex.example

# We can access 192.168.0.* directly
local = 192.168.0.0/255.255.255.0

# Otherwise we use the server
server = 192.168.0.1


Step 2 : Using the library
To make an application to use tsocks, using a terminal, simply do this
export LD_PRELOAD=/lib/libtsocks.so
before executing the application from the terminal. Note that environment variable export only works on the terminal which you export the value.

Alternatives of Tsocks
Transconnect - A HTTP Proxying library similar to Tsocks.
Proxychains - A similar library which supports both HTTP and SOCKS. Also, its able to chain multiple proxies at once.
Written by Izhar Firdaus Follow Support
I'm a system architect, data engineer and developer advocate with passion in Free / Open Source software, entrepreneurship, community building, education and martial art. I take enjoyment in bridging and bringing together different FOSS technologies to help businesses and organizations utilize IT infrastructure to aid and optimize their business and organizational process.

HOWTO: Building an X-less Azureus Dedicated Box using Fedora

Do you have an old unused box sitting still in the storage without nothing useful to do with it?. Are you a heavy torrent'er? Are you...

In old blog, Dec 29, 2006

« Previous Post

Create your own Pixel Button - No image editing required!!

Do you want a cool pixel button for your blog or website? Don't know how to handle image editing softwares such as GIMP/Photoshop? Or...

In old blog, Dec 31, 2006

Next Post »