TMAegis
Más reglas para linux

TMA-ROCKY8-1.3.1.2

Ensure SELinux is not disabled in bootloader configuration

MediaNivel 1Automatizadalinux

Descripción

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

Cómo se verifica

Método de auditoría: Comando de shell

shell
alt0() { o=$(bash -c 'grubby --info=ALL | grep -Po '"'"'(selinux|enforcing)=0\b'"'"'' 2>/dev/null); [ -z "$o" ] || { echo "step1: $o" | head -c 300; return 1; }; o=$(bash -c 'grep -Prs -- '"'"'^\h*([^#\n\r]+\h+)?kernelopts=([^#\n\r]+\h+)?(selinux|enforcing)=0\b'"'"' /boot/grub2 /boot/efi' 2>/dev/null); [ -z "$o" ] || { echo "step2: $o" | head -c 300; return 1; }; }; if alt0; then echo compliant; fi
Salida esperada
compliant

Cómo se corrige

Método de corrección: Guía o parche de infraestructura

Run the following command to remove the selinux=0 and enforcing=0 parameters: grubby --update-kernel ALL --remove-args "selinux=0 enforcing=0" Run the following command to remove the selinux=0 and enforcing=0 parameters if they were created by the deprecated grub2-mkconfig command: # grep -Prsq -- '^\h*([^#\n\r]+\h+)?kernelopts=([^#\n\r]+\h+)?(selinux|enforcing)=0\b' /boot/grub2 /boot/efi && grub2-mkconfig -o "$(grep -Prl -- '\h*([^#\n\r]+\h+)?kernelopts=([^#\n\r]+\h+)?(selinux|enforcing)=0\b' /boot/grub2 /boot/efi)"

Propiedades

Sistemas operativos
rocky-8
Etiquetas
cis-convertedlinux
Referencia
CIS Rocky Linux 8 Benchmark v3.0.0 - 1.3.1.2

Verificar este host

Ejecute esto en un equipo que tenga permiso para auditar. El escaneo es de solo lectura.

shell
tmaegis scan --target linux