Note: This is a public test instance of Red Hat Bugzilla. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback at bugzilla.redhat.com.
Bug 1629341
Summary: | selinux policy prevents running logrotate from a systemd timer | ||||||
---|---|---|---|---|---|---|---|
Product: | [Fedora] Fedora | Reporter: | Jason Tibbitts <j> | ||||
Component: | selinux-policy | Assignee: | Lukas Vrabec <lvrabec> | ||||
Status: | CLOSED ERRATA | QA Contact: | Fedora Extras Quality Assurance <extras-qa> | ||||
Severity: | unspecified | Docs Contact: | |||||
Priority: | unspecified | ||||||
Version: | 28 | CC: | dwalsh, lvrabec, mgrepl, plautrba | ||||
Target Milestone: | --- | ||||||
Target Release: | --- | ||||||
Hardware: | Unspecified | ||||||
OS: | Unspecified | ||||||
Whiteboard: | |||||||
Fixed In Version: | selinux-policy-3.14.1-44.fc28 | Doc Type: | If docs needed, set a value | ||||
Doc Text: | Story Points: | --- | |||||
Clone Of: | Environment: | ||||||
Last Closed: | 2018-10-09 03:09:25 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: | |||||||
Attachments: |
|
For reference: F28: https://github.com/fedora-selinux/selinux-policy-contrib/commit/088cd5a674dd672fa9c1cf4122d86be2881d4e68 Rawhide: https://github.com/fedora-selinux/selinux-policy-contrib/commit/bb3f48189b9709954639ebc889815da815ce2978 (There is no F29 branch for that repository). selinux-policy-3.14.1-44.fc28 has been submitted as an update to Fedora 28. https://bodhi.fedoraproject.org/updates/FEDORA-2018-5e18426088 selinux-policy-3.14.1-44.fc28 has been pushed to the Fedora 28 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-2018-5e18426088 selinux-policy-3.14.1-44.fc28 has been pushed to the Fedora 28 stable repository. If problems still persist, please make note of it in this bug report. |
Created attachment 1483422 [details] Full set of AVCs in permissive mode Currently in Fedora, logrotate is set up to be run from cron.daily, while some distros (Arch is one example) run it from a systemd timer. One thing which prevents this from being fixed is selinux; the Fedora policy prevents systemd from spawning logrotate. I installed logrotate and dropped in the following two units: ==> /etc/systemd/system/logrotate.service <== [Unit] Description=Run logrotate Documentation=man:logrotate [Service] Type=oneshot ExecStart=/usr/sbin/logrotate --verbose /etc/logrotate.conf [Install] WantedBy=multi-user.target ==> /etc/systemd/system/logrotate.timer <== [Unit] Description=Rotate logs daily Documentation=man:logrotate [Timer] #OnCalendar=04:00 OnCalendar=minutely Unit=logrotate.service [Install] WantedBy=multi-user.target After starting the timer and waiting a minute, I got the following: time->Fri Sep 14 19:31:09 2018 type=AVC msg=audit(1536971469.330:21286): avc: denied { execute } for pid=7116 comm="(ogrotate)" name="logrotate" dev="dm-0" ino=2302422 scontext=system_u:system_r:init_t:s0 tcontext=system_u:object_r:logrotate_exec_t:s0 tclass=file permissive=0 (I've no idea why the 'l' is missing from the "comm" field.) Enabling permissive mode gives a load of output, which is probably completely dependent on system configuration. I'll attach it. Working from info from grift on IRC, I built and installed the following policy module: policy_module(logrotate_systemd,1.0,0) gen_require(` type logrotate_t, logrotate_exec_t; ') init_daemon_domain(logrotate_t, logrotate_exec_t) Afterwards all logrotate functionality appeared to work as normal. I guess selinux knows how to transition from cron to logrotate, but not systemd directly. To be honest, I'd think that everything which the current policy allows to be called from cron should also be allowed from systemd so that the conversion from cron can finally be finished. In any case, I am working with F28 but looking at the policy source I think this would also be an issue with F29 and rawhide.