public inbox for development@lists.ipfire.org
 help / color / mirror / Atom feed
* sshd kill all sessions on deamon stop
@ 2025-08-24  6:25 Peer Dietzmann
  2025-08-24 12:55 ` Michael Tremer
  0 siblings, 1 reply; 3+ messages in thread
From: Peer Dietzmann @ 2025-08-24  6:25 UTC (permalink / raw)
  To: development; +Cc: Peer Dietzmann

Hi All,

I discovered, that while rebooting an IPFire instance via SSH my 
terminal keeps stuck after the broadcast message because IPFire isn't 
closing all active connection correctly. As it is annoying especially 
when using SSH in SSH connections because all connections have to be 
reopened manually, I thought of adding just one line to the init-script 
that closes all running sessions.

Best regards,

Peer


diff --git a/src/initscripts/system/sshd b/src/initscripts/system/sshd
index e5a9931af..e69904c61 100644
--- a/src/initscripts/system/sshd
+++ b/src/initscripts/system/sshd
@@ -50,6 +50,7 @@ case "$1" in
      stop)
          boot_mesg "Stopping SSH Server..."
          killproc -p "/var/run/sshd.pid" /usr/sbin/sshd || true
+        killall sshd-session
          ;;

      reload)



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: sshd kill all sessions on deamon stop
  2025-08-24  6:25 sshd kill all sessions on deamon stop Peer Dietzmann
@ 2025-08-24 12:55 ` Michael Tremer
  2025-08-24 17:59   ` Peer Dietzmann
  0 siblings, 1 reply; 3+ messages in thread
From: Michael Tremer @ 2025-08-24 12:55 UTC (permalink / raw)
  To: Peer Dietzmann; +Cc: development

Hello Peer,

Thank you for your email.

I understand what you want to achieve here, but I don’t quite unterstand why. Why would those sessions need to be closed?

Your patch would have some other consequences which I don’t think you intend. For example, if someone would install an update using a SSH console and if that update upgrades OpenSSH and restarts it abort the update. The process would terminate the updater and you would be left with an incomplete update.

I suppose what we could think about is to move terminating the SSH daemon before the network is being shut down. Would that fix your problem?

-Michael

> On 24 Aug 2025, at 07:25, Peer Dietzmann <dietzmann@brecht-schule.hamburg> wrote:
> 
> Hi All,
> 
> I discovered, that while rebooting an IPFire instance via SSH my terminal keeps stuck after the broadcast message because IPFire isn't closing all active connection correctly. As it is annoying especially when using SSH in SSH connections because all connections have to be reopened manually, I thought of adding just one line to the init-script that closes all running sessions.
> 
> Best regards,
> 
> Peer
> 
> 
> diff --git a/src/initscripts/system/sshd b/src/initscripts/system/sshd
> index e5a9931af..e69904c61 100644
> --- a/src/initscripts/system/sshd
> +++ b/src/initscripts/system/sshd
> @@ -50,6 +50,7 @@ case "$1" in
>      stop)
>          boot_mesg "Stopping SSH Server..."
>          killproc -p "/var/run/sshd.pid" /usr/sbin/sshd || true
> +        killall sshd-session
>          ;;
> 
>      reload)
> 
> 



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Re: sshd kill all sessions on deamon stop
  2025-08-24 12:55 ` Michael Tremer
@ 2025-08-24 17:59   ` Peer Dietzmann
  0 siblings, 0 replies; 3+ messages in thread
From: Peer Dietzmann @ 2025-08-24 17:59 UTC (permalink / raw)
  To: Michael Tremer; +Cc: development, Peer Dietzmann

Hi Michael,

On 24/08/2025 14:55, Michael Tremer wrote:
> Hello Peer,
>
> Thank you for your email.
>
> I understand what you want to achieve here, but I don’t quite unterstand why. Why would those sessions need to be closed?
As those sessions aren't restored after a reboot, these sessions are 
then useless and have to be closed anyway. I think this could be done 
automatically by IPFire.
>
> Your patch would have some other consequences which I don’t think you intend. For example, if someone would install an update using a SSH console and if that update upgrades OpenSSH and restarts it abort the update. The process would terminate the updater and you would be left with an incomplete update.
>
> I suppose what we could think about is to move terminating the SSH daemon before the network is being shut down. Would that fix your problem?

I understand your explanation, I was unsure if my patch would also 
affect the updater, but the solution you supposed would also fix the 
problem I tried to solve with my patch. Could you add this to the 
corresponding script?

Thanks in advance!

Best regards,

Peer

>
> -Michael
>
>> On 24 Aug 2025, at 07:25, Peer Dietzmann <dietzmann@brecht-schule.hamburg> wrote:
>>
>> Hi All,
>>
>> I discovered, that while rebooting an IPFire instance via SSH my terminal keeps stuck after the broadcast message because IPFire isn't closing all active connection correctly. As it is annoying especially when using SSH in SSH connections because all connections have to be reopened manually, I thought of adding just one line to the init-script that closes all running sessions.
>>
>> Best regards,
>>
>> Peer
>>
>>
>> diff --git a/src/initscripts/system/sshd b/src/initscripts/system/sshd
>> index e5a9931af..e69904c61 100644
>> --- a/src/initscripts/system/sshd
>> +++ b/src/initscripts/system/sshd
>> @@ -50,6 +50,7 @@ case "$1" in
>>       stop)
>>           boot_mesg "Stopping SSH Server..."
>>           killproc -p "/var/run/sshd.pid" /usr/sbin/sshd || true
>> +        killall sshd-session
>>           ;;
>>
>>       reload)
>>
>>
-- 
Mit freundlichem Gruß
Peer Dietzmann

Brecht-IT  | Administration und Support

Brecht-Schule Hamburg GmbH
Norderstrasse 163-165 | 20097 Hamburg
Tel.: +49 40 21 11 12 - 37 | Fax: +49 40 21 11 12 - 20
E-Mail: dietzmann@brecht-schule.hamburg | www.brecht-schule.hamburg

Diese Email enthält ggfs. vertrauliche und/oder rechtlich geschützte Informationen.
Wenn Sie nicht der richtige Adressat sind oder diese Email irrtümlich erhalten haben, informieren Sie bitte sofort den Absender und vernichten Sie diese Email.
Das unerlaubte Kopieren sowie die unbefugte Weitergabe dieser Email ist nicht gestattet.



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-08-24 17:59 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-08-24  6:25 sshd kill all sessions on deamon stop Peer Dietzmann
2025-08-24 12:55 ` Michael Tremer
2025-08-24 17:59   ` Peer Dietzmann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox