Ubuntu – (practically) block access to the SSH port to the country only

SecuritysshUbuntu

I'm thinking that blocking access to the SSH port to allow for my country only is an obvious step, but I can't see a practical way to do this.

I'm in the UK if it matters. I have full access to the Ubuntu server. The server is a remote cloud-based server.

This seems too easy and I can't see how it can work: http://eminasif.wordpress.com/2014/01/14/how-to-restrict-server-ssh-access-or-any-port-only-for-specific-country-in-csf/

This shows a load of IPs but I can't see how I can transfer that to anything usable/practical: http://www.nirsoft.net/countryip/gb.html

In fact, only one office of people will ever need access (nobody is remote). I'm reluctant to set the current IP address we use when connecting though as it seems to change every 6 months.

I do have other good security practices in place – disable root login, high-bit encryption keys etc. but this seems an obvious extra step.

Is this worth the hassle? Is there a reliable way to do it?

Best Answer

That sounds like a subtle instance of security by obscurity. Anybody who is actually interested in hacking into a system like that can easily find an open proxy or rent a server within the UK, and attack from there.

At the same time you're making operations more difficult:

  • You'd have to use heuristics since there's nothing like a "country" in TCP/IP. Heuristics fail, and when they do it will be at the worst possible moment.
  • A non-standard setup is going to frustrate future maintainers.
  • Critical backups should be replicated across the globe. You don't want to wait for production down-time time to discover a critical recovery path is blocked.