Red Hat Bugzilla – 1852367 – xccdf_org.ssgproject.content_rule_selinux_all_devicefiles_labeled fails when a symlink or regular file is labeled with "device_t"
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.
This bug was initially created as a copy of Bug #1852364
I am copying this bug because:
also applies to RHEL 8
Description of problem:
When a symlink or a regular file in /dev is labeled with "device_t" exists, the rule xccdf_org.ssgproject.content_rule_selinux_all_devicefiles_labeled fails.
The rule should only deal with special devices and skip the rest, but currently it deals with everything which is not a directory:
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------
<linux:selinuxsecuritycontext_object comment="device_t in /dev" id="object_selinux_all_devicefiles_labeled" version="1">
<linux:behaviors recurse_direction="down" />
<linux:path>/dev</linux:path>
<linux:filename operation="pattern match">^.*$</linux:filename>
<filter action="include">state_selinux_all_devicefiles_labeled</filter>
</linux:selinuxsecuritycontext_object>
<linux:selinuxsecuritycontext_state comment="do it" id="state_selinux_all_devicefiles_labeled" version="1">
<linux:type datatype="string" operation="equals">device_t</linux:type>
</linux:selinuxsecuritycontext_state>
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------
From the description and remediation, the rule should only deal with special devices:
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------
To check for unlabeled device files, run the following command:
<pre>$ sudo find /dev -context *:device_t:* \( -type c -o -type b \) -printf "%p %Z\n"</pre>
It should produce no output in a well-configured system.
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------
This is an issue with Veritas software which creates symlink /dev/vx/rdmp to directory /dev/vx/dmp.
Version-Release number of selected component (if applicable):
All
How reproducible:
ALWAYS
Steps to Reproduce:
1. Create a symlink to a directory in /dev
# ln -s /dev/virtio-ports /dev/foo
# restorecon -F /dev/foo
# ls -Z /dev/foo
lrwxrwxrwx. root root system_u:object_r:device_t:s0 /dev/foo -> /dev/virtio-ports
2. Execute the rule
# oscap xccdf eval --profile xccdf_org.ssgproject.content_profile_stig --rule xccdf_org.ssgproject.content_rule_selinux_all_devicefiles_labeled /usr/share/xml/scap/ssg/content/ssg-rhel7-ds.xml
Actual results:
fail
Expected results:
pass
Additional info:
The real use case is symlink /dev/vx/rdmp to directory /dev/vx/dmp.
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 (scap-security-guide 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-2020:4626