b11b5f
From b1b7aaf83414c5b0bed6e61d38aefe29a21fdbcf Mon Sep 17 00:00:00 2001
b11b5f
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
b11b5f
Date: Wed, 23 Nov 2022 16:09:56 +0100
b11b5f
Subject: [PATCH] pam: add a call to pam_namespace
b11b5f
b11b5f
A call to pam_namespace is required so that children of user@.service end up in
b11b5f
a namespace as expected. pam_namespace gets called as part of the stack that
b11b5f
creates a session (login, sshd, gdm, etc.) and those processes end up in a
b11b5f
namespace, but it also needs to be called from our stack which is parallel and
b11b5f
descends from pid1 itself.
b11b5f
b11b5f
The call to pam_namespace is similar to the call to pam_keyinit that was added
b11b5f
in ab79099d1684457d040ee7c28b2012e8c1ea9a4f. The pam stack for user@.service
b11b5f
creates a new session which is disconnected from the parent environment. Both
b11b5f
calls are not suitable for inclusion in the shared part of the stack (e.g.
b11b5f
@system-auth on Fedora/RHEL systems), because for example su/sudo/runuser
b11b5f
should not include them.
b11b5f
b11b5f
(cherry picked from commit 0ef48896d9f23b9fd547a532a4e6e6b8f8b12901)
b11b5f
b11b5f
Resolves: #1861836
b11b5f
---
b11b5f
 src/login/systemd-user.m4 | 1 +
b11b5f
 1 file changed, 1 insertion(+)
b11b5f
b11b5f
diff --git a/src/login/systemd-user.m4 b/src/login/systemd-user.m4
b11b5f
index 20c8999331..eb291beaed 100644
b11b5f
--- a/src/login/systemd-user.m4
b11b5f
+++ b/src/login/systemd-user.m4
b11b5f
@@ -9,4 +9,5 @@ session required pam_selinux.so nottys open
b11b5f
 )m4_dnl
b11b5f
 session required pam_loginuid.so
b11b5f
 session optional pam_keyinit.so force revoke
b11b5f
+session required pam_namespace.so
b11b5f
 session optional pam_systemd.so