Is it possible to set up an SSH tunnel with dynamic port forwarding like this:
ssh -D
but do it the other way around? That's to say I want to initiate the connection on my local machine and have the dynamic port forwarding happen there, and have my friend connect his browser to the other end of the tunnel.
The above works perfectly if my friend types the above but I don't want to give him ssh access to my machine, just let him proxy his browser though it.
Reverse SSH solves this issue by simulating an SSH to the remote server. In this case, the remote machine listens on the local computer's network port. It relays SSH connection requests to that port back to itself, which establishes a new connection between the local and remote computers.
Remote port forwarding (reverse tunneling) Also often called SSH reverse tunneling, remote port forwarding redirects the remote server's port to the localhost's port. When remote port forwarding is used, at first, the client connects to the server with SSH.
Users can "sneak through" a firewall by hiding applications inside a SSH tunnel. With SSH Proxy, PAN-OS firewalls can be configured to decrypt SSH traffic and detect when SSH port forwarding is used. The firewall can then be configured to block the SSH tunneling traffic with a security policy.
For openssh, see the -R
switch:
-R [bind_address:]port:host:hostport Specifies that the given port on the remote (server) host is to be forwarded to the given host and port on the local side. This works by allocating a socket to listen to port on the remote side, and whenever a connection is made to this port, the connec‐ tion is forwarded over the secure channel, and a connection is made to host port hostport from the local machine.
Though there may be better solutions, you could create a SOCKS proxy at your friend's computer remotehost
at port 24680 in the following manner. First, do
ssh -R 24680:localhost:12345 remotehost
And then, do
ssh -D 12345 localhost
Obviously, both sessions need to be kept alive simultaneously.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With