Use SSH for more secure browsing in public networks

In the time of free wifi and free internet connections in every hotel, bar or cafe you should be sure your connections are secure. In some cases you can’t trust the connection but you need to go online and read some mails or share some documents. In this case some basic tools like SSH and Firefox can help you to build an secure connection to an known computer in the internet you can trust (for example your own root server).

To make more clear what I am talking about i created this small diagram to make it more easy for me to explain what I am doing with this SSH connection and how I can benefit from it.

SSH browsing diagram

Let’s say I am connected with an public network or wifi access point. There are many people around me using the same connection and I don’t know the provider of the network very well. What I can do to get an secure connection is to open an SSH tunnel to my known machine and send all the traffic I am generating with my web browser through this tunnel.

This can be done with a SSH command like this:

ssh -D 8080 username@host

What this command does is explained in the man pages of the ssh command:

-D [bind_address:]port
Specifies a local “dynamic” application-level port forwarding.  This works by allocating a
socket to listen to port on the local side, optionally bound to the specified bind_address.
Whenever a connection is made to this port, the connection is forwarded over the secure chan-
nel, and the application protocol is then used to determine where to connect to from the remote
machine.  Currently the SOCKS4 and SOCKS5 protocols are supported, and ssh will act as a SOCKS
server.  Only root can forward privileged ports.  Dynamic port forwardings can also be speci-
fied in the configuration file.

IPv6 addresses can be specified with an alternative syntax: [bind_address/]port or by enclosing
the address in square brackets.  Only the superuser can forward privileged ports.  By default,
the local port is bound in accordance with the GatewayPorts setting.  However, an explicit
bind_address may be used to bind the connection to a specific address.  The bind_address of
“localhost” indicates that the listening port be bound for local use only, while an empty
address or `*’ indicates that the port should be available from all interfaces.

Now I have a local port (8080) where I can send my traffic trough. Only one thing I need to do now is to reconfigure my Firefox to use this port and connection and be sure DNS requests are sent through this secure connection as well.

Firefox proxy configuration window

Open the about:config page and set the following boolean.

Firefox configuration boolean

If you want a possibility to activate and deactivate this proxy configuration with one click there are several firefox addons for managing proxy configurations like QuickProxy or FoxyProxy.

Another method of securing your browsing is the usage of the Tor network. Tor is a good and well known solution to protect your privacy.

If you are more familiar with server administration you should setup an own vpn server for you.

For example use openvpn to secure your browsing if you are in a non trusted wifi network. The setup is quite simple an takes around 1 hour if your are familiar with configuring and if you have some basic network skills.
A lot of good documentation can be found on the project website of OpenVPN: openvpn.net

One big advantage of the usage of an VPN solution is that you can tunnel your complete traffic no matter from what application to a trusted endpoint and from there to the internet. This is the best solution if you really don’t trust the network and you need to go online with you mail programm, your messenger or your custom application which does not use a encrypted or weak encryption mechanism.

This work, unless otherwise expressly stated, is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License.

One thought on “Use SSH for more secure browsing in public networks

  1. Pingback: » Linuxaria – Everything about GNU/Linux and Open source Use SSH for more secure browsing in public networks

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>