Bug 2277658

Summary: SELinux is preventing abrt-dump-journ from 'connectto' accesses on the unix_stream_socket /run/systemd/userdb/io.systemd.Machine.
Product: [Fedora] Fedora Reporter: hkoba <buribullet>
Component: selinux-policyAssignee: Zdenek Pytela <zpytela>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: low    
Version: 40CC: buribullet, chplee, decal_schnapps157, dwalsh, knazekovan, lvrabec, mmalik, omosnacek, pkoncity, robertjenssen, vmojzis, y9t7sypezp, zpytela
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Unspecified   
Whiteboard: abrt_hash:a4b9eba7151e2cdf8c2b64af5d13d86ad9a70264adae2a52e146359914a9a02c;VARIANT_ID=workstation;
Fixed In Version: selinux-policy-40.18-2.fc40 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2024-05-12 04:17:55 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 hkoba 2024-04-29 00:58:01 UTC
Description of problem:
This io.systemd.Machine related selinux alert on coredump still occurs after I applied https://bodhi.fedoraproject.org/updates/FEDORA-2024-57cdb8429c and rebooted.
SELinux is preventing abrt-dump-journ from 'connectto' accesses on the unix_stream_socket /run/systemd/userdb/io.systemd.Machine.

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

abrt-dump-journ に、 io.systemd.Machine unix_stream_socket の connectto アクセスがデフォルトで許可されるべきと考える場合。
Then バグとして報告してください。 
ローカルのポリシーモジュールを生成すると、
 このアクセスを許可することができます。
Do
以下を実行して、このアクセスを許可します:
# ausearch -c 'abrt-dump-journ' --raw | audit2allow -M my-abrtdumpjourn
# semodule -X 300 -i my-abrtdumpjourn.pp

Additional Information:
Source Context                system_u:system_r:abrt_dump_oops_t:s0
Target Context                system_u:system_r:systemd_machined_t:s0
Target Objects                /run/systemd/userdb/io.systemd.Machine [
                              unix_stream_socket ]
Source                        abrt-dump-journ
Source Path                   abrt-dump-journ
Port                          <不明>
Host                          (removed)
Source RPM Packages           
Target RPM Packages           
SELinux Policy RPM            selinux-policy-targeted-40.17-1.fc40.noarch
Local Policy RPM              selinux-policy-targeted-40.17-1.fc40.noarch
Selinux Enabled               True
Policy Type                   targeted
Enforcing Mode                Enforcing
Host Name                     (removed)
Platform                      Linux (removed) 6.8.7-300.fc40.x86_64 #1 SMP
                              PREEMPT_DYNAMIC Wed Apr 17 19:21:08 UTC 2024
                              x86_64
Alert Count                   2
First Seen                    2024-04-29 09:53:36 JST
Last Seen                     2024-04-29 09:53:36 JST
Local ID                      7402e203-919c-4524-8c3c-d815fa6c0090

Raw Audit Messages
type=AVC msg=audit(1714352016.324:249): avc:  denied  { connectto } for  pid=2471 comm="abrt-dump-journ" path="/run/systemd/userdb/io.systemd.Machine" scontext=system_u:system_r:abrt_dump_oops_t:s0 tcontext=system_u:system_r:systemd_machined_t:s0 tclass=unix_stream_socket permissive=0


Hash: abrt-dump-journ,abrt_dump_oops_t,systemd_machined_t,unix_stream_socket,connectto

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

Additional info:
reporter:       libreport-2.17.15
reason:         SELinux is preventing abrt-dump-journ from 'connectto' accesses on the unix_stream_socket /run/systemd/userdb/io.systemd.Machine.
package:        selinux-policy-targeted-40.17-1.fc40.noarch
component:      selinux-policy
hashmarkername: setroubleshoot
type:           libreport
kernel:         6.8.7-300.fc40.x86_64
comment:        This io.systemd.Machine related selinux alert on coredump still occurs after I applied https://bodhi.fedoraproject.org/updates/FEDORA-2024-57cdb8429c and rebooted.
component:      selinux-policy

Comment 1 hkoba 2024-04-29 00:58:03 UTC
Created attachment 2029876 [details]
File: description

Comment 2 hkoba 2024-04-29 00:58:05 UTC
Created attachment 2029877 [details]
File: os_info

Comment 3 Zdenek Pytela 2024-05-04 19:54:24 UTC
*** Bug 2279045 has been marked as a duplicate of this bug. ***

Comment 4 Zdenek Pytela 2024-05-06 08:43:04 UTC
*** Bug 2279104 has been marked as a duplicate of this bug. ***

Comment 5 Zdenek Pytela 2024-05-06 08:45:41 UTC
*** Bug 2279236 has been marked as a duplicate of this bug. ***

Comment 6 Fedora Update System 2024-05-07 08:33:40 UTC
FEDORA-2024-759c80369d (selinux-policy-40.18-2.fc40) has been submitted as an update to Fedora 40.
https://bodhi.fedoraproject.org/updates/FEDORA-2024-759c80369d

Comment 7 Steve 2024-05-07 21:49:00 UTC
While reproducing this bug, I found that it occurs with Workstation, but not with Xfce.

With Workstation:

$ rpm -qa selinux\*
selinux-policy-40.17-1.fc40.noarch
selinux-policy-targeted-40.17-1.fc40.noarch

Test command:

$ date ; { sleep 60 & } ; sleep 3 ; kill -ABRT %1 ; date
Tue May  7 09:43:21 PM UTC 2024
[1] 4308
Tue May  7 09:43:24 PM UTC 2024
$ 
[1]+  Aborted                 (core dumped) sleep 60

$ sudo ausearch -ts 21:43 -m avc
----
time->Tue May  7 21:43:25 2024
type=AVC msg=audit(1715118205.191:390): avc:  denied  { connectto } for  pid=875 comm="abrt-dump-journ" path="/run/systemd/userdb/io.systemd.Machine" scontext=system_u:system_r:abrt_dump_oops_t:s0 tcontext=system_u:system_r:systemd_machined_t:s0 tclass=unix_stream_socket permissive=0
----
time->Tue May  7 21:43:25 2024
type=AVC msg=audit(1715118205.192:391): avc:  denied  { connectto } for  pid=875 comm="abrt-dump-journ" path="/run/systemd/userdb/io.systemd.Home" scontext=system_u:system_r:abrt_dump_oops_t:s0 tcontext=system_u:system_r:init_t:s0 tclass=unix_stream_socket permissive=0
----
time->Tue May  7 21:43:25 2024
type=AVC msg=audit(1715118205.194:392): avc:  denied  { connectto } for  pid=875 comm="abrt-dump-journ" path="/run/systemd/userdb/io.systemd.Machine" scontext=system_u:system_r:abrt_dump_oops_t:s0 tcontext=system_u:system_r:systemd_machined_t:s0 tclass=unix_stream_socket permissive=0
----
time->Tue May  7 21:43:25 2024
type=AVC msg=audit(1715118205.194:393): avc:  denied  { connectto } for  pid=875 comm="abrt-dump-journ" path="/run/systemd/userdb/io.systemd.Home" scontext=system_u:system_r:abrt_dump_oops_t:s0 tcontext=system_u:system_r:init_t:s0 tclass=unix_stream_socket permissive=0

Comment 8 Steve 2024-05-07 21:59:12 UTC
On Workstation:

$ ll /run/systemd/userdb/
total 0
lrwxrwxrwx. 1 root root 42 May  7 21:25 io.systemd.DropIn -> /run/systemd/userdb/io.systemd.Multiplexer
srw-rw-rw-. 1 root root  0 May  7 21:25 io.systemd.DynamicUser
srw-rw-rw-. 1 root root  0 May  7 21:25 io.systemd.Home
srw-rw-rw-. 1 root root  0 May  7 21:25 io.systemd.Machine
srw-rw-rw-. 1 root root  0 May  7 21:25 io.systemd.Multiplexer
lrwxrwxrwx. 1 root root 42 May  7 21:25 io.systemd.NameServiceSwitch -> /run/systemd/userdb/io.systemd.Multiplexer

$ sudo lsof +c 0 |& fgrep Machine
systemd-machine                  842                                  root    9u     unix 0x000000008f1ef52e       0t0       9924 /run/systemd/userdb/io.systemd.Machine type=STREAM (LISTEN)

On Xfce, there is no io.systemd.Machine:

$ ll /run/systemd/userdb/
total 0
lrwxrwxrwx. 1 root root 42 May  7 14:54 io.systemd.DropIn -> /run/systemd/userdb/io.systemd.Multiplexer
srw-rw-rw-. 1 root root  0 May  7 14:54 io.systemd.DynamicUser
srw-rw-rw-. 1 root root  0 May  7 14:54 io.systemd.Home
srw-rw-rw-. 1 root root  0 May  7 14:54 io.systemd.Multiplexer
lrwxrwxrwx. 1 root root 42 May  7 14:54 io.systemd.NameServiceSwitch -> /run/systemd/userdb/io.systemd.Multiplexer

Comment 9 Steve 2024-05-07 22:13:58 UTC
The difference appears to be in whether systemd-container is installed or not.

On Workstation:

$ systemctl list-unit-files -a \*systemd-machine\*
UNIT FILE                         STATE  PRESET
systemd-machine-id-commit.service static -     
systemd-machined.service          static -     

$ locate systemd-machined.service
/usr/lib/systemd/system/systemd-machined.service
/usr/share/man/man8/systemd-machined.service.8.gz

$ rpm -qf /usr/lib/systemd/system/systemd-machined.service
systemd-container-255.4-1.fc40.x86_64

On Xfce:

$ rpm -q systemd-container
package systemd-container is not installed

Comment 10 Fedora Update System 2024-05-08 02:21:25 UTC
FEDORA-2024-759c80369d 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-759c80369d`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2024-759c80369d

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

Comment 11 Fedora Update System 2024-05-12 04:17:55 UTC
FEDORA-2024-759c80369d (selinux-policy-40.18-2.fc40) has been pushed to the Fedora 40 stable repository.
If problem still persists, please make note of it in this bug report.