如何为SSH禁用diffie-hellman-group1-sha1

我发现我的服务器通过SSH仍然支持diffie-hellman-group1-sha1。 要保持最新的PCI合规性,我一直在试图找出如何禁用diffie-hellman-group1-sha1。 Weakdh.org并没有给出明确的指示,说明如何禁用networking上的任何内容。 如果不在Ubuntu上禁用SSH端口22,禁用此algorithm的正确方法是什么? 运行ssh -Q kex时,以下是我的服务器支持的algorithm。

 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 [email protected] 

运行ssh -Q kex

为您提供客户端支持的algorithm列表。 服务器将从sshd -T | grep kex sshd -T | grep kex (当然是在服务器上)。

如果你想删除一个,只要把你从前一个命令得到的列表中,删除你感兴趣的algorithm,并把它放在/etc/ssh/sshd_config (或用kexalgorithmreplace现有的那一行)。

man sshd_config

  KexAlgorithms Specifies the available KEX (Key Exchange) algorithms. Multiple algorithms must be comma-separated. The default is [email protected], 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 

因此,要禁用“diffie-hellman-group1-sha1”,请指定具有参数KexAlgorithms的所需algorithm

KexAlgorithms diffie-hellman-group-exchange-sha256,curve25519-sha256 @ libssh.org,