-1

I have a Ubuntu Server 12.04 that is accessible on the internet. Therefore, I would like to harden it a bit. I thought on starting to write a ~/.ssh/config file, forcing incoming clients a certain cipher, a MAC integrity, a key exchange algorithm, ...

Now my question is, which one is the best of them?

I thought on the following: Ciphers aes256-cbc HostKeyAlgrorithmy ssh-rsa KexAlgroithms diffie-hellman-group-exchange-sha256 MACs hmac-sha2-512-96

What do you think, guys? Is this a reasonable way of securing?

Socrates
  • 8,724
  • 25
  • 66
  • 113

2 Answers2

1

The NIST/NSA Suite B set of protocols are generally considered to be the ones that you should be using. Here is a link:

http://www.nsa.gov/ia/programs/suiteb_cryptography/

Asking which cipher is the best, is a bit like asking which apple is the loudest - each set of ciphers have their merits and weaknesses, but at least the ones in this list are considered safe for government use. What you should be asking, is which ciphers have been proven weak (DES, MD5), and avoid them.

More importantly though, to harden your server, you should look at the following:

  • Possibly only allow key-based SSH authentication
  • Run SSH on a different port
  • Make sure you don't have any unsecured or guest users (or restrict SSH login only to specific users)
  • Make sure you don't have any other services running on the box (or at least restrict running services to the bare minimum required)
roelofs
  • 2,132
  • 20
  • 25
0

For securing/hardening ssh, I have found the recommendations available on at CIS to be helpful. While, I think they are selling tools and services, their benchmarks are free, specific, and rather helpful. The benchmarks are PDF reports that can be downloaded in exchange for your name, email, and a couple questions about who you are. I especially liked how they gave specific reasons for their recommendations, and references for more information. With respect to ssh specifically, and with respect to what crypto algorithms are safest, I found the CIS benchmark for Distribution Independent Linux to be particularly relevant.

With regard to using the ~/.ssh/config file to secure your server, this is not going to help. The ~/.ssh/config file sets preferences for how you (a specific user on your ssh client machine) will connect to any given server. So if you specify a short list of strong ciphers that may be used in your ~/.ssh/config, you are just telling ssh that when you log into a server, you will only accept the use of those specific ciphers. If those ciphers are not available, forget it! do not even connect to that server. The ~/.ssh/config file does not instruct your Ubuntu Server which ciphers to accept or not. The same goes for MACs, KexAlgorithms, HostKeyAlgorithms, etc. To configure your server, you want to take a look at the /etc/ssh/sshd_config file.

Finnally, if you are running an up to date version of your operating system, and you have an up to date installation of ssh and its configuration files, the defaults are fairly reasonable. I believe the ssh authors and maintainers, especially the openSSH authors and maintainer, know what they are doing, and they are specifically trying to provide tools that will allow you to safely, securely, and privately connect to your server using ssh. Having my own server publicly accessible on the internet, I too go through and check the options carefully. That said, as long as your server is running up to date software and using up to date configurations, and the only access to your server is through ssh, I believe you will be reasonably secure by just keeping everything up to date.