Tunneling HTTP/DNS through SSH (SOCKS 5)

Tunneling HTTP with SOCKS over SSH

If you stay in a hostel, in China 😉 or any other location where you don’t trust your inet connection, you could use an easy way to secure your traffic. Like me, I use a SSH tunnel to one of my servers. You can open a local port and tunnel your traffic through a SOCKS 5 proxy to your SSH server. Here is an example:

ssh -D 8080 -f -C -q -N username@yourserver

This open the localport 8080 with an encrypted (-C) tunnel (-D 8080 and -N) running in background (-f) without any logs (-q). Now you can add in Firefox or Chrome under the proxy settings SOCKS 5 proxy to localhost:8080.

Tunneling DNS over SOCKS 5

In order to activate DNS tunneling in Firefox, you must change a option in the configuration file. Howto:

1. Open about:config as URL
2. Change network.proxy.socks_remote_dns to TRUE

Tunneling any other network connection through SOCKS

I use the tool tsocks to tunnel other traffic like from apt-get or wget through SOCKS. You only have to edit the /etc/tsocks.conf and add your localhost:8080.  You can use it like this:

tsocks apt-get update

Simple and easy 😉

Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert.