Note: This bug is displayed in read-only format because
the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Cause: systemd-creds apparently runs in a chroot where /dev/shm is backed by ramfs (ramfs_t) instead of the usual tmpfs, which is not allowed in the policy
Consequence: SELinux is preventing systemd from using LoadCredentials
Fix: Reuse tmpfs_t also for the ramfs filesystem
Result: No SELinux denials
I thinks these two commits are needed:
021025430 Allow systemd-resolved watch tmpfs directories
8e908b8d9 Reuse tmpfs_t also for the ramfs filesystem
and there is one pr pending for cases when sockets are used.
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.
For information on the advisory (selinux-policy bug fix and enhancement update), and where to find the updated
files, follow the link below.
If the solution does not work for you, open a new bug report.
https://access.redhat.com/errata/RHBA-2023:2483
Description of problem: Current SELinux policies doesn't allow new systemd credentials feature. E.g. running a command like this: ``` sudo systemd-run -P --wait -p LoadCredential=abc:/etc/hosts systemd-creds cat abc ``` Results in: run-u11509.service: Failed to set up credentials: Protocol error run-u11509.service: Failed at step CREDENTIALS spawning /bin/systemd-creds: Protocol error run-u11509.service: Main process exited, code=exited, status=243/CREDENTIALS run-u11509.service: Failed with result 'exit-code'. And audit.log: type=PROCTITLE msg=audit(12/06/2022 14:32:29.129:410) : proctitle=(sd-mkdcreds) type=SYSCALL msg=audit(12/06/2022 14:32:29.129:410) : arch=x86_64 syscall=openat success=no exit=EACCES(Permission denied) a0=0x3 a1=0x55a11385ef90 a2=O_RDWR|O_CREAT|O_EXCL|O_NOCTTY|O_NOFOLLOW|O_CLOEXEC a3=0x180 items=0 ppid=3368570 pid=3368571 auid=unset uid=root gid=root euid=root suid=root fsuid=root egid=root sgid=root fsgid=root tty=(none) ses=unset comm=(sd-mkdcreds) exe=/usr/lib/systemd/systemd subj=system_u:system_r:init_t:s0 key=(null) type=AVC msg=audit(12/06/2022 14:32:29.129:410) : avc: denied { read write open } for pid=3368571 comm=(sd-mkdcreds) path=/dev/shm/.#cred8d2badcefa7a5141 dev="ramfs" ino=365308391 scontext=system_u:system_r:init_t:s0 tcontext=system_u:object_r:ramfs_t:s0 tclass=file permissive=0 This seems to be because selinux forbids systemd process to create ramfs files. Adding such permission with semodule containing the following permissions fixes the problem: allow init_t ramfs_t:file { create open read rename setattr write }; Version-Release number of selected component (if applicable): CentOS Stream 9 selinux-policy-targeted: 38.1.3 How reproducible: Everytime Steps to Reproduce: 1. Make sure selinux is enabled 2. sudo systemd-run -P --wait -p LoadCredential=abc:/etc/hosts systemd-creds cat abc Actual results: Main processes terminated with: code=exited/status=243 Expected results: Contents of /etc/hosts file Additional info: Compiling and installing semodule with the following permissions fixes the issue: allow init_t ramfs_t:file { create open read rename setattr write };