Categories
Windows 7

setting up putty to be used as a socks5 proxy over ssh

This was taken from: http://www.ocf.berkeley.edu/~xuanluo/sshproxywin.html

I am posting this for my own knowledge, just incase that site ever goes down.

Run PuTTY. It starts in the “Session” screen; fill in the settings for your SSH connection. The fields “Host Name” and “Port” are pretty self-explanatory. You can enter the username too by filling the “Host Name” field in the “user@host” format. Make sure “SSH” is selected in “Connection type:”.
Go to the “Connection” -> “SSH” -> “Tunnels” screen to configure our tunnel.
Under “Add new forwarded port:”, enter some big integer of your choice to enter for the “Source port” field. (The first thousand or so ports are sometimes reserved by the operating system; so pick something bigger.) Here I will use arbitrarily choose 1080 (the SOCKS port).
Leave the “Destination” field blank.
Select the “Dynamic” radio button.
Click the “Add” button. You should see a line in the text box that reads “D1080” (or whatever number you chose).
(For those interested, this is the “-D” option in OpenSSH.)
(Optional:) By default the a login session is opened in the terminal, which usually runs a “shell”, allowing you to run commands on the command line on the remote computer. If you absolutely do not wish to use this, you may be able to disable it via the following:
Go to the “Connection” -> “SSH” screen.
Check the “Don’t start a shell or command at all” box.
(For those interested, this is the “-N” option in OpenSSH.)
(Optional:) At this point, it is a good idea to create a saved session, so you do not have to go through this process every time. If you wish to do so, go back to the “Session” screen; enter a name for the session and click “Save”.
Now you can open the connection. Click the “Open” button at the bottom.
The session window will open. If this is your first time connecting, it will ask you to add the key; “yes” is recommended. Enter the password when prompted. (You may also set it up to authenticate using public key instead of password, but that is beyond the scope of this tutorial.)
The login session is now connected. As long as the session is open, you will now have a SOCKS proxy running on on the local computer (localhost) at port 1080 (or whatever port you chose).

Example: Mozilla Firefox browser
Go to “Tools” menu -> “Options”
Go to “Advanced” screen -> “Network” tab
In the “Connection” section, click the “Settings…” button
Select the “Manual proxy configuration” radio button
Make sure “Use this proxy server for all protocols” is unchecked
Make sure the “HTTP Proxy”, “SSL Proxy”, “FTP Proxy”, “Gopher Proxy” fields are cleared
For “SOCKS Host”, enter “127.0.0.1”, and for “Port” enter 1080 (or whatever port you chose)
Select the “SOCKS v5” radio button
Click OK. Click OK.
Preventing DNS leaks is supported in Firefox 1.5.0.2 and above. Do the following:
Go to the URL “about:config”
Find the setting “network.proxy.socks_remote_dns” and set it to “true”
Example: Internet Explorer browser
Go to “Tools” menu -> “Internet Options”
Go to “Connections” tab
Click the “LAN Settings” button
In the “Proxy server” section, make sure the “Use a proxy server for your LAN…” box is checked
Click the “Advanced” button
Make sure “Use the same proxy server for all protocols” is unchecked
Make sure the “HTTP”, “Secure”, “FTP” fields are cleared
For “Socks”, enter “127.0.0.1” as the address, and for “Port” enter 1080 (or whatever port you chose)
Click OK. Click OK. Click OK.
I don’t know of any built-in support for preventing DNS leaks

I take ZERO credit for this writeup, again, this is just for my knowledge if I need to reference it again.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.