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 2012772

Summary: Context database contains unexpected patterns
Product: Red Hat Enterprise Linux 8 Reporter: Renaud Métrich <rmetrich>
Component: selinux-policyAssignee: Zdenek Pytela <zpytela>
Status: CLOSED WONTFIX QA Contact: BaseOS QE Security Team <qe-baseos-security>
Severity: low Docs Contact:
Priority: low    
Version: 8.4CC: lvrabec, mmalik, rsahoo, ssekidde
Target Milestone: rcKeywords: Triaged
Target Release: ---Flags: pm-rhel: mirror+
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 2174329 (view as bug list) Environment:
Last Closed: 2023-03-01 07:32:40 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:
Bug Depends On:    
Bug Blocks: 2174329    

Description Renaud Métrich 2021-10-11 09:14:16 UTC
Description of problem:

Browsing the context database, I could find some unexpected patterns, which may confuse customers trying to add their own paths.

Example with "-":
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------
/home/\-inst                                       directory          system_u:object_r:home_root_t:s0 
/usr/lib/NetworkManager/nm\-.*                     regular file       system_u:object_r:bin_t:s0 
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------

These 3 patterns have a leading backslash prior to the dash, is that really needed? I don't think so.

Examples with "." (more an issue since "." means "any character)
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------
[...]
/etc/cron.daily(/.*)?                              all files          system_u:object_r:bin_t:s0 
/etc/cron.hourly(/.*)?                             all files          system_u:object_r:bin_t:s0 
/etc/cron.minutely/openshift-facts                 regular file       system_u:object_r:openshift_cron_exec_t:s0 
/etc/cron.monthly(/.*)?                            all files          system_u:object_r:bin_t:s0 
/etc/cron.weekly(/.*)?                             all files          system_u:object_r:bin_t:s0 
[...]
/var/run/sssd.pid                                  regular file       system_u:object_r:sssd_var_run_t:s0 
/var/run/svnserve.pid                              regular file       system_u:object_r:svnserve_var_run_t:s0 
/var/run/syslog-ng.ctl                             regular file       system_u:object_r:syslogd_var_run_t:s0 
[...]
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------

All the above patterns are wrong, the dot should be escaped (e.g. /etc/cron\.daily/...).
The following command shows most of the issues with "dot":

-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------
# semanage fcontext -l | grep "[^\\/]\.[^\*\+]"
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------

Please fix the policy accordingly, we need to have something sane to not confuse customers.

Version-Release number of selected component (if applicable):

selinux-policy-3.14.3-67.el8_4.2.noarch

How reproducible:

N/A

Comment 1 Zdenek Pytela 2022-06-14 18:03:27 UTC
This issue will be considered for the next RHEL minor version inclusion. What needs to be taken into account is that we are now in the middle of development cycle and we should try to avoid any kind of regression.

Comment 2 Zdenek Pytela 2023-03-01 07:32:40 UTC
This issue was not selected to be included in Red Hat Enterprise Linux 8 because it is seen either as low or moderate impact to a small number of use-cases. We will now close this issue, but if you believe that the decision needs to be reconsidered, feel free to reopen this bug and attach information regarding severity of the bugzilla.

However, this bz has been cloned to resolve in Fedora and subsequently in future RHEL releases.