RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1239045 - Allow systemctl kill in nginx's logrotate snippet
Summary: Allow systemctl kill in nginx's logrotate snippet
Keywords:
Status: CLOSED WONTFIX
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: selinux-policy
Version: 7.1
Hardware: All
OS: Linux
low
low
Target Milestone: rc
: ---
Assignee: Lukas Vrabec
QA Contact: Milos Malik
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2015-07-03 11:03 UTC by Marcos Mello
Modified: 2016-07-18 11:57 UTC (History)
8 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2016-06-27 14:54:47 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description Marcos Mello 2015-07-03 11:03:34 UTC
nginx EPEL 7 logrotate snippet calls systemctl kill to signal the web server main process to reopen its logs. We see this now:

type=USER_AVC msg=audit(1435918621.481:550): pid=1 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:init_t:s0 msg='avc:  denied  { stop } for auid=0 uid=0 gid=0 path="/usr/lib/systemd/system/nginx.service" cmdline="/usr/bin/systemctl kill --signal=SIGUSR1 --kill-who=main nginx.service" scontext=system_u:system_r:logrotate_t:s0-s0:c0.c1023 tcontext=system_u:object_r:httpd_unit_file_t:s0 tclass=service  exe="/usr/lib/systemd/systemd" sauid=0 hostname=? addr=? terminal=?'

Relevant commit:

http://pkgs.fedoraproject.org/cgit/nginx.git/commit/?h=epel7&id=1f6028c976c75dbf3df69cc1a8b74eb0fbe0fcf4

But it is working so far despite the AVC. Anyway, selinux-policy should allow systemctl kill there.

Fedora's selinux-policy will need update too.

Comment 2 Marcos Mello 2015-07-03 13:29:22 UTC
Sorry, it does not work really. And probably any logrotate snippet using systemctl kill will suffer too.

Squid quick test (official package does not use systemctl kill):

type=USER_AVC msg=audit(1435574341.883:572): pid=1 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:init_t:s0 msg='avc:  denied  { stop } for auid=0 uid=0 gid=0 path="/usr/lib/systemd/system/squid.service" cmdline="/usr/bin/systemctl --kill-who=main --signal=SIGUSR1 kill squid.service" scontext=system_u:system_r:logrotate_t:s0-s0:c0.c1023 tcontext=system_u:object_r:systemd_unit_file_t:s0 tclass=service  exe="/usr/lib/systemd/systemd" sauid=0 hostname=? addr=? terminal=?'

Comment 3 Marcos Mello 2015-07-03 13:40:56 UTC
BTW, nginx maintainer reverted the change, but I still think this is a bug.

Comment 5 Lukas Vrabec 2016-06-22 15:53:08 UTC
What is state of this BZ? Could you reproduce it?

Comment 6 Lukas Vrabec 2016-06-27 14:54:47 UTC
Closing this issue as WONTFIX. If maintainer reverted this change, there is no needs to change selinux-policy.

Comment 7 Marcos Mello 2016-07-18 11:57:25 UTC
Yes, the maintainer has reverted it.

Between

kill -HUP $(cat /run/foobar.pid)

and

systemctl kill --kill-who=main --signal=SIGHUP foobar.service

systemd has the advantage as it already knows main service pid -- IOW it will work with daemons which do not use pid files at all. No cat or pgrep shell scripting needed.


Note You need to log in before you can comment on or make changes to this bug.