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 2101910 - rhel9 avc denied with rm and dhclient-script
Summary: rhel9 avc denied with rm and dhclient-script
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 9
Classification: Red Hat
Component: selinux-policy
Version: 9.1
Hardware: All
OS: Linux
medium
medium
Target Milestone: rc
: 9.1
Assignee: Zdenek Pytela
QA Contact: Milos Malik
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2022-06-28 18:22 UTC by Zdenek Pytela
Modified: 2022-11-15 12:58 UTC (History)
4 users (show)

Fixed In Version: selinux-policy-34.1.40-1.el9
Doc Type: Bug Fix
Doc Text:
Cause: The /run/chrony-dhcp/ directory is created by the dhclient-script, but it gets a wrong label, which then leads to the following SELinux denial when the chronyd service is restarted for any reason Consequence: The automated TC failed because of the missing policy rule Fix: Update chronyd_pid_filetrans() interface to allow caller domain to create the /run/chrony-dhcp directory. Result: No AVC denials
Clone Of:
Environment:
Last Closed: 2022-11-15 11:13:54 UTC
Type: Bug
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Issue Tracker RHELPLAN-126535 0 None None None 2022-06-28 18:30:58 UTC
Red Hat Product Errata RHBA-2022:8283 0 None None None 2022-11-15 11:14:02 UTC

Description Zdenek Pytela 2022-06-28 18:22:56 UTC
This bug was initially created as a copy of Bug #2094155

I am copying this bug because: 
Additional denials were found by an automated test.


Description of problem:
rhel9 avc denied with rm and dhclient-script

Version-Release number of selected component (if applicable):
selinux-policy-34.1.35-1.el9

How reproducible:
Always

Steps to Reproduce:
The automated TC failed because the following policy rule is missing:

type_transition dhcpc_t var_run_t : dir chronyd_var_run_t chrony-dhcp;

The automated TC performs these steps:

# rpm -qf /run/chrony-dhcp/
file /run/chrony-dhcp is not owned by any package
# ls -alZ /run/chrony-dhcp/
total 0
drwxr-xr-x.  2 root root system_u:object_r:chronyd_var_run_t:s0  40 Jun 28 08:21 .
drwxr-xr-x. 28 root root system_u:object_r:var_run_t:s0         860 Jun 28 08:22 ..
# rm -rf /run/chrony-dhcp/
# dhclient
grep: /etc/sysconfig/network-scripts/ifcfg-*: No such file or directory
grep: /etc/sysconfig/network-scripts/ifcfg-*: No such file or directory
grep: /etc/sysconfig/network-scripts/ifcfg-*: No such file or directory
grep: /etc/sysconfig/network-scripts/ifcfg-*: No such file or directory
grep: /etc/sysconfig/network-scripts/ifcfg-*: No such file or directory
grep: /etc/sysconfig/network-scripts/ifcfg-*: No such file or directory
# ls -alZ /run/chrony-dhcp/
total 0
drwxr-xr-x.  2 root root unconfined_u:object_r:dhcpc_var_run_t:s0  40 Jun 28 09:10 .
drwxr-xr-x. 28 root root system_u:object_r:var_run_t:s0           880 Jun 28 09:10 ..
#

The /run/chrony-dhcp/ directory is created by the dhclient-script, but it gets a wrong label, which then leads to the following SELinux denial when the chronyd service is restarted for any reason:
----
type=PROCTITLE msg=audit(06/28/2022 09:12:04.432:292) : proctitle=/usr/sbin/chronyd -F 2 
type=SYSCALL msg=audit(06/28/2022 09:12:04.432:292) : arch=x86_64 syscall=openat success=no exit=EACCES(Permission denied) a0=AT_FDCWD a1=0x7ffd7f0e7260 a2=O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC a3=0x0 items=0 ppid=1 pid=4680 auid=unset uid=chrony gid=chrony euid=chrony suid=chrony fsuid=chrony egid=chrony sgid=chrony fsgid=chrony tty=(none) ses=unset comm=chronyd exe=/usr/sbin/chronyd subj=system_u:system_r:chronyd_t:s0 key=(null) 
type=AVC msg=audit(06/28/2022 09:12:04.432:292) : avc:  denied  { read } for  pid=4680 comm=chronyd name=chrony-dhcp dev="tmpfs" ino=1064 scontext=system_u:system_r:chronyd_t:s0 tcontext=unconfined_u:object_r:dhcpc_var_run_t:s0 tclass=dir permissive=0 
----

Here is the particular script which creates the /run/chrony-dhcp/ directory with incorrect label:

# rpm -qf /etc/dhcp/dhclient.d/chrony.sh 
chrony-4.2-1.el9.x86_64
# grep CHRONY_SOURCEDIR /etc/dhcp/dhclient.d/chrony.sh 
CHRONY_SOURCEDIR=/run/chrony-dhcp
SERVERFILE=$CHRONY_SOURCEDIR/$interface.sources
		mkdir -p $CHRONY_SOURCEDIR
#

Actual results:
avc denied 

Expected results:
No avc denied  

Additional info:

Comment 15 errata-xmlrpc 2022-11-15 11:13:54 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:8283


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