Bug 1418682

Summary: SELinux is preventing systemd from 'connectto' accesses on the unix_stream_socket /run/systemd/journal/stdout.
Product: [Fedora] Fedora Reporter: Lukas Slebodnik <lslebodn>
Component: selinux-policyAssignee: Lukas Vrabec <lvrabec>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 26CC: dominick.grift, dwalsh, lvrabec, mgrepl, plautrba, pmoore, ssekidde, zbyszek
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Unspecified   
Whiteboard: abrt_hash:0f763480b3de8d1ed1d95b4703bc8458c4d9afe0ff2e8ed3a30e521889455d95;VARIANT_ID=server;
Fixed In Version: selinux-policy-3.13.1-251.fc26 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-05-09 21:20:50 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 Lukas Slebodnik 2017-02-02 14:08:13 UTC
Description of problem:
SELinux is preventing systemd from 'connectto' accesses on the unix_stream_socket /run/systemd/journal/stdout.

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

If you believe that systemd should be allowed connectto access on the stdout unix_stream_socket 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' --raw | audit2allow -M my-systemd
# semodule -X 300 -i my-systemd.pp

Additional Information:
Source Context                system_u:system_r:init_t:s0
Target Context                system_u:system_r:kernel_t:s0
Target Objects                /run/systemd/journal/stdout [ unix_stream_socket ]
Source                        systemd
Source Path                   systemd
Port                          <Unknown>
Host                          (removed)
Source RPM Packages           
Target RPM Packages           
Policy RPM                    selinux-policy-3.13.1-236.fc26.noarch
Selinux Enabled               True
Policy Type                   targeted
Enforcing Mode                Enforcing
Host Name                     (removed)
Platform                      Linux (removed) 4.9.6-200.fc25.x86_64 #1 SMP Thu
                              Jan 26 10:17:45 UTC 2017 x86_64 x86_64
Alert Count                   74
First Seen                    2017-02-02 15:02:06 CET
Last Seen                     2017-02-02 15:03:24 CET
Local ID                      81daed45-0cf3-4426-88c5-ede9aa22f842

Raw Audit Messages
type=AVC msg=audit(1486044204.161:366): avc:  denied  { connectto } for  pid=2846 comm="(spatcher)" path="/run/systemd/journal/stdout" scontext=system_u:system_r:init_t:s0 tcontext=system_u:system_r:kernel_t:s0 tclass=unix_stream_socket permissive=0


Hash: systemd,init_t,kernel_t,unix_stream_socket,connectto

Version-Release number of selected component:
selinux-policy-3.13.1-236.fc26.noarch

Additional info:
component:      selinux-policy
reporter:       libreport-2.9.0
hashmarkername: setroubleshoot
kernel:         4.9.6-200.fc25.x86_64
type:           libreport

Comment 1 Lukas Slebodnik 2017-02-02 15:18:34 UTC
printf 'type=AVC msg=audit(1486044204.161:366): avc:  denied  { connectto } for  pid=2846 comm="(spatcher)" path="/run/systemd/journal/stdout" scontext=system_u:system_r:init_t:s0 tcontext=system_u:system_r:kernel_t:s0 tclass=unix_stream_socket permissive=0' | audit2allow 


#============= init_t ==============

#!!!! The file '/run/systemd/journal/stdout' is mislabeled on your system.  
#!!!! Fix with $ restorecon -R -v /run/systemd/journal/stdout
allow init_t kernel_t:unix_stream_socket connectto;



But I do not think the file is mislabeled

sh$ ls -dZ /run/systemd/journal/stdout
system_u:object_r:syslogd_var_run_t:s0 /run/systemd/journal/stdout
sh$ ls -dZ /run/systemd/journal/
system_u:object_r:syslogd_var_run_t:s0 /run/systemd/journal/
sh$ ls -dZ /run/systemd/
system_u:object_r:init_var_run_t:s0 /run/systemd/
sh$ ls -dZ /run/
system_u:object_r:var_run_t:s0 /run/
sh$ ls -dZ /
system_u:object_r:root_t:s0 /

sh$ matchpathcon /run/systemd/journal/stdout
/run/systemd/journal/stdout     system_u:object_r:syslogd_var_run_t:s0
sh$ matchpathcon /run/systemd/journal/
/run/systemd/journal    system_u:object_r:syslogd_var_run_t:s0
sh$ matchpathcon /run/systemd/
/run/systemd    system_u:object_r:init_var_run_t:s0
sh$ matchpathcon /run/
/run    system_u:object_r:var_run_t:s0
sh$ matchpathcon /
/       system_u:object_r:root_t:s0

Comment 2 Lukas Slebodnik 2017-02-02 15:22:16 UTC
I think it can be related to your change in selinux-policy.
https://github.com/fedora-selinux/selinux-policy/pull/184

Is it correct?

Comment 3 Zbigniew Jędrzejewski-Szmek 2017-02-02 15:53:56 UTC
Maybe. Can you try the following patch:
https://github.com/keszybz/selinux-policy/commit/c79965b7e2e49bd63df71661a1925f6c4cc733a8 ?

Comment 4 Lukas Slebodnik 2017-02-02 16:42:01 UTC
(In reply to Zbigniew Jędrzejewski-Szmek from comment #3)
> Maybe. Can you try the following patch:
> https://github.com/keszybz/selinux-policy/commit/
> c79965b7e2e49bd63df71661a1925f6c4cc733a8 ?

Yes it helped. Maybe you can add also a comment why this line is needed :-)

Comment 5 Lukas Vrabec 2017-02-03 08:04:49 UTC
Merged, 
Thanks.

Comment 6 Fedora End Of Life 2017-02-28 11:09:49 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 26 development cycle.
Changing version to '26'.

Comment 7 Fedora Update System 2017-04-19 20:37:58 UTC
selinux-policy-3.13.1-251.fc26 has been submitted as an update to Fedora 26. https://bodhi.fedoraproject.org/updates/FEDORA-2017-f36794dd98

Comment 8 Fedora Update System 2017-04-20 20:23:01 UTC
selinux-policy-3.13.1-251.fc26 has been pushed to the Fedora 26 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2017-f36794dd98

Comment 9 Fedora Update System 2017-05-09 21:20:50 UTC
selinux-policy-3.13.1-251.fc26 has been pushed to the Fedora 26 stable repository. If problems still persist, please make note of it in this bug report.