一、问题描述
- 输入:ssh -V,查看版本。(原来的ssh版本是5.3)
OpenSSH_5.3p1
, OpenSSL 1.0.0-fips 29 Mar 2010 - 升级以后的版本是7.4
OpenSSH_7.4p1
, OpenSSL 1.0.1u 22 Sep 2016
ssh升级以后,服务器原来的代码都连接不上sftp,出现Algorithm negotiation fail SSH in Jenkins
等问题,用python写了一个paramiko
的测试程序也出现问题,可以确认是安全级别的问题。
解决方案
找到ssh的配置文件:vim /etc/ssh/sshd_config
,在文件尾加入下面的配置:
MACs hmac-sha2-512-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-ripemd160-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-512,hmac-sha2-256,hmac-ripemd160,umac-128@openssh.com,hmac-md5,hmac-sha1,hmac-sha1-96,hmac-md5-96
KexAlgorithms curve25519-sha256@libssh.org,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group14-sha1,diffie-hellman-group-exchange-sha1,diffie-hellman-group1-sha1