I've grown quite fond of HTTP reverse proxies in our development environment and found the DNS based virtual host reverse proxy quite useful. Having only one port (and the standard one) open on the firewall makes it much easier for management.

I'd like to find something similar to do SSH connections but haven't had much luck. I'd prefer not to simply use SSH tunneling since that requires opening port ranges other than the standard. Is there anything out there that can do this?

Could HAProxy do this?

link|improve this question

40% accept rate
Is your intended application file transfer, or actual SSH access to hosts? – Kyle Hodgson Jul 1 '09 at 16:20
Direct SSH access to the host is the goal. This need comes from the desire to run a Mercurial server in-house but our server is behind the firewall. Right now I'm working on simply setting up an HTTP version but I wanted to have commits use SSH instead of HTTP. Direct SSH access to other servers would be a bonus if this was possible. – tgm Jul 1 '09 at 19:01
This is such an annoying problem. – bias Dec 22 '11 at 18:36
feedback

5 Answers

I don't believe name-based SSH is something that will be possible given how the protocol works.

Here are some alternatives.

  • You could do is setup the host that answers for port 22 to act as a gateway. Then you can configure the ssh server to forward requests to the inside based on the key. SSH Gateway example with keys

  • You could adjust your client to use that host as a proxy. That is, it would ssh to the gateway host, and then make use that host to make a connection to the internal host. SSH proxy with client configuration.

  • You could also setup a simple http proxy on the edge. Then use that to allow incoming connections. SSH via HTTP proxy.

Obviously with all the above, making sure you properly configure and lock down the gateway is pretty important.

link|improve this answer
feedback

I am wondering if Honeytrap (the low interaction honeypot) that has a proxy mode couldn't be modified to achieve that.

This honeypot is able to forward any protocol to another computer. Adding a name based vhost system (as implemented by Apache) could make it a perfect reverse proxy for any protocol no ?

I do not have the skills to achieve that but maybe it could be a great project.

link|improve this answer
excellent idea! – bias Dec 22 '11 at 18:27
feedback

I don't believe this is something that would be possible, at least the way you described, although I would love to be proved wrong. It doesn't appear that the client sends the hostname that it wishes to connect to (at least in the clear). The first step of the SSH connection seems to be to set up encryption.

In addition, you would have issues with host key verification. SSH clients will verify keys based on an IP address as well as a hostname. You would have multiple hostnames with different keys, but the same IP you're connecting to.

A possible solution would be to have a 'bastion' host, where clients can ssh in to that machine, get a normal (or restricted if desired) shell, and can then ssh into internal hosts from there.

link|improve this answer
The bastion concept is what we current have setup but is problematic for my version control (without extra effort). – tgm Jul 1 '09 at 19:05
It's super annoying that ssh doesn't send the fqdn and handles the DNS on the client side. I guess people didn't worry about public IP bloat and NAT when most TCP/IP application level protocols were created. Because, seriously, you should be able to do FQDN based NAT with iptables (i.e. kernel filters). – bias Dec 22 '11 at 18:41
feedback

because of how ssh works I think it's not possible. Similar to https you would have to have different (external) IPs for different hosts, because the gateway doesn't know where do you want to connect to because everything in ssh is encryted

link|improve this answer
feedback

As the number of ports/hosts you want to access behind a firewall increases, the convenience of VPNs increases.

I don't like VPNs, though.

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.