OpenSSH服务器接受公钥,然后立即closures连接,没有任何错误消息

我试图连接到一个SSH服务器,我可以连接到过去,但使用不同的OpenSSH客户端版本。

Cygwin OpenSSH_6.6.1, OpenSSL 1.0.1g 7 Apr 2014客户端,通过使用Cygwin OpenSSH_6.6.1, OpenSSL 1.0.1g 7 Apr 2014通过Squid代理,我很好地连接到中间的Ubuntu 13.10 OpenSSH_6.2p2 Ubuntu-6ubuntu0.3服务器使用转发的代理绕过防止直接访问目标服务器的防火墙。

我可以很好地连接到其他SSH服务器通过这个中间服务器,排除转发的代理configuration或权限问题。

我可以告诉目标服务器失败的唯一区别是,它使用OpenSSH_4.3运行一个旧的Debian版本,虽然几个月前我可以连接到OpenSSH_4.3 ,但几年前还没有更新(在升级中间服务器之前跟随心跳的错误)和升级我的Cygwin客户端之前。

最近和一些较老的OpenSSH用户代理之间是否有任何已知的协议不兼容问题?

从中间服务器连接到目标服务器( s1.hidden.com @63.82.7.10在下面的跟踪)失败,没有任何错误消息,目标服务器已经报告接受我转发的公钥,中间服务器发送公共键。

在下面的跟踪中,到中间服务器的连接和到目标服务器的尝试连接都有选项-vvv ,它解释了涉及转发代理的channel 1debugging消息(地址被编辑):

 [...] debug2: we sent a publickey packet, wait for reply debug1: Server accepts key: pkalg ssh-rsa blen 279 debug2: input_userauth_pk_ok: fp 46:83:33:00:28:48:b2:3c:b1:3f:60:bb:62:80:cc:d2 debug3: sign_and_send_pubkey: RSA 46:83:33:00:28:48:b2:3c:b1:3f:60:bb:62:80:cc:d2 debug2: channel 1: rcvd eof debug2: channel 1: output open -> drain debug2: channel 1: obuf empty debug2: channel 1: close_write debug2: channel 1: output drain -> closed debug1: channel 1: FORCE input drain debug2: channel 1: ibuf empty debug2: channel 1: send eof debug2: channel 1: input drain -> closed debug2: channel 1: send close Connection closed by 63.82.7.10 root@intermediate-server: ~ $ debug3: channel 1: will not send data after close debug2: channel 1: rcvd close debug3: channel 1: will not send data after close debug2: channel 1: is dead debug2: channel 1: garbage collecting debug1: channel 1: free: authentication agent connection, nchannels 2 debug3: channel 1: status: The following connections are open: #0 client-session (t4 r0 i0/0 o0/0 fd 3/6 cc -1) #1 authentication agent connection (t4 r2 i3/0 o3/0 fd 8/8 cc -1) 

在成功的目标服务器上,我可以看到:

 debug2: channel 1: input drain -> closed debug2: channel 1: send close debug1: Authentication succeeded (publickey). 

而不是在失败的服务器上:

 debug2: channel 1: input drain -> closed debug2: channel 1: send close Connection closed by 63.82.7.10 

除OpenSSH版本和地址外,其他一切看起来都是相同的。

以下是从中间服务器到目标服务器的完整-vvv跟踪:

 OpenSSH_6.2p2 Ubuntu-6ubuntu0.3, OpenSSL 1.0.1e 11 Feb 2013 debug1: Reading configuration data /root/.ssh/config debug1: /root/.ssh/config line 1: Applying options for s1 debug1: Reading configuration data /etc/ssh/ssh_config debug1: /etc/ssh/ssh_config line 19: Applying options for * debug2: ssh_connect: needpriv 0 debug1: Connecting to s1.hidden.com [63.82.7.10] port 2222. debug1: Connection established. debug1: permanently_set_uid: 0/0 debug1: identity file /root/.ssh/id_rsa type -1 debug1: identity file /root/.ssh/id_rsa-cert type -1 debug1: identity file /root/.ssh/id_dsa type -1 debug1: identity file /root/.ssh/id_dsa-cert type -1 debug1: identity file /root/.ssh/id_ecdsa type -1 debug1: identity file /root/.ssh/id_ecdsa-cert type -1 debug1: Enabling compatibility mode for protocol 2.0 debug1: Local version string SSH-2.0-OpenSSH_6.2p2 Ubuntu-6ubuntu0.3 debug1: Remote protocol version 2.0, remote software version OpenSSH_4.3 debug1: match: OpenSSH_4.3 pat OpenSSH_4* debug2: fd 3 setting O_NONBLOCK debug3: put_host_port: [s1.hidden.com]:2222 debug3: load_hostkeys: loading entries for host "[s1.hidden.com]:2222" from file "/root/.ssh/known_hosts" debug3: load_hostkeys: found key type RSA in file /root/.ssh/known_hosts:4 debug3: load_hostkeys: loaded 1 keys debug3: order_hostkeyalgs: prefer hostkeyalgs: [email protected],[email protected],ssh-rsa debug1: SSH2_MSG_KEXINIT sent debug1: SSH2_MSG_KEXINIT received debug2: kex_parse_kexinit: ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha1,diffie-hellman-group1-sha1 debug2: kex_parse_kexinit: [email protected],[email protected],ssh-rsa,[email protected],[email protected],[email protected],[email protected],[email protected],ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,ssh-dss debug2: kex_parse_kexinit: aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,[email protected],[email protected],aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,aes192-cbc,aes256-cbc,arcfour,[email protected] debug2: kex_parse_kexinit: aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,[email protected],[email protected],aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,aes192-cbc,aes256-cbc,arcfour,[email protected] debug2: kex_parse_kexinit: [email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],hmac-md5,hmac-sha1,[email protected],[email protected],hmac-sha2-256,hmac-sha2-512,hmac-ripemd160,[email protected],hmac-sha1-96,hmac-md5-96 debug2: kex_parse_kexinit: [email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],hmac-md5,hmac-sha1,[email protected],[email protected],hmac-sha2-256,hmac-sha2-512,hmac-ripemd160,[email protected],hmac-sha1-96,hmac-md5-96 debug2: kex_parse_kexinit: none,[email protected],zlib debug2: kex_parse_kexinit: none,[email protected],zlib debug2: kex_parse_kexinit: debug2: kex_parse_kexinit: debug2: kex_parse_kexinit: first_kex_follows 0 debug2: kex_parse_kexinit: reserved 0 debug2: kex_parse_kexinit: diffie-hellman-group-exchange-sha256,diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha1,diffie-hellman-group1-sha1 debug2: kex_parse_kexinit: ssh-rsa,ssh-dss debug2: kex_parse_kexinit: aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,arcfour128,arcfour256,arcfour,aes192-cbc,aes256-cbc,[email protected],aes128-ctr,aes192-ctr,aes256-ctr debug2: kex_parse_kexinit: aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,arcfour128,arcfour256,arcfour,aes192-cbc,aes256-cbc,[email protected],aes128-ctr,aes192-ctr,aes256-ctr debug2: kex_parse_kexinit: hmac-md5,hmac-sha1,[email protected],hmac-ripemd160,[email protected],hmac-sha1-96,hmac-md5-96 debug2: kex_parse_kexinit: hmac-md5,hmac-sha1,[email protected],hmac-ripemd160,[email protected],hmac-sha1-96,hmac-md5-96 debug2: kex_parse_kexinit: none,[email protected] debug2: kex_parse_kexinit: none,[email protected] debug2: kex_parse_kexinit: debug2: kex_parse_kexinit: debug2: kex_parse_kexinit: first_kex_follows 0 debug2: kex_parse_kexinit: reserved 0 debug2: mac_setup: found hmac-md5 debug1: kex: server->client aes128-ctr hmac-md5 none debug2: mac_setup: found hmac-md5 debug1: kex: client->server aes128-ctr hmac-md5 none debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<1024<8192) sent debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP debug2: dh_gen_key: priv key bits set: 135/256 debug2: bits set: 507/1024 debug1: SSH2_MSG_KEX_DH_GEX_INIT sent debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY debug1: Server host key: RSA b0:07:f4:ce:c7:00:e2:54:23:1c:45:7f:d9:61:41:8a debug3: put_host_port: [63.82.7.10]:2222 debug3: put_host_port: [s1.hidden.com]:2222 debug3: load_hostkeys: loading entries for host "[s1.hidden.com]:2222" from file "/root/.ssh/known_hosts" debug3: load_hostkeys: found key type RSA in file /root/.ssh/known_hosts:4 debug3: load_hostkeys: loaded 1 keys debug3: load_hostkeys: loading entries for host "[63.82.7.10]:2222" from file "/root/.ssh/known_hosts" debug3: load_hostkeys: found key type RSA in file /root/.ssh/known_hosts:5 debug3: load_hostkeys: loaded 1 keys debug1: Host '[s1.hidden.com]:2222' is known and matches the RSA host key. debug1: Found key in /root/.ssh/known_hosts:4 debug2: bits set: 535/1024 debug1: ssh_rsa_verify: signature correct debug2: kex_derive_keys debug2: set_newkeys: mode 1 debug1: SSH2_MSG_NEWKEYS sent debug1: expecting SSH2_MSG_NEWKEYS debug2: set_newkeys: mode 0 debug1: SSH2_MSG_NEWKEYS received debug1: Roaming not allowed by server debug1: SSH2_MSG_SERVICE_REQUEST sent debug1: client_input_channel_open: ctype [email protected] rchan 2 win 65536 max 16384 debug2: fd 8 setting O_NONBLOCK debug3: fd 8 is O_NONBLOCK debug1: channel 1: new [authentication agent connection] debug1: confirm [email protected] debug2: service_accept: ssh-userauth debug1: SSH2_MSG_SERVICE_ACCEPT received debug2: key: /home/jvincent/.ssh/id_rsa (0xb8485070), debug2: key: /root/.ssh/id_rsa ((nil)), debug2: key: /root/.ssh/id_dsa ((nil)), debug2: key: /root/.ssh/id_ecdsa ((nil)), debug1: Authentications that can continue: publickey,password debug3: start over, passed a different list publickey,password debug3: preferred gssapi-keyex,gssapi-with-mic,publickey,keyboard-interactive,password debug3: authmethod_lookup publickey debug3: remaining preferred: keyboard-interactive,password debug3: authmethod_is_enabled publickey debug1: Next authentication method: publickey debug1: Offering RSA public key: /home/jvincent/.ssh/id_rsa debug3: send_pubkey_test debug2: we sent a publickey packet, wait for reply debug1: Server accepts key: pkalg ssh-rsa blen 279 debug2: input_userauth_pk_ok: fp 46:83:33:00:28:48:b2:3c:b1:3f:60:bb:62:80:cc:d2 debug3: sign_and_send_pubkey: RSA 46:83:33:00:28:48:b2:3c:b1:3f:60:bb:62:80:cc:d2 debug2: channel 1: rcvd eof debug2: channel 1: output open -> drain debug2: channel 1: obuf empty debug2: channel 1: close_write debug2: channel 1: output drain -> closed debug1: channel 1: FORCE input drain debug2: channel 1: ibuf empty debug2: channel 1: send eof debug2: channel 1: input drain -> closed debug2: channel 1: send close Connection closed by 63.82.7.10 root@intermediate-server: ~ $ debug3: channel 1: will not send data after close debug2: channel 1: rcvd close debug3: channel 1: will not send data after close debug2: channel 1: is dead debug2: channel 1: garbage collecting debug1: channel 1: free: authentication agent connection, nchannels 2 debug3: channel 1: status: The following connections are open: #0 client-session (t4 r0 i0/0 o0/0 fd 3/6 cc -1) #1 authentication agent connection (t4 r2 i3/0 o3/0 fd 8/8 cc -1) 

debugging这些问题的方法是获取到服务器的辅助通道/会话,然后启动`which sshd` -d -p 2222并检查sshd的输出以获得更好的信息。 我的经历有罪:

  • 坏的shell,检查用户的/ etc / passwd,并检查列出的用户的shell的权限和存在
  • 请检查authorized_keys以获取公钥上的强制命令
  • 错误。 简介。 _rc。* env等
  • $HOME $HOME/.ssh$HOME/.ssh/authorized_keys ,sshd可能是迂回的。 (但是,我不怀疑这个,因为它使服务器接受了密钥)

注意:您似乎有运行到中介服务器的“ssh -vv”,因为在$提示符后的debug *:消息指示中介 – >目标已退出,但现在您有一些源 – >中介详细/debugging也交错您正在查找的debugging信息。