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 1927551 - SELinux block systemd from running scripts in /usr/lib/systemd/system-sleep
Summary: SELinux block systemd from running scripts in /usr/lib/systemd/system-sleep
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 8
Classification: Red Hat
Component: selinux-policy
Version: 8.3
Hardware: All
OS: Linux
medium
medium
Target Milestone: rc
: 8.5
Assignee: Zdenek Pytela
QA Contact: Milos Malik
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2021-02-11 00:09 UTC by Orion Poplawski
Modified: 2021-11-10 08:31 UTC (History)
4 users (show)

Fixed In Version: selinux-policy-3.14.3-69.el8
Doc Type: No Doc Update
Doc Text:
Clone Of:
Environment:
Last Closed: 2021-11-09 19:42:58 UTC
Type: Bug
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Bugzilla 1931460 1 medium CLOSED SELinux prevents hibernation (preventing systemd-sleep from getattr access to swap partition) 2023-09-02 14:23:17 UTC
Red Hat Product Errata RHBA-2021:4420 0 None None None 2021-11-09 19:43:20 UTC

Description Orion Poplawski 2021-02-11 00:09:16 UTC
Description of problem:

I placed a script in /usr/lib/systemd/system-sleep but it does not get executed:

type=AVC msg=audit(1612929018.423:559): avc:  denied  { execute } for  pid=69804 comm="(direxec)" name="bitdefender-sleep" dev="dm-1" ino=138514047 scontext=system_u:system_r:systemd_sleep_t:s0 tcontext=system_u:object_r:bin_t:s0 tclass=file permissive=0

Feb 09 07:17:28 systemd[1]: Starting Suspend...
Feb 09 07:17:28 [133863]: Failed to execute /usr/lib/systemd/system-sleep/bitdefender-sleep: Permission denied
Feb 09 07:17:28 [133862]: /usr/lib/systemd/system-sleep/bitdefender-sleep failed with exit status 1.

Version-Release number of selected component (if applicable):
selinux-policy-3.14.3-54.el8_3.2.noarch

# ls -lZa /usr/lib/systemd/system-sleep
total 12
drwxr-xr-x.  2 root root system_u:object_r:bin_t:s0   31 Dec 17 16:30 ./
drwxr-xr-x. 16 root root system_u:object_r:lib_t:s0 4096 Jan  8 07:18 ../
-rwxr-xr-x.  1 root root system_u:object_r:bin_t:s0  150 Sep  5 10:49 bitdefender-sleep*


allow systemd_sleep_t systemd_sleep_exec_t:file { entrypoint execute getattr ioctl lock map open read };

Perhaps /usr/lib/systemd/system-sleep and it's contents should get labeled systemd_sleep_exec_t ?

FWIW - /usr/lib/systemd/system-shutdown is labeled lib_t instead of bin_t.

restorecon doesn't change any of these labels.

Comment 1 Orion Poplawski 2021-02-11 15:56:36 UTC
Changing to lib_t doesn't help.  Changing to systemd_sleed_exec_t leads to a different denial:

avc:  denied  { getattr } for  pid=144222 comm="(sd-executor)" path="/usr/lib/systemd/system-sleep" dev="dm-1" ino=134845448 scontext=system_u:system_r:systemd_sleep_t:s0 tcontext=system_u:object_r:systemd_sleep_exec_t:s0 tclass=dir permissive=0

Comment 2 Zdenek Pytela 2021-04-19 20:56:33 UTC
I've submitted a Fedora PR to address the issue:
https://github.com/fedora-selinux/selinux-policy/pull/612

Comment 13 errata-xmlrpc 2021-11-09 19:42:58 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-2021:4420


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