2020-11-10 15:33:54 +01:00
|
|
|
---
|
|
|
|
|
|
|
|
|
|
# Builds and install a custom SELinux policy module.
|
|
|
|
|
#
|
|
|
|
|
# The policy file (.te) should be in the source of the
|
|
|
|
|
#
|
|
|
|
|
# Required parameters:
|
|
|
|
|
#
|
|
|
|
|
# - policy_file (str): the file containing custom SELinux policy to build and
|
|
|
|
|
# install.
|
|
|
|
|
# - policy_name (str): the name of the custom SELinux policy to build and
|
|
|
|
|
# install.
|
|
|
|
|
|
2025-01-14 20:18:57 +10:00
|
|
|
- name: Copy over our custom selinux module for {{ policy_name }}
|
2024-12-18 08:23:28 +10:00
|
|
|
ansible.builtin.copy: src="{{ policy_file }}" dest="/usr/local/share/{{ policy_name }}.te"
|
2020-11-10 15:33:54 +01:00
|
|
|
register: selinux_module
|
|
|
|
|
tags:
|
|
|
|
|
- selinux
|
|
|
|
|
- selinux/module
|
|
|
|
|
|
|
|
|
|
- name: Build our custom selinux module
|
2024-12-19 11:22:24 +10:00
|
|
|
ansible.builtin.command: checkmodule -M -m -o /usr/local/share/{{ policy_name }}.mod /usr/local/share/{{ policy_name }}.te
|
2020-11-10 15:33:54 +01:00
|
|
|
when: selinux_module is changed
|
|
|
|
|
tags:
|
|
|
|
|
- selinux
|
|
|
|
|
- selinux/module
|
|
|
|
|
|
|
|
|
|
- name: Compile our custom selinux module
|
2024-12-19 11:22:24 +10:00
|
|
|
ansible.builtin.command: semodule_package -o /usr/local/share/{{ policy_name }}.pp -m /usr/local/share/{{ policy_name }}.mod
|
2020-11-10 15:33:54 +01:00
|
|
|
when: selinux_module is changed
|
|
|
|
|
tags:
|
|
|
|
|
- selinux
|
|
|
|
|
- selinux/module
|
|
|
|
|
|
2025-01-14 20:18:57 +10:00
|
|
|
- name: Install our custom selinux module
|
2024-12-19 11:22:24 +10:00
|
|
|
ansible.builtin.command: semodule -i /usr/local/share/{{ policy_name }}.pp
|
2020-11-10 15:33:54 +01:00
|
|
|
when: selinux_module is changed
|
|
|
|
|
tags:
|
|
|
|
|
- selinux
|
|
|
|
|
- selinux/module
|