Proxytunnel: connect a socket through an HTTP and HTTPs proxy

Translation of the original in Catalan. Read it in: CatalàCastellano

Describing technically what it does

proxytunnel

is quite simple, since all it does is connect the standard input and output through a socket that goes from the client to the server through an HTTP or HTTPs proxy server, supporting several kinds of authentication on the proxy server. Thanks to this simple feature it can be applied in endless places, for example, as a

backend

of

OpenSSH

in order to be able to make SSH connections through an HTTP proxy. Of course the proxy will have to support the CONNECT method. Once it has established the connection with the desired end it publishes a port through which we can connect with a conventional TCP client and send/receive data from the other end of the tunnel. When we work over HTTP proxies these cannot inspect layer 7 contents, otherwise they would notice that the traffic going through is not legitimate; on the other hand, if we make the tunnel over HTTPs this is not a problem, since the data that travels above layer 4 cannot be inspected because it is encrypted. We should also keep in mind that it is usual that, if the CONNECT method, which must be supported by the proxy, is enabled (a rare thing to happen), it will probably be restricted to connecting to remote ports 80, 8080 and 443, at most. So, if what we want is to make an SSH connection, what we have to do is publish the SSH server on one of these ports. If you are interested in applying the SSH connection over HTTP/s proxy solution, I recommend you follow the manual that is on the page:

DAG WIEERS: Tunneling SSH over HTTP(S)

.