TMA-ROCKY8-1.3.1.2
Ensure SELinux is not disabled in bootloader configuration
中级别 1自动化linux
说明
Configure SELINUX to be enabled at boot time and verify that it has not been overwritten by the grub boot parameters.
检查方式
审计方法: 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- 预期输出
compliant
修复方式
修复方法: 操作指南或基础设施补丁
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)"
属性
- 操作系统
- rocky-8
- 标签
- cis-convertedlinux
- 参考
- CIS Rocky Linux 8 Benchmark v3.0.0 - 1.3.1.2
检查本机
请在您有权审计的机器上运行此命令。扫描为只读操作。
shell
tmaegis scan --target linux