Bug 1684885 - [OSP SELinux][Octavia][RHEL8] Amphora AVC denied errors
Summary: [OSP SELinux][Octavia][RHEL8] Amphora AVC denied errors
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat OpenStack
Classification: Red Hat
Component: openstack-selinux
Version: 15.0 (Stein)
Hardware: x86_64
OS: Unspecified
medium
high
Target Milestone: beta
: 15.0 (Stein)
Assignee: Nir Magnezi
QA Contact: Bruna Bonguardo
URL:
Whiteboard:
Depends On:
Blocks: 1623857 1708783
TreeView+ depends on / blocked
 
Reported: 2019-03-03 15:14 UTC by Nir Magnezi
Modified: 2019-09-26 10:48 UTC (History)
4 users (show)

Fixed In Version: openstack-selinux-0.8.18-0.20190327111949.4c5ed0f.el8ost.noarch.rpm
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2019-09-21 11:20:27 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
amphora audit log (303.32 KB, text/plain)
2019-03-03 15:15 UTC, Nir Magnezi
no flags Details
amphora audit log UDP (292.79 KB, text/plain)
2019-03-03 15:38 UTC, Nir Magnezi
no flags Details
audit.log (116.14 KB, text/plain)
2019-03-06 15:03 UTC, Nir Magnezi
no flags Details
audit2allow (513 bytes, text/plain)
2019-03-06 15:04 UTC, Nir Magnezi
no flags Details
audit2why (3.89 KB, text/plain)
2019-03-06 15:05 UTC, Nir Magnezi
no flags Details


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHEA-2019:2811 0 None None None 2019-09-21 11:20:55 UTC

Description Nir Magnezi 2019-03-03 15:14:56 UTC
Description of problem:
=======================
A RHEL8 Beta Amphora image with SELinux in permissive mode, produced AVC denied errors. audit2allows shows the following policies are missing:

#============= haproxy_t ==============

#!!!! This avc can be allowed using the boolean 'domain_can_mmap_files'
allow haproxy_t bin_t:file map;
allow haproxy_t bin_t:file execute;
allow haproxy_t unconfined_service_t:file { open read };

#============= ifconfig_t ==============
allow ifconfig_t usermodehelper_t:file { getattr open write };

#============= keepalived_t ==============
allow keepalived_t bin_t:file entrypoint;
allow keepalived_t keepalived_exec_t:file execute_no_trans;
 

Version-Release number of selected component (if applicable):
=============================================================
OSP15-trunk: openstack-selinux-0.8.18-0.20190212133159.282e8a1.el8ost.noarch

How reproducible:
================
100%

Steps to Reproduce:
===================
1. Create a loadbalancer in Octavia while using an RHEL8 Beta image
2. Create listeners pools and members
3. Inspect audit and run audit2allow

Additional info:
================
audit log attached to this bug

Comment 1 Nir Magnezi 2019-03-03 15:15:39 UTC
Created attachment 1540296 [details]
amphora audit log

Comment 2 Nir Magnezi 2019-03-03 15:38:21 UTC
Created attachment 1540297 [details]
amphora  audit log UDP

Configuring the Octavia loadbalancer to serve UDP traffic produced the following:

#============= ifconfig_t ==============
allow ifconfig_t usermodehelper_t:file { getattr open write };

#============= keepalived_t ==============
allow keepalived_t keepalived_exec_t:file execute_no_trans;
allow keepalived_t var_run_t:dir { create mounton };


Needed policies mentioned here were already listed in comment 0, aside from 

allow keepalived_t var_run_t:dir { create mounton };


which should also be added.

Comment 3 Nir Magnezi 2019-03-03 16:53:15 UTC
Julie,

I started to write a patch[1] for this bug but noticed that openstack-selinux does not have an EL8 branch.
Anyhow, I wrote this and would appreciate your feedback.
I still need to add tests and then I'll propose a pull request (not sure to which branch since, as mentioned, no EL8 branch):

The current tests are not happy with the following:
os-octavia.te:33:ERROR 'unknown type usermodehelper_t' at token ';' on line 3383:

I'll take a deeper look on that one.

[1] https://github.com/nmagnezi/openstack-selinux/commit/9c21cf25f87b60f8dd13ecd4a757fd0373391c6b

Comment 4 Julie Pichon 2019-03-04 09:22:42 UTC
Hi Nir,

Is the missing branch causing an issue (i.e. this wouldn't work on EL7)? I'll look into it. For now openstack-selinux is working as a branchless package we cross-tag to every supported release.

About the breaking test, you probably need to "require" (kinda like "import") usermodehelper_t at the top of the file. I did that and that cleared the error, although the tests then failed on missing keepalived_exec_t so I guess there are a few others missing!

While working on this patch, could you also include the denied AVCs into a test file? See under /tests/ for examples. That way we can make sure the denials are indeed fixed and avoid regressions in the future. Thanks!

Comment 5 Julie Pichon 2019-03-04 09:38:08 UTC
Also, from the description one of the AVCs can be resolved by setting a boolean ("This avc can be allowed using the boolean 'domain_can_mmap_files'") so it would be better to enable the boolean for that one ( https://github.com/redhat-openstack/openstack-selinux/blob/282e8a1/local_settings.sh.in#L159-L181 ) rather than write a new rule.

Comment 6 Nir Magnezi 2019-03-06 14:05:54 UTC
Thanks for the feedback, Julie.

I incorporated your suggestion, as well as added AVC tests for the additions I made to the policy.

See:  https://github.com/redhat-openstack/openstack-selinux/pull/28

I also noticed some Nova SELinux related issues while testing locally on RHEL8, captured it on bug 1686004.

Comment 7 Julie Pichon 2019-03-06 14:22:08 UTC
Removing needinfo. We don't seem to be actively using el6/7 branches so I don't think we need to worry about the lack of el8 branch for now. Working against master is fine. I'll look into bug 1686004 as well.

Comment 8 Nir Magnezi 2019-03-06 15:00:38 UTC
For documentation purposes, I'll attach the following to this bug:

audit.log
audit2allow output
audit2why output

Comment 9 Nir Magnezi 2019-03-06 15:03:36 UTC
Created attachment 1541441 [details]
audit.log

audit.log on RHEL8

Comment 10 Nir Magnezi 2019-03-06 15:04:49 UTC
Created attachment 1541443 [details]
audit2allow

Comment 11 Nir Magnezi 2019-03-06 15:05:41 UTC
Created attachment 1541444 [details]
audit2why

Comment 13 Nir Magnezi 2019-03-12 08:06:01 UTC
PR merged: https://github.com/redhat-openstack/openstack-selinux/pull/28

Comment 18 errata-xmlrpc 2019-09-21 11:20:27 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.

https://access.redhat.com/errata/RHEA-2019:2811


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