How to forward SSH into GitLab Docker container based on requested domain How to forward SSH into GitLab Docker container based on requested domain docker docker

How to forward SSH into GitLab Docker container based on requested domain


Unlike HTTP or SNI-enabled TLS services, the SSH service doesn't have any sort of name-based logic detection.

The long and the short of it is that you get one ssh daemon per ip/port.

There are workarounds that might work.

Port knocking is one possibility. You could change which service a firewall forwards you to based on the knock you send.

Another thing you could do is set up a .ssh/authorized_keys file that will recognize which SSH key you use, and then force a command that will start a new ssh process and drop you on the correct corresponding service.

You could also run each ssh service on a different port, and have a client-side config file handle the name->port mapping.