我无法ssh到一个要求使用diffie-hellman-group1-sha1
密钥交换方法的服务器。
ssh 123.123.123.123
Unable to negotiate with 123.123.123.123 port 22: no matching key exchange method found. Their offer: diffie-hellman-group1-sha1
**如何在Debian 8.0上启用diffie-hellman-group1-sha1
密钥交换方式?
我已经尝试(按照建议这里)将
在我的/etc/ssh/ssh_config
中添加以下几行
KexAlgorithms diffie-hellman-group1-sha1,[email protected],ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group14-sha1
密码 3des-cbc,blowfish-cbc,aes128-cbc,aes128-ctr,aes256-ctr
用以下方法重新生成密钥
ssh-keygen -A
用以下方法重新启动SSH
service ssh restart
但仍然得到错误。
OpenSSH网站有一个专门讨论遗留问题的页面,比如说这个问题。它建议采用以下方法,在客户端。
ssh -oKexAlgorithms=+diffie-hellman-group1-sha1 123.123.123.123
或更持久地添加
Host 123.123.123.123
KexAlgorithms +diffie-hellman-group1-sha1
到 ~/.ssh/config
。
这将在客户端*启用旧的算法,使其能够连接到服务器。
我尝试了这个解决方案,但我的问题是,我有许多(传统的)客户连接到我最近升级的服务器(ubuntu 14 -> ubuntu 16)。
从openssh6 -> openssh7的变化默认禁用了diffie-hellman-group1-sha1
密钥交换方法。
在阅读了this和this我想出了我需要对/etc/ssh/sshd_config
文件进行的修改。
#Legacy changes
KexAlgorithms +diffie-hellman-group1-sha1
Ciphers +aes128-cbc
但更多的改动是(取自这里)
#Legacy changes
KexAlgorithms diffie-hellman-group1-sha1,[email protected],ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group14-sha1
Ciphers 3des-cbc,blowfish-cbc,aes128-cbc,aes128-ctr,aes256-ctr