April 12, 2020

Make a SOCKS5 Proxy with SSH Tunnelling

Make a SOCKS5 Proxy with SSH Tunnelling

If you're tired of turning your VPN on and off to reach restricted machines, or perhaps the country you are located in is blocking your VPN solution, fear not, SSH to the rescue once again!

We can create an ssh tunnel to another machine, point a browser there and have an encrypted tunnel into that network to proxy our browser traffic. Best of all, it's super easy to do as well!

First we need to create the tunnel to the computer we want to use as our proxy.
The below creates our tunnel and then sends any traffic sent to local port 8888 through it.

ssh -D 8888 user@computer.domain.tld

Replace user with your username
Replace computer.domain.tld with your machines details.

So yours might look like this

ssh -D 8888 fred@boulder.flintstone.com

Optionally you can use just about any port you like as well, but bear in mind if you want to use privileged ports you will need to run as root.

With our tunnel up and running all that is left to do is point our browser there.
I'm going to demo with Firefox but this will work with any browser.

In Firefox Preferences, in the General tab, click 'Settings' under the Network Settings section, which will give you the Connection Settings Dialog.

In the Connection Settings dialog, choose 'Manual proxy configuration' and then in the SOCKS Host section put: 127.0.0.1  and Port: 8888. Finally, don't forget to make sure that the SOCKS v5 radio button is ticked as well.

That's it! Hit ok to save your new settings and you're done.