Bug 2060721
| Summary: | SELinux prevents sssd from using the inotify_add_watch syscall on the /run/systemd/resolve directory | ||||||
|---|---|---|---|---|---|---|---|
| Product: | Red Hat Enterprise Linux 8 | Reporter: | Den Ivanov <div> | ||||
| Component: | selinux-policy | Assignee: | Zdenek Pytela <zpytela> | ||||
| Status: | CLOSED ERRATA | QA Contact: | Milos Malik <mmalik> | ||||
| Severity: | low | Docs Contact: | |||||
| Priority: | low | ||||||
| Version: | CentOS Stream | CC: | bstinson, div, jwboyer, lvrabec, mmalik, ssekidde | ||||
| Target Milestone: | rc | Keywords: | Triaged | ||||
| Target Release: | 8.7 | Flags: | pm-rhel:
mirror+
|
||||
| Hardware: | x86_64 | ||||||
| OS: | Linux | ||||||
| Whiteboard: | |||||||
| Fixed In Version: | selinux-policy-3.14.3-98.el8 | Doc Type: | No Doc Update | ||||
| Doc Text: | Story Points: | --- | |||||
| Clone Of: | Environment: | ||||||
| Last Closed: | 2022-11-08 10:43:57 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: | |||||||
| Attachments: |
|
||||||
Unfortunately, I'm not able to reproduce the situation. Can you attach your /etc/nsswitch.conf file to this BZ? If there are any files under the /etc/sssd directory on your machine, please attach them as well. What I know is that the latest SELinux policy does not fix the SELinux denial in any way: # rpm -qa selinux\* selinux-policy-3.14.3-93.el8.noarch selinux-policy-targeted-3.14.3-93.el8.noarch # sesearch -s sssd_t -t systemd_resolved_var_run_t -c dir -p read -A --dontaudit # Thank you. Created attachment 1864112 [details]
/etc/nsswitch.conf
(In reply to Milos Malik from comment #1) > Unfortunately, I'm not able to reproduce the situation. > > Can you attach your /etc/nsswitch.conf file to this BZ? Attached /etc/nsswitch.conf > If there are any files under the /etc/sssd directory on your machine, please > attach them as well. No files under /etc/sssd > What I know is that the latest SELinux policy does not fix the SELinux > denial in any way: > > # rpm -qa selinux\* > selinux-policy-3.14.3-93.el8.noarch > selinux-policy-targeted-3.14.3-93.el8.noarch > # sesearch -s sssd_t -t systemd_resolved_var_run_t -c dir -p read -A > --dontaudit This machine just migrated from CentOS Linux to Stream It can be addressed by backporting the following commit:
commit 5406e9a4f4ae4a95e15fea717ccfa63fe4835264
Author: Zdenek Pytela <zpytela>
Date: Mon Mar 9 10:24:18 2020 +0100
Allow sssd read systemd-resolved runtime directory
Following SELinux denial appeared in enforcing mode:
----
type=PROCTITLE msg=audit(03/04/2022 02:52:56.431:92) : proctitle=/usr/sbin/sssd -i --logger=files
type=PATH msg=audit(03/04/2022 02:52:56.431:92) : item=0 name=/run/systemd/resolve inode=19565 dev=00:18 mode=dir,755 ouid=systemd-resolve ogid=systemd-resolve rdev=00:00 obj=system_u:object_r:systemd_resolved_var_run_t:s0 nametype=NORMAL cap_fp=none cap_fi=none cap_fe=0 cap_fver=0 cap_frootid=0
type=CWD msg=audit(03/04/2022 02:52:56.431:92) : cwd=/
type=SYSCALL msg=audit(03/04/2022 02:52:56.431:92) : arch=x86_64 syscall=inotify_add_watch success=no exit=EACCES(Permission denied) a0=0x0 a1=0x55606b5e2390 a2=0x180 a3=0x0 items=1 ppid=1 pid=1542 auid=unset uid=root gid=root euid=root suid=root fsuid=root egid=root sgid=root fsgid=root tty=(none) ses=unset comm=sssd exe=/usr/sbin/sssd subj=system_u:system_r:sssd_t:s0 key=(null)
type=AVC msg=audit(03/04/2022 02:52:56.431:92) : avc: denied { read } for pid=1542 comm=sssd name=resolve dev="tmpfs" ino=19565 scontext=system_u:system_r:sssd_t:s0 tcontext=system_u:object_r:systemd_resolved_var_run_t:s0 tclass=dir permissive=0
----
I remember that /etc/resolv.conf can be a symbolic link in certain configurations:
# service systemd-resolved start
Redirecting to /bin/systemctl start systemd-resolved.service
# ls -l /etc/resolv.conf
lrwxrwxrwx. 1 root root 32 Mar 4 02:52 /etc/resolv.conf -> /run/systemd/resolve/resolv.conf
# service sssd restart
Redirecting to /bin/systemctl restart sssd.service
#
Now, the issue is reproducible.
Following SELinux denial appeared in permissive mode:
----
type=PROCTITLE msg=audit(03/04/2022 02:56:54.649:97) : proctitle=/usr/sbin/sssd -i --logger=files
type=PATH msg=audit(03/04/2022 02:56:54.649:97) : item=0 name=/run/systemd/resolve inode=19565 dev=00:18 mode=dir,755 ouid=systemd-resolve ogid=systemd-resolve rdev=00:00 obj=system_u:object_r:systemd_resolved_var_run_t:s0 nametype=NORMAL cap_fp=none cap_fi=none cap_fe=0 cap_fver=0 cap_frootid=0
type=CWD msg=audit(03/04/2022 02:56:54.649:97) : cwd=/
type=SYSCALL msg=audit(03/04/2022 02:56:54.649:97) : arch=x86_64 syscall=inotify_add_watch success=yes exit=2 a0=0x0 a1=0x555bd734b390 a2=0x180 a3=0x0 items=1 ppid=1 pid=1573 auid=unset uid=root gid=root euid=root suid=root fsuid=root egid=root sgid=root fsgid=root tty=(none) ses=unset comm=sssd exe=/usr/sbin/sssd subj=system_u:system_r:sssd_t:s0 key=(null)
type=AVC msg=audit(03/04/2022 02:56:54.649:97) : avc: denied { read } for pid=1573 comm=sssd name=resolve dev="tmpfs" ino=19565 scontext=system_u:system_r:sssd_t:s0 tcontext=system_u:object_r:systemd_resolved_var_run_t:s0 tclass=dir permissive=1
----
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-2022:7691 |
Description of problem: After upgrading to Centos Stream, a message about a denied operation appeared in the audit.log: type=AVC msg=audit(1646364486.530:4801932): avc: denied { read } for pid=1303548 comm="sssd" name="resolve" dev="tmpfs" ino=31832 scontext=system_u:system_r:sssd_t:s0 tcontext=system_u:object_r:systemd _resolved_var_run_t:s0 tclass=dir permissive=0 type=SYSCALL msg=audit(1646364486.530:4801932): arch=c000003e syscall=254 success=no exit=-13 a0=0 a1=5637172b2d40 a2=180 a3=0 items=0 ppid=1 pid=1303548 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=4294967295 comm="sssd" exe="/usr/sbin/sssd" subj=system_u:system_r:sssd_t:s0 key=(null).ARCH=x86_64 SYSCALL=inotify_add_watch AUID="unset" UID="root" GID="root" EUID=" root" SUID="root" FSUID="root" EGID="root" SGID="root" FSGID="root" Version-Release number of selected component (if applicable): selinux-policy-3.14.3-93.el8.noarch selinux-policy-targeted-3.14.3-93.el8.noarch How reproducible: Steps to Reproduce: 1. 2. 3. Actual results: Expected results: Additional info: # uname -a Linux zzzzzzz.com 4.18.0-365.el8.x86_64 #1 SMP Thu Feb 10 16:11:23 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux