Bug 2365764

Summary: SELinux policy preventing nut-monitor (upsmon) from creating sleep inhibitor
Product: [Fedora] Fedora Reporter: Scott Shambarger <scott-fedora>
Component: selinux-policyAssignee: Zdenek Pytela <zpytela>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 42CC: dwalsh, lvrabec, mmalik, omosnacek, pkoncity, vmojzis, zpytela
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Linux   
Whiteboard:
Fixed In Version: selinux-policy-41.40-1.fc42 Doc Type: ---
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2025-05-15 01:55:58 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Scott Shambarger 2025-05-12 22:27:24 UTC
SELinux policy currently doesn't allow nut_upsmon_t to write to fifo_file:systemd_logind_inhibit_var_run_t


Reproducible: Always

Steps to Reproduce:
1.Install/configure nut-client
2.Start nut-monitor
3.Run systemd-inhibit --list
Actual Results:
No upsmon sleep inhibitor is listed

Expected Results:
WHO            UID USER PID    COMM           WHAT  WHY                        >
upsmon         57  nut  435457 upsmon         sleep Careful handling of OS slee>


Additional Information:
Denial is:

type=AVC msg=audit(1747088012.000:22345): avc:  denied  { write } for  pid=1452 comm="upsmon" path="/run/systemd/inhibit/6237.ref" dev="tmpfs" ino=46602 scontext=system_u:system_r:nut_upsmon_t:s0 tcontext=system_u:object_r:systemd_logind_inhibit_var_run_t:s0 tclass=fifo_file permissive=0

Adding a module with the following rule allows upsmon to work correctly:

allow nut_upsmon_t systemd_logind_inhibit_var_run_t:fifo_file write;

Comment 1 Fedora Update System 2025-05-13 19:17:53 UTC
FEDORA-2025-5e64167ac4 (selinux-policy-41.40-1.fc42) has been submitted as an update to Fedora 42.
https://bodhi.fedoraproject.org/updates/FEDORA-2025-5e64167ac4

Comment 2 Scott Shambarger 2025-05-13 19:43:38 UTC
Update fixes denial, karma added :)

Comment 3 Fedora Update System 2025-05-14 02:07:52 UTC
FEDORA-2025-5e64167ac4 has been pushed to the Fedora 42 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --refresh --advisory=FEDORA-2025-5e64167ac4`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2025-5e64167ac4

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 4 Fedora Update System 2025-05-15 01:55:58 UTC
FEDORA-2025-5e64167ac4 (selinux-policy-41.40-1.fc42) has been pushed to the Fedora 42 stable repository.
If problem still persists, please make note of it in this bug report.