1.6.1.2 Ensure SELinux is not disabled in bootloader configuration

Information

Configure SELINUX to be enabled at boot time and verify that it has not been overwritten by the grub boot parameters.

Note: This recommendation is designed around the grub 2 bootloader, if LILO or another bootloader is in use in your environment enact equivalent settings.

Rationale:

SELinux must be enabled at boot time in your grub configuration to ensure that the controls it provides are not overridden.

Solution

Edit /etc/default/grub and remove all instances of selinux=0 and enforcing=0 from all CMDLINE_LINUX parameters:

GRUB_CMDLINE_LINUX_DEFAULT='quiet'

GRUB_CMDLINE_LINUX=''

Run the following script to update the grub2 configuration:

#!/usr/bin/env bash

GFCU()
{
grubfile=$(find /boot -type f ( -name 'grubenv' -o -name 'grub.conf' -o -name 'grub.cfg' ) -exec grep -Pl '^h*(kernelopts=|linux|kernel)' {} ;)
grubdir=$(dirname '$grubfile')
grub2-mkconfig -o '$grubdir/grub.cfg'
}
GFCU

See Also

https://workbench.cisecurity.org/files/3636