Bug 2209650 - SELinux prevents the collectd process from reading the /proc/net/dev symlink
Summary: SELinux prevents the collectd process from reading the /proc/net/dev symlink
Keywords:
Status: VERIFIED
Alias: None
Product: Red Hat Enterprise Linux 9
Classification: Red Hat
Component: selinux-policy
Version: 9.3
Hardware: Unspecified
OS: Linux
medium
medium
Target Milestone: rc
: ---
Assignee: Nikola Knazekova
QA Contact: Milos Malik
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2023-05-24 11:19 UTC by Milos Malik
Modified: 2023-07-11 14:58 UTC (History)
3 users (show)

Fixed In Version: selinux-policy-38.1.16-1.el9
Doc Type: No Doc Update
Doc Text:
Clone Of:
Environment:
Last Closed:
Type: Bug
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Github fedora-selinux selinux-policy pull 1747 0 None open Allow collectd_t read network state symlinks 2023-06-16 14:25:00 UTC
Red Hat Issue Tracker RHELPLAN-158056 0 None None None 2023-05-24 11:20:36 UTC

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"


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