Merge "Add selinux rules to allow lxc-attach after reboot"

This commit is contained in:
Jenkins 2016-12-03 02:55:59 +00:00 committed by Gerrit Code Review
commit 3bb06e1bd8
3 changed files with 38 additions and 0 deletions

11
files/lxc-attach.te Normal file
View File

@ -0,0 +1,11 @@
module lxc-attach 1.0;
require {
type unconfined_service_t;
type var_lib_t;
class file entrypoint;
}
#============= unconfined_service_t ==============
allow unconfined_service_t var_lib_t:file entrypoint;

View File

@ -218,3 +218,29 @@
service:
name: lxc
enabled: "yes"
- name: Create directory for compiling SELinux rule
file:
path: "/tmp/lxc-attach-selinux/"
state: 'directory'
mode: '0755'
- name: Drop SELinux config
copy:
src: "lxc-attach.te"
dest: "/tmp/lxc-attach-selinux/lxc-attach.te"
owner: "root"
group: "root"
mode: "0755"
- name: Compile and load SELinux module
command: '{{ item }}'
args:
creates: '/etc/selinux/targeted/modules/active/modules/lxc-attach.pp'
chdir: "/tmp/lxc-attach-selinux/"
with_items:
- make -f /usr/share/selinux/devel/Makefile
- semodule -i /tmp/lxc-attach-selinux/lxc-attach.pp
when:
- ansible_selinux.status == "enabled"

View File

@ -37,6 +37,7 @@ lxc_hosts_distro_packages:
- python34-devel
- pkgconfig
- redhat-lsb
- selinux-policy-devel
- xz
lxc_xz_bin: xz