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 1860924 - SELinux prevents dbus-daemon from reading symlinks in /run/systemd/dynamic-uid directory
Summary: SELinux prevents dbus-daemon from reading symlinks in /run/systemd/dynamic-ui...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 8
Classification: Red Hat
Component: selinux-policy
Version: ---
Hardware: x86_64
OS: Linux
medium
medium
Target Milestone: rc
: 8.5
Assignee: Zdenek Pytela
QA Contact: Milos Malik
URL:
Whiteboard:
: 1892547 (view as bug list)
Depends On:
Blocks: 1925828
TreeView+ depends on / blocked
 
Reported: 2020-07-27 13:08 UTC by Milos Malik
Modified: 2021-11-10 08:30 UTC (History)
8 users (show)

Fixed In Version: selinux-policy-3.14.3-69.el8
Doc Type: No Doc Update
Doc Text:
Clone Of:
Environment:
Last Closed: 2021-11-09 19:42:28 UTC
Type: Bug
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
Add interface to init policy for reading init_var_run_t lnk_file (1.25 KB, patch)
2021-04-20 07:13 UTC, Tuomo Soini
no flags Details | Diff
Use new interface to allow reading lnk_file (1.02 KB, patch)
2021-04-20 07:15 UTC, Tuomo Soini
no flags Details | Diff


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2021:4420 0 None None None 2021-11-09 19:42:56 UTC

Description Milos Malik 2020-07-27 13:08:26 UTC
Description of problem:

Version-Release number of selected component (if applicable):
fwupd-1.4.1-1.el8.x86_64
selinux-policy-3.14.3-48.el8.noarch
selinux-policy-targeted-3.14.3-48.el8.noarch

How reproducible:
 * always

Steps to Reproduce:
1. get a RHEL-8.3 machine (targeted policy is active)
2. start the fwupd-refresh service
3. search for SELinux denials

Actual results (enforcing mode):
----
type=PROCTITLE msg=audit(07/27/2020 09:06:58.618:335) : proctitle=/usr/bin/dbus-daemon --system --address=systemd: --nofork --nopidfile --systemd-activation --syslog-only 
type=PATH msg=audit(07/27/2020 09:06:58.618:335) : item=0 name=/run/systemd/dynamic-uid/direct:62803 inode=38503 dev=00:18 mode=link,777 ouid=root ogid=root rdev=00:00 obj=system_u:object_r:init_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(07/27/2020 09:06:58.618:335) : cwd=/ 
type=SYSCALL msg=audit(07/27/2020 09:06:58.618:335) : arch=x86_64 syscall=readlinkat success=no exit=EACCES(Permission denied) a0=0xffffff9c a1=0x7ffe508dcb30 a2=0x55974a9ca6f0 a3=0x63 items=1 ppid=1 pid=673 auid=unset uid=dbus gid=dbus euid=dbus suid=dbus fsuid=dbus egid=dbus sgid=dbus fsgid=dbus tty=(none) ses=unset comm=dbus-daemon exe=/usr/bin/dbus-daemon subj=system_u:system_r:system_dbusd_t:s0-s0:c0.c1023 key=(null) 
type=AVC msg=audit(07/27/2020 09:06:58.618:335) : avc:  denied  { read } for  pid=673 comm=dbus-daemon name=direct:62803 dev="tmpfs" ino=38503 scontext=system_u:system_r:system_dbusd_t:s0-s0:c0.c1023 tcontext=system_u:object_r:init_var_run_t:s0 tclass=lnk_file permissive=0 
----

Expected results:
 * no SELinux denials

Comment 1 Milos Malik 2020-07-27 13:10:18 UTC
Here is the only SELinux denial which appeared in permissive mode:
----
type=PROCTITLE msg=audit(07/27/2020 09:08:35.060:339) : proctitle=/usr/bin/dbus-daemon --system --address=systemd: --nofork --nopidfile --systemd-activation --syslog-only 
type=PATH msg=audit(07/27/2020 09:08:35.060:339) : item=0 name=/run/systemd/dynamic-uid/direct:62803 inode=38687 dev=00:18 mode=link,777 ouid=root ogid=root rdev=00:00 obj=system_u:object_r:init_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(07/27/2020 09:08:35.060:339) : cwd=/ 
type=SYSCALL msg=audit(07/27/2020 09:08:35.060:339) : arch=x86_64 syscall=readlinkat success=yes exit=13 a0=0xffffff9c a1=0x7ffe508dcb30 a2=0x55974a9ca6f0 a3=0x63 items=1 ppid=1 pid=673 auid=unset uid=dbus gid=dbus euid=dbus suid=dbus fsuid=dbus egid=dbus sgid=dbus fsgid=dbus tty=(none) ses=unset comm=dbus-daemon exe=/usr/bin/dbus-daemon subj=system_u:system_r:system_dbusd_t:s0-s0:c0.c1023 key=(null) 
type=AVC msg=audit(07/27/2020 09:08:35.060:339) : avc:  denied  { read } for  pid=673 comm=dbus-daemon name=direct:62803 dev="tmpfs" ino=38687 scontext=system_u:system_r:system_dbusd_t:s0-s0:c0.c1023 tcontext=system_u:object_r:init_var_run_t:s0 tclass=lnk_file permissive=1 
----

Comment 3 Milos Malik 2020-07-27 13:15:18 UTC
# grep -R DynamicUser=yes /usr/lib/systemd/system/
/usr/lib/systemd/system/fwupd-refresh.service:DynamicUser=yes
#

I'm looking for other services which may trigger similar SELinux denials.

Comment 5 Milos Malik 2020-07-27 13:45:06 UTC
# pwd
/usr/lib/systemd/system
# grep -Ri dynamicuser *
fwupd-refresh.service:DynamicUser=yes
systemd-journal-gatewayd.service:DynamicUser=yes
systemd-journal-upload.service:DynamicUser=yes
#

Above-mentioned services trigger the following SELinux denial either during their start or during their stop:

----
type=PROCTITLE msg=audit(07/27/2020 09:42:35.948:1808) : proctitle=/usr/bin/dbus-daemon --system --address=systemd: --nofork --nopidfile --systemd-activation --syslog-only 
type=PATH msg=audit(07/27/2020 09:42:35.948:1808) : item=0 name=/run/systemd/dynamic-uid/direct:63112 inode=137151 dev=00:18 mode=link,777 ouid=root ogid=root rdev=00:00 obj=system_u:object_r:init_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(07/27/2020 09:42:35.948:1808) : cwd=/ 
type=SYSCALL msg=audit(07/27/2020 09:42:35.948:1808) : arch=x86_64 syscall=readlinkat success=no exit=EACCES(Permission denied) a0=0xffffff9c a1=0x7ffe508dbf80 a2=0x55974a9ca6f0 a3=0x63 items=1 ppid=1 pid=673 auid=unset uid=dbus gid=dbus euid=dbus suid=dbus fsuid=dbus egid=dbus sgid=dbus fsgid=dbus tty=(none) ses=unset comm=dbus-daemon exe=/usr/bin/dbus-daemon subj=system_u:system_r:system_dbusd_t:s0-s0:c0.c1023 key=(null) 
type=AVC msg=audit(07/27/2020 09:42:35.948:1808) : avc:  denied  { read } for  pid=673 comm=dbus-daemon name=direct:63112 dev="tmpfs" ino=137151 scontext=system_u:system_r:system_dbusd_t:s0-s0:c0.c1023 tcontext=system_u:object_r:init_var_run_t:s0 tclass=lnk_file permissive=0 
----

Comment 9 Michal Sekletar 2020-10-20 14:15:33 UTC
AVC occurs because dbus-daemon tries to resolve information (user record) about systemd-journal-gateway user via systemd nss module and that in turn tries to dereference the symlink. I think allowing this in policy is OK. However, the challenge is how to make this scaleable because in theory any application running in some SELinux domain could start resolving such user records and hence generate similar AVCs.

Comment 11 Zdenek Pytela 2020-11-09 22:16:29 UTC
*** Bug 1892547 has been marked as a duplicate of this bug. ***

Comment 14 Tuomo Soini 2021-04-20 07:13:54 UTC
Created attachment 1773644 [details]
Add interface to init policy for reading init_var_run_t lnk_file

Comment 15 Tuomo Soini 2021-04-20 07:15:45 UTC
Created attachment 1773645 [details]
Use new interface to allow reading lnk_file

I propose these patches to fix this issue.

Comment 17 Zdenek Pytela 2021-05-26 14:23:26 UTC
Needs to be backported:
commit f561c3f817eb9da478a337a7633c8ded9dd76bec (HEAD -> rawhide, upstream/rawhide)
Author: Zdenek Pytela <zpytela>
Date:   Wed May 26 15:31:03 2021 +0200

    Allow nsswitch_domain read init pid lnk_files

Comment 18 Zdenek Pytela 2021-05-26 14:25:16 UTC
(In reply to Tuomo Soini from comment #15)
> Created attachment 1773645 [details]
> Use new interface to allow reading lnk_file
> 
> I propose these patches to fix this issue.

Tuomo,

Thank you for the patches. I decided to allow the permission for nsswitch_domain and use a different interface name. Please continue in your effort, preferably use a github pull request:

https://github.com/fedora-selinux/selinux-policy/pulls

Comment 19 Zdenek Pytela 2021-06-02 10:32:13 UTC
Needs backporting:

commit f561c3f817eb9da478a337a7633c8ded9dd76bec
Author: Zdenek Pytela <zpytela>
Date:   Wed May 26 15:31:03 2021 +0200

    Allow nsswitch_domain read init pid lnk_files

Comment 32 errata-xmlrpc 2021-11-09 19:42:28 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-2021:4420


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