Ensure SELinux State is Enforcing
An XCCDF Rule
Description
The SELinux state should be set to
at
system boot time. In the file /etc/selinux/config
, add or correct the
following line to configure the system to boot into enforcing mode:
SELINUX=
Rationale
Setting the SELinux state to enforcing ensures SELinux is able to confine potentially compromised processes to the security policy, which is designed to prevent them from causing damage to the system or further elevating their privileges.
- ID
- xccdf_org.ssgproject.content_rule_selinux_state
- Severity
- High
- References
- Updated
Remediation - Shell Script
# Remediation is applicable only in certain platforms
if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then
var_selinux_state='<xccdf-1.2:sub xmlns:xccdf-1.2="http://checklists.nist.gov/xccdf/1.2" idref="xccdf_org.ssgproject.content_value_var_selinux_state" use="legacy"/>'
Remediation - Ansible
- name: XCCDF Value var_selinux_state # promote to variable
set_fact:
var_selinux_state: !!str <xccdf-1.2:sub xmlns:xccdf-1.2="http://checklists.nist.gov/xccdf/1.2" idref="xccdf_org.ssgproject.content_value_var_selinux_state" use="legacy"/>
tags:
- always