Bug 1047164

Summary: cobbler should be allowed to restart services
Product: [Fedora] Fedora Reporter: Pete Travis <me>
Component: selinux-policy-targetedAssignee: Miroslav Grepl <mgrepl>
Status: CLOSED ERRATA QA Contact: Ben Levenson <benl>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 20CC: dwalsh
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: selinux-policy-3.12.1-116.fc20 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-01-16 07:08:45 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 Pete Travis 2013-12-29 17:25:25 UTC
Cobbler has modules to manage multiple services, such as bind and dhcpd. When updating these configurations, cobbler wants to courteously restart/reload the services to activate the changes. SELinux policy should allow this - or at the least, can you suggest improvements for cobbler?

Specifically, audit2allow says that a `cobbler sync` operation, with cobbler configured to manage dhcpd and named, requires:

    allow cobblerd_t systemd_systemctl_exec_t:file execute;
    allow cobblerd_t systemd_systemctl_exec_t:file { read open }
    allow cobblerd_t systemd_systemctl_exec_t:file execute_no_trans;
    allow cobblerd_t init_t:unix_stream_socket connectto;
    allow cobblerd_t systemd_unit_file_t:service start
    allow cobblerd_t systemd_unit_file_t:service status
    allow cobblerd_t named_unit_file_t:service start
    allow cobblerd_t named_unit_file_t:service status

There are modules to manage others, but for now I'm limiting the report to those I've tested.

Comment 1 Daniel Walsh 2014-01-03 18:34:42 UTC
I have added the ability to restart dnsmasq, named, and dhcpcd

Are there any others?  What AVC caused you to add 

    allow cobblerd_t systemd_unit_file_t:service start
    allow cobblerd_t systemd_unit_file_t:service status

Comment 2 Daniel Walsh 2014-01-03 18:35:31 UTC
5644e27aba3fdb51f1c27ac927df3979cfd4df6d has fixes in git.

Comment 3 Pete Travis 2014-01-05 20:48:17 UTC
(In reply to Daniel Walsh from comment #1)
> I have added the ability to restart dnsmasq, named, and dhcpcd
> 
> Are there any others?  

tftpd, though there were no related AVCs. At least not after applying the blanket service start/stop policy...

There's also somewhat experimental support for storage backends using CouchDB, MongoDB, MySQL, and presumably MariaDB. Refer to http://www.cobblerd.org/manuals/2.4.0/5/18_-_Alternative_Storage_Backends.html

>  What AVC caused you to add 
> 
>     allow cobblerd_t systemd_unit_file_t:service start

# grep 1388293012.222:2215 /var/log/audit/audit.log 
type=USER_AVC msg=audit(1388293012.222:2215): pid=1 uid=0 auid=4294967295 ses=4294967295  subj=system_u:system_r:init_t:s0 msg='avc:  denied  { start } for auid=-1 uid=0 gid=0 path="/usr/lib/systemd/system/dhcpd.service" scontext=system_u:system_r:cobblerd_t:s0 tcontext=system_u:object_r:systemd_unit_file_t:s0 tclass=service  exe="/usr/lib/systemd/systemd" sauid=0 hostname=? addr=? terminal=?'

>     allow cobblerd_t systemd_unit_file_t:service status

# grep 1388293092.972:2220 /var/log/audit/audit.log 
type=USER_AVC msg=audit(1388293092.972:2220): pid=1 uid=0 auid=4294967295 ses=4294967295  subj=system_u:system_r:init_t:s0 msg='avc:  denied  { status } for auid=-1 uid=0 gid=0 path="/usr/lib/systemd/system/dhcpd.service" scontext=system_u:system_r:cobblerd_t:s0 tcontext=system_u:object_r:systemd_unit_file_t:s0 tclass=service  exe="/usr/lib/systemd/systemd" sauid=0 hostname=? addr=? terminal=?'


A policy targeted to dhcpd would remedy this as well, of course - I assumed that there wasn't a dedicated type for dhcpd as there was for named, but the reality is probably just sloppy custom policy application.

Comment 4 Miroslav Grepl 2014-01-06 08:58:45 UTC
commit 6d3d5e6c2ce71116f43af030302cd1967b9576f6
Author: Miroslav Grepl <mgrepl>
Date:   Mon Jan 6 09:58:02 2014 +0100

    Add support for /usr/lib/systemd/system/dhcpd.service

Comment 5 Fedora Update System 2014-01-13 22:54:35 UTC
selinux-policy-3.12.1-116.fc20 has been submitted as an update for Fedora 20.
https://admin.fedoraproject.org/updates/selinux-policy-3.12.1-116.fc20

Comment 6 Fedora Update System 2014-01-15 05:56:14 UTC
Package selinux-policy-3.12.1-116.fc20:
* should fix your issue,
* was pushed to the Fedora 20 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing selinux-policy-3.12.1-116.fc20'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2014-0806/selinux-policy-3.12.1-116.fc20
then log in and leave karma (feedback).

Comment 7 Fedora Update System 2014-01-16 07:08:45 UTC
selinux-policy-3.12.1-116.fc20 has been pushed to the Fedora 20 stable repository.  If problems still persist, please make note of it in this bug report.