Home > Software Developement > Making Google Chrome Work With a SOCKS5 proxy (i.e. putty ssh tunnel)

Making Google Chrome Work With a SOCKS5 proxy (i.e. putty ssh tunnel)

I really like chrome, but something that is an absolute must is a SOCKS5 proxy.  This is due to my ultra restrictive corporate firewall, i need to tunnel http content through an ssh tunnel.  And ssh creates a SOCKS5 proxy when you use the -D option.  Chrome seems like it assumes that your proxy is SOCKS4.x and just fails on the ssh tunnel proxy.  But there is hope, i found a way to work around this and it isn’t even complicated!

Just a quick note, i actually use a plugin from chrome called Switchy! which helps me quickly switch to and from the ssh tunnel proxy.  It is certainly no foxyproxy, but it works well enough that i can use it to solve most proxy related problems.

Now, the secret to this solution is to use Proxy Auto Configuration scripts.  These scripts allow you to specify which version of SOCKS to use for your proxy.  So all you need to do is create a file somewhere on your computer (say called pac-ssh-tunnel.pac) and then add the following to it:

function FindProxyForURL(url, host)
{
   return "SOCKS5 localhost:8080";
}

Now, take note that i am creating the ssh tunnel proxy using the following command:

ssh -N -g -D 8080 username@remote_server

Just FYI, “-N” means don’t execute any commands on the server (i.e. strictly a tunnel connection only).  And “-g” allows the remote host to connect to locally forwarded ports (which i must admit, most people will never need this, but handy if you do complex tunneling of data).   Finally, “-D 8080″ means dynamically forward the proxy data through local port 8080.

So once you have your SSH SOCKS5 tunnel up and running, set chrome to use your proxy automatic configuration script that you created (either through chrome’s options, or through Switchy! if you prefer).  Now you can proxy traffic over your ssh tunnel.

One final note, PAC files are basically javascript files (with a few built-in functions).  You can actually create some complicated PAC files that do all your complex proxy selection for you (basically a lot of regular expression matching).  So if you get adventurous, you can just add all your proxy selection logic to that one function (or break it into multiple functions) and then you won’t even need to change your proxy around ever!

Happy surfing!

, , , , , , ,

Comments:6

Leave a Reply
  1. scoundrel 10/02/01
  2. admin 10/02/07

    Apparently 4.0.249.86 has this problem fixed by using the –proxy-server command line paramater. I will have to grab the latest beta and see if this does in fact work…

  3. Utnnyan 10/03/04

    Tried all the latest builds and the -proxy-server command does not work.

  4. admin 10/03/04

    this is the source for the verified fix: http://code.google.com/p/chromium/issues/detail?id=29914

    Also note that wordpress mangled the flag, it is dash-dash-proxy-server, that is two dashes followed by the proxy-server flag.

    and just as an FYI, i still don’t use this flag, i just use the pac file. This is mostly because switchy can’t override DNS proxies and my work firewall is crazy restrictive.

  5. liedele 11/11/04

    Thanks a Ton, I’d been trying to get chrome to work like fox with foxyproxy since I got it.
    This works great.

  6. Zac 12/02/09

    This is no longer needed. Chrome now supports SOCKS.

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>

Trackbacks:0

Listed below are links to weblogs that reference
Making Google Chrome Work With a SOCKS5 proxy (i.e. putty ssh tunnel) from ErrorOK
TOP