Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 785874 - net-misc/openssh: sshd.service should include KillMode=process
Summary: net-misc/openssh: sshd.service should include KillMode=process
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo's Team for Core System packages
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-04-26 19:46 UTC by Roy Yang
Modified: 2021-04-26 20:23 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Roy Yang 2021-04-26 19:46:26 UTC
When restart sshd service, KillMode sprecifys which mode the process is supposed to be killed. See https://www.freedesktop.org/software/systemd/man/systemd.kill.html

By default, It will kill all process in control-group, that is, main process and its forked ones. This is not desirable in practice. Usually, developers expect his session still remains.

Also investigated the other distros, KillMode=process is prefered.

Reproducible: Always

Steps to Reproduce:
1.ssh machineA
2.sudo systemctl restart sshd

Actual Results:  
Current ssh session is dropped

Expected Results:  
Expected sshd is restarted, but current ssh session remains.
Comment 1 Roy Yang 2021-04-26 20:02:04 UTC
Submit a CL: https://github.com/gentoo/gentoo/pull/20551
Comment 2 Mike Gilbert gentoo-dev 2021-04-26 20:11:34 UTC
> Actual Results:  
> Current ssh session is dropped

That should not happen, regardless of the KillMode setting in the service unit.

pam_systemd should move the session to a separate scope, which will prevent the session sshd from being killed.

Do you have PAM disabled? If so, I suggest you enable it for proper SSH session management.
Comment 3 Mike Gilbert gentoo-dev 2021-04-26 20:21:20 UTC
Anyway, I guess changing the KillMode won't hurt anything. I'll merge it.
Comment 4 Larry the Git Cow gentoo-dev 2021-04-26 20:23:31 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=28ae62f0ee4f0fc34987713043a036d581e4a3e8

commit 28ae62f0ee4f0fc34987713043a036d581e4a3e8
Author:     Roy Yang <royyang@google.com>
AuthorDate: 2021-04-26 19:50:42 +0000
Commit:     Mike Gilbert <floppym@gentoo.org>
CommitDate: 2021-04-26 20:22:33 +0000

    net-misc/openssh: Add KillMode=process to sshd.service
    
    Closes: https://bugs.gentoo.org/785874
    Closes: https://github.com/gentoo/gentoo/pull/20551
    Signed-off-by: Roy Yang <royyang@google.com>
    Signed-off-by: Mike Gilbert <floppym@gentoo.org>

 net-misc/openssh/files/sshd.service | 1 +
 1 file changed, 1 insertion(+)