the itjerk

my adventures with technology

Monthly Archives: March 2012

dynamic port forwarding with ssh

Need to surf securely at work, or on a public wifi? Here's the poor man's vpn. Using an OpenSSH connection to your host machine with the dynamic "-D" flag, you can create a SOCKS proxy for a web browser on another machine. On a Windows machine, you'll need to use Putty to get your ssh connection.
Here's the connection:

ssh -D port user@hostmachine

Once you connect via ssh to your host, configure Firefox to use the SOCKS proxy server. (Options>Advanced>Network>Connections)

For even more security, you can also configure Firefox to route all its DNS requests through the same tunnel. From Firefox's address bar, type "about:config" for "advanced" settings, then look for the key "network.proxy.socks_remote_dns" and set it to true by double-clicking. Done! All your surfing will tunnel through your host machine.

To verify that everything's working, point Firefox here to verify the IP address matches that of the host machine.