Closed s-ocando closed 2 years ago
I have used the generic/rhel9 vagrant box to create the testing environment.
# cat /etc/os-release
NAME="Red Hat Enterprise Linux"
VERSION="9.0 (Plow)"
ID="rhel"
ID_LIKE="fedora"
VERSION_ID="9.0"
PLATFORM_ID="platform:el9"
PRETTY_NAME="Red Hat Enterprise Linux 9.0 (Plow)"
ANSI_COLOR="0;31"
LOGO="fedora-logo-icon"
CPE_NAME="cpe:/o:redhat:enterprise_linux:9::baseos"
HOME_URL="https://www.redhat.com/"
DOCUMENTATION_URL="https://access.redhat.com/documentation/red_hat_enterprise_linux/9/"
BUG_REPORT_URL="https://bugzilla.redhat.com/"
REDHAT_BUGZILLA_PRODUCT="Red Hat Enterprise Linux 9"
REDHAT_BUGZILLA_PRODUCT_VERSION=9.0
REDHAT_SUPPORT_PRODUCT="Red Hat Enterprise Linux"
REDHAT_SUPPORT_PRODUCT_VERSION="9.0"
requirements:
title: "Check RHEL9 family platform"
description: "Requirements for running the policy against RHEL 9 family."
condition: any
rules:
- "f:/etc/redhat-release -> r:^Red Hat Enterprise Linux && r:release 9"
- "f:/etc/redhat-release -> r:^Cloud && r:release 9"
- "f:/etc/redhat-release -> r:^Oracle && r:release 9"
- "f:/etc/redhat-release -> r:^Better && r:release 9"
- "f:/etc/redhat-release -> r:^OpenVZ && r:release 9"
The requirement for running the "CIS Benchmark for Red Hat Enterprise Linux 9" policy is met. The content of /etc/redhat-release
is:
# cat /etc/redhat-release
Red Hat Enterprise Linux release 9.0 (Plow)
Comparison between the CIS Red Hat Enterprise Linux 8 Benchmark v2.0.0 - 02-23-2022 and cis_rhel9_linux.yml
title: π’ description: π’ rationale: π΄
"Removing support for unneeded filesystem types reduces the local attack surface of the server system. If this filesystem type is not needed, disable it."
Where it says server, it should say system.
remediation: π’ cis compliance: π’
Check:
[root@Wazuh vagrant]# modprobe -n -v cramfs
modprobe: FATAL: Module cramfs not found in directory /lib/modules/5.14.0-70.13.1.el9_0.x86_64
[root@Wazuh vagrant]# lsmod | grep cramfs
[root@Wazuh vagrant]# grep -E "^blacklist\s+cramfs" /etc/modprobe.d/*
[root@Wazuh vagrant]#
Expected: PASS
Findings: π΄
This check passes thanks to the additional condition included in "c:modprobe -n -v cramfs -> r:install /bin/false|Module cramfs not found"
. According to the CIS Benchmark, the modprobe -n -v cramfs
output should be install /bin/false
, the Module cramfs not found
is not an accepted output.
cramfs
module has been removed in RHEL9. As this module is no longer present, consider removing the "1.1.1.1 Ensure mounting of cramfs filesystems is disabled" check. See Considerations in adopting RHEL 9. There is no rule for the third check included in the CIS Red Hat Enterprise Linux 8 Benchmark: grep -E "^blacklist\s+cramfs" /etc/modprobe.d/*
title: π’ description: π’ rationale: π’ remediation: π’ cis compliance: π’
Check:
[root@Wazuh vagrant]# modprobe -n -v squashfs | grep "^install"
[root@Wazuh vagrant]# lsmod | grep squashfs
[root@Wazuh vagrant]# grep -E "^blacklist\s+squashfs" /etc/modprobe.d/*
Expected: FAIL
Findings: π΄
There is no rule for the third check included in the CIS Red Hat Enterprise Linux 8 Benchmark: grep -E "^blacklist\s+squashfs" /etc/modprobe.d/*
Module squashfs not found
, not present in the CIS Benchmark, is included in the first rule "c:modprobe -n -v squashfs -> r:install /bin/true|Module squashfs not found"
title: π’ description: π’ rationale: π’ remediation: π’ cis compliance: π΄
Check:
[root@Wazuh vagrant]# modprobe -n -v udf | grep "^install"
[root@Wazuh vagrant]# lsmod | grep udf
[root@Wazuh vagrant]# grep -E "^blacklist[[:blank:]]*udf" /etc/modprobe.d/*
[root@Wazuh vagrant]#
Expected: FAIL
Findings: π΄
There is no rule for the third check included in the CIS Red Hat Enterprise Linux 8 Benchmark: grep -E "^blacklist[[:blank:]]*udf" /etc/modprobe.d/*
Module udf not found
, not present in the CIS Benchmark, is included in the first rule "c:modprobe -n -v udf -> r:install /bin/true|Module udf not found"
title: π’
description: π’
rationale: π΄
"Making /tmp its own file system allows an administrator to set additional mount options such as the noexec option on the mount, making /tmp useless for an attacker to install executable code. It would also prevent an attacker from establishing a hard link to a system setuid program and wait for it to be updated. Once the program was updated, the hard link would be broken and the attacker would have his own copy of the program. If the program happened to have a security vulnerability, the attacker could continue to exploit the known flaw. This can be accomplished by either mounting tmpfs to /tmp, or creating a separate partition for /tmp."
The highlighted text "additional mount options such as" is present in the CIS Benchmark and missing in cis_rhel9_linux.yml
.
In addition, "hardlink" must be changed to "hard link".
remediation: π’ cis compliance: π΄
Check:
[root@Wazuh vagrant]# findmnt --kernel /tmp
[root@Wazuh vagrant]# systemctl is-enabled tmp.mount
disabled
Expected: FAIL
title: π’ description: π’ rationale: π΄
"Since the /tmp filesystem is not intended to support devices, set this option to ensure that users cannot attempt to create a block or character special devices in /tmp."
The crossed-out phrase attempt to should be deleted.
"create block" should be "create a block".
remediation: π’ cis compliance: π’
[root@Wazuh vagrant]# findmnt --kernel /tmp | grep nodev
[root@Wazuh vagrant]#
Expected: FAIL
title: π’
description: π’
rationale: π’
remediation: π’
cis compliance: π’
[root@Wazuh vagrant]# findmnt --kernel /tmp | grep noexec
[root@Wazuh vagrant]#
Expected: FAIL
title: π’
description: π’
rationale: π’
remediation: π΄
"Edit the /etc/fstab file and add nosuid to the fourth field (mounting options) for the /tmp partition. Example:
There is an extra space between /tmp and the quotation mark "...remount /tmp
". The period is missing.
cis compliance: π’
[root@Wazuh vagrant]# findmnt --kernel /tmp | grep nosuid
[root@Wazuh vagrant]#
Expected: FAIL
title: π’
description: π’
rationale: π΄
"... the hard- link would be broken and the attacker would have his own copy of the program. If the program happened to have a security vulnerability, the attacker could continue to exploit the known flaw."
"hard- link" should be "hard-link".
remediation: π’ cis compliance: π’
[root@Wazuh vagrant]# findmnt --kernel /var
[root@Wazuh vagrant]#
Expected: FAIL
title: π’
description: π’
rationale: π’
remediation: π’
cis compliance: π΄
[root@Wazuh vagrant]# findmnt --kernel /var | grep nodev
[root@Wazuh vagrant]#
Expected: FAIL
title: π’
description: π’
rationale: π’
remediation: π’
cis compliance: π’
[root@Wazuh vagrant]# findmnt --kernel /var | grep noexec
[root@Wazuh vagrant]#
Expected: FAIL
title: π’
description: π’
rationale: π’
remediation: π’
cis compliance: π΄
[root@Wazuh vagrant]# findmnt --kernel /var | grep nosuid
[root@Wazuh vagrant]#
Expected: FAIL
title: π’
description: π’
rationale: π΄
"... the hard- link would be broken and the attacker would have his own copy of the program. If the program happened to have a security vulnerability, the attacker could continue to exploit the known flaw."
"hard- link" should be "hard-link".
remediation: π’
cis compliance: π’
[root@Wazuh vagrant]# findmnt --kernel /var/tmp
[root@Wazuh vagrant]#
Expected: FAIL
title: π’ description: π’ rationale: π’ remediation: π΄
"Edit the /etc/fstab file and add noexec to the fourth field (mounting options) for the /var/tmp partition."
The remediation field is incomplete. The following text is missing:
"Example:
cis compliance: π’
[root@Wazuh vagrant]# findmnt --kernel /var/tmp | grep noexec
[root@Wazuh vagrant]#
Expected: FAIL
title: π’ description: π’ rationale: π’ remediation: π’ cis compliance: π’
[root@Wazuh vagrant]# findmnt --kernel /var/tmp | grep nosuid
[root@Wazuh vagrant]#
Expected: FAIL
title: π’
description: π’
rationale: π΄
"Since the /var/tmp filesystem is not intended to support devices, set this option to ensure that users cannot attempt to create a block or character special devices in /var/tmp."
"...to ensure that users cannot attempt to create block..." should be "...to ensure that users cannot create a block..."
remediation: π’ cis compliance: π’
[root@Wazuh vagrant]# findmnt --kernel /var/tmp | grep nodev
[root@Wazuh vagrant]#
Expected: FAIL
title: π’ description: π’ rationale: π΄
"...the hard- link would be broken and the attacker would have..."
"hard- link" should be "hard-link".
remediation: π’ cis compliance: :yellow_circle:
cis_csc
values follow the order [v8, v7]. In this case, they are inverted. [root@Wazuh vagrant]# findmnt --kernel /var/log
[root@Wazuh vagrant]#
Expected: FAIL
title: π’
description: π’
rationale: π’
remediation: π’
cis compliance: π’
[root@Wazuh vagrant]# findmnt --kernel /var/log | grep nodev
[root@Wazuh vagrant]#
Expected: FAIL
title: π’
description: π’
rationale: π’
remediation: π’
cis compliance: π’
[root@Wazuh vagrant]# findmnt --kernel /var/log | grep noexec
[root@Wazuh vagrant]#
Expected: FAIL
title: π’
description: π’
rationale: π’
remediation: π’
cis compliance: π’
[root@Wazuh vagrant]# findmnt --kernel /var/log | grep nosuid
[root@Wazuh vagrant]#
Expected: FAIL
title: π’
description: π’
rationale: :yellow_circle:
"...the hard- link would be broken and the attacker would have his own copy of the program..."
"hard- link" should be "hard-link".
remediation: π’ cis compliance: :yellow_circle:
cis_csc
values follow the order [v8, v7]. In this case, they are inverted. [root@Wazuh vagrant]# findmnt --kernel /var/log/audit
[root@Wazuh vagrant]#
Expected: FAIL
title: π’
description: π’
rationale: π’
remediation: π’
cis compliance: π’
[root@Wazuh vagrant]# findmnt --kernel /var/log/audit | grep noexec
[root@Wazuh vagrant]#
Expected: FAIL
title: π’
description: π’
rationale: π’
remediation: π’
cis compliance: π’
[root@Wazuh vagrant]# findmnt --kernel /var/log/audit | grep nodev
[root@Wazuh vagrant]#
Expected: FAIL
title: π’
description: π’
rationale: π’
remediation: π’
cis compliance:
[root@Wazuh vagrant]# findmnt --kernel /var/log/audit | grep nosuid
[root@Wazuh vagrant]#
Expected: FAIL
title: π΄ "Ensure separate partition exists for /var/log/audit." should be "Ensure separate partition exists for /home."
description: π’ rationale: π΄
"the hard- link would be broken and the attacker"
"hard- link" should be "hard-link".
remediation: π’ cis compliance: π’
[root@Wazuh vagrant]# findmnt --kernel /home
[root@Wazuh vagrant]#
Expected: FAIL
title: π’
description: π’
rationale: :yellow_circle: The rationales differ but the one in the cis_rhel9_linux.yml
document seems to be the right one.
cis_rhel9_linux.yml: "Since the /home filesystem is not intended to support devices, set this option to ensure that users cannot create a block or character special devices in /home." CIS Benchmark: "Since the /home filesystem is not intended to support devices, set this option to ensure that users cannot create a block or character special devices in /var"
The CIS Red Hat Enterprise Linux 8 Benchmark v2.0.0 rationale seems to be incorrect as it refers to /var.
remediation: π’ cis compliance: π’
[root@Wazuh vagrant]# findmnt --kernel /home | grep nodev
[root@Wazuh vagrant]#
Expected: FAIL
title: π’
description: π’
rationale: π’
remediation:
cis compliance: π’
[root@Wazuh vagrant]# findmnt --kernel /home | grep nosuid
[root@Wazuh vagrant]#
Expected: FAIL
title: π’
description: π’
rationale: π’
remediation: π΄
"...Enable quotas on the partition: # quotaon -vug /home /dev/sdb [/home]: group quotas turned on /dev/sdb [/home]: user quotas turned on "
There is an extra space between on and the quotation mark "... turned on
". The period is missing.
cis compliance: π’
[root@Wazuh vagrant]# findmnt --kernel /home | grep usrquota
[root@Wazuh vagrant]#
Expected: FAIL
Findings: π΄
cis_rhel9_linux.yml
is only verifying that the usrquota option is set for the /home mount, but is not verifying that quotas is enabled. # quotaon -p /home | grep user
user quota on /home (/dev/sdb) is on
title: π’
description: π’
rationale: π’
remediation: π΄
"...group quotas turned on /dev/sdb [/home]: user quotas turned on "
There is an extra space between on and the quotation mark "... turned on
". The period is missing.
cis compliance: π’
[root@Wazuh vagrant]# findmnt --kernel /home | grep grpquota
[root@Wazuh vagrant]#
Expected: FAIL
Findings: π΄
cis_rhel9_linux.yml
is only verifying that the grpquota option is set, but is not verifying that quotas is enabled. # quotaon -p /home | grep group
user quota on /home (/dev/sdb) is on
The output off the command seems to be wrong in the CIS benchmark document. Note that the command is looking for "group" which is not present in the output.
title: π’
description: π’
rationale: π’
remediation: π’
cis compliance: π’
[root@Wazuh vagrant]# mount | grep -E '\s/dev/shm\s' | grep -v nodev
[root@Wazuh vagrant]#
Expected: FAIL
title: π’
description: π’
rationale: π’
remediation: π’
cis compliance: π’
[root@Wazuh vagrant]# findmnt --kernel /dev/shm | grep noexec
[root@Wazuh vagrant]#
Expected: FAIL
title: π’
description: π’
rationale: π’
remediation: π’
cis compliance: π’
[root@Wazuh vagrant]# mount | grep -E '\s/dev/shm\s' | grep -v nosuid
[root@Wazuh vagrant]#
Expected: FAIL
title: π’
description: π’
rationale: π’
remediation: π’
cis compliance: π’
[root@Wazuh vagrant]# systemctl is-enabled autofs
Failed to get unit file state for autofs.service: No such file or directory
Expected: PASS
title: π’
description: π’
rationale: π’
remediation: π΄
"Edit or create a file in the /etc/modprobe.d/ directory ending in .conf Example: vim /etc/modprobe.d/usb-storage.conf and add the following line: install usb-storage /bin/true Run the following command to unload the usb-storage module: # rmmod usb-storage"
There are extra spaces between "/bin/true" and "Run": "/bin/true`Run". In "...module: # rmmod..." the
#` symbol is not present in the CIS Benchmark document. The period is missing.
cis compliance: π’
[root@Wazuh vagrant]# modprobe -n -v usb-storage
insmod /lib/modules/5.14.0-70.13.1.el9_0.x86_64/kernel/drivers/usb/storage/usb-storage.ko.xz
Expected: PASS
(With the current rule that does not correspond to the CIS Benchmark audit).
Findings:
install usb-storage /bin/true
. title: π’ description: π΄
"The gpgcheck option, found in the main section of the /etc/yum.conf /etc/dnf/dnf.conf
and individual /etc/yum/repos.d/* files determines if an RPM package's signature is checked prior to its installation."
"/etc/yum.conf" should be "/etc/dnf/dnf.conf".
rationale: π’
remediation: π΄
"Edit /etc/yum.conf and set ' gpgcheck=1 ' in the [main] section. Example: # sed -i 's/^gpgcheck\s=\s./gpgcheck=1/' /etc/dnf/dnf.conf Edit any failing files in /etc/yum.repos.d/ and set all instances of gpgcheck to ' 1 ' Example: # find /etc/yum.repos.d/ -name \".repo\" -exec echo \"Checking:\" {} \; -exec sed -i 's/^gpgcheck\s=\s./gpgcheck=1/' {} \;."
As in the description, "/etc/yum.conf" should be "/etc/dnf/dnf.conf".
cis compliance: :yellow_circle:
[root@Wazuh vagrant]# grep ^gpgcheck /etc/dnf/dnf.conf
gpgcheck=1
[root@Wazuh vagrant]# grep -P "^gpgcheck\h*=\h*[^1].*\h*$" /etc/yum.repos.d/*
[root@Wazuh vagrant]#
Expected: PASS
title: π’
description: π’
rationale: π’
remediation: π’
cis compliance: π’
[root@Wazuh vagrant]# rpm -q aide
package aide is not installed
Expected: FAIL
This check is divided in A and B. Check A verifies that aidcheck.service and aidcheck.timer are enabled and that aidcheck.timer is running. On the other hand, check B verifies that a cron job is scheduled to run the aide check.
title: π’
description: π’
rationale: π’
remediation: π΄
"If cron will be used to schedule and run aide check. Run the following command: # crontab -u root -e Add the following line to the crontab: 0 5 /usr/sbin/aide --check OR if aidecheck.service and aidecheck.timer will be used to schedule and run aide check: Create or edit the file /etc/systemd/system/aidecheck.service and add the following lines
:[Unit] Description=Aide Check [Service] Type=simple ExecStart=/usr/sbin/aide --check [Install] WantedBy=multi-user.target. Create or edit the file /etc/systemd/system/aidecheck.timer and add the following lines
: [Unit] Description=Aide check every day at 5AM [Timer] OnCalendar=-- 05:00:00 Unit=aidecheck.service [Install] WantedBy=multi-user.target. Run the following commands: # chown root:root /etc/systemd/system/aidecheck. # chmod 0644 /etc/systemd/system/aidecheck. # systemctl daemon-reload # systemctl enable aidecheck.service # systemctl --now enable aidecheck.timer"
The sentence and add the following lines
is included in the CIS Benchmark document and is missing in the cis_rhel9_linux.yml
remediation for "Ensure filesystem integrity is regularly checked (A)".
π΄ The remediation in the "Ensure filesystem integrity is regularly checked (B)" check differs from the one included in the CIS Benchmark document.
cis compliance: π΄ Check A: π’ Check B: π΄
π΄ Note that pci_dss, nist_800_53 and tsc checks differ between check A and check B.
[root@Wazuh vagrant]# systemctl is-enabled aidecheck.service
Failed to get unit file state for aidecheck.service: No such file or directory
[root@Wazuh vagrant]# systemctl is-enabled aidecheck.timer
Failed to get unit file state for aidecheck.timer: No such file or directory
[root@Wazuh vagrant]# systemctl status aidecheck.timer
Unit aidecheck.timer could not be found.
[root@Wazuh vagrant]# crontab -u root -l
no crontab for root
[root@Wazuh vagrant]# grep -r aide /etc/cron.* /etc/crontab
Expected: FAIL
title: π’
description: π’
rationale: π’
remediation: π’
cis compliance: :yellow_circle:
[root@Wazuh vagrant]# grep -r /systemd-sulogin-shell /usr/lib/systemd/system/rescue.service
/etc/systemd/system/rescue.service.d
ExecStart=-/usr/lib/systemd/systemd-sulogin-shell rescue
Expected: PASS
title: π’
description: π’
rationale: π’
remediation: π’
cis compliance: π’
[root@Wazuh vagrant]# grep -i '^\s*storage\s*=\s*none' /etc/systemd/coredump.conf
[root@Wazuh vagrant]#
Expected: FAIL
title: π’
description: π’
rationale: π’
remediation: π’
cis compliance: π’
[root@Wazuh vagrant]# grep -i '^\s*ProcessSizeMax\s*=\s*0' /etc/systemd/coredump.conf
[root@Wazuh vagrant]#
Expected: FAIL
.
Default Value: ProcessSizeMax=2G
title: π’
description: π’
rationale: π’
remediation: π΄
'...parameter:# sysctl -w kernel.randomize_va_space=2 '
There's an extra space between "kernel.randomize_va_space=2" and the quotation mark.
cis compliance: :yellow_circle:
#!/usr/bin/env bash
{
krp="" pafile="" fafile=""
kpname="kernel.randomize_va_space"
kpvalue="2"
searchloc="/run/sysctl.d/*.conf /etc/sysctl.d/*.conf /usr/local/lib/sysctl.d/*.conf /usr/lib/sysctl.d/*.conf /lib/sysctl.d/*.conf /etc/sysctl.conf"
krp="$(sysctl "$kpname" | awk -F= '{print $2}' | xargs)"
pafile="$(grep -Psl -- "^\h*$kpname\h*=\h*$kpvalue\b\h*(#.*)?$" $searchloc)"
fafile="$(grep -s -- "^\s*$kpname" $searchloc | grep -Pv -- "\h*=\h*$kpvalue\b\h*" | awk -F: '{print $1}')"
if [ "$krp" = "$kpvalue" ] && [ -n "$pafile" ] && [ -z "$fafile" ]; then
echo -e "\nPASS:\n\"$kpname\" is set to \"$kpvalue\" in the running configuration and in \"$pafile\""
else
echo -e "\nFAIL: "
[ "$krp" != "$kpvalue" ] && echo -e "\"$kpname\" is set to \"$krp\" in the running configuration\n"
[ -n "$fafile" ] && echo -e "\n\"$kpname\" is set incorrectly in \"$fafile\""
[ -z "$pafile" ] && echo -e "\n\"$kpname = $kpvalue\" is not set in a kernel parameter configuration file\n"
fi
}
[root@Wazuh vagrant]# bash 1.5.3_test.sh
FAIL:
"kernel.randomize_va_space = 2" is not set in a kernel parameter configuration file
Expected: FAIL
title: π’
description: π’
rationale: π’
remediation: π’
cis compliance: π’
[root@Wazuh vagrant]# rpm -q libselinux
libselinux-3.3-2.el9.x86_64
Expected: PASS
title: π’
description: π’
rationale: π’
remediation: π’
cis compliance: π’
[root@Wazuh vagrant]# cat /boot/grub2/grubenv | grep -e kernelopts=\.*selinux=0
[root@Wazuh vagrant]# cat /boot/grub2/grubenv | grep -e kernelopts=\.*enforcing=0
[root@Wazuh vagrant]#
Expected: PASS
Findings: :yellow_circle:
The cis_rhel9_linux.yml
rule 'f:/boot/grub2/grubenv -> r:kernelopts=\.*selinux=0|kernelopts=\.*enforcing=0'
only checks /boot/grub2/grubenv
. According to the CIS Benchmark the grub.cfg
file should also be checked as well as any other file following the criteria find /boot -type f \( -name 'grubenv' -o -name 'grub.conf' -o -name 'grub.cfg' \)
.
[root@Wazuh vagrant]# find /boot -type f \( -name 'grubenv' -o -name 'grub.conf' -o -name 'grub.cfg' \)
/boot/grub2/grubenv
/boot/grub2/grub.cfg
title: π’
description: π’
rationale: π’
remediation: π’
cis compliance: π’
[root@Wazuh vagrant]# grep -E '^\s*SELINUXTYPE=(targeted|mls)\b' /etc/selinux/config
SELINUXTYPE=targeted
[root@Wazuh vagrant]# sestatus | grep Loaded
Loaded policy name: targeted
Expected: PASS
title: π’ description: :yellow_circle:
" SELinux can run..." There's an extra space between the quotation mark and "SELinux".
rationale: π’ remediation: :yellow_circle:
"...For Enforcing mode: SELINUX=enforcing OR For Permissive mode: SELINUX=permissive " There's an extra space between "permissive" and the quotation mark.
cis compliance: π’
[root@Wazuh vagrant]# getenforce
Enforcing
[root@Wazuh vagrant]# grep -Ei '^\s*SELINUX=(enforcing|permissive)' /etc/selinux/config
SELINUX=enforcing
Expected: PASS
title: π΄
Ensure the SELinux state mode is enforcing
"SELinux state" should be "SELinux mode".
description: :yellow_circle:
" SELinux can run..."
"... httpd_t domain permissive: # semanage permissive -a httpd_t "
There's an extra space between the quotation mark and "SELinux" and between "httpd_t" and the quotation mark.
rationale: :yellow_circle:
cis_rhel9_linux.yml: "Running SELinux in disabled mode is strongly discouraged; not only does the system avoid enforcing the SELinux policy, it also avoids labeling any persistent objects such as files, making it difficult to enable SELinux in the future. Running SELinux in Permissive mode, though helpful for developing SELinux policy, only logs access denial entries, but does not deny any operations."
CIS Benchmark: "Running SELinux in disabled mode the system not only avoids enforcing the SELinux policy, it also avoids labeling any persistent objects such as files, making it difficult to enable SELinux in the future. Running SELinux in Permissive mode, though helpful for developing SELinux policy, only logs access denial entries, but does not deny any operations."
remediation: :yellow_circle:
"...SELINUX=enforcing. "
There's an extra space between "enforcing." and the quotation mark.
cis compliance: π’
[root@Wazuh vagrant]# getenforce
Enforcing
[root@Wazuh vagrant]# grep -i SELINUX=enforcing /etc/selinux/config
SELINUX=enforcing
Expected: PASS
title: π’ description: π’ rationale: :yellow_circle:
"...SELinux is a security enhancement on top of DAC rules β it does not replace them"
The period is missing.
remediation: π’ cis compliance: π’
[root@Wazuh vagrant]# ps -eZ | grep unconfined_service_t
system_u:system_r:unconfined_service_t:s0 936 ? 00:00:15 VBoxService
Expected: FAIL
title: π’
description: π’
rationale: π’
remediation: π’
cis compliance: π’
[root@Wazuh vagrant]# rpm -q setroubleshoot
package setroubleshoot is not installed
Expected: PASS
title: π’
description: π’
rationale: π’
remediation: π’
cis compliance: π’
[root@Wazuh vagrant]# rpm -q mcstrans
package mcstrans is not installed
Expected: PASS
title: π’
description: π’
rationale: π’
remediation: :yellow_circle:
"...or references to the OS platform OR If the motd is not used, this file can be removed."
There are extra spaces before and after "OR".
cis compliance: π’
[root@Wazuh vagrant]# cat /etc/motd | grep -E -i "(\\\v|\\\r|\\\m|\\\s)"
[root@Wazuh vagrant]#
Expected: PASS
Findings: π΄
'f:/etc/motd -> r:\\v|\\r|\\m|\\s'
does not include a check looking for the OS name included in the CIS Benchmark command. [root@Wazuh vagrant]# grep '^ID=' /etc/os-release | cut -d= -f2 | sed -e 's/"//g'
rhel
CIS Benchmark audit:
grep -E -i "(\\\v|\\\r|\\\m|\\\s|$(grep '^ID=' /etc/os-release | cut -d= -f2 | sed -e 's/"//g'))" /etc/motd
title: π’ description: π΄
"The contents of the /etc/issue file are displayed to users prior to login for local terminals. Unix-based systems have typically displayed information about the OS release and patch level upon logging in to the system. This information can be useful to developers who are developing software for a particular OS platform. If mingetty(8) supports the following options, they display operating system information: \m - machine architecture \r - operating system release \s - operating system name \v - operating system version"
The description is missing the final phrase "- or the operating system's name"
rationale: π’
remediation: :yellow_circle:
"...OS platform:"
The :
is not present in the CIS Benchmark document.
cis compliance: π’
[root@Wazuh vagrant]# cat /etc/issue | grep -E -i "(\\\v|\\\r|\\\m|\\\s|$(grep '^ID=' /etc/os-release | cut -d= -f2 | sed -e 's/"//g'))"
\S
Kernel \r on an \m
Expected: FAIL
Findings: π΄
'f:/etc/issue -> r:\\v|\\r|\\m|\\s'
does not include a check looking for the OS name included in the CIS Benchmark command. title: π’
description: π’
rationale: π’
remediation: π’
cis compliance: π’
[root@Wazuh vagrant]# cat /etc/issue.net | grep -E -i "(\\\v|\\\r|\\\m|\\\s|$(grep '^ID=' /etc/os-release | cut -d= -f2 | sed -e 's/"//g'))"
\S
Kernel \r on an \m
Expected: FAIL
Findings: π΄
f:/etc/issue.net -> r:\\v|\\r|\\m|\\s'
does not include a check looking for the OS name included in the CIS Benchmark command. title: π’
description: π’
rationale: π’
remediation: π’
cis compliance: π’
[root@Wazuh vagrant]# stat -L /etc/motd
File: /etc/motd
Size: 0 Blocks: 0 IO Block: 4096 regular empty file
Device: fd00h/64768d Inode: 134346435 Links: 1
Access: (0644/-rw-r--r--) Uid: ( 0/ root) Gid: ( 0/ root)
Context: system_u:object_r:etc_t:s0
Access: 2022-07-15 11:17:26.709792077 +0000
Modify: 2022-05-27 05:13:44.145798344 +0000
Change: 2022-05-27 05:13:44.145798344 +0000
Birth: 2022-05-27 04:56:07.287003754 +0000
Expected: PASS
title: π’ description: π’ rationale: π’ remediation: π’ cis compliance: π’
[root@Wazuh vagrant]# stat /etc/issue
File: /etc/issue
Size: 23 Blocks: 8 IO Block: 4096 regular file
Device: fd00h/64768d Inode: 134346408 Links: 1
Access: (0644/-rw-r--r--) Uid: ( 0/ root) Gid: ( 0/ root)
Context: system_u:object_r:etc_t:s0
Access: 2022-07-18 08:34:23.745898172 +0000
Modify: 2022-04-06 15:03:54.000000000 +0000
Change: 2022-07-18 08:34:18.520000061 +0000
Birth: 2022-05-27 04:56:07.240003697 +0000
Expected: PASS
title: π’
description: π’
rationale: π’
remediation: π’
cis compliance: π’
[root@Wazuh vagrant]# stat /etc/issue.net
File: /etc/issue.net
Size: 22 Blocks: 8 IO Block: 4096 regular file
Device: fd00h/64768d Inode: 134346409 Links: 1
Access: (0644/-rw-r--r--) Uid: ( 0/ root) Gid: ( 0/ root)
Context: system_u:object_r:etc_t:s0
Access: 2022-07-18 09:57:22.341484421 +0000
Modify: 2022-04-06 15:03:54.000000000 +0000
Change: 2022-05-27 04:56:07.240003697 +0000
Birth: 2022-05-27 04:56:07.240003697 +0000
Expected: PASS
title: π’
description: π’
rationale: π’
remediation: :yellow_circle:
"Run the following command to remove the gdm package # dnf remove gdm.'"
There's an extra '
at the end of the sentence.
cis compliance: :yellow_circle:
[root@Wazuh vagrant]# rpm -q gdm
package gdm is not installed
Expected: PASS
title: π’
description: π’
rationale: π’
remediation:
cis compliance: π’
[root@Wazuh vagrant]# cat /etc/dconf/profile/gdm
cat: /etc/dconf/profile/gdm: No such file or directory
Expected: FAIL
title: π’
description: π’
rationale: :yellow_circle:
"...on the system, consult your documentation to disable displaying the last logged on user. "
There's an extra space between user. and the quotation mark.
remediation: :yellow_circle:
"...databases: # dconf update "
There's an extra space between update and the quotation mark.
cis compliance: π’
[root@Wazuh vagrant]# cat /etc/dconf/profile/gdm
cat: /etc/dconf/profile/gdm: No such file or directory
Expected: FAIL
title: π’
description: π’
rationale: π’
remediation: :yellow_circle:
"Edit the file /etc/gdm/custom.conf and remove the line Enable=true. "
There's an extra space between Enable=true. and the quotation mark.
cis compliance: π’
[root@Wazuh vagrant]# grep -Eis '^\s*Enable\s*=\s*true' /etc/gdm/custom.conf
[root@Wazuh vagrant]#
Expected: PASS
based on the CIS audit. FAIL
with the current rules.
Findings: π΄
cis_rhel9_linux.yml rules:
condition: all
rules:
- "f:/etc/gdm/custom.conf"
- 'c:egrep -Eis "^\s{0,}Enable\s{0,}=\s{0,}true" /etc/gdm/custom.conf -> r:^\s*Enable\s*=\s*true'
CIS benchmark audit:
# grep -Eis '^\s*Enable\s*=\s*true' /etc/gdm/custom.conf
Nothing should be returned
The second rule looks for Enable = true
while the CIS benchmark audit states that nothing should be returned.
On the other hand, the CIS audit command does not verify that the file exists.
title: π’ description: π’ rationale: :yellow_circle:
"...to mount it themselves. "
There's an extra space between themselves. and the quotation mark.
remediation: π’ cis compliance: :yellow_circle:
[root@Wazuh vagrant]# gsettings get org.gnome.desktop.media-handling automount
No schemas installed
Expected: FAIL
title: π’
description: π’
rationale: π’
remediation: :yellow_circle:
"Use your package manager to update all packages on the system according to site policy. The following command will install all available security updates: # dnf update"
The word security is not present in the CIS Benchmark rationale.
cis compliance: :yellow_circle:
[root@Wazuh vagrant]# dnf check-update
Last metadata expiration check: 0:00:14 ago on Tue 19 Jul 2022 09:01:05 AM UTC.
Expected: PASS
Findings: :yellow_circle:
title: π’
description: π’
rationale: π’
remediation: :π΄
remediation: "Run the following command to change the system-wide crypto policy # update-crypto-policies --set `Example:
# update-crypto-policies --set DEFAULT
Run the following to make the updated system-wide crypto policy active
# update-crypto-policies
.`"
There are many blank spaces in the remediation. A period is missing.
cis compliance: π’
[root@Wazuh vagrant]# grep -E -i '^\s*LEGACY\s*(\s+#.*)?$' /etc/crypto-policies/config
[root@Wazuh vagrant]#
Expected: PASS
title: π’
description: :yellow_circle:
"... If another method for time synchronization is being used, this section may be skipped. "
There's an extra space between skipped. and the quotation mark.
rationale: π’
remediation: π’
cis compliance: :yellow_circle:
[root@Wazuh vagrant]# rpm -q chrony
chrony-4.1-3.el9.x86_64
Expected: PASS
title: π’
description: π’
rationale: π’
remediation: π’
cis compliance: :yellow_circle:
[root@Wazuh vagrant]# grep -E "^(server|pool)" /etc/chrony.conf
pool 2.rhel.pool.ntp.org iburst
[root@Wazuh vagrant]# grep ^OPTIONS /etc/sysconfig/chronyd
OPTIONS="-F 2"
Expected: FAIL
Findings: π΄
f:/etc/chrony.conf -> r:server
does not allow the pool option as does the CIS audit command: grep -E "^(server|pool)" /etc/chrony.conf
. The pool option can be used to specify a pool of NTP servers rather than a single NTP server. For more information, see https://chrony.tuxfamily.org/doc/4.2/chrony.conf.html#pool.
title: π’
description: π’
rationale: π΄
"If there are no xinetd services required, it is recommended that the daemon be disabled the package be removed to reduce the attack surface are of the system. Note: If an xinetd service or services are required, ensure that any xinetd service not required is stopped and disabled."
The rationale differs from that of the CIS Benchmark document.
remediation: π’ cis compliance: :yellow_circle:
[root@Wazuh vagrant]# rpm -q xinetd
package xinetd is not installed
Expected: PASS
title: π’
description: π’
rationale: π’
remediation: π’
cis compliance: π’
[root@Wazuh vagrant]# rpm -q xorg-x11-server-common
package xorg-x11-server-common is not installed
Expected: PASS
Findings: π΄
c:rpm -q xorg-x11-server-common -> r:^package xinetd is not installed
looks for the wrong output. The output should be "package xorg-x11-server-common is not installed". title: π’
description: π’
rationale: π΄
"Automatic discovery of network services is not normally required for system functionality. It is recommended to disable remove the service this package to reduce the potential attack surface."
The rationale differs from that of the CIS Benchmark document.
remediation: π’ cis compliance: π’
[root@Wazuh vagrant]# rpm -q avahi-autoipd avahi
package avahi-autoipd is not installed
package avahi is not installed
Expected: PASS
title: π΄
There's a typo in the title: "Ensure CUPS is not isntalled installed."
description: π’ rationale: π’ remediation: :yellow_circle:
"If the system does not need to print jobs or accept print jobs from other systems, it is recommended that CUPS be removed to reduce the potential attack surface. Note: Removing CUPS will prevent printing from the system"
A period is missing.
cis compliance: :yellow_circle:
"Run the following command to remove cups: # dnf remove cups"
A period is missing.
[root@Wazuh vagrant]# rpm -q cups
package cups is not installed
Expected: PASS
title: π’
description: π’
rationale: :yellow_circle:
The rationale is different from that of the CIS Benchmark document but seems correct.
remediation: π’ cis compliance: π’
[root@Wazuh vagrant]# rpm -q dhcp-server
package dhcp-server is not installed
Expected: PASS
title: π’
description: π’
rationale: π΄
"Unless a system is specifically designated to act as a DNS server, it is recommended that the service be disabled package be removed to reduce the potential attack surface."
The rationale differs from that of the CIS Benchmark document.
remediation: π’ cis compliance: π’
[root@Wazuh vagrant]# rpm -q bind
package bind is not installed
Expected: PASS
title: π’
description: π’
rationale: π΄
"FTP does not protect the confidentiality of data or authentication credentials. It is recommended SFTP be used if file transfer is required. Unless there is a need to run the system as a FTP server (for example, to allow anonymous downloads), it is recommended that the service be disabled package be removed to reduce the potential attack surface."
The rationale differs from that of the CIS Benchmark document.
remediation: π’ cis compliance: π’
[root@Wazuh vagrant]# rpm -q ftp
package ftp is not installed
Expected: PASS
title: π’
description: π’
rationale: π’
remediation: π’
cis compliance: π’
[root@Wazuh vagrant]# rpm -q vsftpd
package vsftpd is not installed
Expected: PASS
title: π’
description: π’
rationale: π’
remediation: π’
cis compliance: π’
[root@Wazuh vagrant]# rpm -q tftp-server
package tftp-server is not installed
Expected: PASS
title: π’
description: π’
rationale: π’
remediation: π’
cis compliance: π’
[root@Wazuh vagrant]# rpm -q httpd nginx
package httpd is not installed
package nginx is not installed
Expected: PASS
title: π’
description: π’
rationale: π΄
"Unless POP3 and/or IMAP servers are to be provided by this system, it is recommended that the service be disabled package be removed to reduce the potential attack surface. Note: Several IMAP/POP3 servers exist and can use other service names. These should also be audited and the packages removed if not required."
remediation: π’ cis compliance: π’
[root@Wazuh vagrant]# rpm -q dovecot cyrus-imapd
package dovecot is not installed
package cyrus-imapd is not installed
Expected: PASS
title: π΄
Ensure Samba is not enabled installed.
description: π΄
"The Samba daemon allows system administrators to configure their Linux systems to share file systems and directories with Windows desktops. Samba will advertise the file systems and directories via the Small Server Message Block (SMB) protocol. Windows desktop users will be able to mount these directories and file systems as letter drives on their systems."
rationale: π΄
"If there is no need to mount directories and file systems to Windows systems, then this service can be disabled package can be removed to reduce the potential attack surface."
remediation: π’ cis compliance: π’
[root@Wazuh vagrant]# rpm -q samba
package samba is not installed
Expected: PASS
title: π’
description: π’
rationale: π’
remediation: π’
cis compliance: π’
[root@Wazuh vagrant]# rpm -q squid
package squid is not installed
Expected: PASS
title: π’ description: π’ rationale: π’ remediation: π’ cis compliance: :yellow_circle:
[root@Wazuh vagrant]# rpm -q net-snmp
package net-snmp is not installed
Expected: PASS
title: π’
description: π’
rationale: π΄
"The NIS service is inherently an insecure system that has been vulnerable to DOS attacks, buffer overflows and has poor authentication for querying NIS maps. NIS generally has been replaced by such protocols as Lightweight Directory Access Protocol (LDAP). It is recommended that the service be disabled and other, the ypserv package be removed, and if required a more secure services be used."
The rationale differs from that of the CIS Benchmark document.
remediation: π’ cis compliance: :yellow_circle:
[root@Wazuh vagrant]# rpm -q ypserv
package ypserv is not installed
Expected: PASS
title: π’
description: π’
rationale: π’
remediation: π’
cis compliance: :yellow_circle:
[root@Wazuh vagrant]# rpm -q telnet-server
package telnet-server is not installed
Expected: PASS
title: π’
description: π’
rationale: π’
remediation: :yellow_circle:
"Run the following command to restart postfix:: # systemctl restart postfix"
There's a double :
after "posfix": posfix::
. A period is missing.
cis compliance: π’
[root@Wazuh vagrant]# ss -lntu | grep -E ':25\s' | grep -E -v '\s(127.0.0.1|\[?::1\]?):25\s'
[root@Wazuh vagrant]#
Expected: PASS
title: π’
description: π’
rationale: π’
remediation: π’
cis compliance: π’
[root@Wazuh vagrant]# rpm -q nfs-utils
package nfs-utils is not installed
[root@Wazuh vagrant]# systemctl is-enabled nfs-server
Failed to get unit file state for nfs-server.service: No such file or directory
Expected: PASS
title: π΄
cis_rhel9_linux.yml: "Ensure RPC is not enabled."
CIS Benchmark document: "Ensure rpcbind is not installed or the rpcbind services are masked."
description: π’
rationale: π’
remediation: π’
Note: It differs from the CIS remediation as it corrects an error in the document that says to uninstall the wrong package nfs-utils.
cis compliance: π’
[root@Wazuh vagrant]# rpm -q rpcbind
package rpcbind is not installed
[root@Wazuh vagrant]# systemctl is-enabled rpcbind
Failed to get unit file state for rpcbind.service: No such file or directory
[root@Wazuh vagrant]# systemctl is-enabled rpcbind.socket
Failed to get unit file state for rpcbind.socket: No such file or directory
Expected: PASS
Findings: π΄
If the rpcbind package is required as a dependency, the CIS requires both rpcbind and rpcbind.socket services to be masked.
With the current rules, we are checking that at least one of the services is masked (should be both).
condition: any
rules:
- "c:rpm -q rpcbind -> r:^package rpcbind is not installed"
- "c:systemctl is-enabled rpcbind -> r:masked|No such file or directory"
- "c:systemctl is-enabled rpcbind.socket -> r:masked|No such file or directory"
title: π’
description: π’
rationale: π’
remediation: π’
cis compliance: π’
[root@Wazuh vagrant]# rpm -q rsync
package rsync is not installed
[root@Wazuh vagrant]# systemctl is-enabled rsyncd
Failed to get unit file state for rsyncd.service: No such file or directory
Expected: PASS
title: π’
description: π’
rationale: π’
remediation: π΄
"Run the following command to uninstall remove the ypbind package: # dnf remove ypbind"
cis compliance: :yellow_circle:
[root@Wazuh vagrant]# rpm -q ypbind
package ypbind is not installed
Expected: PASS
Finding: π΄
The rule is looking for the wrong output "package rsync is not installed". It should be ypbind not rsync.
rules:
- "c:rpm -q ypbind -> r:^package rsync is not installed"
title: π’
description: π’
rationale: π’
remediation: π’
cis compliance: :yellow_circle:
[root@Wazuh vagrant]# rpm -q rsh
package rsh is not installed
Expected: PASS
title: π’
description: π’
rationale: π’
remediation: π΄
"Run the following command to remove the rsh talk package: # dnf remove rsh talk."
cis compliance: :yellow_circle:
[root@Wazuh vagrant]# rpm -q talk
package talk is not installed
Expected: PASS
title: π’
description: π’
rationale: π’
remediation: π΄
Run the following command to uninstall telnet remove the telnet package: # dnf remove telnet
cis compliance: :yellow_circle:
[root@Wazuh vagrant]# rpm -q telnet
telnet-0.17-85.el9.x86_64
Expected: FAIL
title: π’
description: π’
rationale: π’
remediation: π’
cis compliance: :yellow_circle:
[root@Wazuh vagrant]# rpm -q openldap-clients
package openldap-clients is not installed
Expected: PASS
title: π’
description: π’
rationale: π’
remediation: π’
cis compliance: π’
[root@Wazuh vagrant]# rpm -q tftp
package tftp is not installed
Expected: PASS
title: π’
description: π’
rationale: π’
remediation: π’
cis compliance: π’
[root@Wazuh vagrant]# modprobe -n -v sctp
modprobe: FATAL: Module sctp not found in directory /lib/modules/5.14.0-70.13.1.el9_0.x86_64
[root@Wazuh vagrant]# lsmod | grep sctp
[root@Wazuh vagrant]#
Expected: PASS
title: π’
description: π’
rationale: π’
remediation: π’
cis compliance: π’
[root@Wazuh vagrant]# modprobe -n -v dccp
modprobe: FATAL: Module dccp not found in directory /lib/modules/5.14.0-70.13.1.el9_0.x86_64
[root@Wazuh vagrant]# lsmod | grep dccp
[root@Wazuh vagrant]#
Expected: PASS
title: π’
description: π’
rationale: π΄
"If wireless is not to be used, wireless devices can should be disabled to reduce the potential attack surface."
remediation: π’ cis compliance: π’
[root@Wazuh vagrant]# bash 3.1.4_audit_script.sh
WIFI-HW WIFI WWAN-HW WWAN
enabled enabled enabled enabled
[root@Wazuh vagrant]# nmcli radio wifi
enabled
[root@Wazuh vagrant]# nmcli radio wwan
enabled
Expected: FAIL
title: π’
description: π’
rationale: π’
remediation: π’
cis compliance: π’
CIS audit scripts and outputs:
#!/usr/bin/env bash
{
krp="" pafile="" fafile=""
kpname="net.ipv4.ip_forward"
kpvalue="0"
searchloc="/run/sysctl.d/*.conf /etc/sysctl.d/*.conf usr/local/lib/sysctl.d/*.conf /usr/lib/sysctl.d/*.conf /lib/sysctl.d/*.conf /etc/sysctl.conf"
krp="$(sysctl "$kpname" | awk -F= '{print $2}' | xargs)"
pafile="$(grep -Psl -- "^\h*$kpname\h*=\h*$kpvalue\b\h*(#.*)?$" $searchloc)"
fafile="$(grep -s -- "^\s*$kpname" $searchloc | grep -Pv -- "\h*=\h*$kpvalue\b\h*" | awk -F: '{print $1}')"
if [ "$krp" = "$kpvalue" ] && [ -n "$pafile" ] && [ -z "$fafile" ]; then
echo -e "\nPASS:\n\"$kpname\" is set to \"$kpvalue\" in the running configuration and in \"$pafile\""
else
echo -e "\nFAIL: "
[ "$krp" != "$kpvalue" ] && echo -e "\"$kpname\" is set to \"$krp\" in the running configuration\n"
[ -n "$fafile" ] && echo -e "\n\"$kpname\" is set incorrectly in \"$fafile\""
[ -z "$pafile" ] && echo -e "\n\"$kpname = $kpvalue\" is not set in a kernel parameter configuration file\n"
fi
}
[root@Wazuh vagrant]# bash test_3.2.1.sh
FAIL:
"net.ipv4.ip_forward = 0" is not set in a kernel parameter configuration file
#!/usr/bin/env bash
{
krp="" pafile="" fafile=""
kpname="net.ipv6.conf.all.forwarding"
kpvalue="0"
searchloc="/run/sysctl.d/*.conf /etc/sysctl.d/*.conf /usr/local/lib/sysctl.d/*.conf /usr/lib/sysctl.d/*.conf /lib/sysctl.d/*.conf /etc/sysctl.conf"
krp="$(sysctl "$kpname" | awk -F= '{print $2}' | xargs)"
pafile="$(grep -Psl -- "^\h*$kpname\h*=\h*$kpvalue\b\h*(#.*)?$" $searchloc)"
fafile="$(grep -s -- "^\s*$kpname" $searchloc | grep -Pv -- "\h*=\h*$kpvalue\b\h*" | awk -F: '{print $1}')"
if [ "$krp" = "$kpvalue" ] && [ -n "$pafile" ] && [ -z "$fafile" ]; then
echo -e "\nPASS:\n\"$kpname\" is set to \"$kpvalue\" in the running configuration and in \"$pafile\""
else
echo -e "\nFAIL: "
[ "$krp" != "$kpvalue" ] && echo -e "\"$kpname\" is set to \"$krp\" in the running configuration\n"
[ -n "$fafile" ] && echo -e "\n\"$kpname\" is set incorrectly in \"$fafile\""
[ -z "$pafile" ] && echo -e "\n\"$kpname = $kpvalue\" is not set in a kernel parameter configuration file\n"
fi
}
[root@Wazuh vagrant]# bash test_3.2.1_2.sh
FAIL:
"net.ipv6.conf.all.forwarding = 0" is not set in a kernel parameter configuration file
Findings: π΄
- 'not c:grep -Rh -E -s "\s*net\.ipv4\.ip_forward" /etc/sysctl.conf /etc/sysctl.d/ /usr/lib/sysctl.d/ /run/sysctl.d/ -> r:^\s*net.ipv4.ip_forward\s*=\s*1'
/run/sysctl.d/*.conf /etc/sysctl.d/*.conf /usr/local/lib/sysctl.d/*.conf /usr/lib/sysctl.d/*.conf /lib/sysctl.d/*.conf /etc/sysctl.conf
Expected: FAIL
title: π’
description: π’
rationale: π’
remediation: π’
cis compliance: π’
CIS audit scripts and outputs:
#!/usr/bin/env bash
{
krp="" pafile="" fafile=""
kpname="net.ipv4.conf.all.send_redirects"
kpvalue="0"
searchloc="/run/sysctl.d/*.conf /etc/sysctl.d/*.conf /usr/local/lib/sysctl.d/*.conf /usr/lib/sysctl.d/*.conf /lib/sysctl.d/*.conf
/etc/sysctl.conf"
krp="$(sysctl "$kpname" | awk -F= '{print $2}' | xargs)"
pafile="$(grep -Psl -- "^\h*$kpname\h*=\h*$kpvalue\b\h*(#.*)?$" $searchloc)"
fafile="$(grep -s -- "^\s*$kpname" $searchloc | grep -Pv -- "\h*=\h*$kpvalue\b\h*" | awk -F: '{print $1}')"
if [ "$krp" = "$kpvalue" ] && [ -n "$pafile" ] && [ -z "$fafile" ]; then
echo -e "\nPASS:\n\"$kpname\" is set to \"$kpvalue\" in the running configuration and in \"$pafile\""
else
echo -e "\nFAIL: "
[ "$krp" != "$kpvalue" ] && echo -e "\"$kpname\" is set to \"$krp\" in the running configuration\n"
[ -n "$fafile" ] && echo -e "\n\"$kpname\" is set incorrectly in \"$fafile\""
[ -z "$pafile" ] && echo -e "\n\"$kpname = $kpvalue\" is not set in a kernel parameter configuration file\n"
fi
}
[root@Wazuh vagrant]# bash test3.2.2_1.sh
FAIL:
"net.ipv4.conf.all.send_redirects" is set to "1" in the running configuration
"net.ipv4.conf.all.send_redirects = 0" is not set in a kernel parameter configuration file
#!/usr/bin/env bash
{
krp="" pafile="" fafile=""
kpname="net.ipv4.conf.default.send_redirects"
kpvalue="0"
searchloc="/run/sysctl.d/*.conf /etc/sysctl.d/*.conf /usr/local/lib/sysctl.d/*.conf /usr/lib/sysctl.d/*.conf /lib/sysctl.d/*.conf /etc sysctl.conf"
krp="$(sysctl "$kpname" | awk -F= '{print $2}' | xargs)"
pafile="$(grep -Psl -- "^\h*$kpname\h*=\h*$kpvalue\b\h*(#.*)?$" $searchloc)"
fafile="$(grep -s -- "^\s*$kpname" $searchloc | grep -Pv -- "\h*=\h*$kpvalue\b\h*" | awk -F: '{print $1}')"
if [ "$krp" = "$kpvalue" ] && [ -n "$pafile" ] && [ -z "$fafile" ]; then
echo -e "\nPASS:\n\"$kpname\" is set to \"$kpvalue\" in the running configuration and in \"$pafile\""
else
echo -e "\nFAIL: "
[ "$krp" != "$kpvalue" ] && echo -e "\"$kpname\" is set to \"$krp\" in the running configuration\n"
[ -n "$fafile" ] && echo -e "\n\"$kpname\" is set incorrectly in \"$fafile\""
[ -z "$pafile" ] && echo -e "\n\"$kpname = $kpvalue\" is not set in a kernel parameter configuration file\n"
fi
}
[root@Wazuh vagrant]# bash test3.2.2_2.sh
FAIL:
"net.ipv4.conf.default.send_redirects" is set to "1" in the running configuration
"net.ipv4.conf.default.send_redirects = 0" is not set in a kernel parameter configuration file
Findings: π΄
- 'c:grep -Rh net.ipv4.conf.default.send_redirects /etc/sysctl.conf /etc/sysctl.d/ -> r:^\s*net.ipv4.conf.default.send_redirects\s*=\s*0'
/run/sysctl.d/*.conf /etc/sysctl.d/*.conf /usr/local/lib/sysctl.d/*.conf /usr/lib/sysctl.d/*.conf /lib/sysctl.d/*.conf /etc/sysctl.conf
Expected: FAIL
title: π’
description: π’
rationale: π’
remediation: π’
cis compliance: π’
CIS audit scripts and outputs:
#!/usr/bin/env bash
{
krp="" pafile="" fafile=""
kpname="net.ipv4.conf.all.accept_source_route"
kpvalue="0"
searchloc="/run/sysctl.d/*.conf /etc/sysctl.d/*.conf /usr/local/lib/sysctl.d/*.conf /usr/lib/sysctl.d/*.conf /lib/sysctl.d/*.conf /etc/sysctl.conf"
krp="$(sysctl "$kpname" | awk -F= '{print $2}' | xargs)"
pafile="$(grep -Psl -- "^\h*$kpname\h*=\h*$kpvalue\b\h*(#.*)?$" $searchloc)"
fafile="$(grep -s -- "^\s*$kpname" $searchloc | grep -Pv -- "\h*=\h*$kpvalue\b\h*" | awk -F: '{print $1}')"
if [ "$krp" = "$kpvalue" ] && [ -n "$pafile" ] && [ -z "$fafile" ]; then
echo -e "\nPASS:\n\"$kpname\" is set to \"$kpvalue\" in the running configuration and in \"$pafile\""
else
echo -e "\nFAIL: "
[ "$krp" != "$kpvalue" ] && echo -e "\"$kpname\" is set to \"$krp\" in the running configuration\n"
[ -n "$fafile" ] && echo -e "\n\"$kpname\" is set incorrectly in \"$fafile\""
[ -z "$pafile" ] && echo -e "\n\"$kpname = $kpvalue\" is not set in a kernel parameter configuration file\n"
fi
}
[root@Wazuh vagrant]# bash test_3.3.1_1.sh
FAIL:
"net.ipv4.conf.all.accept_source_route = 0" is not set in a kernel parameter configuration file
#!/usr/bin/env bash
{
krp="" pafile="" fafile=""
kpname="net.ipv4.conf.default.accept_source_route"
kpvalue="0"
searchloc="/run/sysctl.d/*.conf /etc/sysctl.d/*.conf /usr/local/lib/sysctl.d/*.conf /usr/lib/sysctl.d/*.conf /lib/sysctl.d/*.conf /etc/sysctl.conf"
krp="$(sysctl "$kpname" | awk -F= '{print $2}' | xargs)"
pafile="$(grep -Psl -- "^\h*$kpname\h*=\h*$kpvalue\b\h*(#.*)?$" $searchloc)"
fafile="$(grep -s -- "^\s*$kpname" $searchloc | grep -Pv -- "\h*=\h*$kpvalue\b\h*" | awk -F: '{print $1}')"
if [ "$krp" = "$kpvalue" ] && [ -n "$pafile" ] && [ -z "$fafile" ]; then
echo -e "\nPASS:\n\"$kpname\" is set to \"$kpvalue\" in the running configuration and in \"$pafile\""
else
echo -e "\nFAIL: "
[ "$krp" != "$kpvalue" ] && echo -e "\"$kpname\" is set to \"$krp\" in the running configuration\n"
[ -n "$fafile" ] && echo -e "\n\"$kpname\" is set incorrectly in \"$fafile\""
[ -z "$pafile" ] && echo -e "\n\"$kpname = $kpvalue\" is not set in a kernel parameter configuration file\n"
fi
}
[root@Wazuh vagrant]# bash test_3.3.1_2.sh
PASS:
"net.ipv4.conf.default.accept_source_route" is set to "0" in the running configuration and in "/usr/lib/sysctl.d/50-default.conf
/lib/sysctl.d/50-default.conf"
Expected: FAIL
Findings: π΄
The rule 'c:grep -Rh net.ipv4.conf.default.accept_source_route /etc/sysctl.conf /etc/sysctl.d/ -> r:^\s*net.ipv4.conf.default.accept_source_route\s*=\s*0'
only searches /etc/sysctl.conf
and /etc/sysctl.d/
while the CIS audit searches in: /run/sysctl.d/*.conf /etc/sysctl.d/*.conf /usr/local/lib/sysctl.d/*.conf /usr/lib/sysctl.d/*.conf /lib/sysctl.d/*.conf /etc/sysctl.conf
title: π’
description: π’
rationale: π’
remediation: π’
cis compliance: π’
CIS audit scripts and outputs:
#!/usr/bin/env bash
{
krp="" pafile="" fafile=""
kpname="net.ipv4.conf.all.send_redirects"
kpvalue="0"
searchloc="/run/sysctl.d/*.conf /etc/sysctl.d/*.conf /usr/local/lib/sysctl.d/*.conf /usr/lib/sysctl.d/*.conf /lib/sysctl.d/*.conf /etc/sysctl.conf"
krp="$(sysctl "$kpname" | awk -F= '{print $2}' | xargs)"
pafile="$(grep -Psl -- "^\h*$kpname\h*=\h*$kpvalue\b\h*(#.*)?$" $searchloc)"
fafile="$(grep -s -- "^\s*$kpname" $searchloc | grep -Pv -- "\h*=\h*$kpvalue\b\h*" | awk -F: '{print $1}')"
if [ "$krp" = "$kpvalue" ] && [ -n "$pafile" ] && [ -z "$fafile" ]; then
echo -e "\nPASS:\n\"$kpname\" is set to \"$kpvalue\" in the running configuration and in \"$pafile\""
else
echo -e "\nFAIL: "
[ "$krp" != "$kpvalue" ] && echo -e "\"$kpname\" is set to \"$krp\" in the running configuration\n"
[ -n "$fafile" ] && echo -e "\n\"$kpname\" is set incorrectly in \"$fafile\""
[ -z "$pafile" ] && echo -e "\n\"$kpname = $kpvalue\" is not set in a kernel parameter configuration file\n"
fi
}
[root@Wazuh vagrant]# bash test_3.2.2_1.sh
FAIL:
"net.ipv4.conf.all.send_redirects" is set to "1" in the running configuration
"net.ipv4.conf.all.send_redirects = 0" is not set in a kernel parameter configuration file
#!/usr/bin/env bash
{
krp="" pafile="" fafile=""
kpname="net.ipv4.conf.default.send_redirects"
kpvalue="0"
searchloc="/run/sysctl.d/*.conf /etc/sysctl.d/*.conf /usr/local/lib/sysctl.d/*.conf /usr/lib/sysctl.d/*.conf /lib/sysctl.d/*.conf /etc/sysctl.conf"
krp="$(sysctl "$kpname" | awk -F= '{print $2}' | xargs)"
pafile="$(grep -Psl -- "^\h*$kpname\h*=\h*$kpvalue\b\h*(#.*)?$" $searchloc)"
fafile="$(grep -s -- "^\s*$kpname" $searchloc | grep -Pv -- "\h*=\h*$kpvalue\b\h*" | awk -F: '{print $1}')"
if [ "$krp" = "$kpvalue" ] && [ -n "$pafile" ] && [ -z "$fafile" ]; then
echo -e "\nPASS:\n\"$kpname\" is set to \"$kpvalue\" in the running configuration and in \"$pafile\""
else
echo -e "\nFAIL: "
[ "$krp" != "$kpvalue" ] && echo -e "\"$kpname\" is set to \"$krp\" in the running configuration\n"
[ -n "$fafile" ] && echo -e "\n\"$kpname\" is set incorrectly in \"$fafile\""
[ -z "$pafile" ] && echo -e "\n\"$kpname = $kpvalue\" is not set in a kernel parameter configuration file\n"
fi
}
[root@Wazuh vagrant]# bash test_3.2.2_2.sh
FAIL:
"net.ipv4.conf.default.send_redirects" is set to "1" in the running configuration
"net.ipv4.conf.default.send_redirects = 0" is not set in a kernel parameter configuration file
Expected: FAIL
3.3.1 - 3.3.9 :red_circle: As in the previous section, not all files and directories included in the CIS audit scripts are scanned in the cis_rhel9_linux.yml
rules.
title: π’
description: π’
rationale: π’
remediation: π’
cis compliance: π’
[root@Wazuh vagrant]# rpm -q firewalld iptables
firewalld-1.0.0-4.el9.noarch
package iptables is not installed
Expected: FAIL
title: π’
description: π’
rationale: π’
remediation: π’
cis compliance: π’
[root@Wazuh vagrant]# rpm -q iptables-services
package iptables-services is not installed
Findings: :yellow_circle:
cis_rhel9_linux.yml
rules also check if firewalld is installed.
Checking if firewalld is installed is redundant since it is included in 3.4.1.1. Including this extra rule may cause this check to fail and the user to apply remediations unnecessarily. Expected: PASS
title: π’
description: π’
rationale: π’
remediation: π’
cis compliance: π’
[root@Wazuh vagrant]# rpm -q nftables
nftables-0.9.8-12.el9.x86_64
[root@Wazuh vagrant]# systemctl is-active nftables
inactive
[root@Wazuh vagrant]# systemctl is-enabled nftables
disabled
Expected: FAIL
Findings: π΄
The condition that nftables can be masked is not included in the cis_rhel9_linux.yml
rules.
As in the previous check, verifying if firewalld is installed is redundant since it is included in 3.4.1.1.
title: π’
description: π’
rationale: π’
remediation: π’
cis compliance: π’
[root@Wazuh vagrant]# systemctl is-enabled firewalld
enabled
[root@Wazuh vagrant]# firewall-cmd --state
running
Expected: PASS
Findings: :yellow_circle:
cis_rhel9_linux.yml
rules. title: π’
description: π’
rationale: π’
remediation: π’
cis compliance: π’
[root@Wazuh vagrant]# firewall-cmd --get-default-zone
public
Expected: PASS
Findings: :yellow_circle:
cis_rhel9_linux.yml
rules. title: π’
description: π’
rationale: π’
remediation: π’
cis compliance: π’
[root@Wazuh vagrant]# rpm -q nftables
nftables-0.9.8-12.el9.x86_64
Expected: PASS
Findings: π΄
rules:
- "c:rpm -q firewalld -> r:^package firewalld is not installed"
- "c:rpm -q iptables -> r:^package iptables is not installed"
- "c:rpm -q nftables -> r:^nftables-"
cis_rhel9_linux.yml
rules also require that firewalld and iptables are not installed, this requirement is not correct as firewalld can be installed but masked. title: π’
description: π’
rationale: π’
remediation: π’
cis compliance: π’
[root@Wazuh vagrant]# rpm -q firewalld
firewalld-1.0.0-4.el9.noarch
[root@Wazuh vagrant]# command -v firewall-cmd >/dev/null && firewall-cmd --state | grep 'running'
running
[root@Wazuh vagrant]# systemctl is-enabled firewalld
enabled
Expected: FAIL
Findings: π΄
The condition that firewalld can be masked is not included in the cis_rhel9_linux.yml
rules.
An additional check that verifies if nftables is installed is included in the cis_rhel9_linux.yml
rules.
title: π’
description: π’
rationale: π’
remediation: π’
cis compliance: π’
[root@Wazuh vagrant]# rpm -q iptables-services
package iptables-services is not installed
Expected: PASS
Findings: :yellow_circle:
cis_rhel9_linux.yml
rules.title: π’
description: π’
rationale: π’
remediation: π’
cis compliance: π’
[root@Wazuh vagrant]# iptables -L
Chain INPUT (policy ACCEPT)
target prot opt source destination
Chain FORWARD (policy ACCEPT)
target prot opt source destination
Chain OUTPUT (policy ACCEPT)
target prot opt source destination
[root@Wazuh vagrant]# ip6tables -L
Chain INPUT (policy ACCEPT)
target prot opt source destination
Chain FORWARD (policy ACCEPT)
target prot opt source destination
Chain OUTPUT (policy ACCEPT)
target prot opt source destination
Expected: PASS
Findings: :yellow_circle:
cis_rhel9_linux.yml
rules.title: π’
description: π’
rationale: π’
remediation: π’
cis compliance: π’
[root@Wazuh vagrant]# nft list tables
table inet firewalld
Expected: PASS
Findings: :yellow_circle:
cis_rhel9_linux.yml
rules.title: π’
description: π’
rationale: π’
remediation: π’
cis compliance: π΄
[root@Wazuh vagrant]# nft list ruleset | grep 'hook input'
type filter hook input priority filter + 10; policy accept;
[root@Wazuh vagrant]# nft list ruleset | grep 'hook forward'
type filter hook forward priority filter + 10; policy accept;
[root@Wazuh vagrant]# nft list ruleset | grep 'hook output'
type filter hook output priority filter + 10; policy accept;
Expected: PASS
Findings: π΄
rules:
- "c:nft list ruleset -> r:input"
- "c:nft list ruleset -> r:forward"
- "c:nft list ruleset -> r:output"
- "c:rpm -q nftables -> r:nftables-"
cis_rhel9_linux.yml
rules. The 3.4.2.9 check verifies that base chains contain a policy of DROP.cis_rhel9_linux.yml
rules.title: π’
description: π’
rationale: π’
remediation: π’
cis compliance: π’
[root@Wazuh vagrant]# systemctl is-enabled nftables
disabled
Expected: FAIL
title: π’
description: π’
rationale: π’
remediation: π’
cis compliance: π’
[root@Wazuh vagrant]# rpm -q iptables iptables-services
package iptables is not installed
package iptables-services is not installed
[root@Wazuh vagrant]# rpm -q nftables
nftables-0.9.8-12.el9.x86_64
[root@Wazuh vagrant]# rpm -q firewalld
firewalld-1.0.0-4.el9.noarch
[root@Wazuh vagrant]# systemctl status firewalld | grep "Active: " | grep -v "active (running) "
[root@Wazuh vagrant]# systemctl is-enabled firewalld
enabled
Expected: FAIL
Findings: :yellow_circle:
cis_rhel9_linux.yml
rules.title: π’
description: π’
rationale: π’
remediation: π’
cis compliance: π’
[root@Wazuh vagrant]# iptables -L
Chain INPUT (policy ACCEPT)
target prot opt source destination
Chain FORWARD (policy ACCEPT)
target prot opt source destination
Chain OUTPUT (policy ACCEPT)
target prot opt source destination
Expected: FAIL
title: π’
description: π’
rationale: π’
remediation: π’
cis compliance: π’
[root@Wazuh vagrant]# systemctl is-enabled iptables
Failed to get unit file state for iptables.service: No such file or directory
[root@Wazuh vagrant]# systemctl is-active iptables
inactive
Expected: FAIL
title: π’ description: π΄
"Configure the loopback interface to accept traffic. Configure all other interfaces to deny traffic tothe loopback network (::1)."
There's a typo "tothe".
rationale: π’
remediation: π’
cis compliance: π’
[root@Wazuh vagrant]# ip6tables -L INPUT -v -n
Chain INPUT (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination
[root@Wazuh vagrant]# ip6tables -L OUTPUT -v -n
Chain OUTPUT (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination
Expected: FAIL
Findings: π΄
title: π’
description: π’
rationale: π’
remediation: π΄
There's a typo: "-PFORWARD" should be "-P FORWARD"
cis compliance: π’
[root@Wazuh vagrant]# ip6tables -L
Chain INPUT (policy ACCEPT)
target prot opt source destination
Chain FORWARD (policy ACCEPT)
target prot opt source destination
Chain OUTPUT (policy ACCEPT)
target prot opt source destination
Expected: FAIL
Findings: π΄
title: π’
description: π’
rationale: π’
remediation: π΄
# systemctl --now enable ip6tables
should be # systemctl --now start ip6tables
.
cis compliance: π’
[root@Wazuh vagrant]# systemctl is-enabled ip6tables
Failed to get unit file state for ip6tables.service: No such file or directory
[root@Wazuh vagrant]# systemctl status ip6tables
Unit ip6tables.service could not be found.
Expected: PASS
Findings: π΄
title: π’
description: π’
rationale: π’
remediation: π’
cis compliance: π’
[root@Wazuh vagrant]# rpm -q audit
audit-3.0.7-101.el9_0.2.x86_64
Expected: PASS
title: π΄
"Ensure auditd service is enabled and running."
description: π’ rationale: π’ remediation: π’ cis compliance: π’
[root@Wazuh vagrant]# systemctl is-enabled auditd
enabled
Expected: PASS
Findings: π΄
"c:systemctl status auditd -> r:active && r:running"
is not included in the CIS audit commands. title: π’
description: π’
rationale: π’
remediation: π’
cis compliance: π’
[root@Wazuh vagrant]# find /boot -type f -name 'grubenv' -exec grep -P 'kernelopts=([^#\n\r]+\h+)?(audit=1)' {} \;
[root@Wazuh vagrant]#
Expected: FAIL
title: π’
description: π’
rationale: π’
remediation: π’
cis compliance: π’
[root@Wazuh vagrant]# grep -w "^\s*max_log_file\s*=" /etc/audit/auditd.conf
max_log_file = 8
Expected: PASS
title: π’
description: π’
rationale: π’
remediation: π’
cis compliance: π’
[root@Wazuh vagrant]# grep max_log_file_action /etc/audit/auditd.conf
max_log_file_action = ROTATE
Expected: FAIL
title: π’
description: π’
rationale: π’
remediation: :yellow_circle: Extra spaces are present in the remediation.
cis compliance: π’
[root@Wazuh vagrant]# grep space_left_action /etc/audit/auditd.conf
space_left_action = SYSLOG
admin_space_left_action = SUSPEND
[root@Wazuh vagrant]# grep action_mail_acct /etc/audit/auditd.conf
action_mail_acct = root
[root@Wazuh vagrant]# grep -E 'admin_space_left_action\s*=\s*(halt|single)' /etc/audit/auditd.conf
[root@Wazuh vagrant]#
Expected: FAIL
title: π’
description: π’
rationale: π’
remediation: π’
cis compliance: π’
[root@Wazuh vagrant]# awk '/^ *-w/ \
&&/\/etc\/sudoers/ \
&&/ +-p *wa/ \
&&(/ key= *[!-~]* *$/||/ -k *[!-~]* *$/)' /etc/audit/rules.d/*.rules
[root@Wazuh vagrant]# auditctl -l | awk '/^ *-w/ \
&&/\/etc\/sudoers/ \
&&/ +-p *wa/ \
&&(/ key= *[!-~]* *$/||/ -k *[!-~]* *$/)'
[root@Wazuh vagrant]#
Expected: FAIL
title: π’
description: π’
rationale: π’
remediation: π’
cis compliance: π’
[root@Wazuh vagrant]# awk '/^ *-a *always,exit/ \
&&/ -F *arch=b[2346]{2}/ \
&&/ -S/ \
&&(/adjtimex/ \
||/settimeofday/ \
||/clock_settime/ ) \
&&(/ key= *[!-~]* *$/||/ -k *[!-~]* *$/)' /etc/audit/rules.d/*.rules
[root@Wazuh vagrant]# awk '/^ *-w/ \
&&/\/etc\/localtime/ \
&&/ +-p *wa/ \
&&(/ key= *[!-~]* *$/||/ -k *[!-~]* *$/)' /etc/audit/rules.d/*.rules
[root@Wazuh vagrant]#
Expected: FAIL
Findings: π΄
rules:
- 'd:/etc/audit/rules.d/ -> r:\.*.rules -> r:^-a && r:always,exit|exit,always && r:-F arch=b32 && r:-S adjtimex && r:-S settimeofday && r:-S stime && r:-k time-change'
- 'd:/etc/audit/rules.d/ -> r:\.*.rules -> r:^-a && r:always,exit|exit,always && r:-F arch=b32 && r:-S clock_settime && r:-k time-change'
arch=b64.
title: π’
description: π’
rationale: π’
remediation: π’
cis compliance: π’
[root@Wazuh vagrant]# awk '/^ *-a *always,exit/ \
&&/ -F *arch=b[2346]{2}/ \
&&/ -S/ \
&&(/sethostname/ \
||/setdomainname/) \
&&(/ key= *[!-~]* *$/||/ -k *[!-~]* *$/)' /etc/audit/rules.d/*.rules
[root@Wazuh vagrant]# awk '/^ *-w/ \
&&(/\/etc\/issue/ \
||/\/etc\/issue.net/ \
||/\/etc\/hosts/ \
||/\/etc\/sysconfig\/network/) \
&&/ +-p *wa/ \
&&(/ key= *[!-~]* *$/||/ -k *[!-~]* *$/)' /etc/audit/rules.d/*.rules
[root@Wazuh vagrant]#
Expected: FAIL
Findings: π΄
-a always,exit -F arch=b64 -S sethostname,setdomainname -k system-locale
-a always,exit -F arch=b32 -S sethostname,setdomainname -k system-locale
arch=b64
is missing. r:-S sethostname && r:-S setdomainname
as the expected output is -S sethostname,setdomainname
rules:
- 'd:/etc/audit/rules.d/ -> r:\.*.rules -> r:^-a && r:always,exit|exit,always && r:-F arch=b32 && r:-S sethostname && r:-S setdomainname && r:-k system-locale'
- 'd:/etc/audit/rules.d/ -> r:\.*.rules -> r:-w /etc/issue && r:-p wa && r:-k system-locale'
- 'd:/etc/audit/rules.d/ -> r:\.*.rules -> r:-w /etc/issue.net && r:-p wa && r:-k system-locale'
- 'd:/etc/audit/rules.d/ -> r:\.*.rules -> r:-w /etc/hosts && r:-p wa && r:-k system-locale'
- 'd:/etc/audit/rules.d/ -> r:\.*.rules -> r:-w /etc/sysconfig/network && r:-p wa && r:-k system-locale'
- 'd:/etc/audit/rules.d/ -> r:\.*.rules -> r:-w /etc/sysconfig/network-scripts/ && r:-p wa && r:-k system-locale'
title: π’
description: π’
rationale: π’
remediation: π’
cis compliance: π’
[root@Wazuh vagrant]# awk '/^ *-w/ \
&&(/\/etc\/group/ \
||/\/etc\/passwd/ \
||/\/etc\/gshadow/ \
||/\/etc\/shadow/ \
||/\/etc\/security\/opasswd/) \
&&/ +-p *wa/ \
&&(/ key= *[!-~]* *$/||/ -k *[!-~]* *$/)' /etc/audit/rules.d/*.rules
[root@Wazuh vagrant]#
Expected: FAIL
title: π’
description: π’
rationale: π’
remediation: π’
cis compliance: π’
Expected: FAIL
Findings: π΄
r:-S chmod && r:-S fchmod && r:-S fchmodat
vs -S chmod,fchmod,fchmodat
-F auid!=4294967295
vs -F auid!=-1
Expected outputs:
-a always,exit -F arch=b64 -S chmod,fchmod,fchmodat -F auid>=1000 -F auid!=-1
-F key=perm_mod
-a always,exit -F arch=b64 -S chown,fchown,lchown,fchownat -F auid>=1000 -F
auid!=-1 -F key=perm_mod
-a always,exit -F arch=b32 -S chmod,fchmod,fchmodat -F auid>=1000 -F auid!=-1
-F key=perm_mod
-a always,exit -F arch=b32 -S lchown,fchown,chown,fchownat -F auid>=1000 -F
auid!=-1 -F key=perm_mod
-a always,exit -F arch=b64 -S
setxattr,lsetxattr,fsetxattr,removexattr,lremovexattr,fremovexattr -F
auid>=1000 -F auid!=-1 -F key=perm_mod
-a always,exit -F arch=b32 -S
setxattr,lsetxattr,fsetxattr,removexattr,lremovexattr,fremovexattr -F
auid>=1000 -F auid!=-1 -F key=perm_mod
Rules:
rules:
- "f:/etc/audit/audit.rules -> r:^-a && r:always,exit|exit,always && r:-F arch=b32 && r:-S chmod && r:-S fchmod && r:-S fchmodat && r:-F auid>=1000 && r:-F auid!=4294967295 && r:-k perm_mod"
- "f:/etc/audit/audit.rules -> r:^-a && r:always,exit|exit,always && r:-F arch=b32 && r:-S chown && r:-S fchown && r:-S fchownat && r:-S lchown && r:-F auid>=1000 && r:-F auid!=4294967295 && r:-k perm_mod"
- "f:/etc/audit/audit.rules -> r:^-a && r:always,exit|exit,always && r:-F arch=b32 && r:-S setxattr && r:-S lsetxattr && r:-S fsetxattr && r:-S removexattr && r:-S lremovexattr && r:-S fremovexattr && r:-F auid>=1000 && r:-F auid!=4294967295 && r:-k perm_mod"
title: π’
description: π΄ (and umount
)
rationale: π΄ "non-privileged"
remediation: π΄ "Remediation:"
cis compliance: π’
Expected: FAIL
Findings: π΄
Expected outputs:
-a always,exit -F arch=b64 -S mount -F auid>=1000 -F auid!=-1 -F key=mounts
-a always,exit -F arch=b32 -S mount -F auid>=1000 -F auid!=-1 -F key=mounts
rules:
- "f:/etc/audit/audit.rules -> r:^-a && r:always,exit|exit,always && r:-F arch=b32 && r:-S mount && r:-F auid>=1000 && r:-F auid!=4294967295 && r:-k mounts"
title: π’
description: π’
rationale: π’
remediation: π’
cis compliance: π’
[root@Wazuh vagrant]# awk '/^ *-w/ \
&&(/\/var\/run\/utmp/ \
||/\/var\/log\/wtmp/ \
||/\/var\/log\/btmp/) \
&&/ +-p *wa/ \
&&(/ key= *[!-~]* *$/||/ -k *[!-~]* *$/)' /etc/audit/rules.d/*.rules
[root@Wazuh vagrant]#
Expected: FAIL
Findings: π΄
Expected output:
-w /var/run/utmp -p wa -k session
-w /var/log/wtmp -p wa -k session
-w /var/log/btmp -p wa -k session
rules:
- "f:/etc/audit/audit.rules -> r:-w /var/run/utmp && r:-p wa && r:-k session"
- "f:/etc/audit/audit.rules -> r:-w /var/log/wtmp && r:-p wa && r:-k logins"
- "f:/etc/audit/audit.rules -> r:-w /var/log/btmp && r:-p wa && r:-k logins"
title: π’
description: π’
rationale: π’
remediation: π’
cis compliance: π’
[root@Wazuh vagrant]# awk '/^ *-w/ \
&&(/\/var\/log\/lastlog/ \
||/\/var\/run\/faillock/) \
&&/ +-p *wa/ \
&&(/ key= *[!-~]* *$/||/ -k *[!-~]* *$/)' /etc/audit/rules.d/*.rules
[root@Wazuh vagrant]#
Expected: FAIL
title: π’
description: π’
rationale: π’
remediation: π’
cis compliance: π’
[root@Wazuh vagrant]# UID_MIN=$(awk '/^\s*UID_MIN/{print $2}' /etc/login.defs)
[ -n "${UID_MIN}" ] && awk "/^ *-a *always,exit/ \
&&/ -F *arch=b[2346]{2}/ \
&&(/ -F *auid!=unset/||/ -F *auid!=-1/||/ -F *auid!=4294967295/) \
&&/ -F *auid>=${UID_MIN}/ \
&&/ -S/ \
&&(/unlink/||/rename/||/unlinkat/||/renameat/) \
&&(/ key= *[!-~]* *$/||/ -k *[!-~]* *$/)" /etc/audit/rules.d/*.rules \
|| printf "ERROR: Variable 'UID_MIN' is unset.\n"
[root@Wazuh vagrant]#
Expected: FAIL
Findings: π΄
r:-S unlink && r:-S unlinkat && r:-S rename && r:-S renameat
vs -S rename,unlink,unlinkat,renamea
. r:-F auid!=429496729
vs F auid!=-1
. Expected output:
-a always,exit -F arch=b64 -S rename,unlink,unlinkat,renameat -F auid>=1000 -
F auid!=-1 -F key=delete
-a always,exit -F arch=b32 -S unlink,rename,unlinkat,renameat -F auid>=1000 -
F auid!=-1 -F key=delete
rules:
- "f:/etc/audit/audit.rules -> r:^-a && r:always,exit|exit,always && r:-F arch=b32 && r:-S unlink && r:-S unlinkat && r:-S rename && r:-S renameat && r:-F auid>=1000 && r:-F auid!=4294967295 && r:-k delete"
title: π’
description: π’
rationale: π’
remediation: π’
cis compliance: π’
[root@Wazuh vagrant]# awk '/^ *-w/ \
&&(/\/etc\/selinux/ \
||/\/usr\/share\/selinux/) \
&&/ +-p *wa/ \
&&(/ key= *[!-~]* *$/||/ -k *[!-~]* *$/)' /etc/audit/rules.d/*.rules
[root@Wazuh vagrant]#
Expected: FAIL
title: π’
description: :yellow_circle: "`.
Setting the flag "
`-e 2"
rationale: π’
remediation: π’
cis compliance: π’
[root@Wazuh vagrant]# grep "^\s*[^#]" /etc/audit/rules.d/*.rules | tail -1
-f 1
Expected: FAIL
title: π’
description: π’
rationale: π’
remediation: π’
cis compliance: π’
[root@Wazuh vagrant]# rpm -q rsyslog
rsyslog-8.2102.0-101.el9.x86_64
Expected: PASS
title: :yellow_circle: "Ensure rsyslog Sservice is enabled"
description: π’
rationale: π’
remediation: π’
cis compliance: π’
[root@Wazuh vagrant]# systemctl is-enabled rsyslog
enabled
Expected: PASS
title: π’
description: π’
rationale: π’
remediation: π’
cis compliance: π’
[root@Wazuh vagrant]# grep ^\s*ForwardToSyslog /etc/systemd/journald.conf
[root@Wazuh vagrant]#
Expected: FAIL
title: π΄ "Ensure rsyslog default file permissions are configured."
description: π’
rationale: π’
remediation: π’
cis compliance: π’
[root@Wazuh vagrant]# grep ^\$FileCreateMode /etc/rsyslog.conf /etc/rsyslog.d/*.conf
grep: /etc/rsyslog.d/*.conf: No such file or directory
[root@Wazuh vagrant]#
Expected: FAIL
Findings: π΄
^\$FileCreateMode 06\d0
. Condition should be all
.
rules:
- 'f:/etc/rsyslog.conf -> r:^\$FileCreateMode 06\d0|^\$FileCreateMode 04\d0|^\$FileCreateMode 02\d0|^\$FileCreateMode 00\d0'
- 'f:/etc/rsyslog.conf -> r:^\$FileCreateMode 0\d40|^\$FileCreateMode 0\d20|^\$FileCreateMode 0\d00'
title: π’
description: π’
rationale: π’
remediation: π’
cis compliance: π΄ cis_csc is wrong.
[root@Wazuh vagrant]# grep *.*[^I][^I]*@ /etc/rsyslog.conf
[root@Wazuh vagrant]#
Expected: FAIL
Findings: π΄
The new format is not taken into consideration. Note that the remediation suggests the new format.
# grep -E '^\s*([^#]+\s+)?action\(([^#]+\s+)?\btarget=\"?[^#"]+\"?\b'
/etc/rsyslog.conf /etc/rsyslog.d/*.conf
Output should include target=
*.* action(type="omfwd" target="loghost.example.com" port="514"
protocol="tcp"
title: π’
description: π’
rationale: π’
remediation: π’
cis compliance: π’
[root@Wazuh vagrant]# grep '$ModLoad imtcp' /etc/rsyslog.conf /etc/rsyslog.d/*.conf
grep: /etc/rsyslog.d/*.conf: No such file or directory
[root@Wazuh vagrant]# grep '$InputTCPServerRun' /etc/rsyslog.conf /etc/rsyslog.d/*.conf
grep: /etc/rsyslog.d/*.conf: No such file or directory
Expected: FAIL
title: π’
description: π’
rationale: π’
remediation: π’
cis compliance: π’
[root@Wazuh vagrant]# rpm -q systemd-journal-remote
package systemd-journal-remote is not installed
Expected: FAIL
title: π’
description: π’
rationale: π’
remediation: π’
cis compliance: π’
[root@Wazuh vagrant]# grep -P "^ *URL=|^ *ServerKeyFile=|^ *ServerCertificateFile=|^ *TrustedCertificateFile=" /etc/systemd/journal-upload.conf
grep: /etc/systemd/journal-upload.conf: No such file or directory
Expected: FAIL
title: π’
description: π’
rationale: π’
remediation: π’
cis compliance: π’
[root@Wazuh vagrant]# systemctl is-enabled systemd-journal-upload.service
Failed to get unit file state for systemd-journal-upload.service: No such file or directory
Expected: FAIL
title: π’
description: π’
rationale: π’
remediation: π’
cis compliance: π’
[root@Wazuh vagrant]# systemctl is-enabled systemd-journal-remote.socket
Failed to get unit file state for systemd-journal-remote.socket: No such file or directory
Expected: FAIL
title: π’
description: π’
rationale: π’
remediation: π’
cis compliance: π’
[root@Wazuh vagrant]# systemctl is-enabled systemd-journald.service
static
Expected: PASS
title: π’
description: π’
rationale: π’
remediation: π’
cis compliance: π’
[root@Wazuh vagrant]# grep ^\s*Compress /etc/systemd/journald.conf
[root@Wazuh vagrant]#
Expected: FAIL
title: π’
description: π’
rationale: π’
remediation: π’
cis compliance: π’
[root@Wazuh vagrant]# grep ^\s*Storage /etc/systemd/journald.conf
[root@Wazuh vagrant]#
Expected: FAIL
title: π’
description: π’
rationale: π’
remediation: π’
cis compliance: π’
[root@Wazuh vagrant]# grep ^\s*ForwardToSyslog /etc/systemd/journald.conf
[root@Wazuh vagrant]#
Expected: PASS
title: π’
description: π’
rationale: π’
remediation: π’
cis compliance: π’
[root@Wazuh vagrant]# find /var/log/ -type f -perm /g+wx,o+rwx -exec ls -l "{}" +
-rw-rw----. 1 root utmp 0 Aug 1 11:26 /var/log/btmp
-rw-rw----. 1 root utmp 0 May 27 05:13 /var/log/btmp-20220801
-rw-r--r--. 1 root root 74951 Aug 4 14:12 /var/log/dnf.librepo.log
-rw-r--r--. 1 root root 205380 Aug 4 14:12 /var/log/dnf.log
-rw-r--r--. 1 root root 8799 Aug 4 14:12 /var/log/dnf.rpm.log
-rw-r--r--. 1 root root 840 Aug 4 14:12 /var/log/hawkey.log
...
Expected: FAIL
title: π’
description: π’
rationale: π’
remediation: π’
cis compliance: π’
[root@Wazuh vagrant]# systemctl is-enabled crond
enabled
Expected: PASS
title: π’
description: π’
rationale: π’
remediation: π’
cis compliance: π’
[root@Wazuh vagrant]# stat /etc/crontab
File: /etc/crontab
Size: 451 Blocks: 8 IO Block: 4096 regular file
Device: fd00h/64768d Inode: 134724320 Links: 1
Access: (0644/-rw-r--r--) Uid: ( 0/ root) Gid: ( 0/ root)
Context: system_u:object_r:system_cron_spool_t:s0
Access: 2022-08-03 07:47:42.917405256 +0000
Modify: 2022-03-23 10:19:13.000000000 +0000
Change: 2022-05-27 04:56:45.019436082 +0000
Birth: 2022-05-27 04:56:45.019436082 +0000
Expected: FAIL
title: π’
description: π’
rationale: π’
remediation: π’
cis compliance: π’
[root@Wazuh vagrant]# stat /etc/cron.hourly
File: /etc/cron.hourly
Size: 22 Blocks: 0 IO Block: 4096 directory
Device: fd00h/64768d Inode: 227025 Links: 2
Access: (0755/drwxr-xr-x) Uid: ( 0/ root) Gid: ( 0/ root)
Context: system_u:object_r:bin_t:s0
Access: 2022-08-04 12:01:01.571430166 +0000
Modify: 2022-03-23 10:19:13.000000000 +0000
Change: 2022-05-27 04:56:45.019436082 +0000
Birth: 2022-05-27 04:56:44.656437215 +0000
Expected: FAIL
title: π’
description: π’
rationale: π’
remediation: π’
cis compliance: π’
[root@Wazuh vagrant]# stat /etc/cron.daily
File: /etc/cron.daily
Size: 6 Blocks: 0 IO Block: 4096 directory
Device: fd00h/64768d Inode: 134724319 Links: 2
Access: (0755/drwxr-xr-x) Uid: ( 0/ root) Gid: ( 0/ root)
Context: system_u:object_r:bin_t:s0
Access: 2022-08-03 07:47:47.925454637 +0000
Modify: 2022-03-23 10:19:13.000000000 +0000
Change: 2022-05-27 04:56:45.019436082 +0000
Birth: 2022-05-27 04:56:45.019436082 +0000
Expected: FAIL
title: π’
description: π’
rationale: π’
remediation: π’
cis compliance: π’
[root@Wazuh vagrant]# stat /etc/cron.weekly
File: /etc/cron.weekly
Size: 6 Blocks: 0 IO Block: 4096 directory
Device: fd00h/64768d Inode: 227034 Links: 2
Access: (0755/drwxr-xr-x) Uid: ( 0/ root) Gid: ( 0/ root)
Context: system_u:object_r:bin_t:s0
Access: 2022-08-03 07:47:47.925454637 +0000
Modify: 2022-03-23 10:19:13.000000000 +0000
Change: 2022-05-27 04:56:45.019436082 +0000
Birth: 2022-05-27 04:56:45.019436082 +0000
Expected: FAIL
title: π’
description: π’
rationale: π’
remediation: π’
cis compliance: π’
[root@Wazuh vagrant]# stat /etc/cron.monthly
File: /etc/cron.monthly
Size: 6 Blocks: 0 IO Block: 4096 directory
Device: fd00h/64768d Inode: 201588083 Links: 2
Access: (0755/drwxr-xr-x) Uid: ( 0/ root) Gid: ( 0/ root)
Context: system_u:object_r:bin_t:s0
Access: 2022-08-03 07:47:47.925454637 +0000
Modify: 2022-03-23 10:19:13.000000000 +0000
Change: 2022-05-27 04:56:45.019436082 +0000
Birth: 2022-05-27 04:56:45.019436082 +0000
Expected: FAIL
title: π’
description: π’
rationale: π’
remediation: π’
cis compliance: π’
[root@Wazuh vagrant]# stat /etc/cron.d
File: /etc/cron.d
Size: 21 Blocks: 0 IO Block: 4096 directory
Device: fd00h/64768d Inode: 134724313 Links: 2
Access: (0700/drwx------) Uid: ( 0/ root) Gid: ( 0/ root)
Context: system_u:object_r:system_cron_spool_t:s0
Access: 2022-08-03 07:47:42.901405098 +0000
Modify: 2022-07-07 08:22:09.873784112 +0000
Change: 2022-08-04 15:16:41.961848287 +0000
Birth: 2022-05-27 04:56:44.874436534 +0000
Expected: PASS
title: π’
description: π’
rationale: π’
remediation: π’
cis compliance: π’
[root@Wazuh vagrant]# stat /etc/ssh/sshd_config
File: /etc/ssh/sshd_config
Size: 3539 Blocks: 8 IO Block: 4096 regular file
Device: fd00h/64768d Inode: 134693240 Links: 1
Access: (0600/-rw-------) Uid: ( 0/ root) Gid: ( 0/ root)
Context: system_u:object_r:etc_t:s0
Access: 2022-08-04 16:00:41.542986958 +0000
Modify: 2022-05-27 05:13:32.084831622 +0000
Change: 2022-05-27 05:13:32.084831622 +0000
Birth: 2022-05-27 05:13:32.083831625 +0000
Expected: PASS
title: π’
description: :yellow_circle: "In this authentication method, Tthe possession"
rationale: π’
remediation: :red_circle: There's an extra space: o- rwx
.
cis compliance: π’
File: /etc/ssh/ssh_host_ecdsa_key
Size: 480 Blocks: 8 IO Block: 4096 regular file
Device: fd00h/64768d Inode: 134826330 Links: 1
Access: (0640/-rw-r-----) Uid: ( 0/ root) Gid: ( 996/ssh_keys)
Context: system_u:object_r:sshd_key_t:s0
Access: 2022-08-04 16:00:41.542986958 +0000
Modify: 2022-07-07 08:22:08.633787035 +0000
Change: 2022-07-07 08:22:08.633787035 +0000
Birth: 2022-07-07 08:22:08.633787035 +0000
File: /etc/ssh/ssh_host_ed25519_key
Size: 387 Blocks: 8 IO Block: 4096 regular file
Device: fd00h/64768d Inode: 134857680 Links: 1
Access: (0640/-rw-r-----) Uid: ( 0/ root) Gid: ( 996/ssh_keys)
Context: system_u:object_r:sshd_key_t:s0
Access: 2022-08-04 16:00:41.542986958 +0000
Modify: 2022-07-07 08:22:08.652786989 +0000
Change: 2022-07-07 08:22:08.671786945 +0000
Birth: 2022-07-07 08:22:08.652786989 +0000
File: /etc/ssh/ssh_host_rsa_key
Size: 2578 Blocks: 8 IO Block: 4096 regular file
Device: fd00h/64768d Inode: 134857664 Links: 1
Access: (0640/-rw-r-----) Uid: ( 0/ root) Gid: ( 996/ssh_keys)
Context: system_u:object_r:sshd_key_t:s0
Access: 2022-08-04 16:00:41.542986958 +0000
Modify: 2022-07-07 08:22:09.390785251 +0000
Change: 2022-07-07 08:22:09.408785207 +0000
Birth: 2022-07-07 08:22:09.390785251 +0000
Expected: PASS
Findings: :red_circle:
r:^Access: \(0\d00/\w\w\w\w------\)
title: π’
description: π’
rationale: π’
remediation: :yellow_circle: Default value is missing.
cis compliance: π’
[root@Wazuh vagrant]# find /etc/ssh -xdev -type f -name 'ssh_host_*_key.pub' -exec stat {} \;
File: /etc/ssh/ssh_host_ecdsa_key.pub
Size: 162 Blocks: 8 IO Block: 4096 regular file
Device: fd00h/64768d Inode: 134857675 Links: 1
Access: (0644/-rw-r--r--) Uid: ( 0/ root) Gid: ( 0/ root)
Context: system_u:object_r:sshd_key_t:s0
Access: 2022-08-04 16:00:41.542986958 +0000
Modify: 2022-07-07 08:22:08.633787035 +0000
Change: 2022-08-04 16:44:21.245796632 +0000
Birth: 2022-07-07 08:22:08.633787035 +0000
File: /etc/ssh/ssh_host_ed25519_key.pub
Size: 82 Blocks: 8 IO Block: 4096 regular file
Device: fd00h/64768d Inode: 135011012 Links: 1
Access: (0644/-rw-r--r--) Uid: ( 0/ root) Gid: ( 0/ root)
Context: system_u:object_r:sshd_key_t:s0
Access: 2022-08-04 16:00:41.542986958 +0000
Modify: 2022-07-07 08:22:08.652786989 +0000
Change: 2022-08-04 16:44:21.250796676 +0000
Birth: 2022-07-07 08:22:08.652786989 +0000
File: /etc/ssh/ssh_host_rsa_key.pub
Size: 554 Blocks: 8 IO Block: 4096 regular file
Device: fd00h/64768d Inode: 135098301 Links: 1
Access: (0644/-rw-r--r--) Uid: ( 0/ root) Gid: ( 0/ root)
Context: system_u:object_r:sshd_key_t:s0
Access: 2022-08-04 16:00:41.542986958 +0000
Modify: 2022-07-07 08:22:09.390785251 +0000
Change: 2022-08-04 16:44:21.255796721 +0000
Birth: 2022-07-07 08:22:09.390785251 +0000
Expected: PASS
Findings :red_circle:
[root@Wazuh vagrant]# stat -L /etc/ssh/ssh_host_ed228519_key.pub
stat: cannot statx '/etc/ssh/ssh_host_ed228519_key.pub': No such file or directory
title: π’
description: π’
rationale: π’
remediation: :yellow_circle: an AND should be OR.
cis compliance: π’
[root@Wazuh vagrant]# sshd -T -C user=root -C host="$(hostname)" -C addr="$(grep $(hostname) /etc/hosts | awk '{print $1}')" | grep -Pi '^\h*(allow|deny)(users|groups)\h+\H+(\h+.*)?$'
[root@Wazuh vagrant]# grep -Pi '^\h*(allow|deny)(users|groups)\h+\H+(\h+.*)?$' /etc/ssh/sshd_config
[root@Wazuh vagrant]#
Expected: FAIL
title: π’
description: π’
rationale: π’
remediation: π’
cis compliance: π’
[root@Wazuh vagrant]# sshd -T -C user=root -C host="$(hostname)" -C addr="$(grep $(hostname) /etc/hosts | awk '{print $1}')" | grep loglevel
loglevel INFO
Expected: PASS
Findings: :yellow_circle: :
rules:
- 'c:sshd -T -C user=root -> r:^\s*LogLevel\s+VERBOSE|^\s*loglevel\s+INFO'```
title: π’
description: π’
rationale: π’
remediation: π’
cis compliance: π’
[root@Wazuh vagrant]# sshd -T -C user=root -C host="$(hostname)" -C addr="$(grep $(hostname) /etc/hosts | awk '{print $1}')" | grep -i usepam
usepam yes
[root@Wazuh vagrant]# grep -Ei '^\s*UsePAM\s+no' /etc/ssh/sshd_config
[root@Wazuh vagrant]#
Expected: PASS
title: π’
description: π’
rationale: π’
remediation: π’
cis compliance: π’
[root@Wazuh vagrant]# sshd -T -C user=root -C host="$(hostname)" -C addr="$(grep $(hostname) /etc/hosts | awk '{print $1}')" | grep permitrootlogin
permitrootlogin yes
[root@Wazuh vagrant]# grep -Ei '^\s*PermitRootLogin\s+yes' /etc/ssh/sshd_config
PermitRootLogin yes
Expected: FAIL
Description
This issue aims to manually test the correct functioning of the SCA checks, report the results, and open new issues for any encountered errors.
OS:
RHEL9 (Red Hat Enterprise Linux 9)
SCA policy file: cis_rhel9_linux.ymlTests
For each check in the SCA policy checks:
yml
file.https://github.com/wazuh/wazuh/blob/b2e6e27b0fcf11959d6013c2bac725cbaaa84ed0/ruleset/sca/rhel/9/cis_rhel9_linux.yml#L35-L3922
The installers must also be tested:
Note that at this moment there is no CIS Benchmark for RHEL9 available. We will use RHEL8 CIS Benchmark as the base.
Test report procedure
Any failing test must be properly addressed with a new issue, detailing the error and the possible cause.
An extended report of the test results can be attached as a ZIP or TXT file. Please attach any documents, screenshots, or tables to the issue update with the results. This report can be used by the auditors to dig deeper into any possible failures and details.
SCA checks
Conclusions
All the results reported in this issue, as well as other observations, have been discussed with @72nomada and have been addressed in the following commits: