3 ms·
Many (most?) releases auto generate the SSH server keys and set default configuration during OS or during SSH server enablement. Changing the server key prote
by efitz 3y ago
Many (most?) releases auto generate the SSH server keys and set default configuration during OS or during SSH server enablement. Changing the server key protects you against the case that whoever made the distribution did it wrong - either used duplicate keys to other hosts, or intentionally compromised the key, or used a poor PRNG, or used a less desirable algorithm, perhaps for compatibility purposes.
That is not to say that any of those things actually happened; it’s just that the most paranoid/defense-oriented view is not to trust what the OS did for you, but to do it yourself.
A distro provider is incentivized to find a local optimum between security and compatibility and has no idea about your environment.
You have much more context about your environment- you know what you need to connect to, what needs to connect to you, and what ciphers, key length, and other configuration that you must support. Therefore if you take all that into account you might be able to optimize for security by disabling compatibility options you don’t need.
BTW this answer is pretty much the same when it comes to hardening any security feature of any OS. Vendors/distributors do a good job of hardening but you might be able to lock things down just a little further.
- rlpb 3y ago> You have much more context about your environment- you know what you need to connect to, what needs to connect to you, and what ciphers, key length, and other configuration that you must support. Therefore if you take all that into account you might be able to optimize for security by disabling compatibility options you don’t need. As long as that's what you actually do. If instead you want a checklist to blindly execute to "harden" your system, then the grandparent commenter is correct: either your can accept that your distribution's defaults are actually good enough, or you're removing functionality such that you'll find a hurdle you've left for yourself sooner or later.
- lazide 3y agoIf your OS distributor screwed you that badly (and a short check should be sufficient to determine if they did if the distribution is popular!) you’re deeply screwed anyway. And there is nothing post-facto you can do from within that distribution.
- napkin 3y agoFor two years there was an undiscovered Debian-specific vulnerability in their OpenSSL package borking the generation of keys. But your point about being screwed from within applies to this case- regenerating the keys on an affected system would not have solved the problem, until it was patched. For those curious, look up ssh-vulnkey.
- mkj 3y agoFollowing the guide's steps wouldn't have helped in the Debian case. I reckon on average a distro ssh maintainer is more aware than an average end user following a hardening guide, even with mistakes like that one.
- e2le 3y ago>Changing the server key protects you against the case that whoever made the distribution did it wrong I'm unsure of ssh_host_* and it's importance, however on some hosts I manage the "ssh_host_rsa" key is only 2048 bits. Would regenerating "ssh_host_rsa" to be larger (4096 bits) not be an improvement?