Files
openstack-ansible-os_neutron/tasks/neutron_selinux.yml
Major Hayden 261a789342 Add SELinux policies for bare metal agents
The recent move to bare metal neutron agents brought the processes
spawned by each agent under the watch of SELinux policies. This
patch ensures that neutron can still start important daemons, such
as dnsmasq or haproxy, without causing SELinux AVCs.

Closes-Bug: 1742552
Change-Id: Id1ae9d2b43cd0fb4c38460501da24733b29566e2
2018-01-26 17:47:39 +00:00

59 lines
1.8 KiB
YAML

---
# Copyright 2017, Rackspace US, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
- name: Ensure SELinux packages are installed
package:
name: "{{ item }}"
state: present
with_items:
- libselinux
- libselinux-devel
- checkpolicy
- policycoreutils-python
- name: Create directory for compiling SELinux role
file:
path: "/tmp/osa-neutron-selinux"
state: directory
mode: '0755'
- name: Deploy SELinux policy source file
copy:
src: "osa-neutron-selinux.te"
dest: "/tmp/osa-neutron-selinux/"
owner: root
group: root
mode: "0755"
# NOTE(mhayden): Linting checks are skipped here because there isn't a
# reliable way to determine if this SELinux module is newer than the one that
# is currently in use on the system. The linter expects there to be a
# "creates" argument below.
- name: Compile and load SELinux module
command: "{{ item }}"
args:
chdir: "/tmp/osa-neutron-selinux/"
with_items:
- checkmodule -M -m -o osa-neutron-selinux.mod osa-neutron-selinux.te
- semodule_package -o osa-neutron-selinux.pp -m osa-neutron-selinux.mod
- semodule -i osa-neutron-selinux.pp
tags:
- skip_ansible_lint
- name: Remove temporary directory
file:
path: "/tmp/osa-neutron-selinux/"
state: absent