SSH – Best Reverse Proxy Solutions

linux-networkingreverse-proxysshssh-tunnel

Hi here is a situation I have a server in a corporate data center for a project.
I have an SSH access to this machine at port 22.There are some virtual machines running on this server and then at the back of every thing many other Operating systems are working.
Now Since I am behind the data centers firewall my supervisor asked me if I can do some thing by which I can give many people on Internet access to these virtual machines directly.
I know if I were allowed to get traffic on port other than 22 then I can do a port forwarding.
But since I am not allowed this so what can be a solution in this case.
The people who would like to connect might be complete idiots.Who may be happy just by opening putty at their machines or may be even filezilla.I have configured an Apache Reverse Proxy for redirecting the Internet traffic to the virtual machines on these hosts.But I am not clear as for SSH what can I do.So is there some thing equivalent to an Apache Reverse Proxy which can do similar work for SSH in this situation.

I do not have firewall in my hands or any port other than 22 open and in fact even if I request they wont allow to open.2 times SSH is not some thing that my supervisor wants.

Best Answer

You should open ssh tunnel from your computer to server in data center. Let's name this as "server1". If you are using openssh, you can just run

ssh -L0.0.0.0:8080:localhost:8080 you_username@server1

This will open connection from your computer at port 8080 to server, port 8080, skipping firewall in between. Assuming your apache is listening on port 8080. Port forward format is listening IP:local port:remote address:remote port. Of course for single server you can use also

ssh -L0.0.0.0:8080:remote_server_address:8080 you_username@server1

Please note that localhost in -L parameter is relative to server1. In the other words, server is seeing connections coming from localhost, when in fact those are coming from your computer over ssh connection.

You also need parameter

AllowTcpForwarding yes

in server's ssh configuration (typically /etc/ssh/sshd_config).

After this, others can connect to your computer on port 8080 to get connection via Apache Reverse Proxy. If you need general proxy (so users can choose address, not just specific addresses in Apache configuration) you should install squid on server1 and use ssh tunnel to squid port.