我发现我的服务器通过 SSH 仍然支持 diffie-hellman-group1-sha1。为了与最新的 PCI 合规性保持一致,我一直在努力弄清楚如何禁用 diffie-hellman-group1-sha1。Weakdh.org 没有明确说明如何禁用此功能,也没有在网络上提供任何内容。在 Ubuntu 上禁用 SSH 的端口 22 的情况下禁用此算法的正确方法是什么?以下是我的服务器在运行时支持的算法ssh -Q kex。
diffie-hellman-group1-sha1
diffie-hellman-group14-sha1
diffie-hellman-group-exchange-sha1
diffie-hellman-group-exchange-sha256
ecdh-sha2-nistp256
ecdh-sha2-nistp384
ecdh-sha2-nistp521
diffie-hellman-group1-sha1
curve25519-sha256@libssh.org
Run Code Online (Sandbox Code Playgroud)
小智 13
在 OpenSSH 7.6 中,如果您想删除一个或多个选项并保留其余默认值,您可以将以下行添加到/etc/ssh/sshd_config:
KexAlgorithms -diffie-hellman-group1-sha1,ecdh-sha2-nistp256\nRun Code Online (Sandbox Code Playgroud)\n请注意-逗号分隔列表开头的 。上面的行将禁用 diffie-hellman-group1-sha1 和 ecdh-sha2-nistp256。
sshd_configman中对此进行了进一步详细说明KexAlgorithms:
If the specified value begins with a \xe2\x80\x98-\xe2\x80\x99 character, then the specified methods (including\nwildcards) will be removed from the default set instead of replacing them.\nRun Code Online (Sandbox Code Playgroud)\n最后一点,在进行任何更改后,请在重新启动 sshd 之前/etc/ssh/sshd_config始终使用它们进行验证。sshd -t
跑步
ssh -Q kex
为您提供客户端支持的算法列表。您将从中获得sshd -T | grep kex的服务器(当然是在服务器上)。
如果您想删除一个,只需从上一个命令中获取列表,删除您感兴趣的算法并将其放入/etc/ssh/sshd_config(或用 kex 算法替换那里的现有行)。
小智 8
KexAlgorithms
Specifies the available KEX (Key Exchange) algorithms. Multiple algorithms must be comma-separated. The default is
curve25519-sha256@libssh.org,
ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,
diffie-hellman-group-exchange-sha256,
diffie-hellman-group-exchange-sha1,
diffie-hellman-group14-sha1,
diffie-hellman-group1-sha1
Run Code Online (Sandbox Code Playgroud)
因此,要禁用 "diffie-hellman-group1-sha1" ,请使用参数 KexAlgorithms 指定所需的算法
KexAlgorithms diffie-hellman-group-exchange-sha256,curve25519-sha256@libssh.org,
| 归档时间: |
|
| 查看次数: |
47285 次 |
| 最近记录: |