Bug 1393569

Summary: SELinux is preventing radicale from execute access on the file /usr/bin/python3.5.
Product: [Fedora] Fedora Reporter: Charles-Henri d'Adhémar <charles-henri>
Component: radicaleAssignee: Juan Orti <jorti>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 24CC: charles-henri, jorti, opensource, viorel.tabara
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: radicale-1.1.1-9.fc24 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-12-20 18:18:52 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:

Description Charles-Henri d'Adhémar 2016-11-09 21:34:34 UTC
SELinux is preventing radicale from execute access on the file /usr/bin/python3.5.

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

If you believe that radicale should be allowed execute access on the python3.5 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 'radicale' --raw | audit2allow -M my-radicale
# semodule -X 300 -i my-radicale.pp


Additional Information:
Source Context                system_u:system_r:radicale_t:s0
Target Context                system_u:object_r:bin_t:s0
Target Objects                /usr/bin/python3.5 [ file ]
Source                        radicale
Source Path                   radicale
Port                          <Unknown>
Host                          horous
Source RPM Packages           
Target RPM Packages           python3-3.5.2-3.fc24.x86_64
Policy RPM                    selinux-policy-3.13.1-191.19.fc24.noarch
Selinux Enabled               True
Policy Type                   targeted
Enforcing Mode                Enforcing
Host Name                     horous
Platform                      Linux horous 4.8.6-201.fc24.x86_64 #1 SMP Thu Nov
                              3 14:38:57 UTC 2016 x86_64 x86_64
Alert Count                   2
First Seen                    2016-11-07 18:19:36 CET
Last Seen                     2016-11-09 21:56:11 CET
Local ID                      2841e50f-9319-4435-a454-e3801ed27d21

Raw Audit Messages
type=AVC msg=audit(1478724971.764:212): avc:  denied  { execute } for  pid=5678 comm="radicale" path="/usr/bin/python3.5" dev="dm-0" ino=8478947 scontext=system_u:system_r:radicale_t:s0 tcontext=system_u:object_r:bin_t:s0 tclass=file permissive=1


Hash: radicale,radicale_t,bin_t,file,execute

Comment 1 Viorel Tabara 2016-11-30 22:34:54 UTC
I was getting this on F25 with latest policy:

   [root@stuff selinux]# rpm -qa --last "selinux*"
   selinux-policy-devel-3.13.1-225.fc25.noarch   Wed 30 Nov 2016 03:06:51 PM MST
   selinux-policy-doc-3.13.1-225.fc25.noarch     Wed 30 Nov 2016 03:06:48 PM MST
   selinux-policy-targeted-3.13.1-225.fc25.noarch Wed 30 Nov 2016 03:06:35 PM MST
   selinux-policy-3.13.1-225.fc25.noarch         Wed 30 Nov 2016 03:06:23 PM MST
   selinux-policy-sandbox-3.13.1-224.fc25.noarch Thu 24 Nov 2016 09:45:56 AM MST
   
   Nov 30 15:17:11 stuff.can.local systemd[1]: Stopping Radicale CalDAV and CardDAV server...
   Nov 30 15:17:11 stuff.can.local systemd[1]: Stopped Radicale CalDAV and CardDAV server.
   Nov 30 15:17:11 stuff.can.local audit[1]: SERVICE_STOP pid=1 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:init_t:s0 msg='unit=radicale comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
   Nov 30 15:17:11 stuff.can.local systemd[1]: Starting Radicale CalDAV and CardDAV server...
   Nov 30 15:17:11 stuff.can.local audit[1396]: AVC avc:  denied  { execute } for  pid=1396 comm="radicale" path="/usr/bin/python3.5" dev="dm-1" ino=18990 scontext=system_u:system_r:radicale_t:s0 tcontext=system_u:object_r:bin_t:s0 tclass=file permissive=1
   Nov 30 15:17:11 stuff.can.local systemd[1]: Started Radicale CalDAV and CardDAV server.
   Nov 30 15:17:11 stuff.can.local audit[1]: SERVICE_START pid=1 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:init_t:s0 msg='unit=radicale comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
   Nov 30 15:17:14 stuff.can.local dbus-daemon[1541]: [system] Activating service name='org.fedoraproject.Setroubleshootd' requested by ':1.37' (uid=0 pid=1500 comm="/usr/sbin/sedispatch " label="system_u:system_r:audisp_t:s0") (using servicehelper)
   Nov 30 15:17:15 stuff.can.local dbus-daemon[1541]: [system] Successfully activated service 'org.fedoraproject.Setroubleshootd'
   Nov 30 15:17:16 stuff.can.local setroubleshoot[1408]: SELinux is preventing radicale from execute access on the file /usr/bin/python3.5. For complete SELinux messages. run sealert -l 77b4c560-b796-42fd-b8ef-0c7b3c2153cd
   Nov 30 15:17:16 stuff.can.local python3[1408]: SELinux is preventing radicale from execute access on the file /usr/bin/python3.5.

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

                                                If you believe that radicale should be allowed execute access on the python3.5 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 'radicale' --raw | audit2allow -M my-radicale
                                                # semodule -X 300 -i my-radicale.pp


Removing the '-devel' packages followed by radicale service "stop" and "start" 
got rid of alerts:

   Nov 30 15:30:16 stuff.can.local systemd[1]: Stopping Radicale CalDAV and CardDAV server...
   Nov 30 15:30:16 stuff.can.local audit[1]: SERVICE_STOP pid=1 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:init_t:s0 msg='unit=radicale comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
   Nov 30 15:30:16 stuff.can.local systemd[1]: Stopped Radicale CalDAV and CardDAV server.
   Nov 30 15:30:27 stuff.can.local systemd[1]: Starting Radicale CalDAV and CardDAV server...
   Nov 30 15:30:28 stuff.can.local audit[1]: SERVICE_START pid=1 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:init_t:s0 msg='unit=radicale comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
   Nov 30 15:30:28 stuff.can.local systemd[1]: Started Radicale CalDAV and CardDAV server.

Comment 2 Viorel Tabara 2016-11-30 22:50:27 UTC
Sorry, spoke too soon. Subsequent restart still trigger the alerts.

Comment 3 Juan Orti 2016-12-09 10:57:22 UTC
I'm not sure why we're getting those AVCs in F25, I'm investigating it.

It's radicale otherwise working for you?

Comment 4 Fedora Update System 2016-12-09 13:48:27 UTC
radicale-1.1.1-9.fc25 has been submitted as an update to Fedora 25. https://bodhi.fedoraproject.org/updates/FEDORA-2016-4339113d45

Comment 5 Fedora Update System 2016-12-09 14:01:29 UTC
radicale-1.1.1-9.fc24 has been submitted as an update to Fedora 24. https://bodhi.fedoraproject.org/updates/FEDORA-2016-b644a7905e

Comment 6 Charles-Henri d'Adhémar 2016-12-09 19:23:12 UTC
To be honest I have not noticed any issue with Radicale and this AVC.
All is working great.

Comment 7 Fedora Update System 2016-12-10 03:58:50 UTC
radicale-1.1.1-9.fc25 has been pushed to the Fedora 25 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-2016-4339113d45

Comment 8 Fedora Update System 2016-12-10 04:29:12 UTC
radicale-1.1.1-9.fc24 has been pushed to the Fedora 24 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-2016-b644a7905e

Comment 9 Juan Orti 2016-12-11 14:23:42 UTC
If you still get the execute_no_trans in /usr/sbin/ldconfig, could you show me the file context of that file? It was wrong in my system, I don't know why.

# ls -lZ /usr/sbin/ldconfig
# restorecon -v /usr/sbin/ldconfig

Comment 10 Charles-Henri d'Adhémar 2016-12-11 14:48:02 UTC
Hi Juan,

Thank you very much for your support and time here.
I have to apologies, I should have tried this first myself.

Indeed restoring the context solves the issue and I have no more AVC with radicale:

# ls -lZ /usr/sbin/ldconfig
-rwxr-xr-x. 2 root root system_u:object_r:bin_t:s0 1092864 18 août  14:21 /usr/sbin/ldconfig

#  restorecon -v /usr/sbin/ldconfig
restorecon reset /usr/sbin/ldconfig context system_u:object_r:bin_t:s0->system_u:object_r:ldconfig_exec_t:s0

Comment 11 Fedora Update System 2016-12-19 06:02:22 UTC
radicale-1.1.1-9.fc25 has been pushed to the Fedora 25 stable repository. If problems still persist, please make note of it in this bug report.

Comment 12 Fedora Update System 2016-12-20 18:18:52 UTC
radicale-1.1.1-9.fc24 has been pushed to the Fedora 24 stable repository. If problems still persist, please make note of it in this bug report.