麒麟信安等服务器ssh问题no matching MAC found. Their offer: hmac-sha1-96,hmac-sha1,hmac-md5-96,hmac-md5

时间:2023-01-29 11:54:56


近期很多银河麒麟、麒麟信安、 凝思等操作系统服务器ssh连接不上问题,大多原因是ssh算法不匹配所致。

1、排查:

journalctl --unit sshd --no-pager查看ssh目标服务器(ssh连接的服务器)的sshd日志,

根据日志大概知道原因

2、解决

  • 第一步:修改/etc/ssh/sshd_config文件,大致有以下几种修改思路(择其一)
  1. (多为银河麒麟)增加KexAlgorithms 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
  2. (多为麒麟信安服务器版)增加HostkeyAlgorithms +ssh-rsa,ssh-dss
  3. (多为麒麟信安桌面版)MACs hmac-sha2-512,hmac-sha2-512-etm@openssh.com,hmac-sha2-256,hmac-sha2-256-etm@openssh.com修改为

MACs hmac-sha2-512,​​hmac-sha2-512-etm@openssh.com​​,hmac-sha2-256,​​hmac-sha2-256-etm@openssh.com​​,hmac-sha1-96,hmac-sha1,hmac-md5-96,hmac-md5

  • 第二步:systemctl restart sshd重启ssh服务