Search code examples
sshproxyopensshsocks

Are "SOCKS5 proxying" and "ssh tunneling" same thing?


  1. I know that I can run a socks5 proxy by ssh -D some-port-number remote-server-url.
  2. I know that I can configure my applications (for example firefox) to use socks5 proxy (often by specifying something like socks5://localhost:that-port-number-metioned-above).
  3. I hear people online referring to this technique as "socks5 proxy" or "ssh tunneling"; sometimes I even see people talking about "reverse ssh tunnling".
  4. But as far as I know socks5 and ssh are totally different protocols, the only similarity between them is that they both have server-client architecture. Reading wiki definitions and googling on these concepts didn't clarify my confusion..

So how are these concepts -- SOCKS5 proxying, ssh tunneling, reverse ssh tunneling related with each other?


Solution

  • What you describe is a SOCKS proxy. It is standalone protocol used by various tools. What openssh does it to tunnel this protocol encrypted from one point to the other. But more precisely, it is called TCP port forwarding (it forwards one port from client through the secure tunnel to the server).

    There are other possibilities to use TCP port forwarding in openssh using -L and -R switches that are correctly named Local ("brings" remote service to local host) and Remote (makes local service accessible from remote host).

    As you can see, there are similarities, but they are implemented in different way. All of them are TCP port forwarding (through secure tunnel). The Dynamic (-D) special, because the server have to understand the SOCKS protocol.