All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dominick Grift <dominick.grift@defensec.nl>
To: selinux@vger.kernel.org
Subject: systemd.exec(5) PAMName= with libselinux
Date: Mon, 21 Jul 2025 10:47:51 +0200	[thread overview]
Message-ID: <87jz42dj60.fsf@defensec.nl> (raw)


systemd has an identity directive called PAMName= which allows you to
run a unit with a specified PAM stack. The issue here is that in this
case the "session leader" is always systemd.

Thus you get into issues with pam_selinux because since systemd is for
example always associated with "init_t" you can't really specify log
SELinux identity foo_u in with foo_r:foo_t:s0 if this PAM stack is used
and log SELinux identity foo_u in with bar_r:bar_t:s0 if that PAM stack
is used.

This previously was not a big issue since this feature is pretty niche
but with the advent of `run0` it became an issue since that relies on
PAMName=

The problem is that pam_selinux is often already used to start the
systemd --user instance, for example:

/etc/selinux/TYPE/contexts/users/foo_u (/etc/pam.d/systemd-user):
system_r:init_t:s0 foo_r:foo_systemd_user_instance_t:s0

So you can't add the following because it would conflict

/etc/selinux/TYPE/contexts/user/foo_u (/etc/pam.d/run0):
system_r:init_t:s0 foo_r:foo_shell_t:s0

Ideas? Suggestions?

-- 
gpg --locate-keys dominick.grift@defensec.nl (wkd)
Key fingerprint = FCD2 3660 5D6B 9D27 7FC6  E0FF DA7E 521F 10F6 4098
Dominick Grift
Mastodon: @kcinimod@defensec.nl

             reply	other threads:[~2025-07-21  8:53 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-21  8:47 Dominick Grift [this message]
2025-07-22 19:06 ` systemd.exec(5) PAMName= with libselinux Stephen Smalley
2025-07-22 19:31   ` Dominick Grift
2025-07-23 19:16     ` Dominick Grift
2025-07-24  5:34       ` Dominick Grift
2025-09-29  2:29         ` Rahul Sandhu
2025-09-30 20:01           ` Stephen Smalley

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87jz42dj60.fsf@defensec.nl \
    --to=dominick.grift@defensec.nl \
    --cc=selinux@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.