Bug 2025925

Summary: Confined sysadm users cannot execute Pacemaker commands
Product: Red Hat Enterprise Linux 8 Reporter: Renaud Métrich <rmetrich>
Component: selinux-policyAssignee: Zdenek Pytela <zpytela>
Status: CLOSED DUPLICATE QA Contact: Milos Malik <mmalik>
Severity: medium Docs Contact:
Priority: medium    
Version: 8.5CC: lvrabec, mmalik, ssekidde
Target Milestone: rcKeywords: Triaged
Target Release: 8.6Flags: pm-rhel: mirror+
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: No Doc Update
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2021-12-21 18:35:14 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:
Bug Depends On:    
Bug Blocks: 1778780    

Description Renaud Métrich 2021-11-23 12:12:15 UTC
Description of problem:

When a user is confined to *sysadm_u* and tries, after sudoing, to execute various Pacemaker commands, they fail or show nothing, e.g.:
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------
# id -Z
sysadm_u:sysadm_r:sysadm_t:s0-s0:c0.c1023

# pcs stonith status
Error: unable to get cluster status from crm_mon
crm_mon: Error: cluster is not available on this node

# crm_mon
Waiting until cluster is available on this node ...
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------

The root cause is *sysadm_t* is not able to connect to the Unix socket hold by *cluster_t* (Pacemaker daemons):
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------
type=PROCTITLE msg=audit(11/23/2021 13:09:29.151:4608) : proctitle=crm_mon 
type=SYSCALL msg=audit(11/23/2021 13:09:29.151:4608) : arch=x86_64 syscall=connect success=no exit=EACCES(Permission denied) a0=0x3 a1=0x7ffea4eaef30 a2=0x6e a3=0x0 items=0 ppid=29071 pid=29110 auid=sysadm uid=root gid=root euid=root suid=root fsuid=root egid=root sgid=root fsgid=root tty=pts3 ses=41 comm=crm_mon exe=/usr/sbin/crm_mon subj=sysadm_u:sysadm_r:sysadm_t:s0-s0:c0.c1023 key=(null) 
type=AVC msg=audit(11/23/2021 13:09:29.151:4608) : avc:  denied  { connectto } for  pid=29110 comm=crm_mon path=pacemakerd scontext=sysadm_u:sysadm_r:sysadm_t:s0-s0:c0.c1023 tcontext=system_u:system_r:cluster_t:s0 tclass=unix_stream_socket permissive=0 
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------

The fix is to let it connect to the socket:
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------
# cat local_pacemaker_sysadm.cil 
(allow sysadm_t cluster_t (unix_stream_socket (connectto)))
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------

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

selinux-policy-3.14.3-80.el8.noarch


How reproducible:

Always

Comment 1 Zdenek Pytela 2021-12-21 18:35:14 UTC
rhel8# rpm -q selinux-policy
selinux-policy-3.14.3-85.el8.noarch
rhel8# sesearch -A -s sysadm_t -t cluster_t -c unix_stream_socket -p connectto
allow sysadm_t cluster_domain:unix_stream_socket connectto;

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