Tuesday, March 31, 2009

Using ssh as a SOCKS proxy

SSH makes an awesome socks proxy for tunneling whatever, but particularly web. The nicest way to do it is to create a ~/.ssh/config file with:

host mysocks
dynamicforward 9988
hostname mysocksbox.domain.name
user blah

You can put any options in that config file that are listed in the ssh_config man page. So now all you need to do is
ssh mysocks
and it will set up a listener on local port 9988, traffic forwarded over ssh to mysocksbox.domain.name. You can then use the firefox switchproxy add on or foxyproxy to point to localhost 9988 SOCKS5. You also want to set network.proxy.socks_remote_dns to true in about:config to get DNS to go through the proxy too. Simple!

No comments: