ssh 卡在 debug1:已发送 SSH2_MSG_KEX_DH_GEX_REQUEST(2048<3072<8192)

Posted

技术标签:

【中文标题】ssh 卡在 debug1:已发送 SSH2_MSG_KEX_DH_GEX_REQUEST(2048<3072<8192)【英文标题】:ssh getting stuck at debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(2048<3072<8192) sent 【发布时间】:2021-09-14 09:33:25 【问题描述】:
debug3: send packet: type 20
debug1: SSH2_MSG_KEXINIT sent
debug3: receive packet: type 20
debug1: SSH2_MSG_KEXINIT received
debug2: local client KEXINIT proposal
debug2: KEX algorithms: curve25519-sha256,curve25519-sha256@libssh.org,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group16-sha512,diffie-hellman-group18-sha512,diffie-hellman-group14-sha256,ext-info-c
debug2: host key algorithms: ecdsa-sha2-nistp256-cert-v01@openssh.com,ecdsa-sha2-nistp384-cert-v01@openssh.com,ecdsa-sha2-nistp521-cert-v01@openssh.com,sk-ecdsa-sha2-nistp256-cert-v01@openssh.com,ssh-ed25519-cert-v01@openssh.com,sk-ssh-ed25519-cert-v01@openssh.com,rsa-sha2-512-cert-v01@openssh.com,rsa-sha2-256-cert-v01@openssh.com,ssh-rsa-cert-v01@openssh.com,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,sk-ecdsa-sha2-nistp256@openssh.com,ssh-ed25519,sk-ssh-ed25519@openssh.com,rsa-sha2-512,rsa-sha2-256,ssh-rsa
debug2: ciphers ctos: chacha20-poly1305@openssh.com,aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm@openssh.com,aes256-gcm@openssh.com
debug2: ciphers stoc: chacha20-poly1305@openssh.com,aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm@openssh.com,aes256-gcm@openssh.com
debug2: MACs ctos: hmac-md5,hmac-sha1,umac-64@openssh.com
debug2: MACs stoc: hmac-md5,hmac-sha1,umac-64@openssh.com
debug2: compression ctos: none,zlib@openssh.com,zlib
debug2: compression stoc: none,zlib@openssh.com,zlib
debug2: languages ctos: 
debug2: languages stoc: 
debug2: first_kex_follows 0 
debug2: reserved 0 
debug2: peer server KEXINIT proposal
debug2: KEX algorithms: diffie-hellman-group-exchange-sha256,diffie-hellman-group-exchange-sha1
debug2: host key algorithms: ssh-rsa,ssh-dss
debug2: ciphers ctos: aes128-ctr,aes192-ctr,aes256-ctr,aes128-cbc,aes192-cbc,aes256-cbc
debug2: ciphers stoc: aes128-ctr,aes192-ctr,aes256-ctr,aes128-cbc,aes192-cbc,aes256-cbc
debug2: MACs ctos: hmac-md5,hmac-sha1,hmac-ripemd160,hmac-ripemd160@openssh.com,hmac-sha1-96,hmac-md5-96
debug2: MACs stoc: hmac-md5,hmac-sha1,hmac-ripemd160,hmac-ripemd160@openssh.com,hmac-sha1-96,hmac-md5-96
debug2: compression ctos: none
debug2: compression stoc: none
debug2: languages ctos: 
debug2: languages stoc: 
debug2: first_kex_follows 0 
debug2: reserved 0 
debug1: kex: algorithm: diffie-hellman-group-exchange-sha256
debug1: kex: host key algorithm: ssh-rsa
debug1: kex: server->client cipher: aes128-ctr MAC: hmac-md5 compression: none
debug1: kex: client->server cipher: aes128-ctr MAC: hmac-md5 compression: none
debug3: send packet: type 34
debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(2048<3072<8192) sent

我尝试了这里提到的解决方案ssh stuck on SSH2_MSG_KEX_DH_GEX_REQUEST(1024<7680<8192) sent,但没有任何效果。

【问题讨论】:

【参考方案1】:

我遇到了一些问题,当使用 diffie-hellman-group-exchange-sha256 时,服务器需要 34 种类型的 Diffie-Hellman Group 交换,而客户端只能使用旧的 30 种类型。由于我们无法切换客户端(嵌入在其他代码中),我们不得不使用其他 diffie-hellman-group14-sha1。在您的情况下 group14 似乎并不常见,但您有一个共同点:“diffie-hellman-group1-sha1”,它可能会更好。否则尝试更改客户端并尝试不同的客户端,看看是否有帮助。

/* dh-group-exchange */
#define SSH2_MSG_KEX_DH_GEX_REQUEST_OLD         30
#define SSH2_MSG_KEX_DH_GEX_GROUP           31
#define SSH2_MSG_KEX_DH_GEX_INIT            32
#define SSH2_MSG_KEX_DH_GEX_REPLY           33
#define SSH2_MSG_KEX_DH_GEX_REQUEST         34

【讨论】:

以上是关于ssh 卡在 debug1:已发送 SSH2_MSG_KEX_DH_GEX_REQUEST(2048<3072<8192)的主要内容,如果未能解决你的问题,请参考以下文章

ssh登陆报错

ssh连接到centos主机,无法成功连接,报错如下,求大侠赐教!!感谢!!

ssh -v root@xxxxx 显示登录的细节

linux ssh无法连接。连接上的没问题。

Bot 与 bitbucket 集成的问题

登录操作需要很长时间(系统日志问题)