Bug 1767394

Summary: SELinux is preventing systemd-tmpfile from using the 'setrlimit' accesses on a process.
Product: [Fedora] Fedora Reporter: Yannick Defais <sevmek>
Component: selinux-policyAssignee: Lukas Vrabec <lvrabec>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 31CC: dwalsh, lvrabec, mwolf, plautrba, sevmek, zpytela
Target Milestone: ---Keywords: Reopened
Target Release: ---   
Hardware: x86_64   
OS: Unspecified   
Whiteboard: abrt_hash:0599895a821d905dd69cbeffeca862e4f27567c85a874dae3ced99263d80a49f;VARIANT_ID=workstation;
Fixed In Version: selinux-policy-3.14.4-43.fc31 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2019-12-20 15:08:34 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 Yannick Defais 2019-10-31 11:19:37 UTC
Description of problem:
SELinux is preventing systemd-tmpfile from using the 'setrlimit' accesses on a process.

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

Si vous pensez que systemd-tmpfile devrait être autorisé à accéder setrlimit sur les processus étiquetés systemd_tmpfiles_t par défaut.
Then vous devriez rapporter ceci en tant qu'anomalie.
Vous pouvez générer un module de stratégie local pour autoriser cet accès.
Do
autoriser cet accès pour le moment en exécutant :
# ausearch -c "systemd-tmpfile" --raw | audit2allow -M my-systemdtmpfile
# semodule -X 300 -i my-systemdtmpfile.pp

Additional Information:
Source Context                system_u:system_r:systemd_tmpfiles_t:s0
Target Context                system_u:system_r:systemd_tmpfiles_t:s0
Target Objects                Inconnu [ process ]
Source                        systemd-tmpfile
Source Path                   systemd-tmpfile
Port                          <Inconnu>
Host                          (removed)
Source RPM Packages           
Target RPM Packages           
Policy RPM                    selinux-policy-3.14.4-39.fc31.noarch
Selinux Enabled               True
Policy Type                   targeted
Enforcing Mode                Enforcing
Host Name                     (removed)
Platform                      Linux (removed) 5.3.7-301.fc31.x86_64 #1 SMP Mon
                              Oct 21 19:18:58 UTC 2019 x86_64 x86_64
Alert Count                   2
First Seen                    2019-10-30 17:53:36 CET
Last Seen                     2019-10-31 12:15:59 CET
Local ID                      8b131f25-b217-4a79-8542-363e34b4cf72

Raw Audit Messages
type=AVC msg=audit(1572520559.401:273): avc:  denied  { setrlimit } for  pid=8785 comm="systemd-tmpfile" scontext=system_u:system_r:systemd_tmpfiles_t:s0 tcontext=system_u:system_r:systemd_tmpfiles_t:s0 tclass=process permissive=0


Hash: systemd-tmpfile,systemd_tmpfiles_t,systemd_tmpfiles_t,process,setrlimit

Version-Release number of selected component:
selinux-policy-3.14.4-39.fc31.noarch

Additional info:
component:      selinux-policy
reporter:       libreport-2.10.1
hashmarkername: setroubleshoot
kernel:         5.3.7-301.fc31.x86_64
type:           libreport

Comment 1 Lukas Vrabec 2019-10-31 16:46:29 UTC
commit 40f6bccc38526717eb8ff2032d3c915bc77ad3d1 (HEAD -> rawhide)
Author: Lukas Vrabec <lvrabec>
Date:   Thu Oct 31 17:46:00 2019 +0100

    Allow systemd-tmpfiles processes to set rlimit information
    
    Resolves: rhbz#1767394

Comment 2 Zdenek Pytela 2019-11-06 08:25:08 UTC
*** Bug 1769160 has been marked as a duplicate of this bug. ***

Comment 4 Fedora Update System 2019-11-22 16:17:31 UTC
FEDORA-2019-fefda9dd5e has been submitted as an update to Fedora 31. https://bodhi.fedoraproject.org/updates/FEDORA-2019-fefda9dd5e

Comment 5 Fedora Update System 2019-11-23 02:39:17 UTC
selinux-policy-3.14.4-42.fc31 has been pushed to the Fedora 31 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-2019-fefda9dd5e

Comment 6 Fedora Update System 2019-12-06 18:02:38 UTC
FEDORA-2019-fefda9dd5e has been submitted as an update to Fedora 31. https://bodhi.fedoraproject.org/updates/FEDORA-2019-fefda9dd5e

Comment 7 Fedora Update System 2019-12-07 03:38:27 UTC
container-selinux-2.123.0-2.fc31, selinux-policy-3.14.4-43.fc31 has been pushed to the Fedora 31 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-2019-fefda9dd5e

Comment 8 Yannick Defais 2019-12-09 19:01:29 UTC
Hi,

Using selinux-policy-3.14.4-43.fc31 the issue is still here:

SELinux interdit à systemctl d'utiliser l'accès setrlimit sur un processus.

*****  Le greffon catchall (100. de confiance) suggère   *********************

Si vous pensez que systemctl devrait être autorisé à accéder setrlimit sur les processus étiquetés NetworkManager_t par défaut.
Alors vous devriez rapporter ceci en tant qu'anomalie.
Vous pouvez générer un module de stratégie local pour autoriser cet accès.
Faire
autoriser cet accès pour le moment en exécutant :
# ausearch -c "systemctl" --raw | audit2allow -M my-systemctl
# semodule -X 300 -i my-systemctl.pp

Informations complémentaires :
Contexte source               system_u:system_r:NetworkManager_t:s0
Contexte cible                system_u:system_r:NetworkManager_t:s0
Objets du contexte            Inconnu [ process ]
Source                        systemctl
Chemin de la source           systemctl
Port                          <Inconnu>
Hôte                          achille
Paquets RPM source            
Paquets RPM cible             
RPM de la statégie            selinux-policy-3.14.4-43.fc31.noarch
Selinux activé                True
Type de stratégie             targeted
Mode strict                   Enforcing
Nom de l'hôte                 achille
Plateforme                    Linux achille 5.3.14-300.fc31.x86_64 #1 SMP Mon
                              Dec 2 15:41:35 UTC 2019 x86_64 x86_64
Compteur d'alertes            624
Première alerte               2019-10-30 17:38:30 CET
Dernière alerte               2019-12-09 19:58:16 CET
ID local                      2648755a-1249-42c9-a186-0cbe3d5b1cf2

Messages d'audit bruts 
type=AVC msg=audit(1575917896.817:324): avc:  denied  { setrlimit } for  pid=8500 comm="systemctl" scontext=system_u:system_r:NetworkManager_t:s0 tcontext=system_u:system_r:NetworkManager_t:s0 tclass=process permissive=0


Hash: systemctl,NetworkManager_t,NetworkManager_t,process,setrlimit

Comment 9 Fedora Update System 2019-12-11 02:06:02 UTC
container-selinux-2.123.0-2.fc31, selinux-policy-3.14.4-43.fc31 has been pushed to the Fedora 31 stable repository. If problems still persist, please make note of it in this bug report.

Comment 10 Yannick Defais 2019-12-12 18:42:03 UTC
As of comment #8 the problem still persist. selinux-policy-3.14.4-43.fc31 was tested and failed to fix this issue.
Please re-open this bug.

Comment 11 Zdenek Pytela 2019-12-20 15:08:34 UTC
Yannick,

The bugzilla was reported for systemd-tmpfiles and as such resolved. If you happen to see a similar denial for a different domain, please create a new bug and include reproducing steps, e. g. how NetworkManager configuration changed.