0

I have a home server running ubuntu 10.04 that is running two services:

  1. an SSH service
  2. a dockerized gogs service

I would like to essentially reverse-proxy incoming SSH connections based on the subdomain. For instance, I'd like for ssh connections made via ssh user@mydomain.com to be forwarded to port 2222 and those made via ssh user@gogs.mydomain.com to be forwarded to port 10022.

In essence, I'd like something analogous to nginx for SSH traffic. How can this be achieved?

Louis Thibault
  • 117
  • 2
  • 6
  • 2
    See [Do the SSH or FTP protocols tell the server to which domain I am trying to connect?](http://serverfault.com/a/672403/168875) – Martin Prikryl Jun 23 '15 at 19:45

1 Answers1

4

This is impossible. SSH has no notion of a Host header as is present in HTTP. The best you can do is port-based routing.

EEAA
  • 108,414
  • 18
  • 172
  • 242
  • Bad news, but thanks for the answer. – Louis Thibault Jun 23 '15 at 17:18
  • 1
    @blz I managed to patch the OpenSSH client to work through a name based HTTP proxy. It is [dirty as hell](http://share.kasperd.net/openssh-6.6p1-host-header.patch) and will not work with all proxies. You should be using IPv6 instead. – kasperd Jun 28 '15 at 10:38
  • @kasperd, thanks for the link and for the full disclosure! I'll look into it carefully :) – Louis Thibault Jun 28 '15 at 14:31