How to surf safely on open Wi-Fi networks

We live in a world in which there are more and more places where free Wi-Fi and free internet connection are offered. In each hotel, bar or café you have to make sure that these connections are secure, since they are usually open wifis, without any protectionIn those cases, the connection is not secure, but of course, you still have the need to connect and read your emails or share some of your documents. ¿What to do: Do you expose yourself to a possible theft of information or do you not connect directly? Is there another alternative? Yes, create an SSH tunnel.


There are some basic tools like SSH and Firefox (or almost any other Internet browser) that can help you build a secure connection to a computer you trust on the Internet (for example, your own root server).

To be clear: let's say you're connected to a public network or Wi-Fi hotspot. There are many people around you with the same connection and you don't know anything about who the network provider is. What can you do to get a secure connection? Open what is called an SSH tunnel to a known machine (generally a distant machine that you own) and send all the traffic that you are generating with your web browser through this tunnel.

It is possible to do this with the following ssh command:

ssh -N -f -D 8080 username @ remote_ssh_server

Where username is the username with which you usually connect via SSH to that machine and remote_ssh_server is the IP or name of the remote machine. I recommend you do man ssh to find more information about this command.

What the above command does is open port 8080 on our local machine (127.0.0.1) where it will listen to all the requests for browsing websites and send them to the remote machine. Then the remote machine will forward all the packets to the Internet as if they were coming from there. Therefore the public IP of our browser is the remote server and not the machine from which we navigate.

This sounds like Chinese means that you have just enabled a port on your machine (in the example, 8080) to send and receive your web traffic safely.

All that remains is to configure Firefox or your preferred web browser to use that port and ensure that all DNS requirements are also funneled through this secure connection. We are going to Edit> Preferences> Advanced> Network> Connection> Configuration. Once there, configure the new SOCKS proxy.

To configure DNS requirements, I typed about: config in the Firefox address bar and look for the following variable. Double click on it to change it to true.

network.proxy.socks_remote_dns; default boolean true

To easily enable / disable the use of this proxy you can download extensions for Firefox such as QuickProxy o FoxyProxy.

To close the port, you just have to kill the ssh process started with the command indicated at the beginning of this post. Every time you want to start a secure connection you have to run that ssh command, introducing the variants that suit your tastes and needs (the port can be different, you can pass the -C parameter to it so that it compresses all the information, etc.)

This method does not encrypt the services of MSN, Skype, or similar if we have not previously configured in these programs the use of a proxy server. To encrypt absolutely EVERYTHING, including these services, you have to create a virtual private network using openVPN.

Source: linuxaria & Sun Wiki


Add as preferred source