大网数据广告活动
服务器运维问答

How can I list MACs, Ciphers and KexAlgorithms supported by my ssh server?

· 52CE 我爱测

How can I determine the supported MACs, Ciphers, Key length and KexAlgorithms 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 exa…

问题原文

原帖链接 · Henrik Pingel · CC BY-SA 4.0

How can I determine the supported MACs, Ciphers, Key length and KexAlgorithms 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 ssh uses the default ciphers as listed in man sshd_config. However I need a solution I can use in a script and man sshd_config does not list information about key length. I need to correct myself here: You can specify ServerKeyBits 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?

已采纳解答

原帖链接 · Jakuje · CC BY-SA 4.0

You miss few points in your question:

  • What is your openssh version? It can differ a bit over the versions.
  • 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 Ciphers, MACs and KexAlgorithms are the ones that are offered using connection, as you point out. But they can also be achieved 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.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2015-11-10)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 4.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。