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 semanage export and import commands in your scripts

For automated deployment using RHEL system roles and Ansible, see Configuring SELinux by using RHEL system roles.

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

Procedure

  1. Log in to the RHEL 10 web console.
  2. Click SELinux.
  3. Click View the automation script.

    View the automation script button provides an Ansible Playbook and a shell script of your SELinux configuration

    A window with the generated script opens. You can navigate between a shell script and an Ansible Playbook generation options tab.

  4. Click the Copy to clipboard 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.

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-utils package is installed on your system.

Procedure

  1. Export your verified SELinux settings:

    # semanage export -f ./<my-selinux-settings.mod>
  2. Copy the file with the settings to the new system:

    # scp ./<my-selinux-settings.mod> <new-system-hostname>:
  3. Log in on the new system:

    $ ssh root@<new-system-hostname>
  4. Import the settings on the new system:

    <new-system-hostname># semanage import -f ./<my-selinux-settings.mod>
Red Hat logoGithubRedditYoutubeTwitter

Learn

Try, buy, & sell

Communities

About Red Hat

We deliver hardened solutions that make it easier for enterprises to work across platforms and environments, from the core datacenter to the network edge.

Making open source more inclusive

Red Hat is committed to replacing problematic language in our code, documentation, and web properties. For more details, see the Red Hat Blog.

About Red Hat Documentation

Legal Notice

Theme

© 2026 Red Hat
Back to top