I am trying to configure a machine, B, as a proxy which means that incoming ssh connections get silently redirected to another host, for example C. As the guy who initiates the connection all I have is the IP address of B, nothing else, the redirection to C should automatically be handled, so that I just end up at machine C without even noticing the hop in between.
A ---> B ---> C
A few things to note:
- Host B and C are in the same network.
- There can be multiple endpoint hosts aside from C. Imagine D, E, F .. etc
- In a later stage I need to implement a forwarding logic, aka the endpoint C can change depending on who initiates the connection. So be should be able to decide where the connection should be forwarded to, depending on who initiated the connection. For example if Person X connects to B he might get forwarded to C while Person Y gets redirected to D when connecting to B.
- All machines run Linux
I know about the basics with local and remote portforwarding with SSH, however I am not sure if thats the right approach. I was thinking of some service who waits for incoming SSH connection, checks where they come from and then performs the redirect to the endpoint. How do I do that? What tools to use? Just normal ssh? Can someone provide me a basic example for my scenario?