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 1686833 - restorecon relabels files /var/cache/yum
Summary: restorecon relabels files /var/cache/yum
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 8
Classification: Red Hat
Component: selinux-policy
Version: 8.0
Hardware: All
OS: Linux
low
low
Target Milestone: rc
: 8.2
Assignee: Zdenek Pytela
QA Contact: Milos Malik
URL:
Whiteboard:
Depends On: 1682526
Blocks:
TreeView+ depends on / blocked
 
Reported: 2019-03-08 12:57 UTC by mkenjale
Modified: 2023-10-06 18:12 UTC (History)
8 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of: 1654190
Environment:
Last Closed: 2020-04-28 16:40:35 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-30852 0 None None None 2023-10-06 18:12:14 UTC
Red Hat Product Errata RHBA-2020:1773 0 None None None 2020-04-28 16:40:55 UTC

Description mkenjale 2019-03-08 12:57:54 UTC
This bug was initially created as a clone of Bug #1654190 as this issue was not selected to be included in Red Hat Enterprise Linux 7.7 because it is seen either as low or moderate impact to a small number of use-cases. The next release will be in Maintenance Support 1 Phase, which means that qualified Critical and Important Security errata advisories (RHSAs) and Urgent Priority Bug Fix errata advisories (RHBAs) may be released as they become available.

The Bug #1654190 was closed and recommendation I am opening the request to Red Hat Enterprise Linux 8

Description of problem:
While running restorecon, my customer notices that all(?) files in /var/cache/yum get relabeled:

[ ... ]
restorecon reset /var/cache/yum context unconfined_u:object_r:rpm_var_lib_t:s0->unconfined_u:object_r:rpm_var_cache_t:s0
restorecon reset /var/cache/yum/x86_64 context unconfined_u:object_r:rpm_var_lib_t:s0->unconfined_u:object_r:rpm_var_cache_t:s0
restorecon reset /var/cache/yum/x86_64/7Server context unconfined_u:object_r:rpm_var_lib_t:s0->unconfined_u:object_r:rpm_var_cache_t:s0
[ ... ]

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


How reproducible: Always


Steps to Reproduce:
1. Run yum
2. Run restorecon -Rv /var/cache/yum

Actual results:
Files are have the wrong label.


Expected results:
Files have the correct selinux label.

Comment 1 Milos Malik 2019-03-08 14:02:31 UTC
# matchpathcon /var/
/var	system_u:object_r:var_t:s0
# matchpathcon /var/cache/
/var/cache	system_u:object_r:var_t:s0
# matchpathcon /var/cache/yum
/var/cache/yum	system_u:object_r:rpm_var_cache_t:s0
# 

Because dnf/yum is usually executed by root user and it runs unconfined_u:unconfined_r:unconfined_t:s0, following filename transition rules are the cause for mislabeled /var/cache/yum:

# sesearch -s unconfined_t -t var_t -c dir -T | grep rpm_var_lib_t
type_transition unconfined_t var_t:dir rpm_var_lib_t dnf;
type_transition unconfined_t var_t:dir rpm_var_lib_t rpm;
type_transition unconfined_t var_t:dir rpm_var_lib_t yum;

I believe that SELinux policy contains a macro which incorrectly generates above-mentioned rules.

Comment 2 Milos Malik 2019-03-08 14:17:46 UTC
Easy to reproduce:

# ls -dZ /var/cache
system_u:object_r:var_t:s0 /var/cache
# ls -dZ /var/cache/rpm
ls: cannot access '/var/cache/rpm': No such file or directory
# mkdir /var/cache/rpm
# ls -dZ /var/cache/rpm
unconfined_u:object_r:rpm_var_lib_t:s0 /var/cache/rpm
# restorecon -Rv /var/cache/rpm/
Relabeled /var/cache/rpm from unconfined_u:object_r:rpm_var_lib_t:s0 to unconfined_u:object_r:var_t:s0
#

Comment 14 errata-xmlrpc 2020-04-28 16:40:35 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, 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-2020:1773


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