Bug 889120

Summary: AVC denials for sanlock and fence_sanlock
Product: Red Hat Enterprise Linux 6 Reporter: michal novacek <mnovacek>
Component: selinux-policyAssignee: Miroslav Grepl <mgrepl>
Status: CLOSED ERRATA QA Contact: Milos Malik <mmalik>
Severity: medium Docs Contact:
Priority: medium    
Version: 6.4CC: dwalsh, mmalik
Target Milestone: rcKeywords: FutureFeature
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: selinux-policy-3.7.19-223.el6 Doc Type: Enhancement
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-11-21 10:11:39 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
AVC denials log filtered
none
AVC denials log complete
none
/etc/cluster/cluster.conf
none
avc denials after proposed fix in comment #9 none

Description michal novacek 2012-12-20 09:32:04 UTC
Description of problem:
AVC denials.

Version-Release number of selected component (if applicable):
RHEL-6.4-candidate-20121217
selinux-policy-3.7.19-187.el6.noarch

Steps to Reproduce:
1) have two node cluster with both nodes in selinux permissive
2) yum -y install fence-sanlock sanlock sanlock-lib
3) change /etc/cluster/cluster.conf to the attached version and 
    "cman_tool version -r" to distribute to the other node
4) fence_sanlock -o sanlock_init -p /dev/vdb
5) chkconfig wdmd off
6) chkconfig sanlock off
7) chkconfig fence_sanlockd on
8) chkconfig cman on
9) reboot both nodes
10) collect denial messages

Comment 1 michal novacek 2012-12-20 09:32:48 UTC
Created attachment 666562 [details]
AVC denials log filtered

Comment 2 michal novacek 2012-12-20 09:33:25 UTC
Created attachment 666563 [details]
AVC denials log complete

Comment 4 michal novacek 2012-12-20 09:34:07 UTC
Created attachment 666564 [details]
/etc/cluster/cluster.conf

Comment 5 Milos Malik 2012-12-20 10:38:16 UTC
Following AVC appeared in enforcing mode:
----
time->Thu Dec 20 13:35:22 2012
type=PATH msg=audit(1356006922.828:3246): item=0 name="/usr/sbin/sanlock" inode=4207261 dev=08:03 mode=0100755 ouid=0 ogid=0 rdev=00:00 obj=system_u:object_r:sanlock_exec_t:s0
type=CWD msg=audit(1356006922.828:3246):  cwd="/"
type=SYSCALL msg=audit(1356006922.828:3246): arch=c000003e syscall=4 success=no exit=-13 a0=1ebcea0 a1=7fff5e819e60 a2=7fff5e819e60 a3=12 items=1 ppid=12921 pid=12922 auid=0 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=pts0 ses=450 comm="fence_sanlock" exe="/bin/bash" subj=unconfined_u:system_r:fenced_t:s0 key=(null)
type=AVC msg=audit(1356006922.828:3246): avc:  denied  { getattr } for  pid=12922 comm="fence_sanlock" path="/usr/sbin/sanlock" dev=sda3 ino=4207261 scontext=unconfined_u:system_r:fenced_t:s0 tcontext=system_u:object_r:sanlock_exec_t:s0 tclass=file
----

Comment 6 Milos Malik 2012-12-20 10:39:58 UTC
Following AVCs appeared in permissive mode:
----
time->Thu Dec 20 13:37:39 2012
type=PATH msg=audit(1356007059.975:3248): item=0 name="/usr/sbin/sanlock" inode=4207261 dev=08:03 mode=0100755 ouid=0 ogid=0 rdev=00:00 obj=system_u:object_r:sanlock_exec_t:s0
type=CWD msg=audit(1356007059.975:3248):  cwd="/"
type=SYSCALL msg=audit(1356007059.975:3248): arch=c000003e syscall=4 success=yes exit=0 a0=1254ea0 a1=7fffa18bdc50 a2=7fffa18bdc50 a3=12 items=1 ppid=13290 pid=13291 auid=0 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=pts0 ses=450 comm="fence_sanlock" exe="/bin/bash" subj=unconfined_u:system_r:fenced_t:s0 key=(null)
type=AVC msg=audit(1356007059.975:3248): avc:  denied  { getattr } for  pid=13291 comm="fence_sanlock" path="/usr/sbin/sanlock" dev=sda3 ino=4207261 scontext=unconfined_u:system_r:fenced_t:s0 tcontext=system_u:object_r:sanlock_exec_t:s0 tclass=file
----
time->Thu Dec 20 13:37:39 2012
type=PATH msg=audit(1356007059.975:3249): item=0 name="/usr/sbin/sanlock" inode=4207261 dev=08:03 mode=0100755 ouid=0 ogid=0 rdev=00:00 obj=system_u:object_r:sanlock_exec_t:s0
type=CWD msg=audit(1356007059.975:3249):  cwd="/"
type=SYSCALL msg=audit(1356007059.975:3249): arch=c000003e syscall=21 success=yes exit=0 a0=1254ea0 a1=1 a2=0 a3=7fffa18bd9d0 items=1 ppid=13290 pid=13291 auid=0 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=pts0 ses=450 comm="fence_sanlock" exe="/bin/bash" subj=unconfined_u:system_r:fenced_t:s0 key=(null)
type=AVC msg=audit(1356007059.975:3249): avc:  denied  { execute } for  pid=13291 comm="fence_sanlock" name="sanlock" dev=sda3 ino=4207261 scontext=unconfined_u:system_r:fenced_t:s0 tcontext=system_u:object_r:sanlock_exec_t:s0 tclass=file
----
time->Thu Dec 20 13:37:39 2012
type=PATH msg=audit(1356007059.975:3250): item=0 name="/usr/sbin/sanlock" inode=4207261 dev=08:03 mode=0100755 ouid=0 ogid=0 rdev=00:00 obj=system_u:object_r:sanlock_exec_t:s0
type=CWD msg=audit(1356007059.975:3250):  cwd="/"
type=SYSCALL msg=audit(1356007059.975:3250): arch=c000003e syscall=21 success=yes exit=0 a0=1254ea0 a1=4 a2=0 a3=7fffa18bd9d0 items=1 ppid=13290 pid=13291 auid=0 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=pts0 ses=450 comm="fence_sanlock" exe="/bin/bash" subj=unconfined_u:system_r:fenced_t:s0 key=(null)
type=AVC msg=audit(1356007059.975:3250): avc:  denied  { read } for  pid=13291 comm="fence_sanlock" name="sanlock" dev=sda3 ino=4207261 scontext=unconfined_u:system_r:fenced_t:s0 tcontext=system_u:object_r:sanlock_exec_t:s0 tclass=file
----
time->Thu Dec 20 13:37:39 2012
type=PATH msg=audit(1356007059.976:3251): item=1 name=(null) inode=6032943 dev=08:03 mode=0100755 ouid=0 ogid=0 rdev=00:00 obj=system_u:object_r:ld_so_t:s0
type=PATH msg=audit(1356007059.976:3251): item=0 name="/usr/sbin/sanlock" inode=4207261 dev=08:03 mode=0100755 ouid=0 ogid=0 rdev=00:00 obj=system_u:object_r:sanlock_exec_t:s0
type=CWD msg=audit(1356007059.976:3251):  cwd="/"
type=EXECVE msg=audit(1356007059.976:3251): argc=5 a0="sanlock" a1="direct" a2="read_leader" a3="-r" a4="fence:h1:/dev/vdb:1048576"
type=SYSCALL msg=audit(1356007059.976:3251): arch=c000003e syscall=59 success=yes exit=0 a0=1254ea0 a1=1270590 a2=12705d0 a3=7fffa18bdac0 items=2 ppid=13291 pid=13292 auid=0 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=pts0 ses=450 comm="sanlock" exe="/usr/sbin/sanlock" subj=unconfined_u:system_r:fenced_t:s0 key=(null)
type=AVC msg=audit(1356007059.976:3251): avc:  denied  { execute_no_trans } for  pid=13292 comm="fence_sanlock" path="/usr/sbin/sanlock" dev=sda3 ino=4207261 scontext=unconfined_u:system_r:fenced_t:s0 tcontext=system_u:object_r:sanlock_exec_t:s0 tclass=file
type=AVC msg=audit(1356007059.976:3251): avc:  denied  { open } for  pid=13292 comm="fence_sanlock" name="sanlock" dev=sda3 ino=4207261 scontext=unconfined_u:system_r:fenced_t:s0 tcontext=system_u:object_r:sanlock_exec_t:s0 tclass=file
----

Comment 7 Milos Malik 2012-12-20 10:47:29 UTC
fence_sanlockd runs as initrc_t. Could we fix it within this bug or should I file a new bug?

Comment 8 Milos Malik 2012-12-20 10:57:15 UTC
How important is the fix for your team? Please assign priority/severity.

Comment 9 Miroslav Grepl 2012-12-20 11:58:51 UTC
Also could you test it with

# cat mypol.te
policy_module(mypol,1.0)

require{
 type fenced_t;
 type sanlock_exec_t;
 type sanlock_t;
}

domtrans_pattern(fenced_t, sanlock_exec_t, sanlock_exec_t)



and execute

# make -f /usr/share/selinux/devel/Makefile mypol.pp
# semodule -i mypol.pp
# chcon -t sanlock_exec_t PATHO/fence_sanlockd

Comment 10 michal novacek 2012-12-21 11:19:07 UTC
It's not too important as it is FutureFeature (I put that into keyword) but it should be fixed eventually. 

It can be changed in this bug I do not need another one.

Comment 11 michal novacek 2012-12-21 11:51:13 UTC
Created attachment 667192 [details]
avc denials after proposed fix in comment #9

Comment 12 RHEL Program Management 2012-12-25 06:47:09 UTC
This request was not resolved in time for the current release.
Red Hat invites you to ask your support representative to
propose this request, if still desired, for consideration in
the next release of Red Hat Enterprise Linux.

Comment 16 Miroslav Grepl 2013-10-15 12:58:30 UTC
# matchpathcon /usr/sbin/fence_sanlockd
/usr/sbin/fence_sanlockd	system_u:object_r:fenced_exec_t:s0

Comment 19 errata-xmlrpc 2013-11-21 10:11:39 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-2013-1598.html