Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 971
Jay Somedon Avatar asked Aug 18 '16 03:08

Jay Somedon


People also ask

What are the 3 types of SSH tunneling?

Transporting arbitrary data streams over SSH sessions is also known as SSH tunneling. OpenSSH, a popular open-source SSH server, supports three types of tunneling features- local port forwarding, remote port forwarding, and dynamic port forwarding.

Is SSH a SOCKS5?

The ssh command provides the -D option in order to create a proxy. The default proxy type is Sock5. Socks5 is a type of HTTP proxy. Also, the local port number should be specified which is listened to on the client system.

What is a SSH tunneling?

SSH tunneling, or SSH port forwarding, is a method of transporting arbitrary data over an encrypted SSH connection. SSH tunnels allow connections made to a local port (that is, to a port on your own desktop) to be forwarded to a remote machine via a secure channel.

Is SSH tunnel a proxy?

A special case of the forward TCP tunnels is the Socks proxy capability. Using these options, the SSH client listens on a specified binding port and acts as a SOCKS 4 or 5 proxy server. Note that we don't even need to specify the destination host and port for the forwarding in this case.


1 Answers

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.

like image 142
Jakuje Avatar answered Sep 24 '22 01:09

Jakuje