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.
Bug 2060721 - SELinux prevents sssd from using the inotify_add_watch syscall on the /run/systemd/resolve directory
Summary: SELinux prevents sssd from using the inotify_add_watch syscall on the /run/sy...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 8
Classification: Red Hat
Component: selinux-policy
Version: CentOS Stream
Hardware: x86_64
OS: Linux
low
low
Target Milestone: rc
: 8.7
Assignee: Zdenek Pytela
QA Contact: Milos Malik
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2022-03-04 05:50 UTC by Den Ivanov
Modified: 2022-11-08 12:20 UTC (History)
6 users (show)

Fixed In Version: selinux-policy-3.14.3-98.el8
Doc Type: No Doc Update
Doc Text:
Clone Of:
Environment:
Last Closed: 2022-11-08 10:43:57 UTC
Type: Bug
Target Upstream Version:
Embargoed:
pm-rhel: mirror+


Attachments (Terms of Use)
/etc/nsswitch.conf (1.72 KB, text/plain)
2022-03-04 07:45 UTC, Den Ivanov
no flags Details


Links
System ID Private Priority Status Summary Last Updated
Github fedora-selinux selinux-policy-contrib pull 215 0 None Merged Allow sssd read systemd-resolved runtime directory 2022-03-04 07:53:36 UTC
Red Hat Bugzilla 1811556 1 None None None 2022-03-04 07:53:36 UTC
Red Hat Issue Tracker RHELPLAN-114451 0 None None None 2022-03-04 05:53:56 UTC
Red Hat Product Errata RHBA-2022:7691 0 None None None 2022-11-08 10:44:18 UTC

Description Den Ivanov 2022-03-04 05:50:00 UTC
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

Comment 1 Milos Malik 2022-03-04 07:33:45 UTC
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.

Comment 2 Den Ivanov 2022-03-04 07:45:42 UTC
Created attachment 1864112 [details]
/etc/nsswitch.conf

Comment 3 Den Ivanov 2022-03-04 07:48:54 UTC
(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

Comment 4 Zdenek Pytela 2022-03-04 07:53:36 UTC
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

Comment 5 Milos Malik 2022-03-04 07:56:43 UTC
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.

Comment 6 Milos Malik 2022-03-04 07:57:41 UTC
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 
----

Comment 16 errata-xmlrpc 2022-11-08 10:43:57 UTC
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


Note You need to log in before you can comment on or make changes to this bug.