I'm trying to setup a nginx egress proxy so that all the SSH connections to a specific group of hosts (*.example.com) go through the proxy. I have a local DNS server, where I resolve such hosts to the proxy ip address. I've looked at the nginx stream docs, but it looks like that is more for load balancing, which is different. What I'm trying to do is just pass the SSH connection to the an upstream host that matches the original host name. As an example:
ssh bob@somerandomhost.example.com ---> egress proxy receives the request and verifies it's whitelisted ---> passes connection to public upstream host.