tsocks provides a way to tunnel individual tty sessions or everything on a linux box through a SOCKS 45 proxy. What this enables you to do is use a SSH tunnel to proxy programs and applications through etc..

What do you need?

apt-get install tsocks

edit /etc/tsocks.conf

local = 192.168.0.0/255.255.255.0 server = 127.0.0.1 server_type = 5 server_port = 12345

Here, we assume we have created a dynamic ssh tunnel using lets say the following command:

ssh -D 12345 [email protected]

and we are telling tsocks to pass any traffic destined for the local network normally but anything else, will be ported through our proxy server (ssh tunnel).

To use this on an individual shell session run:

export LD_PRELOAD=/usr/lib/libtsocks.so

To use this system wide (be careful with this) create a file “/etc/ld.so.preload” with the contents:

/usr/lib/libtsocks.so

Super kewl!!

Ohh and heres more on the man page.

Mario Loria is a builder of diverse infrastructure with modern workloads on both bare-metal and cloud platforms. He's traversed roles in system administration, network engineering, and DevOps. You can learn more about him here.