Openssh升级导致旧版本堡垒机无法连接服务器的一次排错

发布于:2023-05-25 ⋅ 阅读:(264) ⋅ 点赞:(0)

现象描述

由于Diffie-Hellman Key Agreement Protocol 漏洞,需要对服务器SSH版本进行升级
将Openssh版本升级到8.5后,操作系统出现如下告警,无法通过堡垒机进行远程连接
# 报错信息
Unable to negotiate with 192.168.1.101 port 29418: no matching key exchange method found. Their offer: diffie-hellman-group1-sha1

问题原因

OpenSSH 7.0 弃用了 diffie-hellman-group1-sha1 密钥算法,因为它很弱并且在所谓的 Logjam 攻击的理论范围内。
如果客户端和服务器无法就一组相互的参数达成一致,则连接将失败。OpenSSH(7.0 及更高版本)将产生如下错误消息:
# 报错信息
Unable to negotiate with 192.168.1.101 port 29418: no matching key exchange method found. Their offer: diffie-hellman-group1-sha1
在这种情况下,客户端和服务器无法就密钥交换算法达成一致,因为服务器只提供了一种方法 diffie-hellman-group1-sha1。

修复方案

  • 客户端远程时强制指定ssh使用旧版本的key
ssh -oKexAlgorithms=+diffie-hellman-group1-sha1 user@host
  • 在 ~/.ssh/config 文件中配置如下代码
Host *
    KexAlgorithms +diffie-hellman-group1-sha1
  • 在修改/etc/ssh/ssh_config文件,在最末尾加入如下代码
KexAlgorithms +diffie-hellman-group1-sha1  # 按照报错信息添加算法

网站公告

今日签到

点亮在社区的每一天
去签到