SSH:当 KexAlgorithm 被列为可用时,“找不到匹配的密钥交换方法”

Mat*_*ttB 2 linux ssh

当我尝试通过 ssh 连接到我的一个交换机时,出现以下错误:

$ ssh remotehost
Unable to negotiate with 1.2.3.4 port 22: no matching key exchange method found. Their offer: diffie-hellman-group14-sha1
Run Code Online (Sandbox Code Playgroud)

如果我列出可用的密钥交换算法,我可以看到我们确实拥有它;

$ ssh -Q kex
...
...
diffie-hellman-group14-sha1
...
Run Code Online (Sandbox Code Playgroud)

手动将其指定为选项确实有效,并为它创建一个 .ssh/config 条目,但如果它在 kex 列表中,不应该自动选择它吗?

ssh -o KexAlgorithms=diffie-hellman-group14-sha1 user@remotehost
Run Code Online (Sandbox Code Playgroud)

.ssh/配置

Host remotehost
    KexAlgorithms +diffie-hellman-group14-sha1
Run Code Online (Sandbox Code Playgroud)

小智 5

在最近的 SSH 版本中,默认情况下禁用 diffie-hellman-group1-sha1 密钥交换方法。配置选项是您执行此操作的唯一方法。查看openssh 遗留问题页面了解详细信息