ssh gateway which can proxy to upstream servers based on user name?
Every user has a dedicated machine, but is not exposed to the outside world. The 'gateway' is the only system that is exposed.
The user has no idea of this setup. He just does
ssh username@gateway
which should be equivalent to ssh [email protected]
.
Can we configure a gateway sshd with which we can achieve this? Each machine has a single user. So, there can't be any confusion in determining the upstream server.
Solution 1:
Setting up
Match group proxyUsers
ForceCommand /bin/connect_to_user_machine
and having /bin/connect_to_user_machine
#!/bin/bash
ssh $USER@$USER.internal $SSH_ORIGINAL_COMMAND
will do the job