Sunday, September 14, 2008

Using SSH as a Socks Proxy (dynamic application-level port forwarding).


Now that you know how to have FireFox do DNS lookups instead of your PC when using a Socks Proxy, let's show you how to setup a Socks Proxy with SSH.

First some background with what the man page for ssh states for dynamic application-level port forwarding (the -D option):

"Whenever a connection is made to this port, the connection is forwarded over the secure channel, 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."


#ssh -D port -g remoteserver

I.E

#ssh -D 15200 -g www.commandlineisking.com

That's it, now your workstation will listen on port 15200. The -g makes the service available over the network for other clients not just the loopback adapter.

To do the same with a putty client:




Now point your browser to the Socks Server 'localhost' like so:



Also note that if you used the -g option, your may also point a different workstation to your workstation and "share" the proxy.

0 comments: