0

How can I reverse SHH tunnel all ports on a remote server so any requests made by the remote server go through the client?

E.g.

client ssh into server 
server requests google.com
request goes from the server to the client over ssh then out to google.com
google.com responds to client which is forward to server over ssh tunnel

I want to do this for all ports, and both internet and LAN connections. It doesn't have to be permanent, just while the ssh connection is open.

Petah
  • 1,796
  • 2
  • 15
  • 22
  • What? you write "client ssh into server " what client? the web browser? or ssh.exe? what server? the ssh server? or an http proxy? I guess maybe you mean web browser client. You write "server requests google.com" what server? the ssh server? the web server? the http proxy server? I guess you mean http proxy server. but then the web browser makes the request.. before the http proxy server does. And what is reverse about what you describe? Do you mean the web browser is on the computer with the ssh server? and the http proxy is on the client side? – barlop Mar 10 '15 at 21:07
  • If you are asking how to make a reverse http proxy.. that's answered on superuser already. http://superuser.com/questions/370930/ssh-reverse-socks-tunnel it involves two ssh tunnels, according to one answer anyway – barlop Mar 10 '15 at 21:10
  • @barlop the client is a ssh.exe running on workstation. The server is an sshd server. I am not talking only about HTTP, but all ports/applications. – Petah Mar 10 '15 at 21:11
  • well the thing is that you can't do just any application. There is SSH -L , -R and -D. If you do -L then it forwards to a particular server only e.g. say you have a VNC server ip 5.6.7.8 it will forward to that, but you can't then suddenly decide to forward to IP 9.10.11.12 An HTTP Proxy lets the web client specify the destination server to forward to at each request. SSH -D is SOCKS it supports a bunch of protocols(I guess ones that are socks compatible or something), including http proxy but not absolutely any protocol. – barlop Mar 10 '15 at 21:14
  • And by the way, why should the ssh server make a request to google.com?! unless a blah client connected to a port sshd opened up and made the request, and sshd is just forwarding it, it's not making the request really, it's listening and forwarding it to the ssh client side, and that is then forwarding it on to the web or whatever server. – barlop Mar 10 '15 at 21:17
  • ssh -L or -R can do any protocol but the server it forwards to is set when the tunnel is made. otherwise you're using -D which can forward to any server at each request, but is SOCKS only. – barlop Mar 10 '15 at 21:19

0 Answers0