Bug 677802

Summary: cluster daemons need access to dbus
Product: Red Hat Enterprise Linux 6 Reporter: Nate Straz <nstraz>
Component: selinux-policyAssignee: Miroslav Grepl <mgrepl>
Status: CLOSED ERRATA QA Contact: Cluster QE <mspqa-list>
Severity: unspecified Docs Contact:
Priority: medium    
Version: 6.1CC: dwalsh, lhh, mgrepl, mmalik, rohara
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-05-19 11:57:39 UTC Type: ---
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: 592964    

Description Nate Straz 2011-02-15 21:30:02 UTC
Description of problem:

When starting fenced I'm getting this AVC when fenced tries to register with dbus.

type=AVC msg=audit(1297805235.116:43352): avc:  denied  { search } for  pid=16830 comm="fenced" name="dbus" dev=dm-0 ino=1439545 scontext=system_u:system_r:fenced_t:s0-s0:c0.c1023 tcontext=system_u:object_r:system_dbusd_var_run_t:s0 tclass=dir

fenced and other cluster daemons are using dbus to talk to the new foghorn package which translates the dbus messages into SNMP events.

Version-Release number of selected component (if applicable):
cman-3.0.12-33.el6.x86_64
selinux-policy-3.7.19-70.el6.noarch


How reproducible:
Every time

Steps to Reproduce:
1. start fenced
2.
3.
  
Actual results:


Expected results:


Additional info:

Comment 1 Milos Malik 2011-02-16 08:44:32 UTC
Easy to reproduce:

Feb 16 03:24:43 pogolinux-2 kernel: type=1400 audit(1297844683.520:4): avc:  denied  { search } for  pid=5888 comm="fenced" name="dbus" dev=dm-0 ino=654841 scontext=unconfined_u:system_r:fenced_t:s0 tcontext=system_u:object_r:system_dbusd_var_run_t:s0 tclass=dir

Comment 2 Miroslav Grepl 2011-02-16 11:04:25 UTC
So is this needed also for other cluster services?

It looks there is a lot of changes related to cluster services.

Nate, 
could you run 

# semanage permissive -a $cluster_service

if you see some AVC msgs for a cluster service to collect all AVC. 

I wish we could catch these issues in the devel time.

Comment 3 Ryan O'Hara 2011-02-16 19:10:23 UTC
(In reply to comment #2)
> So is this needed also for other cluster services?
> 
> It looks there is a lot of changes related to cluster services.
> 
> Nate, 
> could you run 
> 
> # semanage permissive -a $cluster_service
> 
> if you see some AVC msgs for a cluster service to collect all AVC. 
> 
> I wish we could catch these issues in the devel time.

Not sure what is going on here:

# semanage permissive -a fenced
Traceback (most recent call last):
  File "/usr/sbin/semanage", line 556, in <module>
    process_args(sys.argv[1:])
  File "/usr/sbin/semanage", line 433, in process_args
    OBJECT.add(target)
  File "/usr/lib64/python2.6/site-packages/seobject.py", line 373, in add
    mc.create_module_package(filename, 1)
  File "/usr/lib64/python2.6/site-packages/sepolgen/module.py", line 172, in create_module_package
    self.refpol_build(sourcename)
  File "/usr/lib64/python2.6/site-packages/sepolgen/module.py", line 186, in refpol_build
    raise RuntimeError("compilation failed:\n%s" % self.last_output)
RuntimeError: compilation failed:
find: unknown predicate `-D.te'
/usr/share/selinux/devel/include/Makefile:211: warning: overriding commands for target `permissive_fenced'
/usr/share/selinux/devel/include/Makefile:208: warning: ignoring old commands for target `permissive_fenced'
make: *** No rule to make target `-D.pp', needed by `all'.  Stop.

Comment 4 Ryan O'Hara 2011-02-16 19:22:48 UTC
# setenforce 0
# service cman start

From /var/log/audit/audit.log

type=AVC msg=audit(1297884146.090:22577): avc:  denied  { search } for  pid=2786 comm="fenced" name="dbus" dev=dm-0 ino=393854 scontext=unconfined_u:system_r:fenced_t:s0 tcontext=system_u:object_r:system_dbusd_var_run_t:s0 tclass=dir
type=AVC msg=audit(1297884146.090:22577): avc:  denied  { write } for  pid=2786 comm="fenced" name="system_bus_socket" dev=dm-0 ino=396077 scontext=unconfined_u:system_r:fenced_t:s0 tcontext=system_u:object_r:system_dbusd_var_run_t:s0 tclass=sock_file
type=AVC msg=audit(1297884146.090:22577): avc:  denied  { connectto } for  pid=2786 comm="fenced" path="/var/run/dbus/system_bus_socket" scontext=unconfined_u:system_r:fenced_t:s0 tcontext=system_u:system_r:system_dbusd_t:s0-s0:c0.c1023 tclass=unix_stream_socket
type=SYSCALL msg=audit(1297884146.090:22577): arch=c000003e syscall=42 success=yes exit=0 a0=5 a1=7ffff8d35d60 a2=21 a3=7ffff8d35ad0 items=0 ppid=1 pid=2786 auid=0 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=1 comm="fenced" exe="/usr/sbin/fenced" subj=unconfined_u:system_r:fenced_t:s0 key=(null)
type=USER_AVC msg=audit(1297884146.098:22578): user pid=1484 uid=81 auid=4294967295 ses=4294967295 subj=system_u:system_r:system_dbusd_t:s0-s0:c0.c1023 msg='avc:  denied  { send_msg } for msgtype=method_call interface=org.freedesktop.DBus member=Hello dest=org.freedesktop.DBus spid=2786 scontext=unconfined_u:system_r:fenced_t:s0 tcontext=system_u:system_r:system_dbusd_t:s0-s0:c0.c1023 tclass=dbus : exe="/bin/dbus-daemon" sauid=81 hostname=? addr=? terminal=?'

Comment 5 Daniel Walsh 2011-02-16 19:44:43 UTC
optional_policy(`
	dbus_system_bus_client(cluster_domain)
')

We can add this, but do we need more, are the cluster daemons going to be sending each other dbus messages.

	allow cluster_domain cluster_domain:dbus send_msg;


Are any of the cluster domains going to be started on demand by dbus?

Comment 6 Nate Straz 2011-02-16 19:53:46 UTC
I do expect the cluster daemons to be sending each other dbus messages.  I do not expect cluster daemons to be started via dbus.

Lon or Ryan, is that correct?

Comment 7 Ryan O'Hara 2011-02-16 20:29:01 UTC
(In reply to comment #5)
> optional_policy(`
>  dbus_system_bus_client(cluster_domain)
> ')
> 
> We can add this, but do we need more, are the cluster daemons going to be
> sending each other dbus messages.

Only fenced and rgmanager will be sending dbus signals. Those signals aren't actually to each other, since dbus signals are broadcast. There is a new service called 'foghorn' that listens for these signals and generates SNMP traps from them. I've not seen any selinux problems with the foghorn service.

Actually there is a third component that can/will talk to dbus -- corosync-notifyd. The corosync developers have not mentioned any problems with selinux when using dbus, but I will verify.

>  allow cluster_domain cluster_domain:dbus send_msg;
> 
> 
> Are any of the cluster domains going to be started on demand by dbus?

No.

Comment 8 Daniel Walsh 2011-02-16 22:09:28 UTC
Well corosync-notifyd and foghorn are probably running as initrc_t which would mean they are unconfined.

Comment 9 Miroslav Grepl 2011-02-17 08:59:25 UTC
(In reply to comment #3)
> (In reply to comment #2)
> > So is this needed also for other cluster services?
> > 
> > It looks there is a lot of changes related to cluster services.
> > 
> > Nate, 
> > could you run 
> > 
> > # semanage permissive -a $cluster_service
> > 
> > if you see some AVC msgs for a cluster service to collect all AVC. 
> > 
> > I wish we could catch these issues in the devel time.
> 
> Not sure what is going on here:
> 
> # semanage permissive -a fenced
> Traceback (most recent call last):
>   File "/usr/sbin/semanage", line 556, in <module>
>     process_args(sys.argv[1:])

Oops, I meant this format

# semanage permissive -a fenced_t

Comment 10 Miroslav Grepl 2011-02-17 09:01:50 UTC
(In reply to comment #7)
> (In reply to comment #5)
> > optional_policy(`
> >  dbus_system_bus_client(cluster_domain)
> > ')
> > 
> > We can add this, but do we need more, are the cluster daemons going to be
> > sending each other dbus messages.
> 
> Only fenced and rgmanager will be sending dbus signals. Those signals aren't
> actually to each other, since dbus signals are broadcast. There is a new
> service called 'foghorn' that listens for these signals and generates SNMP
> traps from them. I've not seen any selinux problems with the foghorn service.
> 
> Actually there is a third component that can/will talk to dbus --
> corosync-notifyd. The corosync developers have not mentioned any problems with
> selinux when using dbus, but I will verify.
> 

Thanks. I would imagine there will be other avc msgs.

Comment 11 Miroslav Grepl 2011-02-17 15:25:15 UTC
Fixed in selinux-policy-3.7.19-71.el6

Comment 13 Ryan O'Hara 2011-02-17 17:53:13 UTC
(In reply to comment #10)
> (In reply to comment #7)
> > (In reply to comment #5)
> > > optional_policy(`
> > >  dbus_system_bus_client(cluster_domain)
> > > ')
> > > 
> > > We can add this, but do we need more, are the cluster daemons going to be
> > > sending each other dbus messages.
> > 
> > Only fenced and rgmanager will be sending dbus signals. Those signals aren't
> > actually to each other, since dbus signals are broadcast. There is a new
> > service called 'foghorn' that listens for these signals and generates SNMP
> > traps from them. I've not seen any selinux problems with the foghorn service.
> > 
> > Actually there is a third component that can/will talk to dbus --
> > corosync-notifyd. The corosync developers have not mentioned any problems with
> > selinux when using dbus, but I will verify.
> > 
> 
> Thanks. I would imagine there will be other avc msgs.

Yes, I assume that is the case.

Lon and I did not see any avc denials when running rgmanager, which is surprising. I'll test this latest policy and post the results. Thanks.

Comment 16 errata-xmlrpc 2011-05-19 11:57:39 UTC
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHBA-2011-0526.html