socks proxy

SSH as SOCKs 5 proxy

Let’s say, for example, that “someone” is traffic shaping our peer 2 peer connections or eavesdropping traffic in general, blocking myfavoritesite.net or any other domain/service… Here’s a really cool antidote: SSH proxy. I think it’s a really nice gesture to give someone the access on something that’s been blocked without his permission.

To use ssh as a proxy you need to set up first The ssh server on the server machine and the ssh client on you desktop (if it’s not already installed).

  1. How to setup an ssh server
  2. How to secure your ssh server

Create the tunnel


We need an encrypted tunnel from our client and all the way to the server so no one can spy our actions between this segment. We’re going to target our traffic to a local port, on the local machine, and the data will be “guided” to the server and the server will forward this traffic to the open internet. The segment between our server and the internet is unencrypted of course.

through terminal


Run the command below to your terminal. Assuming that your ssh server runs on port 22(which is a bad idea :P ) …

or for a non default port use -p port

Options explained:

  • C = Compression
  • 2 = Ssh version 2 only
  • q = Quite mode, no messages will prompt the user
  • T = Disable pseudo-tty allocation.
  • n = Prevents reading from stdin. (Because it will run on the background).
  • N = Do not execute remote command.
  • D = “dynamic” application-level port forwarding so ssh can act as SOCKS server.
  • -p = defines ssh’s server port.

through GUI


For GUI there is an ssh tunnel manager named gSTM follow the instructions below to install and configure.

1. Install it.

2Run it. (Internet->gSTM)

3. Add new tunnel.

1. gSTM create tunnel
1. gSTM create tunnel

4. Configure new tunnel.

2. gSTM configure tunnel
2. gSTM configure tunnel

5. Start the new tunnel from the main screen.

Note: you will be prompted for user password.

Configure Firefox

  1. Open FF
  2. Install addon named “proxy selector”
  3. Go to Tools->Proxy Selector-> Manage Proxies->Add
  4. give it a name myTunnel
  5. hostname for SOCKs = localhost
  6. port for SOCKs = the local port we forwarded with ssh to the server
  7. open new tab and write to the address bar “about:config” (and say to FF that you’re a good boy)
  8. find “network.proxy.socks_remote_dns=FALSE” and set it to TRUE (thnx to @4li3n)
firefox-proxy-selector1
Firefox Proxy Configuration with proxy selector
Firefox configuration network proxy socks remote dns
Firefox configuration network.proxy.socks_remote_dns=True

Series Navigation<< How to setup SSH – Install SSH server and clientLinux user account with ssh-only permissions >>

1 thought on “SSH as SOCKs 5 proxy”

Comment:

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