Bug 1513403

Summary: start of syslog-ng is blocked by SELinux
Product: [Fedora] Fedora Reporter: Peter Czanik <peter>
Component: selinux-policyAssignee: Lukas Vrabec <lvrabec>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: urgent Docs Contact:
Priority: unspecified    
Version: 27CC: dwalsh, lvrabec, mgrepl, plautrba, pmoore
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: selinux-policy-3.13.1-283.17.fc27 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-11-28 23:52:57 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Peter Czanik 2017-11-15 11:00:16 UTC
Description of problem:

Start of syslog-ng is blocked by SELinux. 

Version-Release number of selected component (if applicable):

Fedora 27 as of November 15 with all updates
[root@localhost ~]# rpm -qa | grep syslog
syslog-ng-3.10.1-3.fc27.x86_64
[root@localhost ~]# rpm -qa | grep selinux
selinux-policy-targeted-3.13.1-283.14.fc27.noarch
selinux-policy-3.13.1-283.14.fc27.noarch
rpm-plugin-selinux-4.14.0-2.fc27.x86_64
libselinux-python3-2.7-2.fc27.x86_64
libselinux-2.7-2.fc27.x86_64
libselinux-utils-2.7-2.fc27.x86_64


How reproducible:

Always.

Steps to Reproduce:
1. "systemctl start syslog-ng" on a freshly installed system
2.
3.

Actual results:

syslog-ng does not start. Journal shows the following information:

"
Nov 15 11:14:58 localhost.localdomain systemd[1]: Starting System Logger Daemon...
Nov 15 11:14:58 localhost.localdomain audit[3815]: AVC avc:  denied  { map } for  pid=3815 comm="syslog-ng" path="/var/lib/syslog-ng/syslog-ng.persist-" dev="dm-0" ino=664080 scontext=system_u:system_r:syslogd_t
Nov 15 11:14:58 localhost.localdomain audit[1]: SERVICE_START pid=1 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:init_t:s0 msg='unit=syslog-ng comm="systemd" exe="/usr/lib/systemd/systemd" hostnam
Nov 15 11:14:58 localhost.localdomain systemd[1]: syslog-ng.service: Main process exited, code=exited, status=2/INVALIDARGUMENT
Nov 15 11:14:58 localhost.localdomain systemd[1]: Failed to start System Logger Daemon.
Nov 15 11:14:58 localhost.localdomain systemd[1]: syslog-ng.service: Unit entered failed state.
Nov 15 11:14:58 localhost.localdomain systemd[1]: syslog-ng.service: Failed with result 'exit-code'.
Nov 15 11:14:58 localhost.localdomain systemd[1]: syslog-ng.service: Service hold-off time over, scheduling restart.
Nov 15 11:14:58 localhost.localdomain systemd[1]: Stopped System Logger Daemon.
Nov 15 11:14:58 localhost.localdomain systemd[1]: syslog-ng.service: Start request repeated too quickly.
Nov 15 11:14:58 localhost.localdomain systemd[1]: Failed to start System Logger Daemon.
Nov 15 11:14:58 localhost.localdomain systemd[1]: syslog-ng.service: Unit entered failed state.
Nov 15 11:14:58 localhost.localdomain systemd[1]: syslog-ng.service: Failed with result 'exit-code'.
Nov 15 11:14:58 localhost.localdomain audit[1]: SERVICE_START pid=1 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:init_t:s0 msg='unit=syslog-ng comm="systemd" exe="/usr/lib/systemd/systemd" hostnam
Nov 15 11:14:58 localhost.localdomain audit[1]: SERVICE_STOP pid=1 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:init_t:s0 msg='unit=syslog-ng comm="systemd" exe="/usr/lib/systemd/systemd" hostname
Nov 15 11:15:01 localhost.localdomain dbus-daemon[722]: [system] Activating service name='org.fedoraproject.Setroubleshootd' requested by ':1.139' (uid=0 pid=698 comm="/usr/sbin/sedispatch " label="system_u:syst
Nov 15 11:15:02 localhost.localdomain dbus-daemon[722]: [system] Successfully activated service 'org.fedoraproject.Setroubleshootd'
Nov 15 11:15:02 localhost.localdomain setroubleshoot[3817]: failed to retrieve rpm info for /var/lib/syslog-ng/syslog-ng.persist-
Nov 15 11:15:02 localhost.localdomain setroubleshoot[3817]: SELinux is preventing syslog-ng from map access on the file /var/lib/syslog-ng/syslog-ng.persist-. For complete SELinux messages run: sealert -l 0e7634
Nov 15 11:15:02 localhost.localdomain python3[3817]: SELinux is preventing syslog-ng from map access on the file /var/lib/syslog-ng/syslog-ng.persist-.
                                                     
                                                     *****  Plugin catchall (100. confidence) suggests   **************************
                                                     
                                                     If you believe that syslog-ng should be allowed map access on the syslog-ng.persist- file 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 'syslog-ng' --raw | audit2allow -M my-syslogng
                                                     # semodule -X 300 -i my-syslogng.pp

"

Expected results:

starting syslog-ng without any errors

Additional info:

syslog-ng.persist and syslog-ng.persist- are used by syslog-ng to store some information between restarts, for example file or journal reading positions, etc.

Comment 1 Lukas Vrabec 2017-11-16 12:43:17 UTC
Hi, 

Could you try to reproduce the scenario and attach output of: 

# ausearch -m AVC -ts recent 

Thanks,
Lukas.

Comment 2 Peter Czanik 2017-11-17 08:18:05 UTC
Did a fresh install and ran the above command:

[root@localhost ~]# ausearch -m AVC -ts recent 
----
time->Fri Nov 17 09:15:38 2017
type=AVC msg=audit(1510906538.911:313): avc:  denied  { map } for  pid=3487 comm="syslog-ng" path="/var/lib/syslog-ng/syslog-ng.persist-" dev="dm-0" ino=273636 scontext=system_u:system_r:syslogd_t:s0 tcontext=system_u:object_r:syslogd_var_lib_t:s0 tclass=file permissive=0
----
time->Fri Nov 17 09:15:39 2017
type=AVC msg=audit(1510906539.176:317): avc:  denied  { map } for  pid=3488 comm="syslog-ng" path="/var/lib/syslog-ng/syslog-ng.persist-" dev="dm-0" ino=273636 scontext=system_u:system_r:syslogd_t:s0 tcontext=system_u:object_r:syslogd_var_lib_t:s0 tclass=file permissive=0
----
time->Fri Nov 17 09:15:39 2017
type=AVC msg=audit(1510906539.425:321): avc:  denied  { map } for  pid=3489 comm="syslog-ng" path="/var/lib/syslog-ng/syslog-ng.persist-" dev="dm-0" ino=273636 scontext=system_u:system_r:syslogd_t:s0 tcontext=system_u:object_r:syslogd_var_lib_t:s0 tclass=file permissive=0
----
time->Fri Nov 17 09:15:39 2017
type=AVC msg=audit(1510906539.675:325): avc:  denied  { map } for  pid=3490 comm="syslog-ng" path="/var/lib/syslog-ng/syslog-ng.persist-" dev="dm-0" ino=273636 scontext=system_u:system_r:syslogd_t:s0 tcontext=system_u:object_r:syslogd_var_lib_t:s0 tclass=file permissive=0
----
time->Fri Nov 17 09:15:39 2017
type=AVC msg=audit(1510906539.924:329): avc:  denied  { map } for  pid=3491 comm="syslog-ng" path="/var/lib/syslog-ng/syslog-ng.persist-" dev="dm-0" ino=273636 scontext=system_u:system_r:syslogd_t:s0 tcontext=system_u:object_r:syslogd_var_lib_t:s0 tclass=file permissive=0

Comment 3 Fedora Update System 2017-11-22 08:53:48 UTC
selinux-policy-3.13.1-283.17.fc27 has been submitted as an update to Fedora 27. https://bodhi.fedoraproject.org/updates/FEDORA-2017-d05b1a2ab9

Comment 4 Fedora Update System 2017-11-22 21:40:35 UTC
selinux-policy-3.13.1-283.17.fc27 has been pushed to the Fedora 27 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-d05b1a2ab9

Comment 5 Fedora Update System 2017-11-28 23:52:57 UTC
selinux-policy-3.13.1-283.17.fc27 has been pushed to the Fedora 27 stable repository. If problems still persist, please make note of it in this bug report.