Posts Tagged ‘ssh’

Quick encrypt for your coffee shop traffic.

Monday, May 16th, 2011

Just a little function to add to your .profile that automatically turns on a socks proxy and tunnels all your traffic through the server of your choice. It’s a simple setup and <CTRL>-C kills the connection and shuts off the proxy. This assumes that you have shell access to some server that you trust to run your traffic through.

I recommend setting up public key authentication for ease of use.

# warm feet
function socks() { 
  networksetup -setsocksfirewallproxy AirPort localhost 9999
  ssh -ND 9999 -C username@domain
  networksetup -setsocksfirewallproxystate AirPort off
}

(One caveat: If you happen to close the window of your terminal without hitting <CTRL>-C first, it will not disable the socks proxy.)