It’s highly annoying when you are trying to read or download something at a client site only to be denied by their proxy. Luckily there’s a way around it that normally works, and here’s how to set it up in OS X or Linux. 1
Basically, you’re setting up an SSH tunnel between you and your own SSH server on the Internet, and you’re opening a tunnel endpoint on your local system that will serve as the proxy address. Anything sent over that port will be shuttled over the tunnel–invisible to anyone in-between.
There are basically three steps for setup:
- Own an SSH server somewhere on the Internet (else, fail)
- Set up your local proxy (which points to your SSH server)
- Configure your browser to use that proxy
Step one is out of scope here, so let’s move on to step 2.
# set up your SSH tunnel on the local system
ssh -ND 8082 firstname.lastname@example.org
-N tells it not to execute remote commands, and the
-D is where the *dynamic* port forwarding happens. The number listed there is the port that will listen locally that you’ll connect to to get out.
My preferred browser is Google Chrome, and my favorite extension for proxy modification is Proxy Switchy. I set up Proxy Switchy to use just one protocol, which is Socks Version 4 as shown in the screenshot below:
That’s it. Activate that proxy from within Proxy Switchy and now you’re browsing the Internet over SSH. If it seems too good to be true, SSH to your server and use
tcpdump to watch the HTTP leave your box. ::
[ As someone pointed out in the comments, you have to be able to SSH out of the network for this to work. This is true, but this is often the case–especially if your SSH server listens on a port other than 22. ]
1 This guide assumes you have permission from the network owner to bypass the proxy.