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 1973754 - setfiles: do not restrict checks against binary policy provided via '-c' option
Summary: setfiles: do not restrict checks against binary policy provided via '-c' option
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 8
Classification: Red Hat
Component: policycoreutils
Version: 8.4
Hardware: All
OS: Linux
urgent
urgent
Target Milestone: beta
: ---
Assignee: Vit Mojzis
QA Contact: Milos Malik
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2021-06-18 16:06 UTC by Tomáš Hozza
Modified: 2021-11-10 10:19 UTC (History)
8 users (show)

Fixed In Version: policycoreutils-2.9-15.el8
Doc Type: No Doc Update
Doc Text:
Clone Of:
Environment:
Last Closed: 2021-11-09 20:03:21 UTC
Type: Bug
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2021:4497 0 None None None 2021-11-09 20:03:26 UTC

Description Tomáš Hozza 2021-06-18 16:06:24 UTC
Description of problem:
In the Image Builder team, we have a simple tool called 'image-info' [1]. We use it to analyse images produced by our tooling, which is part of the official RHEL release process and used via Brew. We recently extended the tool to check the SELinux context of all files present in the image for any discrepancies. In order to analyse an image, the tool mounts it to a temporary directory on the host system and runs checks against it. For checks, we prefer using binaries from the host. However in order to produce correct report for SELinux, we need to perform the check of the image against the binary policy present on the image. Otherwise the produced report may be incorrect, especially if the image contains any RPMs shipping a custom SELinux policy, which is not present on the host system. However, on RHEL-8, the version of 'setfiles' does not allow this.

The change to allow specifying a different binary policy using '-c' is already present in the upstream and in Fedora. I would like to request that the relevant change is backported to RHEL-8.

[1] https://github.com/osbuild/osbuild-composer/blob/main/tools/image-info

Version-Release number of selected component (if applicable):
policycoreutils-2.9-14.el8.x86_64.rpm

How reproducible:
always

Steps to Reproduce:
1. Download any RHEL image, e.g. the KVM Guest image
2. Mount the image to '<mounted_image_path>'
3. Run 'setfiles -r <mounted_image_path> -nvF -c <mounted_image_path>/etc/selinux/targeted/policy/policy.31 <mounted_image_path>/etc/selinux/targeted/contexts/files/file_contexts <mounted_image_path>'

Actual results:
setfiles prints is usage message:
usage:  setfiles [-diIDlmnpqvFW] [-e excludedir] [-r alt_root_path] spec_file pathname...
usage:  setfiles [-diIDlmnpqvFW] [-e excludedir] [-r alt_root_path] spec_file -f filename
usage:  setfiles -s [-diIDlmnpqvFW] spec_file
usage:  setfiles -c policyfile spec_file

Expected results:
setfiles should use the provided binary policy file and check the provided filesystem root against it.

Additional info:
Relevant upstream commit: https://github.com/SELinuxProject/selinux/commit/c94e542c98da2f26863c1cbd9d7ad9bc5cca6aff

Comment 15 errata-xmlrpc 2021-11-09 20:03:21 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 (policycoreutils 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-2021:4497


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