A Little Off Code, Computers, Photography and Guns

23Mar/090

Socks FTW!

Well, not the fabric-y variety of SOCKS, the proxy variety. My friend Pete mentioned at some point a few weeks ago that I was "doing it the wrong" when I was doing some SSH tunneling to my FreeNAS server.

The original setup involved tunneling port 80 and a few other random ports for things like the web interfaces of the DAAP and UPnP servers. Which was a bit of a pain to add each time I wanted to tunnel the ports on a new computer whether it was my laptop, desktop or workstation. I could save the profile and just use that though it was a pain to be thorough enough to include all the ports I'd need. At the time Pete mentioned something about a SOCKS proxy which I didn't really understand and originally thought it would involve installing new software somewhere which I didn't really want to do at the time.

After a little bit of research later I found that one of the most common SSH servers OpenSSH has a built in SOCKS proxy. This is great because it meant installing no new software or even any new configurations for that matter. In Putty I discovered it was as simple as adding a dynamic port of my choice (1080 is probably best here since it's the default SOCKS proxy port). Once I did this I installed FoxyProxy plugin for firefox and was on my way to a quick and simple proxy to any service I desired on my FreeNAS server.

To do this from a command line is just as simple:

1
ssh -D1080 user@example.com

A quick way to test this is to go to a "what is my IP" site of some variety then connect to the server with the SOCKS proxy enabled and setup your browser with that proxy and reload the page, if your external IP changes to the external IP of the server you just ssh'd into then you've done it.