teknoraver / rpms / systemd

Forked from rpms/systemd 2 months ago
Clone

Blame 0002-pam-add-a-call-to-pam_namespace.patch

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