Bugzilla will be upgraded to version 5.0. The upgrade date is tentatively scheduled for 2 December 2018, pending final testing and feedback.
Bug 1376893 - the puppetmaster service does not start because of SELinux
the puppetmaster service does not start because of SELinux
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: selinux-policy (Show other bugs)
7.3
All Linux
medium Severity medium
: rc
: ---
Assigned To: Lukas Vrabec
Milos Malik
: Reopened
: 1410199 (view as bug list)
Depends On:
Blocks: 1393066
  Show dependency treegraph
 
Reported: 2016-09-16 14:55 EDT by Milos Malik
Modified: 2018-04-10 08:25 EDT (History)
10 users (show)

See Also:
Fixed In Version: selinux-policy-3.13.1-187.el7
Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2018-04-10 08:24:04 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)


External Trackers
Tracker ID Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2018:0763 None None None 2018-04-10 08:25 EDT

  None (edit)
Description Milos Malik 2016-09-16 14:55:10 EDT
Description of problem:

Version-Release number of selected component (if applicable):
puppet-3.6.2-3.el7.noarch
puppet-server-3.6.2-3.el7.noarch
selinux-policy-3.13.1-97.el7.noarch
selinux-policy-targeted-3.13.1-97.el7.noarch

How reproducible:
* always

Steps to Reproduce:
1. get a RHEL-7.3 machine with active targeted policy
2. install puppet* packages from EPEL
3. service puppetmaster start

Actual results (enforcing mode):
----
time->Fri Sep 16 14:46:42 2016
type=PATH msg=audit(1474051602.270:315): item=0 name="/usr/bin/puppet" inode=20230 dev=fd:01 mode=0100755 ouid=0 ogid=0 rdev=00:00 obj=system_u:object_r:puppetagent_exec_t:s0 objtype=NORMAL
type=CWD msg=audit(1474051602.270:315):  cwd="/"
type=SYSCALL msg=audit(1474051602.270:315): arch=c000003e syscall=59 success=no exit=-13 a0=df70b0 a1=df5ff0 a2=df5b00 a3=7ffc2b718420 items=1 ppid=30588 pid=30591 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=4294967295 comm="start-puppet-ma" exe="/usr/bin/bash" subj=system_u:system_r:puppetmaster_t:s0 key=(null)
type=AVC msg=audit(1474051602.270:315): avc:  denied  { execute } for  pid=30591 comm="start-puppet-ma" name="puppet" dev="dm-1" ino=20230 scontext=system_u:system_r:puppetmaster_t:s0 tcontext=system_u:object_r:puppetagent_exec_t:s0 tclass=file
----
time->Fri Sep 16 14:46:42 2016
type=PATH msg=audit(1474051602.270:316): item=0 name="/usr/bin/puppet" inode=20230 dev=fd:01 mode=0100755 ouid=0 ogid=0 rdev=00:00 obj=system_u:object_r:puppetagent_exec_t:s0 objtype=NORMAL
type=CWD msg=audit(1474051602.270:316):  cwd="/"
type=SYSCALL msg=audit(1474051602.270:316): arch=c000003e syscall=4 success=no exit=-13 a0=df70b0 a1=7ffc2b7185f0 a2=7ffc2b7185f0 a3=7ffc2b718370 items=1 ppid=30588 pid=30591 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=4294967295 comm="start-puppet-ma" exe="/usr/bin/bash" subj=system_u:system_r:puppetmaster_t:s0 key=(null)
type=AVC msg=audit(1474051602.270:316): avc:  denied  { getattr } for  pid=30591 comm="start-puppet-ma" path="/usr/bin/puppet" dev="dm-1" ino=20230 scontext=system_u:system_r:puppetmaster_t:s0 tcontext=system_u:object_r:puppetagent_exec_t:s0 tclass=file
----

Expected results:
* no SELinux denials
Comment 1 Milos Malik 2016-09-16 15:02:31 EDT
Actual results (permissive mode):
----
type=PATH msg=audit(09/16/2016 15:00:32.020:345) : item=2 name=/lib64/ld-linux-x86-64.so.2 inode=3575 dev=fd:01 mode=file,755 ouid=root ogid=root rdev=00:00 obj=system_u:object_r:ld_so_t:s0 objtype=NORMAL 
type=PATH msg=audit(09/16/2016 15:00:32.020:345) : item=1 name=/usr/bin/ruby inode=20103 dev=fd:01 mode=file,755 ouid=root ogid=root rdev=00:00 obj=system_u:object_r:bin_t:s0 objtype=NORMAL 
type=PATH msg=audit(09/16/2016 15:00:32.020:345) : item=0 name=/usr/bin/puppet inode=20230 dev=fd:01 mode=file,755 ouid=root ogid=root rdev=00:00 obj=system_u:object_r:puppetagent_exec_t:s0 objtype=NORMAL 
type=CWD msg=audit(09/16/2016 15:00:32.020:345) :  cwd=/ 
type=EXECVE msg=audit(09/16/2016 15:00:32.020:345) : argc=4 a0=/usr/bin/ruby a1=/usr/bin/puppet a2=master a3=--no-daemonize 
type=SYSCALL msg=audit(09/16/2016 15:00:32.020:345) : arch=x86_64 syscall=execve success=yes exit=0 a0=0x14880b0 a1=0x1486ff0 a2=0x1486b00 a3=0x7ffc74892700 items=3 ppid=1629 pid=1630 auid=unset uid=root gid=root euid=root suid=root fsuid=root egid=root sgid=root fsgid=root tty=(none) ses=unset comm=puppet exe=/usr/bin/ruby subj=system_u:system_r:puppetmaster_t:s0 key=(null) 
type=AVC msg=audit(09/16/2016 15:00:32.020:345) : avc:  denied  { execute_no_trans } for  pid=1630 comm=start-puppet-ma path=/usr/bin/puppet dev="dm-1" ino=20230 scontext=system_u:system_r:puppetmaster_t:s0 tcontext=system_u:object_r:puppetagent_exec_t:s0 tclass=file 
type=AVC msg=audit(09/16/2016 15:00:32.020:345) : avc:  denied  { read open } for  pid=1630 comm=start-puppet-ma path=/usr/bin/puppet dev="dm-1" ino=20230 scontext=system_u:system_r:puppetmaster_t:s0 tcontext=system_u:object_r:puppetagent_exec_t:s0 tclass=file 
type=AVC msg=audit(09/16/2016 15:00:32.020:345) : avc:  denied  { execute } for  pid=1630 comm=start-puppet-ma name=puppet dev="dm-1" ino=20230 scontext=system_u:system_r:puppetmaster_t:s0 tcontext=system_u:object_r:puppetagent_exec_t:s0 tclass=file 
----
type=SYSCALL msg=audit(09/16/2016 15:00:32.041:346) : arch=x86_64 syscall=fstat success=yes exit=0 a0=0x7 a1=0x7fff78865fc0 a2=0x7fff78865fc0 a3=0x7f04d375ed66 items=0 ppid=1629 pid=1630 auid=unset uid=root gid=root euid=root suid=root fsuid=root egid=root sgid=root fsgid=root tty=(none) ses=unset comm=puppet exe=/usr/bin/ruby subj=system_u:system_r:puppetmaster_t:s0 key=(null) 
type=AVC msg=audit(09/16/2016 15:00:32.041:346) : avc:  denied  { getattr } for  pid=1630 comm=puppet path=/usr/bin/puppet dev="dm-1" ino=20230 scontext=system_u:system_r:puppetmaster_t:s0 tcontext=system_u:object_r:puppetagent_exec_t:s0 tclass=file 
----
type=SYSCALL msg=audit(09/16/2016 15:00:32.041:347) : arch=x86_64 syscall=ioctl success=no exit=ENOTTY(Inappropriate ioctl for device) a0=0x7 a1=TCGETS a2=0x7fff78865fa0 a3=0xe items=0 ppid=1629 pid=1630 auid=unset uid=root gid=root euid=root suid=root fsuid=root egid=root sgid=root fsgid=root tty=(none) ses=unset comm=puppet exe=/usr/bin/ruby subj=system_u:system_r:puppetmaster_t:s0 key=(null) 
type=AVC msg=audit(09/16/2016 15:00:32.041:347) : avc:  denied  { ioctl } for  pid=1630 comm=puppet path=/usr/bin/puppet dev="dm-1" ino=20230 scontext=system_u:system_r:puppetmaster_t:s0 tcontext=system_u:object_r:puppetagent_exec_t:s0 tclass=file 
----
Comment 3 Lukas Vrabec 2017-01-05 05:55:37 EST
*** Bug 1410199 has been marked as a duplicate of this bug. ***
Comment 4 Edouard Bourguignon 2017-01-14 04:32:03 EST
Any news on this bug ?
Comment 6 Tim Landscheidt 2017-01-27 20:12:40 EST
This also happens on Fedora 25.  Should I file a separate bug for that?
Comment 7 Milos Malik 2017-01-28 10:57:22 EST
Yes, please.
Comment 8 Tim Landscheidt 2017-02-02 23:51:29 EST
(I have filed bug #1418902 for the same/a similar issue on Fedora 25.)
Comment 9 Stephen 2017-03-29 08:27:07 EDT
This had been doing my nut for a while! So I thought I would share.

I am using centos 7 but should work for other distros, I had to disable selinux - load puppetmaster - enable selinux just to get it to run.

My fix as a root user and selinux enabled was the following.

#Create some recent audit logs
systemctl start puppetmaster

#Check the audit logs
ausearch -m avc -ts recent


########LOG######### (One of many denied errors which included exec and getattr)

type=SYSCALL msg=audit(1490787585.076:4811): arch=c000003e syscall=4 success=no exit=-13 a0=1e0b090 a1=7ffc16cc73f0 a2=7ffc16cc73f0 a3=7ffc16cc7190 items=0 ppid=11712 pid=11713 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=4294967295 comm="start-puppet-ma" exe="/usr/bin/bash" subj=system_u:system_r:puppetmaster_t:s0 key=(null)
type=AVC msg=audit(1490787585.076:4811): avc:  denied  { getattr } for  pid=11713 comm="start-puppet-ma" path="/usr/bin/puppet" dev="dm-0" ino=1733641 scontext=system_u:system_r:puppetmaster_t:s0 tcontext=system_u:object_r:puppetagent_exec_t:s0 tclass=file

####################

#check the selinux context information on the file it's failing on. 
ls -Z /usr/bin/start-puppet-ma*

#output was.
-rwxr-xr-x. root root system_u:object_r:puppetmaster_exec_t:s0 /usr/bin/start-puppet-master

The service is trying to run as subj=system_u:system_r:puppetmaster_t:s0, the file has the same selinux user but it doesn't have the same role or type for the service to start.

so a quick fix was to change the file contexts to match what the service needed to run.

#Disable selinux to make changes.
setenforce 0

#Set the role
chcon -r system_r start-puppet-master

#Set the type
chcon -t puppetmaster_t start-puppet-master

#Enable selinux
setenforce 1

#Start/Restart the service
systemctl start puppetmaster



Hope this helps.
Comment 11 Lukas Vrabec 2017-10-12 08:19:47 EDT
We're going to close this bug as WONTFIX because

 * of limited capacity of selinux-policy developers
 * the bug is related to EPEL component or 3rd party SW only
 * the bug appears in unsupported configuration 

We believe this bug can be fixed via a local policy module.
For more information please see: 

 * https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/selinux_users_and_administrators_guide/sect-security-enhanced_linux-troubleshooting-fixing_problems#sect-Security-Enhanced_Linux-Fixing_Problems-Allowing_Access_audit2allow

If you disagree, please re-open the bug.
Comment 12 Lukas Vrabec 2017-10-12 08:21:38 EDT
We're going to close this bug as WONTFIX because

 * of limited capacity of selinux-policy developers
 * the bug is related to EPEL component or 3rd party SW only
 * the bug appears in unsupported configuration 

We believe this bug can be fixed via a local policy module.
For more information please see: 

 * https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/selinux_users_and_administrators_guide/sect-security-enhanced_linux-troubleshooting-fixing_problems#sect-Security-Enhanced_Linux-Fixing_Problems-Allowing_Access_audit2allow

If you disagree, please re-open the bug.
Comment 13 Milos Malik 2018-02-01 06:15:49 EST
Re-opening the bug because:
 * SELinux should not prevent the puppetmaster service from running in default configuration
 * puppet is part of various layered products sold to our customers
 * puppet is used internally by various teams
Comment 20 errata-xmlrpc 2018-04-10 08:24:04 EDT
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2018:0763

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