I would like to use OpenSSH to allow port forwarding over two hops, the last hop being connected through a reverse tunnel.
Here is my current setup:
Server B is running sshd on port 10000. Server C is running sshd on port 20000
Client A connects to Server B via "normal" SSH
Server C opens a reverse SSH tunnel to Server B on port 30000
Server B connects to Server C through that reverse tunnel
What I want to do: open a port on Client A that forwards connections from Client A through Server B to Server C (over the reverse SSH tunnel established between Server B and Server C)
Here are the respective commands I'm currently using:
Client A connects to Server B via "normal" SSH:
ClientAHostName $ ssh -p 10000 User@ServerBHostName
Server C opens a reverse SSH tunnel to Server B on port 30000:
ServerCHostName $ ssh -p 10000 -N -R 30000:localhost:20000 User@ServerBHostName
Server B connects to Server C through that reverse tunnel:
ServerBHostName $ ssh -p 30000 User@localhost
The reason I want to do this is so I can control certain services on Server C from Client A through a web browser (using a forwarded port). Due to limitations imposed by the ISPs of Client A and Server C, I cannot connect directly from Server B (or Client A) to Server C, or from Server C to Client A.