How-To: Route internet traffic through an SSH Proxy
Say you’re out somewhere (a wi-fi hotspot) for example, and you either want to access a site that’s blocked or you want a little more security, you can create a SSH tunnel from your computer to a remote computer. If you don’t have a UNIX box at home that you can connect to, a web hosting account works great! Here’s how to do it the quick an easy way, with a GUI, and then a different, slightly more complicated way.
The Quick and Easy, Automated Way:
- Download a free utility called SSHTunnel
- Fill in your SSH account info in the ‘Servers’ tab (note: SSH usually connects over port 22)
- Go back to sessions, and select either Ethernet or Airport proxy (depending on your connection), select your server, and click on.
- That’s it! SSH will turn on, and all internet traffic will be routed through the remote SSH host via an encrypted tunnel. (Note: SSH internet tunnel usage will probably count against your monthly hosting bandwidth - so, be careful!)
The More Advanced GUI Way (A little complicated, and unnecessary):
- Use SSH Tunnel Manager
- Setup your server, and enable it (see below for more) – For this technique, you have to set up each and every port redirect (HTTP, for example, is usually over port 80)
- Setup your SOCKS proxy (see below)
- Browse away!
The Down and Dirty CLI Way:
- Open up the Terminal, and type ’ssh -ND 9999 user@host.com’ (9999 is the local port to be forwarded – you can use whatever as long as its not already in use)
- Enter your password when prompted (or set up SSH key exchange for password-less access)
- It will look as if nothing has happened – the ‘-n’ flag cancels the SSH interactive prompt
- Go into your browser, and enter the just setup SSH proxy info (Safari uses system proxies, FireFox has its own settings) – Select SOCKS proxy, and enter ‘localhost’ as the server and ‘9999′ as the port
- Browse away!
For more, check out these posts:
- http://lifehacker.com/software/ssh/geek-to-live–encrypt-your-web-browsing-session-with-an-ssh-socks-proxy-237227.php
- http://paulstamatiou.com/2008/05/16/how-to-surf-securely-with-ssh-tunnel
