How can I determine the supported MACs, Ciphers, Key length and KexAlogrithms supported by my ssh servers?
I need to create a list for an external security audit. I'm looking for something similar to openssl s_client -connect example.com:443 -showcerts
. From my research the ssh
uses the default ciphers as listed in man sshd_config
. However I need a solution I can use in a script and . I need to correct myself here: You can specify man sshd_config
does not list information about key lengthServerKeyBits
in sshd_config
.
I guess that ssh -vv localhost &> ssh_connection_specs.out
returns the information I need but I'm not sure if the listed ciphers are the ciphers supported the client or by the server. Also I'm not sure how to run this non interactive in a script.
Is there a convenient way to get SSH
connection information?
It looks like the answer on https://superuser.com/a/1219759/173408 is also an answer to your question. It fits in one line:
Here is the output on a plain Debian 9.4 machine with current SSH version:
You miss few points in your question:
ServerKeyBits
is option for protocol version 1, which you have hopefully disabled!Supported Ciphers, MACs and KexAlgorithms are always available in manual and this doesn't have anything in common with key lengths.
Enabled Chiphers, MACs and KexAlgorithms are the ones that are offered using connection as you point out. But they can be gained also in other ways, for example using
sshd -T | grep "\(ciphers\|macs\|kexalgorithms\)"
To get the key length of your server key(s), you can use ssh-keygen:
ssh-keygen -lf /etc/ssh/ssh_host_rsa_key.pub
but you will probably want also the moduli sizes that are offered and used during the key exchange, but it really depends on the key exchange method, but it should be also readable from debug output
ssh -vvv host
.