Bug 1412727

Summary: USER_AVC when enabling/disabling a non-existent service
Product: Red Hat Enterprise Linux 7 Reporter: Frantisek Sumsal <fsumsal>
Component: selinux-policyAssignee: Lukas Vrabec <lvrabec>
Status: CLOSED DUPLICATE QA Contact: BaseOS QE Security Team <qe-baseos-security>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 7.3CC: lvrabec, mgrepl, mmalik, plautrba, pvrabec, ssekidde
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-01-12 16:28:51 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 Frantisek Sumsal 2017-01-12 16:07:42 UTC
Description of problem:
Enabling/disabling a non-existent service causes "Failed to execute operation: Access denied" error being thrown along with a USER_AVC. This is a possible regression, see BZ#1154065.

Version-Release number of selected component (if applicable):
systemd-219-30.el7.x86_64
selinux-policy-3.13.1-108.el7.noarch

How reproducible:
always

Steps to Reproduce:
# systemctl status definitely-a-non-existent-service.service
Unit definitely-a-non-existent-service.service could not be found.
# systemctl enable definitely-a-non-existent-service.service
Failed to execute operation: Access denied
# systemctl disable definitely-a-non-existent-service.service
Failed to execute operation: Access denied
# ausearch -m USER_AVC -i
----
type=USER_AVC msg=audit(01/12/2017 11:02:53.361:307) : pid=1 uid=root auid=unset ses=unset subj=system_u:system_r:init_t:s0 msg='avc:  denied  { enable } for auid=root uid=root gid=root cmdline="systemctl enable definitely-a-non-existent-service.service" scontext=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 tcontext=system_u:system_r:init_t:s0 tclass=service  exe=/usr/lib/systemd/systemd sauid=root hostname=? addr=? terminal=?' 
----
type=USER_AVC msg=audit(01/12/2017 11:02:55.839:308) : pid=1 uid=root auid=unset ses=unset subj=system_u:system_r:init_t:s0 msg='avc:  denied  { disable } for auid=root uid=root gid=root cmdline="systemctl disable definitely-a-non-existent-service.service" scontext=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 tcontext=system_u:system_r:init_t:s0 tclass=service  exe=/usr/lib/systemd/systemd sauid=root hostname=? addr=? terminal=?'

Expected results:
# setenforce 0
# systemctl enable definitely-a-non-existent-service.service
Failed to execute operation: No such file or directory
# systemctl disable definitely-a-non-existent-service.service
Failed to execute operation: No such file or directory

Comment 1 Milos Malik 2017-01-12 16:23:47 UTC
I believe this bug is duplicate of BZ#1337041.

Comment 2 Milos Malik 2017-01-12 16:25:40 UTC
Please see comment#6 in BZ#1337041.

Comment 3 Frantisek Sumsal 2017-01-12 16:28:51 UTC
Thank you, Milos, it's indeed the exactly same problem.

*** This bug has been marked as a duplicate of bug 1337041 ***