Bug 1423361

Summary: /bin/bash: /etc/cron.hourly/man-db.cron: Permission denied
Product: Red Hat Enterprise Linux 7 Reporter: Karl Latiss <karl+rhbugzilla>
Component: selinux-policyAssignee: Lukas Vrabec <lvrabec>
Status: CLOSED ERRATA QA Contact: Milos Malik <mmalik>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 7.5-AltCC: lvrabec, mgrepl, mmalik, plautrba, pvrabec, ssekidde
Target Milestone: rc   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: selinux-policy-3.13.1-203.el7 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-10-30 10:00:04 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 Karl Latiss 2017-02-17 05:59:14 UTC
Description of problem:
man-db.cron fails to to run with selinux set to enforcing and CIS hardening applied

Version-Release number of selected component (if applicable):
$ rpm -qa | egrep '(selinux|cron)'
cronie-anacron-1.4.11-14.el7_2.1.x86_64
cronie-1.4.11-14.el7_2.1.x86_64
libselinux-utils-2.5-6.el7.x86_64
selinux-policy-3.13.1-102.el7_3.7.noarch
selinux-policy-targeted-3.13.1-102.el7_3.7.noarch
libselinux-2.5-6.el7.x86_64
libselinux-python-2.5-6.el7.x86_64
crontabs-1.11-6.20121102git.el7.noarch


How reproducible:
Always

Steps to Reproduce:
1. Apply CIS hardening rules (specifically around /etc/cron.* directory permissions)
2.Wait for cron to run
3.

Actual results:
Email stating

/bin/bash: /etc/cron.hourly/man-db.cron: Permission denied

Expected results:
man-db.cron runs without output

Additional info:

node=ip-172-33-0-107.eu-west-1.compute.internal type=PATH msg=audit(17/02/17 03:29:01.403:1958) : item=0 name=/etc/cron.daily/man-db.cron objtype=UNKNOWN 
node=ip-172-33-0-107.eu-west-1.compute.internal type=CWD msg=audit(17/02/17 03:29:01.403:1958) :  cwd=/ 
node=ip-172-33-0-107.eu-west-1.compute.internal type=SYSCALL msg=audit(17/02/17 03:29:01.403:1958) : arch=x86_64 syscall=open success=no exit=EACCES(Permission denied) a0=0x254a1a0 a1=O_RDONLY a2=0x6e6f72 a3=0x3 items=1 ppid=18338 pid=18348 auid=root uid=root gid=root euid=root suid=root fsuid=root egid=root sgid=root fsgid=root tty=(none) ses=36 comm=man-db.cron exe=/usr/bin/bash subj=system_u:system_r:mandb_t:s0-s0:c0.c1023 key=(null) 
node=ip-172-33-0-107.eu-west-1.compute.internal type=AVC msg=audit(17/02/17 03:29:01.403:1958) : avc:  denied  { dac_read_search } for  pid=18348 comm=man-db.cron capability=dac_read_search  scontext=system_u:system_r:mandb_t:s0-s0:c0.c1023 tcontext=system_u:system_r:mandb_t:s0-s0:c0.c1023 tclass=capability 
node=ip-172-33-0-107.eu-west-1.compute.internal type=AVC msg=audit(17/02/17 03:29:01.403:1958) : avc:  denied  { dac_override } for  pid=18348 comm=man-db.cron capability=dac_override  scontext=system_u:system_r:mandb_t:s0-s0:c0.c1023 tcontext=system_u:system_r:mandb_t:s0-s0:c0.c1023 tclass=capability 


NOTE: Applying 

$ sudo chcon system_u:object_r:bin_t:s0 /etc/cron.hourly/man-db.cron

as per the other entries in /etc/cron.hourly seems to fix this for me.

Comment 7 errata-xmlrpc 2018-10-30 10:00:04 UTC
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:3111