Bug 1118

Summary: Annoying "Killed by signal 1" message with ProxyCommand
Product: Portable OpenSSH Reporter: Koef <koef>
Component: sshAssignee: Assigned to nobody <unassigned-bugs>
Status: CLOSED WONTFIX    
Severity: normal CC: koef
Priority: P2    
Version: 4.2p1   
Hardware: Other   
OS: All   
Attachments:
Description Flags
debug() and cleanup_exit() on signal rather than fatal() none

Description Koef 2005-11-12 07:34:40 AEDT
(Copied from Debian bug #313371)

When using nc or socat to bounce connections to an ssh server via an
intermediary, "Killed by signal 1." is printed when I log out.
Signal 1 is SIGHUP.  This does not happen with OpenSSH 3.9 or earlier.

Example commands:

	ssh -o 'ProxyCommand ssh localhost socat - TCP4:%h:%p' localhost

	ssh -o 'ProxyCommand ssh localhost nc %h %p' localhost

The first 'localhost' is normally the intermediary host.

Reproduced on: Linux 2.6.14, FreeBSD 6.0, Solaris 8
Comment 1 Darren Tucker 2005-11-21 08:57:27 AEDT
Well, the sighup is from this line in ssh.c:

        if (proxy_command_pid > 1)
                kill(proxy_command_pid, SIGHUP);

but without that, some proxycommands will hang around indefinitely.

The easy way to prevent it is to use "ssh -q foo bar" as the proxycommand.
Comment 2 Damien Miller 2006-03-12 15:50:13 AEDT
The current behaviour won't change, please use the workaround provided.
Comment 3 Darren Tucker 2006-10-07 11:43:07 AEST
Change all RESOLVED bug to CLOSED with the exception of the ones fixed post-4.4.
Comment 4 Colin Watson 2010-03-02 02:50:08 AEDT
Created attachment 1803 [details]
debug() and cleanup_exit() on signal rather than fatal()
Comment 5 Colin Watson 2010-03-02 02:51:34 AEDT
Closely related to this, it was pointed out to me in http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=313371#10 that ssh really shouldn't print a message when it's killed by SIGTERM or SIGINT, since those typically correspond to explicit user actions which the user doesn't need to be told about again.  Does this make sense to you as well?

For the sake of completeness, I've attached the patch that we're currently using in Debian to reduce these errors to debug messages.  At the time I didn't realise that -q would suppress output from fatal(), though, so I may drop this patch once I've looked into whether any dependent software in Debian still needs it.

It is perhaps worth noting that this patch also produces a more accurate exit code ...