我正在尝试使用 PuTTY 连接到新系统并看到以下内容:
致命错误:无法就主机密钥算法达成一致(可用:rsa-sha2-512、rsa-sha2-256、ecdsa-sha2-nistp256)
检查服务器上可用的算法:
acoder@client ~ $ nmap --script ssh2-enum-algos -sV -p 22 server.name.here
Starting Nmap 7.01 ( https://nmap.org ) at 2021-04-16 10:33 EDT
Nmap scan report for server.name.here (1.1.1.1)
Host is up (0.018s latency).
PORT STATE SERVICE VERSION
22/tcp open ssh OpenSSH 8.0 (protocol 2.0)
| ssh2-enum-algos:
| kex_algorithms: (7)
| ecdh-sha2-nistp256
| ecdh-sha2-nistp384
| ecdh-sha2-nistp521
| diffie-hellman-group-exchange-sha256
| diffie-hellman-group14-sha256
| diffie-hellman-group16-sha512
| diffie-hellman-group18-sha512
| server_host_key_algorithms: (3)
| rsa-sha2-512
| rsa-sha2-256
| ecdsa-sha2-nistp256
| encryption_algorithms: (6)
| [email protected]
| aes256-ctr
| aes256-cbc
| [email protected]
| aes128-ctr
| aes128-cbc
| mac_algorithms: (6)
| [email protected]
| [email protected]
| [email protected]
| hmac-sha2-256
| hmac-sha1
| hmac-sha2-512
| compression_algorithms: (2)
| none
|_ [email protected]
以下是我的客户端机器上可用的内容:
公钥接受密钥类型
acoder@client ~ $ ssh -Q key
ssh-ed25519
[email protected]
ssh-rsa
ssh-dss
ecdsa-sha2-nistp256
ecdsa-sha2-nistp384
ecdsa-sha2-nistp521
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
密码
acoder@client ~ $ ssh -Q cipher
3des-cbc
blowfish-cbc
cast128-cbc
arcfour
arcfour128
arcfour256
aes128-cbc
aes192-cbc
aes256-cbc
[email protected]
aes128-ctr
aes192-ctr
aes256-ctr
[email protected]
[email protected]
[email protected]
媒体访问控制
acoder@client ~ $ ssh -Q mac
hmac-sha1
hmac-sha1-96
hmac-sha2-256
hmac-sha2-512
hmac-md5
hmac-md5-96
hmac-ripemd160
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
Kex算法
acoder@client ~ $ ssh -Q kex
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
[email protected]
我在这里忽略了什么?
答案1
您忽略了 PuTTY 和 ssh (OpenSSH) 是两个完全独立的程序。它们不共享任何代码;它们不使用任何通用加密库。列表ssh -Q
没有告诉您有关 PuTTY 可以支持什么的任何信息。
我认为问题是你的PuTTY版本太旧了。在服务器提供的签名方法中,ECDSA签名(ecdsa-sha2-nistp256
)至少需要PuTTY版本0.68,而 RSA-SHA2 方法(rsa-sha2-*
)仅在下一个 PuTTY 版本(0.75)中可用。
造成这种情况的原因是 OpenSSH 服务器ssh-rsa
最近已禁用对旧的基于 SHA1 的签名算法的支持(它们仍然使用相同的 RSA 密钥,但仅通过基于 SHA2 的签名),而对 DSA 密钥的支持已在几年前被取消。