When I on an open wifi hotspot and I want to secure my web traffic, one option I’ve used is an ssh socks tunnel. What you do is connect to a system with internet accessible ssh, like a machine at your home or a hosted computer, then you set up a socks proxy to tunnel your traffic through. Here I don’t cover how to set up an ssh host to connect to, I assume you already have a system you can ssh to. I just cover how to connect to that system.
Again, the steps are:
- ssh to a remote system using the bind option
- configure your system to use the ssh tunnel as a proxy for your network traffic
Somebody Set us up the Tunnel!
To establish a tunnel with the ssh host you will ssh into the system while using the “-D” option to bind the tunnel to a local network port. If your ssh account name was “bob” and the host was at address “example.grivet-tools.com” the command would look like:
ssh -D 2001 firstname.lastname@example.org
The port 2001 on your local computer will now relay any traffic pointed to it through the ssh link. Port 2001 here is arbitrary. I’m only using it here because it is the port I learned to use, so it is the port I’m passing along. It can, however, be any valid network port number.
Use the Tunnel
- System Preferences -> Network
- Pick your active network interface
- Click Advanced
- Select Proxies
- Select “SOCKS Proxy”
- Set server to “localhost”
- Set port to “2001”
- Check the box next to “SOCKS Proxy”
- Click OK
Congratulations! You are now tunneling your web traffic through the ssh tunnel. To turn this off, you will go back to the proxy settings and uncheck the box next to “SOCKS Proxy”. Once you have done that, you can exit out of your ssh tunnel and go back to working normally on your system.
Interested In A Free Installer?
Our custom Wifi On/Off script has been a popular post!
This script automatically turns off the wireless interface on a computer when it is connected to a wired network, and turn the wireless interface back on when it is disconnected from the wired network.
This script has two main benefits:
- Network connection failover
- Eliminates unnecessary wireless traffic, and Multi-homed computers.