Bug 2317484

Summary: SELinux is preventing systemd-machine from 'kill' accesses on the cap_userns labeled systemd_machined_t.
Product: [Fedora] Fedora Reporter: MstrPi <mstrpi>
Component: selinux-policyAssignee: Zdenek Pytela <zpytela>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: medium    
Version: 40CC: dwalsh, lvrabec, mmalik, mstrpi, omosnacek, pkoncity, vmojzis, zpytela
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Unspecified   
Whiteboard: abrt_hash:f43227e55f6d333a744f056661f21fe13c993da7e20dabdfcbfebfebb5fc933a;VARIANT_ID=workstation;
Fixed In Version: selinux-policy-40.29-2.fc40 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2024-11-05 04:42:54 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:
Attachments:
Description Flags
File: description
none
File: os_info none

Description MstrPi 2024-10-09 05:44:58 UTC
Description of problem:
i attempted to stop a container with "machinectl stop container_name", and was denied. i would think systemd-machine would have proper permissions to interact with something labeled systemd_machine_t.
SELinux is preventing systemd-machine from 'kill' accesses on the cap_userns labeled systemd_machined_t.

*****  Plugin catchall (100. confidence) suggests   **************************

If you believe that systemd-machine should be allowed kill access on cap_userns labeled systemd_machined_t by default.
Then you should report this as a bug.
You can generate a local policy module to allow this access.
Do
allow this access for now by executing:
# ausearch -c 'systemd-machine' --raw | audit2allow -M my-systemdmachine
# semodule -X 300 -i my-systemdmachine.pp

Additional Information:
Source Context                system_u:system_r:systemd_machined_t:s0
Target Context                system_u:system_r:systemd_machined_t:s0
Target Objects                Unknown [ cap_userns ]
Source                        systemd-machine
Source Path                   systemd-machine
Port                          <Unknown>
Host                          (removed)
Source RPM Packages           
Target RPM Packages           
SELinux Policy RPM            selinux-policy-targeted-40.28-1.fc40.noarch
Local Policy RPM              selinux-policy-targeted-40.28-1.fc40.noarch
Selinux Enabled               True
Policy Type                   targeted
Enforcing Mode                Enforcing
Host Name                     (removed)
Platform                      Linux (removed) 6.10.12-200.fc40.x86_64 #1 SMP
                              PREEMPT_DYNAMIC Mon Sep 30 21:38:25 UTC 2024
                              x86_64
Alert Count                   1
First Seen                    2024-10-09 01:36:43 EDT
Last Seen                     2024-10-09 01:36:43 EDT
Local ID                      d1e13b2d-7347-4617-a22a-3d91bee413ac

Raw Audit Messages
type=AVC msg=audit(1728452203.924:854): avc:  denied  { kill } for  pid=920 comm="systemd-machine" capability=5  scontext=system_u:system_r:systemd_machined_t:s0 tcontext=system_u:system_r:systemd_machined_t:s0 tclass=cap_userns permissive=0


Hash: systemd-machine,systemd_machined_t,systemd_machined_t,cap_userns,kill

Version-Release number of selected component:
selinux-policy-targeted-40.28-1.fc40.noarch

Additional info:
reporter:       libreport-2.17.15
reason:         SELinux is preventing systemd-machine from 'kill' accesses on the cap_userns labeled systemd_machined_t.
package:        selinux-policy-targeted-40.28-1.fc40.noarch
component:      selinux-policy
hashmarkername: setroubleshoot
type:           libreport
kernel:         6.10.12-200.fc40.x86_64
comment:        i attempted to stop a container with "machinectl stop container_name", and was denied. i would think systemd-machine would have proper permissions to interact with something labeled systemd_machine_t.
component:      selinux-policy

Comment 1 MstrPi 2024-10-09 05:45:01 UTC
Created attachment 2051115 [details]
File: description

Comment 2 MstrPi 2024-10-09 05:45:03 UTC
Created attachment 2051116 [details]
File: os_info

Comment 3 Fedora Update System 2024-10-26 12:02:19 UTC
FEDORA-2024-aa24e6024f (selinux-policy-40.29-1.fc40) has been submitted as an update to Fedora 40.
https://bodhi.fedoraproject.org/updates/FEDORA-2024-aa24e6024f

Comment 4 Fedora Update System 2024-10-28 03:49:59 UTC
FEDORA-2024-a9588c99c1 has been pushed to the Fedora 40 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --refresh --advisory=FEDORA-2024-a9588c99c1`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2024-a9588c99c1

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

Comment 5 Fedora Update System 2024-11-05 04:42:54 UTC
FEDORA-2024-a9588c99c1 (selinux-policy-40.29-2.fc40) has been pushed to the Fedora 40 stable repository.
If problem still persists, please make note of it in this bug report.