Bug 1804773
| Summary: | SELinux prevents systemd-journal-upload from stat()-ing POSIX shared memory segments | ||
|---|---|---|---|
| Product: | Red Hat Enterprise Linux 8 | Reporter: | Milos Malik <mmalik> |
| Component: | selinux-policy | Assignee: | Zdenek Pytela <zpytela> |
| Status: | CLOSED DUPLICATE | QA Contact: | Milos Malik <mmalik> |
| Severity: | medium | Docs Contact: | |
| Priority: | medium | ||
| Version: | 8.2 | CC: | lvrabec, mmalik, plautrba, rfilo, ssekidde |
| Target Milestone: | rc | Keywords: | Triaged |
| Target Release: | --- | Flags: | pm-rhel:
mirror+
|
| Hardware: | All | ||
| OS: | Linux | ||
| Whiteboard: | |||
| Fixed In Version: | Doc Type: | If docs needed, set a value | |
| Doc Text: | Story Points: | --- | |
| Clone Of: | Environment: | ||
| Last Closed: | 2020-06-09 14:39:16 UTC | Type: | Bug |
| Regression: | --- | Mount Type: | --- |
| Documentation: | --- | CRM: | |
| Verified Versions: | Category: | --- | |
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
| Cloudforms Team: | --- | Target Upstream Version: | |
| Embargoed: | |||
SELinux denials caught in enforcing mode:
----
type=PROCTITLE msg=audit(02/19/2020 16:09:53.856:1284) : proctitle=(l-upload)
type=PATH msg=audit(02/19/2020 16:09:53.856:1284) : item=0 name=vhostmd0 inode=70576 dev=00:15 mode=file,644 ouid=root ogid=root rdev=00:00 obj=system_u:object_r:vhostmd_tmpfs_t:s0 nametype=NORMAL cap_fp=none cap_fi=none cap_fe=0 cap_fver=0 cap_frootid=0
type=CWD msg=audit(02/19/2020 16:09:53.856:1284) : cwd=/
type=SYSCALL msg=audit(02/19/2020 16:09:53.856:1284) : arch=x86_64 syscall=newfstatat success=no exit=EACCES(Permission denied) a0=0x8 a1=0x5557b29e8273 a2=0x7ffee1479e00 a3=0x100 items=1 ppid=1 pid=19496 auid=unset uid=root gid=root euid=root suid=root fsuid=root egid=root sgid=root fsgid=root tty=(none) ses=unset comm=(l-upload) exe=/usr/lib/systemd/systemd subj=system_u:system_r:init_t:s0 key=(null)
type=AVC msg=audit(02/19/2020 16:09:53.856:1284) : avc: denied { getattr } for pid=19496 comm=(l-upload) path=/dev/shm/vhostmd0 dev="tmpfs" ino=70576 scontext=system_u:system_r:init_t:s0 tcontext=system_u:object_r:vhostmd_tmpfs_t:s0 tclass=file permissive=0
----
type=PROCTITLE msg=audit(02/19/2020 16:09:53.856:1285) : proctitle=(l-upload)
type=PATH msg=audit(02/19/2020 16:09:53.856:1285) : item=0 name=squid-cf__readers.shm inode=69285 dev=00:15 mode=file,600 ouid=squid ogid=squid rdev=00:00 obj=system_u:object_r:squid_tmpfs_t:s0 nametype=NORMAL cap_fp=none cap_fi=none cap_fe=0 cap_fver=0 cap_frootid=0
type=CWD msg=audit(02/19/2020 16:09:53.856:1285) : cwd=/
type=SYSCALL msg=audit(02/19/2020 16:09:53.856:1285) : arch=x86_64 syscall=newfstatat success=no exit=EACCES(Permission denied) a0=0x8 a1=0x5557b29e8293 a2=0x7ffee1479e00 a3=0x100 items=1 ppid=1 pid=19496 auid=unset uid=root gid=root euid=root suid=root fsuid=root egid=root sgid=root fsgid=root tty=(none) ses=unset comm=(l-upload) exe=/usr/lib/systemd/systemd subj=system_u:system_r:init_t:s0 key=(null)
type=AVC msg=audit(02/19/2020 16:09:53.856:1285) : avc: denied { getattr } for pid=19496 comm=(l-upload) path=/dev/shm/squid-cf__readers.shm dev="tmpfs" ino=69285 scontext=system_u:system_r:init_t:s0 tcontext=system_u:object_r:squid_tmpfs_t:s0 tclass=file permissive=0
----
type=PROCTITLE msg=audit(02/19/2020 16:09:53.856:1286) : proctitle=(l-upload)
type=PATH msg=audit(02/19/2020 16:09:53.856:1286) : item=0 name=squid-cf__queues.shm inode=69284 dev=00:15 mode=file,600 ouid=squid ogid=squid rdev=00:00 obj=system_u:object_r:squid_tmpfs_t:s0 nametype=NORMAL cap_fp=none cap_fi=none cap_fe=0 cap_fver=0 cap_frootid=0
type=CWD msg=audit(02/19/2020 16:09:53.856:1286) : cwd=/
type=SYSCALL msg=audit(02/19/2020 16:09:53.856:1286) : arch=x86_64 syscall=newfstatat success=no exit=EACCES(Permission denied) a0=0x8 a1=0x5557b29e82c3 a2=0x7ffee1479e00 a3=0x100 items=1 ppid=1 pid=19496 auid=unset uid=root gid=root euid=root suid=root fsuid=root egid=root sgid=root fsgid=root tty=(none) ses=unset comm=(l-upload) exe=/usr/lib/systemd/systemd subj=system_u:system_r:init_t:s0 key=(null)
type=AVC msg=audit(02/19/2020 16:09:53.856:1286) : avc: denied { getattr } for pid=19496 comm=(l-upload) path=/dev/shm/squid-cf__queues.shm dev="tmpfs" ino=69284 scontext=system_u:system_r:init_t:s0 tcontext=system_u:object_r:squid_tmpfs_t:s0 tclass=file permissive=0
----
type=PROCTITLE msg=audit(02/19/2020 16:09:53.856:1287) : proctitle=(l-upload)
type=PATH msg=audit(02/19/2020 16:09:53.856:1287) : item=0 name=squid-cf__metadata.shm inode=69283 dev=00:15 mode=file,600 ouid=squid ogid=squid rdev=00:00 obj=system_u:object_r:squid_tmpfs_t:s0 nametype=NORMAL cap_fp=none cap_fi=none cap_fe=0 cap_fver=0 cap_frootid=0
type=CWD msg=audit(02/19/2020 16:09:53.856:1287) : cwd=/
type=SYSCALL msg=audit(02/19/2020 16:09:53.856:1287) : arch=x86_64 syscall=newfstatat success=no exit=EACCES(Permission denied) a0=0x8 a1=0x5557b29e82eb a2=0x7ffee1479e00 a3=0x100 items=1 ppid=1 pid=19496 auid=unset uid=root gid=root euid=root suid=root fsuid=root egid=root sgid=root fsgid=root tty=(none) ses=unset comm=(l-upload) exe=/usr/lib/systemd/systemd subj=system_u:system_r:init_t:s0 key=(null)
type=AVC msg=audit(02/19/2020 16:09:53.856:1287) : avc: denied { getattr } for pid=19496 comm=(l-upload) path=/dev/shm/squid-cf__metadata.shm dev="tmpfs" ino=69283 scontext=system_u:system_r:init_t:s0 tcontext=system_u:object_r:squid_tmpfs_t:s0 tclass=file permissive=0
----
type=PROCTITLE msg=audit(02/19/2020 16:09:53.856:1288) : proctitle=(l-upload)
type=PATH msg=audit(02/19/2020 16:09:53.856:1288) : item=0 name=lldpad.state inode=52563 dev=00:15 mode=file,600 ouid=root ogid=root rdev=00:00 obj=system_u:object_r:lldpad_tmpfs_t:s0 nametype=NORMAL cap_fp=none cap_fi=none cap_fe=0 cap_fver=0 cap_frootid=0
type=CWD msg=audit(02/19/2020 16:09:53.856:1288) : cwd=/
type=SYSCALL msg=audit(02/19/2020 16:09:53.856:1288) : arch=x86_64 syscall=newfstatat success=no exit=EACCES(Permission denied) a0=0x8 a1=0x5557b29e831b a2=0x7ffee1479e00 a3=0x100 items=1 ppid=1 pid=19496 auid=unset uid=root gid=root euid=root suid=root fsuid=root egid=root sgid=root fsgid=root tty=(none) ses=unset comm=(l-upload) exe=/usr/lib/systemd/systemd subj=system_u:system_r:init_t:s0 key=(null)
type=AVC msg=audit(02/19/2020 16:09:53.856:1288) : avc: denied { getattr } for pid=19496 comm=(l-upload) path=/dev/shm/lldpad.state dev="tmpfs" ino=52563 scontext=system_u:system_r:init_t:s0 tcontext=system_u:object_r:lldpad_tmpfs_t:s0 tclass=file permissive=0
----
type=PROCTITLE msg=audit(02/19/2020 16:09:53.856:1289) : proctitle=(l-upload)
type=PATH msg=audit(02/19/2020 16:09:53.856:1289) : item=0 name=wdmd inode=47384 dev=00:15 mode=file,644 ouid=root ogid=root rdev=00:00 obj=system_u:object_r:wdmd_tmpfs_t:s0 nametype=NORMAL cap_fp=none cap_fi=none cap_fe=0 cap_fver=0 cap_frootid=0
type=CWD msg=audit(02/19/2020 16:09:53.856:1289) : cwd=/
type=SYSCALL msg=audit(02/19/2020 16:09:53.856:1289) : arch=x86_64 syscall=newfstatat success=no exit=EACCES(Permission denied) a0=0x8 a1=0x5557b29e833b a2=0x7ffee1479e00 a3=0x100 items=1 ppid=1 pid=19496 auid=unset uid=root gid=root euid=root suid=root fsuid=root egid=root sgid=root fsgid=root tty=(none) ses=unset comm=(l-upload) exe=/usr/lib/systemd/systemd subj=system_u:system_r:init_t:s0 key=(null)
type=AVC msg=audit(02/19/2020 16:09:53.856:1289) : avc: denied { getattr } for pid=19496 comm=(l-upload) path=/dev/shm/wdmd dev="tmpfs" ino=47384 scontext=system_u:system_r:init_t:s0 tcontext=system_u:object_r:wdmd_tmpfs_t:s0 tclass=file permissive=0
----
SELinux denials caught in permissive mode:
----
type=PROCTITLE msg=audit(02/19/2020 16:39:35.088:1411) : proctitle=(l-upload)
type=PATH msg=audit(02/19/2020 16:39:35.088:1411) : item=0 name=vhostmd0 inode=70576 dev=00:15 mode=file,644 ouid=root ogid=root rdev=00:00 obj=system_u:object_r:vhostmd_tmpfs_t:s0 nametype=NORMAL cap_fp=none cap_fi=none cap_fe=0 cap_fver=0 cap_frootid=0
type=CWD msg=audit(02/19/2020 16:39:35.088:1411) : cwd=/
type=SYSCALL msg=audit(02/19/2020 16:39:35.088:1411) : arch=x86_64 syscall=newfstatat success=yes exit=0 a0=0x8 a1=0x5557b29e8273 a2=0x7ffee1479e00 a3=0x100 items=1 ppid=1 pid=31623 auid=unset uid=root gid=root euid=root suid=root fsuid=root egid=root sgid=root fsgid=root tty=(none) ses=unset comm=(l-upload) exe=/usr/lib/systemd/systemd subj=system_u:system_r:init_t:s0 key=(null)
type=AVC msg=audit(02/19/2020 16:39:35.088:1411) : avc: denied { getattr } for pid=31623 comm=(l-upload) path=/dev/shm/vhostmd0 dev="tmpfs" ino=70576 scontext=system_u:system_r:init_t:s0 tcontext=system_u:object_r:vhostmd_tmpfs_t:s0 tclass=file permissive=1
----
type=PROCTITLE msg=audit(02/19/2020 16:39:35.088:1412) : proctitle=(l-upload)
type=PATH msg=audit(02/19/2020 16:39:35.088:1412) : item=0 name=squid-cf__readers.shm inode=69285 dev=00:15 mode=file,600 ouid=squid ogid=squid rdev=00:00 obj=system_u:object_r:squid_tmpfs_t:s0 nametype=NORMAL cap_fp=none cap_fi=none cap_fe=0 cap_fver=0 cap_frootid=0
type=CWD msg=audit(02/19/2020 16:39:35.088:1412) : cwd=/
type=SYSCALL msg=audit(02/19/2020 16:39:35.088:1412) : arch=x86_64 syscall=newfstatat success=yes exit=0 a0=0x8 a1=0x5557b29e8293 a2=0x7ffee1479e00 a3=0x100 items=1 ppid=1 pid=31623 auid=unset uid=root gid=root euid=root suid=root fsuid=root egid=root sgid=root fsgid=root tty=(none) ses=unset comm=(l-upload) exe=/usr/lib/systemd/systemd subj=system_u:system_r:init_t:s0 key=(null)
type=AVC msg=audit(02/19/2020 16:39:35.088:1412) : avc: denied { getattr } for pid=31623 comm=(l-upload) path=/dev/shm/squid-cf__readers.shm dev="tmpfs" ino=69285 scontext=system_u:system_r:init_t:s0 tcontext=system_u:object_r:squid_tmpfs_t:s0 tclass=file permissive=1
----
type=PROCTITLE msg=audit(02/19/2020 16:39:35.088:1413) : proctitle=(l-upload)
type=PATH msg=audit(02/19/2020 16:39:35.088:1413) : item=0 name=lldpad.state inode=52563 dev=00:15 mode=file,600 ouid=root ogid=root rdev=00:00 obj=system_u:object_r:lldpad_tmpfs_t:s0 nametype=NORMAL cap_fp=none cap_fi=none cap_fe=0 cap_fver=0 cap_frootid=0
type=CWD msg=audit(02/19/2020 16:39:35.088:1413) : cwd=/
type=SYSCALL msg=audit(02/19/2020 16:39:35.088:1413) : arch=x86_64 syscall=newfstatat success=yes exit=0 a0=0x8 a1=0x5557b29e831b a2=0x7ffee1479e00 a3=0x100 items=1 ppid=1 pid=31623 auid=unset uid=root gid=root euid=root suid=root fsuid=root egid=root sgid=root fsgid=root tty=(none) ses=unset comm=(l-upload) exe=/usr/lib/systemd/systemd subj=system_u:system_r:init_t:s0 key=(null)
type=AVC msg=audit(02/19/2020 16:39:35.088:1413) : avc: denied { getattr } for pid=31623 comm=(l-upload) path=/dev/shm/lldpad.state dev="tmpfs" ino=52563 scontext=system_u:system_r:init_t:s0 tcontext=system_u:object_r:lldpad_tmpfs_t:s0 tclass=file permissive=1
----
type=PROCTITLE msg=audit(02/19/2020 16:39:35.088:1414) : proctitle=(l-upload)
type=PATH msg=audit(02/19/2020 16:39:35.088:1414) : item=0 name=wdmd inode=47384 dev=00:15 mode=file,644 ouid=root ogid=root rdev=00:00 obj=system_u:object_r:wdmd_tmpfs_t:s0 nametype=NORMAL cap_fp=none cap_fi=none cap_fe=0 cap_fver=0 cap_frootid=0
type=CWD msg=audit(02/19/2020 16:39:35.088:1414) : cwd=/
type=SYSCALL msg=audit(02/19/2020 16:39:35.088:1414) : arch=x86_64 syscall=newfstatat success=yes exit=0 a0=0x8 a1=0x5557b29e833b a2=0x7ffee1479e00 a3=0x100 items=1 ppid=1 pid=31623 auid=unset uid=root gid=root euid=root suid=root fsuid=root egid=root sgid=root fsgid=root tty=(none) ses=unset comm=(l-upload) exe=/usr/lib/systemd/systemd subj=system_u:system_r:init_t:s0 key=(null)
type=AVC msg=audit(02/19/2020 16:39:35.088:1414) : avc: denied { getattr } for pid=31623 comm=(l-upload) path=/dev/shm/wdmd dev="tmpfs" ino=47384 scontext=system_u:system_r:init_t:s0 tcontext=system_u:object_r:wdmd_tmpfs_t:s0 tclass=file permissive=1
----
In Fedora that bug is not reproducible because an allow rule exists:
# sesearch -A --dontaudit -s init_t -t squid_tmpfs_t -c file
allow domain file_type:file map; [ domain_can_mmap_files ]:True
allow init_t file_type:file { getattr relabelfrom relabelto };
allow init_t non_security_file_type:file mounton; [ init_create_dirs ]:True
#
Added with the following commit:
commit b313a79dbfd2fba545e00f31aa53d29c6f2b2722
Author: Lukas Vrabec <lvrabec>
Date: Tue Aug 13 17:36:11 2019 +0200
Allow systemd to relabel all files on system.
Resolves: #270
diff --git a/policy/modules/system/init.te b/policy/modules/system/init.te
index 1f39ee086..aa02c7d79 100644
--- a/policy/modules/system/init.te
+++ b/policy/modules/system/init.te
@@ -580,9 +580,7 @@ files_setattr_var_dirs(init_t)
files_list_boot(init_t)
files_list_home(init_t)
files_create_lock_dirs(init_t)
-files_relabel_all_lock_dirs(init_t)
-files_relabel_var_dirs(init_t)
-files_relabel_var_lib_dirs(init_t)
+files_relabel_all_files(init_t)
files_read_kernel_modules(init_t)
files_map_kernel_modules(init_t)
files_dontaudit_mounton_isid(init_t)
Note to clarify: the commit in the previous comment refers to a fix in Fedora. In RHEL such a change has not been implemented yet. *** This bug has been marked as a duplicate of bug 1818981 *** |
Description of problem: Version-Release number of selected component (if applicable): lldpad-1.0.1-13.git036e314.el8.x86_64 sanlock-3.8.0-2.el8.x86_64 sanlock-lib-3.8.0-2.el8.x86_64 selinux-policy-3.14.3-40.el8.noarch selinux-policy-devel-3.14.3-40.el8.noarch selinux-policy-doc-3.14.3-40.el8.noarch selinux-policy-minimum-3.14.3-40.el8.noarch selinux-policy-mls-3.14.3-40.el8.noarch selinux-policy-sandbox-3.14.3-40.el8.noarch selinux-policy-targeted-3.14.3-40.el8.noarch squid-4.4-8.module+el8.1.0+4044+36416a77.x86_64 systemd-239-25.el8.x86_64 systemd-container-239-25.el8.x86_64 systemd-devel-239-25.el8.x86_64 systemd-journal-remote-239-25.el8.x86_64 systemd-libs-239-25.el8.x86_64 systemd-pam-239-25.el8.x86_64 systemd-tests-239-25.el8.x86_64 systemd-udev-239-25.el8.x86_64 vhostmd-1.1-4.el8.x86_64 How reproducible: * always Steps to Reproduce: 1. get a RHEL-8.2 machine (targeted policy is active) 2. start some service which provides a POSIX shared memory segment (for exmaple: lldpad, squid, vhostmd, wdmd) 3. start the systemd-journal-upload service 4. search for SELinux denials Actual results (ausearch -m avc -i -ts recent | audit2allow): allow init_t lldpad_tmpfs_t:file getattr; allow init_t squid_tmpfs_t:file getattr; allow init_t vhostmd_tmpfs_t:file getattr; allow init_t wdmd_tmpfs_t:file getattr; Detailed SELinux denials will be attached. Expected results: * no SELinux denials Additional info: # ls -1Z /dev/shm/ system_u:object_r:lldpad_tmpfs_t:s0 lldpad.state system_u:object_r:tmpfs_t:s0 multipath system_u:object_r:squid_tmpfs_t:s0 squid-cf__metadata.shm system_u:object_r:squid_tmpfs_t:s0 squid-cf__queues.shm system_u:object_r:squid_tmpfs_t:s0 squid-cf__readers.shm system_u:object_r:vhostmd_tmpfs_t:s0 vhostmd0 system_u:object_r:wdmd_tmpfs_t:s0 wdmd # Relevant part of the journal: systemd[19496]: Failed to stat() POSIX shared memory segment vhostmd0: Permission denied systemd[19496]: Failed to stat() POSIX shared memory segment squid-cf__readers.shm: Permission denied systemd[19496]: Failed to stat() POSIX shared memory segment squid-cf__queues.shm: Permission denied systemd[19496]: Failed to stat() POSIX shared memory segment squid-cf__metadata.shm: Permission denied systemd[19496]: Failed to stat() POSIX shared memory segment lldpad.state: Permission denied systemd[19496]: Failed to stat() POSIX shared memory segment wdmd: Permission denied