Bug 1151235 - [RFE] Ceph MON should work with SELinux
Summary: [RFE] Ceph MON should work with SELinux
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Red Hat OpenStack
Classification: Red Hat
Component: openstack-selinux
Version: Foreman (RHEL 6)
Hardware: x86_64
OS: Linux
urgent
urgent
Target Milestone: z2
: 5.0 (RHEL 7)
Assignee: Ryan Hallisey
QA Contact: nlevinki
URL:
Whiteboard: MVP
Depends On: 1127910 1159756 1250037
Blocks: 1122184
TreeView+ depends on / blocked
 
Reported: 2014-10-09 20:37 UTC by Mike Burns
Modified: 2016-04-26 16:53 UTC (History)
21 users (show)

Fixed In Version:
Doc Type: Enhancement
Doc Text:
Clone Of: 1127910
Environment:
Last Closed: 2014-10-24 15:16:07 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Ceph Project Bug Tracker 8746 0 None None None Never

Comment 1 Ryan Hallisey 2014-10-09 21:22:57 UTC
I have a good feeling that almost all those are mislabeled files.

# restorecon -Rv /var/log/calamari/calamari.log
# restorecon -Rv /var/lib/graphite/whisper

allow ldconfig_t proc_net_t:file read;

Comment 2 Lon Hohberger 2014-10-10 13:41:55 UTC
[root@localhost ~]# semanage fcontext -l | grep calam
/etc/cron\.daily/calamaris                         regular file       system_u:object_r:calamaris_exec_t:s0 
/var/log/calamaris(/.*)?                           all files          system_u:object_r:calamaris_log_t:s0 
/var/www/calamaris(/.*)?                           all files          system_u:object_r:calamaris_www_t:s0 

I don't think restorecon will fix it.

Comment 3 Lon Hohberger 2014-10-10 13:43:36 UTC
type=AVC msg=audit(1409330049.520:333): avc:  denied  { open } for  pid=2870 comm="httpd" path="/var/log/calamari/calamari.log" dev="dm-0" ino=1812779 scontext=system_u:system_r:httpd_t:s0 tcontext=unconfined_u:object_r:var_log_t:s0 tclass=file

It's presently var_log_t.  I think that's correct.

Comment 4 Lon Hohberger 2014-10-10 13:46:35 UTC
BTW, The SELinux 'calamaris' module is for the squid proxy cache, not ceph.  If the AVCs are actually for some instance of squid, then we're deploying it wrong.

Comment 5 Lon Hohberger 2014-10-10 13:53:19 UTC
#============= httpd_t ==============
allow httpd_t httpd_log_t:file rename;
allow httpd_t init_var_lib_t:dir { read getattr open };
allow httpd_t init_var_lib_t:file { read getattr open };

#!!!! This avc can be allowed using the boolean 'httpd_can_network_connect'
allow httpd_t mmcc_port_t:tcp_socket name_connect;

#!!!! This avc can be allowed using one of the these booleans:
#     httpd_can_network_connect, httpd_can_network_connect_db
allow httpd_t postgresql_port_t:tcp_socket name_connect;

#!!!! This avc is allowed in the current policy
allow httpd_t unreserved_port_t:tcp_socket name_connect;

allow httpd_t var_log_t:file open;


so a workaround is:
 # setsebool -P httpd_can_network_connect 1
 # semanage fcontext /var/log/calamari.log http_log_t
 # restorecon /var/log/calamari.log

The only remaining weird parts are the http_t dealing with init_var_lib_t.

Comment 6 Lon Hohberger 2014-10-10 13:54:02 UTC
Er:

 # semanage fcontext /var/log/calamari.log httpd_log_t

...

Comment 7 Miroslav Grepl 2014-10-13 07:46:00 UTC
What is labeled as init_var_lib_t?

Comment 9 Lon Hohberger 2014-10-16 14:44:19 UTC
https://bugzilla.redhat.com/attachment.cgi?id=933573

^ audit.log (from other bug against 7.0)

Comment 10 Lon Hohberger 2014-10-16 14:45:24 UTC
type=AVC msg=audit(1409330362.683:338): avc:  denied  { getattr } for  pid=4020 comm="find" path="/var/lib/graphite/whisper/carbon" dev="dm-0" ino=10888735 scontext=system_u:system_r:httpd_t:s0 tcontext=system_u:object_r:init_var_lib_t:s0 tclass=dir

^^ That one.

Comment 12 Miroslav Grepl 2014-10-16 15:05:51 UTC
$ rpm -qf /var/lib/graphite

Comment 13 Lon Hohberger 2014-10-20 17:36:21 UTC
Looks like there's this:

https://github.com/graphite-project

On Fedora, there's a python-carbon rpm.  It has:

/var/lib/carbon
/var/log/carbon
/var/run/carbon

/etc/carbon
/etc/carbon/carbon.conf
/etc/carbon/storage-schemas.conf
/etc/init.d/carbon-aggregator
/etc/init.d/carbon-cache
/etc/init.d/carbon-relay
/etc/sysconfig/carbon
/usr/bin/carbon-aggregator
/usr/bin/carbon-cache
/usr/bin/carbon-client
/usr/bin/carbon-relay
/usr/bin/validate-storage-schemas

Comment 14 Lon Hohberger 2014-10-20 17:36:52 UTC
(and site-packages)

Comment 15 Lon Hohberger 2014-10-20 18:39:01 UTC
Presumably, this python-carbon rpm is provided by the Ceph deployment tool; it's not part of RHEL or RHEL OSP.

I really don't think the /var/lib/carbon thing is something we want to patch around in openstack-selinux.

If we create a conflicting type to fix this in openstack-selinux, we will break upgrade.

Comment 17 Lon Hohberger 2014-10-20 19:46:42 UTC
So, calamari/carbon aren't necessarily needed initially, leaving:

# httpd_t
allow httpd_t httpd_log_t:file rename;


And, in postinstall:
 # setsebool -P httpd_can_network_connect 1

Comment 18 Lon Hohberger 2014-10-20 19:50:27 UTC
I've asked Crag to attach up-to-the-minute audit.logs for us.

Comment 19 Crag Wolfe 2014-10-21 00:00:55 UTC
No avc denials were logged given a 3 mon / 1 storage node cluster created by https://github.com/cwolferh/moar-cowbell-scripts/blob/master/ceph/simple-cluster-with-predefined-ceph.bash .  Note that my cluster does not use carbon on any of the nodes -- that is a calamari thing.  I.e., my cluster is based off of ceph-deploy only and calamari is not installed.

Comment 20 Lon Hohberger 2014-10-24 15:16:07 UTC
Ok, if the deployment from Staypuft works, then there's nothing specific to do here for the openstack-selinux package.


Note You need to log in before you can comment on or make changes to this bug.