Bug 1024855

Summary: default label of /var/run/fence_sanlockd/fence_sanlockd.fifo is not correct
Product: Red Hat Enterprise Linux 6 Reporter: Milos Malik <mmalik>
Component: selinux-policyAssignee: Simon Sekidde <ssekidde>
Status: CLOSED ERRATA QA Contact: Milos Malik <mmalik>
Severity: medium Docs Contact:
Priority: medium    
Version: 6.5CC: dwalsh, eparis, ssekidde
Target Milestone: rc   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-10-14 07:57:34 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 Milos Malik 2013-10-30 14:05:16 UTC
Description of problem:
If fence_sanlockd is running and somebody calls "restorecon -R /var/run" then /var/run/fence_sanlockd/fence_sanlockd.fifo gets mislabeled, which leads to AVCs.

Version-Release number of selected component (if applicable):
fence-sanlock-2.8-1.el6.x86_64
sanlock-2.8-1.el6.x86_64
sanlock-lib-2.8-1.el6.x86_64
selinux-policy-3.7.19-231.el6.noarch
selinux-policy-doc-3.7.19-231.el6.noarch
selinux-policy-minimum-3.7.19-231.el6.noarch
selinux-policy-mls-3.7.19-231.el6.noarch
selinux-policy-targeted-3.7.19-231.el6.noarch

How reproducible:
always

Steps to Reproduce:
# service fence_sanlockd status
fence_sanlockd is stopped
# ls -Z /var/run/fence_sanlockd/fence_sanlockd.fifo 
ls: cannot access /var/run/fence_sanlockd/fence_sanlockd.fifo: No such file or directory
# service fence_sanlockd start
Starting wdmd:                                             [  OK  ]
Starting sanlock:                                          [  OK  ]
Starting fence_sanlockd:                                   [  OK  ]
# service fence_sanlockd status
fence_sanlockd (pid 6562) is running...
# ls -Z /var/run/fence_sanlockd/fence_sanlockd.fifo 
prw-------. root root unconfined_u:object_r:fenced_var_run_t:s0 /var/run/fence_sanlockd/fence_sanlockd.fifo
# restorecon -Rv /var/run/
restorecon reset /var/run/fence_sanlockd/fence_sanlockd.fifo context unconfined_u:object_r:fenced_var_run_t:s0->unconfined_u:object_r:var_run_t:s0
# service fence_sanlockd restart
Sending stop signal fence_sanlockd (6562):                 [  OK  ]
Waiting for fence_sanlockd (6562) to stop:                 [  OK  ]
Sending stop signal sanlock (6547):                        [  OK  ]
Waiting for sanlock (6547) to stop:                        [  OK  ]
Sending stop signal wdmd (6521):                           [  OK  ]
Waiting for wdmd (6521) to stop:                           [  OK  ]
Starting wdmd:                                             [  OK  ]
Starting sanlock:                                          [  OK  ]
Starting fence_sanlockd:                                   [  OK  ]
# ausearch -m avc -m user_avc -m selinux_err -i -ts recent

Actual results:
----
type=PATH msg=audit(10/30/2013 14:58:40.796:1127) : item=1 name=/var/run/fence_sanlockd/fence_sanlockd.fifo inode=139562 dev=fc:03 mode=fifo,600 ouid=root ogid=root rdev=00:00 obj=unconfined_u:object_r:var_run_t:s0 nametype=DELETE 
type=PATH msg=audit(10/30/2013 14:58:40.796:1127) : item=0 name=/var/run/fence_sanlockd/ inode=158130 dev=fc:03 mode=dir,775 ouid=root ogid=root rdev=00:00 obj=system_u:object_r:var_run_t:s0 nametype=PARENT 
type=CWD msg=audit(10/30/2013 14:58:40.796:1127) :  cwd=/ 
type=SYSCALL msg=audit(10/30/2013 14:58:40.796:1127) : arch=x86_64 syscall=unlink success=no exit=-13(Permission denied) a0=607b40 a1=ffffffff a2=0 a3=4000 items=2 ppid=1 pid=6707 auid=root uid=root gid=root euid=root suid=root fsuid=root egid=root sgid=root fsgid=root tty=(none) ses=1 comm=fence_sanlockd exe=/usr/sbin/fence_sanlockd subj=unconfined_u:system_r:fenced_t:s0 key=(null) 
type=AVC msg=audit(10/30/2013 14:58:40.796:1127) : avc:  denied  { unlink } for  pid=6707 comm=fence_sanlockd name=fence_sanlockd.fifo dev=vda3 ino=139562 scontext=unconfined_u:system_r:fenced_t:s0 tcontext=unconfined_u:object_r:var_run_t:s0 tclass=fifo_file 
----
type=PATH msg=audit(10/30/2013 14:58:40.796:1126) : item=0 name=/var/run/fence_sanlockd/fence_sanlockd.fifo inode=139562 dev=fc:03 mode=fifo,600 ouid=root ogid=root rdev=00:00 obj=unconfined_u:object_r:var_run_t:s0 nametype=NORMAL 
type=CWD msg=audit(10/30/2013 14:58:40.796:1126) :  cwd=/ 
type=SYSCALL msg=audit(10/30/2013 14:58:40.796:1126) : arch=x86_64 syscall=open success=no exit=-13(Permission denied) a0=607b40 a1=80000 a2=ffffffffffffffa8 a3=0 items=1 ppid=1 pid=6707 auid=root uid=root gid=root euid=root suid=root fsuid=root egid=root sgid=root fsgid=root tty=(none) ses=1 comm=fence_sanlockd exe=/usr/sbin/fence_sanlockd subj=unconfined_u:system_r:fenced_t:s0 key=(null) 
type=AVC msg=audit(10/30/2013 14:58:40.796:1126) : avc:  denied  { read } for  pid=6707 comm=fence_sanlockd name=fence_sanlockd.fifo dev=vda3 ino=139562 scontext=unconfined_u:system_r:fenced_t:s0 tcontext=unconfined_u:object_r:var_run_t:s0 tclass=fifo_file 
----

Expected results:
 * no AVCs

Comment 1 Daniel Walsh 2013-11-04 16:52:47 UTC
We have the correct labeling for this in Fedora.

Comment 4 errata-xmlrpc 2014-10-14 07:57:34 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-2014-1568.html