c1caab
From 0ef48896d9f23b9fd547a532a4e6e6b8f8b12901 Mon Sep 17 00:00:00 2001
c1caab
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
c1caab
Date: Wed, 23 Nov 2022 16:09:56 +0100
c1caab
Subject: [PATCH 2/2] pam: add a call to pam_namespace
c1caab
c1caab
A call to pam_namespace is required so that children of user@.service end up in
c1caab
a namespace as expected. pam_namespace gets called as part of the stack that
c1caab
creates a session (login, sshd, gdm, etc.) and those processes end up in a
c1caab
namespace, but it also needs to be called from our stack which is parallel and
c1caab
descends from pid1 itself.
c1caab
c1caab
The call to pam_namespace is similar to the call to pam_keyinit that was added
c1caab
in ab79099d1684457d040ee7c28b2012e8c1ea9a4f. The pam stack for user@.service
c1caab
creates a new session which is disconnected from the parent environment. Both
c1caab
calls are not suitable for inclusion in the shared part of the stack (e.g.
c1caab
@system-auth on Fedora/RHEL systems), because for example su/sudo/runuser
c1caab
should not include them.
c1caab
c1caab
Fixes #17043 (Allow to execute user service into dedicated namespace
c1caab
              if pam_namespace enabled)
c1caab
Related to https://bugzilla.redhat.com/show_bug.cgi?id=1861836
c1caab
(Polyinstantiation is ignored/bypassed in GNOME sessions)
c1caab
---
c1caab
 src/login/systemd-user.in | 1 +
c1caab
 1 file changed, 1 insertion(+)
c1caab
c1caab
diff --git a/src/login/systemd-user.in b/src/login/systemd-user.in
c1caab
index d5597d28cb..06f7e36458 100644
c1caab
--- a/src/login/systemd-user.in
c1caab
+++ b/src/login/systemd-user.in
c1caab
@@ -15,6 +15,7 @@ session  required pam_selinux.so nottys open
c1caab
 {% endif %}
c1caab
 session  required pam_loginuid.so
c1caab
 session  optional pam_keyinit.so force revoke
c1caab
+session  required pam_namespace.so
c1caab
 {% if ENABLE_HOMED %}
c1caab
 -session  optional pam_systemd_home.so
c1caab
 {% endif %}
c1caab
-- 
c1caab
2.38.1
c1caab