Possible Duplicate:
SSH and port forward socks proxy
When I set up a tunnel using dynamic forwarding (ssh -D), which side is running the SOCKS proxy? That is, is the proxy running on the local end (client) or the remote end (server)?
Here's the situation: I want to set up several tunnels chained together using -L
. Should the -D
tunnel be the last one in the chain or the first one?
Edit: I found the answer to the second paragraph on Super User (the -D
tunnel should be at the remotest end). But I'd still like to know where the proxy code is running.
A quick perusal of the OpenSSH sources reveals:
The local
ssh
client handles-D
very simply, just like all other forwarding sockets: listen locally, push over a channel to the server.The remote
sshd
server handles all the proxying involved withSSH_CHANNEL_DYNAMIC
, including decoding SOCKS headers, making outbound connections, and multiplexing the data.