Friday 4 October 2019

networking - SSH Reverse socks tunnel


ssh -D can make a socks port at local machine, which pass the traffic to the remote, then to other places.


ssh -L port:host:hostport, listen port at local machine, pass the traffic to "host:hostport" from the point of view of the remote machine.


ssh -R port:host:hostport is the counterpart of ssh -L, which listen port at remote machine, and pass the traffic to "host:hostport" from the point of view of the local machine.


But what is the counterpart of ssh -D, i.e., how to open a socks port at remote machine, which will pass the traffic to the local, then to other places?



Answer



With -D & -L you have a way to communicate either way between the two machines.


So...



  • From the local machine, use -R to create a listening port on the remote machine pointed at the local machine's sshd.

  • Use -D on the remote machine, pointed at the port you created above.


I "think" filling in the below will make it work...


ssh remotehost -R remoteport:localhost:localport "ssh -D 9050 localhost -p remoteport"


'remotehost', 'remoteport' & 'localport' in the above need changing. A socks proxy will be formed on 9050.


No comments:

Post a Comment

How can I VLOOKUP in multiple Excel documents?

I am trying to VLOOKUP reference data with around 400 seperate Excel files. Is it possible to do this in a quick way rather than doing it m...