我正在玩弄 OpenSSH 配置并研究 Diffie-Hellman 参数。我正在使用 GDSSecurity 的工具检查 DH 设置,并使用此页面查看其他 SSH 设置。
为了有趣,我从以下位置删除了所有小于 4096 位的模数/etc/ssh/moduli:
$ awk '{print $5}' /etc/ssh/moduli | sort | uniq
4095
6143
8191
如果客户端仅接受 2048 位或 3072 位组,我希望密钥交换应该失败。有趣的是,它并不能在后一种情况下,但不前,2048位情况。
KEX proposal client: diffie-hellman-group-exchange-sha256
KEX proposal server: curve25519-sha256@libssh.org,diffie-hellman-group-exchange-sha256
KEX algorithm chosen: diffie-hellman-group-exchange-sha256
KEX client group sizes: min = 2048, nbits = 2048, max = 2048
KEX server-chosen group size in bits: 2048
Warning: Permanently added 'test,x.x.x.x' (ED25519) to the list of known hosts.
KEX proposal client: diffie-hellman-group-exchange-sha256
KEX proposal server: curve25519-sha256@libssh.org,diffie-hellman-group-exchange-sha256
KEX algorithm chosen: diffie-hellman-group-exchange-sha256
KEX client group sizes: min = 3072, nbits = 3072, max = 3072
ssh_dispatch_run_fatal: Connection to x.x.x.x: DH GEX group out of range
上述站点还声称使用 2048 位组进行了成功的密钥交换。
我对 SSH 协议或 OpenSSH 的细节知之甚少,无法理解这里发生了什么。如果模数文件中没有合适的组可用,OpenSSH 是否使用回退参数?