Linux – Remote access to a Linux machine behind a firewall

linuxremote-accessssh

I'm going to be deploying an Linux machine as a sort of public terminal at a remote location. I'd like to be able to access it remotely via SSH for maintenance but I don't want to keep a port open on the remote firewall for the rare occasions I need to access this machine. I've though about a simple script to create a reverse SSH tunnel to a machine on the outside, but I'd rather not have to have a user have to do anything when I need to access it. Any ideas?

Update: I've decided to go with my original plan of a script to create a reverse ssh tunnel. While other suggested solutions, such as port knocking would be more along the lines of what I really want to do, in this case, I don't have any access to configure the router other than walking a user through a config. shudder

Best Answer

It has less to do with being concerned with a port being open and more to do with not wanting to walk a user though the process of opening up a port. I don't have any access to this router at all unfortunately.

If changing the router is completely out of the question, you may need to look at a P2P or VPN solution like Hamachi. If you setup the system to automatically establish the VPN connection at startup, then you should be able to connect in whenever you need to. Hamachi does all the firewall negotiation for you. The one drawback is you have to rely on the Hamachi servers being up and functional when you need to connect.

If you have a server that is always up, you could setup autossh so that the remote system always keeps a tunnel open and connected to your server. The one drawback is the remote system is compromised they attacker will get the keys that where used to establish the ssh session. It would be very important to keep your system that accept the ssh connection really locked down.


Below is my original answer, I had assumed that updating the router was an option.

One solution you might want to investigate if you firewall supports it, is port knocking. With some firewalls it should be possible to send out a special set of packets that the firewall notices and then temporarily opens hole through the firewall.

There are many implementations some better then others. Some use strong cryptography to make it nearly impossible for a person without the right keys to send the correct knock.

Related Topic