Bug 2257 - ssh - Connection closed by UNKNOWN
Summary: ssh - Connection closed by UNKNOWN
Status: CLOSED FIXED
Alias: None
Product: Portable OpenSSH
Classification: Unclassified
Component: ssh (show other bugs)
Version: 6.6p1
Hardware: All Linux
: P5 minor
Assignee: Damien Miller
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-07-18 14:32 AEST by Petr Lautrbach
Modified: 2015-08-11 23:05 AEST (History)
2 users (show)

See Also:


Attachments
add set_remote_ipaddr() (2.10 KB, patch)
2014-07-18 14:35 AEST, Petr Lautrbach
no flags Details | Diff
improve ECONNRESET error message (786 bytes, patch)
2015-05-01 14:43 AEST, Damien Miller
no flags Details | Diff
improved diff; refactor to sshpkt_fatal (1.99 KB, patch)
2015-05-01 14:51 AEST, Damien Miller
dtucker: ok+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Petr Lautrbach 2014-07-18 14:32:04 AEST
ssh clients shows "closed by UNKNOWN" message when a socket is closed by a
remote side while ssh is waiting for user's password:

$ ssh user@localhost
user@localhost's password:
Connection closed by UNKNOWN

When the packet_read_seqnr() calls get_remote_ipaddr(), a connection's
socket is already closed and there's not been any other call of this function
yet so canonical_host_ip from canohost.c is still NULL and the function
returns "UNKNOWN". I think that it could be workarounded by calling get_remote_ipaddr() right
after packet_set_connection(), e.g. using another debug message, or
there could be set_remote_ipaddr() in canonhost.c for that.
Comment 1 Petr Lautrbach 2014-07-18 14:35:48 AEST
Created attachment 2457 [details]
add set_remote_ipaddr()
Comment 2 Damien Miller 2015-05-01 14:43:51 AEST
Created attachment 2611 [details]
improve ECONNRESET error message

On -current, just tweaking the error seems sufficient.

$ ./ssh/obj/ssh -p 2222 127.0.0.1                                
djm@127.0.0.1's password: 
Connection reset by 127.0.0.1
Comment 3 Damien Miller 2015-05-01 14:51:44 AEST
Created attachment 2612 [details]
improved diff; refactor to sshpkt_fatal

I just noticed there is already sshpkt_fatal() for this purpose
Comment 4 Damien Miller 2015-05-01 17:10:21 AEST
patch applied - this will be in openssh-6.9
Comment 5 Damien Miller 2015-08-11 23:05:39 AEST
Set all RESOLVED bugs to CLOSED with release of OpenSSH 7.1