Secure Browsing using SSH
It seems like these days wherever you are (coffee shop, airport, burger joint) you can find a wireless hotspot allowing you free access to roam the Internet without much of a problem. However when surfing using these networks the data is send in plain text and is not safe. Using SSH and SOCKS proxy you can easily encrypt all your web browsing traffic and redirect through your home network (or some other trusted computer).
This howto is targeted for Windows (quick Linux instructions are included towards bottom of this post) and leverages the SSH setup described in my earlier post Securing Windows Remote Desktop with OpenSSH. All the changes are on the Client machine. No changes are required on the machine running SSH server.
Modify Putty configuration on Client
- Open PuTTY
- In the Saved Sessions list click on the name you created during Securing Windows Remote Desktop with OpenSSH
- Click Load
- In the left pane click on + next to connection
- Click on + next to SSH
- Click on Tunnels
- In the Source port field enter 9090 (Note: In PuTTY the source port field looks small but it will still allow you to enter details)
- Leave the Destination field empty
- Select Dynamic radio button
- Click Add (see screenshot)
- Click on Session in the left pane
- Click Save button (Do not click Load again – it discard the tunnel changes you made)
Connect using PuTTY
- Open PuTTY (if not already open)
- In the Saved Sessions list click on the name you created during Securing Windows Remote Desktop with OpenSSH
- Click Load
- Click Open
- The first time you connect you will see a security alert. Click Yes. (see screenshot)
- You will be prompted for username/password
- You should be successfully connected to Computer 1 (i.e SSH server) via SSH. (see screenshot)
Configure Browser proxy
- Open FireFox Options (Tools->Options)
- Click Advanced
- Select Network tab and click on Settings
- Select Manual Proxy configuration
- Under SOCKS Host enter localhost and port 9090 (this has to match the port you entered in your Putty configuration)
- Select SOCKS v5
- Click OK (see screenshot)
You can now browse the Internet via a secure SSH connection. To verify go to http://www.whatismyip.com/ and you should see the external IP address of your home/trusted network. The are some handy FireFox Add-ons to make your life easier.
SwitchProxy Tool – lets you manage and switch between multiple proxy configurations quickly and easily (see screenshot and usage instructions).
Live IP Address – displays your external IP address in Firefox’s status bar. With one quick glance you can verify you are secure browsing (see screenshot).
Updated on 06/15/2009 – DNS Resolution
As a reader has correctly commented below using the above technique the DNS resolution still happens at the local network and not on your trusted network. This can be altered by changing the FireFox configuration.
- Open FireFox
- In the address field enter about:config
- If this is the first time you are accessing FireFox configuration you will see a waring page. Click “I’ll be careful, I promise!” (see screenshot)
- A page displaying list of all FireFox configuration values is displayed.
- Type ‘dns’ (without quotes) in the filter field
- Right click on network.proxy.socks_remote_dns and select Toggle (see screenshot).
- The Status column of the configuration page should now show user set for network.proxy.socks_remote_dns
- Close the FireFox window
The DNS resolution step is optional but is recommended if you are browsing to certain sites that you do not want to be listed on the DNS log of the untrusted network.
Quick Linux (Ubuntu) instructions
To install SSH server open terminal window and type the following command
sudo apt-get install openssh-server
Check if firewall is active
sudo ufw status
If active allow SSH traffic
sudo ufw allow ssh
Follow the instructions here to Setup Port Forwarding on your router.
To connect to the SSH server for secure browsing use the command
ssh -D 9090 username@ip-address-of-ssh-server
4 comments
4 Comments so far







Users of this technique should be aware that this only tunnels the web traffic of the browser sessions and NOT name resolution traffic.
DNS traffic will still be looked up against the users local DNS servers in the plain, so if the users are hoping to not have certain sites relate to them, they should consider a real VPN solution which is capable of tunneling all IP traffic.
I have updated the post and added details on how the FireFox configuration could be changed to handle the DNS resolution on the trusted network.
Very handy, though if I were to have FireFox on my USB key, and I went to an internet cafe (with a quick scan 86 viruses :S)would PuTTY need to be installed or could I just load FireFox from my USB and use it with no extra programs?
Many Thanks,
Patrick Socha
Hi Patrick,
You would need PuTTY but there is a portable version of PuTTY that you can run from your USB key.
-lucidTipster