SSH proxy

From Urandom
Jump to navigation Jump to search

Creating the ssh tunnel

* I use this script to maintain a ssh tunnel. I use it on public WIFI or at work, this way nobody can see what you are doing on the net, because all the traffic is directed throught the SSH tunnel to your server
while [ 0 -le 1 ]
netstat -l --numeric | grep 8080 | grep -q 127 || ssh -f -C -N -D8080 &
sleep 5
* Create endless loop that sleeps every 5 seconds.
* Check weather the port is listening on localhost
* If not start the ssh tunnel

Using with tsocks

* Install tsocks and configure /etc/tsocks.conf
local =
local =
local =

server =
# Server type defaults to 4 so we need to specify it as 5 for this one
server_type = 5
# The port defaults to 1080 but I've stated it here for clarity 
server_port = 8080

* in local define the IPs that you dont want to go through a proxy, usually your local network
* server must be your localhost, because the tunnel listens on your machine not the ssh server.

Now simply run tsocks firefox to use the proxy, you can of course make the program use proxyes themselves without tsocks but I found it to be convenient.