Bug 1551568

Summary: Cannot execute mdadm when policy is MLS
Product: Red Hat Enterprise Linux 7 Reporter: Renaud Métrich <rmetrich>
Component: selinux-policyAssignee: Lukas Vrabec <lvrabec>
Status: CLOSED ERRATA QA Contact: Milos Malik <mmalik>
Severity: medium Docs Contact:
Priority: medium    
Version: 7.6CC: lvrabec, mgrepl, mmalik, plautrba, ssekidde
Target Milestone: rc   
Target Release: ---   
Hardware: All   
OS: Linux   
Fixed In Version: selinux-policy-3.13.1-197.el7 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 1551569 (view as bug list) Environment:
Last Closed: 2018-10-30 10:03:08 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:
Bug Depends On:    
Bug Blocks: 1551569    

Description Renaud Métrich 2018-03-05 12:30:23 UTC
Description of problem:

Upon switching to MLS policy, the sysadm_r user (e.g. root) cannot execute mdadm, getting the following error:

type=SYSCALL msg=audit(): arch=c000003e syscall=59 success=no exit=-13 a0=1fff930 a1=1ffbee0 a2=2006110 a3=7ffd72116750 items=0 ppid=2877 pid=2893 auid=0 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=tty2 ses=2 comm="bash" exe="/bin/bash" subj=root:sysadm_r:sysadm_t:s0-s15:c0.c1023 key=(null)
type=SELINUX_ERR msg=audit(): op=security_compute_sid invalid_context=root:sysadm_r:mdadm_t:s0-s15:c0.c1023 scontext=root:sysadm_r:sysadm_t:s0-s15:c0.c1023 tcontext=system_u:object_r:mdadm_exec_t:s0 tclass=process

lvrabec++ found root cause, fixed in Fedora: https://github.com/fedora-selinux/selinux-policy/commit/579d1bc8124a2a908d071105458a6f0f4f60e423

Version-Release number of selected component (if applicable):


How reproducible:


Steps to Reproduce:
1. Execute "mdadm" as root user while in MLS enforcing

Actual results:

-bash: /usr/sbin/mdadm: Permission denied

Expected results:


Comment 3 Milos Malik 2018-09-17 16:09:44 UTC
# id -Z
# sestatus 
SELinux status:                 enabled
SELinuxfs mount:                /sys/fs/selinux
SELinux root directory:         /etc/selinux
Loaded policy name:             mls
Current mode:                   enforcing
Mode from config file:          enforcing
Policy MLS status:              enabled
Policy deny_unknown status:     denied
Max kernel policy version:      31
# mdadm /dev/vda
/dev/vda: is not an md array
# mdadm
Usage: mdadm --help
  for help

Unfortunately, if the daemons_use_tty boolean is disabled, then mdadm is completely silent:

# setsebool daemons_use_tty off
# mdadm 
# mdadm --help
# mdadm /dev/vda

Either the need to use the boolean is documented or policy needs to be improved.

# rpm -qa selinux\*

Comment 5 errata-xmlrpc 2018-10-30 10:03:08 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.