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.

Bug 2209650

Summary: SELinux prevents the collectd process from reading the /proc/net/dev symlink
Product: Red Hat Enterprise Linux 9 Reporter: Milos Malik <mmalik>
Component: selinux-policyAssignee: Nobody <nobody>
Status: CLOSED ERRATA QA Contact: Milos Malik <mmalik>
Severity: medium Docs Contact:
Priority: medium    
Version: 9.3CC: lvrabec, mmalik, zpytela
Target Milestone: rcKeywords: AutoVerified, Triaged
Target Release: ---Flags: pm-rhel: mirror+
Hardware: Unspecified   
OS: Linux   
Whiteboard:
Fixed In Version: selinux-policy-38.1.16-1.el9 Doc Type: No Doc Update
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2023-11-07 08:52:24 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:

Description Milos Malik 2023-05-24 11:19:44 UTC
Description of problem:

# journalctl -l -u collectd | grep -i denied
May 24 07:09:11 removed collectd[4592]: interface plugin: fopen: Permission denied
May 24 07:09:31 removed collectd[4592]: interface plugin: fopen: Permission denied
May 24 07:10:11 removed collectd[4592]: interface plugin: fopen: Permission denied
May 24 07:11:31 removed collectd[4592]: interface plugin: fopen: Permission denied
May 24 07:14:11 removed collectd[4592]: interface plugin: fopen: Permission denied
#

Each of the permission denied messages can be matched with a SELinux denial in the audit log.

Version-Release number of selected component (if applicable):
collectd-5.12.0-24.el9.x86_64
selinux-policy-38.1.12-1.el9.noarch
selinux-policy-targeted-38.1.12-1.el9.noarch

How reproducible:
 * always

Steps to Reproduce:
1. get a RHEL-9.3 machine (targeted policy is active)
2. install the collectd package
3. start the collectd service
4. search for SELinux denials

Actual results (enforcing mode):
----
type=PROCTITLE msg=audit(05/24/2023 07:09:11.293:347) : proctitle=/usr/sbin/collectd 
type=PATH msg=audit(05/24/2023 07:09:11.293:347) : item=0 name=/proc/net/dev nametype=UNKNOWN cap_fp=none cap_fi=none cap_fe=0 cap_fver=0 cap_frootid=0 
type=CWD msg=audit(05/24/2023 07:09:11.293:347) : cwd=/var/lib/collectd 
type=SYSCALL msg=audit(05/24/2023 07:09:11.293:347) : arch=x86_64 syscall=openat success=no exit=EACCES(Permission denied) a0=AT_FDCWD a1=0x7f74cff191e0 a2=O_RDONLY a3=0x0 items=1 ppid=1 pid=4592 auid=unset uid=root gid=root euid=root suid=root fsuid=root egid=root sgid=root fsgid=root tty=(none) ses=unset comm=reader#0 exe=/usr/sbin/collectd subj=system_u:system_r:collectd_t:s0 key=(null) 
type=AVC msg=audit(05/24/2023 07:09:11.293:347) : avc:  denied  { read } for  pid=4592 comm=reader#0 name=net dev="proc" ino=4026531845 scontext=system_u:system_r:collectd_t:s0 tcontext=system_u:object_r:proc_net_t:s0 tclass=lnk_file permissive=0 
----

Expected results:
 * no SELinux denials

Additional info:
 * the collectd package comes from EPEL

Comment 1 Milos Malik 2023-05-24 11:21:51 UTC
# find /proc/ -inum 4026531845
/proc/net
# ls -ldZ /proc/net
lrwxrwxrwx. 1 root root system_u:object_r:proc_net_t:s0 8 May 24 06:56 /proc/net -> self/net
#

Comment 2 Milos Malik 2023-05-24 11:23:24 UTC
Actual results (permissive mode):
----
type=PROCTITLE msg=audit(05/24/2023 07:22:04.399:360) : proctitle=/usr/sbin/collectd 
type=PATH msg=audit(05/24/2023 07:22:04.399:360) : item=0 name=/proc/net/dev inode=4026532012 dev=00:14 mode=file,444 ouid=root ogid=root rdev=00:00 obj=system_u:object_r:proc_net_t:s0 nametype=NORMAL cap_fp=none cap_fi=none cap_fe=0 cap_fver=0 cap_frootid=0 
type=CWD msg=audit(05/24/2023 07:22:04.399:360) : cwd=/var/lib/collectd 
type=SYSCALL msg=audit(05/24/2023 07:22:04.399:360) : arch=x86_64 syscall=openat success=yes exit=3 a0=AT_FDCWD a1=0x7f3574d641e0 a2=O_RDONLY a3=0x0 items=1 ppid=1 pid=4693 auid=unset uid=root gid=root euid=root suid=root fsuid=root egid=root sgid=root fsgid=root tty=(none) ses=unset comm=reader#1 exe=/usr/sbin/collectd subj=system_u:system_r:collectd_t:s0 key=(null) 
type=AVC msg=audit(05/24/2023 07:22:04.399:360) : avc:  denied  { read } for  pid=4693 comm=reader#1 name=net dev="proc" ino=4026531845 scontext=system_u:system_r:collectd_t:s0 tcontext=system_u:object_r:proc_net_t:s0 tclass=lnk_file permissive=1 
----

Additional SELinux denials did NOT appear.

Comment 5 Nikola Knazekova 2023-06-14 14:41:43 UTC
PR: https://github.com/fedora-selinux/selinux-policy/pull/1741

Comment 6 Zdenek Pytela 2023-06-14 15:17:07 UTC
Commit to backport:
f4847d50d (HEAD -> rawhide, upstream/rawhide) Allow collectd_t read proc_net link files Allow collectd read generic symbolic links in /proc

Comment 15 Zdenek Pytela 2023-06-26 09:59:17 UTC
These two commits were merged upstream:
9a02a239e Allow collectd_t read network state symlinks
235763507 Revert "Allow collectd_t read proc_net link files"

Comment 23 errata-xmlrpc 2023-11-07 08:52:24 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-2023:6617