Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Following standard online directions, I set up an ssh tunnel at home using putty to access private web pages accessible only on my work network. Fortunately, this just worked; when I sshed into a machine on our private network with the tunneling options set in putty, and set my browser to use the corresponding port on localhost, I could access web pages on our private network.

I am curious how this typically works on the server side. Did someone already set up a proxy server in addition to the ssh server? The following question seems to suggest that this is unnecessary, and that the ssh server already supports http proxy requests: Do I need to have a proxy server to have HTTP over SSH?

How I can investigate on my own to see which http proxy server my traffic is going through?

share|improve this question

1 Answer 1

up vote 2 down vote accepted

The SSHv2 protocol includes functionality for requesting that the server establish a TCP connection and relay data between the client (you) and the given remote host, over your SSH connection. All it cares about is the raw TCP stream.

Your SSH client (i.e. PuTTY or OpenSSH) is able to use this functionality in several ways: in addition to statically configured remote host:port ("local forwarding" or "remote forwarding"), the client is also able to act as a SOCKS 5 server allowing other programs (such as Firefox) to specify where to connect.

To the browser, your SSH program looks like an ordinary SOCKS proxy server. (The SSH server you are connecting to doesn't know all of this – it just acts on the "open a TCP connection to google.com:80" requests. No additional proxy server is involved, either.)

  • web browser ↔ (SOCKS 5) ↔ SSH client ↔ (SSH) ↔ SSH server ↔ (TCP) ↔ web server

Note that the proxy protocol used is SOCKS, not HTTP. In other words, the SSH client doesn't care about HTTP requests – it works at a lower level, relaying raw TCP connections. This also means that any protocol using TCP can be tunneled this way, including mail, HTTP/SSL, and SSH itself.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.