Skip to content

Security Enhanced Linux (SELinux) is a mandatory-access security tool that enables administrators to strictly define how processes are able to interact with system resources like files, directories, and sockets. For a thorough introduction to SELinux, see the RedHat SELinux page and the SELinux Wiki.

For SELinux users on RedHat Enterprise Linux, Aembit Edge Components ship with SELinux rules (.te) files when deployed to VM environments. Use .te files to create a custom SELinux policy.

On this page:

To configure SELinux to work with Aembit Edge Components, perform the following steps:

  1. Install the requisite SELinux packages.

    Terminal window
    sudo dnf install -y selinux-policy-devel rpm-build
  2. Create a new directory to contain the SELinux policy files.

    Terminal window
    mkdir ~/edge_component_policy
    cd ~/edge_component_policy
  3. Use the selinux/generate_selinux_policy.sh script inside your Edge Component installer bundle to generate a new SELinux policy for the Edge Component.

    ~/edge_component_policy
    sudo <path_to_installer_bundle>/selinux/generate_selinux_policy.sh
    # e.g sudo /home/user/aembit_agent_proxy_linux_amd64_1.19.2326/selinux/generate_selinux_policy.sh
  4. Copy the .te file for your RedHat version, located in the Edge Component installer bundle’s selinux directory, into the directory with the newly generated policy files.

    ~/edge_component_policy
    sudo cp <path_to_installer_bundle>/selinux/<RHEL_version>/aembit_agent_proxy.te .
    # e.g sudo cp /home/user/aembit_agent_proxy_linux_amd64_1.19.2326/selinux/RHEL_9.3/aembit_agent_proxy.te .
  5. Install the policy using the generated aembit_agent_proxy.sh shell script.

    ~/edge_component_policy
    sudo ./aembit_agent_proxy.sh
  6. Restart the Edge Component for the policy to take effect.

    Terminal window
    sudo systemctl restart aembit_agent_proxy
    # or sudo systemctl restart aembit_agent_controller
  7. Verify Agent Proxy is now running under SELinux.

    Terminal window
    ps -efZ | grep aembit_agent_proxy
    # Sample output:
    # system_u:system_r:aembit_agent_proxy_t:s0 [...] /opt/aembit/edge/agent_proxy/<version>/bin/aembit_agent_proxy
    # ^^^^^^^^ ^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^ - SELinux-generated user, role, and type for the Agent Proxy binary

After completing the preceding steps, the Edge Component run under SELinux.

SELinux may report violations if an Edge Component is run with non-default installation options or with unique workloads. If this occurs, follow these steps to update the SELinux policy and allow the Edge Component to access the needed resources.

  1. Change to the directory where you initially generated the SELinux policy files for your Edge Component (if you followed along from the previous section, this was ~/edge_component_policy).

    Terminal window
    cd ~/edge_component_policy
  2. Update the rules (.te) file to account for new violations by running the previously generated installation script with the --update flag.

    Terminal window
    sudo ./aembit_agent_proxy.sh --update
  3. Restart the Edge Component for the policy updates to take effect.

    Terminal window
    sudo systemctl restart aembit_agent_proxy

When installing a new version of an Edge Component that’s monitored by SELinux, you may choose to re-use your existing rules (.te) file from a previous policy installation, or you can install a new policy from scratch using the .te file provided in the Edge Component’s installation bundle. Both options lead to a fully functioning SELinux policy.

  • To create a new policy using the rules (.te) file provided in the new Edge Component’s installer bundle, follow the steps outlined in the policy creation section.

  • To create a new policy using your existing rules (.te) file, follow the steps in the policy creation section, but use your previous .te file instead of the supplied one in the Edge Component’s installation bundle.