自用的一台服务器上次yum update到centos 7.4,刚才发现跳转不过去了,提示:
expected key exchange group packet from server
赶紧登陆服务器看一下,诶,可以ssh登陆啊。SSH通道换成密码的形式,也是不行。
看一下SSHD的日志
journalctl --unit sshd --no-pager
Jan 24 17:51:20 hk sshd[1989]: /etc/ssh/sshd_config line 50: Deprecated option RSAAuthenticationJan 24 17:51:20 hk systemd[1]: Started OpenSSH server daemon.Jan 24 17:51:22 hk sshd[1990]: rexec line 50: Deprecated option RSAAuthenticationJan 24 17:51:22 hk sshd[1990]: error: kex protocol error: type 30 seq 1 [preauth]
嘿,升级了openssh版本了啊,这个配置参数已经是被废弃掉的
于是我备份一下/etc/ssh/sshd_config文件便删掉了50行的RSAAuthentication
重启再试,嘿,还是不行,现在就剩下这句提示了:
error: kex protocol error: type 30 seq 1 [preauth]
度娘一下,悻悻的打开了小飞机,发现这篇文章有着跟我一样的情况
https://github.com/Studio3T/robomongo/issues/1125
得,试试呗。
# Add this to /etc/ssh/sshd_config
KexAlgorithms curve25519-sha256@libssh.org,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group14-sha1,diffie-hellman-group1-sha1提示什么缺少什么自行添加KexAlgorithms diffie-hellman-group1-sha1,curve25519-sha256@libssh.org,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group14-sha1Ciphers 3des-cbc,blowfish-cbc,aes128-cbc,aes128-ctr,aes256-ctr
# systemctl restart sshd
原因大概就是
use , and libssh2 only support diffie-hellman key exchange methods
而且升级libssh2也不能解决,应该是个bug。
ps:只有在centos 7.4版本出现,7.3和7.5均没有这种情况