kingToolbox / kingToolbox/WindTerm

Agent forwarding login stuck

Open
#2,454 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
C
Stars
32.3k
Forks
2.5k
PR merge metrics
No merged PRs in 30d

Description

ver: `2.7-prerelease`
system: `Windows 10`
Linux Server ssh version: `OpenSSH_7.4p1, OpenSSL 1.0.2k-fips 26 Jan 2017`

SecureCRT does not rely on the local `ssh-agent` service, Just check `Add key to agent` and `Enable OpenSSH agent forwarding`.
WindTerm operation is more complicated. You need to start the `ssh-agent` service and then manually execute `ssh-add private_key` to add the key.
The server login is always stuck. I have to use ctrl+c to terminate it. Then the terminal symbol becomes `-bash-4.2$`.

linux server log:
```
Jul 17 20:57:07 ****** sshd[941]: debug1: Forked child 9867.
Jul 17 20:57:07 ****** sshd[9867]: debug1: Set /proc/self/oom_score_adj to 0
Jul 17 20:57:07 ****** sshd[9867]: debug1: rexec start in 5 out 5 newsock 5 pipe 7 sock 8
Jul 17 20:57:07 ****** sshd[9867]: debug1: inetd sockets after dupping: 3, 3
Jul 17 20:57:07 ****** sshd[9867]: Connection from ***local IP*** port ***local port*** on ***remote IP*** port ***remote port***
Jul 17 20:57:07 ****** sshd[9867]: debug1: Client protocol version 2.0; client software version libssh_0.9.6
Jul 17 20:57:07 ****** sshd[9867]: debug1: no match: libssh_0.9.6
Jul 17 20:57:07 ****** sshd[9867]: debug1: Local version string SSH-2.0-OpenSSH_7.4
Jul 17 20:57:07 ****** sshd[9867]: debug1: Enabling compatibility mode for protocol 2.0
Jul 17 20:57:07 ****** sshd[9867]: debug1: SELinux support disabled [preauth]
Jul 17 20:57:07 ****** sshd[9867]: debug1: permanently_set_uid: 74/74 [preauth]
Jul 17 20:57:07 ****** sshd[9867]: debug1: list_hostkey_types: ssh-rsa,rsa-sha2-512,rsa-sha2-256,ecdsa-sha2-nistp256,ssh-ed25519 [preauth]
Jul 17 20:57:07 ****** sshd[9867]: debug1: SSH2_MSG_KEXINIT sent [preauth]
Jul 17 20:57:07 ****** sshd[9867]: debug1: SSH2_MSG_KEXINIT received [preauth]
Jul 17 20:57:07 ****** sshd[9867]: debug1: kex: algorithm: curve25519-sha256 [preauth]
Jul 17 20:57:07 ****** sshd[9867]: debug1: kex: host key algorithm: ssh-ed25519 [preauth]
Jul 17 20:57:07 ****** sshd[9867]: debug1: kex: client->server cipher: aes256-gcm@openssh.com MAC: compression: none [preauth]
Jul 17 20:57:07 ****** sshd[9867]: debug1: kex: server->client cipher: aes256-gcm@openssh.com MAC: compression: none [preauth]
Jul 17 20:57:07 ****** sshd[9867]: debug1: kex: curve25519-sha256 need=32 dh_need=32 [preauth]
Jul 17 20:57:07 ****** sshd[9867]: debug1: kex: curve25519-sha256 need=32 dh_need=32 [preauth]
Jul 17 20:57:07 ****** sshd[9867]: debug1: expecting SSH2_MSG_KEX_ECDH_INIT [preauth]
Jul 17 20:57:07 ****** sshd[9867]: debug1: rekey after 4294967296 blocks [preauth]
Jul 17 20:57:07 ****** sshd[9867]: debug1: SSH2_MSG_NEWKEYS sent [preauth]
Jul 17 20:57:07 ****** sshd[9867]: debug1: expecting SSH2_MSG_NEWKEYS [preauth]
Jul 17 20:57:07 ****** sshd[9867]: debug1: SSH2_MSG_NEWKEYS received [preauth]
Jul 17 20:57:07 ****** sshd[9867]: debug1: rekey after 4294967296 blocks [preauth]
Jul 17 20:57:07 ****** sshd[9867]: debug1: KEX done [preauth]
Jul 17 20:57:07 ****** sshd[9867]: debug1: userauth-request for user admin service ssh-connection method none [preauth]
Jul 17 20:57:07 ****** sshd[9867]: debug1: attempt 0 failures 0 [preauth]
Jul 17 20:57:07 ****** sshd[9867]: debug1: PAM: initializing for "admin"
Jul 17 20:57:07 ****** sshd[9867]: debug1: PAM: setting PAM_RHOST to "***local IP***"
Jul 17 20:57:07 ****** sshd[9867]: debug1: PAM: setting PAM_TTY to "ssh"
Jul 17 20:57:07 ****** sshd[9867]: debug1: userauth-request for user admin service ssh-connection method publickey [preauth]
Jul 17 20:57:07 ****** sshd[9867]: debug1: attempt 1 failures 0 [preauth]
Jul 17 20:57:07 ****** sshd[9867]: debug1: userauth_pubkey: test whether pkalg/pkblob are acceptable for RSA SHA256:****** [preauth]
Jul 17 20:57:07 ****** sshd[9867]: debug1: temporarily_use_uid: 1001/1001 (e=0/0)
Jul 17 20:57:07 ****** sshd[9867]: debug1: trying public key file /home/admin/.ssh/authorized_keys
Jul 17 20:57:07 ****** sshd[9867]: debug1: fd 4 clearing O_NONBLOCK
Jul 17 20:57:07 ****** sshd[9867]: debug1: matching key found: file /home/admin/.ssh/authorized_keys, line 13 RSA SHA256:******
Jul 17 20:57:07 ****** sshd[9867]: debug1: restore_uid: 0/0
Jul 17 20:57:07 ****** sshd[9867]: Postponed publickey for admin from ***local IP*** port ***local port*** ssh2 [preauth]
Jul 17 20:57:07 ****** sshd[9867]: debug1: userauth-request for user admin service ssh-connection method publickey [preauth]
Jul 17 20:57:07 ****** sshd[9867]: debug1: attempt 2 failures 0 [preauth]
Jul 17 20:57:07 ****** sshd[9867]: debug1: temporarily_use_uid: 1001/1001 (e=0/0)
Jul 17 20:57:07 ****** sshd[9867]: debug1: trying public key file /home/admin/.ssh/authorized_keys
Jul 17 20:57:07 ****** sshd[9867]: debug1: fd 4 clearing O_NONBLOCK
Jul 17 20:57:07 ****** sshd[9867]: debug1: matching key found: file /home/admin/.ssh/authorized_keys, line 13 RSA SHA256:******
Jul 17 20:57:07 ****** sshd[9867]: debug1: restore_uid: 0/0
Jul 17 20:57:07 ****** sshd[9867]: debug1: do_pam_account: called
Jul 17 20:57:07 ****** sshd[9867]: Accepted publickey for admin from ***local IP*** port ***local port*** ssh2: RSA SHA256:******
Jul 17 20:57:07 ****** sshd[9867]: debug1: monitor_child_preauth: admin has been authenticated by privileged process
Jul 17 20:57:07 ****** sshd[9867]: debug1: monitor_read_log: child log fd closed
Jul 17 20:57:07 ****** sshd[9867]: debug1: SELinux support disabled
Jul 17 20:57:07 ****** sshd[9867]: debug1: PAM: establishing credentials
Jul 17 20:57:07 ****** sshd[9867]: pam_unix(sshd:session): session opened for user admin by (uid=0)
Jul 17 20:57:07 ****** sshd[9867]: User child is on pid 10017
Jul 17 20:57:07 ****** sshd[10017]: debug1: PAM: establishing credentials
Jul 17 20:57:07 ****** sshd[10017]: debug1: permanently_set_uid: 1001/1001
Jul 17 20:57:07 ****** sshd[10017]: debug1: rekey after 4294967296 blocks
Jul 17 20:57:07 ****** sshd[10017]: debug1: rekey after 4294967296 blocks
Jul 17 20:57:07 ****** sshd[10017]: debug1: ssh_packet_set_postauth: called
Jul 17 20:57:07 ****** sshd[10017]: debug1: Entering interactive session for SSH2.
Jul 17 20:57:07 ****** sshd[10017]: debug1: server_init_dispatch
Jul 17 20:57:07 ****** sshd[10017]: debug1: server_input_channel_open: ctype session rchan 43 win 64000 max 261120
Jul 17 20:57:07 ****** sshd[10017]: debug1: input_session_request
Jul 17 20:57:07 ****** sshd[10017]: debug1: channel 0: new [server-session]
Jul 17 20:57:07 ****** sshd[10017]: debug1: session_new: session 0
Jul 17 20:57:07 ****** sshd[10017]: debug1: session_open: channel 0
Jul 17 20:57:07 ****** sshd[10017]: debug1: session_open: session 0: link with channel 0
Jul 17 20:57:07 ****** sshd[10017]: debug1: server_input_channel_open: confirm session
Jul 17 20:57:07 ****** sshd[10017]: debug1: server_input_channel_req: channel 0 request auth-agent-req@openssh.com reply 0
Jul 17 20:57:07 ****** sshd[10017]: debug1: session_by_channel: session 0 channel 0
Jul 17 20:57:07 ****** sshd[10017]: debug1: session_input_channel_req: session 0 req auth-agent-req@openssh.com
Jul 17 20:57:07 ****** sshd[10017]: debug1: temporarily_use_uid: 1001/1001 (e=1001/1001)
Jul 17 20:57:07 ****** sshd[10017]: debug1: restore_uid: (unprivileged)
Jul 17 20:57:07 ****** sshd[10017]: debug1: channel 1: new [auth socket]
Jul 17 20:57:07 ****** sshd[10017]: debug1: server_input_channel_req: channel 0 request pty-req reply 1
Jul 17 20:57:07 ****** sshd[10017]: debug1: session_by_channel: session 0 channel 0
Jul 17 20:57:07 ****** sshd[10017]: debug1: session_input_channel_req: session 0 req pty-req
Jul 17 20:57:07 ****** sshd[10017]: debug1: Allocating pty.
Jul 17 20:57:07 ****** sshd[9867]: debug1: session_new: session 0
Jul 17 20:57:07 ****** sshd[9867]: debug1: SELinux support disabled
Jul 17 20:57:07 ****** sshd[10017]: debug1: session_pty_req: session 0 alloc /dev/pts/4
Jul 17 20:57:08 ****** sshd[10017]: debug1: server_input_channel_req: channel 0 request shell reply 1
Jul 17 20:57:08 ****** sshd[10017]: debug1: session_by_channel: session 0 channel 0
Jul 17 20:57:08 ****** sshd[10017]: debug1: session_input_channel_req: session 0 req shell
Jul 17 20:57:08 ****** sshd[10017]: Starting session: shell on pts/4 for admin from ***local IP*** port ***local port*** id 0
Jul 17 20:57:08 ****** sshd[10175]: debug1: Setting controlling tty using TIOCSCTTY.
Jul 17 20:57:08 ****** sshd[10017]: debug1: server_input_channel_req: channel 0 request window-change reply 0
Jul 17 20:57:08 ****** sshd[10017]: debug1: session_by_channel: session 0 channel 0
Jul 17 20:57:08 ****** sshd[10017]: debug1: session_input_channel_req: session 0 req window-change
Jul 17 20:57:08 ****** sshd[10017]: debug1: server_input_channel_req: channel 0 request window-change reply 0
Jul 17 20:57:08 ****** sshd[10017]: debug1: session_by_channel: session 0 channel 0
Jul 17 20:57:08 ****** sshd[10017]: debug1: session_input_channel_req: session 0 req window-change
Jul 17 20:57:09 ****** sshd[10017]: debug1: channel 2: new [accepted auth socket]
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reproducing the stuck login on Windows 10 with agent forwarding enabled, using the reported OpenSSH server and libssh_0.9.6 details. Compare the client behavior with the server log around auth-agent-req@openssh.com and the accepted auth socket. Done means the forwarded-agent session reaches a usable shell without requiring Ctrl+C.

Written by the indexing model from the issue text.

Assessment

Domain
authentication, networking
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.