SSH is a powerful tool, and PuTTY is by far my preferred SSH client on Windows. Using SSH, you can use an SSH server as a proxy for any application that will allow you to use a SOCKS-type proxy. Of course, there are a lot of other tunnel types that SSH will allow you to do (X forwarding, remote to local, local to remote, etc), but this type of tunneling is especially useful. I’m posting this mainly because there isn’t a whole lot of documentation out there about this particular topic, and the stuff that did exist wasn’t so clear when I first started using this a few years ago. Without further ado…
Dynamic Proxy Using PuTTY
- An SSH server that you can login to, and that supports TCP forwarding. By default, OpenSSH ships with TCP forwarding enabled.
- Download PuTTY, and execute it
- When you open it, on the left side, expand “SSH”, and select “Tunnels”. The screen should look something like so:
- Pick a port between 1025 and 65535. We will refer to this as “X”.
- Under source port, select “Dynamic”, enter “X”, and then enter “myservername:X” under destination. Click on “Add”, and “D X” should appear under ‘forwarded ports’.
- Next, select “Session on the left side. Set hostname to ‘myservername’. Click ‘Open’ to login to the server. Enter your username and password, and as long as the window is open and you’re logged in, the dynamic proxy will be open. You can tell your applications to use ‘localhost:X’ as the SOCKS proxy server to use, and it should work nicely.
Configuring network applications to actually use the proxy is beyond the scope of this document, but its pretty straightforward if there is an option to use such a proxy. Also, this can also be done on Linux/Unix using a commandline SSH client as well, refer to the documentation on how that works.