When the client connects a few service processes are running, pulseaudio, unfsd etc. These services are used from within the session via remote port forwarding tunnels within the ssh connection. If a service dies, eg. there is no end point of the remote port forwarding tunnel and that the server side tries to connect, the SSH process logs an error message of a broken port forwarding tunnel. If the client on the server side misbehaves, eg. retries to establish a connection within a loop, the logfile will be filled up. A simple way to reproduce is: 1. Connect to a session 2. Kill pulseaudio process that the client has started 3. Look at tlclient.log file filling up with error logs from SSH
One way to overcome this problem is to cancel the SSH port forwarding when the client notices that the process behind the service is not available any more.
Created attachment 901 [details] Cancel port forwarding if service process is gone This patch will wrap a service process into a subclass that can act upon when a process is not available anymore. When that is the case, the remote port forwarding will be cancelled.
(In reply to comment #3) > Created an attachment (id=901) [details] > Cancel port forwarding if service process is gone > > This patch will wrap a service process into a subclass that can act upon > when a process is not available anymore. When that is the case, the remote port > forwarding will be cancelled. > This patch forces SSH to enable a pseudo tty and uses escape sequence '~C' to send command '-KR<port>' to cancel an active remote port forwarding.
This is a problem when the log level is turned up as you get a whole bunch of debug lines from ssh in that case. > 2019-01-09T13:20:37: ssh[E]: debug1: client_input_channel_open: ctype forwarded-tcpip rchan 11 win 2097152 max 32768 > 2019-01-09T13:20:37: ssh[E]: debug1: client_request_forwarded_tcpip: listen localhost port 5015, originator 127.0.0.1 port 42828 > 2019-01-09T13:20:37: ssh[E]: debug1: connect_next: host 127.0.0.1 ([127.0.0.1]:34745) in progress, fd=8 > 2019-01-09T13:20:37: ssh[E]: debug1: channel 3: new [127.0.0.1] > 2019-01-09T13:20:37: ssh[E]: debug1: confirm forwarded-tcpip > 2019-01-09T13:20:37: ssh[E]: debug1: channel 3: connection failed: Connection refused > 2019-01-09T13:20:37: ssh[E]: connect_to 127.0.0.1 port 34745: failed. > 2019-01-09T13:20:37: ssh[E]: debug1: channel 3: free: 127.0.0.1, nchannels 4 On the default level you get the same line each time: > 2019-01-09T13:20:37: ssh[E]: connect_to 127.0.0.1 port 34745: failed. Which means it will only be written once (eventually followed by "Last line repeated X times...").
Unfortunately sshd also logs this on the server, filling up server log files. :/ Even if we fix our client to be more well behaved, a malicious client could still use this to fill up the server's log space. Upstream should probably reconsider this logging.