older versions of OpenSSH periodically kill the connection when multiple channels are opened

Terra Frost terrafrost at gmail.com
Wed Oct 13 13:58:53 AEDT 2021


Sometimes when I connect to older OpenSSH servers the server closes the
connection. Doing "sudo /usr/sbin/sshd -ddd -p2222 &" gives me the
following error:

> debug1: Unable to open session: The name org.freedesktop.ConsoleKit was
not provided by any .service files

What the client is doing is...  it's opening up an interactive session on
one channel, requesting a pty and starting a shell on that channel and then
running "ping 127.0.0.1" on the shell.

The client then opens up another interactive session, on another channel
and tries to request a pty on the other channel but no response is received
because the server has closed the connection.

Here's the full log of the back and forth unencrypted SSH traffic:

-> SSH_MSG_CHANNEL_OPEN (since last: 1.9427, network: 0s)
00000000  00:00:00:07:73:65:73:73:69:6f:6e:00:00:00:02:7f  ....session.....
00000010  ff:ff:ff:00:00:40:00                             ..... at .

<- SSH_MSG_CHANNEL_OPEN_CONFIRMATION (since last: 0.0355, network: 0.0001s)
00000000  00:00:00:02:00:00:00:00:00:00:00:00:00:00:80:00  ................

-> SSH_MSG_CHANNEL_REQUEST (since last: 0.0003, network: 0s)
00000000  00:00:00:00:00:00:00:07:70:74:79:2d:72:65:71:01  ........pty-req.
00000010  00:00:00:05:76:74:31:30:30:00:00:00:50:00:00:00  ....vt100...P...
00000020  18:00:00:00:00:00:00:00:00:00:00:00:01:00        ..............

<- SSH_MSG_CHANNEL_SUCCESS (since last: 0.0006, network: 0s)
00000000  00:00:00:02                                      ....

-> SSH_MSG_CHANNEL_REQUEST (since last: 0.0002, network: 0s)
00000000  00:00:00:00:00:00:00:05:73:68:65:6c:6c:01        ........shell.

<- SSH_MSG_CHANNEL_WINDOW_ADJUST (since last: 0.0006, network: 0s)
00000000  00:00:00:02:00:20:00:00                          ..... ..

<- SSH_MSG_CHANNEL_SUCCESS (since last: 0.0001, network: 0s)
00000000  00:00:00:02                                      ....

-> SSH_MSG_CHANNEL_DATA (since last: 0.0002, network: 0s)
00000000  00:00:00:00:00:00:00:0f:70:69:6e:67:20:31:32:37  ........ping 127
00000010  2e:30:2e:30:2e:31:0a                             .0.0.1.

-> SSH_MSG_CHANNEL_OPEN (since last: 0.0002, network: 0s)
00000000  00:00:00:07:73:65:73:73:69:6f:6e:00:00:00:01:7f  ....session.....
00000010  ff:ff:ff:00:00:40:00                             ..... at .

<- SSH_MSG_CHANNEL_DATA (since last: 0.0005, network: 0s)
00000000  00:00:00:02:00:00:00:36:4c:61:73:74:20:6c:6f:67  .......6Last log
00000010  69:6e:3a:20:54:75:65:20:4f:63:74:20:31:32:20:30  in: Tue Oct 12 0
00000020  33:3a:34:33:3a:31:31:20:32:30:32:31:20:66:72:6f  3:43:11 2021 fro
00000030  6d:20:6c:6f:63:61:6c:68:6f:73:74:0d:0d:0a        m localhost...

<- SSH_MSG_CHANNEL_OPEN_CONFIRMATION (since last: 0.0003, network: 0s)
00000000  00:00:00:01:00:00:00:01:00:00:00:00:00:00:80:00  ................

-> SSH_MSG_CHANNEL_REQUEST (since last: 0.0002, network: 0s)
00000000  00:00:00:01:00:00:00:07:70:74:79:2d:72:65:71:01  ........pty-req.
00000010  00:00:00:05:76:74:31:30:30:00:00:00:50:00:00:00  ....vt100...P...
00000020  18:00:00:00:00:00:00:00:00:00:00:00:01:00        ..............

Here's the full error log that the OpenSSH server is providing:

debug1: server_input_channel_req: channel 1 request pty-req reply 1
debug1: session_by_channel: session 1 channel 1
debug1: session_input_channel_req: session 1 req pty-req
debug1: Allocating pty.
debug3: mm_request_send entering: type 28
debug3: mm_pty_allocate: waiting for MONITOR_ANS_PTY
debug3: mm_request_receive_expect entering: type 29
debug3: mm_request_receive entering
debug1: Unable to open session: The name org.freedesktop.ConsoleKit was not
provided by any .service files
debug3: mm_request_send entering: type 157
debug3: mm_request_receive entering
debug3: monitor_read: checking request 28
debug3: mm_answer_pty entering
debug2: session_new: allocate (allocated 1 max 10)
debug3: session_unused: session id 1 unused
debug1: session_new: session 1
debug3: mm_request_send entering: type 29
debug3: mm_answer_pty: tty /dev/pts/3 ptyfd 9
mm_request_receive_expect: read: rtype 157 != type 29
debug1: do_cleanup
debug3: PAM: sshpam_thread_cleanup entering
debug3: mm_request_receive entering
mm_request_receive: read: Connection reset by peer
debug1: do_cleanup
debug1: PAM: cleanup
debug1: PAM: closing session
debug1: PAM: deleting credentials
debug3: PAM: sshpam_thread_cleanup entering
debug1: session_pty_cleanup: session 0 release /dev/pts/2
debug1: unregistering ConsoleKit session (null)
debug1: session_pty_cleanup: session 1 release /dev/pts/3
debug1: audit_event: unhandled event 12

I haven't seen this issue on SSH-2.0-OpenSSH_7.2p2 Ubuntu-4ubuntu2.8 or
later versions but, none-the-less, this error is causing some unit tests to
fail, intermittently.

Should I make it so that the client won't open up multiple channels on
versions of OpenSSH older than 7.2?

If this issue is indeed a resolved issue is there a changelog entry that
mentions the fix that I can cite in my code?


More information about the openssh-unix-dev mailing list