Bug 809746

Summary: SELinux prevents heartbeat service from starting
Product: Red Hat Enterprise Linux 6 Reporter: Milos Malik <mmalik>
Component: selinux-policyAssignee: Miroslav Grepl <mgrepl>
Status: CLOSED ERRATA QA Contact: Milos Malik <mmalik>
Severity: medium Docs Contact:
Priority: high    
Version: 6.3CC: dwalsh
Target Milestone: rc   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: selinux-policy-3.7.19-151.el6 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-06-20 12:33:16 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:
Attachments:
Description Flags
heartbeat AVCs in permissive none

Description Milos Malik 2012-04-04 09:20:45 UTC
Description of problem:


Version-Release number of selected component (if applicable):
selinux-policy-doc-3.7.19-143.el6.noarch
selinux-policy-3.7.19-143.el6.noarch
selinux-policy-mls-3.7.19-143.el6.noarch
selinux-policy-minimum-3.7.19-143.el6.noarch
selinux-policy-targeted-3.7.19-143.el6.noarch
heartbeat-libs-3.0.4-1.el6.x86_64
heartbeat-3.0.4-1.el6.x86_64
clusterlib-3.1.3-1.el6.x86_64
cluster-glue-1.0.5-6.el6.x86_64
cluster-snmp-0.16.2-18.el6.x86_64
cluster-glue-libs-1.0.5-6.el6.x86_64

How reproducible:
always

Steps to Reproduce:
# yum -y -q install heartbeat cluster-glue
# cp /usr/share/doc/heartbeat-3.0.4/ha.cf /etc/ha.d/
# run_init service heartbeat start
Authenticating root.
Password: 
Starting High-Availability services:  Heartbeat failure [rc=1]. Failed.

heartbeat[24076]: 2012/04/04_11:14:22 WARN: glib: lt_dlopen() failure on plugin InterfaceMgr/generic [/usr/lib64/heartbeat/plugins/InterfaceMgr/generic.so]. Reason: [file not found]
heartbeat[24076]: 2012/04/04_11:14:22 ERROR: ERROR: cannot load generic interface manager plugin [InterfaceMgr/generic]: No such plugin/interface/interface type
heartbeat[24076]: 2012/04/04_11:14:22 ERROR: Heartbeat not started: module init error.
# ausearch -m avc -m user_avc -m selinux_err -ts recent

Actual results:
----
time->Wed Apr  4 11:14:17 2012
type=SYSCALL msg=audit(1333530857.588:2601): arch=c000003e syscall=9 success=no exit=-13 a0=0 a1=202370 a2=5 a3=802 items=0 ppid=24015 pid=24022 auid=0 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=pts0 ses=147 comm="heartbeat" exe="/usr/lib64/heartbeat/heartbeat" subj=system_u:system_r:corosync_t:s0 key=(null)
type=AVC msg=audit(1333530857.588:2601): avc:  denied  { execute } for  pid=24022 comm="heartbeat" path="/usr/lib64/heartbeat/plugins/InterfaceMgr/generic.so" dev=sda3 ino=6425707 scontext=system_u:system_r:corosync_t:s0 tcontext=system_u:object_r:corosync_var_lib_t:s0 tclass=file
----

Expected results:
* no AVCs

Comment 2 Milos Malik 2012-04-04 09:30:00 UTC
Following AVCs appeared in permissive mode after "run_init service heartbeat status":
----
time->Wed Apr  4 11:26:06 2012
type=SYSCALL msg=audit(1333531566.913:2617): arch=c000003e syscall=9 success=yes exit=140055973367808 a0=0 a1=202370 a2=5 a3=802 items=0 ppid=24190 pid=24197 auid=0 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=pts0 ses=147 comm="heartbeat" exe="/usr/lib64/heartbeat/heartbeat" subj=system_u:system_r:corosync_t:s0 key=(null)
type=AVC msg=audit(1333531566.913:2617): avc:  denied  { execute } for  pid=24197 comm="heartbeat" path="/usr/lib64/heartbeat/plugins/InterfaceMgr/generic.so" dev=sda3 ino=6431361 scontext=system_u:system_r:corosync_t:s0 tcontext=system_u:object_r:corosync_var_lib_t:s0 tclass=file
----
time->Wed Apr  4 11:26:06 2012
type=SYSCALL msg=audit(1333531566.913:2618): arch=c000003e syscall=29 success=yes exit=1114117 a0=0 a1=1460 a2=180 a3=7fff3478ccd0 items=0 ppid=24190 pid=24197 auid=0 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=pts0 ses=147 comm="heartbeat" exe="/usr/lib64/heartbeat/heartbeat" subj=system_u:system_r:corosync_t:s0 key=(null)
type=AVC msg=audit(1333531566.913:2618): avc:  denied  { create } for  pid=24197 comm="heartbeat" key=0  scontext=system_u:system_r:corosync_t:s0 tcontext=system_u:system_r:corosync_t:s0 tclass=shm
----
time->Wed Apr  4 11:26:06 2012
type=SYSCALL msg=audit(1333531566.913:2619): arch=c000003e syscall=30 success=yes exit=140056016449536 a0=110005 a1=0 a2=0 a3=7fff3478ccd0 items=0 ppid=24190 pid=24197 auid=0 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=pts0 ses=147 comm="heartbeat" exe="/usr/lib64/heartbeat/heartbeat" subj=system_u:system_r:corosync_t:s0 key=(null)
type=AVC msg=audit(1333531566.913:2619): avc:  denied  { read write } for  pid=24197 comm="heartbeat" key=0  scontext=system_u:system_r:corosync_t:s0 tcontext=system_u:system_r:corosync_t:s0 tclass=shm
type=AVC msg=audit(1333531566.913:2619): avc:  denied  { unix_read unix_write } for  pid=24197 comm="heartbeat" key=0  scontext=system_u:system_r:corosync_t:s0 tcontext=system_u:system_r:corosync_t:s0 tclass=shm
----
time->Wed Apr  4 11:26:06 2012
type=SYSCALL msg=audit(1333531566.913:2620): arch=c000003e syscall=31 success=yes exit=0 a0=110005 a1=0 a2=0 a3=7fff3478ccd0 items=0 ppid=24190 pid=24197 auid=0 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=pts0 ses=147 comm="heartbeat" exe="/usr/lib64/heartbeat/heartbeat" subj=system_u:system_r:corosync_t:s0 key=(null)
type=AVC msg=audit(1333531566.913:2620): avc:  denied  { destroy } for  pid=24197 comm="heartbeat" key=0  scontext=system_u:system_r:corosync_t:s0 tcontext=system_u:system_r:corosync_t:s0 tclass=shm
----

Comment 3 Milos Malik 2012-04-04 09:41:10 UTC
Following AVCs appeared in permissive mode after "run_init service heartbeat start":
----
time->Wed Apr  4 11:29:27 2012
type=SYSCALL msg=audit(1333531767.827:2631): arch=c000003e syscall=2 success=yes exit=3 a0=7f40e62c7477 a1=0 a2=4 a3=7fff72fcf530 items=0 ppid=24482 pid=24483 auid=0 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=pts0 ses=147 comm="heartbeat" exe="/usr/lib64/heartbeat/heartbeat" subj=system_u:system_r:corosync_t:s0 key=(null)
type=AVC msg=audit(1333531767.827:2631): avc:  denied  { read } for  pid=24483 comm="heartbeat" scontext=system_u:system_r:corosync_t:s0 tcontext=system_u:object_r:sysctl_kernel_t:s0 tclass=file
type=AVC msg=audit(1333531767.827:2631): avc:  denied  { search } for  pid=24483 comm="heartbeat" scontext=system_u:system_r:corosync_t:s0 tcontext=system_u:object_r:sysctl_kernel_t:s0 tclass=dir
----

Comment 4 Miroslav Grepl 2012-04-04 11:46:08 UTC
Yes, we now treat this policy with corosync. I need to fix these.

Comment 5 Milos Malik 2012-04-04 12:53:29 UTC
Created attachment 575120 [details]
heartbeat AVCs in permissive

All these AVCs appeared in permissive mode when the automated test was running.

Comment 6 Miroslav Grepl 2012-04-05 15:02:48 UTC
Adde to Fedora. Backporting to RHEL6.3

Comment 8 Miroslav Grepl 2012-04-06 12:45:58 UTC
What is a patch to "ha-log"?

Try again with fifo_files. It should be ok.

Comment 13 Daniel Walsh 2012-04-10 18:57:37 UTC
We have 

/var/run/hearbeat(/.*)?             gen_context(system_u:object_r:corosync_var_run_t,s0)

So I guess we should have

/var/lib/heartbeat(/.*)?			gen_context(system_u:object_r:corosync_var_lib_t,s0)

Comment 14 Daniel Walsh 2012-04-10 18:59:16 UTC
I believe 5b32d445af1d3d1efe5bec8bf8129320ef330a50 fixes this problem.

Comment 27 errata-xmlrpc 2012-06-20 12:33:16 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.

http://rhn.redhat.com/errata/RHBA-2012-0780.html