I've been fighting with the configuration of a Socks5 proxy in Chromium for about two weeks and now I finally found a solution that is very easy to configure.

First of all. Why I want to send all my traffic over a Socks5 proxy? Simple. Sometimes I'm connecting from a "untrusted" network and I don't want to be worrying if my data is intercepted or not (~~and not for hide the porn traffic to the possible network traffic voyaure~~). I have my VPS with santrex and it's dead easy to open a Socks5 tunnel with ssh, so, why not sending all my brower traffinc through a cyphered  and safe connection?
[ Setting up the Socks5 proxy ]
:::code $ sudo aptitude install autossh
$ ssh-add ~/.ssh/santrex
$ autossh -N -D 30000 inedit@uma -i ~/.ssh/santrex

Why autossh? Because I often change the wifi connection to the wired one and I loose the SSH connections. Autossh establish a new connection as soon as you have Internet again. It's very useful in this cases. With the command "ssh-add" I add my private key to the authentication agent. It ask my password once and I will not have to type my password again. The parameter "-D 30000" specifies the port of the Socks5 proxy. It can be any number higher than 1024. The "-i inedit/.ssh/santrex" is my RSA 2048 bits key, the only access to my VPS.

Ok. Very easy, right?

[Configuring Chromium]

Now we have to configure Chromium. If you go to the obvious place (Menu>Setting>Under the hood>Change proxy settings) a message will be displayed to you saying "I'm using the system configuration of the proxy. You can configure the brower from the CLI and define a proxy setting". Ok, fine. Let's try different stuff:

  • Modify the enviroment variables "http_proxy" and "socks_proxy" and launch chromium. Nothing.
  • Configure the gnome setting trying to configure the proxy ( gsettings set org.gnome.system.proxy.socks host '127.0.0.1' ). Nothing.
  • Using the CLI for lanunching chromium with the parameter  --proxy-server="socks5://127.0.0.1:30000". A bunch of errors.
  • Using the tsocks command that monkey patches de chromium with LD_PRELOAD and tryies to route all the traffic thru a proxy. More ugly errors.

Damn it! Quite complicated, isn't it? The solution, of course,  was an obvius one: a chromium extension! After trying a different proxy extensions Proxy Anywhere worked. Just install the application, and in the configuration set the following options:

  • Protocol: Socks4
  • Host: 127.0.0.1
  • Port: 30000

Click save and we are done.  You will have a new button near to the "Configuration" button, and if you click it you'll activate the proxy. For being sure that the changes have been applied successfully you can open www.whatismyip.com in one tab, and activate the proxy and open this URL again. If the IP addresses does not matches is that everything went OK. Congratulations.

And this is it. Take care.

Note: Ummm...yep it's working with socks4 proxy. I don't know the difference between socks4 and socks5, but now I don't have time to check it out. I'll edit this entry or add another one if I figure out how make it works with socks5.