Chapter 10. Deploying the same SELinux configuration on multiple systems
Deploy your tested and verified SELinux configuration efficiently across multiple systems. Automating deployment helps ensure consistent security policies across your infrastructure.
You can deploy your verified SELinux configuration on multiple systems by using one of the following methods:
- Using the RHEL web console
-
Using
semanageexport and import commands in your scripts
For automated deployment using RHEL system roles and Ansible, see Configuring SELinux by using RHEL system roles.
10.1. Creating an SELinux configuration Ansible Playbook in the web console Copy linkLink copied to clipboard!
Generate an Ansible Playbook directly from the RHEL web console that captures your current SELinux configuration settings. You can copy this script and apply it to multiple systems to quickly deploy a consistent configuration.
Prerequisites
You have installed the RHEL 10 web console.
For instructions, see Installing and enabling the web console.
Procedure
- Log in to the RHEL 10 web console.
- Click SELinux.
Click .
A window with the generated script opens. You can navigate between a shell script and an Ansible Playbook generation options tab.
Click the button to select the script or playbook and apply it.
As a result, you have an automation script that you can apply to more machines. See the
ansible-playbook(1)man page on your system for more information.
10.2. Transferring SELinux settings to another system with semanage Copy linkLink copied to clipboard!
Transfer verified, custom SELinux configuration settings between RHEL 10 systems by using the semanage export and semanage import commands. This is a reliable way to replicate security setups.
Prerequisites
-
The
policycoreutils-python-utilspackage is installed on your system.
Procedure
Export your verified SELinux settings:
# semanage export -f ./<my-selinux-settings.mod>Copy the file with the settings to the new system:
# scp ./<my-selinux-settings.mod> <new-system-hostname>:Log in on the new system:
$ ssh root@<new-system-hostname>Import the settings on the new system:
<new-system-hostname># semanage import -f ./<my-selinux-settings.mod>