# # This script is Copyright (C) 2004-2019 and is owned by Tenable, Inc. or an Affiliate thereof. # # This script is released under the Tenable Subscription License and # may not be used from within scripts released under another license # without authorization from Tenable, Inc. # # See the following licenses for details: # # http://static.tenable.com/prod_docs/Nessus_6_SLA_and_Subscription_Agreement.pdf # # @PROFESSIONALFEED@ # $Revision: 1.0 $ # $Date: 2019/11/06 $ # # Description : This document implements the security configuration as recommended by the CIS Red Hat Enterprise Linux 8 Benchmark v1.0.0 # # https://workbench.cisecurity.org/files/2485 # # #CIS Red Hat EL8 Server L1 v1.0.0 # # CIS # Red Hat EL8 Server L1 # 1.0.0 # https://workbench.cisecurity.org/files/2485 # #unix,cis,redhat,enterprise,linux,rhel,rhel_8 #LEVEL,CSCv6 # # # BANNER_TEXT # All activities performed on this system will be monitored. # Banner Text # This is the text for the warning a user receives when logging onto the system. # # # NTP_SERVER # 10\.0\.0\.2 # Network Time Server # Host address of the NTP server for the target. # # # SYSLOG_SERVER # 10\.0\.0\.2 # Log server # Host address of the sytem log server for the target to send logs to. # # # TRY_FIRST_PASS # try_first_pass # 5.3.1 - try_first_pass # retrieve the password from a previous stacked PAM module. If not available, then prompt the user for a password # # # PW_RETRY # [1-3] # 5.3.1 - Allowed PW Retries # retry=3 - Allow 3 tries before sending back a failure. # # # PW_MINLEN # (8|[8-9]|[1-9][0-9]) # 5.3.1 - PW minimum length # minlen-14 - password must be 8 characters or more # # # PW_DCREDIT # -1 # 5.3.1 - PW number of digits # dcredit=-1 - provide at least one digit # # # PW_UCREDIT # -1 # 5.3.1 - PW number of uppercase chars # ucredit=-1 - provide at least one uppercase character # # # PW_OCREDIT # -1 # 5.3.1 - PW number of special chars # ocredit=-1 - provide at least one special character # # # PW_LCREDIT # -1 # 5.3.1 - PW number of lowercase chars # lcredit=-1 - provide at least one lowercase character # # # MAX_START_UP # 10:30:100 # 5.2.18 Ensure SSH MaxStartups is configured # The benchmark recommended setting is 10:30:60 # # # MAX_SESSIONS # 10 # 5.2.19 Ensure SSH MaxSessions is set to 4 or less # The benchmark recommended setting is [1-4] # # # CUSTOM_PROFILE # sssd # 5.3.1 Create custom authselect profile # The custom profile name which follows your local site policy. # # # SHADOW_GID # 42 # Shadow Group GID # GID for the Shadow Group # # # system : "Linux" type : FILE_CONTENT_CHECK description : "Red Hat Enterprise Linux 8 is installed" file : "/etc/redhat-release" regex : "^[\\s]*Red Hat Enterprise Linux.*release 8" expect : "^[\\s]*Red Hat Enterprise Linux.*release 8" description : "CIS_Red_Hat_EL8_Server_L1_v1.0.0.audit from CIS Red Hat Enterprise Linux 8 Benchmark v1.0.0" system : "Linux" type : CMD_EXEC description : "1.1.1.1 Ensure mounting of cramfs filesystems is disabled - modprobe" info : "The cramfs filesystem type is a compressed read-only Linux filesystem embedded in small footprint systems. A cramfs image can be used without having to first decompress the image. Rationale: Removing support for unneeded filesystem types reduces the local attack surface of the server. If this filesystem type is not needed, disable it." solution : "Edit or create a file in the /etc/modprobe.d/ directory ending in .conf Example: vim /etc/modprobe.d/cramfs.conf and add the following line: install cramfs /bin/true Run the following command to unload the cramfs module: # rmmod cramfs" reference : "800-171|3.4.6,800-171|3.4.7,800-53|CM-7,CN-L3|7.1.3.5(c),CN-L3|7.1.3.7(d),CSCv7|5.1,CSF|PR.IP-1,CSF|PR.PT-3,ITSG-33|CM-7,LEVEL|1S,NIAv2|SS13b,NIAv2|SS14a,NIAv2|SS14c,NIAv2|SS15a,PCI-DSSv3.1|2.2.4,PCI-DSSv3.2|2.2.4,SWIFT-CSCv1|2.3" see_also : "https://workbench.cisecurity.org/files/2485" cmd : "/usr/sbin/modprobe -n -v cramfs | /usr/bin/awk '{print} END {if (NR == 0) print \"fail\"}'" expect : "install /bin/true" system : "Linux" type : CMD_EXEC description : "1.1.1.1 Ensure mounting of cramfs filesystems is disabled - lsmod" info : "The cramfs filesystem type is a compressed read-only Linux filesystem embedded in small footprint systems. A cramfs image can be used without having to first decompress the image. Rationale: Removing support for unneeded filesystem types reduces the local attack surface of the server. If this filesystem type is not needed, disable it." solution : "Edit or create a file in the /etc/modprobe.d/ directory ending in .conf Example: vim /etc/modprobe.d/cramfs.conf and add the following line: install cramfs /bin/true Run the following command to unload the cramfs module: # rmmod cramfs" reference : "800-171|3.4.6,800-171|3.4.7,800-53|CM-7,CN-L3|7.1.3.5(c),CN-L3|7.1.3.7(d),CSCv7|5.1,CSF|PR.IP-1,CSF|PR.PT-3,ITSG-33|CM-7,LEVEL|1S,NIAv2|SS13b,NIAv2|SS14a,NIAv2|SS14c,NIAv2|SS15a,SWIFT-CSCv1|2.3" see_also : "https://workbench.cisecurity.org/files/2485" cmd : "/usr/sbin/lsmod | /usr/bin/grep cramfs | /usr/bin/awk '{print} END {if (NR == 0) print \"pass\" ; else print \"fail\"}'" expect : "pass" system : "Linux" type : CMD_EXEC description : "1.1.1.3 Ensure mounting of squashfs filesystems is disabled - modprobe" info : "The squashfs filesystem type is a compressed read-only Linux filesystem embedded in small footprint systems (similar to cramfs ). A squashfs image can be used without having to first decompress the image. Rationale: Removing support for unneeded filesystem types reduces the local attack surface of the system. If this filesystem type is not needed, disable it." solution : "Edit or create a file in the /etc/modprobe.d/ directory ending in .conf Example: vim /etc/modprobe.d/squashfs.conf and add the following line: install squashfs /bin/true Run the following command to unload the squashfs module: # rmmod squashfs" reference : "800-171|3.4.6,800-171|3.4.7,800-53|CM-7,CN-L3|7.1.3.5(c),CN-L3|7.1.3.7(d),CSCv7|5.1,CSF|PR.IP-1,CSF|PR.PT-3,ITSG-33|CM-7,LEVEL|1S,NIAv2|SS13b,NIAv2|SS14a,NIAv2|SS14c,NIAv2|SS15a,PCI-DSSv3.1|2.2.4,PCI-DSSv3.2|2.2.4,SWIFT-CSCv1|2.3" see_also : "https://workbench.cisecurity.org/files/2485" cmd : "/sbin/modprobe -n -v squashfs | /usr/bin/awk '{print} END {if (NR == 0) print \"fail\"}'" expect : "install /bin/true" system : "Linux" type : CMD_EXEC description : "1.1.1.3 Ensure mounting of squashfs filesystems is disabled - lsmod" info : "The squashfs filesystem type is a compressed read-only Linux filesystem embedded in small footprint systems (similar to cramfs ). A squashfs image can be used without having to first decompress the image. Rationale: Removing support for unneeded filesystem types reduces the local attack surface of the system. If this filesystem type is not needed, disable it." solution : "Edit or create a file in the /etc/modprobe.d/ directory ending in .conf Example: vim /etc/modprobe.d/squashfs.conf and add the following line: install squashfs /bin/true Run the following command to unload the squashfs module: # rmmod squashfs" reference : "800-171|3.4.6,800-171|3.4.7,800-53|CM-7,CN-L3|7.1.3.5(c),CN-L3|7.1.3.7(d),CSCv7|5.1,CSF|PR.IP-1,CSF|PR.PT-3,ITSG-33|CM-7,LEVEL|1S,NIAv2|SS13b,NIAv2|SS14a,NIAv2|SS14c,NIAv2|SS15a,SWIFT-CSCv1|2.3" see_also : "https://workbench.cisecurity.org/files/2485" cmd : "/sbin/lsmod squashfs | /usr/bin/awk \'{print} END {if (NR == 0) print \"pass\" ; else print \"fail\"}\'" expect : "pass" system : "Linux" type : CMD_EXEC description : "1.1.1.4 Ensure mounting of udf filesystems is disabled - modprobe" info : "The udf filesystem type is the universal disk format used to implement ISO/IEC 13346 and ECMA-167 specifications. This is an open vendor filesystem type for data storage on a broad range of media. This filesystem type is necessary to support writing DVDs and newer optical disc formats. Rationale: Removing support for unneeded filesystem types reduces the local attack surface of the system. If this filesystem type is not needed, disable it." solution : "Edit or create a file in the /etc/modprobe.d/ directory ending in .conf Example: vim /etc/modprobe.d/udf.conf and add the following line: install udf /bin/true Run the following command to unload the udf module: # rmmod udf" reference : "800-171|3.4.6,800-171|3.4.7,800-53|CM-7,CN-L3|7.1.3.5(c),CN-L3|7.1.3.7(d),CSCv7|5.1,CSF|PR.IP-1,CSF|PR.PT-3,ITSG-33|CM-7,LEVEL|1S,NIAv2|SS13b,NIAv2|SS14a,NIAv2|SS14c,NIAv2|SS15a,PCI-DSSv3.1|2.2.4,PCI-DSSv3.2|2.2.4,SWIFT-CSCv1|2.3" see_also : "https://workbench.cisecurity.org/files/2485" cmd : "/sbin/modprobe -n -v udf | /usr/bin/awk '{print} END {if (NR == 0) print \"fail\"}'" expect : "install /bin/true" system : "Linux" type : CMD_EXEC description : "1.1.1.4 Ensure mounting of udf filesystems is disabled - lsmod" info : "The udf filesystem type is the universal disk format used to implement ISO/IEC 13346 and ECMA-167 specifications. This is an open vendor filesystem type for data storage on a broad range of media. This filesystem type is necessary to support writing DVDs and newer optical disc formats. Rationale: Removing support for unneeded filesystem types reduces the local attack surface of the system. If this filesystem type is not needed, disable it." solution : "Edit or create a file in the /etc/modprobe.d/ directory ending in .conf Example: vim /etc/modprobe.d/udf.conf and add the following line: install udf /bin/true Run the following command to unload the udf module: # rmmod udf" reference : "800-171|3.4.6,800-171|3.4.7,800-53|CM-7,CN-L3|7.1.3.5(c),CN-L3|7.1.3.7(d),CSCv7|5.1,CSF|PR.IP-1,CSF|PR.PT-3,ITSG-33|CM-7,LEVEL|1S,NIAv2|SS13b,NIAv2|SS14a,NIAv2|SS14c,NIAv2|SS15a,SWIFT-CSCv1|2.3" see_also : "https://workbench.cisecurity.org/files/2485" cmd : "/sbin/lsmod udf | /usr/bin/awk \'{print} END {if (NR == 0) print \"pass\" ; else print \"fail\"}\'" expect : "pass" system : "Linux" type : CMD_EXEC description : "1.1.2 Ensure /tmp is configured - mount" info : "The /tmp directory is a world-writable directory used for temporary storage by all users and some applications. Rationale: Making /tmp its own file system allows an administrator to set 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 hardlink to a system setuid program and wait for it to be updated. Once the program was updated, the hardlink 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." solution : "Configure /etc/fstab as appropriate. example: tmpfs /tmp tmpfs defaults,rw,nosuid,nodev,noexec,relatime 0 0 OR Run the following commands to enable systemd /tmp mounting: # systemctl unmask tmp.mount # systemctl enable tmp.mount Edit /etc/systemd/system/local-fs.target.wants/tmp.mount to configure the /tmp mount: [Mount] What=tmpfs Where=/tmp Type=tmpfs Options=mode=1777,strictatime,noexec,nodev,nosuid Impact: Since the /tmp directory is intended to be world-writable, there is a risk of resource exhaustion if it is not bound to a separate partition. Running out of /tmp space is a problem regardless of what kind of filesystem lies under it, but in a default installation a disk-based /tmp will essentially have the whole disk available, as it only creates a single / partition. On the other hand, a RAM-based /tmp as with tmpfs will almost certainly be much smaller, which can lead to applications filling up the filesystem much more easily. /tmp utilizing tmpfs can be resized using the size={size} parameter on the Options line on the tmp.mount file" reference : "800-171|3.4.2,800-53|CM-6,CSCv7|9.1,CSF|PR.IP-1,ITSG-33|CM-6,LEVEL|1S,NESA|T3.2.1,SWIFT-CSCv1|2.3" see_also : "https://workbench.cisecurity.org/files/2485" cmd : "/usr/bin/mount | /bin/grep /tmp" expect : ".*on[\\s]+/tmp[\\s]+type.*" system : "Linux" type : CMD_EXEC description : "1.1.2 Ensure /tmp is configured - systemctl" info : "The /tmp directory is a world-writable directory used for temporary storage by all users and some applications. Rationale: Making /tmp its own file system allows an administrator to set 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 hardlink to a system setuid program and wait for it to be updated. Once the program was updated, the hardlink 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." solution : "Configure /etc/fstab as appropriate. example: tmpfs /tmp tmpfs defaults,rw,nosuid,nodev,noexec,relatime 0 0 OR Run the following commands to enable systemd /tmp mounting: # systemctl unmask tmp.mount # systemctl enable tmp.mount Edit /etc/systemd/system/local-fs.target.wants/tmp.mount to configure the /tmp mount: [Mount] What=tmpfs Where=/tmp Type=tmpfs Options=mode=1777,strictatime,noexec,nodev,nosuid Impact: Since the /tmp directory is intended to be world-writable, there is a risk of resource exhaustion if it is not bound to a separate partition. Running out of /tmp space is a problem regardless of what kind of filesystem lies under it, but in a default installation a disk-based /tmp will essentially have the whole disk available, as it only creates a single / partition. On the other hand, a RAM-based /tmp as with tmpfs will almost certainly be much smaller, which can lead to applications filling up the filesystem much more easily. /tmp utilizing tmpfs can be resized using the size={size} parameter on the Options line on the tmp.mount file" reference : "CIP|007-6-R1,CSCv7|9.1,LEVEL|1S,PCI-DSSv3.1|2.2.2,PCI-DSSv3.1|2.2.3,PCI-DSSv3.2|2.2.2,PCI-DSSv3.2|2.2.3" see_also : "https://workbench.cisecurity.org/files/2485" cmd : "/usr/bin/systemctl is-enabled tmp.mount" expect : "enabled" system : "Linux" type : CMD_EXEC description : "1.1.3 Ensure nodev option set on /tmp partition" info : "The nodev mount option specifies that the filesystem cannot contain special devices. Rationale: Since the /tmp filesystem is not intended to support devices, set this option to ensure that users cannot attempt to create block or character special devices in /tmp ." solution : "Edit the /etc/fstab file and add nodev to the fourth field (mounting options) for the /tmp partition. See the fstab(5) manual page for more information. Run the following command to remount /tmp : # mount -o remount,nodev /tmp OR Edit /etc/systemd/system/local-fs.target.wants/tmp.mount to add nodev to the /tmp mount options: [Mount] Options=mode=1777,strictatime,noexec,nodev,nosuid Run the following command to remount /tmp : # mount -o remount,nodev /tmp" reference : "800-171|3.1.7,800-53|AC-6,CSCv7|5.1,CSF|PR.AC-4,LEVEL|1S" see_also : "https://workbench.cisecurity.org/files/2485" cmd : "/usr/bin/mount | /usr/bin/grep 'on /tmp '" expect : "[\\s]*[,]?nodev" system : "Linux" type : CMD_EXEC description : "1.1.4 Ensure nosuid option set on /tmp partition" info : "The nosuid mount option specifies that the filesystem cannot contain setuid files. Rationale: Since the /tmp filesystem is only intended for temporary file storage, set this option to ensure that users cannot create setuid files in /tmp ." solution : "Edit the /etc/fstab file and add nosuid to the fourth field (mounting options) for the /tmp partition. See the fstab(5) manual page for more information. Run the following command to remount /tmp : # mount -o remount,nosuid /tmp OR Edit /etc/systemd/system/local-fs.target.wants/tmp.mount to add nosuid to the /tmp mount options: [Mount] Options=mode=1777,strictatime,noexec,nodev,nosuid Run the following command to remount /tmp : # mount -o remount,nosuid /tmp" reference : "800-171|3.1.7,800-53|AC-6,CSCv7|5.1,CSF|PR.AC-4,LEVEL|1S" see_also : "https://workbench.cisecurity.org/files/2485" cmd : "/usr/bin/mount | /usr/bin/grep 'on /tmp '" expect : "[\\s]*[,]?nosuid" system : "Linux" type : CMD_EXEC description : "1.1.5 Ensure noexec option set on /tmp partition" info : "The noexec mount option specifies that the filesystem cannot contain executable binaries. Rationale: Since the /tmp filesystem is only intended for temporary file storage, set this option to ensure that users cannot run executable binaries from /tmp ." solution : "Edit the /etc/fstab file and add noexec to the fourth field (mounting options) for the /tmp partition. See the fstab(5) manual page for more information. Run the following command to remount /tmp : # mount -o remount,noexec /tmp OR Edit /etc/systemd/system/local-fs.target.wants/tmp.mount to add noexec to the /tmp mount options: [Mount] Options=mode=1777,strictatime,noexec,nodev,nosuid Run the following command to remount /tmp : # mount -o remount,noexec /tmp" reference : "800-171|3.1.7,800-53|AC-6,CSCv7|2.6,CSF|PR.AC-4,LEVEL|1S" see_also : "https://workbench.cisecurity.org/files/2485" cmd : "/usr/bin/mount | /usr/bin/grep 'on /tmp '" expect : "[\\s]*[,]?noexec" system : "Linux" type : CMD_EXEC description : "1.1.8 Ensure nodev option set on /var/tmp partition" info : "The nodev mount option specifies that the filesystem cannot contain special devices. Rationale: Since the /var/tmp filesystem is not intended to support devices, set this option to ensure that users cannot attempt to create block or character special devices in /var/tmp ." solution : "Edit the /etc/fstab file and add nodev to the fourth field (mounting options) for the /var/tmp partition. See the fstab(5) manual page for more information. Run the following command to remount /var/tmp : # mount -o remount,nodev /var/tmp" reference : "800-171|3.1.7,800-53|AC-6,CSCv7|5.1,CSF|PR.AC-4,LEVEL|1S" see_also : "https://workbench.cisecurity.org/files/2485" cmd : "/usr/bin/mount | /usr/bin/grep 'on /var/tmp '" expect : "[\\s]*[,]?nodev" system : "Linux" type : CMD_EXEC description : "1.1.9 Ensure nosuid option set on /var/tmp partition" info : "The nosuid mount option specifies that the filesystem cannot contain setuid files. Rationale: Since the /var/tmp filesystem is only intended for temporary file storage, set this option to ensure that users cannot create setuid files in /var/tmp ." solution : "Edit the /etc/fstab file and add nosuid to the fourth field (mounting options) for the /var/tmp partition. See the fstab(5) manual page for more information. Run the following command to remount /var/tmp: # mount -o remount,nosuid /var/tmp" reference : "800-171|3.1.7,800-53|AC-6,CSCv7|5.1,CSF|PR.AC-4,LEVEL|1S" see_also : "https://workbench.cisecurity.org/files/2485" cmd : "/usr/bin/mount | /usr/bin/grep 'on /var/tmp '" expect : "[\\s]*[,]?nosuid" system : "Linux" type : CMD_EXEC description : "1.1.10 Ensure noexec option set on /var/tmp partition" info : "The noexec mount option specifies that the filesystem cannot contain executable binaries. Rationale: Since the /var/tmp filesystem is only intended for temporary file storage, set this option to ensure that users cannot run executable binaries from /var/tmp ." solution : "Edit the /etc/fstab file and add noexec to the fourth field (mounting options) for the /var/tmp partition. See the fstab(5) manual page for more information. Run the following command to remount /var/tmp : # mount -o remount,noexec /var/tmp" reference : "800-171|3.1.7,800-53|AC-6,CSCv7|2.6,CSF|PR.AC-4,LEVEL|1S" see_also : "https://workbench.cisecurity.org/files/2485" cmd : "/usr/bin/mount | /usr/bin/grep 'on /var/tmp '" expect : "[\\s]*[,]?noexec" system : "Linux" type : CMD_EXEC description : "1.1.14 Ensure nodev option set on /home partition" info : "The nodev mount option specifies that the filesystem cannot contain special devices. Rationale: Since the user partitions are not intended to support devices, set this option to ensure that users cannot attempt to create block or character special devices." solution : "Edit the /etc/fstab file and add nodev to the fourth field (mounting options) for the /home partition. See the fstab(5) manual page for more information. # mount -o remount,nodev /home Notes: The actions in this recommendation refer to the /homepartition, which is the default user partition that is defined in many distributions. If you have created other user partitions, it is recommended that the Remediation and Audit steps be applied to these partitions as well." reference : "800-171|3.1.7,800-53|AC-6,CSCv7|5.1,CSF|PR.AC-4,LEVEL|1S" see_also : "https://workbench.cisecurity.org/files/2485" cmd : "/bin/mount | /bin/grep 'on /home '" expect : "[\\s]*[,]?nodev" system : "Linux" type : CMD_EXEC description : "1.1.15 Ensure nodev option set on /dev/shm partition" info : "The nodev mount option specifies that the filesystem cannot contain special devices. Rationale: Since the /dev/shm filesystem is not intended to support devices, set this option to ensure that users cannot attempt to create special devices in /dev/shm partitions." solution : "Edit the /etc/fstab file and add nodev to the fourth field (mounting options) for the /dev/shm partition. See the fstab(5) manual page for more information. Run the following command to remount /dev/shm : # mount -o remount,nodev /dev/shm Notes: Some distributions mount /dev/shm through other means and require /dev/shm to be added to /etc/fstab even though it is already being mounted on boot. Others may configure /dev/shm in other locations and may override /etc/fstab configuration. Consult the documentation appropriate for your distribution." reference : "800-171|3.1.7,800-53|AC-6,CSCv7|5.1,CSF|PR.AC-4,LEVEL|1S" see_also : "https://workbench.cisecurity.org/files/2485" cmd : "/bin/mount | /bin/grep 'on /dev/shm '" expect : "[\\s]*[,]?nodev" system : "Linux" type : CMD_EXEC description : "1.1.16 Ensure nosuid option set on /dev/shm partition" info : "The nosuid mount option specifies that the filesystem cannot contain setuid files. Rationale: Setting this option on a file system prevents users from introducing privileged programs onto the system and allowing non-root users to execute them." solution : "Edit the /etc/fstab file and add nosuid to the fourth field (mounting options) for the /dev/shm partition. See the fstab(5) manual page for more information. Run the following command to remount /dev/shm : # mount -o remount,nosuid /dev/shm Notes: Some distributions mount /dev/shm through other means and require /dev/shm to be added to /etc/fstab even though it is already being mounted on boot. Others may configure /dev/shm in other locations and may override /etc/fstab configuration. Consult the documentation appropriate for your distribution." reference : "800-171|3.1.7,800-53|AC-6,CSCv7|5.1,CSF|PR.AC-4,LEVEL|1S" see_also : "https://workbench.cisecurity.org/files/2485" cmd : "/bin/mount | /bin/grep 'on /dev/shm '" expect : "[\\s]*[,]?nosuid" system : "Linux" type : CMD_EXEC description : "1.1.17 Ensure noexec option set on /dev/shm partition" info : "The noexec mount option specifies that the filesystem cannot contain executable binaries. Rationale: Setting this option on a file system prevents users from executing programs from shared memory. This deters users from introducing potentially malicious software on the system." solution : "Edit the /etc/fstab file and add noexec to the fourth field (mounting options) for the /dev/shm partition. See the fstab(5) manual page for more information. Run the following command to remount /dev/shm: # mount -o remount,noexec /dev/shm Notes: Some distributions mount /dev/shm through other means and require /dev/shm to be added to /etc/fstab even though it is already being mounted on boot. Others may configure /dev/shm in other locations and may override /etc/fstab configuration. Consult the documentation appropriate for your distribution." reference : "800-171|3.1.7,800-53|AC-6,CSCv7|2.6,CSF|PR.AC-4,LEVEL|1S" see_also : "https://workbench.cisecurity.org/files/2485" cmd : "/bin/mount | /bin/grep 'on /dev/shm '" expect : "[\\s]*[,]?noexec" system : "Linux" type : FILE_CONTENT_CHECK description : "1.1.18 Ensure nodev option set on removable media partitions" info : "The nodev mount option specifies that the filesystem cannot contain special devices. Rationale: Removable media containing character and block special devices could be used to circumvent security controls by allowing non-root users to access sensitive device files such as /dev/kmem or the raw disk partitions." solution : "Edit the /etc/fstab file and add nodev to the fourth field (mounting options) of all removable media partitions. Look for entries that have mount points that contain words such as floppy or cdrom. See the fstab(5) manual page for more information." reference : "800-171|3.1.7,800-53|AC-6,CSCv7|5.1,CSF|PR.AC-4,LEVEL|1NS,PCI-DSSv3.1|2.2.4,PCI-DSSv3.2|2.2.4" see_also : "https://workbench.cisecurity.org/files/2485" file : "/etc/fstab" regex : "^[\\s]*.*[\\s]+\/m.*\/(floppy|cdrom|corder)[\\s]" expect : "^[\\s]*.*[\\s]+\/m.*\/(floppy|cdrom|corder)[\\s].*,nodev" string_required : NO system : "Linux" type : FILE_CONTENT_CHECK description : "1.1.19 Ensure nosuid option set on removable media partitions" info : "The nosuid mount option specifies that the filesystem cannot contain setuid files. Rationale: Setting this option on a file system prevents users from introducing privileged programs onto the system and allowing non-root users to execute them." solution : "Edit the /etc/fstab file and add nosuid to the fourth field (mounting options) of all removable media partitions. Look for entries that have mount points that contain words such as floppy or cdrom. See the fstab(5) manual page for more information." reference : "800-171|3.1.7,800-53|AC-6,CSCv7|5.1,CSF|PR.AC-4,LEVEL|1NS,PCI-DSSv3.1|2.2.4,PCI-DSSv3.2|2.2.4" see_also : "https://workbench.cisecurity.org/files/2485" file : "/etc/fstab" regex : "^[\\s]*[^#]*[\\s]+\\/m.*\\/(floppy|cdrom|corder)[\\s]" expect : "^[\\s]*[^#]*[\\s]+\\/m.*\\/(floppy|cdrom|corder)[\\s].*[,]?nosuid" string_required : NO system : "Linux" type : FILE_CONTENT_CHECK description : "1.1.20 Ensure noexec option set on removable media partitions" info : "The noexec mount option specifies that the filesystem cannot contain executable binaries. Rationale: Setting this option on a file system prevents users from executing programs from the removable media. This deters users from being able to introduce potentially malicious software on the system." solution : "Edit the /etc/fstab file and add noexec to the fourth field (mounting options) of all removable media partitions. Look for entries that have mount points that contain words such as floppy or cdrom. See the fstab(5) manual page for more information." reference : "800-171|3.1.7,800-53|AC-6,CSCv7|2.6,CSF|PR.AC-4,LEVEL|1NS,PCI-DSSv3.1|2.2.4,PCI-DSSv3.2|2.2.4" see_also : "https://workbench.cisecurity.org/files/2485" file : "/etc/fstab" regex : "^[\\s]*[^#]*[\\s]+\\/m.*\\/(floppy|cdrom|corder)[\\s]" expect : "^[\\s]*[^#]*[\\s]+\\/m.*\\/(floppy|cdrom|corder)[\\s].*[,]?noexec" string_required : NO system : "Linux" type : CMD_EXEC description : "1.1.21 Ensure sticky bit is set on all world-writable directories" info : "Setting the sticky bit on world writable directories prevents users from deleting or renaming files in that directory that are not owned by them. Rationale: This feature prevents the ability to delete or rename files in world writable directories (such as /tmp ) that are owned by another user." solution : "Run the following command to set the sticky bit on all world writable directories: # df --local -P | awk '{if (NR!=1) print $6}' | xargs -I '{}' find '{}' -xdev -type d \( -perm -0002 -a ! -perm -1000 \) 2>/dev/null | xargs -I '{}' chmod a+t '{}'" reference : "800-171|3.1.1,800-171|3.1.2,800-53|AC-3,CSCv7|5.1,CSF|PR.AC-4,CSF|PR.PT-3,ITSG-33|AC-3,LEVEL|1S,NESA|T5.5.4,NESA|T7.5.3" see_also : "https://workbench.cisecurity.org/files/2485" cmd : "/usr/bin/df --local -P | /usr/bin/awk {'if (NR!=1) print $6'} | /usr/bin/xargs -I '{}' /usr/bin/find '{}' -xdev -type d \\( -perm -0002 -a ! -perm -1000 \\) 2>/dev/null | /usr/bin/awk '{print} END {if (NR == 0) print \"none\"}'" expect : "none" system : "Linux" type : CMD_EXEC description : "1.1.22 Disable Automounting" info : "autofs allows automatic mounting of devices, typically including CD/DVDs and USB drives. Rationale: With automounting enabled anyone with physical access could attach a USB drive or disc and have its contents available in system even if they lacked permissions to mount it themselves." solution : "Run the following command to disable autofs: # systemctl --now disable autofs Impact: The use of portable hard drives is very common for workstation users. If your organization allows the use of portable storage or media on workstations and physical access controls to workstations is considered adequate there is little value add in turning off automounting. Notes: Additional methods of disabling a service exist. Consult your distribution documentation for appropriate methods. This control should align with the tolerance of the use of portable drives and optical media in the organization. On a server requiring an admin to manually mount media can be part of defense-in-depth to reduce the risk of unapproved software or information being introduced or proprietary software or information being exfiltrated. If admins commonly use flash drives and Server access has sufficient physical controls, requiring manual mounting may not increase security." reference : "CIP|007-6-R1,CSCv7|8.4,CSCv7|8.5,LEVEL|1S,PCI-DSSv3.1|2.2.2,PCI-DSSv3.1|2.2.3,PCI-DSSv3.2|2.2.2,PCI-DSSv3.2|2.2.3" see_also : "https://workbench.cisecurity.org/files/2485" cmd : "/usr/bin/systemctl is-enabled autofs | /usr/bin/awk '{print} END {if(NR==0) print \"disabled\" }'" expect : "disabled" dont_echo_cmd : YES system : "Linux" type : CMD_EXEC description : "1.1.23 Disable USB Storage - modprobe" info : "USB storage provides a means to transfer and store files insuring persistence and availability of the files independent of network connection status. Its popularity and utility has led to USB-based malware being a simple and common means for network infiltration and a first step to establishing a persistent threat within a networked environment. Rationale: Restricting USB access on the system will decrease the physical attack surface for a device and diminish the possible vectors to introduce malware." solution : "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 Notes: An alternative solution to disabling the usb-storage module may be found in USBGuard. Red Hat documents the use of the USBGuard framework for fine-grained, policy-driven control of USB devices on Red Hat Enterprise Linux systems at https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/security_guide/sec-using-usbguard. Use of USBGuard and construction of USB device policies should be done in alignment with site policy." reference : "800-171|3.4.6,800-171|3.4.7,800-53|CM-7,CN-L3|7.1.3.5(c),CN-L3|7.1.3.7(d),CSCv7|8.4,CSCv7|8.5,CSF|PR.IP-1,CSF|PR.PT-3,ITSG-33|CM-7,LEVEL|1S,NIAv2|SS13b,NIAv2|SS14a,NIAv2|SS14c,NIAv2|SS15a,PCI-DSSv3.1|2.2.4,PCI-DSSv3.2|2.2.4,SWIFT-CSCv1|2.3" see_also : "https://workbench.cisecurity.org/files/2485" cmd : "/usr/sbin/modprobe -n -v usb-storage | /usr/bin/awk '{print} END {if (NR == 0) print \"fail\"}'" expect : "install /bin/true" system : "Linux" type : CMD_EXEC description : "1.1.23 Disable USB Storage - lsmod" info : "USB storage provides a means to transfer and store files insuring persistence and availability of the files independent of network connection status. Its popularity and utility has led to USB-based malware being a simple and common means for network infiltration and a first step to establishing a persistent threat within a networked environment. Rationale: Restricting USB access on the system will decrease the physical attack surface for a device and diminish the possible vectors to introduce malware." solution : "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 Notes: An alternative solution to disabling the usb-storage module may be found in USBGuard. Red Hat documents the use of the USBGuard framework for fine-grained, policy-driven control of USB devices on Red Hat Enterprise Linux systems at https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/security_guide/sec-using-usbguard. Use of USBGuard and construction of USB device policies should be done in alignment with site policy." reference : "800-171|3.4.6,800-171|3.4.7,800-53|CM-7,CN-L3|7.1.3.5(c),CN-L3|7.1.3.7(d),CSCv7|8.4,CSCv7|8.5,CSF|PR.IP-1,CSF|PR.PT-3,ITSG-33|CM-7,LEVEL|1S,NIAv2|SS13b,NIAv2|SS14a,NIAv2|SS14c,NIAv2|SS15a,SWIFT-CSCv1|2.3" see_also : "https://workbench.cisecurity.org/files/2485" cmd : "/usr/sbin/lsmod | /usr/bin/grep usb-storage | /usr/bin/awk '{print} END {if (NR == 0) print \"pass\" ; else print \"fail\"}'" expect : "pass" system : "Linux" type : CMD_EXEC description : "1.2.1 Ensure Red Hat Subscription Manager connection is configured" info : "Systems need to be registered with the Red Hat Subscription Manager (RHSM) to receive patch updates. This is usually configured during initial installation. Rationale: It is important to register with the Red Hat Subscription Manager to make sure that patches are updated on a regular basis. This helps to reduce the exposure time as new vulnerabilities are discovered. NOTE: Nessus has provided the target output to assist in reviewing the benchmark to ensure target compliance." solution : "Run the following command to connect to the Red Hat Subscription Manager: # subscription-manager register" reference : "800-171|3.14.1,800-53|SI-2,CSCv7|3.4,CSF|ID.RA-1,CSF|PR.IP-12,ITSG-33|SI-2,LEVEL|1NS,NESA|T7.6.2,NESA|T7.7.1,NIAv2|AM38,NIAv2|AM39,NIAv2|PR9,NIAv2|SS14b,SWIFT-CSCv1|2.2" see_also : "https://workbench.cisecurity.org/files/2485" cmd : "/usr/bin/subscription-manager identity" expect : "ManualReviewRequired" severity : MEDIUM system : "Linux" type : CHKCONFIG description : "1.2.2 Disable the rhnsd Daemon" info : "The rhnsd daemon polls the Red Hat Network web site for scheduled actions and, if there are, executes those actions. Rationale: Patch management policies may require that organizations test the impact of a patch before it is deployed in a production environment. Having patches automatically deployed could have a negative impact on the environment. It is best to not allow an action by default but only after appropriate consideration has been made. It is recommended that the service be disabled unless the risk is understood and accepted or you are running your own satellite . This item is not scored because organizations may have addressed the risk." solution : "Run the following command to disable rhnsd: # systemctl --now disable rhnsd" reference : "800-171|3.4.6,800-171|3.4.7,800-53|CM-7,CIP|007-6-R1,CN-L3|7.1.3.5(c),CN-L3|7.1.3.7(d),CSCv7|3.4,CSF|PR.IP-1,CSF|PR.PT-3,ITSG-33|CM-7,LEVEL|1NS,NIAv2|SS13b,NIAv2|SS14a,NIAv2|SS14c,NIAv2|SS15a,PCI-DSSv3.1|2.2.2,PCI-DSSv3.1|2.2.3,PCI-DSSv3.2|2.2.2,PCI-DSSv3.2|2.2.3,SWIFT-CSCv1|2.3" see_also : "https://workbench.cisecurity.org/files/2485" status : OFF levels : "0123456" service : "rhnsd" system : "Linux" type : CMD_EXEC description : "1.2.3 Ensure GPG keys are configured" info : "Most packages managers implement GPG key signing to verify package integrity during installation. Rationale: It is important to ensure that updates are obtained from a valid source to protect against spoofing that could lead to the inadvertent installation of malware on the system. NOTE: Nessus has provided the target output to assist in reviewing the benchmark to ensure target compliance." solution : "Update your package manager GPG keys in accordance with site policy." reference : "800-53|SI-7,CSCv7|3.4,CSF|PR.DS-6,LEVEL|1NS,SWIFT-CSCv1|6.2" see_also : "https://workbench.cisecurity.org/files/2485" cmd : "/usr/bin/rpm -q gpg-pubkey --queryformat '%{name}-%{version}-%{release} --> %{summary}\n'" expect : "^gpg-pubkey(-[a-f0-9]{8}){2} --> gpg\\(Red\\s+Hat,\\s+Inc\\.\\s+\\(release\\s+key\\s*.*\\)\\s+\\[\\)]?" severity : MEDIUM dont_echo_cmd : YES system : "Linux" type : FILE_CONTENT_CHECK description : "1.2.4 Ensure gpgcheck is globally activated" info : "The gpgcheck option, found in the main section of the /etc/yum.conf and individual /etc/yum/repos.d/* files determines if an RPM package's signature is checked prior to its installation. Rationale: It is important to ensure that an RPM's package signature is always checked prior to installation to ensure that the software is obtained from a trusted source." solution : "Edit /etc/yum.conf and set 'gpgcheck=1' in the [main] section. Edit any failing files in /etc/yum.repos.d/* and set all instances of gpgcheck to '1'." reference : "800-53|SI-7,CSCv7|3.4,CSF|PR.DS-6,LEVEL|1S,SWIFT-CSCv1|6.2" see_also : "https://workbench.cisecurity.org/files/2485" file : "/etc/yum.conf" regex : "^[\\s]*gpgcheck[\\s]*=" expect : "^[\\s]*gpgcheck[\\s]*=[\\s]*1[\\s]*$" system : "Linux" type : CMD_EXEC description : "1.2.5 Ensure package manager repositories are configured" info : "Systems need to have package manager repositories configured to ensure they receive the latest patches and updates. Rationale: If a system's package repositories are misconfigured important patches may not be identified or a rogue repository could introduce compromised software. NOTE: Nessus has provided the target output to assist in reviewing the benchmark to ensure target compliance." solution : "Configure your package manager repositories according to site policy." reference : "800-171|3.14.1,800-53|SI-2,CSCv7|3.4,CSF|ID.RA-1,CSF|PR.IP-12,ITSG-33|SI-2,LEVEL|1NS,NESA|T7.6.2,NESA|T7.7.1,NIAv2|PR9,SWIFT-CSCv1|2.2" see_also : "https://workbench.cisecurity.org/files/2485" cmd : "/usr/bin/yum repolist" expect : "ManualReviewRequired" severity : MEDIUM system : "Linux" type : RPM_CHECK description : "1.3.1 Ensure sudo is installed" info : "sudo allows a permitted user to execute a command as the superuser or another user, as specified by the security policy. The invoking user's real (not effective) user ID is used to determine the user name with which to query the security policy. Rationale: sudo supports a plugin architecture for security policies and input/output logging. Third parties can develop and distribute their own policy and I/O logging plugins to work seamlessly with the sudo front end. The default security policy is sudoers, which is configured via the file /etc/sudoers. The security policy determines what privileges, if any, a user has to run sudo. The policy may require that users authenticate themselves with a password or another authentication mechanism. If authentication is required, sudo will exit if the user's password is not entered within a configurable time limit. This limit is policy-specific." solution : "Run the following command to install sudo # dnf install sudo" reference : "800-171|3.4.8,800-53|CM-7,CSCv7|4.3,CSF|PR.IP-1,CSF|PR.PT-3,ISO/IEC-27001|A.12.5.1,ISO/IEC-27001|A.12.6.2,LEVEL|1S,PCI-DSSv3.1|12.3.7,PCI-DSSv3.2|12.3.7,SWIFT-CSCv1|2.3" see_also : "https://workbench.cisecurity.org/files/2485" rpm : "sudo-0.0.0-0" operator : "gt" required : YES system : "Linux" type : CMD_EXEC description : "1.3.2 Ensure sudo commands use pty" info : "sudo can be configured to run only from a psuedo-pty Rationale: Attackers can run a malicious program using sudo which would fork a background process that remains even when the main program has finished executing." solution : "edit the file /etc/sudoers or a file in /etc/sudoers.d/ with visudo -f and add the following line: Defaults use_pty Impact: editing the sudo configuration incorrectly can cause sudo to stop functioning." reference : "800-171|3.1.1,800-53|AC-3,CN-L3|7.1.2.2(g),CN-L3|7.1.3.2(c),CSCv7|5.1,CSF|PR.AC-4,CSF|PR.PT-3,LEVEL|1S" see_also : "https://workbench.cisecurity.org/files/2485" cmd : "/usr/bin/grep -s -E '^[[:space:]]*Defaults[[:space:]]+(\[^#]+,[[:space:]]*)?use_pty' /etc/sudoers /etc/sudoers.d/* | /usr/bin/awk '{print} END {if (NR != 0) print \"pass\" ; else print \"fail\"}'" expect : "^pass$" system : "Linux" type : CMD_EXEC description : "1.3.3 Ensure sudo log file exists" info : "sudo can use a custom log file Rationale: A sudo log file simplifies auditing of sudo commands" solution : "edit the file /etc/sudoers or a file in /etc/sudoers.d/ with visudo -f and add the following line: Defaults logfile=\"\" **Example Defaults logfile=\"/var/log/sudo.log\" Impact: editing the sudo configuration incorrectly can cause sudo to stop functioning" reference : "800-171|3.3.1,800-171|3.3.2,800-53|AU-12,CN-L3|7.1.3.3(a),CN-L3|7.1.3.3(b),CN-L3|7.1.3.3(c),CSCv7|6.3,CSF|DE.CM-1,CSF|DE.CM-3,CSF|DE.CM-7,CSF|PR.PT-1,ISO/IEC-27001|A.12.4.1,ITSG-33|AU-12,LEVEL|1S,NESA|T3.6.2,NESA|T3.6.5,NESA|T3.6.6,NIAv2|SM8,SWIFT-CSCv1|6.4,TBA-FIISB|45.1.1" see_also : "https://workbench.cisecurity.org/files/2485" cmd : "/usr/bin/grep -s -E '^[[:space:]]*Defaults[[:space:]]+(\[^#]+,[[:space:]]*)?logfile=' /etc/sudoers /etc/sudoers.d/* | /usr/bin/awk '{print} END {if (NR != 0) print \"pass\" ; else print \"fail\"}'" expect : "^pass$" system : "Linux" type : RPM_CHECK description : "1.4.1 Ensure AIDE is installed" info : "AIDE takes a snapshot of filesystem state including modification times, permissions, and file hashes which can then be used to compare against the current state of the filesystem to detect modifications to the system. Rationale: By monitoring the filesystem state compromised files can be detected to prevent or limit the exposure of accidental or malicious misconfigurations or modified binaries." solution : "Run the following command to install AIDE: # dnf install aide Configure AIDE as appropriate for your environment. Consult the AIDE documentation for options. Initialize AIDE: Run the following commands: # aide --init # mv /var/lib/aide/aide.db.new.gz /var/lib/aide/aide.db.gz" reference : "800-171|3.4.8,800-53|CM-7,CSCv7|14.9,CSF|PR.IP-1,CSF|PR.PT-3,ISO/IEC-27001|A.12.5.1,ISO/IEC-27001|A.12.6.2,LEVEL|1S,PCI-DSSv3.1|12.3.7,PCI-DSSv3.2|12.3.7,SWIFT-CSCv1|2.3" see_also : "https://workbench.cisecurity.org/files/2485" rpm : "aide-0.0.0-0" operator : "gt" required : YES system : "Linux" type : CMD_EXEC description : "1.4.2 Ensure filesystem integrity is regularly checked - crontab" cmd : "/usr/bin/crontab -u root -l | /usr/bin/grep aide" expect : "^((\\d{1,2}|\\*)[\\s]+){5}\\/usr\\/sbin\\/aide[\\s]+--check[\\s]*(.*)$" system : "Linux" type : CMD_EXEC description : "1.4.2 Ensure filesystem integrity is regularly checked - /etc/cron.*" cmd : "/usr/bin/grep -r aide /etc/cron.* /etc/crontab" expect : "^((\\d{1,2}|\\*)[\\s]+){5}\\/usr\\/sbin\\/aide[\\s]+--check[\\s]*(.*)$" description : "1.4.2 Ensure filesystem integrity is regularly checked" info : "Periodic checking of the filesystem integrity is needed to detect changes to the filesystem. Rationale: Periodic file checking allows the system administrator to determine on a regular basis if critical files have been changed in an unauthorized fashion." solution : "Run the following commands: # cp ./config/aidecheck.service /etc/systemd/system/aidecheck.service # cp ./config/aidecheck.timer /etc/systemd/system/aidecheck.timer # chmod 0644 /etc/systemd/system/aidecheck.* # systemctl reenable aidecheck.timer # systemctl restart aidecheck.timer # systemctl daemon-reload OR Run the following command: # crontab -u root -e Add the following line to the crontab: 0 5 * * * /usr/sbin/aide --check" reference : "CSCv7|14.9,LEVEL|1S" see_also : "https://workbench.cisecurity.org/files/2485" description : "1.4.2 Ensure filesystem integrity is regularly checked" info : "Periodic checking of the filesystem integrity is needed to detect changes to the filesystem. Rationale: Periodic file checking allows the system administrator to determine on a regular basis if critical files have been changed in an unauthorized fashion." solution : "Run the following commands: # cp ./config/aidecheck.service /etc/systemd/system/aidecheck.service # cp ./config/aidecheck.timer /etc/systemd/system/aidecheck.timer # chmod 0644 /etc/systemd/system/aidecheck.* # systemctl reenable aidecheck.timer # systemctl restart aidecheck.timer # systemctl daemon-reload OR Run the following command: # crontab -u root -e Add the following line to the crontab: 0 5 * * * /usr/sbin/aide --check" reference : "CSCv7|14.9,LEVEL|1S" see_also : "https://workbench.cisecurity.org/files/2485" system : "Linux" type : FILE_CHECK_NOT description : "Check that /sys/firmware/efi does not exist" file : "/sys/firmware/efi" system : "Linux" type : FILE_CHECK description : "1.5.1 Ensure permissions on bootloader config are configured - grub.cfg" info : "The grub configuration file contains information on boot settings and passwords for unlocking boot options. The grub configuration is usually grub.cfg and grubenv stored in/boot/grub2/` Rationale: Setting the permissions to read and write for root only prevents non-root users from seeing the boot parameters or changing them. Non-root users who read the boot parameters may be able to identify weaknesses in security upon boot and be able to exploit them." solution : "Run the following commands to set permissions on your grub configuration: # chown root:root /boot/grub2/grub.cfg # chmod og-rwx /boot/grub2/grub.cfg # chown root:root /boot/grub2/grubenv # chmod og-rwx /boot/grub2/grubenv Notes: This recommendation is designed around the grub bootloader, if LILO or another bootloader is in use in your environment enact equivalent settings. Replace /boot/grub2/grub.cfg and /boot/grub2/grubenv with the appropriate configuration file(s) for your environment" reference : "800-53|SI-7,CSCv7|5.1,CSF|PR.DS-6,LEVEL|1S,PCI-DSSv3.1|2.2.4,PCI-DSSv3.2|2.2.4" see_also : "https://workbench.cisecurity.org/files/2485" file : "/boot/grub2/grub.cfg" owner : "root" mask : "177" group : "root" system : "Linux" type : FILE_CHECK description : "1.5.1 Ensure permissions on bootloader config are configured - user.cfg" info : "The grub configuration file contains information on boot settings and passwords for unlocking boot options. The grub configuration is usually grub.cfg and grubenv stored in/boot/grub2/` Rationale: Setting the permissions to read and write for root only prevents non-root users from seeing the boot parameters or changing them. Non-root users who read the boot parameters may be able to identify weaknesses in security upon boot and be able to exploit them." solution : "Run the following commands to set permissions on your grub configuration: # chown root:root /boot/grub2/grub.cfg # chmod og-rwx /boot/grub2/grub.cfg # chown root:root /boot/grub2/grubenv # chmod og-rwx /boot/grub2/grubenv Notes: This recommendation is designed around the grub bootloader, if LILO or another bootloader is in use in your environment enact equivalent settings. Replace /boot/grub2/grub.cfg and /boot/grub2/grubenv with the appropriate configuration file(s) for your environment" reference : "800-53|SI-7,CSCv7|5.1,CSF|PR.DS-6,LEVEL|1S,PCI-DSSv3.1|2.2.4,PCI-DSSv3.2|2.2.4" see_also : "https://workbench.cisecurity.org/files/2485" file : "/boot/grub2/user.cfg" owner : "root" mask : "177" group : "root" system : "Linux" type : FILE_CONTENT_CHECK description : "1.5.2 Ensure bootloader password is set" info : "Setting the boot loader password will require that anyone rebooting the system must enter a password before being able to set command line boot parameters Rationale: Requiring a boot password upon execution of the boot loader will prevent an unauthorized user from entering boot parameters or changing the boot partition. This prevents users from weakening security (e.g. turning off SELinux at boot time)." solution : "Create an encrypted password with grub2-setpassword : # grub2-setpassword Enter password: Confirm password: Run the following command to update the grub2 configuration: # grub2-mkconfig -o /boot/grub2/grub.cfg Impact: If password protection is enabled, only the designated superuser can edit a Grub 2 menu item by pressing \"e\" or access the GRUB 2 command line by pressing \"c\" If GRUB 2 is set up to boot automatically to a password-protected menu entry the user has no option to back out of the password prompt to select another menu entry. Holding the SHIFT key will not display the menu in this case. The user must enter the correct username and password. If unable, the configuration files will have to be edited via the LiveCD or other means to fix the problem You can add --unrestricted to the menu entries to allow the system to boot without entering a password. Password will still be required to edit menu items. Notes: This recommendation is designed around the grub2 bootloader, if LILO or another bootloader is in use in your environment enact equivalent settings. Replace `/boot/grub2/grub.cfg with the appropriate grub configuration file for your environment The superuser/user information and password do not have to be contained in the /etc/grub.d/00_header file. The information can be placed in any /etc/grub.d file as long as that file is incorporated into grub.cfg. The user may prefer to enter this data into a custom file, such as /etc/grub.d/40_custom so it is not overwritten should the Grub package be updated. If placing the information in a custom file, do not include the \"cat << EOF\" and \"EOF\" lines as the content is automatically added from these files." reference : "800-171|3.1.1,800-53|AC-3,CSCv7|5.1,CSF|PR.AC-4,CSF|PR.PT-3,ISO/IEC-27001|A.9.4.1,ITSG-33|AC-3,LEVEL|1S,NESA|T4.2.1,NESA|T5.4.4,NESA|T5.4.5,NESA|T5.5.4,NESA|T5.6.1,NESA|T7.5.2,NESA|T7.5.3,NIAv2|AM3,NIAv2|SS29" see_also : "https://workbench.cisecurity.org/files/2485" file : "/boot/grub2/user.cfg" regex : "^[\\s]*GRUB2_PASSWORD" expect : "^[\\s]*GRUB2_PASSWORD[\\s]*=[^\\s]+$" system : "Linux" type : FILE_CHECK description : "1.5.1 Ensure permissions on bootloader config are configured - grub.cfg" info : "The grub configuration file contains information on boot settings and passwords for unlocking boot options. The grub configuration is usually grub.cfg and grubenv stored in/boot/grub2/` Rationale: Setting the permissions to read and write for root only prevents non-root users from seeing the boot parameters or changing them. Non-root users who read the boot parameters may be able to identify weaknesses in security upon boot and be able to exploit them." solution : "Run the following commands to set permissions on your grub configuration: # chown root:root /boot/grub2/grub.cfg # chmod og-rwx /boot/grub2/grub.cfg # chown root:root /boot/grub2/grubenv # chmod og-rwx /boot/grub2/grubenv Notes: This recommendation is designed around the grub bootloader, if LILO or another bootloader is in use in your environment enact equivalent settings. Replace /boot/grub2/grub.cfg and /boot/grub2/grubenv with the appropriate configuration file(s) for your environment" reference : "800-53|SI-7,CSCv7|5.1,CSF|PR.DS-6,LEVEL|1S,PCI-DSSv3.1|2.2.4,PCI-DSSv3.2|2.2.4" see_also : "https://workbench.cisecurity.org/files/2485" file : "/boot/efi/EFI/redhat/grub.cfg" owner : "root" mask : "177" group : "root" system : "Linux" type : FILE_CHECK description : "1.5.1 Ensure permissions on bootloader config are configured - user.cfg" info : "The grub configuration file contains information on boot settings and passwords for unlocking boot options. The grub configuration is usually grub.cfg and grubenv stored in/boot/grub2/` Rationale: Setting the permissions to read and write for root only prevents non-root users from seeing the boot parameters or changing them. Non-root users who read the boot parameters may be able to identify weaknesses in security upon boot and be able to exploit them." solution : "Run the following commands to set permissions on your grub configuration: # chown root:root /boot/grub2/grub.cfg # chmod og-rwx /boot/grub2/grub.cfg # chown root:root /boot/grub2/grubenv # chmod og-rwx /boot/grub2/grubenv Notes: This recommendation is designed around the grub bootloader, if LILO or another bootloader is in use in your environment enact equivalent settings. Replace /boot/grub2/grub.cfg and /boot/grub2/grubenv with the appropriate configuration file(s) for your environment" reference : "800-53|SI-7,CSCv7|5.1,CSF|PR.DS-6,LEVEL|1S,PCI-DSSv3.1|2.2.4,PCI-DSSv3.2|2.2.4" see_also : "https://workbench.cisecurity.org/files/2485" file : "/boot/efi/EFI/redhat/user.cfg" owner : "root" mask : "177" group : "root" system : "Linux" type : FILE_CONTENT_CHECK description : "1.5.2 Ensure bootloader password is set" info : "Setting the boot loader password will require that anyone rebooting the system must enter a password before being able to set command line boot parameters Rationale: Requiring a boot password upon execution of the boot loader will prevent an unauthorized user from entering boot parameters or changing the boot partition. This prevents users from weakening security (e.g. turning off SELinux at boot time)." solution : "Create an encrypted password with grub2-setpassword : # grub2-setpassword Enter password: Confirm password: Run the following command to update the grub2 configuration: # grub2-mkconfig -o /boot/grub2/grub.cfg Impact: If password protection is enabled, only the designated superuser can edit a Grub 2 menu item by pressing \"e\" or access the GRUB 2 command line by pressing \"c\" If GRUB 2 is set up to boot automatically to a password-protected menu entry the user has no option to back out of the password prompt to select another menu entry. Holding the SHIFT key will not display the menu in this case. The user must enter the correct username and password. If unable, the configuration files will have to be edited via the LiveCD or other means to fix the problem You can add --unrestricted to the menu entries to allow the system to boot without entering a password. Password will still be required to edit menu items. Notes: This recommendation is designed around the grub2 bootloader, if LILO or another bootloader is in use in your environment enact equivalent settings. Replace `/boot/grub2/grub.cfg with the appropriate grub configuration file for your environment The superuser/user information and password do not have to be contained in the /etc/grub.d/00_header file. The information can be placed in any /etc/grub.d file as long as that file is incorporated into grub.cfg. The user may prefer to enter this data into a custom file, such as /etc/grub.d/40_custom so it is not overwritten should the Grub package be updated. If placing the information in a custom file, do not include the \"cat << EOF\" and \"EOF\" lines as the content is automatically added from these files." reference : "800-171|3.1.1,800-53|AC-3,CSCv7|5.1,CSF|PR.AC-4,CSF|PR.PT-3,ISO/IEC-27001|A.9.4.1,ITSG-33|AC-3,LEVEL|1S,NESA|T4.2.1,NESA|T5.4.4,NESA|T5.4.5,NESA|T5.5.4,NESA|T5.6.1,NESA|T7.5.2,NESA|T7.5.3,NIAv2|AM3,NIAv2|SS29" see_also : "https://workbench.cisecurity.org/files/2485" file : "/boot/efi/EFI/redhat/user.cfg" regex : "^[\\s]*GRUB2_PASSWORD" expect : "^[\\s]*GRUB2_PASSWORD[\\s]*=[^\\s]+$" system : "Linux" type : FILE_CONTENT_CHECK description : "1.5.3 Ensure authentication required for single user mode - rescue.service" info : "Single user mode (rescue mode) is used for recovery when the system detects an issue during boot or by manual selection from the bootloader. Rationale: Requiring authentication in single user mode (rescue mode) prevents an unauthorized user from rebooting the system into single user to gain root privileges without credentials." solution : "Edit /usr/lib/systemd/system/rescue.service and add/modify the following line: ExecStart=-/usr/lib/systemd/systemd-sulogin-shell rescue Edit /usr/lib/systemd/system/emergency.service and add/modify the following line: ExecStart=-/usr/lib/systemd/systemd-sulogin-shell emergency" reference : "800-53|SI-7,CSCv7|5.1,CSF|PR.DS-6,LEVEL|1S" see_also : "https://workbench.cisecurity.org/files/2485" file : "/usr/lib/systemd/system/rescue.service" regex : "^ExecStart=-/bin/sh -c \"(/usr)?/sbin/sulogin; (/usr)?/bin/systemctl --fail --no-block default\"" expect : "^ExecStart=-/bin/sh -c \"(/usr)?/sbin/sulogin; (/usr)?/bin/systemctl --fail --no-block default\"" system : "Linux" type : FILE_CONTENT_CHECK description : "1.5.3 Ensure authentication required for single user mode - emergency.service" info : "Single user mode (rescue mode) is used for recovery when the system detects an issue during boot or by manual selection from the bootloader. Rationale: Requiring authentication in single user mode (rescue mode) prevents an unauthorized user from rebooting the system into single user to gain root privileges without credentials." solution : "Edit /usr/lib/systemd/system/rescue.service and add/modify the following line: ExecStart=-/usr/lib/systemd/systemd-sulogin-shell rescue Edit /usr/lib/systemd/system/emergency.service and add/modify the following line: ExecStart=-/usr/lib/systemd/systemd-sulogin-shell emergency" reference : "800-53|SI-7,CSCv7|5.1,CSF|PR.DS-6,LEVEL|1S" see_also : "https://workbench.cisecurity.org/files/2485" file : "/usr/lib/systemd/system/emergency.service" regex : "^ExecStart=-/bin/sh -c \"(/usr)?/sbin/sulogin; (/usr)?/bin/systemctl --fail --no-block default\"" expect : "^ExecStart=-/bin/sh -c \"(/usr)?/sbin/sulogin; (/usr)?/bin/systemctl --fail --no-block default\"" system : "Linux" type : CMD_EXEC description : "1.6.1 Ensure core dumps are restricted - limits.conf limits.d" info : "A core dump is the memory of an executable program. It is generally used to determine why a program aborted. It can also be used to glean confidential information from a core file. The system provides the ability to set a soft limit for core dumps, but this can be overridden by the user. Rationale: Setting a hard limit on core dumps prevents users from overriding the soft variable. If core dumps are required, consider setting limits for user groups (see limits.conf(5) ). In addition, setting the fs.suid_dumpable variable to 0 will prevent setuid programs from dumping core." solution : "Add the following line to /etc/security/limits.conf or a /etc/security/limits.d/* file: * hard core 0 Set the following parameter in /etc/sysctl.conf or a /etc/sysctl.d/* file: fs.suid_dumpable = 0 Run the following command to set the active kernel parameter: # sysctl -w fs.suid_dumpable=0 If systemd-coredump is installed: edit /etc/systemd/coredump.conf and add/modify the following lines: Storage=none ProcessSizeMax=0 Run the command: systemctl daemon-reload" reference : "800-171|3.1.7,800-53|AC-6,CSCv7|5.1,CSF|PR.AC-4,LEVEL|1S" see_also : "https://workbench.cisecurity.org/files/2485" cmd : "/usr/bin/grep -s -E '^[[:space:]]*\\*[[:space:]]+hard[[:space:]]+core[[:space:]]+0[[:space:]]*$' /etc/security/limits.conf /etc/security/limits.d/* | /usr/bin/awk '{print} END {if (NR != 0) print \"pass\" ; else print \"fail\"}'" expect : "^pass$" system : "Linux" type : CMD_EXEC description : "1.6.1 Ensure core dumps are restricted - sysctl" info : "A core dump is the memory of an executable program. It is generally used to determine why a program aborted. It can also be used to glean confidential information from a core file. The system provides the ability to set a soft limit for core dumps, but this can be overridden by the user. Rationale: Setting a hard limit on core dumps prevents users from overriding the soft variable. If core dumps are required, consider setting limits for user groups (see limits.conf(5) ). In addition, setting the fs.suid_dumpable variable to 0 will prevent setuid programs from dumping core." solution : "Add the following line to /etc/security/limits.conf or a /etc/security/limits.d/* file: * hard core 0 Set the following parameter in /etc/sysctl.conf or a /etc/sysctl.d/* file: fs.suid_dumpable = 0 Run the following command to set the active kernel parameter: # sysctl -w fs.suid_dumpable=0 If systemd-coredump is installed: edit /etc/systemd/coredump.conf and add/modify the following lines: Storage=none ProcessSizeMax=0 Run the command: systemctl daemon-reload" reference : "800-171|3.1.7,800-53|AC-6,CSCv7|5.1,CSF|PR.AC-4,LEVEL|1S" see_also : "https://workbench.cisecurity.org/files/2485" cmd : "/usr/sbin/sysctl fs.suid_dumpable" expect : "^[\\s]*fs\\.suid_dumpable[\\s]*=[\\s]*0[\\s]*$" system : "Linux" type : CMD_EXEC description : "1.6.1 Ensure core dumps are restricted - sysctl.conf sysctl.d" info : "A core dump is the memory of an executable program. It is generally used to determine why a program aborted. It can also be used to glean confidential information from a core file. The system provides the ability to set a soft limit for core dumps, but this can be overridden by the user. Rationale: Setting a hard limit on core dumps prevents users from overriding the soft variable. If core dumps are required, consider setting limits for user groups (see limits.conf(5) ). In addition, setting the fs.suid_dumpable variable to 0 will prevent setuid programs from dumping core." solution : "Add the following line to /etc/security/limits.conf or a /etc/security/limits.d/* file: * hard core 0 Set the following parameter in /etc/sysctl.conf or a /etc/sysctl.d/* file: fs.suid_dumpable = 0 Run the following command to set the active kernel parameter: # sysctl -w fs.suid_dumpable=0 If systemd-coredump is installed: edit /etc/systemd/coredump.conf and add/modify the following lines: Storage=none ProcessSizeMax=0 Run the command: systemctl daemon-reload" reference : "800-171|3.1.7,800-53|AC-6,CSCv7|5.1,CSF|PR.AC-4,LEVEL|1S" see_also : "https://workbench.cisecurity.org/files/2485" cmd : "/usr/bin/grep -s -E '^[[:space:]]*fs\\.suid_dumpable[[:space:]]*=[[:space:]]*0[[:space:]]*$' /etc/sysctl.conf /etc/sysctl.d/* | /usr/bin/awk '{print} END {if (NR != 0) print \"pass\" ; else print \"fail\"}'" expect : "^pass$" system : "Linux" type : CMD_EXEC description : "1.6.2 Ensure address space layout randomization (ASLR) is enabled - sysctl" info : "Address space layout randomization (ASLR) is an exploit mitigation technique which randomly arranges the address space of key data areas of a process. Rationale: Randomly placing virtual memory regions will make it difficult to write memory page exploits as the memory placement will be consistently shifting." solution : "Set the following parameter in /etc/sysctl.conf or a /etc/sysctl.d/* file: kernel.randomize_va_space = 2 Run the following command to set the active kernel parameter: # sysctl -w kernel.randomize_va_space=2" reference : "CSCv7|8.3,LEVEL|1S,PCI-DSSv3.1|2.2.4,PCI-DSSv3.2|2.2.4" see_also : "https://workbench.cisecurity.org/files/2485" cmd : "/usr/sbin/sysctl kernel.randomize_va_space" expect : "^[\\s]*kernel\\.randomize_va_space[\\s]*=[\\s]*2[\\s]*$" system : "Linux" type : CMD_EXEC description : "1.6.2 Ensure address space layout randomization (ASLR) is enabled - sysctl.conf sysctl.d" info : "Address space layout randomization (ASLR) is an exploit mitigation technique which randomly arranges the address space of key data areas of a process. Rationale: Randomly placing virtual memory regions will make it difficult to write memory page exploits as the memory placement will be consistently shifting." solution : "Set the following parameter in /etc/sysctl.conf or a /etc/sysctl.d/* file: kernel.randomize_va_space = 2 Run the following command to set the active kernel parameter: # sysctl -w kernel.randomize_va_space=2" reference : "800-53|SI-16,CSCv7|8.3,LEVEL|1S" see_also : "https://workbench.cisecurity.org/files/2485" cmd : "/usr/bin/grep -s -E '^[[:space:]]*kernel\\.randomize_va_space[[:space:]]*=[[:space:]]*2[[:space:]]*$' /etc/sysctl.conf /etc/sysctl.d/* | /usr/bin/awk '{print} END {if (NR != 0) print \"pass\" ; else print \"fail\"}'" expect : "^pass$" dont_echo_cmd : YES system : "Linux" type : BANNER_CHECK description : "1.8.1.1 Ensure message of the day is configured properly - banner text" info : "The contents of the /etc/motd file are displayed to users after login and function as a message of the day for authenticated users. 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 Rationale: Warning messages inform users who are attempting to login to the system of their legal status regarding the system and must include the name of the organization that owns the system and any monitoring policies that are in place. Displaying OS and patch level information in login banners also has the side effect of providing detailed system information to attackers attempting to target specific exploits of a system. Authorized users can easily get this information by running the \" uname -a \" command once they have logged in." solution : "Edit the /etc/motd file with the appropriate contents according to your site policy, remove any instances of \m , \r , \s , \v or references to the OS platform OR If the motd is not used, this file can be removed. Run the following command to remove the motd file: # rm /etc/motd" reference : "800-171|3.1.9,800-53|AC-8,CSCv7|5.1,ITSG-33|AC-8,LEVEL|1S,NESA|M1.3.6" see_also : "https://workbench.cisecurity.org/files/2485" file : "/etc/motd" # Note: Variable @BANNER_TEXT@ replaced with "All activities performed on this system will be monitored." in field "content". content : "All activities performed on this system will be monitored." system : "Linux" type : FILE_CONTENT_CHECK_NOT description : "1.8.1.1 Ensure message of the day is configured properly - mrsv" info : "The contents of the /etc/motd file are displayed to users after login and function as a message of the day for authenticated users. 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 Rationale: Warning messages inform users who are attempting to login to the system of their legal status regarding the system and must include the name of the organization that owns the system and any monitoring policies that are in place. Displaying OS and patch level information in login banners also has the side effect of providing detailed system information to attackers attempting to target specific exploits of a system. Authorized users can easily get this information by running the \" uname -a \" command once they have logged in." solution : "Edit the /etc/motd file with the appropriate contents according to your site policy, remove any instances of \m , \r , \s , \v or references to the OS platform OR If the motd is not used, this file can be removed. Run the following command to remove the motd file: # rm /etc/motd" reference : "800-171|3.4.2,800-53|CM-6,CSCv7|5.1,CSF|PR.IP-1,ITSG-33|CM-6,LEVEL|1S,NESA|T3.2.1,PCI-DSSv3.1|2.2.4,PCI-DSSv3.2|2.2.4,SWIFT-CSCv1|2.3" see_also : "https://workbench.cisecurity.org/files/2485" file : "/etc/motd" regex : "\\\\[mrsv]" expect : "\\\\[mrsv]" system : "Linux" type : BANNER_CHECK description : "1.8.1.2 Ensure local login warning banner is configured properly - banner text" info : "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 - or the operating system's name Rationale: Warning messages inform users who are attempting to login to the system of their legal status regarding the system and must include the name of the organization that owns the system and any monitoring policies that are in place. Displaying OS and patch level information in login banners also has the side effect of providing detailed system information to attackers attempting to target specific exploits of a system. Authorized users can easily get this information by running the \" uname -a \" command once they have logged in." solution : "Edit the /etc/issue file with the appropriate contents according to your site policy, remove any instances of \m , \r , \s , \v or references to the OS platform # echo \"Authorized uses only. All activity may be monitored and reported.\" > /etc/issue" reference : "800-171|3.1.9,800-53|AC-8,CSCv7|5.1,ITSG-33|AC-8,LEVEL|1S,NESA|M1.3.6" see_also : "https://workbench.cisecurity.org/files/2485" file : "/etc/issue" # Note: Variable @BANNER_TEXT@ replaced with "All activities performed on this system will be monitored." in field "content". content : "All activities performed on this system will be monitored." system : "Linux" type : FILE_CONTENT_CHECK_NOT description : "1.8.1.2 Ensure local login warning banner is configured properly - mrsv" info : "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 - or the operating system's name Rationale: Warning messages inform users who are attempting to login to the system of their legal status regarding the system and must include the name of the organization that owns the system and any monitoring policies that are in place. Displaying OS and patch level information in login banners also has the side effect of providing detailed system information to attackers attempting to target specific exploits of a system. Authorized users can easily get this information by running the \" uname -a \" command once they have logged in." solution : "Edit the /etc/issue file with the appropriate contents according to your site policy, remove any instances of \m , \r , \s , \v or references to the OS platform # echo \"Authorized uses only. All activity may be monitored and reported.\" > /etc/issue" reference : "800-171|3.4.2,800-53|CM-6,CSCv7|5.1,CSF|PR.IP-1,ITSG-33|CM-6,LEVEL|1S,NESA|T3.2.1,PCI-DSSv3.1|2.2.4,PCI-DSSv3.2|2.2.4,SWIFT-CSCv1|2.3" see_also : "https://workbench.cisecurity.org/files/2485" file : "/etc/issue" regex : "\\\\[mrsv]" expect : "\\\\[mrsv]" system : "Linux" type : BANNER_CHECK description : "1.8.1.3 Ensure remote login warning banner is configured properly - banner text" info : "The contents of the /etc/issue.net file are displayed to users prior to login for remote connections from configured services. 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 Rationale: Warning messages inform users who are attempting to login to the system of their legal status regarding the system and must include the name of the organization that owns the system and any monitoring policies that are in place. Displaying OS and patch level information in login banners also has the side effect of providing detailed system information to attackers attempting to target specific exploits of a system. Authorized users can easily get this information by running the \" uname -a \" command once they have logged in." solution : "Edit the /etc/issue.net file with the appropriate contents according to your site policy, remove any instances of \m , \r , \s , \v or references to the OS platform # echo \"Authorized uses only. All activity may be monitored and reported.\" > /etc/issue.net" reference : "800-171|3.1.9,800-53|AC-8,CSCv7|5.1,ITSG-33|AC-8,LEVEL|1S,NESA|M1.3.6" see_also : "https://workbench.cisecurity.org/files/2485" file : "/etc/issue.net" # Note: Variable @BANNER_TEXT@ replaced with "All activities performed on this system will be monitored." in field "content". content : "All activities performed on this system will be monitored." system : "Linux" type : FILE_CONTENT_CHECK_NOT description : "1.8.1.3 Ensure remote login warning banner is configured properly - mrsv" info : "The contents of the /etc/issue.net file are displayed to users prior to login for remote connections from configured services. 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 Rationale: Warning messages inform users who are attempting to login to the system of their legal status regarding the system and must include the name of the organization that owns the system and any monitoring policies that are in place. Displaying OS and patch level information in login banners also has the side effect of providing detailed system information to attackers attempting to target specific exploits of a system. Authorized users can easily get this information by running the \" uname -a \" command once they have logged in." solution : "Edit the /etc/issue.net file with the appropriate contents according to your site policy, remove any instances of \m , \r , \s , \v or references to the OS platform # echo \"Authorized uses only. All activity may be monitored and reported.\" > /etc/issue.net" reference : "800-171|3.4.2,800-53|CM-6,CSCv7|5.1,CSF|PR.IP-1,ITSG-33|CM-6,LEVEL|1S,NESA|T3.2.1,PCI-DSSv3.1|2.2.4,PCI-DSSv3.2|2.2.4,SWIFT-CSCv1|2.3" see_also : "https://workbench.cisecurity.org/files/2485" file : "/etc/issue.net" regex : "\\\\[mrsv]" expect : "\\\\[mrsv]" system : "Linux" type : FILE_CHECK description : "1.8.1.4 Ensure permissions on /etc/motd are configured" info : "The contents of the /etc/motd file are displayed to users after login and function as a message of the day for authenticated users. Rationale: If the /etc/motd file does not have the correct ownership it could be modified by unauthorized users with incorrect or misleading information." solution : "Run the following commands to set permissions on /etc/motd : # chown root:root /etc/motd # chmod u-x,go-wx /etc/motd" reference : "800-171|3.4.2,800-53|CM-6,CSCv7|5.1,CSF|PR.IP-1,ITSG-33|CM-6,LEVEL|1S,NESA|T3.2.1,PCI-DSSv3.1|2.2.4,PCI-DSSv3.2|2.2.4,SWIFT-CSCv1|2.3" see_also : "https://workbench.cisecurity.org/files/2485" group : "root" owner : "root" file : "/etc/motd" mask : "133" system : "Linux" type : FILE_CHECK description : "1.8.1.5 Ensure permissions on /etc/issue are configured" info : "The contents of the /etc/issue file are displayed to users prior to login for local terminals. Rationale: If the /etc/issue file does not have the correct ownership it could be modified by unauthorized users with incorrect or misleading information." solution : "Run the following commands to set permissions on /etc/issue : # chown root:root /etc/issue # chmod u-x,go-wx /etc/issue" reference : "800-171|3.4.2,800-53|CM-6,CSCv7|5.1,CSF|PR.IP-1,ITSG-33|CM-6,LEVEL|1S,NESA|T3.2.1,PCI-DSSv3.1|2.2.4,PCI-DSSv3.2|2.2.4,SWIFT-CSCv1|2.3" see_also : "https://workbench.cisecurity.org/files/2485" group : "root" owner : "root" file : "/etc/issue" mask : "133" system : "Linux" type : FILE_CHECK description : "1.8.1.6 Ensure permissions on /etc/issue.net are configured" info : "The contents of the /etc/issue.net file are displayed to users prior to login for remote connections from configured services. Rationale: If the /etc/issue.net file does not have the correct ownership it could be modified by unauthorized users with incorrect or misleading information." solution : "Run the following commands to set permissions on /etc/issue.net : # chown root:root /etc/issue.net # chmod u-x,go-wx /etc/issue.net" reference : "800-171|3.4.2,800-53|CM-6,CSCv7|5.1,CSF|PR.IP-1,ITSG-33|CM-6,LEVEL|1S,NESA|T3.2.1,PCI-DSSv3.1|2.2.4,PCI-DSSv3.2|2.2.4,SWIFT-CSCv1|2.3" see_also : "https://workbench.cisecurity.org/files/2485" group : "root" owner : "root" file : "/etc/issue.net" mask : "133" system : "Linux" type : RPM_CHECK description : "Check GDM installed" rpm : "gdm-0.0.0-0" operator : "gt" required : YES system : "Linux" type : FILE_CONTENT_CHECK description : "1.8.2 Ensure GDM login banner is configured - user-db" info : "GDM is the GNOME Display Manager which handles graphical login for GNOME based systems. Rationale: Warning messages inform users who are attempting to login to the system of their legal status regarding the system and must include the name of the organization that owns the system and any monitoring policies that are in place." solution : "Edit or create the file /etc/gdm3/greeter.dconf-defaults and add the following: [org/gnome/login-screen] banner-message-enable=true banner-message-text='Authorized uses only. All activity may be monitored and reported.' Notes: Additional options and sections may appear in the /etc/dconf/db/gdm.d/01-banner-message file. If a different GUI login service is in use, consult your documentation and apply an equivalent banner." reference : "800-171|3.1.9,800-53|AC-8,CSCv7|5.1,ITSG-33|AC-8,LEVEL|1S,NESA|M1.3.6,NESA|M5.2.5,NESA|T5.5.1,NIAv2|AM10a,NIAv2|AM10b,NIAv2|AM10c,NIAv2|AM10d,NIAv2|AM10e" see_also : "https://workbench.cisecurity.org/files/2485" file : "/etc/dconf/profile/gdm" regex : "^[\\s]*user-db[\\s]*:" expect : "^[\\s]*user-db[\\s]*:[\\s]*user[\\s]*$" system : "Linux" type : FILE_CONTENT_CHECK description : "1.8.2 Ensure GDM login banner is configured - system-db" info : "GDM is the GNOME Display Manager which handles graphical login for GNOME based systems. Rationale: Warning messages inform users who are attempting to login to the system of their legal status regarding the system and must include the name of the organization that owns the system and any monitoring policies that are in place." solution : "Edit or create the file /etc/gdm3/greeter.dconf-defaults and add the following: [org/gnome/login-screen] banner-message-enable=true banner-message-text='Authorized uses only. All activity may be monitored and reported.' Notes: Additional options and sections may appear in the /etc/dconf/db/gdm.d/01-banner-message file. If a different GUI login service is in use, consult your documentation and apply an equivalent banner." reference : "800-171|3.1.9,800-53|AC-8,CSCv7|5.1,ITSG-33|AC-8,LEVEL|1S,NESA|M1.3.6,NESA|M5.2.5,NESA|T5.5.1,NIAv2|AM10a,NIAv2|AM10b,NIAv2|AM10c,NIAv2|AM10d,NIAv2|AM10e" see_also : "https://workbench.cisecurity.org/files/2485" file : "/etc/dconf/profile/gdm" regex : "^[\\s]*system-db[\\s]*:" expect : "^[\\s]*system-db[\\s]*:[\\s]*gdm[\\s]*$" system : "Linux" type : FILE_CONTENT_CHECK description : "1.8.2 Ensure GDM login banner is configured - file-db" info : "GDM is the GNOME Display Manager which handles graphical login for GNOME based systems. Rationale: Warning messages inform users who are attempting to login to the system of their legal status regarding the system and must include the name of the organization that owns the system and any monitoring policies that are in place." solution : "Edit or create the file /etc/gdm3/greeter.dconf-defaults and add the following: [org/gnome/login-screen] banner-message-enable=true banner-message-text='Authorized uses only. All activity may be monitored and reported.' Notes: Additional options and sections may appear in the /etc/dconf/db/gdm.d/01-banner-message file. If a different GUI login service is in use, consult your documentation and apply an equivalent banner." reference : "800-171|3.1.9,800-53|AC-8,CSCv7|5.1,ITSG-33|AC-8,LEVEL|1S,NESA|M1.3.6,NESA|M5.2.5,NESA|T5.5.1,NIAv2|AM10a,NIAv2|AM10b,NIAv2|AM10c,NIAv2|AM10d,NIAv2|AM10e" see_also : "https://workbench.cisecurity.org/files/2485" file : "/etc/dconf/profile/gdm" regex : "^[\\s]*file-db[\\s]*:" expect : "^[\\s]*file-db[\\s]*:[\\s]*/usr/share/gdm/greeter-dconf-defaults[\\s]*$" system : "Linux" type : FILE_CONTENT_CHECK description : "1.8.2 Ensure GDM login banner is configured - banner message enabled" info : "GDM is the GNOME Display Manager which handles graphical login for GNOME based systems. Rationale: Warning messages inform users who are attempting to login to the system of their legal status regarding the system and must include the name of the organization that owns the system and any monitoring policies that are in place." solution : "Edit or create the file /etc/gdm3/greeter.dconf-defaults and add the following: [org/gnome/login-screen] banner-message-enable=true banner-message-text='Authorized uses only. All activity may be monitored and reported.' Notes: Additional options and sections may appear in the /etc/dconf/db/gdm.d/01-banner-message file. If a different GUI login service is in use, consult your documentation and apply an equivalent banner." reference : "800-171|3.1.9,800-53|AC-8,CSCv7|5.1,ITSG-33|AC-8,LEVEL|1S,NESA|M1.3.6,NESA|M5.2.5,NESA|T5.5.1,NIAv2|AM10a,NIAv2|AM10b,NIAv2|AM10c,NIAv2|AM10d,NIAv2|AM10e" see_also : "https://workbench.cisecurity.org/files/2485" file : "/etc/dconf/db/gdm.d/*" regex : "^[\\s]*banner-message-enable[\\s]*=" expect : "^[\\s]*banner-message-enable[\\s]*=[\\s]*true[\\s]*$" system : "Linux" type : BANNER_CHECK description : "1.8.2 Ensure GDM login banner is configured - banner message text" info : "GDM is the GNOME Display Manager which handles graphical login for GNOME based systems. Rationale: Warning messages inform users who are attempting to login to the system of their legal status regarding the system and must include the name of the organization that owns the system and any monitoring policies that are in place." solution : "Edit or create the file /etc/gdm3/greeter.dconf-defaults and add the following: [org/gnome/login-screen] banner-message-enable=true banner-message-text='Authorized uses only. All activity may be monitored and reported.' Notes: Additional options and sections may appear in the /etc/dconf/db/gdm.d/01-banner-message file. If a different GUI login service is in use, consult your documentation and apply an equivalent banner." reference : "800-171|3.1.9,800-53|AC-8,CSCv7|5.1,ITSG-33|AC-8,LEVEL|1S,NESA|M1.3.6" see_also : "https://workbench.cisecurity.org/files/2485" file : "/etc/dconf/db/gdm.d/01-banner-message" is_substring : YES # Note: Variable @BANNER_TEXT@ replaced with "All activities performed on this system will be monitored." in field "content". content : "All activities performed on this system will be monitored." description : "1.8.2 Ensure GDM login banner is configured - user-db" info : "GDM is the GNOME Display Manager which handles graphical login for GNOME based systems. Rationale: Warning messages inform users who are attempting to login to the system of their legal status regarding the system and must include the name of the organization that owns the system and any monitoring policies that are in place." solution : "Edit or create the file /etc/gdm3/greeter.dconf-defaults and add the following: [org/gnome/login-screen] banner-message-enable=true banner-message-text='Authorized uses only. All activity may be monitored and reported.' Notes: Additional options and sections may appear in the /etc/dconf/db/gdm.d/01-banner-message file. If a different GUI login service is in use, consult your documentation and apply an equivalent banner." reference : "800-171|3.1.9,800-53|AC-8,CSCv7|5.1,ITSG-33|AC-8,LEVEL|1S,NESA|M1.3.6,NESA|M5.2.5,NESA|T5.5.1,NIAv2|AM10a,NIAv2|AM10b,NIAv2|AM10c,NIAv2|AM10d,NIAv2|AM10e" see_also : "https://workbench.cisecurity.org/files/2485" description : "1.8.2 Ensure GDM login banner is configured - system-db" info : "GDM is the GNOME Display Manager which handles graphical login for GNOME based systems. Rationale: Warning messages inform users who are attempting to login to the system of their legal status regarding the system and must include the name of the organization that owns the system and any monitoring policies that are in place." solution : "Edit or create the file /etc/gdm3/greeter.dconf-defaults and add the following: [org/gnome/login-screen] banner-message-enable=true banner-message-text='Authorized uses only. All activity may be monitored and reported.' Notes: Additional options and sections may appear in the /etc/dconf/db/gdm.d/01-banner-message file. If a different GUI login service is in use, consult your documentation and apply an equivalent banner." reference : "800-171|3.1.9,800-53|AC-8,CSCv7|5.1,ITSG-33|AC-8,LEVEL|1S,NESA|M1.3.6,NESA|M5.2.5,NESA|T5.5.1,NIAv2|AM10a,NIAv2|AM10b,NIAv2|AM10c,NIAv2|AM10d,NIAv2|AM10e" see_also : "https://workbench.cisecurity.org/files/2485" description : "1.8.2 Ensure GDM login banner is configured - file-db" info : "GDM is the GNOME Display Manager which handles graphical login for GNOME based systems. Rationale: Warning messages inform users who are attempting to login to the system of their legal status regarding the system and must include the name of the organization that owns the system and any monitoring policies that are in place." solution : "Edit or create the file /etc/gdm3/greeter.dconf-defaults and add the following: [org/gnome/login-screen] banner-message-enable=true banner-message-text='Authorized uses only. All activity may be monitored and reported.' Notes: Additional options and sections may appear in the /etc/dconf/db/gdm.d/01-banner-message file. If a different GUI login service is in use, consult your documentation and apply an equivalent banner." reference : "800-171|3.1.9,800-53|AC-8,CSCv7|5.1,ITSG-33|AC-8,LEVEL|1S,NESA|M1.3.6,NESA|M5.2.5,NESA|T5.5.1,NIAv2|AM10a,NIAv2|AM10b,NIAv2|AM10c,NIAv2|AM10d,NIAv2|AM10e" see_also : "https://workbench.cisecurity.org/files/2485" description : "1.8.2 Ensure GDM login banner is configured - banner message enabled" info : "GDM is the GNOME Display Manager which handles graphical login for GNOME based systems. Rationale: Warning messages inform users who are attempting to login to the system of their legal status regarding the system and must include the name of the organization that owns the system and any monitoring policies that are in place." solution : "Edit or create the file /etc/gdm3/greeter.dconf-defaults and add the following: [org/gnome/login-screen] banner-message-enable=true banner-message-text='Authorized uses only. All activity may be monitored and reported.' Notes: Additional options and sections may appear in the /etc/dconf/db/gdm.d/01-banner-message file. If a different GUI login service is in use, consult your documentation and apply an equivalent banner." reference : "800-171|3.1.9,800-53|AC-8,CSCv7|5.1,ITSG-33|AC-8,LEVEL|1S,NESA|M1.3.6,NESA|M5.2.5,NESA|T5.5.1,NIAv2|AM10a,NIAv2|AM10b,NIAv2|AM10c,NIAv2|AM10d,NIAv2|AM10e" see_also : "https://workbench.cisecurity.org/files/2485" description : "1.8.2 Ensure GDM login banner is configured - banner message text" info : "GDM is the GNOME Display Manager which handles graphical login for GNOME based systems. Rationale: Warning messages inform users who are attempting to login to the system of their legal status regarding the system and must include the name of the organization that owns the system and any monitoring policies that are in place." solution : "Edit or create the file /etc/gdm3/greeter.dconf-defaults and add the following: [org/gnome/login-screen] banner-message-enable=true banner-message-text='Authorized uses only. All activity may be monitored and reported.' Notes: Additional options and sections may appear in the /etc/dconf/db/gdm.d/01-banner-message file. If a different GUI login service is in use, consult your documentation and apply an equivalent banner." reference : "800-171|3.1.9,800-53|AC-8,CSCv7|5.1,ITSG-33|AC-8,LEVEL|1S,NESA|M1.3.6" see_also : "https://workbench.cisecurity.org/files/2485" system : "Linux" type : CMD_EXEC description : "1.9 Ensure updates, patches, and additional security software are installed" info : "Periodically patches are released for included software either due to security flaws or to include additional functionality. Rationale: Newer patches may contain security enhancements that would not be available through the latest full update. As a result, it is recommended that the latest software patches be used to take advantage of the latest functionality. As with any software installation, organizations need to determine if a given update meets their requirements and verify the compatibility and supportability of any additional software against the update revision that is selected. NOTE: Nessus has provided the target output to assist in reviewing the benchmark to ensure target compliance." solution : "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 --security Notes: Site policy may mandate a testing period before install onto production systems for available updates. The audit and remediation here only cover security updates. Non-security updates can be audited with and comparing against site policy: # dnf check-update" reference : "800-171|3.14.1,800-53|SI-2,CSCv7|3.4,CSF|ID.RA-1,CSF|PR.IP-12,ITSG-33|SI-2,LEVEL|1S,NESA|T7.6.2,NESA|T7.7.1,NIAv2|AM38,NIAv2|AM39,NIAv2|PR9,NIAv2|SS14b,SWIFT-CSCv1|2.2" see_also : "https://workbench.cisecurity.org/files/2485" cmd : "/usr/bin/yum check-update --security" expect : "ManualReviewRequired" severity : MEDIUM system : "Linux" type : CMD_EXEC description : "1.10 Ensure system-wide crypto policy is not legacy" info : "The system-wide crypto-policies followed by the crypto core components allow consistently deprecating and disabling algorithms system-wide. The individual policy levels (DEFAULT, LEGACY, FUTURE, and FIPS) are included in the crypto-policies(7) package. Rationale: If the Legacy system-wide crypto policy is selected, it includes support for TLS 1.0, TLS 1.1, and SSH2 protocols or later. The algorithms DSA, 3DES, and RC4 are allowed, while RSA and Diffie-Hellman parameters are accepted if larger than 1023-bits. These legacy protocols and algorithms can make the system vulnerable to attacks, including those listed in RFC 7457" solution : "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 Impact: The default system-wide cryptographic policy in Red Hat Enterprise Linux 8 does not allow communication using older, insecure protocols. For environments that require to be compatible with Red Hat Enterprise Linux 5 and in some cases also with earlier releases, the less secure LEGACY policy level is available. Default Value: DEFAULT" reference : "800-171|3.4.2,800-53|CM-6,CSCv7|14.4,CSF|PR.IP-1,ITSG-33|CM-6,LEVEL|1S,NESA|T3.2.1,SWIFT-CSCv1|2.3" see_also : "https://workbench.cisecurity.org/files/2485" cmd : "/usr/bin/grep -i -E '^[[:space:]]*LEGACY[[:space:]]*([[:space:]]+#.*)?$' /etc/crypto-policies/config | /usr/bin/awk '{print} END {if (NR == 0) print \"pass\" ; else print \"fail\"}'" expect : "^pass$" system : "Linux" type : RPM_CHECK description : "2.1.1 Ensure xinetd is not installed" info : "The eXtended InterNET Daemon ( xinetd ) is an open source super daemon that replaced the original inetd daemon. The xinetd daemon listens for well known services and dispatches the appropriate daemon to properly respond to service requests. Rationale: If there are no xinetd services required, it is recommended that the package be removed." solution : "Run the following command to remove xinetd: # dnf remove xinetd" reference : "800-171|3.4.8,800-53|CM-7,CSCv7|9.2,CSF|PR.IP-1,CSF|PR.PT-3,ISO/IEC-27001|A.12.6.2,LEVEL|1S,NIAv2|SS13a,SWIFT-CSCv1|2.3" see_also : "https://workbench.cisecurity.org/files/2485" rpm : "xinetd-0.0.0-0" operator : "lt" system : "Linux" type : RPM_CHECK description : "Check NTP installed" rpm : "ntp-0.0.0-0" operator : "gt" required : YES system : "Linux" type : RPM_CHECK description : "Check chrony installed" rpm : "chrony-0.0.0-0" operator : "gt" required : YES description : "2.2.1.1 Ensure time synchronization is in use" info : "System time should be synchronized between all systems in an environment. This is typically done by establishing an authoritative time server or set of servers and having all systems synchronize their clocks to them. Rationale: Time synchronization is important to support time sensitive security mechanisms like Kerberos and also ensures log files have consistent time records across the enterprise, which aids in forensic investigations." solution : "On physical systems or virtual systems where host based time synchronization is not available install chrony: Run the folloing command to install chrony: # dnf install chrony On virtual systems where host based time synchronization is available consult your virtualization software documentation and setup host based synchronization. Notes: systemd-timesyncd is part of systemd. Some versions of systemd have been compiled without systemd-timesycnd. On these distributions, chrony or NTP should be used instead of systemd-timesycnd." reference : "CSCv7|6.1,LEVEL|1NS" see_also : "https://workbench.cisecurity.org/files/2485" description : "2.2.1.1 Ensure time synchronization is in use" info : "System time should be synchronized between all systems in an environment. This is typically done by establishing an authoritative time server or set of servers and having all systems synchronize their clocks to them. Rationale: Time synchronization is important to support time sensitive security mechanisms like Kerberos and also ensures log files have consistent time records across the enterprise, which aids in forensic investigations." solution : "On physical systems or virtual systems where host based time synchronization is not available install chrony: Run the folloing command to install chrony: # dnf install chrony On virtual systems where host based time synchronization is available consult your virtualization software documentation and setup host based synchronization. Notes: systemd-timesyncd is part of systemd. Some versions of systemd have been compiled without systemd-timesycnd. On these distributions, chrony or NTP should be used instead of systemd-timesycnd." reference : "CSCv7|6.1,LEVEL|1NS" see_also : "https://workbench.cisecurity.org/files/2485" system : "Linux" type : RPM_CHECK description : "Check chrony installed" rpm : "chrony-0.0.0-0" operator : "gt" required : YES system : "Linux" type : FILE_CONTENT_CHECK description : "2.2.1.2 Ensure chrony is configured - NTP server" info : "chrony is a daemon which implements the Network Time Protocol (NTP) is designed to synchronize system clocks across a variety of systems and use a source that is highly accurate. More information on chrony can be found at http://chrony.tuxfamily.org/. chrony can be configured to be a client and/or a server. Rationale: If chrony is in use on the system proper configuration is vital to ensuring time synchronization is working properly. This recommendation only applies if chrony is in use on the system." solution : "Add or edit server or pool lines to /etc/chrony.conf as appropriate: server Configure chrony to run as the chrony user" reference : "800-171|3.3.7,800-53|AU-8,CSCv7|6.1,CSF|PR.PT-1,ISO/IEC-27001|A.12.4.4,ITSG-33|AU-8,LEVEL|1S,NESA|T3.6.7,NIAv2|NS44,NIAv2|NS45,NIAv2|NS46,NIAv2|NS47" see_also : "https://workbench.cisecurity.org/files/2485" file : "/etc/chrony.conf" # Note: Variable @NTP_SERVER@ replaced with "10\\.0\\.0\\.2" in field "regex". regex : "^[\\s]*(server|pool)[\\s]+10\\.0\\.0\\.2" # Note: Variable @NTP_SERVER@ replaced with "10\\.0\\.0\\.2" in field "expect". expect : "^[\\s]*(server|pool)[\\s]+10\\.0\\.0\\.2" system : "Linux" type : FILE_CONTENT_CHECK description : "2.2.1.2 Ensure chrony is configured - OPTIONS" info : "chrony is a daemon which implements the Network Time Protocol (NTP) is designed to synchronize system clocks across a variety of systems and use a source that is highly accurate. More information on chrony can be found at http://chrony.tuxfamily.org/. chrony can be configured to be a client and/or a server. Rationale: If chrony is in use on the system proper configuration is vital to ensuring time synchronization is working properly. This recommendation only applies if chrony is in use on the system." solution : "Add or edit server or pool lines to /etc/chrony.conf as appropriate: server Configure chrony to run as the chrony user" reference : "800-171|3.4.2,800-53|CM-6,CSCv7|6.1,CSF|PR.IP-1,ITSG-33|CM-6,LEVEL|1S,NESA|T3.2.1,SWIFT-CSCv1|2.3" see_also : "https://workbench.cisecurity.org/files/2485" file : "/etc/sysconfig/chronyd" regex : "^OPTIONS=" expect : "-u[\\s]+chrony" description : "2.2.1.2 Ensure chrony is configured - NTP server" info : "chrony is a daemon which implements the Network Time Protocol (NTP) is designed to synchronize system clocks across a variety of systems and use a source that is highly accurate. More information on chrony can be found at http://chrony.tuxfamily.org/. chrony can be configured to be a client and/or a server. Rationale: If chrony is in use on the system proper configuration is vital to ensuring time synchronization is working properly. This recommendation only applies if chrony is in use on the system. NOTE: Nessus has not performed this check. Please review the benchmark to ensure target compliance." solution : "Add or edit server or pool lines to /etc/chrony.conf as appropriate: server Configure chrony to run as the chrony user" reference : "800-171|3.3.7,800-53|AU-8,CSCv7|6.1,CSF|PR.PT-1,ISO/IEC-27001|A.12.4.4,ITSG-33|AU-8,LEVEL|1S,NESA|T3.6.7,NIAv2|NS44,NIAv2|NS45,NIAv2|NS46,NIAv2|NS47" see_also : "https://workbench.cisecurity.org/files/2485" description : "2.2.1.2 Ensure chrony is configured - OPTIONS" info : "chrony is a daemon which implements the Network Time Protocol (NTP) is designed to synchronize system clocks across a variety of systems and use a source that is highly accurate. More information on chrony can be found at http://chrony.tuxfamily.org/. chrony can be configured to be a client and/or a server. Rationale: If chrony is in use on the system proper configuration is vital to ensuring time synchronization is working properly. This recommendation only applies if chrony is in use on the system. NOTE: Nessus has not performed this check. Please review the benchmark to ensure target compliance." solution : "Add or edit server or pool lines to /etc/chrony.conf as appropriate: server Configure chrony to run as the chrony user" reference : "800-171|3.4.2,800-53|CM-6,CSCv7|6.1,CSF|PR.IP-1,ITSG-33|CM-6,LEVEL|1S,NESA|T3.2.1,SWIFT-CSCv1|2.3" see_also : "https://workbench.cisecurity.org/files/2485" system : "Linux" type : RPM_CHECK description : "2.2.2 Ensure X Window System is not installed" info : "The X Window System provides a Graphical User Interface (GUI) where users can have multiple windows in which to run programs and various add on. The X Windows system is typically used on workstations where users login, but not on servers where users typically do not login. Rationale: Unless your organization specifically requires graphical login access via X Windows, remove it to reduce the potential attack surface." solution : "Run the following command to remove the X Windows System packages. # dnf remove xorg-x11* Impact: Many Linux systems run applications which require a Java runtime. Some Linux Java packages have a dependency on specific X Windows xorg-x11-fonts. One workaround to avoid this dependency is to use the \"headless\" Java packages for your specific Java runtime, if provided by your distribution." reference : "800-171|3.4.8,800-53|CM-7,CSCv7|2.6,CSF|PR.IP-1,CSF|PR.PT-3,ISO/IEC-27001|A.12.6.2,LEVEL|1S,NIAv2|SS13a,SWIFT-CSCv1|2.3" see_also : "https://workbench.cisecurity.org/files/2485" required : NO operator : "lt" rpm : "xorg-x11-server-common-0.0.0-0" system : "Linux" type : XINETD_SVC description : "2.2.3 Ensure rsync service is not enabled" info : "The rsyncd service can be used to synchronize files between systems over network links. Rationale: The rsyncd service presents a security risk as it uses unencrypted protocols for communication." solution : "Run the following command to disable rsyncd: # systemctl --now disable rsyncd Notes: Additional methods of disabling a service exist. Consult your distribution documentation for appropriate methods. On some distributions the rsync service is known as rsync, not rsyncd." reference : "800-171|3.4.6,800-171|3.4.7,800-53|CM-7,CIP|007-6-R1,CN-L3|7.1.3.5(c),CN-L3|7.1.3.7(d),CSCv7|9.2,CSF|PR.IP-1,CSF|PR.PT-3,ITSG-33|CM-7,LEVEL|1S,NIAv2|SS13b,NIAv2|SS14a,NIAv2|SS14c,NIAv2|SS15a,PCI-DSSv3.1|2.2.2,PCI-DSSv3.1|2.2.3,PCI-DSSv3.2|2.2.2,PCI-DSSv3.2|2.2.3,SWIFT-CSCv1|2.3" see_also : "https://workbench.cisecurity.org/files/2485" status : OFF service : "rsync" system : "Linux" type : CMD_EXEC description : "2.2.4 Ensure Avahi Server is not enabled" info : "Avahi is a free zeroconf implementation, including a system for multicast DNS/DNS-SD service discovery. Avahi allows programs to publish and discover services and hosts running on a local network with no specific configuration. For example, a user can plug a computer into a network and Avahi automatically finds printers to print to, files to look at and people to talk to, as well as network services running on the machine. Rationale: Automatic discovery of network services is not normally required for system functionality. It is recommended to disable the service to reduce the potential attack surface." solution : "Run the following command to disable avahi-daemon: # systemctl --now disable avahi-daemon Notes: Additional methods of disabling a service exist. Consult your distribution documentation for appropriate methods." reference : "CIP|007-6-R1,CSCv7|9.2,LEVEL|1S,PCI-DSSv3.1|2.2.2,PCI-DSSv3.1|2.2.3,PCI-DSSv3.2|2.2.2,PCI-DSSv3.2|2.2.3" see_also : "https://workbench.cisecurity.org/files/2485" cmd : "/usr/bin/systemctl is-enabled avahi-daemon | /usr/bin/awk '{print} END {if(NR==0) print \"disabled\" }'" expect : "disabled" dont_echo_cmd : YES system : "Linux" type : CMD_EXEC description : "2.2.5 Ensure SNMP Server is not enabled" info : "The Simple Network Management Protocol (SNMP) server is used to listen for SNMP commands from an SNMP management system, execute the commands or collect the information and then send results back to the requesting system. Rationale: The SNMP server can communicate using SNMP v1, which transmits data in the clear and does not require authentication to execute commands. Unless absolutely necessary, it is recommended that the SNMP service not be used. If SNMP is required the server should be configured to disallow SNMP v1." solution : "Run the following command to disable snmpd: # systemctl --now disable snmpd Notes: Additional methods of disabling a service exist. Consult your distribution documentation for appropriate methods." reference : "CIP|007-6-R1,CSCv7|9.2,LEVEL|1S,PCI-DSSv3.1|2.2.2,PCI-DSSv3.1|2.2.3,PCI-DSSv3.2|2.2.2,PCI-DSSv3.2|2.2.3" see_also : "https://workbench.cisecurity.org/files/2485" cmd : "/usr/bin/systemctl is-enabled snmpd | /usr/bin/awk '{print} END { if(NR==0) print \"disabled\" }'" expect : "disabled" dont_echo_cmd : YES system : "Linux" type : CMD_EXEC description : "2.2.6 Ensure HTTP Proxy Server is not enabled" info : "Squid is a standard proxy server used in many distributions and environments. Rationale: If there is no need for a proxy server, it is recommended that the squid proxy be deleted to reduce the potential attack surface." solution : "Run the following command to disable squid: # systemctl --now disable squid Notes: Additional methods of disabling a service exist. Consult your distribution documentation for appropriate methods." reference : "CIP|007-6-R1,CSCv7|9.2,LEVEL|1S,PCI-DSSv3.1|2.2.2,PCI-DSSv3.1|2.2.3,PCI-DSSv3.2|2.2.2,PCI-DSSv3.2|2.2.3" see_also : "https://workbench.cisecurity.org/files/2485" cmd : "/usr/bin/systemctl is-enabled squid | /usr/bin/awk '{print} END { if(NR==0) print \"disabled\" }'" expect : "disabled" dont_echo_cmd : YES system : "Linux" type : CMD_EXEC description : "2.2.7 Ensure Samba is not enabled" info : "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 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 deleted to reduce the potential attack surface." solution : "Run the following command to disable smb: # systemctl --now disable smb" reference : "CIP|007-6-R1,CSCv7|9.2,LEVEL|1S,PCI-DSSv3.1|2.2.2,PCI-DSSv3.1|2.2.3,PCI-DSSv3.2|2.2.2,PCI-DSSv3.2|2.2.3" see_also : "https://workbench.cisecurity.org/files/2485" cmd : "/usr/bin/systemctl is-enabled smb | /usr/bin/awk '{print} END { if(NR==0) print \"disabled\" }'" expect : "disabled" dont_echo_cmd : YES system : "Linux" type : CMD_EXEC description : "2.2.8 Ensure IMAP and POP3 server is not enabled" info : "dovecot is an open source IMAP and POP3 server for Linux based systems. Rationale: Unless POP3 and/or IMAP servers are to be provided by this system, it is recommended that the service be deleted to reduce the potential attack surface." solution : "Run the following command to disable dovecot : # systemctl --now disable dovecot Notes: Additional methods of disabling a service exist. Consult your distribution documentation for appropriate methods. Several IMAP/POP3 servers exist and can use other service names. courier-imap and cyrus-imap are example services that provide a mail server. These and other services should also be audited." reference : "CIP|007-6-R1,CSCv7|9.2,LEVEL|1S,PCI-DSSv3.1|2.2.2,PCI-DSSv3.1|2.2.3,PCI-DSSv3.2|2.2.2,PCI-DSSv3.2|2.2.3" see_also : "https://workbench.cisecurity.org/files/2485" cmd : "/usr/bin/systemctl is-enabled dovecot | /usr/bin/awk '{print} END { if(NR==0) print \"disabled\" }'" expect : "disabled" dont_echo_cmd : YES system : "Linux" type : CMD_EXEC description : "2.2.9 Ensure HTTP server is not enabled" info : "HTTP or web servers provide the ability to host web site content. Rationale: Unless there is a need to run the system as a web server, it is recommended that the package be deleted to reduce the potential attack surface." solution : "Run the following command to disable httpd : # systemctl --now disable httpd Notes: Additional methods of disabling a service exist. Consult your distribution documentation for appropriate methods. Several httpd servers exist and can use other service names. apache, apache2, lighttpd, and nginx are example services that provide an HTTP server. These and other services should also be audited." reference : "CIP|007-6-R1,CSCv7|9.2,LEVEL|1S,PCI-DSSv3.1|2.2.2,PCI-DSSv3.1|2.2.3,PCI-DSSv3.2|2.2.2,PCI-DSSv3.2|2.2.3" see_also : "https://workbench.cisecurity.org/files/2485" cmd : "/usr/bin/systemctl is-enabled httpd | /usr/bin/awk '{print} END { if(NR==0) print \"disabled\" }'" expect : "disabled" dont_echo_cmd : YES system : "Linux" type : CMD_EXEC description : "2.2.10 Ensure FTP Server is not enabled" info : "The File Transfer Protocol (FTP) provides networked computers with the ability to transfer files. 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 package be deleted to reduce the potential attack surface." solution : "Run the following command to disable vsftpd : # systemctl --now disable vsftpd Notes: Additional methods of disabling a service exist. Consult your distribution documentation for appropriate methods. Additional FTP servers also exist and should be audited." reference : "CIP|007-6-R1,CSCv7|9.2,LEVEL|1S,PCI-DSSv3.1|2.2.2,PCI-DSSv3.1|2.2.3,PCI-DSSv3.2|2.2.2,PCI-DSSv3.2|2.2.3" see_also : "https://workbench.cisecurity.org/files/2485" cmd : "/usr/bin/systemctl is-enabled vsftpd | /usr/bin/awk '{print} END { if(NR==0) print \"disabled\" }'" expect : "disabled" dont_echo_cmd : YES system : "Linux" type : CMD_EXEC description : "2.2.11 Ensure DNS Server is not enabled" info : "The Domain Name System (DNS) is a hierarchical naming system that maps names to IP addresses for computers, services and other resources connected to a network. Rationale: Unless a system is specifically designated to act as a DNS server, it is recommended that the package be deleted to reduce the potential attack surface." solution : "Run the following command to disable named : # systemctl --now disable named Notes: Additional methods of disabling a service exist. Consult your distribution documentation for appropriate methods." reference : "CIP|007-6-R1,CSCv7|9.2,LEVEL|1S,PCI-DSSv3.1|2.2.2,PCI-DSSv3.1|2.2.3,PCI-DSSv3.2|2.2.2,PCI-DSSv3.2|2.2.3" see_also : "https://workbench.cisecurity.org/files/2485" cmd : "/usr/bin/systemctl is-enabled named | /usr/bin/awk '{print} END { if(NR==0) print \"disabled\" }'" expect : "disabled" dont_echo_cmd : YES system : "Linux" type : CMD_EXEC description : "2.2.12 Ensure NFS is not enabled" info : "The Network File System (NFS) is one of the first and most widely distributed file systems in the UNIX environment. It provides the ability for systems to mount file systems of other servers through the network. Rationale: If the system does not export NFS shares, it is recommended that the NFS be disabled to reduce the remote attack surface." solution : "Run the following commands to disable NFS: # systemctl --now disable nfs Notes: Additional methods of disabling a service exist. Consult your distribution documentation for appropriate methods." reference : "CIP|007-6-R1,CSCv7|9.2,LEVEL|1S,PCI-DSSv3.1|2.2.2,PCI-DSSv3.1|2.2.3,PCI-DSSv3.2|2.2.2,PCI-DSSv3.2|2.2.3" see_also : "https://workbench.cisecurity.org/files/2485" cmd : "/usr/bin/systemctl is-enabled nfs | /usr/bin/awk '{print} END { if(NR==0) print \"disabled\" }'" expect : "disabled" dont_echo_cmd : YES system : "Linux" type : CMD_EXEC description : "2.2.13 Ensure RPC is not enabled" info : "The rpcbind service maps Remote Procedure Call (RPC) services to the ports on which they listen. RPC processes notify rpcbind when they start, registering the ports they are listening on and the RPC program numbers they expect to serve. The client system then contacts rpcbind on the server with a particular RPC program number. The rpcbind service redirects the client to the proper port number so it can communicate with the requested service. Rationale: If the system does not require rpc based services, it is recommended that rpcbind be disabled to reduce the remote attack surface." solution : "Run the following commands to disable rpcbind : # systemctl --now disable rpcbind Impact: Because RPC-based services rely on rpcbind to make all connections with incoming client requests, rpcbind must be available before any of these services start" reference : "CIP|007-6-R1,CSCv7|9.2,LEVEL|1S,PCI-DSSv3.1|2.2.2,PCI-DSSv3.1|2.2.3,PCI-DSSv3.2|2.2.2,PCI-DSSv3.2|2.2.3" see_also : "https://workbench.cisecurity.org/files/2485" cmd : "/usr/bin/systemctl is-enabled rpcbind | /usr/bin/awk '{print} END { if(NR==0) print \"disabled\" }'" expect : "disabled" dont_echo_cmd : YES system : "Linux" type : CMD_EXEC description : "2.2.14 Ensure LDAP server is not enabled" info : "The Lightweight Directory Access Protocol (LDAP) was introduced as a replacement for NIS/YP. It is a service that provides a method for looking up information from a central database. Rationale: If the system will not need to act as an LDAP server, it is recommended that the software be disabled to reduce the potential attack surface." solution : "Run the following command to disable slapd : # systemctl --now disable slapd" reference : "CIP|007-6-R1,CSCv7|9.2,LEVEL|1S,PCI-DSSv3.1|2.2.2,PCI-DSSv3.1|2.2.3,PCI-DSSv3.2|2.2.2,PCI-DSSv3.2|2.2.3" see_also : "https://workbench.cisecurity.org/files/2485" cmd : "/usr/bin/systemctl is-enabled slapd | /usr/bin/awk '{print} END { if(NR==0) print \"disabled\" }'" expect : "disabled" dont_echo_cmd : YES system : "Linux" type : CMD_EXEC description : "2.2.15 Ensure DHCP Server is not enabled" info : "The Dynamic Host Configuration Protocol (DHCP) is a service that allows machines to be dynamically assigned IP addresses. Rationale: Unless a system is specifically set up to act as a DHCP server, it is recommended that this service be deleted to reduce the potential attack surface." solution : "Run the following command to disable dhcpd: # systemctl --now disable dhcpd" reference : "CIP|007-6-R1,CSCv7|9.2,LEVEL|1S,PCI-DSSv3.1|2.2.2,PCI-DSSv3.1|2.2.3,PCI-DSSv3.2|2.2.2,PCI-DSSv3.2|2.2.3" see_also : "https://workbench.cisecurity.org/files/2485" cmd : "/usr/bin/systemctl is-enabled dhcpd | /usr/bin/awk '{print} END { if(NR==0) print \"disabled\" }'" expect : "disabled" dont_echo_cmd : YES system : "Linux" type : CMD_EXEC description : "2.2.16 Ensure CUPS is not enabled" info : "The Common Unix Print System (CUPS) provides the ability to print to both local and network printers. A system running CUPS can also accept print jobs from remote systems and print them to local printers. It also provides a web based remote administration capability. Rationale: If the system does not need to print jobs or accept print jobs from other systems, it is recommended that CUPS be disabled to reduce the potential attack surface." solution : "Run the following command to disable cups: # systemctl --now disable cups Impact: Disabling CUPS will prevent printing from the system, a common task for workstation systems." reference : "CIP|007-6-R1,CSCv7|9.2,LEVEL|1S,PCI-DSSv3.1|2.2.2,PCI-DSSv3.1|2.2.3,PCI-DSSv3.2|2.2.2,PCI-DSSv3.2|2.2.3" see_also : "https://workbench.cisecurity.org/files/2485" cmd : "/usr/bin/systemctl is-enabled cups | /usr/bin/awk '{print} END { if(NR==0) print \"disabled\" }'" expect : "disabled" dont_echo_cmd : YES system : "Linux" type : CMD_EXEC description : "2.2.17 Ensure NIS Server is not enabled" info : "The Network Information Service (NIS) (formally known as Yellow Pages) is a client-server directory service protocol for distributing system configuration files. The NIS server is a collection of programs that allow for the distribution of configuration files. 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, more secure services be used" solution : "Run the following command to disable ypserv: # systemctl --now disable ypserv Notes: Additional methods of disabling a service exist. Consult your distribution documentation for appropriate methods." reference : "CIP|007-6-R1,CSCv7|9.2,LEVEL|1S,PCI-DSSv3.1|2.2.2,PCI-DSSv3.1|2.2.3,PCI-DSSv3.2|2.2.2,PCI-DSSv3.2|2.2.3" see_also : "https://workbench.cisecurity.org/files/2485" cmd : "/usr/bin/systemctl is-enabled ypserv | /usr/bin/awk '{print} END { if(NR==0) print \"disabled\" }'" expect : "disabled" dont_echo_cmd : YES system : "Linux" type : RPM_CHECK description : "Check if Postfix is installed" rpm : "postfix-0.0.0-0" operator : "gt" required : YES system : "Linux" type : FILE_CONTENT_CHECK description : "2.2.18 Ensure mail transfer agent is configured for local-only mode" info : "Mail Transfer Agents (MTA), such as sendmail and Postfix, are used to listen for incoming mail and transfer the messages to the appropriate user or mail server. If the system is not intended to be a mail server, it is recommended that the MTA be configured to only process local mail. Rationale: The software for all Mail Transfer Agents is complex and most have a long history of security issues. While it is important to ensure that the system can process local mail messages, it is not necessary to have the MTA's daemon listening on a port unless the server is intended to be a mail server that receives and processes mail from other systems." solution : "Edit /etc/postfix/main.cf and add the following line to the RECEIVING MAIL section. If the line already exists, change it to look like the line below: inet_interfaces = loopback-only Run the following command to restart postfix # systemctl restart postfix Notes: This recommendation is designed around the postfix mail server, depending on your environment you may have an alternative MTA installed such as sendmail. If this is the case consult the documentation for your installed MTA to configure the recommended state." reference : "800-171|3.4.2,800-53|CM-6,CIP|007-6-R1,CSCv7|9.2,CSF|PR.IP-1,ITSG-33|CM-6,LEVEL|1S,NESA|T3.2.1,PCI-DSSv3.1|2.2.4,PCI-DSSv3.2|2.2.4,SWIFT-CSCv1|2.3" see_also : "https://workbench.cisecurity.org/files/2485" file : "/etc/postfix/main.cf" regex : "^[\\s]*inet_interfaces[\\s]*=[\\s]*" expect : "^[\\s]*inet_interfaces[\\s]*=[\\s]*loopback-only[\\s]*$" description : "2.2.18 Ensure mail transfer agent is configured for local-only mode" info : "Mail Transfer Agents (MTA), such as sendmail and Postfix, are used to listen for incoming mail and transfer the messages to the appropriate user or mail server. If the system is not intended to be a mail server, it is recommended that the MTA be configured to only process local mail. Rationale: The software for all Mail Transfer Agents is complex and most have a long history of security issues. While it is important to ensure that the system can process local mail messages, it is not necessary to have the MTA's daemon listening on a port unless the server is intended to be a mail server that receives and processes mail from other systems." solution : "Edit /etc/postfix/main.cf and add the following line to the RECEIVING MAIL section. If the line already exists, change it to look like the line below: inet_interfaces = loopback-only Run the following command to restart postfix # systemctl restart postfix Notes: This recommendation is designed around the postfix mail server, depending on your environment you may have an alternative MTA installed such as sendmail. If this is the case consult the documentation for your installed MTA to configure the recommended state." reference : "800-171|3.4.2,800-53|CM-6,CIP|007-6-R1,CSCv7|9.2,CSF|PR.IP-1,ITSG-33|CM-6,LEVEL|1S,NESA|T3.2.1,PCI-DSSv3.1|2.2.4,PCI-DSSv3.2|2.2.4,SWIFT-CSCv1|2.3" see_also : "https://workbench.cisecurity.org/files/2485" system : "Linux" type : RPM_CHECK description : "2.3.1 Ensure NIS Client is not installed" info : "The Network Information Service (NIS), formerly known as Yellow Pages, is a client-server directory service protocol used to distribute system configuration files. The NIS client ( ypbind ) was used to bind a machine to an NIS server and receive the distributed configuration files. 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 removed." solution : "Run the following command to Uninstall ypbind # dnf remove ypbind Impact: Many insecure service clients are used as troubleshooting tools and in testing environments. Uninstalling them can inhibit capability to test and troubleshoot. If they are required it is advisable to remove the clients after use to prevent accidental or intentional misuse." reference : "800-171|3.4.8,800-53|CM-7,CSCv7|2.6,CSF|PR.IP-1,CSF|PR.PT-3,ISO/IEC-27001|A.12.6.2,LEVEL|1S,NIAv2|SS13a,SWIFT-CSCv1|2.3" see_also : "https://workbench.cisecurity.org/files/2485" rpm : "ypbind-0.0.0-0" operator : "lt" required : NO system : "Linux" type : RPM_CHECK description : "2.3.2 Ensure telnet client is not installed" info : "The telnet package contains the telnet client, which allows users to start connections to other systems via the telnet protocol. Rationale: The telnet protocol is insecure and unencrypted. The use of an unencrypted transmission medium could allow an unauthorized user to steal credentials. The ssh package provides an encrypted session and stronger security and is included in most Linux distributions." solution : "Run the folling command to uninstall telnet # dnf remove telnet Impact: Many insecure service clients are used as troubleshooting tools and in testing environments. Uninstalling them can inhibit capability to test and troubleshoot. If they are required it is advisable to remove the clients after use to prevent accidental or intentional misuse." reference : "800-171|3.4.8,800-53|CM-7,CSCv7|4.5,CSF|PR.IP-1,CSF|PR.PT-3,ISO/IEC-27001|A.12.6.2,LEVEL|1S,NIAv2|SS13a,SWIFT-CSCv1|2.3" see_also : "https://workbench.cisecurity.org/files/2485" required : NO operator : "lt" rpm : "telnet-0.0.0-0" system : "Linux" type : RPM_CHECK description : "2.3.3 Ensure LDAP client is not installed" info : "The Lightweight Directory Access Protocol (LDAP) was introduced as a replacement for NIS/YP. It is a service that provides a method for looking up information from a central database. Rationale: If the system will not need to act as an LDAP client, it is recommended that the software be removed to reduce the potential attack surface." solution : "Run the following command to uninstall openldap-clients. # dnf remove openldap-clients Impact: Removing the LDAP client will prevent or inhibit using LDAP for authentication in your environment." reference : "800-171|3.4.8,800-53|CM-7,CSCv7|2.6,CSF|PR.IP-1,CSF|PR.PT-3,ISO/IEC-27001|A.12.6.2,LEVEL|1S,NIAv2|SS13a,SWIFT-CSCv1|2.3" see_also : "https://workbench.cisecurity.org/files/2485" required : NO operator : "lt" rpm : "openldap-clients-0.0.0-0" system : "Linux" type : CMD_EXEC description : "3.1.1 Ensure IP forwarding is disabled - sysctl" info : "The net.ipv4.ip_forward and net.ipv6.conf.all.forwarding flags are used to tell the system whether it can forward packets or not. Rationale: Setting the flags to 0 ensures that a system with multiple interfaces (for example, a hard proxy), will never be able to forward packets, and therefore, never serve as a router." solution : "Run the following commands to restore the default parameters and set the active kernel parameters: # grep -Els \"^\s*net\.ipv4\.ip_forward\s*=\s*1\" /etc/sysctl.conf /etc/sysctl.d/*.conf /usr/lib/sysctl.d/*.conf /run/sysctl.d/*.conf | while read filename; do sed -ri \"s/^\s*(net\.ipv4\.ip_forward\s*)(=)(\s*\S+\b).*$/# *REMOVED* \1/\" $filename; done; sysctl -w net.ipv4.ip_forward=0; sysctl -w net.ipv4.route.flush=1 # grep -Els \"^\s*net\.ipv6\.conf\.all\.forwarding\s*=\s*1\" /etc/sysctl.conf /etc/sysctl.d/*.conf /usr/lib/sysctl.d/*.conf /run/sysctl.d/*.conf | while read filename; do sed -ri \"s/^\s*(net\.ipv6\.conf\.all\.forwarding\s*)(=)(\s*\S+\b).*$/# *REMOVED* \1/\" $filename; done; sysctl -w net.ipv6.conf.all.forwarding=0; sysctl -w net.ipv6.route.flush=1" reference : "800-171|3.13.1,800-53|SC-7,CSCv7|5.1,ITSG-33|SC-7,LEVEL|1S,NIAv2|AM38,NIAv2|SS13d,NIAv2|SS26" see_also : "https://workbench.cisecurity.org/files/2485" cmd : "/usr/sbin/sysctl net.ipv4.ip_forward" expect : "^[\\s]*net\\.ipv4\\.ip_forward[\\s]*=[\\s]*0[\\s]*$" system : "Linux" type : CMD_EXEC description : "3.1.1 Ensure IP forwarding is disabled - /etc/sysctl.conf /etc/sysctl.d/*" info : "The net.ipv4.ip_forward and net.ipv6.conf.all.forwarding flags are used to tell the system whether it can forward packets or not. Rationale: Setting the flags to 0 ensures that a system with multiple interfaces (for example, a hard proxy), will never be able to forward packets, and therefore, never serve as a router." solution : "Run the following commands to restore the default parameters and set the active kernel parameters: # grep -Els \"^\s*net\.ipv4\.ip_forward\s*=\s*1\" /etc/sysctl.conf /etc/sysctl.d/*.conf /usr/lib/sysctl.d/*.conf /run/sysctl.d/*.conf | while read filename; do sed -ri \"s/^\s*(net\.ipv4\.ip_forward\s*)(=)(\s*\S+\b).*$/# *REMOVED* \1/\" $filename; done; sysctl -w net.ipv4.ip_forward=0; sysctl -w net.ipv4.route.flush=1 # grep -Els \"^\s*net\.ipv6\.conf\.all\.forwarding\s*=\s*1\" /etc/sysctl.conf /etc/sysctl.d/*.conf /usr/lib/sysctl.d/*.conf /run/sysctl.d/*.conf | while read filename; do sed -ri \"s/^\s*(net\.ipv6\.conf\.all\.forwarding\s*)(=)(\s*\S+\b).*$/# *REMOVED* \1/\" $filename; done; sysctl -w net.ipv6.conf.all.forwarding=0; sysctl -w net.ipv6.route.flush=1" reference : "800-171|3.13.1,800-53|SC-7,CSCv7|5.1,ITSG-33|SC-7,LEVEL|1S,NIAv2|AM38,NIAv2|SS13d,NIAv2|SS26" see_also : "https://workbench.cisecurity.org/files/2485" cmd : "/usr/bin/grep -s -E '^[[:space:]]*net\\.ipv4\\.ip_forward[[:space:]]*=[[:space:]]*0[[:space:]]*$' /etc/sysctl.conf /etc/sysctl.d/* | /usr/bin/awk '{print} END {if (NR != 0) print \"pass\" ; else print \"fail\"}'" expect : "^pass$" system : "Linux" type : CMD_EXEC description : "3.1.2 Ensure packet redirect sending is disabled - 'net.ipv4.conf.all.send_redirects = 0'" info : "ICMP Redirects are used to send routing information to other hosts. As a host itself does not act as a router (in a host only configuration), there is no need to send redirects. Rationale: An attacker could use a compromised host to send invalid ICMP redirects to other router devices in an attempt to corrupt routing and have users access a system set up by the attacker as opposed to a valid system." solution : "Set the following parameters in /etc/sysctl.conf or a /etc/sysctl.d/* file: net.ipv4.conf.all.send_redirects = 0 net.ipv4.conf.default.send_redirects = 0 Run the following commands to set the active kernel parameters: # sysctl -w net.ipv4.conf.all.send_redirects=0 # sysctl -w net.ipv4.conf.default.send_redirects=0 # sysctl -w net.ipv4.route.flush=1" reference : "800-171|3.13.1,800-53|SC-7,CSCv7|5.1,ITSG-33|SC-7,LEVEL|1S,NIAv2|AM38,NIAv2|SS13d,NIAv2|SS26" see_also : "https://workbench.cisecurity.org/files/2485" cmd : "/usr/sbin/sysctl net.ipv4.conf.all.send_redirects" expect : "^[\\s]*net\\.ipv4\\.conf\\.all\\.send_redirects[\\s]*=[\\s]*0[\\s]*$" system : "Linux" type : CMD_EXEC description : "3.1.2 Ensure packet redirect sending is disabled - files 'net.ipv4.conf.default.send_redirects = 0'" info : "ICMP Redirects are used to send routing information to other hosts. As a host itself does not act as a router (in a host only configuration), there is no need to send redirects. Rationale: An attacker could use a compromised host to send invalid ICMP redirects to other router devices in an attempt to corrupt routing and have users access a system set up by the attacker as opposed to a valid system." solution : "Set the following parameters in /etc/sysctl.conf or a /etc/sysctl.d/* file: net.ipv4.conf.all.send_redirects = 0 net.ipv4.conf.default.send_redirects = 0 Run the following commands to set the active kernel parameters: # sysctl -w net.ipv4.conf.all.send_redirects=0 # sysctl -w net.ipv4.conf.default.send_redirects=0 # sysctl -w net.ipv4.route.flush=1" reference : "800-171|3.13.1,800-53|SC-7,CSCv7|5.1,ITSG-33|SC-7,LEVEL|1S,NIAv2|AM38,NIAv2|SS13d,NIAv2|SS26" see_also : "https://workbench.cisecurity.org/files/2485" cmd : "/usr/bin/grep -s -E '^[[:space:]]*net\\.ipv4\\.conf\\.default\\.send_redirects[[:space:]]*=[[:space:]]*0[[:space:]]*$' /etc/sysctl.conf /etc/sysctl.d/* | /usr/bin/awk '{print} END {if (NR != 0) print \"pass\" ; else print \"fail\"}'" expect : "^pass$" system : "Linux" type : CMD_EXEC description : "3.1.2 Ensure packet redirect sending is disabled - 'net.ipv4.conf.default.send_redirects = 0'" info : "ICMP Redirects are used to send routing information to other hosts. As a host itself does not act as a router (in a host only configuration), there is no need to send redirects. Rationale: An attacker could use a compromised host to send invalid ICMP redirects to other router devices in an attempt to corrupt routing and have users access a system set up by the attacker as opposed to a valid system." solution : "Set the following parameters in /etc/sysctl.conf or a /etc/sysctl.d/* file: net.ipv4.conf.all.send_redirects = 0 net.ipv4.conf.default.send_redirects = 0 Run the following commands to set the active kernel parameters: # sysctl -w net.ipv4.conf.all.send_redirects=0 # sysctl -w net.ipv4.conf.default.send_redirects=0 # sysctl -w net.ipv4.route.flush=1" reference : "800-171|3.13.1,800-53|SC-7,CSCv7|5.1,ITSG-33|SC-7,LEVEL|1S,NIAv2|AM38,NIAv2|SS13d,NIAv2|SS26" see_also : "https://workbench.cisecurity.org/files/2485" cmd : "/usr/sbin/sysctl net.ipv4.conf.default.send_redirects" expect : "^[\\s]*net\\.ipv4\\.conf\\.default\\.send_redirects[\\s]*=[\\s]*0[\\s]*$" system : "Linux" type : CMD_EXEC description : "3.1.2 Ensure packet redirect sending is disabled - files 'net.ipv4.conf.all.send_redirects = 0'" info : "ICMP Redirects are used to send routing information to other hosts. As a host itself does not act as a router (in a host only configuration), there is no need to send redirects. Rationale: An attacker could use a compromised host to send invalid ICMP redirects to other router devices in an attempt to corrupt routing and have users access a system set up by the attacker as opposed to a valid system." solution : "Set the following parameters in /etc/sysctl.conf or a /etc/sysctl.d/* file: net.ipv4.conf.all.send_redirects = 0 net.ipv4.conf.default.send_redirects = 0 Run the following commands to set the active kernel parameters: # sysctl -w net.ipv4.conf.all.send_redirects=0 # sysctl -w net.ipv4.conf.default.send_redirects=0 # sysctl -w net.ipv4.route.flush=1" reference : "800-171|3.13.1,800-53|SC-7,CSCv7|5.1,ITSG-33|SC-7,LEVEL|1S,NIAv2|AM38,NIAv2|SS13d,NIAv2|SS26" see_also : "https://workbench.cisecurity.org/files/2485" cmd : "/usr/bin/grep -s -E '^[[:space:]]*net\\.ipv4\\.conf\\.all\\.send_redirects[[:space:]]*=[[:space:]]*0[[:space:]]*$' /etc/sysctl.conf /etc/sysctl.d/* | /usr/bin/awk '{print} END {if (NR != 0) print \"pass\" ; else print \"fail\"}'" expect : "^pass$" system : "Linux" type : CMD_EXEC description : "3.2.1 Ensure source routed packets are not accepted - 'net.ipv4.conf.default.accept_source_route = 0'" info : "In networking, source routing allows a sender to partially or fully specify the route packets take through a network. In contrast, non-source routed packets travel a path determined by routers in the network. In some cases, systems may not be routable or reachable from some locations (e.g. private addresses vs. Internet routable), and so source routed packets would need to be used. Rationale: Setting net.ipv4.conf.all.accept_source_route, net.ipv4.conf.default.accept_source_route, net.ipv6.conf.all.accept_source_route and net.ipv6.conf.default.accept_source_route to 0 disables the system from accepting source routed packets. Assume this system was capable of routing packets to Internet routable addresses on one interface and private addresses on another interface. Assume that the private addresses were not routable to the Internet routable addresses and vice versa. Under normal routing circumstances, an attacker from the Internet routable addresses could not use the system as a way to reach the private address systems. If, however, source routed packets were allowed, they could be used to gain access to the private address systems as the route could be specified, rather than rely on routing protocols that did not allow this routing." solution : "Set the following parameters in /etc/sysctl.conf or a /etc/sysctl.d/* file: net.ipv4.conf.all.accept_source_route = 0 net.ipv4.conf.default.accept_source_route = 0 net.ipv6.conf.all.accept_source_route = 0 net.ipv6.conf.default.accept_source_route = 0 Run the following commands to set the active kernel parameters: # sysctl -w net.ipv4.conf.all.accept_source_route=0 # sysctl -w net.ipv4.conf.default.accept_source_route=0 # sysctl -w net.ipv6.conf.all.accept_source_route=0 # sysctl -w net.ipv6.conf.default.accept_source_route=0 # sysctl -w net.ipv4.route.flush=1 # sysctl -w net.ipv6.route.flush=1" reference : "800-171|3.13.1,800-53|SC-7,CSCv7|5.1,ITSG-33|SC-7,LEVEL|1S,NIAv2|AM38,NIAv2|SS13d,NIAv2|SS26" see_also : "https://workbench.cisecurity.org/files/2485" cmd : "/usr/sbin/sysctl net.ipv4.conf.default.accept_source_route" expect : "^[\\s]*net\\.ipv4\\.conf\\.default\\.accept_source_route[\\s]*=[\\s]*0[\\s]*$" system : "Linux" type : CMD_EXEC description : "3.2.1 Ensure source routed packets are not accepted - 'net.ipv4.conf.all.accept_source_route = 0'" info : "In networking, source routing allows a sender to partially or fully specify the route packets take through a network. In contrast, non-source routed packets travel a path determined by routers in the network. In some cases, systems may not be routable or reachable from some locations (e.g. private addresses vs. Internet routable), and so source routed packets would need to be used. Rationale: Setting net.ipv4.conf.all.accept_source_route, net.ipv4.conf.default.accept_source_route, net.ipv6.conf.all.accept_source_route and net.ipv6.conf.default.accept_source_route to 0 disables the system from accepting source routed packets. Assume this system was capable of routing packets to Internet routable addresses on one interface and private addresses on another interface. Assume that the private addresses were not routable to the Internet routable addresses and vice versa. Under normal routing circumstances, an attacker from the Internet routable addresses could not use the system as a way to reach the private address systems. If, however, source routed packets were allowed, they could be used to gain access to the private address systems as the route could be specified, rather than rely on routing protocols that did not allow this routing." solution : "Set the following parameters in /etc/sysctl.conf or a /etc/sysctl.d/* file: net.ipv4.conf.all.accept_source_route = 0 net.ipv4.conf.default.accept_source_route = 0 net.ipv6.conf.all.accept_source_route = 0 net.ipv6.conf.default.accept_source_route = 0 Run the following commands to set the active kernel parameters: # sysctl -w net.ipv4.conf.all.accept_source_route=0 # sysctl -w net.ipv4.conf.default.accept_source_route=0 # sysctl -w net.ipv6.conf.all.accept_source_route=0 # sysctl -w net.ipv6.conf.default.accept_source_route=0 # sysctl -w net.ipv4.route.flush=1 # sysctl -w net.ipv6.route.flush=1" reference : "800-171|3.13.1,800-53|SC-7,CSCv7|5.1,ITSG-33|SC-7,LEVEL|1S,NIAv2|AM38,NIAv2|SS13d,NIAv2|SS26" see_also : "https://workbench.cisecurity.org/files/2485" cmd : "/usr/sbin/sysctl net.ipv4.conf.all.accept_source_route" expect : "^[\\s]*net\\.ipv4\\.conf\\.all\\.accept_source_route[\\s]*=[\\s]*0[\\s]*$" system : "Linux" type : CMD_EXEC description : "3.2.1 Ensure source routed packets are not accepted - files 'net.ipv4.conf.default.accept_source_route = 0'" info : "In networking, source routing allows a sender to partially or fully specify the route packets take through a network. In contrast, non-source routed packets travel a path determined by routers in the network. In some cases, systems may not be routable or reachable from some locations (e.g. private addresses vs. Internet routable), and so source routed packets would need to be used. Rationale: Setting net.ipv4.conf.all.accept_source_route, net.ipv4.conf.default.accept_source_route, net.ipv6.conf.all.accept_source_route and net.ipv6.conf.default.accept_source_route to 0 disables the system from accepting source routed packets. Assume this system was capable of routing packets to Internet routable addresses on one interface and private addresses on another interface. Assume that the private addresses were not routable to the Internet routable addresses and vice versa. Under normal routing circumstances, an attacker from the Internet routable addresses could not use the system as a way to reach the private address systems. If, however, source routed packets were allowed, they could be used to gain access to the private address systems as the route could be specified, rather than rely on routing protocols that did not allow this routing." solution : "Set the following parameters in /etc/sysctl.conf or a /etc/sysctl.d/* file: net.ipv4.conf.all.accept_source_route = 0 net.ipv4.conf.default.accept_source_route = 0 net.ipv6.conf.all.accept_source_route = 0 net.ipv6.conf.default.accept_source_route = 0 Run the following commands to set the active kernel parameters: # sysctl -w net.ipv4.conf.all.accept_source_route=0 # sysctl -w net.ipv4.conf.default.accept_source_route=0 # sysctl -w net.ipv6.conf.all.accept_source_route=0 # sysctl -w net.ipv6.conf.default.accept_source_route=0 # sysctl -w net.ipv4.route.flush=1 # sysctl -w net.ipv6.route.flush=1" reference : "800-171|3.13.1,800-53|SC-7,CSCv7|5.1,ITSG-33|SC-7,LEVEL|1S,NIAv2|AM38,NIAv2|SS13d,NIAv2|SS26" see_also : "https://workbench.cisecurity.org/files/2485" cmd : "/usr/bin/grep -s -E '^[[:space:]]*net\\.ipv4\\.conf\\.default\\.accept_source_route[[:space:]]*=[[:space:]]*0[[:space:]]*$' /etc/sysctl.conf /etc/sysctl.d/* | /usr/bin/awk '{print} END {if (NR != 0) print \"pass\" ; else print \"fail\"}'" expect : "^pass$" system : "Linux" type : CMD_EXEC description : "3.2.1 Ensure source routed packets are not accepted - files 'net.ipv4.conf.all.accept_source_route = 0'" info : "In networking, source routing allows a sender to partially or fully specify the route packets take through a network. In contrast, non-source routed packets travel a path determined by routers in the network. In some cases, systems may not be routable or reachable from some locations (e.g. private addresses vs. Internet routable), and so source routed packets would need to be used. Rationale: Setting net.ipv4.conf.all.accept_source_route, net.ipv4.conf.default.accept_source_route, net.ipv6.conf.all.accept_source_route and net.ipv6.conf.default.accept_source_route to 0 disables the system from accepting source routed packets. Assume this system was capable of routing packets to Internet routable addresses on one interface and private addresses on another interface. Assume that the private addresses were not routable to the Internet routable addresses and vice versa. Under normal routing circumstances, an attacker from the Internet routable addresses could not use the system as a way to reach the private address systems. If, however, source routed packets were allowed, they could be used to gain access to the private address systems as the route could be specified, rather than rely on routing protocols that did not allow this routing." solution : "Set the following parameters in /etc/sysctl.conf or a /etc/sysctl.d/* file: net.ipv4.conf.all.accept_source_route = 0 net.ipv4.conf.default.accept_source_route = 0 net.ipv6.conf.all.accept_source_route = 0 net.ipv6.conf.default.accept_source_route = 0 Run the following commands to set the active kernel parameters: # sysctl -w net.ipv4.conf.all.accept_source_route=0 # sysctl -w net.ipv4.conf.default.accept_source_route=0 # sysctl -w net.ipv6.conf.all.accept_source_route=0 # sysctl -w net.ipv6.conf.default.accept_source_route=0 # sysctl -w net.ipv4.route.flush=1 # sysctl -w net.ipv6.route.flush=1" reference : "800-171|3.13.1,800-53|SC-7,CSCv7|5.1,ITSG-33|SC-7,LEVEL|1S,NIAv2|AM38,NIAv2|SS13d,NIAv2|SS26" see_also : "https://workbench.cisecurity.org/files/2485" cmd : "/usr/bin/grep -s -E '^[[:space:]]*net\\.ipv4\\.conf\\.all\\.accept_source_route[[:space:]]*=[[:space:]]*0[[:space:]]*$' /etc/sysctl.conf /etc/sysctl.d/* | /usr/bin/awk '{print} END {if (NR != 0) print \"pass\" ; else print \"fail\"}'" expect : "^pass$" system : "Linux" type : CMD_EXEC description : "3.2.2 Ensure ICMP redirects are not accepted - files 'net.ipv4.conf.all.accept_redirects = 0'" info : "ICMP redirect messages are packets that convey routing information and tell your host (acting as a router) to send packets via an alternate path. It is a way of allowing an outside routing device to update your system routing tables. By setting net.ipv4.conf.all.accept_redirects and net.ipv6.conf.all.accept_redirects to 0, the system will not accept any ICMP redirect messages, and therefore, won't allow outsiders to update the system's routing tables. Rationale: Attackers could use bogus ICMP redirect messages to maliciously alter the system routing tables and get them to send packets to incorrect networks and allow your system packets to be captured." solution : "Set the following parameters in /etc/sysctl.conf or a /etc/sysctl.d/* file: net.ipv4.conf.all.accept_redirects = 0 net.ipv4.conf.default.accept_redirects = 0 net.ipv6.conf.all.accept_redirects = 0 net.ipv6.conf.default.accept_redirects = 0 Run the following commands to set the active kernel parameters: # sysctl -w net.ipv4.conf.all.accept_redirects=0 # sysctl -w net.ipv4.conf.default.accept_redirects=0 # sysctl -w net.ipv6.conf.all.accept_redirects=0 # sysctl -w net.ipv6.conf.default.accept_redirects=0 # sysctl -w net.ipv4.route.flush=1 # sysctl -w net.ipv6.route.flush=1" reference : "800-171|3.13.1,800-53|SC-7,CSCv7|5.1,ITSG-33|SC-7,LEVEL|1S,NIAv2|AM38,NIAv2|SS13d,NIAv2|SS26" see_also : "https://workbench.cisecurity.org/files/2485" cmd : "/usr/bin/grep -s -E '^[[:space:]]*net\\.ipv4\\.conf\\.all\\.accept_redirects[[:space:]]*=[[:space:]]*0[[:space:]]*$' /etc/sysctl.conf /etc/sysctl.d/* | /usr/bin/awk '{print} END {if (NR != 0) print \"pass\" ; else print \"fail\"}'" expect : "^pass$" system : "Linux" type : CMD_EXEC description : "3.2.2 Ensure ICMP redirects are not accepted - files 'net.ipv4.conf.default.accept_redirects = 0'" info : "ICMP redirect messages are packets that convey routing information and tell your host (acting as a router) to send packets via an alternate path. It is a way of allowing an outside routing device to update your system routing tables. By setting net.ipv4.conf.all.accept_redirects and net.ipv6.conf.all.accept_redirects to 0, the system will not accept any ICMP redirect messages, and therefore, won't allow outsiders to update the system's routing tables. Rationale: Attackers could use bogus ICMP redirect messages to maliciously alter the system routing tables and get them to send packets to incorrect networks and allow your system packets to be captured." solution : "Set the following parameters in /etc/sysctl.conf or a /etc/sysctl.d/* file: net.ipv4.conf.all.accept_redirects = 0 net.ipv4.conf.default.accept_redirects = 0 net.ipv6.conf.all.accept_redirects = 0 net.ipv6.conf.default.accept_redirects = 0 Run the following commands to set the active kernel parameters: # sysctl -w net.ipv4.conf.all.accept_redirects=0 # sysctl -w net.ipv4.conf.default.accept_redirects=0 # sysctl -w net.ipv6.conf.all.accept_redirects=0 # sysctl -w net.ipv6.conf.default.accept_redirects=0 # sysctl -w net.ipv4.route.flush=1 # sysctl -w net.ipv6.route.flush=1" reference : "800-171|3.13.1,800-53|SC-7,CSCv7|5.1,ITSG-33|SC-7,LEVEL|1S,NIAv2|AM38,NIAv2|SS13d,NIAv2|SS26" see_also : "https://workbench.cisecurity.org/files/2485" cmd : "/usr/bin/grep -s -E '^[[:space:]]*net\\.ipv4\\.conf\\.default\\.accept_redirects[[:space:]]*=[[:space:]]*0[[:space:]]*$' /etc/sysctl.conf /etc/sysctl.d/* | /usr/bin/awk '{print} END {if (NR != 0) print \"pass\" ; else print \"fail\"}'" expect : "^pass$" system : "Linux" type : CMD_EXEC description : "3.2.2 Ensure ICMP redirects are not accepted - 'net.ipv4.conf.all.accept_redirects = 0'" info : "ICMP redirect messages are packets that convey routing information and tell your host (acting as a router) to send packets via an alternate path. It is a way of allowing an outside routing device to update your system routing tables. By setting net.ipv4.conf.all.accept_redirects and net.ipv6.conf.all.accept_redirects to 0, the system will not accept any ICMP redirect messages, and therefore, won't allow outsiders to update the system's routing tables. Rationale: Attackers could use bogus ICMP redirect messages to maliciously alter the system routing tables and get them to send packets to incorrect networks and allow your system packets to be captured." solution : "Set the following parameters in /etc/sysctl.conf or a /etc/sysctl.d/* file: net.ipv4.conf.all.accept_redirects = 0 net.ipv4.conf.default.accept_redirects = 0 net.ipv6.conf.all.accept_redirects = 0 net.ipv6.conf.default.accept_redirects = 0 Run the following commands to set the active kernel parameters: # sysctl -w net.ipv4.conf.all.accept_redirects=0 # sysctl -w net.ipv4.conf.default.accept_redirects=0 # sysctl -w net.ipv6.conf.all.accept_redirects=0 # sysctl -w net.ipv6.conf.default.accept_redirects=0 # sysctl -w net.ipv4.route.flush=1 # sysctl -w net.ipv6.route.flush=1" reference : "800-171|3.13.1,800-53|SC-7,CSCv7|5.1,ITSG-33|SC-7,LEVEL|1S,NIAv2|AM38,NIAv2|SS13d,NIAv2|SS26" see_also : "https://workbench.cisecurity.org/files/2485" cmd : "/usr/sbin/sysctl net.ipv4.conf.all.accept_redirects" expect : "^[\\s]*net\\.ipv4\\.conf\\.all\\.accept_redirects[\\s]*=[\\s]*0[\\s]*$" system : "Linux" type : CMD_EXEC description : "3.2.2 Ensure ICMP redirects are not accepted - 'net.ipv4.conf.default.accept_redirects = 0'" info : "ICMP redirect messages are packets that convey routing information and tell your host (acting as a router) to send packets via an alternate path. It is a way of allowing an outside routing device to update your system routing tables. By setting net.ipv4.conf.all.accept_redirects and net.ipv6.conf.all.accept_redirects to 0, the system will not accept any ICMP redirect messages, and therefore, won't allow outsiders to update the system's routing tables. Rationale: Attackers could use bogus ICMP redirect messages to maliciously alter the system routing tables and get them to send packets to incorrect networks and allow your system packets to be captured." solution : "Set the following parameters in /etc/sysctl.conf or a /etc/sysctl.d/* file: net.ipv4.conf.all.accept_redirects = 0 net.ipv4.conf.default.accept_redirects = 0 net.ipv6.conf.all.accept_redirects = 0 net.ipv6.conf.default.accept_redirects = 0 Run the following commands to set the active kernel parameters: # sysctl -w net.ipv4.conf.all.accept_redirects=0 # sysctl -w net.ipv4.conf.default.accept_redirects=0 # sysctl -w net.ipv6.conf.all.accept_redirects=0 # sysctl -w net.ipv6.conf.default.accept_redirects=0 # sysctl -w net.ipv4.route.flush=1 # sysctl -w net.ipv6.route.flush=1" reference : "800-171|3.13.1,800-53|SC-7,CSCv7|5.1,ITSG-33|SC-7,LEVEL|1S,NIAv2|AM38,NIAv2|SS13d,NIAv2|SS26" see_also : "https://workbench.cisecurity.org/files/2485" cmd : "/usr/sbin/sysctl net.ipv4.conf.default.accept_redirects" expect : "^[\\s]*net\\.ipv4\\.conf\\.default\\.accept_redirects[\\s]*=[\\s]*0[\\s]*$" system : "Linux" type : CMD_EXEC description : "3.2.3 Ensure secure ICMP redirects are not accepted - files 'net.ipv4.conf.all.secure_redirects = 0'" info : "Secure ICMP redirects are the same as ICMP redirects, except they come from gateways listed on the default gateway list. It is assumed that these gateways are known to your system, and that they are likely to be secure. Rationale: It is still possible for even known gateways to be compromised. Setting net.ipv4.conf.all.secure_redirects to 0 protects the system from routing table updates by possibly compromised known gateways." solution : "Set the following parameters in /etc/sysctl.conf or a /etc/sysctl.d/* file: net.ipv4.conf.all.secure_redirects = 0 net.ipv4.conf.default.secure_redirects = 0 Run the following commands to set the active kernel parameters: # sysctl -w net.ipv4.conf.all.secure_redirects=0 # sysctl -w net.ipv4.conf.default.secure_redirects=0 # sysctl -w net.ipv4.route.flush=1" reference : "800-171|3.13.1,800-53|SC-7,CSCv7|5.1,ITSG-33|SC-7,LEVEL|1S,NIAv2|AM38,NIAv2|SS13d,NIAv2|SS26" see_also : "https://workbench.cisecurity.org/files/2485" cmd : "/usr/bin/grep -s -E '^[[:space:]]*net\\.ipv4\\.conf\\.all\\.secure_redirects[[:space:]]*=[[:space:]]*0[[:space:]]*$' /etc/sysctl.conf /etc/sysctl.d/* | /usr/bin/awk '{print} END {if (NR != 0) print \"pass\" ; else print \"fail\"}'" expect : "^pass$" system : "Linux" type : CMD_EXEC description : "3.2.3 Ensure secure ICMP redirects are not accepted - 'net.ipv4.conf.default.secure_redirects = 0'" info : "Secure ICMP redirects are the same as ICMP redirects, except they come from gateways listed on the default gateway list. It is assumed that these gateways are known to your system, and that they are likely to be secure. Rationale: It is still possible for even known gateways to be compromised. Setting net.ipv4.conf.all.secure_redirects to 0 protects the system from routing table updates by possibly compromised known gateways." solution : "Set the following parameters in /etc/sysctl.conf or a /etc/sysctl.d/* file: net.ipv4.conf.all.secure_redirects = 0 net.ipv4.conf.default.secure_redirects = 0 Run the following commands to set the active kernel parameters: # sysctl -w net.ipv4.conf.all.secure_redirects=0 # sysctl -w net.ipv4.conf.default.secure_redirects=0 # sysctl -w net.ipv4.route.flush=1" reference : "800-171|3.13.1,800-53|SC-7,CSCv7|5.1,ITSG-33|SC-7,LEVEL|1S,NIAv2|AM38,NIAv2|SS13d,NIAv2|SS26" see_also : "https://workbench.cisecurity.org/files/2485" cmd : "/usr/sbin/sysctl net.ipv4.conf.default.secure_redirects" expect : "^[\\s]*net\\.ipv4\\.conf\\.default\\.secure_redirects[\\s]*=[\\s]*0[\\s]*$" system : "Linux" type : CMD_EXEC description : "3.2.3 Ensure secure ICMP redirects are not accepted - files 'net.ipv4.conf.default.secure_redirects = 0'" info : "Secure ICMP redirects are the same as ICMP redirects, except they come from gateways listed on the default gateway list. It is assumed that these gateways are known to your system, and that they are likely to be secure. Rationale: It is still possible for even known gateways to be compromised. Setting net.ipv4.conf.all.secure_redirects to 0 protects the system from routing table updates by possibly compromised known gateways." solution : "Set the following parameters in /etc/sysctl.conf or a /etc/sysctl.d/* file: net.ipv4.conf.all.secure_redirects = 0 net.ipv4.conf.default.secure_redirects = 0 Run the following commands to set the active kernel parameters: # sysctl -w net.ipv4.conf.all.secure_redirects=0 # sysctl -w net.ipv4.conf.default.secure_redirects=0 # sysctl -w net.ipv4.route.flush=1" reference : "800-171|3.13.1,800-53|SC-7,CSCv7|5.1,ITSG-33|SC-7,LEVEL|1S,NIAv2|AM38,NIAv2|SS13d,NIAv2|SS26" see_also : "https://workbench.cisecurity.org/files/2485" cmd : "/usr/bin/grep -s -E '^[[:space:]]*net\\.ipv4\\.conf\\.default\\.secure_redirects[[:space:]]*=[[:space:]]*0[[:space:]]*$' /etc/sysctl.conf /etc/sysctl.d/* | /usr/bin/awk '{print} END {if (NR != 0) print \"pass\" ; else print \"fail\"}'" expect : "^pass$" system : "Linux" type : CMD_EXEC description : "3.2.3 Ensure secure ICMP redirects are not accepted - 'net.ipv4.conf.all.secure_redirects = 0'" info : "Secure ICMP redirects are the same as ICMP redirects, except they come from gateways listed on the default gateway list. It is assumed that these gateways are known to your system, and that they are likely to be secure. Rationale: It is still possible for even known gateways to be compromised. Setting net.ipv4.conf.all.secure_redirects to 0 protects the system from routing table updates by possibly compromised known gateways." solution : "Set the following parameters in /etc/sysctl.conf or a /etc/sysctl.d/* file: net.ipv4.conf.all.secure_redirects = 0 net.ipv4.conf.default.secure_redirects = 0 Run the following commands to set the active kernel parameters: # sysctl -w net.ipv4.conf.all.secure_redirects=0 # sysctl -w net.ipv4.conf.default.secure_redirects=0 # sysctl -w net.ipv4.route.flush=1" reference : "800-171|3.13.1,800-53|SC-7,CSCv7|5.1,ITSG-33|SC-7,LEVEL|1S,NIAv2|AM38,NIAv2|SS13d,NIAv2|SS26" see_also : "https://workbench.cisecurity.org/files/2485" cmd : "/usr/sbin/sysctl net.ipv4.conf.all.secure_redirects" expect : "^[\\s]*net\\.ipv4\\.conf\\.all\\.secure_redirects[\\s]*=[\\s]*0[\\s]*$" system : "Linux" type : CMD_EXEC description : "3.2.4 Ensure suspicious packets are logged - files 'net.ipv4.conf.all.log_martians = 1'" info : "When enabled, this feature logs packets with un-routable source addresses to the kernel log. Rationale: Enabling this feature and logging these packets allows an administrator to investigate the possibility that an attacker is sending spoofed packets to their system." solution : "Set the following parameters in /etc/sysctl.conf or a /etc/sysctl.d/* file: net.ipv4.conf.all.log_martians = 1 net.ipv4.conf.default.log_martians = 1 Run the following commands to set the active kernel parameters: # sysctl -w net.ipv4.conf.all.log_martians=1 # sysctl -w net.ipv4.conf.default.log_martians=1 # sysctl -w net.ipv4.route.flush=1" reference : "800-171|3.3.1,800-171|3.3.2,800-53|AU-12,CN-L3|7.1.3.3(a),CN-L3|7.1.3.3(b),CN-L3|7.1.3.3(c),CSCv7|6.2,CSCv7|6.3,CSF|DE.CM-1,CSF|DE.CM-3,CSF|DE.CM-7,CSF|PR.PT-1,ISO/IEC-27001|A.12.4.1,ITSG-33|AU-12,LEVEL|1S,NESA|T3.6.2,NESA|T3.6.5,NESA|T3.6.6,NIAv2|SM8,SWIFT-CSCv1|6.4,TBA-FIISB|45.1.1" see_also : "https://workbench.cisecurity.org/files/2485" cmd : "/usr/bin/grep -s -E '^[[:space:]]*net\\.ipv4\\.conf\\.all\\.log_martians[[:space:]]*=[[:space:]]*1[[:space:]]*$' /etc/sysctl.conf /etc/sysctl.d/* | /usr/bin/awk '{print} END {if (NR != 0) print \"pass\" ; else print \"fail\"}'" expect : "^pass$" system : "Linux" type : CMD_EXEC description : "3.2.4 Ensure suspicious packets are logged - files 'net.ipv4.conf.default.log_martians = 1'" info : "When enabled, this feature logs packets with un-routable source addresses to the kernel log. Rationale: Enabling this feature and logging these packets allows an administrator to investigate the possibility that an attacker is sending spoofed packets to their system." solution : "Set the following parameters in /etc/sysctl.conf or a /etc/sysctl.d/* file: net.ipv4.conf.all.log_martians = 1 net.ipv4.conf.default.log_martians = 1 Run the following commands to set the active kernel parameters: # sysctl -w net.ipv4.conf.all.log_martians=1 # sysctl -w net.ipv4.conf.default.log_martians=1 # sysctl -w net.ipv4.route.flush=1" reference : "800-171|3.3.1,800-171|3.3.2,800-53|AU-12,CN-L3|7.1.3.3(a),CN-L3|7.1.3.3(b),CN-L3|7.1.3.3(c),CSCv7|6.2,CSCv7|6.3,CSF|DE.CM-1,CSF|DE.CM-3,CSF|DE.CM-7,CSF|PR.PT-1,ISO/IEC-27001|A.12.4.1,ITSG-33|AU-12,LEVEL|1S,NESA|T3.6.2,NESA|T3.6.5,NESA|T3.6.6,NIAv2|SM8,SWIFT-CSCv1|6.4,TBA-FIISB|45.1.1" see_also : "https://workbench.cisecurity.org/files/2485" cmd : "/usr/bin/grep -s -E '^[[:space:]]*net\\.ipv4\\.conf\\.default\\.log_martians[[:space:]]*=[[:space:]]*1[[:space:]]*$' /etc/sysctl.conf /etc/sysctl.d/* | /usr/bin/awk '{print} END {if (NR != 0) print \"pass\" ; else print \"fail\"}'" expect : "^pass$" system : "Linux" type : CMD_EXEC description : "3.2.4 Ensure suspicious packets are logged - 'net.ipv4.conf.default.log_martians = 1'" info : "When enabled, this feature logs packets with un-routable source addresses to the kernel log. Rationale: Enabling this feature and logging these packets allows an administrator to investigate the possibility that an attacker is sending spoofed packets to their system." solution : "Set the following parameters in /etc/sysctl.conf or a /etc/sysctl.d/* file: net.ipv4.conf.all.log_martians = 1 net.ipv4.conf.default.log_martians = 1 Run the following commands to set the active kernel parameters: # sysctl -w net.ipv4.conf.all.log_martians=1 # sysctl -w net.ipv4.conf.default.log_martians=1 # sysctl -w net.ipv4.route.flush=1" reference : "800-171|3.3.1,800-171|3.3.2,800-53|AU-12,CN-L3|7.1.3.3(a),CN-L3|7.1.3.3(b),CN-L3|7.1.3.3(c),CSCv7|6.2,CSCv7|6.3,CSF|DE.CM-1,CSF|DE.CM-3,CSF|DE.CM-7,CSF|PR.PT-1,ISO/IEC-27001|A.12.4.1,ITSG-33|AU-12,LEVEL|1S,NESA|T3.6.2,NESA|T3.6.5,NESA|T3.6.6,NIAv2|SM8,SWIFT-CSCv1|6.4,TBA-FIISB|45.1.1" see_also : "https://workbench.cisecurity.org/files/2485" cmd : "/usr/sbin/sysctl net.ipv4.conf.default.log_martians" expect : "^[\\s]*net\\.ipv4\\.conf\\.default\\.log_martians[\\s]*=[\\s]*1[\\s]*$" system : "Linux" type : CMD_EXEC description : "3.2.4 Ensure suspicious packets are logged - 'net.ipv4.conf.all.log_martians = 1'" info : "When enabled, this feature logs packets with un-routable source addresses to the kernel log. Rationale: Enabling this feature and logging these packets allows an administrator to investigate the possibility that an attacker is sending spoofed packets to their system." solution : "Set the following parameters in /etc/sysctl.conf or a /etc/sysctl.d/* file: net.ipv4.conf.all.log_martians = 1 net.ipv4.conf.default.log_martians = 1 Run the following commands to set the active kernel parameters: # sysctl -w net.ipv4.conf.all.log_martians=1 # sysctl -w net.ipv4.conf.default.log_martians=1 # sysctl -w net.ipv4.route.flush=1" reference : "800-171|3.3.1,800-171|3.3.2,800-53|AU-12,CN-L3|7.1.3.3(a),CN-L3|7.1.3.3(b),CN-L3|7.1.3.3(c),CSCv7|6.2,CSCv7|6.3,CSF|DE.CM-1,CSF|DE.CM-3,CSF|DE.CM-7,CSF|PR.PT-1,ISO/IEC-27001|A.12.4.1,ITSG-33|AU-12,LEVEL|1S,NESA|T3.6.2,NESA|T3.6.5,NESA|T3.6.6,NIAv2|SM8,SWIFT-CSCv1|6.4,TBA-FIISB|45.1.1" see_also : "https://workbench.cisecurity.org/files/2485" cmd : "/usr/sbin/sysctl net.ipv4.conf.all.log_martians" expect : "^[\\s]*net\\.ipv4\\.conf\\.all\\.log_martians[\\s]*=[\\s]*1[\\s]*$" system : "Linux" type : CMD_EXEC description : "3.2.5 Ensure broadcast ICMP requests are ignored - sysctl" info : "Setting net.ipv4.icmp_echo_ignore_broadcasts to 1 will cause the system to ignore all ICMP echo and timestamp requests to broadcast and multicast addresses. Rationale: Accepting ICMP echo and timestamp requests with broadcast or multicast destinations for your network could be used to trick your host into starting (or participating) in a Smurf attack. A Smurf attack relies on an attacker sending large amounts of ICMP broadcast messages with a spoofed source address. All hosts receiving this message and responding would send echo-reply messages back to the spoofed address, which is probably not routable. If many hosts respond to the packets, the amount of traffic on the network could be significantly multiplied." solution : "Run the following command to restore the default parameters and set the active kernel parameters: # grep -Els \"^\s*net\.ipv4\.icmp_echo_ignore_broadcasts\s*=\s*0\" /etc/sysctl.conf /etc/sysctl.d/*.conf /usr/lib/sysctl.d/*.conf /run/sysctl.d/*.conf | while read filename; do sed -ri \"s/^\s*(net\.ipv4\.icmp_echo_ignore_broadcasts\s*)(=)(\s*\S+\b).*$/# *REMOVED* \1/\" $filename; done; sysctl -w net.icmp_echo_ignore_broadcasts=1; sysctl -w net.ipv4.route.flush=1" reference : "800-171|3.13.1,800-53|SC-7,CSCv7|5.1,ITSG-33|SC-7,LEVEL|1S,NIAv2|AM38,NIAv2|SS13d,NIAv2|SS26" see_also : "https://workbench.cisecurity.org/files/2485" cmd : "/usr/sbin/sysctl net.ipv4.icmp_echo_ignore_broadcasts" expect : "^[\\s]*net\\.ipv4\\.icmp_echo_ignore_broadcasts[\\s]*=[\\s]*1[\\s]*$" system : "Linux" type : CMD_EXEC description : "3.2.5 Ensure broadcast ICMP requests are ignored - sysctl.conf sysctl.d" info : "Setting net.ipv4.icmp_echo_ignore_broadcasts to 1 will cause the system to ignore all ICMP echo and timestamp requests to broadcast and multicast addresses. Rationale: Accepting ICMP echo and timestamp requests with broadcast or multicast destinations for your network could be used to trick your host into starting (or participating) in a Smurf attack. A Smurf attack relies on an attacker sending large amounts of ICMP broadcast messages with a spoofed source address. All hosts receiving this message and responding would send echo-reply messages back to the spoofed address, which is probably not routable. If many hosts respond to the packets, the amount of traffic on the network could be significantly multiplied." solution : "Run the following command to restore the default parameters and set the active kernel parameters: # grep -Els \"^\s*net\.ipv4\.icmp_echo_ignore_broadcasts\s*=\s*0\" /etc/sysctl.conf /etc/sysctl.d/*.conf /usr/lib/sysctl.d/*.conf /run/sysctl.d/*.conf | while read filename; do sed -ri \"s/^\s*(net\.ipv4\.icmp_echo_ignore_broadcasts\s*)(=)(\s*\S+\b).*$/# *REMOVED* \1/\" $filename; done; sysctl -w net.icmp_echo_ignore_broadcasts=1; sysctl -w net.ipv4.route.flush=1" reference : "800-171|3.13.1,800-53|SC-7,CSCv7|5.1,ITSG-33|SC-7,LEVEL|1S,NIAv2|AM38,NIAv2|SS13d,NIAv2|SS26" see_also : "https://workbench.cisecurity.org/files/2485" cmd : "/usr/bin/grep -s -E '^[[:space:]]*net\\.ipv4\\.icmp_echo_ignore_broadcasts[[:space:]]*=[[:space:]]*1[[:space:]]*$' /etc/sysctl.conf /etc/sysctl.d/* | /usr/bin/awk '{print} END {if (NR != 0) print \"pass\" ; else print \"fail\"}'" expect : "^pass$" system : "Linux" type : CMD_EXEC description : "3.2.6 Ensure bogus ICMP responses are ignored - sysctl" info : "Setting icmp_ignore_bogus_error_responses to 1 prevents the kernel from logging bogus responses (RFC-1122 non-compliant) from broadcast reframes, keeping file systems from filling up with useless log messages. Rationale: Some routers (and some attackers) will send responses that violate RFC-1122 and attempt to fill up a log file system with many useless error messages." solution : "Run the following commands to restore the default parameters and set the active kernel parameters: # grep -Els \"^\s*net\.ipv4\.icmp_ignore_bogus_error_responses\s*=\s*0\" /etc/sysctl.conf /etc/sysctl.d/*.conf /usr/lib/sysctl.d/*.conf /run/sysctl.d/*.conf | while read filename; do sed -ri \"s/^\s*(net\.ipv4\.icmp_ignore_bogus_error_responses\s*)(=)(\s*\S+\b).*$/# *REMOVED* \1/\" $filename; done; sysctl -w net.ipv4.icmp_ignore_bogus_error_responses=1; sysctl -w net.ipv4.route.flush=1" reference : "800-171|3.13.1,800-53|SC-7,CSCv7|5.1,ITSG-33|SC-7,LEVEL|1S,NIAv2|AM38,NIAv2|SS13d,NIAv2|SS26" see_also : "https://workbench.cisecurity.org/files/2485" cmd : "/usr/sbin/sysctl net.ipv4.icmp_ignore_bogus_error_responses" expect : "^[\\s]*net\\.ipv4\\.icmp_ignore_bogus_error_responses[\\s]*=[\\s]*1[\\s]*$" system : "Linux" type : CMD_EXEC description : "3.2.6 Ensure bogus ICMP responses are ignored - /etc/sysctl.conf /etc/sysctl.d/*" info : "Setting icmp_ignore_bogus_error_responses to 1 prevents the kernel from logging bogus responses (RFC-1122 non-compliant) from broadcast reframes, keeping file systems from filling up with useless log messages. Rationale: Some routers (and some attackers) will send responses that violate RFC-1122 and attempt to fill up a log file system with many useless error messages." solution : "Run the following commands to restore the default parameters and set the active kernel parameters: # grep -Els \"^\s*net\.ipv4\.icmp_ignore_bogus_error_responses\s*=\s*0\" /etc/sysctl.conf /etc/sysctl.d/*.conf /usr/lib/sysctl.d/*.conf /run/sysctl.d/*.conf | while read filename; do sed -ri \"s/^\s*(net\.ipv4\.icmp_ignore_bogus_error_responses\s*)(=)(\s*\S+\b).*$/# *REMOVED* \1/\" $filename; done; sysctl -w net.ipv4.icmp_ignore_bogus_error_responses=1; sysctl -w net.ipv4.route.flush=1" reference : "800-171|3.13.1,800-53|SC-7,CSCv7|5.1,ITSG-33|SC-7,LEVEL|1S,NIAv2|AM38,NIAv2|SS13d,NIAv2|SS26" see_also : "https://workbench.cisecurity.org/files/2485" cmd : "/usr/bin/grep -s -E '^[[:space:]]*net\\.ipv4\\.icmp_ignore_bogus_error_responses[[:space:]]*=[[:space:]]*1[[:space:]]*$' /etc/sysctl.conf /etc/sysctl.d/* | /usr/bin/awk '{print} END {if (NR != 0) print \"pass\" ; else print \"fail\"}'" expect : "^pass$" system : "Linux" type : CMD_EXEC description : "3.2.7 Ensure Reverse Path Filtering is enabled - 'net.ipv4.conf.default.rp_filter = 1'" info : "Setting net.ipv4.conf.all.rp_filter and net.ipv4.conf.default.rp_filter to 1 forces the Linux kernel to utilize reverse path filtering on a received packet to determine if the packet was valid. Essentially, with reverse path filtering, if the return packet does not go out the same interface that the corresponding source packet came from, the packet is dropped (and logged if log_martians is set). Rationale: Setting these flags is a good way to deter attackers from sending your system bogus packets that cannot be responded to. One instance where this feature breaks down is if asymmetrical routing is employed. This would occur when using dynamic routing protocols (bgp, ospf, etc) on your system. If you are using asymmetrical routing on your system, you will not be able to enable this feature without breaking the routing." solution : "Run the following command to restore the default net.ipv4.conf.all.rp_filter = 1 parameter and set the active kernel parameter: # grep -Els \"^\s*net\.ipv4\.conf\.all\.rp_filter\s*=\s*0\" /etc/sysctl.conf /etc/sysctl.d/*.conf /usr/lib/sysctl.d/*.conf /run/sysctl.d/*.conf | while read filename; do sed -ri \"s/^\s*(net\.ipv4\.net.ipv4.conf\.all\.rp_filter\s*)(=)(\s*\S+\b).*$/# *REMOVED* \1/\" $filename; done; sysctl -w net.ipv4.conf.all.rp_filter=1; sysctl -w net.ipv4.route.flush=1 Set the following parameter in /etc/sysctl.conf or a /etc/sysctl.d/* file: net.ipv4.conf.default.rp_filter=1 Run the following commands to set the active kernel parameter: # sysctl -w net.ipv4.conf.default.rp_filter=1 # sysctl -w net.ipv4.route.flush=1" reference : "800-171|3.13.1,800-53|SC-7,CSCv7|5.1,ITSG-33|SC-7,LEVEL|1S,NIAv2|AM38,NIAv2|SS13d,NIAv2|SS26" see_also : "https://workbench.cisecurity.org/files/2485" cmd : "/usr/sbin/sysctl net.ipv4.conf.default.rp_filter" expect : "^[\\s]*net\\.ipv4\\.conf\\.default\\.rp_filter[\\s]*=[\\s]*1[\\s]*$" system : "Linux" type : CMD_EXEC description : "3.2.7 Ensure Reverse Path Filtering is enabled - 'net.ipv4.conf.all.rp_filter = 1'" info : "Setting net.ipv4.conf.all.rp_filter and net.ipv4.conf.default.rp_filter to 1 forces the Linux kernel to utilize reverse path filtering on a received packet to determine if the packet was valid. Essentially, with reverse path filtering, if the return packet does not go out the same interface that the corresponding source packet came from, the packet is dropped (and logged if log_martians is set). Rationale: Setting these flags is a good way to deter attackers from sending your system bogus packets that cannot be responded to. One instance where this feature breaks down is if asymmetrical routing is employed. This would occur when using dynamic routing protocols (bgp, ospf, etc) on your system. If you are using asymmetrical routing on your system, you will not be able to enable this feature without breaking the routing." solution : "Run the following command to restore the default net.ipv4.conf.all.rp_filter = 1 parameter and set the active kernel parameter: # grep -Els \"^\s*net\.ipv4\.conf\.all\.rp_filter\s*=\s*0\" /etc/sysctl.conf /etc/sysctl.d/*.conf /usr/lib/sysctl.d/*.conf /run/sysctl.d/*.conf | while read filename; do sed -ri \"s/^\s*(net\.ipv4\.net.ipv4.conf\.all\.rp_filter\s*)(=)(\s*\S+\b).*$/# *REMOVED* \1/\" $filename; done; sysctl -w net.ipv4.conf.all.rp_filter=1; sysctl -w net.ipv4.route.flush=1 Set the following parameter in /etc/sysctl.conf or a /etc/sysctl.d/* file: net.ipv4.conf.default.rp_filter=1 Run the following commands to set the active kernel parameter: # sysctl -w net.ipv4.conf.default.rp_filter=1 # sysctl -w net.ipv4.route.flush=1" reference : "800-171|3.13.1,800-53|SC-7,CSCv7|5.1,ITSG-33|SC-7,LEVEL|1S,NIAv2|AM38,NIAv2|SS13d,NIAv2|SS26" see_also : "https://workbench.cisecurity.org/files/2485" cmd : "/usr/sbin/sysctl net.ipv4.conf.all.rp_filter" expect : "^[\\s]*net\\.ipv4\\.conf\\.all\\.rp_filter[\\s]*=[\\s]*1[\\s]*$" system : "Linux" type : CMD_EXEC description : "3.2.7 Ensure Reverse Path Filtering is enabled - files 'net.ipv4.conf.default.rp_filter = 1'" info : "Setting net.ipv4.conf.all.rp_filter and net.ipv4.conf.default.rp_filter to 1 forces the Linux kernel to utilize reverse path filtering on a received packet to determine if the packet was valid. Essentially, with reverse path filtering, if the return packet does not go out the same interface that the corresponding source packet came from, the packet is dropped (and logged if log_martians is set). Rationale: Setting these flags is a good way to deter attackers from sending your system bogus packets that cannot be responded to. One instance where this feature breaks down is if asymmetrical routing is employed. This would occur when using dynamic routing protocols (bgp, ospf, etc) on your system. If you are using asymmetrical routing on your system, you will not be able to enable this feature without breaking the routing." solution : "Run the following command to restore the default net.ipv4.conf.all.rp_filter = 1 parameter and set the active kernel parameter: # grep -Els \"^\s*net\.ipv4\.conf\.all\.rp_filter\s*=\s*0\" /etc/sysctl.conf /etc/sysctl.d/*.conf /usr/lib/sysctl.d/*.conf /run/sysctl.d/*.conf | while read filename; do sed -ri \"s/^\s*(net\.ipv4\.net.ipv4.conf\.all\.rp_filter\s*)(=)(\s*\S+\b).*$/# *REMOVED* \1/\" $filename; done; sysctl -w net.ipv4.conf.all.rp_filter=1; sysctl -w net.ipv4.route.flush=1 Set the following parameter in /etc/sysctl.conf or a /etc/sysctl.d/* file: net.ipv4.conf.default.rp_filter=1 Run the following commands to set the active kernel parameter: # sysctl -w net.ipv4.conf.default.rp_filter=1 # sysctl -w net.ipv4.route.flush=1" reference : "800-171|3.13.1,800-53|SC-7,CSCv7|5.1,ITSG-33|SC-7,LEVEL|1S,NIAv2|AM38,NIAv2|SS13d,NIAv2|SS26" see_also : "https://workbench.cisecurity.org/files/2485" cmd : "/usr/bin/grep -s -E '^[[:space:]]*net\\.ipv4\\.conf\\.default\\.rp_filter[[:space:]]*=[[:space:]]*1[[:space:]]*$' /etc/sysctl.conf /etc/sysctl.d/* | /usr/bin/awk '{print} END {if (NR != 0) print \"pass\" ; else print \"fail\"}'" expect : "^pass$" system : "Linux" type : CMD_EXEC description : "3.2.7 Ensure Reverse Path Filtering is enabled - files 'net.ipv4.conf.all.rp_filter = 1'" info : "Setting net.ipv4.conf.all.rp_filter and net.ipv4.conf.default.rp_filter to 1 forces the Linux kernel to utilize reverse path filtering on a received packet to determine if the packet was valid. Essentially, with reverse path filtering, if the return packet does not go out the same interface that the corresponding source packet came from, the packet is dropped (and logged if log_martians is set). Rationale: Setting these flags is a good way to deter attackers from sending your system bogus packets that cannot be responded to. One instance where this feature breaks down is if asymmetrical routing is employed. This would occur when using dynamic routing protocols (bgp, ospf, etc) on your system. If you are using asymmetrical routing on your system, you will not be able to enable this feature without breaking the routing." solution : "Run the following command to restore the default net.ipv4.conf.all.rp_filter = 1 parameter and set the active kernel parameter: # grep -Els \"^\s*net\.ipv4\.conf\.all\.rp_filter\s*=\s*0\" /etc/sysctl.conf /etc/sysctl.d/*.conf /usr/lib/sysctl.d/*.conf /run/sysctl.d/*.conf | while read filename; do sed -ri \"s/^\s*(net\.ipv4\.net.ipv4.conf\.all\.rp_filter\s*)(=)(\s*\S+\b).*$/# *REMOVED* \1/\" $filename; done; sysctl -w net.ipv4.conf.all.rp_filter=1; sysctl -w net.ipv4.route.flush=1 Set the following parameter in /etc/sysctl.conf or a /etc/sysctl.d/* file: net.ipv4.conf.default.rp_filter=1 Run the following commands to set the active kernel parameter: # sysctl -w net.ipv4.conf.default.rp_filter=1 # sysctl -w net.ipv4.route.flush=1" reference : "800-171|3.13.1,800-53|SC-7,CSCv7|5.1,ITSG-33|SC-7,LEVEL|1S,NIAv2|AM38,NIAv2|SS13d,NIAv2|SS26" see_also : "https://workbench.cisecurity.org/files/2485" cmd : "/usr/bin/grep -s -E '^[[:space:]]*net\\.ipv4\\.conf\\.all\\.rp_filter[[:space:]]*=[[:space:]]*1[[:space:]]*$' /etc/sysctl.conf /etc/sysctl.d/* | /usr/bin/awk '{print} END {if (NR != 0) print \"pass\" ; else print \"fail\"}'" expect : "^pass$" system : "Linux" type : CMD_EXEC description : "3.2.8 Ensure TCP SYN Cookies is enabled - sysctl" info : "When tcp_syncookies is set, the kernel will handle TCP SYN packets normally until the half-open connection queue is full, at which time, the SYN cookie functionality kicks in. SYN cookies work by not using the SYN queue at all. Instead, the kernel simply replies to the SYN with a SYN|ACK, but will include a specially crafted TCP sequence number that encodes the source and destination IP address and port number and the time the packet was sent. A legitimate connection would send the ACK packet of the three way handshake with the specially crafted sequence number. This allows the system to verify that it has received a valid response to a SYN cookie and allow the connection, even though there is no corresponding SYN in the queue. Rationale: Attackers use SYN flood attacks to perform a denial of service attacked on a system by sending many SYN packets without completing the three way handshake. This will quickly use up slots in the kernel's half-open connection queue and prevent legitimate connections from succeeding. SYN cookies allow the system to keep accepting valid connections, even if under a denial of service attack." solution : "Run the following command to restore the default parameter and set the active kernel parameters: # grep -Els \"^\s*net\.ipv4\.tcp_syncookies\s*=\s*[02]*\" /etc/sysctl.conf /etc/sysctl.d/*.conf /usr/lib/sysctl.d/*.conf /run/sysctl.d/*.conf | while read filename; do sed -ri \"s/^\s*(net\.ipv4\.tcp_syncookies\s*)(=)(\s*\S+\b).*$/# *REMOVED* \1/\" $filename; done; sysctl -w net.ipv4.tcp_syncookies=1; sysctl -w net.ipv4.route.flush=1" reference : "800-171|3.13.1,800-53|SC-7,CSCv7|5.1,ITSG-33|SC-7,LEVEL|1S,NIAv2|AM38,NIAv2|SS13d,NIAv2|SS26" see_also : "https://workbench.cisecurity.org/files/2485" cmd : "/usr/sbin/sysctl net.ipv4.tcp_syncookies" expect : "^[\\s]*net\\.ipv4\\.tcp_syncookies[\\s]*=[\\s]*1[\\s]*$" system : "Linux" type : CMD_EXEC description : "3.2.8 Ensure TCP SYN Cookies is enabled - sysctl.conf sysctl.d" info : "When tcp_syncookies is set, the kernel will handle TCP SYN packets normally until the half-open connection queue is full, at which time, the SYN cookie functionality kicks in. SYN cookies work by not using the SYN queue at all. Instead, the kernel simply replies to the SYN with a SYN|ACK, but will include a specially crafted TCP sequence number that encodes the source and destination IP address and port number and the time the packet was sent. A legitimate connection would send the ACK packet of the three way handshake with the specially crafted sequence number. This allows the system to verify that it has received a valid response to a SYN cookie and allow the connection, even though there is no corresponding SYN in the queue. Rationale: Attackers use SYN flood attacks to perform a denial of service attacked on a system by sending many SYN packets without completing the three way handshake. This will quickly use up slots in the kernel's half-open connection queue and prevent legitimate connections from succeeding. SYN cookies allow the system to keep accepting valid connections, even if under a denial of service attack." solution : "Run the following command to restore the default parameter and set the active kernel parameters: # grep -Els \"^\s*net\.ipv4\.tcp_syncookies\s*=\s*[02]*\" /etc/sysctl.conf /etc/sysctl.d/*.conf /usr/lib/sysctl.d/*.conf /run/sysctl.d/*.conf | while read filename; do sed -ri \"s/^\s*(net\.ipv4\.tcp_syncookies\s*)(=)(\s*\S+\b).*$/# *REMOVED* \1/\" $filename; done; sysctl -w net.ipv4.tcp_syncookies=1; sysctl -w net.ipv4.route.flush=1" reference : "800-171|3.13.1,800-53|SC-7,CSCv7|5.1,ITSG-33|SC-7,LEVEL|1S,NIAv2|AM38,NIAv2|SS13d,NIAv2|SS26" see_also : "https://workbench.cisecurity.org/files/2485" cmd : "/usr/bin/grep -s -E '^[[:space:]]*net\\.ipv4\\.tcp_syncookies[[:space:]]*=[[:space:]]*1[[:space:]]*$' /etc/sysctl.conf /etc/sysctl.d/* | /usr/bin/awk '{print} END {if (NR != 0) print \"pass\" ; else print \"fail\"}'" expect : "^pass$" system : "Linux" type : CMD_EXEC description : "3.2.9 Ensure IPv6 router advertisements are not accepted - 'net.ipv6.conf.default.accept_ra = 0'" info : "This setting disables the system's ability to accept IPv6 router advertisements. Rationale: It is recommended that systems do not accept router advertisements as they could be tricked into routing traffic to compromised machines. Setting hard routes within the system (usually a single default route to a trusted router) protects the system from bad routes." solution : "Set the following parameters in /etc/sysctl.conf or a /etc/sysctl.d/* file: net.ipv6.conf.all.accept_ra = 0 net.ipv6.conf.default.accept_ra = 0 Run the following commands to set the active kernel parameters: # sysctl -w net.ipv6.conf.all.accept_ra=0 # sysctl -w net.ipv6.conf.default.accept_ra=0 # sysctl -w net.ipv6.route.flush=1" reference : "800-171|3.13.1,800-53|SC-7,CSCv7|5.1,ITSG-33|SC-7,LEVEL|1S,NIAv2|AM38,NIAv2|SS13d,NIAv2|SS26" see_also : "https://workbench.cisecurity.org/files/2485" cmd : "/usr/sbin/sysctl net.ipv6.conf.default.accept_ra" expect : "^[\\s]*net\\.ipv6\\.conf\\.default\\.accept_ra[\\s]*=[\\s]*0[\\s]*$" system : "Linux" type : CMD_EXEC description : "3.2.9 Ensure IPv6 router advertisements are not accepted - 'net.ipv6.conf.all.accept_ra = 0'" info : "This setting disables the system's ability to accept IPv6 router advertisements. Rationale: It is recommended that systems do not accept router advertisements as they could be tricked into routing traffic to compromised machines. Setting hard routes within the system (usually a single default route to a trusted router) protects the system from bad routes." solution : "Set the following parameters in /etc/sysctl.conf or a /etc/sysctl.d/* file: net.ipv6.conf.all.accept_ra = 0 net.ipv6.conf.default.accept_ra = 0 Run the following commands to set the active kernel parameters: # sysctl -w net.ipv6.conf.all.accept_ra=0 # sysctl -w net.ipv6.conf.default.accept_ra=0 # sysctl -w net.ipv6.route.flush=1" reference : "800-171|3.13.1,800-53|SC-7,CSCv7|5.1,ITSG-33|SC-7,LEVEL|1S,NIAv2|AM38,NIAv2|SS13d,NIAv2|SS26" see_also : "https://workbench.cisecurity.org/files/2485" cmd : "/usr/sbin/sysctl net.ipv6.conf.all.accept_ra" expect : "^[\\s]*net\\.ipv6\\.conf\\.all\\.accept_ra[\\s]*=[\\s]*0[\\s]*$" system : "Linux" type : RPM_CHECK description : "firewalld install check" rpm : "firewalld-0.0.0-0" operator : "gt" required : YES system : "Linux" type : RPM_CHECK description : "nftables install check" rpm : "nftables-0.0.0-0" operator : "gt" required : YES system : "Linux" type : RPM_CHECK description : "iptables install check" rpm : "iptables-0.0.0-0" operator : "gt" required : YES description : "3.4.1.1 Ensure a Firewall package is installed" info : "A Firewall package should be selected. Most firewall configuration utilities operate as a front end to nftables or iptables. Rationale: A Firewall package is required for firewall management and configuration." solution : "Run one of the following commands to install a Firewall package. For firewalld: # dnf install firewalld For nftables: # dnf install nftables For iptables: # dnf install iptables" reference : "CSCv7|9.4,LEVEL|1S" see_also : "https://workbench.cisecurity.org/files/2485" description : "3.4.1.1 Ensure a Firewall package is installed" info : "A Firewall package should be selected. Most firewall configuration utilities operate as a front end to nftables or iptables. Rationale: A Firewall package is required for firewall management and configuration." solution : "Run one of the following commands to install a Firewall package. For firewalld: # dnf install firewalld For nftables: # dnf install nftables For iptables: # dnf install iptables" reference : "CSCv7|9.4,LEVEL|1S" see_also : "https://workbench.cisecurity.org/files/2485" system : "Linux" type : CMD_EXEC description : "3.4.2.1 Ensure firewalld service is enabled and running - enabled" info : "Ensure that the firewalld service is enabled to protect your system Rationale: firewalld (Dynamic Firewall Manager) tool provides a dynamically managed firewall. The tool enables network/firewall zones to define the trust level of network connections and/or interfaces. It has support both for IPv4 and IPv6 firewall settings. Also, it supports Ethernet bridges and allow you to separate between runtime and permanent configuration options. Finally, it supports an interface for services or applications to add firewall rules directly" solution : "Run the following command to enable and start firewalld # systemctl --now enable firewalld Impact: Changing firewall settings while connected over network can result in being locked out of the system." reference : "800-171|3.13.1,800-53|SC-7,CIP|007-6-R1,CSCv7|9.4,ITSG-33|SC-7,LEVEL|1S,NIAv2|AM38,NIAv2|SS13d,NIAv2|SS26,PCI-DSSv3.1|2.2.2,PCI-DSSv3.1|2.2.3,PCI-DSSv3.2|2.2.2,PCI-DSSv3.2|2.2.3" see_also : "https://workbench.cisecurity.org/files/2485" cmd : "/usr/bin/systemctl is-enabled firewalld | /usr/bin/awk '{print} END {if(NR==0) print \"disabled\" }'" expect : "enabled" dont_echo_cmd : YES system : "Linux" type : CMD_EXEC description : "3.4.2.1 Ensure firewalld service is enabled and running - running" info : "Ensure that the firewalld service is enabled to protect your system Rationale: firewalld (Dynamic Firewall Manager) tool provides a dynamically managed firewall. The tool enables network/firewall zones to define the trust level of network connections and/or interfaces. It has support both for IPv4 and IPv6 firewall settings. Also, it supports Ethernet bridges and allow you to separate between runtime and permanent configuration options. Finally, it supports an interface for services or applications to add firewall rules directly" solution : "Run the following command to enable and start firewalld # systemctl --now enable firewalld Impact: Changing firewall settings while connected over network can result in being locked out of the system." reference : "800-171|3.13.1,800-53|SC-7,CSCv7|9.4,ITSG-33|SC-7,LEVEL|1S,NIAv2|AM38,NIAv2|SS13d,NIAv2|SS26" see_also : "https://workbench.cisecurity.org/files/2485" cmd : "/usr/bin/firewall-cmd --state | /usr/bin/awk '{print} END {if(NR==0) print \"not running\" }'" expect : "^running$" dont_echo_cmd : YES system : "Linux" type : CMD_EXEC description : "3.4.2.2 Ensure iptables is not enabled - inactive" info : "IPtables is an application that allows a system administrator to configure the IPv4 and IPv6 tables, chains and rules provided by the Linux kernel firewall. IPtables is installed as a dependency with firewalld. Rationale: Running firewalld and IPtables concurrently may lead to conflict, therefore IPtables should be stopped and masked when using firewalld." solution : "Run the following command to stop and mask iptables systemctl --now mask iptables" reference : "800-171|3.4.6,800-171|3.4.7,800-53|CM-7,CN-L3|7.1.3.5(c),CN-L3|7.1.3.7(d),CSCv7|9.4,CSF|PR.IP-1,CSF|PR.PT-3,ITSG-33|CM-7,LEVEL|1S,NIAv2|SS13b,NIAv2|SS14a,NIAv2|SS14c,NIAv2|SS15a,SWIFT-CSCv1|2.3" see_also : "https://workbench.cisecurity.org/files/2485" cmd : "/usr/bin/systemctl is-active iptables | /usr/bin/awk \'{print} END { if(NR==0) print \"inactive\" }\'" expect : "inactive" dont_echo_cmd : YES system : "Linux" type : CMD_EXEC description : "3.4.2.2 Ensure iptables is not enabled - disabled" info : "IPtables is an application that allows a system administrator to configure the IPv4 and IPv6 tables, chains and rules provided by the Linux kernel firewall. IPtables is installed as a dependency with firewalld. Rationale: Running firewalld and IPtables concurrently may lead to conflict, therefore IPtables should be stopped and masked when using firewalld." solution : "Run the following command to stop and mask iptables systemctl --now mask iptables" reference : "CIP|007-6-R1,CSCv7|9.4,LEVEL|1S,PCI-DSSv3.1|2.2.2,PCI-DSSv3.1|2.2.3,PCI-DSSv3.2|2.2.2,PCI-DSSv3.2|2.2.3" see_also : "https://workbench.cisecurity.org/files/2485" cmd : "/usr/bin/systemctl is-enabled iptables | /usr/bin/awk \'{print} END { if(NR==0) print \"disabled\" }\'" expect : "disabled" dont_echo_cmd : YES system : "Linux" type : CMD_EXEC description : "3.4.2.3 Ensure nftables is not enabled - disabled" info : "nftables is a subsystem of the Linux kernel providing filtering and classification of network packets/datagrams/frames and is the successor to iptables. nftables are installed as a dependency with firewalld. Rationale: Running firewalld and nftables concurrently may lead to conflict, therefore nftables should be stopped and masked when using firewalld." solution : "Run the following command to mask and stop nftables systemctl --now mask nftables Notes: firewalld is dependent on nftables. nftables should be stopped and disabled." reference : "CIP|007-6-R1,CSCv7|9.4,LEVEL|1S,PCI-DSSv3.1|2.2.2,PCI-DSSv3.1|2.2.3,PCI-DSSv3.2|2.2.2,PCI-DSSv3.2|2.2.3" see_also : "https://workbench.cisecurity.org/files/2485" cmd : "/usr/bin/systemctl is-enabled nftables | /usr/bin/awk \'{print} END { if(NR==0) print \"disabled\" }\'" expect : "disabled|masked" dont_echo_cmd : YES system : "Linux" type : CMD_EXEC description : "3.4.2.3 Ensure nftables is not enabled - inactive" info : "nftables is a subsystem of the Linux kernel providing filtering and classification of network packets/datagrams/frames and is the successor to iptables. nftables are installed as a dependency with firewalld. Rationale: Running firewalld and nftables concurrently may lead to conflict, therefore nftables should be stopped and masked when using firewalld." solution : "Run the following command to mask and stop nftables systemctl --now mask nftables Notes: firewalld is dependent on nftables. nftables should be stopped and disabled." reference : "800-171|3.4.6,800-171|3.4.7,800-53|CM-7,CN-L3|7.1.3.5(c),CN-L3|7.1.3.7(d),CSCv7|9.4,CSF|PR.IP-1,CSF|PR.PT-3,ITSG-33|CM-7,LEVEL|1S,NIAv2|SS13b,NIAv2|SS14a,NIAv2|SS14c,NIAv2|SS15a,SWIFT-CSCv1|2.3" see_also : "https://workbench.cisecurity.org/files/2485" cmd : "/usr/bin/systemctl is-active nftables | /usr/bin/awk \'{print} END { if(NR==0) print \"inactive\" }\'" expect : "inactive" dont_echo_cmd : YES system : "Linux" type : CMD_EXEC description : "3.4.2.4 Ensure default zone is set" info : "A firewall zone defines the trust level for a connection, interface or source address binding. This is a one to many relation, which means that a connection, interface or source can only be part of one zone, but a zone can be used for many network connections, interfaces and sources. The default zone is the zone that is used for everything that is not explicitely bound/assigned to another zone. That means that if there is no zone assigned to a connection, interface or source, only the default zone is used. The default zone is not always listed as being used for an interface or source as it will be used for it either way. This depends on the manager of the interfaces. Connections handled by NetworkManager are listed as NetworkManager requests to add the zone binding for the interface used by the connection. Also interfaces under control of the network service are listed also because the service requests it. Rationale: Because the default zone is the zone that is used for everything that is not explicitly bound/assigned to another zone, it is important for the default zone to set NOTE: Nessus has provided the target output to assist in reviewing the benchmark to ensure target compliance." solution : "Run the following command to set the default zone: # firewall-cmd --set-default-zone= Example: # firewall-cmd --set-default-zone=public" reference : "800-171|3.13.1,800-171|3.13.5,800-53|SC-7,CSCv7|9.4,CSF|DE.CM-1,CSF|PR.AC-5,CSF|PR.DS-5,CSF|PR.PT-4,ITSG-33|SC-7,LEVEL|1S,NESA|T4.5.4,NIAv2|GS1,NIAv2|GS2a,NIAv2|GS2b" see_also : "https://workbench.cisecurity.org/files/2485" cmd : "/usr/bin/firewall-cmd --get-default-zone" expect : "" severity : MEDIUM system : "Linux" type : CMD_EXEC description : "3.4.2.5 Ensure network interfaces are assigned to appropriate zone" info : "firewall zones define the trust level of network connections or interfaces. Rationale: A network interface not assigned to the appropriate zone can allow unexpected or undesired network traffic to be accepted on the interface NOTE: Nessus has provided the target output to assist in reviewing the benchmark to ensure target compliance." solution : "Run the following command to assign an interface to the approprate zone. # firewall-cmd --zone= --change-interface= Example: # firewall-cmd --zone=customezone --change-interface=eth0 Impact: Changing firewall settings while connected over network can result in being locked out of the system. Default Value: If the zone is not set in the configuration file, the interfaces will be assigned to the default zone defined in the firewalld configuration" reference : "800-171|3.13.1,800-171|3.13.5,800-53|SC-7,CSCv7|9.4,CSF|DE.CM-1,CSF|PR.AC-5,CSF|PR.DS-5,CSF|PR.PT-4,ITSG-33|SC-7,LEVEL|1NS,NESA|T4.5.4,NIAv2|GS1,NIAv2|GS2a,NIAv2|GS2b" see_also : "https://workbench.cisecurity.org/files/2485" cmd : "/usr/bin/nmcli -t connection show | /usr/bin/awk -F: \'{if($4){print $4}}\' | while read INT; do /usr/bin/firewall-cmd --get-active-zones | /usr/bin/grep -B1 $INT; done" expect : "" severity : MEDIUM system : "Linux" type : CMD_EXEC description : "3.4.2.6 Ensure unnecessary services and ports are not accepted" info : "Services and ports can be accepted or explicitly rejected or dropped by a zone. For every zone, you can set a default behavior that handles incoming traffic that is not further specified. Such behavior is defined by setting the target of the zone. There are three options - default, ACCEPT, REJECT, and DROP. By setting the target to ACCEPT, you accept all incoming packets except those disabled by a specific rule. If you set the target to REJECT or DROP, you disable all incoming packets except those that you have allowed in specific rules. When packets are rejected, the source machine is informed about the rejection, while there is no information sent when the packets are dropped. Rationale: To reduce the attack surface of a system, all services and ports should be blocked unless required NOTE: Nessus has provided the target output to assist in reviewing the benchmark to ensure target compliance." solution : "Run the following command to remove an unnecessary service: # firewall-cmd --remove-service= Example: #firewall-cmd --remove-service=cockpit Run the following command to remove an unnecessary port: # firewall-cmd --remove-port=/ Example: # firewall-cmd --remove-port=25/tcp Run the following command to make new settings persistent: # firewall-cmd --runtime-to-permanent" reference : "800-171|3.13.1,800-171|3.13.5,800-53|SC-7,CSCv7|9.4,CSF|DE.CM-1,CSF|PR.AC-5,CSF|PR.DS-5,CSF|PR.PT-4,ITSG-33|SC-7,LEVEL|1NS,NESA|T4.5.4,NIAv2|GS1,NIAv2|GS2a,NIAv2|GS2b" see_also : "https://workbench.cisecurity.org/files/2485" cmd : "/usr/bin/firewall-cmd --get-active-zones | /usr/bin/awk '!/:/ {print $1}' | while read ZN; do /usr/bin/firewall-cmd --list-all --zone=$ZN; done" expect : "" severity : MEDIUM system : "Linux" type : CMD_EXEC description : "3.4.3.1 Ensure iptables are flushed - ipv4" info : "nftables is a replacement for iptables, ip6tables, ebtables and arptables Rationale: It is possible to mix iptables and nftables. However, this increases complexity and also the chance to introduce errors. For simplicity flush out all iptables rules, and ensure it is not loaded NOTE: Nessus has provided the target output to assist in reviewing the benchmark to ensure target compliance." solution : "Run the following commands to flush iptables: For iptables: # iptables -F For ip6tables # ip6tables -F" reference : "800-171|3.4.6,800-171|3.4.7,800-53|CM-7,CN-L3|7.1.3.5(c),CN-L3|7.1.3.7(d),CSCv7|9.4,CSF|PR.IP-1,CSF|PR.PT-3,ITSG-33|CM-7,LEVEL|1NS,NIAv2|SS13b,NIAv2|SS14a,NIAv2|SS14c,NIAv2|SS15a,SWIFT-CSCv1|2.3" see_also : "https://workbench.cisecurity.org/files/2485" cmd : "/usr/sbin/iptables -L" expect : "" severity : MEDIUM system : "Linux" type : CMD_EXEC description : "3.4.3.1 Ensure iptables are flushed - ipv6" info : "nftables is a replacement for iptables, ip6tables, ebtables and arptables Rationale: It is possible to mix iptables and nftables. However, this increases complexity and also the chance to introduce errors. For simplicity flush out all iptables rules, and ensure it is not loaded NOTE: Nessus has provided the target output to assist in reviewing the benchmark to ensure target compliance." solution : "Run the following commands to flush iptables: For iptables: # iptables -F For ip6tables # ip6tables -F" reference : "800-171|3.4.6,800-171|3.4.7,800-53|CM-7,CN-L3|7.1.3.5(c),CN-L3|7.1.3.7(d),CSCv7|9.4,CSF|PR.IP-1,CSF|PR.PT-3,ITSG-33|CM-7,LEVEL|1NS,NIAv2|SS13b,NIAv2|SS14a,NIAv2|SS14c,NIAv2|SS15a,SWIFT-CSCv1|2.3" see_also : "https://workbench.cisecurity.org/files/2485" cmd : "/usr/sbin/ip6tables -L" expect : "" severity : MEDIUM system : "Linux" type : CMD_EXEC description : "3.4.3.2 Ensure a table exists" info : "Tables hold chains. Each table only has one address family and only applies to packets of this family. Tables can have one of five families. Rationale: nftables doesn't have any default tables. Without a table being build, nftables will not filter network traffic." solution : "Run the following command to create a table in nftables # nft create table inet Example: # nft create table inet filter Impact: Adding rules to a running nftables can cause loss of connectivity to the system" reference : "800-171|3.13.1,800-53|SC-7,CSCv7|9.4,CSF|PR.AC-5,CSF|PR.PT-4,ITSG-33|SC-7,LEVEL|1S,NESA|T4.5.3,NIAv2|NS5c,NIAv2|NS6a" see_also : "https://workbench.cisecurity.org/files/2485" cmd : "/usr/sbin/nft list tables | /usr/bin/awk '{print} END {if (NR != 0) print \"pass\" ; else print \"fail\"}'" expect : "^pass$" system : "Linux" type : CMD_EXEC description : "3.4.3.3 Ensure base chains exist - 'hook input'" info : "Chains are containers for rules. They exist in two kinds, base chains and regular chains. A base chain is an entry point for packets from the networking stack, a regular chain may be used as jump target and is used for better rule organization. Rationale: If a base chain doesn't exist with a hook for input, forward, and delete, packets that would flow through those chains will not be touched by nftables." solution : "Run the following command to create the base chains: # nft create chain inet
{ type filter hook <(input|forward|output)> priority 0 \; } Example: # nft create chain inet filter input { type filter hook input priority 0 \; } # nft create chain inet filter forward { type filter hook forward priority 0 \; } # nft create chain inet filter output { type filter hook output priority 0 \; } Impact: if configuring nftables over ssh, creating a base chain with a policy of drop will cause loss of connectivity. Ensure that a rule allowing ssh has been added to the base chain prior to setting the base chain's policy to drop" reference : "800-171|3.13.1,800-53|SC-7,CSCv7|9.4,CSF|PR.AC-5,CSF|PR.PT-4,ITSG-33|SC-7,LEVEL|1S,NESA|T4.5.3,NIAv2|NS5c,NIAv2|NS6a" see_also : "https://workbench.cisecurity.org/files/2485" cmd : "/usr/sbin/nft list ruleset | /usr/bin/grep 'hook input'" expect : "type[\\s]+filter[\\s]+hook[\\s]+input[\\s]+priority[\\s]+0;" system : "Linux" type : CMD_EXEC description : "3.4.3.3 Ensure base chains exist - 'hook forward'" info : "Chains are containers for rules. They exist in two kinds, base chains and regular chains. A base chain is an entry point for packets from the networking stack, a regular chain may be used as jump target and is used for better rule organization. Rationale: If a base chain doesn't exist with a hook for input, forward, and delete, packets that would flow through those chains will not be touched by nftables." solution : "Run the following command to create the base chains: # nft create chain inet
{ type filter hook <(input|forward|output)> priority 0 \; } Example: # nft create chain inet filter input { type filter hook input priority 0 \; } # nft create chain inet filter forward { type filter hook forward priority 0 \; } # nft create chain inet filter output { type filter hook output priority 0 \; } Impact: if configuring nftables over ssh, creating a base chain with a policy of drop will cause loss of connectivity. Ensure that a rule allowing ssh has been added to the base chain prior to setting the base chain's policy to drop" reference : "800-171|3.13.1,800-53|SC-7,CSCv7|9.4,CSF|PR.AC-5,CSF|PR.PT-4,ITSG-33|SC-7,LEVEL|1S,NESA|T4.5.3,NIAv2|NS5c,NIAv2|NS6a" see_also : "https://workbench.cisecurity.org/files/2485" cmd : "/usr/sbin/nft list ruleset | /usr/bin/grep 'hook forward'" expect : "type[\\s]+filter[\\s]+hook[\\s]+forward[\\s]+priority[\\s]+0;" system : "Linux" type : CMD_EXEC description : "3.4.3.3 Ensure base chains exist - 'hook output'" info : "Chains are containers for rules. They exist in two kinds, base chains and regular chains. A base chain is an entry point for packets from the networking stack, a regular chain may be used as jump target and is used for better rule organization. Rationale: If a base chain doesn't exist with a hook for input, forward, and delete, packets that would flow through those chains will not be touched by nftables." solution : "Run the following command to create the base chains: # nft create chain inet
{ type filter hook <(input|forward|output)> priority 0 \; } Example: # nft create chain inet filter input { type filter hook input priority 0 \; } # nft create chain inet filter forward { type filter hook forward priority 0 \; } # nft create chain inet filter output { type filter hook output priority 0 \; } Impact: if configuring nftables over ssh, creating a base chain with a policy of drop will cause loss of connectivity. Ensure that a rule allowing ssh has been added to the base chain prior to setting the base chain's policy to drop" reference : "800-171|3.13.1,800-53|SC-7,CSCv7|9.4,CSF|PR.AC-5,CSF|PR.PT-4,ITSG-33|SC-7,LEVEL|1S,NESA|T4.5.3,NIAv2|NS5c,NIAv2|NS6a" see_also : "https://workbench.cisecurity.org/files/2485" cmd : "/usr/sbin/nft list ruleset | /usr/bin/grep 'hook output'" expect : "type[\\s]+filter[\\s]+hook[\\s]+output[\\s]+priority[\\s]+0;" system : "Linux" type : CMD_EXEC description : "3.4.3.4 Ensure loopback traffic is configured" info : "Configure the loopback interface to accept traffic. Configure all other interfaces to deny traffic to the loopback network Rationale: Loopback traffic is generated between processes on machine and is typically critical to operation of the system. The loopback interface is the only place that loopback network traffic should be seen, all other interfaces should ignore traffic on this network as an anti-spoofing measure. NOTE: Nessus has provided the target output to assist in reviewing the benchmark to ensure target compliance." solution : "Run the following commands to implement the loopback rules: # nft add rule inet filter input iif lo accept # nft create rule inet filter input ip saddr 127.0.0.0/8 counter drop # nft add rule inet filter input ip6 saddr ::1 counter drop" reference : "800-171|3.13.1,800-53|SC-7,CSCv7|19.4,CSCv7|9.4,ITSG-33|SC-7,LEVEL|1S,NIAv2|AM38,NIAv2|SS13d,NIAv2|SS26" see_also : "https://workbench.cisecurity.org/files/2485" cmd : "/usr/sbin/iptables -L INPUT -v -n; /usr/sbin/iptables -L OUTPUT -v -n" expect : "ManualReviewRequired" severity : MEDIUM system : "Linux" type : CMD_EXEC description : "3.4.3.5 Ensure outbound and established connections are configured" info : "Configure the firewall rules for new outbound, and established connections Rationale: If rules are not in place for new outbound, and established connections all packets will be dropped by the default policy preventing network usage. NOTE: Nessus has provided the target output to assist in reviewing the benchmark to ensure target compliance." solution : "Configure nftables in accordance with site policy. The following commands will implement a policy to allow all outbound connections and all established connections: # nft add rule inet filter input ip protocol tcp ct state established accept # nft add rule inet filter input ip protocol udp ct state established accept # nft add rule inet filter input ip protocol icmp ct state established accept # nft add rule inet filter output ip protocol tcp ct state new,related,established accept # nft add rule inet filter output ip protocol udp ct state new,related,established accept # nft add rule inet filter output ip protocol icmp ct state new,related,established accept" reference : "800-171|3.13.1,800-53|SC-7,CSCv7|9.4,ITSG-33|SC-7,LEVEL|1NS,NIAv2|AM38,NIAv2|SS13d,NIAv2|SS26" see_also : "https://workbench.cisecurity.org/files/2485" cmd : "/usr/sbin/iptables -L -v -n" expect : "ManualReviewRequired" severity : MEDIUM system : "Linux" type : CMD_EXEC description : "3.4.3.6 Ensure default deny firewall policy - Chain FORWARD" info : "Base chain policy is the default verdict that will be applied to packets reaching the end of the chain. Rationale: There are two policies: accept (Default) and drop. If the policy is set to accept, the firewall will accept any packet that is not configured to be denied and the packet will continue transversing the network stack. It is easier to white list acceptable usage than to black list unacceptable usage." solution : "Run the following command for the base chains with the input, forward, and output hooks to implement a default DROP policy: # nft chain
{ policy drop \; } Example: # nft chain inet filter input { policy drop \; } # nft chain inet filter forward { policy drop \; } # nft chain inet filter output { policy drop \; } Impact: if configuring nftables over ssh, creating a base chain with a policy of drop will cause loss of connectivity. Ensure that a rule allowing ssh has been added to the base chain prior to setting the base chain's policy to drop Default Value: accept" reference : "800-171|3.13.1,800-53|SC-7,CSCv7|9.4,ITSG-33|SC-7,LEVEL|1S,NIAv2|AM38,NIAv2|SS13d,NIAv2|SS26" see_also : "https://workbench.cisecurity.org/files/2485" cmd : "/usr/sbin/iptables --list | /usr/bin/grep 'Chain FORWARD'" regex : "^Chain FORWARD \\(policy (DROP|REJECT)\\)" expect : "^Chain FORWARD \\(policy (DROP|REJECT)\\)" system : "Linux" type : CMD_EXEC description : "3.4.3.6 Ensure default deny firewall policy - Chain OUTPUT" info : "Base chain policy is the default verdict that will be applied to packets reaching the end of the chain. Rationale: There are two policies: accept (Default) and drop. If the policy is set to accept, the firewall will accept any packet that is not configured to be denied and the packet will continue transversing the network stack. It is easier to white list acceptable usage than to black list unacceptable usage." solution : "Run the following command for the base chains with the input, forward, and output hooks to implement a default DROP policy: # nft chain
{ policy drop \; } Example: # nft chain inet filter input { policy drop \; } # nft chain inet filter forward { policy drop \; } # nft chain inet filter output { policy drop \; } Impact: if configuring nftables over ssh, creating a base chain with a policy of drop will cause loss of connectivity. Ensure that a rule allowing ssh has been added to the base chain prior to setting the base chain's policy to drop Default Value: accept" reference : "800-171|3.13.1,800-53|SC-7,CSCv7|9.4,ITSG-33|SC-7,LEVEL|1S,NIAv2|AM38,NIAv2|SS13d,NIAv2|SS26" see_also : "https://workbench.cisecurity.org/files/2485" cmd : "/usr/sbin/iptables --list | /usr/bin/grep 'Chain OUTPUT'" regex : "^Chain OUTPUT \\(policy (DROP|REJECT)\\)" expect : "^Chain OUTPUT \\(policy (DROP|REJECT)\\)" system : "Linux" type : CMD_EXEC description : "3.4.3.6 Ensure default deny firewall policy - Chain INPUT" info : "Base chain policy is the default verdict that will be applied to packets reaching the end of the chain. Rationale: There are two policies: accept (Default) and drop. If the policy is set to accept, the firewall will accept any packet that is not configured to be denied and the packet will continue transversing the network stack. It is easier to white list acceptable usage than to black list unacceptable usage." solution : "Run the following command for the base chains with the input, forward, and output hooks to implement a default DROP policy: # nft chain
{ policy drop \; } Example: # nft chain inet filter input { policy drop \; } # nft chain inet filter forward { policy drop \; } # nft chain inet filter output { policy drop \; } Impact: if configuring nftables over ssh, creating a base chain with a policy of drop will cause loss of connectivity. Ensure that a rule allowing ssh has been added to the base chain prior to setting the base chain's policy to drop Default Value: accept" reference : "800-171|3.13.1,800-53|SC-7,CSCv7|9.4,ITSG-33|SC-7,LEVEL|1S,NIAv2|AM38,NIAv2|SS13d,NIAv2|SS26" see_also : "https://workbench.cisecurity.org/files/2485" cmd : "/usr/sbin/iptables --list | /usr/bin/grep 'Chain INPUT'" regex : "^Chain INPUT \\(policy (DROP|REJECT)\\)" expect : "^Chain INPUT \\(policy (DROP|REJECT)\\)" system : "Linux" type : CMD_EXEC description : "3.4.3.7 Ensure nftables service is enabled" info : "The nftables service allows for the loading of nftables rulesets during boot, or starting of the nftables service Rationale: The nftables service restores the nftables rules from the rules files referenced in the /etc/sysconfig/nftables.conf file durring boot or the starting of the nftables service" solution : "Run the following command to enable the nftables service: # systemctl --now enable nftables" reference : "CIP|007-6-R1,CSCv7|9.4,LEVEL|1S,PCI-DSSv3.1|2.2.2,PCI-DSSv3.1|2.2.3,PCI-DSSv3.2|2.2.2,PCI-DSSv3.2|2.2.3" see_also : "https://workbench.cisecurity.org/files/2485" cmd : "/usr/bin/systemctl is-enabled nftables | /usr/bin/awk '{print} END {if(NR==0) print \"disabled\" }'" expect : "enabled" dont_echo_cmd : YES system : "Linux" type : CMD_EXEC description : "3.4.3.8 Ensure nftables rules are permanent" info : "nftables is a subsystem of the Linux kernel providing filtering and classification of network packets/datagrams/frames. The nftables service reads the /etc/sysconfig/nftables.conf file for a nftables file or files to include in the nftables ruleset. A nftables ruleset containing the input, forward, and output base chains allow network traffic to be filtered. Rationale: Changes made to nftables ruleset only affect the live system, you will also need to configure the nftables ruleset to apply on boot NOTE: Nessus has provided the target output to assist in reviewing the benchmark to ensure target compliance." solution : "Edit the /etc/sysconfig/nftables.conf file and un-comment or add a line with include for each nftables file you want included in the nftables ruleset on boot example: # vi /etc/sysconfig/nftables.conf Add the line: include \"/etc/nftables/nftables.rules\"" reference : "800-171|3.1.1,800-171|3.1.2,800-53|AC-3,CSCv7|9.4,CSF|PR.AC-4,CSF|PR.PT-3,ITSG-33|AC-3,LEVEL|1S,NESA|T5.5.4,NESA|T7.5.3" see_also : "https://workbench.cisecurity.org/files/2485" cmd : "/usr/bin/cat /etc/sysconfig/nftables.conf" expect : "" severity : MEDIUM system : "Linux" type : CMD_EXEC description : "3.4.4.1.1 Ensure default deny firewall policy - Chain FORWARD" info : "A default deny all policy on connections ensures that any unconfigured network usage will be rejected. Rationale: With a default accept policy the firewall will accept any packet that is not configured to be denied. It is easier to white list acceptable usage than to black list unacceptable usage." solution : "Run the following commands to implement a default DROP policy: # iptables -P INPUT DROP # iptables -P OUTPUT DROP # iptables -P FORWARD DROP Notes: Changing firewall settings while connected over network can result in being locked out of the system. Remediation will only affect the active system firewall, be sure to configure the default policy in your firewall management to apply on boot as well." reference : "800-171|3.13.1,800-53|SC-7,CSCv7|9.4,ITSG-33|SC-7,LEVEL|1S,NIAv2|AM38,NIAv2|SS13d,NIAv2|SS26" see_also : "https://workbench.cisecurity.org/files/2485" cmd : "/usr/sbin/iptables --list | /usr/bin/grep 'Chain FORWARD'" regex : "^Chain FORWARD \\(policy (DROP|REJECT)\\)" expect : "^Chain FORWARD \\(policy (DROP|REJECT)\\)" system : "Linux" type : CMD_EXEC description : "3.4.4.1.1 Ensure default deny firewall policy - Chain OUTPUT" info : "A default deny all policy on connections ensures that any unconfigured network usage will be rejected. Rationale: With a default accept policy the firewall will accept any packet that is not configured to be denied. It is easier to white list acceptable usage than to black list unacceptable usage." solution : "Run the following commands to implement a default DROP policy: # iptables -P INPUT DROP # iptables -P OUTPUT DROP # iptables -P FORWARD DROP Notes: Changing firewall settings while connected over network can result in being locked out of the system. Remediation will only affect the active system firewall, be sure to configure the default policy in your firewall management to apply on boot as well." reference : "800-171|3.13.1,800-53|SC-7,CSCv7|9.4,ITSG-33|SC-7,LEVEL|1S,NIAv2|AM38,NIAv2|SS13d,NIAv2|SS26" see_also : "https://workbench.cisecurity.org/files/2485" cmd : "/usr/sbin/iptables --list | /usr/bin/grep 'Chain OUTPUT'" regex : "^Chain OUTPUT \\(policy (DROP|REJECT)\\)" expect : "^Chain OUTPUT \\(policy (DROP|REJECT)\\)" system : "Linux" type : CMD_EXEC description : "3.4.4.1.1 Ensure default deny firewall policy - Chain INPUT" info : "A default deny all policy on connections ensures that any unconfigured network usage will be rejected. Rationale: With a default accept policy the firewall will accept any packet that is not configured to be denied. It is easier to white list acceptable usage than to black list unacceptable usage." solution : "Run the following commands to implement a default DROP policy: # iptables -P INPUT DROP # iptables -P OUTPUT DROP # iptables -P FORWARD DROP Notes: Changing firewall settings while connected over network can result in being locked out of the system. Remediation will only affect the active system firewall, be sure to configure the default policy in your firewall management to apply on boot as well." reference : "800-171|3.13.1,800-53|SC-7,CSCv7|9.4,ITSG-33|SC-7,LEVEL|1S,NIAv2|AM38,NIAv2|SS13d,NIAv2|SS26" see_also : "https://workbench.cisecurity.org/files/2485" cmd : "/usr/sbin/iptables --list | /usr/bin/grep 'Chain INPUT'" regex : "^Chain INPUT \\(policy (DROP|REJECT)\\)" expect : "^Chain INPUT \\(policy (DROP|REJECT)\\)" system : "Linux" type : CMD_EXEC description : "3.4.4.1.2 Ensure loopback traffic is configured" info : "Configure the loopback interface to accept traffic. Configure all other interfaces to deny traffic to the loopback network (127.0.0.0/8). Rationale: Loopback traffic is generated between processes on machine and is typically critical to operation of the system. The loopback interface is the only place that loopback network (127.0.0.0/8) traffic should be seen, all other interfaces should ignore traffic on this network as an anti-spoofing measure. NOTE: Nessus has provided the target output to assist in reviewing the benchmark to ensure target compliance." solution : "Run the following commands to implement the loopback rules: # iptables -A INPUT -i lo -j ACCEPT # iptables -A OUTPUT -o lo -j ACCEPT # iptables -A INPUT -s 127.0.0.0/8 -j DROP Notes: Changing firewall settings while connected over network can result in being locked out of the system. Remediation will only affect the active system firewall, be sure to configure the default policy in your firewall management to apply on boot as well." reference : "800-171|3.13.1,800-53|SC-7,CSCv7|9.4,ITSG-33|SC-7,LEVEL|1S,NIAv2|AM38,NIAv2|SS13d,NIAv2|SS26" see_also : "https://workbench.cisecurity.org/files/2485" cmd : "/usr/sbin/iptables -L INPUT -v -n; /usr/sbin/iptables -L OUTPUT -v -n" expect : "ManualReviewRequired" severity : MEDIUM system : "Linux" type : CMD_EXEC description : "3.4.4.1.3 Ensure outbound and established connections are configured" info : "Configure the firewall rules for new outbound, and established connections. Rationale: If rules are not in place for new outbound, and established connections all packets will be dropped by the default policy preventing network usage. NOTE: Nessus has provided the target output to assist in reviewing the benchmark to ensure target compliance." solution : "Configure iptables in accordance with site policy. The following commands will implement a policy to allow all outbound connections and all established connections: # iptables -A OUTPUT -p tcp -m state --state NEW,ESTABLISHED -j ACCEPT # iptables -A OUTPUT -p udp -m state --state NEW,ESTABLISHED -j ACCEPT # iptables -A OUTPUT -p icmp -m state --state NEW,ESTABLISHED -j ACCEPT # iptables -A INPUT -p tcp -m state --state ESTABLISHED -j ACCEPT # iptables -A INPUT -p udp -m state --state ESTABLISHED -j ACCEPT # iptables -A INPUT -p icmp -m state --state ESTABLISHED -j ACCEPT Notes: Changing firewall settings while connected over network can result in being locked out of the system. Remediation will only affect the active system firewall, be sure to configure the default policy in your firewall management to apply on boot as well." reference : "800-171|3.13.1,800-53|SC-7,CSCv7|9.4,ITSG-33|SC-7,LEVEL|1NS,NIAv2|AM38,NIAv2|SS13d,NIAv2|SS26" see_also : "https://workbench.cisecurity.org/files/2485" cmd : "/usr/sbin/iptables -L -v -n" expect : "ManualReviewRequired" severity : MEDIUM system : "Linux" type : CMD_EXEC description : "3.4.4.1.4 Ensure firewall rules exist for all open ports" info : "Any ports that have been opened on non-loopback addresses need firewall rules to govern traffic. Rationale: Without a firewall rule configured for open ports default firewall policy will drop all packets to these ports. NOTE: Nessus has provided the target output to assist in reviewing the benchmark to ensure target compliance." solution : "For each port identified in the audit which does not have a firewall rule establish a proper rule for accepting inbound connections: # iptables -A INPUT -p --dport -m state --state NEW -j ACCEPT Notes: Changing firewall settings while connected over network can result in being locked out of the system. Remediation will only affect the active system firewall, be sure to configure the default policy in your firewall management to apply on boot as well. The remediation command opens up the port to traffic from all sources. Consult iptables documentation and set any restrictions in compliance with site policy." reference : "800-171|3.13.1,800-53|SC-7,CSCv7|9.2,CSCv7|9.4,ITSG-33|SC-7,LEVEL|1S,NIAv2|AM38,NIAv2|SS13d,NIAv2|SS26" see_also : "https://workbench.cisecurity.org/files/2485" cmd : "/usr/bin/netstat -ln; /usr/sbin/iptables -L INPUT -v -n" expect : "ManualReviewRequired" severity : MEDIUM system : "Linux" type : CMD_EXEC description : "3.4.4.2.1 Ensure IPv6 default deny firewall policy - 'Chain INPUT'" info : "A default deny all policy on connections ensures that any unconfigured network usage will be rejected. Rationale: With a default accept policy the firewall will accept any packet that is not configured to be denied. It is easier to white list acceptable usage than to black list unacceptable usage." solution : "Run the following commands to implement a default DROP policy: # ip6tables -P INPUT DROP # ip6tables -P OUTPUT DROP # ip6tables -P FORWARD DROP Notes: Changing firewall settings while connected over network can result in being locked out of the system. Remediation will only affect the active system firewall, be sure to configure the default policy in your firewall management to apply on boot as well." reference : "800-171|3.13.1,800-53|SC-7,CSCv7|9.4,ITSG-33|SC-7,LEVEL|1S,NIAv2|AM38,NIAv2|SS13d,NIAv2|SS26" see_also : "https://workbench.cisecurity.org/files/2485" cmd : "/usr/sbin/ip6tables --list | /usr/bin/grep 'Chain INPUT'" expect : "^Chain INPUT \\(policy (DROP|REJECT)\\)" system : "Linux" type : CMD_EXEC description : "3.4.4.2.1 Ensure IPv6 default deny firewall policy - 'Chain FORWARD'" info : "A default deny all policy on connections ensures that any unconfigured network usage will be rejected. Rationale: With a default accept policy the firewall will accept any packet that is not configured to be denied. It is easier to white list acceptable usage than to black list unacceptable usage." solution : "Run the following commands to implement a default DROP policy: # ip6tables -P INPUT DROP # ip6tables -P OUTPUT DROP # ip6tables -P FORWARD DROP Notes: Changing firewall settings while connected over network can result in being locked out of the system. Remediation will only affect the active system firewall, be sure to configure the default policy in your firewall management to apply on boot as well." reference : "800-171|3.13.1,800-53|SC-7,CSCv7|9.4,ITSG-33|SC-7,LEVEL|1S,NIAv2|AM38,NIAv2|SS13d,NIAv2|SS26" see_also : "https://workbench.cisecurity.org/files/2485" cmd : "/usr/sbin/ip6tables --list | /usr/bin/grep 'Chain FORWARD'" expect : "^Chain FORWARD \\(policy (DROP|REJECT)\\)" system : "Linux" type : CMD_EXEC description : "3.4.4.2.1 Ensure IPv6 default deny firewall policy - 'Chain OUTPUT'" info : "A default deny all policy on connections ensures that any unconfigured network usage will be rejected. Rationale: With a default accept policy the firewall will accept any packet that is not configured to be denied. It is easier to white list acceptable usage than to black list unacceptable usage." solution : "Run the following commands to implement a default DROP policy: # ip6tables -P INPUT DROP # ip6tables -P OUTPUT DROP # ip6tables -P FORWARD DROP Notes: Changing firewall settings while connected over network can result in being locked out of the system. Remediation will only affect the active system firewall, be sure to configure the default policy in your firewall management to apply on boot as well." reference : "800-171|3.13.1,800-53|SC-7,CSCv7|9.4,ITSG-33|SC-7,LEVEL|1S,NIAv2|AM38,NIAv2|SS13d,NIAv2|SS26" see_also : "https://workbench.cisecurity.org/files/2485" cmd : "/usr/sbin/ip6tables --list | /usr/bin/grep 'Chain OUTPUT'" expect : "^Chain OUTPUT \\(policy (DROP|REJECT)\\)" system : "Linux" type : CMD_EXEC description : "IPv6 is disabled" cmd : "/usr/bin/grep -E '^[\\s]*kernelopts=.*ipv6\.disable=1.*$' /boot/grub2/grubenv | /usr/bin/awk '{print} END {if (NR != 0) print \"pass\" ; else print \"fail\"}'" expect : "^pass$" description : "3.4.4.2.2 Ensure IPv6 loopback traffic is configured" info : "Configure the loopback interface to accept traffic. Configure all other interfaces to deny traffic to the loopback network (::1). Rationale: Loopback traffic is generated between processes on machine and is typically critical to operation of the system. The loopback interface is the only place that loopback network (::1) traffic should be seen, all other interfaces should ignore traffic on this network as an anti-spoofing measure." solution : "Run the following commands to implement the loopback rules: # ip6tables -A INPUT -i lo -j ACCEPT # ip6tables -A OUTPUT -o lo -j ACCEPT # ip6tables -A INPUT -s ::1 -j DROP Notes: Changing firewall settings while connected over network can result in being locked out of the system. Remediation will only affect the active system firewall, be sure to configure the default policy in your firewall management to apply on boot as well." reference : "800-171|3.13.1,800-53|SC-7,CSCv7|9.4,ITSG-33|SC-7,LEVEL|1S,NIAv2|AM38,NIAv2|SS13d,NIAv2|SS26" see_also : "https://workbench.cisecurity.org/files/2485" system : "Linux" type : CMD_EXEC description : "3.4.4.2.2 Ensure IPv6 loopback traffic is configured" info : "Configure the loopback interface to accept traffic. Configure all other interfaces to deny traffic to the loopback network (::1). Rationale: Loopback traffic is generated between processes on machine and is typically critical to operation of the system. The loopback interface is the only place that loopback network (::1) traffic should be seen, all other interfaces should ignore traffic on this network as an anti-spoofing measure. NOTE: Nessus has provided the target output to assist in reviewing the benchmark to ensure target compliance." solution : "Run the following commands to implement the loopback rules: # ip6tables -A INPUT -i lo -j ACCEPT # ip6tables -A OUTPUT -o lo -j ACCEPT # ip6tables -A INPUT -s ::1 -j DROP Notes: Changing firewall settings while connected over network can result in being locked out of the system. Remediation will only affect the active system firewall, be sure to configure the default policy in your firewall management to apply on boot as well." reference : "800-171|3.13.1,800-53|SC-7,CSCv7|9.4,ITSG-33|SC-7,LEVEL|1S,NIAv2|AM38,NIAv2|SS13d,NIAv2|SS26" see_also : "https://workbench.cisecurity.org/files/2485" cmd : "/usr/sbin/ip6tables -L INPUT -v -n; /usr/sbin/ip6tables -L OUTPUT -v -n" expect : "ManualReviewRequired" severity : MEDIUM system : "Linux" type : CMD_EXEC description : "IPv6 is disabled" cmd : "/usr/bin/grep -E '^[\\s]*kernelopts=.*ipv6\.disable=1.*$' /boot/grub2/grubenv | /usr/bin/awk '{print} END {if (NR != 0) print \"pass\" ; else print \"fail\"}'" expect : "^pass$" description : "3.4.4.2.3 Ensure IPv6 outbound and established connections are configured" info : "Configure the firewall rules for new outbound, and established IPv6 connections. Rationale: If rules are not in place for new outbound, and established connections all packets will be dropped by the default policy preventing network usage." solution : "Configure iptables in accordance with site policy. The following commands will implement a policy to allow all outbound connections and all established connections: # ip6tables -A OUTPUT -p tcp -m state --state NEW,ESTABLISHED -j ACCEPT # ip6tables -A OUTPUT -p udp -m state --state NEW,ESTABLISHED -j ACCEPT # ip6tables -A OUTPUT -p icmp -m state --state NEW,ESTABLISHED -j ACCEPT # ip6tables -A INPUT -p tcp -m state --state ESTABLISHED -j ACCEPT # ip6tables -A INPUT -p udp -m state --state ESTABLISHED -j ACCEPT # ip6tables -A INPUT -p icmp -m state --state ESTABLISHED -j ACCEPT Notes: Changing firewall settings while connected over network can result in being locked out of the system. Remediation will only affect the active system firewall, be sure to configure the default policy in your firewall management to apply on boot as well." reference : "800-171|3.13.1,800-53|SC-7,CSCv7|9.4,ITSG-33|SC-7,LEVEL|1NS,NIAv2|AM38,NIAv2|SS13d,NIAv2|SS26" see_also : "https://workbench.cisecurity.org/files/2485" system : "Linux" type : CMD_EXEC description : "3.4.4.2.3 Ensure IPv6 outbound and established connections are configured" info : "Configure the firewall rules for new outbound, and established IPv6 connections. Rationale: If rules are not in place for new outbound, and established connections all packets will be dropped by the default policy preventing network usage. NOTE: Nessus has provided the target output to assist in reviewing the benchmark to ensure target compliance." solution : "Configure iptables in accordance with site policy. The following commands will implement a policy to allow all outbound connections and all established connections: # ip6tables -A OUTPUT -p tcp -m state --state NEW,ESTABLISHED -j ACCEPT # ip6tables -A OUTPUT -p udp -m state --state NEW,ESTABLISHED -j ACCEPT # ip6tables -A OUTPUT -p icmp -m state --state NEW,ESTABLISHED -j ACCEPT # ip6tables -A INPUT -p tcp -m state --state ESTABLISHED -j ACCEPT # ip6tables -A INPUT -p udp -m state --state ESTABLISHED -j ACCEPT # ip6tables -A INPUT -p icmp -m state --state ESTABLISHED -j ACCEPT Notes: Changing firewall settings while connected over network can result in being locked out of the system. Remediation will only affect the active system firewall, be sure to configure the default policy in your firewall management to apply on boot as well." reference : "800-171|3.13.1,800-53|SC-7,CSCv7|9.4,ITSG-33|SC-7,LEVEL|1NS,NIAv2|AM38,NIAv2|SS13d,NIAv2|SS26" see_also : "https://workbench.cisecurity.org/files/2485" cmd : "/sbin/ip6tables -L -v -n" expect : "" severity : MEDIUM system : "Linux" type : CMD_EXEC description : "IPv6 is disabled" cmd : "/usr/bin/grep -E '^[\\s]*kernelopts=.*ipv6\.disable=1.*$' /boot/grub2/grubenv | /usr/bin/awk '{print} END {if (NR != 0) print \"pass\" ; else print \"fail\"}'" expect : "^pass$" description : "3.4.4.2.4 Ensure IPv6 firewall rules exist for all open ports - ports" info : "Any ports that have been opened on non-loopback addresses need firewall rules to govern traffic. Rationale: Without a firewall rule configured for open ports default firewall policy will drop all packets to these ports." solution : "For each port identified in the audit which does not have a firewall rule establish a proper rule for accepting inbound connections: # ip6tables -A INPUT -p --dport -m state --state NEW -j ACCEPT Notes: Changing firewall settings while connected over network can result in being locked out of the system. Remediation will only affect the active system firewall, be sure to configure the default policy in your firewall management to apply on boot as well. The remediation command opens up the port to traffic from all sources. Consult iptables documentation and set any restrictions in compliance with site policy." reference : "800-171|3.13.1,800-53|SC-7,CSCv7|9.4,ITSG-33|SC-7,LEVEL|1NS,NIAv2|AM38,NIAv2|SS13d,NIAv2|SS26" see_also : "https://workbench.cisecurity.org/files/2485" description : "3.4.4.2.4 Ensure IPv6 firewall rules exist for all open ports - firewall rules" info : "Any ports that have been opened on non-loopback addresses need firewall rules to govern traffic. Rationale: Without a firewall rule configured for open ports default firewall policy will drop all packets to these ports." solution : "For each port identified in the audit which does not have a firewall rule establish a proper rule for accepting inbound connections: # ip6tables -A INPUT -p --dport -m state --state NEW -j ACCEPT Notes: Changing firewall settings while connected over network can result in being locked out of the system. Remediation will only affect the active system firewall, be sure to configure the default policy in your firewall management to apply on boot as well. The remediation command opens up the port to traffic from all sources. Consult iptables documentation and set any restrictions in compliance with site policy." reference : "800-171|3.13.1,800-53|SC-7,CSCv7|9.4,ITSG-33|SC-7,LEVEL|1NS,NIAv2|AM38,NIAv2|SS13d,NIAv2|SS26" see_also : "https://workbench.cisecurity.org/files/2485" system : "Linux" type : CMD_EXEC description : "3.4.4.2.4 Ensure IPv6 firewall rules exist for all open ports - ports" info : "Any ports that have been opened on non-loopback addresses need firewall rules to govern traffic. Rationale: Without a firewall rule configured for open ports default firewall policy will drop all packets to these ports. NOTE: Nessus has provided the target output to assist in reviewing the benchmark to ensure target compliance." solution : "For each port identified in the audit which does not have a firewall rule establish a proper rule for accepting inbound connections: # ip6tables -A INPUT -p --dport -m state --state NEW -j ACCEPT Notes: Changing firewall settings while connected over network can result in being locked out of the system. Remediation will only affect the active system firewall, be sure to configure the default policy in your firewall management to apply on boot as well. The remediation command opens up the port to traffic from all sources. Consult iptables documentation and set any restrictions in compliance with site policy." reference : "800-171|3.13.1,800-53|SC-7,CSCv7|9.4,ITSG-33|SC-7,LEVEL|1NS,NIAv2|AM38,NIAv2|SS13d,NIAv2|SS26" see_also : "https://workbench.cisecurity.org/files/2485" cmd : "/usr/sbin/ss -6tuln; /usr/sbin/ip6tables -L INPUT -v -n" expect : "" severity : MEDIUM system : "Linux" type : CMD_EXEC description : "3.4.4.2.4 Ensure IPv6 firewall rules exist for all open ports - firewall rules" info : "Any ports that have been opened on non-loopback addresses need firewall rules to govern traffic. Rationale: Without a firewall rule configured for open ports default firewall policy will drop all packets to these ports. NOTE: Nessus has provided the target output to assist in reviewing the benchmark to ensure target compliance." solution : "For each port identified in the audit which does not have a firewall rule establish a proper rule for accepting inbound connections: # ip6tables -A INPUT -p --dport -m state --state NEW -j ACCEPT Notes: Changing firewall settings while connected over network can result in being locked out of the system. Remediation will only affect the active system firewall, be sure to configure the default policy in your firewall management to apply on boot as well. The remediation command opens up the port to traffic from all sources. Consult iptables documentation and set any restrictions in compliance with site policy." reference : "800-171|3.13.1,800-53|SC-7,CSCv7|9.4,ITSG-33|SC-7,LEVEL|1NS,NIAv2|AM38,NIAv2|SS13d,NIAv2|SS26" see_also : "https://workbench.cisecurity.org/files/2485" cmd : "/sbin/ip6tables -L -v -n" expect : "" severity : MEDIUM system : "Linux" type : CMD_EXEC description : "3.5 Ensure wireless interfaces are disabled" info : "Wireless networking is used when wired networks are unavailable. Red Hat Enterprise Linux contains a wireless tool kit to allow system administrators to configure and use wireless networks. Rationale: If wireless is not to be used, wireless devices can be disabled to reduce the potential attack surface." solution : "Run the following command to disable any wireless interfaces: # nmcli radio all off Disable any wireless interfaces in your network configuration. Impact: Many if not all laptop workstations and some desktop workstations will connect via wireless requiring these interfaces be enabled." reference : "800-53|AC-18,CSCv7|15.4,CSCv7|15.5,CSF|PR.PT-4,ITSG-33|AC-18,LEVEL|1S,SWIFT-CSCv1|2.3" see_also : "https://workbench.cisecurity.org/files/2485" cmd : "/usr/bin/nmcli radio wifi" expect : "disabled" system : "Linux" type : RPM_CHECK description : "4.2.1.1 Ensure rsyslog is installed" info : "The rsyslog software is a recommended replacement to the original syslogd daemon which provide improvements over syslogd, such as connection-oriented (i.e. TCP) transmission of logs, the option to log to database formats, and the encryption of log data en route to a central logging server. Rationale: The security enhancements of rsyslog such as connection-oriented (i.e. TCP) transmission of logs, the option to log to database formats, and the encryption of log data en route to a central logging server) justify installing and configuring the package." solution : "Run the folloing command to install rsyslog: # dnf install rsyslog" reference : "800-171|3.4.8,800-53|CM-7,CSCv7|6.2,CSCv7|6.3,CSF|PR.IP-1,CSF|PR.PT-3,ISO/IEC-27001|A.12.5.1,ISO/IEC-27001|A.12.6.2,LEVEL|1S,PCI-DSSv3.1|12.3.7,PCI-DSSv3.2|12.3.7,SWIFT-CSCv1|2.3" see_also : "https://workbench.cisecurity.org/files/2485" rpm : "rsyslog-0.0.0-0" operator : "gt" required : YES system : "Linux" type : CMD_EXEC description : "4.2.1.2 Ensure rsyslog Service is enabled" info : "Once the rsyslog package is installed it needs to be activated. Rationale: If the rsyslog service is not activated the system may default to the syslogd service or lack logging instead." solution : "Run the following command to enable rsyslog: # systemctl --now enable rsyslog Notes: Additional methods of enabling a service exist. Consult your distribution documentation for appropriate methods." reference : "CIP|007-6-R1,CSCv7|6.2,CSCv7|6.3,LEVEL|1S,PCI-DSSv3.1|2.2.2,PCI-DSSv3.1|2.2.3,PCI-DSSv3.2|2.2.2,PCI-DSSv3.2|2.2.3" see_also : "https://workbench.cisecurity.org/files/2485" cmd : "/usr/bin/systemctl is-enabled rsyslog | /usr/bin/awk '{print} END {if(NR==0) print \"disabled\" }'" expect : "enabled" system : "Linux" type : CMD_EXEC description : "4.2.1.3 Ensure rsyslog default file permissions configured" info : "rsyslog will create logfiles that do not already exist on the system. This setting controls what permissions will be applied to these newly created files. Rationale: It is important to ensure that log files have the correct permissions to ensure that sensitive data is archived and protected." solution : "Edit the /etc/rsyslog.conf and /etc/rsyslog.d/*.conf files and set $FileCreateMode to 0640 or more restrictive: $FileCreateMode 0640" reference : "800-171|3.3.8,800-53|AU-9,CN-L3|7.1.2.3(d),CN-L3|7.1.3.3(f),CSCv7|5.1,CSF|PR.PT-1,ISO/IEC-27001|A.12.4.2,ITSG-33|AU-9,LEVEL|1S,NESA|M5.2.3,NESA|M5.5.2,NESA|T3.6.4,NESA|T8.2.9,NIAv2|SM5,NIAv2|SM6" see_also : "https://workbench.cisecurity.org/files/2485" cmd : "/usr/bin/grep '$FileCreateMode' /etc/rsyslog.conf /etc/rsyslog.d/*.conf" expect : ".*?:\\$FileCreateMode 0640" system : "Linux" type : CMD_EXEC description : "4.2.1.4 Ensure logging is configured" info : "The /etc/rsyslog.conf and /etc/rsyslog.d/*.conf files specifies rules for logging and which files are to be used to log certain classes of messages. Rationale: A great deal of important security-related information is sent via rsyslog (e.g., successful and failed su attempts, failed login attempts, root login attempts, etc.). NOTE: Nessus has provided the target output to assist in reviewing the benchmark to ensure target compliance." solution : "Edit the following lines in the /etc/rsyslog.conf and /etc/rsyslog.d/*.conf files as appropriate for your environment: *.emerg :omusrmsg:* auth,authpriv.* /var/log/secure mail.* -/var/log/mail mail.info -/var/log/mail.info mail.warning -/var/log/mail.warn mail.err /var/log/mail.err news.crit -/var/log/news/news.crit news.err -/var/log/news/news.err news.notice -/var/log/news/news.notice *.=warning;*.=err -/var/log/warn *.crit /var/log/warn *.*;mail.none;news.none -/var/log/messages local0,local1.* -/var/log/localmessages local2,local3.* -/var/log/localmessages local4,local5.* -/var/log/localmessages local6,local7.* -/var/log/localmessages Run the following command to reload the rsyslogd configuration: # systemctl restart rsyslog" reference : "800-171|3.3.1,800-171|3.3.2,800-53|AU-12,CN-L3|7.1.3.3(a),CN-L3|7.1.3.3(b),CN-L3|7.1.3.3(c),CSCv7|6.2,CSCv7|6.3,CSF|DE.CM-1,CSF|DE.CM-3,CSF|DE.CM-7,CSF|PR.PT-1,ISO/IEC-27001|A.12.4.1,ITSG-33|AU-12,LEVEL|1NS,NESA|T3.6.2,NESA|T3.6.5,NESA|T3.6.6,NIAv2|SM8,SWIFT-CSCv1|6.4,TBA-FIISB|45.1.1" see_also : "https://workbench.cisecurity.org/files/2485" cmd : "/usr/bin/ls -l /var/log/" expect : "" severity : MEDIUM system : "Linux" type : CMD_EXEC description : "4.2.1.5 Ensure rsyslog is configured to send logs to a remote log host" info : "The rsyslog utility supports the ability to send logs it gathers to a remote log host running syslogd(8) or to receive messages from remote hosts, reducing administrative overhead. Rationale: Storing log data on a remote host protects log integrity from local attacks. If an attacker gains root access on the local system, they could tamper with or remove log data that is stored on the local system" solution : "Edit the /etc/rsyslog.conf and /etc/rsyslog.d/*.conf files and add the following line (where loghost.example.com is the name of your central log host). *.* @@loghost.example.com Run the following command to reload the rsyslogd configuration: # systemctl restart rsyslog" reference : "800-171|3.3.8,800-53|AU-9,CSCv7|6.6,CSCv7|6.8,CSF|PR.PT-1,ITSG-33|AU-9,LEVEL|1S,NESA|M5.2.3,NESA|M5.5.2,NIAv2|SS13e" see_also : "https://workbench.cisecurity.org/files/2485" cmd : "/usr/bin/grep '^*.*[^I][^I]*@' /etc/rsyslog.conf /etc/rsyslog.d/*.conf" regex : ".*?:[\\s]*\\*\\.\\*[\\s]+" # Note: Variable @SYSLOG_SERVER@ replaced with "10\\.0\\.0\\.2" in field "expect". expect : ".*?:[\\s]*\\*\\.\\*[\\s]+\\@\\@10\\.0\\.0\\.2[\\s]*$" system : "Linux" type : CMD_EXEC description : "4.2.1.6 Ensure remote rsyslog messages are only accepted on designated log hosts. - ModLoad imtcp" info : "By default, rsyslog does not listen for log messages coming in from remote systems. The ModLoad tells rsyslog to load the imtcp.so module so it can listen over a network via TCP. The InputTCPServerRun option instructs rsyslogd to listen on the specified TCP port. Rationale: The guidance in the section ensures that remote log hosts are configured to only accept rsyslog data from hosts within the specified domain and that those systems that are not designed to be log hosts do not accept any remote rsyslog messages. This provides protection from spoofed log data and ensures that system administrators are reviewing reasonably complete syslog data in a central location. NOTE: Nessus has provided the target output to assist in reviewing the benchmark to ensure target compliance." solution : "For hosts that are designated as log hosts, edit the /etc/rsyslog.conf file and un-comment or add the following lines: $ModLoad imtcp $InputTCPServerRun 514 For hosts that are not designated as log hosts, edit the /etc/rsyslog.conf file and comment or remove the following lines: # $ModLoad imtcp # $InputTCPServerRun 514 Run the following command to reload the rsyslogd configuration: # systemctl restart rsyslog" reference : "800-171|3.4.6,800-171|3.4.7,800-53|CM-7,CN-L3|7.1.3.5(c),CN-L3|7.1.3.7(d),CSCv7|9.2,CSF|PR.IP-1,CSF|PR.PT-3,ITSG-33|CM-7,LEVEL|1NS,NIAv2|SS13b,NIAv2|SS14a,NIAv2|SS14c,NIAv2|SS15a,SWIFT-CSCv1|2.3" see_also : "https://workbench.cisecurity.org/files/2485" cmd : "/usr/bin/grep -h '$ModLoad imtcp' /etc/rsyslog.conf /etc/rsyslog.d/*.conf" expect : "^[\\s]*\\$ModLoad[\\s]+imtcp[\\s]*$" severity : MEDIUM system : "Linux" type : CMD_EXEC description : "4.2.1.6 Ensure remote rsyslog messages are only accepted on designated log hosts. - InputTCPServerRun" info : "By default, rsyslog does not listen for log messages coming in from remote systems. The ModLoad tells rsyslog to load the imtcp.so module so it can listen over a network via TCP. The InputTCPServerRun option instructs rsyslogd to listen on the specified TCP port. Rationale: The guidance in the section ensures that remote log hosts are configured to only accept rsyslog data from hosts within the specified domain and that those systems that are not designed to be log hosts do not accept any remote rsyslog messages. This provides protection from spoofed log data and ensures that system administrators are reviewing reasonably complete syslog data in a central location. NOTE: Nessus has provided the target output to assist in reviewing the benchmark to ensure target compliance." solution : "For hosts that are designated as log hosts, edit the /etc/rsyslog.conf file and un-comment or add the following lines: $ModLoad imtcp $InputTCPServerRun 514 For hosts that are not designated as log hosts, edit the /etc/rsyslog.conf file and comment or remove the following lines: # $ModLoad imtcp # $InputTCPServerRun 514 Run the following command to reload the rsyslogd configuration: # systemctl restart rsyslog" reference : "800-171|3.4.6,800-171|3.4.7,800-53|CM-7,CN-L3|7.1.3.5(c),CN-L3|7.1.3.7(d),CSCv7|9.2,CSF|PR.IP-1,CSF|PR.PT-3,ITSG-33|CM-7,LEVEL|1NS,NIAv2|SS13b,NIAv2|SS14a,NIAv2|SS14c,NIAv2|SS15a,SWIFT-CSCv1|2.3" see_also : "https://workbench.cisecurity.org/files/2485" cmd : "/usr/bin/grep -h '$InputTCPServerRun' /etc/rsyslog.conf /etc/rsyslog.d/*.conf" expect : "^[\\s]*\\$InputTCPServerRun[\\s]+514[\\s]*$" severity : MEDIUM system : "Linux" type : CMD_EXEC description : "4.2.2.1 Ensure journald is configured to send logs to rsyslog" info : "Data from journald may be stored in volatile memory or persisted locally on the server. Utilities exist to accept remote export of journald logs, however, use of the rsyslog service provides a consistent means of log collection and export. Rationale: Storing log data on a remote host protects log integrity from local attacks. If an attacker gains root access on the local system, they could tamper with or remove log data that is stored on the local system." solution : "Edit the /etc/systemd/journald.conf file and add the following line: ForwardToSyslog=yes" reference : "800-171|3.3.1,800-171|3.3.2,800-53|AU-12,CN-L3|7.1.3.3(a),CN-L3|7.1.3.3(b),CN-L3|7.1.3.3(c),CSCv7|6.5,CSF|DE.CM-1,CSF|DE.CM-3,CSF|DE.CM-7,CSF|PR.PT-1,ISO/IEC-27001|A.12.4.1,ITSG-33|AU-12,LEVEL|1S,NESA|T3.6.2,NESA|T3.6.5,NESA|T3.6.6,NIAv2|SM8,SWIFT-CSCv1|6.4,TBA-FIISB|45.1.1" see_also : "https://workbench.cisecurity.org/files/2485" cmd : "/usr/bin/grep -e ^[\\s]*ForwardToSyslog /etc/systemd/journald.conf | /usr/bin/awk '{print} END {if (NR == 0) print \"fail\"}'" expect : "^[\\s]*ForwardToSyslog[\\s]*=[\\s]*yes[\\s]*$" system : "Linux" type : CMD_EXEC description : "4.2.2.2 Ensure journald is configured to compress large log files" info : "The journald system includes the capability of compressing overly large files to avoid filling up the system with logs or making the logs unmanageably large. Rationale: Uncompressed large files may unexpectedly fill a filesystem leading to resource unavailability. Compressing logs prior to write can prevent sudden, unexpected filesystem impacts." solution : "Edit the /etc/systemd/journald.conf file and add the following line: Compress=yes" reference : "800-171|3.4.2,800-53|CM-6,CSCv7|6.4,CSF|PR.IP-1,ITSG-33|CM-6,LEVEL|1S,NESA|T3.2.1,SWIFT-CSCv1|2.3" see_also : "https://workbench.cisecurity.org/files/2485" cmd : "/usr/bin/grep -e ^[\\s]*Compress /etc/systemd/journald.conf | /usr/bin/awk '{print} END {if (NR == 0) print \"fail\"}'" expect : "^[\\s]*Compress[\\s]*=[\\s]*yes[\\s]*$" system : "Linux" type : CMD_EXEC description : "4.2.2.3 Ensure journald is configured to write logfiles to persistent disk" info : "Data from journald may be stored in volatile memory or persisted locally on the server. Logs in memory will be lost upon a system reboot. By persisting logs to local disk on the server they are protected from loss. Rationale: Writing log data to disk will provide the ability to forensically reconstruct events which may have impacted the operations or security of a system even after a system crash or reboot." solution : "Edit the /etc/systemd/journald.conf file and add the following line: Storage=persistent" reference : "800-171|3.3.8,800-53|AU-9,CN-L3|7.1.2.3(d),CN-L3|7.1.3.3(f),CSCv7|6.2,CSCv7|6.3,CSF|PR.PT-1,ISO/IEC-27001|A.12.4.2,ITSG-33|AU-9,LEVEL|1S,NESA|M5.2.3,NESA|M5.5.2,NESA|T3.6.4,NESA|T8.2.9,NIAv2|SM5,NIAv2|SM6" see_also : "https://workbench.cisecurity.org/files/2485" cmd : "/usr/bin/grep -e ^[\\s]*Storage /etc/systemd/journald.conf | /usr/bin/awk '{print} END {if (NR == 0) print \"fail\"}'" expect : "^[\\s]*Storage[\\s]*=[\\s]*persistent[\\s]*$" system : "Linux" type : CMD_EXEC description : "4.2.3 Ensure permissions on all logfiles are configured" info : "Log files stored in /var/log/ contain logged information from many services on the system, or on log hosts others as well. Rationale: It is important to ensure that log files have the correct permissions to ensure that sensitive data is archived and protected." solution : "Run the following commands to set permissions on all existing log files: find /var/log -type f -exec chmod g-wx,o-rwx \"{}\" + -o -type d -exec chmod g-w,o-rwx \"{}\" + Notes: You may also need to change the configuration for your logging software or services for any logs that had incorrect permissions." reference : "800-171|3.4.2,800-53|CM-6,CSCv7|5.1,CSF|PR.IP-1,ITSG-33|CM-6,LEVEL|1S,NESA|T3.2.1,SWIFT-CSCv1|2.3" see_also : "https://workbench.cisecurity.org/files/2485" cmd : "/usr/bin/find /var/log -type f -perm /037 -ls -o -type d -perm /026 -ls | /usr/bin/awk '{print} END {if (NR == 0) print \"pass\" ; else print \"fail\"}'" expect : "^pass$" description : "4.3 Ensure logrotate is configured" info : "The system includes the capability of rotating log files regularly to avoid filling up the system with logs or making the logs unmanageably large. The file /etc/logrotate.d/syslog is the configuration file used to rotate log files created by syslog or rsyslog. Rationale: By keeping the log files smaller and more manageable, a system administrator can easily archive these files to another system and spend less time looking through inordinately large log files. NOTE: Nessus has not performed this check. Please review the benchmark to ensure target compliance." solution : "Edit /etc/logrotate.conf and /etc/logrotate.d/* to ensure logs are rotated according to site policy. Notes: If no maxage setting is set for logrotate a situation can occur where logrotate is interrupted and fails to delete rotated logfiles. It is recommended to set this to a value greater than the longest any log file should exist on your system to ensure that any such logfile is removed but standard rotation settings are not overridden." reference : "CSCv7|6.4,LEVEL|1NS" see_also : "https://workbench.cisecurity.org/files/2485" system : "Linux" type : CMD_EXEC description : "5.1.1 Ensure cron daemon is enabled" info : "The cron daemon is used to execute batch jobs on the system. Rationale: While there may not be user jobs that need to be run on the system, the system does have maintenance jobs that may include security monitoring that have to run, and cron is used to execute them." solution : "Run the following command to enable cron: # systemctl --now enable crond Notes: Additional methods of enabling a service exist. Consult your distribution documentation for appropriate methods." reference : "CIP|007-6-R1,CSCv7|5.1,LEVEL|1S,PCI-DSSv3.1|2.2.2,PCI-DSSv3.1|2.2.3,PCI-DSSv3.2|2.2.2,PCI-DSSv3.2|2.2.3" see_also : "https://workbench.cisecurity.org/files/2485" cmd : "/usr/bin/systemctl is-enabled crond | /usr/bin/awk '{print} END {if(NR==0) print \"disabled\" }'" expect : "enabled" dont_echo_cmd : YES system : "Linux" type : FILE_CHECK description : "5.1.2 Ensure permissions on /etc/crontab are configured" info : "The /etc/crontab file is used by cron to control its own jobs. The commands in this item make sure that root is the user and group owner of the file and that only the owner can access the file. Rationale: This file contains information on what system jobs are run by cron. Write access to these files could provide unprivileged users with the ability to elevate their privileges. Read access to these files could provide users with the ability to gain insight on system jobs that run on the system and could provide them a way to gain unauthorized privileged access." solution : "Run the following commands to set ownership and permissions on /etc/crontab : # chown root:root /etc/crontab # chmod og-rwx /etc/crontab" reference : "800-171|3.4.2,800-53|CM-6,CSCv7|5.1,CSF|PR.IP-1,ITSG-33|CM-6,LEVEL|1S,NESA|T3.2.1,PCI-DSSv3.1|2.2.4,PCI-DSSv3.2|2.2.4,SWIFT-CSCv1|2.3" see_also : "https://workbench.cisecurity.org/files/2485" group : "root" owner : "root" file : "/etc/crontab" mask : "177" system : "Linux" type : FILE_CHECK description : "5.1.3 Ensure permissions on /etc/cron.hourly are configured" info : "This directory contains system cron jobs that need to run on an hourly basis. The files in this directory cannot be manipulated by the crontab command, but are instead edited by system administrators using a text editor. The commands below restrict read/write and search access to user and group root, preventing regular users from accessing this directory. Rationale: Granting write access to this directory for non-privileged users could provide them the means for gaining unauthorized elevated privileges. Granting read access to this directory could give an unprivileged user insight in how to gain elevated privileges or circumvent auditing controls." solution : "Run the following commands to set ownership and permissions on /etc/cron.hourly : # chown root:root /etc/cron.hourly # chmod og-rwx /etc/cron.hourly" reference : "800-171|3.4.2,800-53|CM-6,CSCv7|5.1,CSF|PR.IP-1,ITSG-33|CM-6,LEVEL|1S,NESA|T3.2.1,PCI-DSSv3.1|2.2.4,PCI-DSSv3.2|2.2.4,SWIFT-CSCv1|2.3" see_also : "https://workbench.cisecurity.org/files/2485" group : "root" owner : "root" file : "/etc/cron.hourly" mask : "077" system : "Linux" type : FILE_CHECK description : "5.1.4 Ensure permissions on /etc/cron.daily are configured" info : "The /etc/cron.daily directory contains system cron jobs that need to run on a daily basis. The files in this directory cannot be manipulated by the crontab command, but are instead edited by system administrators using a text editor. The commands below restrict read/write and search access to user and group root, preventing regular users from accessing this directory. Rationale: Granting write access to this directory for non-privileged users could provide them the means for gaining unauthorized elevated privileges. Granting read access to this directory could give an unprivileged user insight in how to gain elevated privileges or circumvent auditing controls." solution : "Run the following commands to set ownership and permissions on /etc/cron.daily : # chown root:root /etc/cron.daily # chmod og-rwx /etc/cron.daily" reference : "800-171|3.4.2,800-53|CM-6,CSCv7|5.1,CSF|PR.IP-1,ITSG-33|CM-6,LEVEL|1S,NESA|T3.2.1,PCI-DSSv3.1|2.2.4,PCI-DSSv3.2|2.2.4,SWIFT-CSCv1|2.3" see_also : "https://workbench.cisecurity.org/files/2485" group : "root" owner : "root" file : "/etc/cron.daily" mask : "077" system : "Linux" type : FILE_CHECK description : "5.1.5 Ensure permissions on /etc/cron.weekly are configured" info : "The /etc/cron.weekly directory contains system cron jobs that need to run on a weekly basis. The files in this directory cannot be manipulated by the crontab command, but are instead edited by system administrators using a text editor. The commands below restrict read/write and search access to user and group root, preventing regular users from accessing this directory. Rationale: Granting write access to this directory for non-privileged users could provide them the means for gaining unauthorized elevated privileges. Granting read access to this directory could give an unprivileged user insight in how to gain elevated privileges or circumvent auditing controls." solution : "Run the following commands to set ownership and permissions on /etc/cron.weekly : # chown root:root /etc/cron.weekly # chmod og-rwx /etc/cron.weekly" reference : "800-171|3.4.2,800-53|CM-6,CSCv7|5.1,CSF|PR.IP-1,ITSG-33|CM-6,LEVEL|1S,NESA|T3.2.1,PCI-DSSv3.1|2.2.4,PCI-DSSv3.2|2.2.4,SWIFT-CSCv1|2.3" see_also : "https://workbench.cisecurity.org/files/2485" group : "root" owner : "root" file : "/etc/cron.weekly" mask : "077" system : "Linux" type : FILE_CHECK description : "5.1.6 Ensure permissions on /etc/cron.monthly are configured" info : "The /etc/cron.monthly directory contains system cron jobs that need to run on a monthly basis. The files in this directory cannot be manipulated by the crontab command, but are instead edited by system administrators using a text editor. The commands below restrict read/write and search access to user and group root, preventing regular users from accessing this directory. Rationale: Granting write access to this directory for non-privileged users could provide them the means for gaining unauthorized elevated privileges. Granting read access to this directory could give an unprivileged user insight in how to gain elevated privileges or circumvent auditing controls." solution : "Run the following commands to set ownership and permissions on /etc/cron.monthly : # chown root:root /etc/cron.monthly # chmod og-rwx /etc/cron.monthly" reference : "800-171|3.4.2,800-53|CM-6,CSCv7|5.1,CSF|PR.IP-1,ITSG-33|CM-6,LEVEL|1S,NESA|T3.2.1,PCI-DSSv3.1|2.2.4,PCI-DSSv3.2|2.2.4,SWIFT-CSCv1|2.3" see_also : "https://workbench.cisecurity.org/files/2485" group : "root" owner : "root" file : "/etc/cron.monthly" mask : "077" system : "Linux" type : FILE_CHECK description : "5.1.7 Ensure permissions on /etc/cron.d are configured" info : "The /etc/cron.d directory contains system cron jobs that need to run in a similar manner to the hourly, daily weekly and monthly jobs from /etc/crontab , but require more granular control as to when they run. The files in this directory cannot be manipulated by the crontab command, but are instead edited by system administrators using a text editor. The commands below restrict read/write and search access to user and group root, preventing regular users from accessing this directory. Rationale: Granting write access to this directory for non-privileged users could provide them the means for gaining unauthorized elevated privileges. Granting read access to this directory could give an unprivileged user insight in how to gain elevated privileges or circumvent auditing controls." solution : "Run the following commands to set ownership and permissions on /etc/cron.d : # chown root:root /etc/cron.d # chmod og-rwx /etc/cron.d" reference : "800-171|3.4.2,800-53|CM-6,CSCv7|5.1,CSF|PR.IP-1,ITSG-33|CM-6,LEVEL|1S,NESA|T3.2.1,PCI-DSSv3.1|2.2.4,PCI-DSSv3.2|2.2.4,SWIFT-CSCv1|2.3" see_also : "https://workbench.cisecurity.org/files/2485" group : "root" owner : "root" file : "/etc/cron.d" mask : "077" system : "Linux" type : FILE_CHECK_NOT description : "5.1.8 Ensure at/cron is restricted to authorized users - cron.deny" info : "Configure /etc/cron.allow and /etc/at.allow to allow specific users to use these services. If /etc/cron.allow or /etc/at.allow do not exist, then /etc/at.deny and /etc/cron.deny are checked. Any user not specifically defined in those files is allowed to use at and cron. By removing the files, only users in /etc/cron.allow and /etc/at.allow are allowed to use at and cron. Note that even though a given user is not listed in cron.allow , cron jobs can still be run as that user. The cron.allow file only controls administrative access to the crontab command for scheduling and modifying cron jobs. Rationale: On many systems, only the system administrator is authorized to schedule cron jobs. Using the cron.allow file to control who can run cron jobs enforces this policy. It is easier to manage an allow list than a deny list. In a deny list, you could potentially add a user ID to the system and forget to add it to the deny files." solution : "Run the following commands to remove /etc/cron.deny and /etc/at.deny and create and set permissions and ownership for /etc/cron.allow and /etc/at.allow : # rm /etc/cron.deny # rm /etc/at.deny # touch /etc/cron.allow # touch /etc/at.allow # chmod og-rwx /etc/cron.allow # chmod og-rwx /etc/at.allow # chown root:root /etc/cron.allow # chown root:root /etc/at.allow" reference : "800-171|3.1.7,800-53|AC-6,CIP|007-6-R1,CSCv7|16,CSF|PR.AC-4,LEVEL|1S,PCI-DSSv3.1|2.2.2,PCI-DSSv3.1|2.2.3,PCI-DSSv3.2|2.2.2,PCI-DSSv3.2|2.2.3" see_also : "https://workbench.cisecurity.org/files/2485" file : "/etc/cron.deny" system : "Linux" type : FILE_CHECK_NOT description : "5.1.8 Ensure at/cron is restricted to authorized users - at.deny" info : "Configure /etc/cron.allow and /etc/at.allow to allow specific users to use these services. If /etc/cron.allow or /etc/at.allow do not exist, then /etc/at.deny and /etc/cron.deny are checked. Any user not specifically defined in those files is allowed to use at and cron. By removing the files, only users in /etc/cron.allow and /etc/at.allow are allowed to use at and cron. Note that even though a given user is not listed in cron.allow , cron jobs can still be run as that user. The cron.allow file only controls administrative access to the crontab command for scheduling and modifying cron jobs. Rationale: On many systems, only the system administrator is authorized to schedule cron jobs. Using the cron.allow file to control who can run cron jobs enforces this policy. It is easier to manage an allow list than a deny list. In a deny list, you could potentially add a user ID to the system and forget to add it to the deny files." solution : "Run the following commands to remove /etc/cron.deny and /etc/at.deny and create and set permissions and ownership for /etc/cron.allow and /etc/at.allow : # rm /etc/cron.deny # rm /etc/at.deny # touch /etc/cron.allow # touch /etc/at.allow # chmod og-rwx /etc/cron.allow # chmod og-rwx /etc/at.allow # chown root:root /etc/cron.allow # chown root:root /etc/at.allow" reference : "800-171|3.1.7,800-53|AC-6,CIP|007-6-R1,CSCv7|16,CSF|PR.AC-4,LEVEL|1S,PCI-DSSv3.1|2.2.2,PCI-DSSv3.1|2.2.3,PCI-DSSv3.2|2.2.2,PCI-DSSv3.2|2.2.3" see_also : "https://workbench.cisecurity.org/files/2485" file : "/etc/at.deny" system : "Linux" type : FILE_CHECK description : "5.1.8 Ensure at/cron is restricted to authorized users - cron.allow" info : "Configure /etc/cron.allow and /etc/at.allow to allow specific users to use these services. If /etc/cron.allow or /etc/at.allow do not exist, then /etc/at.deny and /etc/cron.deny are checked. Any user not specifically defined in those files is allowed to use at and cron. By removing the files, only users in /etc/cron.allow and /etc/at.allow are allowed to use at and cron. Note that even though a given user is not listed in cron.allow , cron jobs can still be run as that user. The cron.allow file only controls administrative access to the crontab command for scheduling and modifying cron jobs. Rationale: On many systems, only the system administrator is authorized to schedule cron jobs. Using the cron.allow file to control who can run cron jobs enforces this policy. It is easier to manage an allow list than a deny list. In a deny list, you could potentially add a user ID to the system and forget to add it to the deny files." solution : "Run the following commands to remove /etc/cron.deny and /etc/at.deny and create and set permissions and ownership for /etc/cron.allow and /etc/at.allow : # rm /etc/cron.deny # rm /etc/at.deny # touch /etc/cron.allow # touch /etc/at.allow # chmod og-rwx /etc/cron.allow # chmod og-rwx /etc/at.allow # chown root:root /etc/cron.allow # chown root:root /etc/at.allow" reference : "800-171|3.1.7,800-53|AC-6,CSCv7|16,CSF|PR.AC-4,LEVEL|1S,PCI-DSSv3.1|2.2.4,PCI-DSSv3.2|2.2.4" see_also : "https://workbench.cisecurity.org/files/2485" group : "root" owner : "root" file : "/etc/cron.allow" mask : "177" system : "Linux" type : FILE_CHECK description : "5.1.8 Ensure at/cron is restricted to authorized users - at.allow" info : "Configure /etc/cron.allow and /etc/at.allow to allow specific users to use these services. If /etc/cron.allow or /etc/at.allow do not exist, then /etc/at.deny and /etc/cron.deny are checked. Any user not specifically defined in those files is allowed to use at and cron. By removing the files, only users in /etc/cron.allow and /etc/at.allow are allowed to use at and cron. Note that even though a given user is not listed in cron.allow , cron jobs can still be run as that user. The cron.allow file only controls administrative access to the crontab command for scheduling and modifying cron jobs. Rationale: On many systems, only the system administrator is authorized to schedule cron jobs. Using the cron.allow file to control who can run cron jobs enforces this policy. It is easier to manage an allow list than a deny list. In a deny list, you could potentially add a user ID to the system and forget to add it to the deny files." solution : "Run the following commands to remove /etc/cron.deny and /etc/at.deny and create and set permissions and ownership for /etc/cron.allow and /etc/at.allow : # rm /etc/cron.deny # rm /etc/at.deny # touch /etc/cron.allow # touch /etc/at.allow # chmod og-rwx /etc/cron.allow # chmod og-rwx /etc/at.allow # chown root:root /etc/cron.allow # chown root:root /etc/at.allow" reference : "800-171|3.1.7,800-53|AC-6,CSCv7|16,CSF|PR.AC-4,LEVEL|1S,PCI-DSSv3.1|2.2.4,PCI-DSSv3.2|2.2.4" see_also : "https://workbench.cisecurity.org/files/2485" group : "root" owner : "root" file : "/etc/at.allow" mask : "177" system : "Linux" type : FILE_CHECK description : "5.2.1 Ensure permissions on /etc/ssh/sshd_config are configured" info : "The /etc/ssh/sshd_config file contains configuration specifications for sshd. The command below sets the owner and group of the file to root. Rationale: The /etc/ssh/sshd_config file needs to be protected from unauthorized changes by non-privileged users." solution : "Run the following commands to set ownership and permissions on /etc/ssh/sshd_config: # chown root:root /etc/ssh/sshd_config # chmod og-rwx /etc/ssh/sshd_config" reference : "800-171|3.4.2,800-53|CM-6,CSCv7|5.1,CSF|PR.IP-1,ITSG-33|CM-6,LEVEL|1S,NESA|T3.2.1,PCI-DSSv3.1|2.2.4,PCI-DSSv3.2|2.2.4,SWIFT-CSCv1|2.3" see_also : "https://workbench.cisecurity.org/files/2485" file : "/etc/ssh/sshd_config" owner : "root" mask : "177" group : "root" system : "Linux" type : FILE_CONTENT_CHECK description : "5.2.2 Ensure SSH access is limited" info : "There are several options available to limit which users and group can access the system via SSH. It is recommended that at least one of the following options be leveraged: AllowUsers The AllowUsers variable gives the system administrator the option of allowing specific users to ssh into the system. The list consists of space separated user names. Numeric user IDs are not recognized with this variable. If a system administrator wants to restrict user access further by only allowing the allowed users to log in from a particular host, the entry can be specified in the form of user@host. AllowGroups The AllowGroups variable gives the system administrator the option of allowing specific groups of users to ssh into the system. The list consists of space separated group names. Numeric group IDs are not recognized with this variable. DenyUsers The DenyUsers variable gives the system administrator the option of denying specific users to ssh into the system. The list consists of space separated user names. Numeric user IDs are not recognized with this variable. If a system administrator wants to restrict user access further by specifically denying a user's access from a particular host, the entry can be specified in the form of user@host. DenyGroups The DenyGroups variable gives the system administrator the option of denying specific groups of users to ssh into the system. The list consists of space separated group names. Numeric group IDs are not recognized with this variable. Rationale: Restricting which users can remotely access the system via SSH will help ensure that only authorized users access the system." solution : "Edit the /etc/ssh/sshd_config file to set one or more of the parameter as follows: AllowUsers AllowGroups DenyUsers DenyGroups " reference : "800-53|AC-6,CSCv7|4.3,CSF|PR.AC-4,ISO/IEC-27001|A.9.2.5,LEVEL|1S,NESA|M1.1.3,NESA|T5.1.1" see_also : "https://workbench.cisecurity.org/files/2485" file : "/etc/ssh/sshd_config" regex : "^[\\s]*(Allow|Deny)(Users|Groups)[\\s]" expect : "^[\\s]*(Allow|Deny)(Users|Groups)[\\s]" system : "Linux" type : FILE_CHECK description : "5.2.3 Ensure permissions on SSH private host key files are configured" info : "An SSH private key is one of two files used in SSH public key authentication. In this authentication method, The possession of the private key is proof of identity. Only a private key that corresponds to a public key will be able to authenticate successfully. The private keys need to be stored and handled carefully, and no copies of the private key should be distributed. Rationale: If an unauthorized user obtains the private SSH host key file, the host could be impersonated" solution : "Run the following commands to set ownership and permissions on the private SSH host key files # find /etc/ssh -xdev -type f -name 'ssh_host_*_key' -exec chown root:root {} \; # find /etc/ssh -xdev -type f -name 'ssh_host_*_key' -exec chmod 0600 {} \;" reference : "800-171|3.4.2,800-53|CM-6,CSCv7|5.1,CSF|PR.IP-1,ITSG-33|CM-6,LEVEL|1S,NESA|T3.2.1,PCI-DSSv3.1|2.2.4,PCI-DSSv3.2|2.2.4,SWIFT-CSCv1|2.3" see_also : "https://workbench.cisecurity.org/files/2485" group : "root" owner : "root" file : "/etc/ssh/ssh_host_*_key" mask : "7177" system : "Linux" type : FILE_CHECK description : "5.2.4 Ensure permissions on SSH public host key files are configured" info : "An SSH public key is one of two files used in SSH public key authentication. In this authentication method, a public key is a key that can be used for verifying digital signatures generated using a corresponding private key. Only a public key that corresponds to a private key will be able to authenticate successfully. Rationale: If a public host key file is modified by an unauthorized user, the SSH service may be compromised." solution : "Run the following commands to set permissions and ownership on the SSH host public key files # find /etc/ssh -xdev -type f -name 'ssh_host_*_key.pub' -exec chmod 0644 {} \; #find /etc/ssh -xdev -type f -name 'ssh_host_*_key.pub' -exec chown root:root {} \;" reference : "800-171|3.4.2,800-53|CM-6,CSCv7|5.1,CSF|PR.IP-1,ITSG-33|CM-6,LEVEL|1S,NESA|T3.2.1,PCI-DSSv3.1|2.2.4,PCI-DSSv3.2|2.2.4,SWIFT-CSCv1|2.3" see_also : "https://workbench.cisecurity.org/files/2485" group : "root" owner : "root" file : "/etc/ssh/ssh_host_*_key.pub" mask : "7133" system : "Linux" type : CMD_EXEC description : "5.2.5 Ensure SSH LogLevel is appropriate" info : "INFO level is the basic level that only records login activity of SSH users. In many situations, such as Incident Response, it is important to determine when a particular user was active on a system. The logout record can eliminate those users who disconnected, which helps narrow the field. VERBOSE level specifies that login and logout activity as well as the key fingerprint for any SSH key used for login will be logged. This information is important for SSH key management, especially in legacy environments. Rationale: SSH provides several logging levels with varying amounts of verbosity. DEBUG is specifically not recommended other than strictly for debugging SSH communications since it provides so much data that it is difficult to identify important security information." solution : "Edit the /etc/ssh/sshd_config file to set the parameter as follows: LogLevel VERBOSE OR LogLevel INFO Default Value: LogLevel INFO" reference : "800-171|3.3.1,800-171|3.3.2,800-53|AU-12,CN-L3|7.1.3.3(a),CN-L3|7.1.3.3(b),CN-L3|7.1.3.3(c),CSCv7|6.2,CSCv7|6.3,CSF|DE.CM-1,CSF|DE.CM-3,CSF|DE.CM-7,CSF|PR.PT-1,ISO/IEC-27001|A.12.4.1,ITSG-33|AU-12,LEVEL|1S,NESA|T3.6.2,NESA|T3.6.5,NESA|T3.6.6,NIAv2|SM8,SWIFT-CSCv1|6.4,TBA-FIISB|45.1.1" see_also : "https://workbench.cisecurity.org/files/2485" cmd : "/usr/sbin/sshd -T | /usr/bin/grep loglevel | /usr/bin/awk '{print} END {if (NR == 0) print \"fail\"}'" expect : "^[\\s]*[Ll]og[Ll]evel[\\s]+(INFO|VERBOSE)[\\s]*$" system : "Linux" type : FILE_CONTENT_CHECK description : "5.2.7 Ensure SSH MaxAuthTries is set to 3 or less" info : "The MaxAuthTries parameter specifies the maximum number of authentication attempts permitted per connection. When the login failure count reaches half the number, error messages will be written to the syslog file detailing the login failure. Rationale: Setting the MaxAuthTries parameter to a low number will minimize the risk of successful brute force attacks to the SSH server. While the recommended setting is 4, set the number based on site policy." solution : "Edit the /etc/ssh/sshd_config file to set the parameter as follows: MaxAuthTries 4 Default Value: MaxAuthTries 6" reference : "800-171|3.1.8,800-53|AC-7,CSCv7|16.13,ITSG-33|AC-7,LEVEL|1S,NESA|T5.5.1,NIAv2|AM24,TBA-FIISB|45.1.2,TBA-FIISB|45.2.1,TBA-FIISB|45.2.2" see_also : "https://workbench.cisecurity.org/files/2485" file : "/etc/ssh/sshd_config" regex : "^[\\s]*MaxAuthTries[\\s]" expect : "^[\\s]*MaxAuthTries[\\s]+[1-3][\\s]*$" system : "Linux" type : FILE_CONTENT_CHECK description : "5.2.8 Ensure SSH IgnoreRhosts is enabled" info : "The IgnoreRhosts parameter specifies that .rhosts and .shosts files will not be used in RhostsRSAAuthentication or HostbasedAuthentication. Rationale: Setting this parameter forces users to enter a password when authenticating with ssh." solution : "Edit the /etc/ssh/sshd_config file to set the parameter as follows: IgnoreRhosts yes Default Value: IgnoreRhosts yes" reference : "800-171|3.5.2,800-53|AC-14,800-53|IA-5,CSCv7|9.2,CSF|PR.AC-1,ITSG-33|AC-14,ITSG-33|IA-5,LEVEL|1S,NESA|T5.2.3,NESA|T5.6.1" see_also : "https://workbench.cisecurity.org/files/2485" file : "/etc/ssh/sshd_config" regex : "^[\\s]*IgnoreRhosts[\\s]" expect : "^[\\s]*IgnoreRhosts[\\s]+yes[\\s]*$" system : "Linux" type : FILE_CONTENT_CHECK description : "5.2.9 Ensure SSH HostbasedAuthentication is disabled" info : "The HostbasedAuthentication parameter specifies if authentication is allowed through trusted hosts via the user of .rhosts, or /etc/hosts.equiv, along with successful public key client host authentication. This option only applies to SSH Protocol Version 2. Rationale: Even though the .rhosts files are ineffective if support is disabled in /etc/pam.conf, disabling the ability to use .rhosts files in SSH provides an additional layer of protection." solution : "Edit the /etc/ssh/sshd_config file to set the parameter as follows: HostbasedAuthentication no Default Value: HostbasedAuthentication no" reference : "800-171|3.5.2,800-53|AC-14,800-53|IA-5,CSCv7|16.3,CSF|PR.AC-1,ITSG-33|AC-14,ITSG-33|IA-5,LEVEL|1S,NESA|T5.2.3,NESA|T5.6.1" see_also : "https://workbench.cisecurity.org/files/2485" file : "/etc/ssh/sshd_config" regex : "^[\\s]*HostbasedAuthentication[\\s]" expect : "^[\\s]*HostbasedAuthentication[\\s]+no[\\s]*$" system : "Linux" type : FILE_CONTENT_CHECK description : "5.2.10 Ensure SSH root login is disabled" info : "The PermitRootLogin parameter specifies if the root user can log in using ssh. The default is no. Rationale: Disallowing root logins over SSH requires system admins to authenticate using their own individual account, then escalating to root via sudo or su. This in turn limits opportunity for non-repudiation and provides a clear audit trail in the event of a security incident" solution : "Edit the /etc/ssh/sshd_config file to set the parameter as follows: PermitRootLogin no Default Value: PermitRootLogin without-password" reference : "800-171|3.1.15,800-171|3.1.2,800-53|AC-17,CSCv7|4.3,CSF|PR.AC-3,CSF|PR.PT-4,ITSG-33|AC-17,LEVEL|1S,SWIFT-CSCv1|5.1" see_also : "https://workbench.cisecurity.org/files/2485" file : "/etc/ssh/sshd_config" regex : "^[\\s]*PermitRootLogin[\\s]" expect : "^[\\s]*PermitRootLogin[\\s]+no[\\s]*$" system : "Linux" type : FILE_CONTENT_CHECK description : "5.2.11 Ensure SSH PermitEmptyPasswords is disabled" info : "The PermitEmptyPasswords parameter specifies if the SSH server allows login to accounts with empty password strings. Rationale: Disallowing remote shell access to accounts that have an empty password reduces the probability of unauthorized access to the system" solution : "Edit the /etc/ssh/sshd_config file to set the parameter as follows: PermitEmptyPasswords no Default Value: PermitEmptyPasswords no" reference : "800-171|3.5.2,800-53|IA-5,CSCv7|16.3,CSF|PR.AC-1,ITSG-33|IA-5,LEVEL|1S,NESA|T5.2.3" see_also : "https://workbench.cisecurity.org/files/2485" file : "/etc/ssh/sshd_config" regex : "^[\\s]*PermitEmptyPasswords[\\s]" expect : "^[\\s]*PermitEmptyPasswords[\\s]+no[\\s]*$" system : "Linux" type : FILE_CONTENT_CHECK description : "5.2.12 Ensure SSH PermitUserEnvironment is disabled" info : "The PermitUserEnvironment option allows users to present environment options to the ssh daemon. Rationale: Permitting users the ability to set environment variables through the SSH daemon could potentially allow users to bypass security controls (e.g. setting an execution path that has ssh executing trojan'd programs)" solution : "Edit the /etc/ssh/sshd_config file to set the parameter as follows: PermitUserEnvironment no Default Value: PermitUserEnvironment no" reference : "800-171|3.4.2,800-53|CM-6,CSCv7|5.1,CSF|PR.IP-1,ITSG-33|CM-6,LEVEL|1S,NESA|T3.2.1,PCI-DSSv3.1|2.2.4,PCI-DSSv3.2|2.2.4,SWIFT-CSCv1|2.3" see_also : "https://workbench.cisecurity.org/files/2485" file : "/etc/ssh/sshd_config" regex : "^[\\s]*PermitUserEnvironment[\\s]" expect : "^[\\s]*PermitUserEnvironment[\\s]+no[\\s]*$" system : "Linux" type : FILE_CONTENT_CHECK description : "5.2.13 Ensure SSH Idle Timeout Interval is configured - ClientAliveInterval" info : "The two options ClientAliveInterval and ClientAliveCountMax control the timeout of ssh sessions. When the ClientAliveInterval variable is set, ssh sessions that have no activity for the specified length of time are terminated. When the ClientAliveCountMax variable is set, sshd will send client alive messages at every ClientAliveInterval interval. When the number of consecutive client alive messages are sent with no response from the client, the ssh session is terminated. For example, if the ClientAliveInterval is set to 15 seconds and the ClientAliveCountMax is set to 3, the client ssh session will be terminated after 45 seconds of idle time. Rationale: Having no timeout value associated with a connection could allow an unauthorized user access to another user's ssh session (e.g. user walks away from their computer and doesn't lock the screen). Setting a timeout value at least reduces the risk of this happening.. While the recommended setting is 1800 seconds (15 minutes), set this timeout value based on site policy. The recommended setting for ClientAliveCountMax is 0. In this case, the client session will be terminated after 15 minutes of idle time and no keepalive messages will be sent." solution : "Edit the /etc/ssh/sshd_config file to set the parameters according to site policy: ClientAliveInterval 1800 ClientAliveCountMax 0 Default Value: ClientAliveInterval 1800 ClientAliveCountMax 0" reference : "800-171|3.1.11,800-53|AC-12,CN-L3|7.1.2.2(d),CN-L3|7.1.3.7(b),CSCv7|16.11,HIPAA|164.312(a)(2)(iii),ITSG-33|AC-12,LEVEL|1S,NIAv2|NS49,PCI-DSSv3.1|12.3.8,PCI-DSSv3.1|8.1.8,PCI-DSSv3.2|12.3.8,PCI-DSSv3.2|8.1.8" see_also : "https://workbench.cisecurity.org/files/2485" file : "/etc/ssh/sshd_config" regex : "^[\\s]*ClientAliveInterval[\\s]" expect : "^[\\s]*ClientAliveInterval[\\s]+([1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-7][0-9][0-9][0-9]|1800)[\\s]*$" system : "Linux" type : FILE_CONTENT_CHECK description : "5.2.13 Ensure SSH Idle Timeout Interval is configured - ClientAliveCountMax" info : "The two options ClientAliveInterval and ClientAliveCountMax control the timeout of ssh sessions. When the ClientAliveInterval variable is set, ssh sessions that have no activity for the specified length of time are terminated. When the ClientAliveCountMax variable is set, sshd will send client alive messages at every ClientAliveInterval interval. When the number of consecutive client alive messages are sent with no response from the client, the ssh session is terminated. For example, if the ClientAliveInterval is set to 15 seconds and the ClientAliveCountMax is set to 3, the client ssh session will be terminated after 45 seconds of idle time. Rationale: Having no timeout value associated with a connection could allow an unauthorized user access to another user's ssh session (e.g. user walks away from their computer and doesn't lock the screen). Setting a timeout value at least reduces the risk of this happening.. While the recommended setting is 300 seconds (5 minutes), set this timeout value based on site policy. The recommended setting for ClientAliveCountMax is 0. In this case, the client session will be terminated after 5 minutes of idle time and no keepalive messages will be sent." solution : "Edit the /etc/ssh/sshd_config file to set the parameters according to site policy: ClientAliveInterval 1800 ClientAliveCountMax 0 Default Value: ClientAliveInterval 1800 ClientAliveCountMax 0" reference : "800-171|3.1.11,800-53|AC-12,CN-L3|7.1.2.2(d),CN-L3|7.1.3.7(b),CSCv7|16.11,HIPAA|164.312(a)(2)(iii),ITSG-33|AC-12,LEVEL|1S,NIAv2|NS49,PCI-DSSv3.1|12.3.8,PCI-DSSv3.1|8.1.8,PCI-DSSv3.2|12.3.8,PCI-DSSv3.2|8.1.8" see_also : "https://workbench.cisecurity.org/files/2485" file : "/etc/ssh/sshd_config" regex : "^[\\s]*ClientAliveCountMax[\\s]" expect : "^[\\s]*ClientAliveCountMax[\\s]+[1-3][\\s]*$" system : "Linux" type : FILE_CONTENT_CHECK description : "5.2.14 Ensure SSH LoginGraceTime is set to one minute or less" info : "The LoginGraceTime parameter specifies the time allowed for successful authentication to the SSH server. The longer the Grace period is the more open unauthenticated connections can exist. Like other session controls in this session the Grace Period should be limited to appropriate organizational limits to ensure the service is available for needed access. Rationale: Setting the LoginGraceTime parameter to a low number will minimize the risk of successful brute force attacks to the SSH server. It will also limit the number of concurrent unauthenticated connections While the recommended setting is 60 seconds (1 Minute), set the number based on site policy." solution : "Edit the /etc/ssh/sshd_config file to set the parameter as follows: LoginGraceTime 60 Default Value: LoginGraceTime 120" reference : "800-171|3.1.11,800-53|AC-12,CN-L3|7.1.2.2(d),CN-L3|7.1.3.7(b),CSCv7|5.1,HIPAA|164.312(a)(2)(iii),ITSG-33|AC-12,LEVEL|1S,NIAv2|NS49,PCI-DSSv3.1|12.3.8,PCI-DSSv3.1|8.1.8,PCI-DSSv3.2|12.3.8,PCI-DSSv3.2|8.1.8" see_also : "https://workbench.cisecurity.org/files/2485" file : "/etc/ssh/sshd_config" regex : "^[\\s]*LoginGraceTime[\\s]" expect : "^[\\s]*LoginGraceTime[\\s]+([1-9]|[1-5][0-9]|60)[\\s]*$" system : "Linux" type : FILE_CONTENT_CHECK description : "5.2.15 Ensure SSH warning banner is configured" info : "The Banner parameter specifies a file whose contents must be sent to the remote user before authentication is permitted. By default, no banner is displayed. Rationale: Banners are used to warn connecting users of the particular site's policy regarding connection. Presenting a warning message prior to the normal user login may assist the prosecution of trespassers on the computer system." solution : "Edit the /etc/ssh/sshd_config file to set the parameter as follows: Banner /etc/issue.net" reference : "800-171|3.1.9,800-53|AC-8,CSCv7|5.1,ITSG-33|AC-8,LEVEL|1S,NESA|M1.3.6,NESA|M5.2.5,NESA|T5.5.1,NIAv2|AM10a,NIAv2|AM10b,NIAv2|AM10c,NIAv2|AM10d,NIAv2|AM10e" see_also : "https://workbench.cisecurity.org/files/2485" file : "/etc/ssh/sshd_config" regex : "^[\\s]*Banner[\\s]" expect : "^[\\s]*Banner[\\s]+/etc/issue\\.net[\\s]*$" system : "Linux" type : CMD_EXEC description : "5.2.16 Ensure SSH PAM is enabled" info : "UsePAM Enables the Pluggable Authentication Module interface. If set to \"yes\" this will enable PAM authentication using ChallengeResponseAuthentication and PasswordAuthentication in addition to PAM account and session module processing for all authentication types Rationale: When usePAM is set to yes, PAM runs through account and session types properly. This is important if you want to restrict access to services based off of IP, time or other factors of the account. Additionally, you can make sure users inherit certain environment variables on login or disallow access to the server" solution : "Edit the /etc/ssh/sshd_config file to set the parameter as follows: UsePAM yes Impact: If UsePAM is enabled, you will not be able to run sshd(8) as a non-root user. Default Value: usePAM yes" reference : "800-171|3.1.1,800-53|AC-3,CN-L3|7.1.2.2(g),CN-L3|7.1.3.2(c),CSCv7|5.1,CSF|PR.AC-4,CSF|PR.PT-3,LEVEL|1S" see_also : "https://workbench.cisecurity.org/files/2485" cmd : "/usr/sbin/sshd -T | /usr/bin/grep usepam | /usr/bin/awk '{print} END {if (NR == 0) print \"fail\"}'" expect : "^[\\s]*usepam[\\s]+yes[\\s]*$" system : "Linux" type : CMD_EXEC description : "5.2.18 Ensure SSH MaxStartups is configured" info : "The MaxStartups parameter specifies the maximum number of concurrent unauthenticated connections to the SSH daemon. Rationale: To protect a system from denial of service due to a large number of pending authentication connection attempts, use the rate limiting function of MaxStartups to protect availability of sshd logins and prevent overwhelming the daemon." solution : "Edit the /etc/ssh/sshd_config file to set the parameter as follows: maxstartups 10:30:60" reference : "800-53|AC-10,CSCv7|5.1,ITSG-33|AC-10,LEVEL|1S,NESA|T5.5.1" see_also : "https://workbench.cisecurity.org/files/2485" cmd : "/usr/sbin/sshd -T | /usr/bin/grep maxstartups | /usr/bin/awk '{print} END {if (NR == 0) print \"fail\"}'" # Note: Variable @MAX_START_UP@ replaced with "10:30:100" in field "expect". expect : "^[\\s]*maxstartups[\\s]+10:30:100[\\s]*$" system : "Linux" type : CMD_EXEC description : "5.2.19 Ensure SSH MaxSessions is set to 4 or less" info : "The MaxSessions parameter specifies the maximum number of open sessions permitted from a given connection. Rationale: To protect a system from denial of service due to a large number of concurrent sessions, use the rate limiting function of MaxSessions to protect availability of sshd logins and prevent overwhelming the daemon." solution : "Edit the /etc/ssh/sshd_config file to set the parameter as follows: MaxSessions 4" reference : "800-53|AC-10,CSCv7|5.1,ITSG-33|AC-10,LEVEL|1S,NESA|T5.5.1" see_also : "https://workbench.cisecurity.org/files/2485" cmd : "/usr/sbin/sshd -T | /usr/bin/grep maxsessions | /usr/bin/awk '{print} END {if (NR == 0) print \"fail\"}'" # Note: Variable @MAX_SESSIONS@ replaced with "10" in field "expect". expect : "^[\\s]*maxsessions[\\s]+10[\\s]*$" system : "Linux" type : CMD_EXEC description : "5.2.20 Ensure system-wide crypto policy is not over-ridden" info : "System-wide Crypto policy can be over-ridden or opted out of for openSSH Rationale: Over-riding or opting out of the system-wide crypto policy could allow for the use of less secure Ciphers, MACs, KexAlgoritms and GSSAPIKexAlgorithsm" solution : "Run the following commands: # sed -ri \"s/^\s*(CRYPTO_POLICY\s*=.*)$/# \1/\" /etc/sysconfig/sshd # systemctl reload sshd" reference : "800-171|3.13.11,800-53|SC-13,CSCv7|14.4,CSF|PR.DS-5,ITSG-33|SC-13,LEVEL|1S,NESA|M5.2.6,NESA|T7.4.1,NIAv2|CY3,NIAv2|CY4,NIAv2|CY5b,NIAv2|CY5c,NIAv2|CY5d,NIAv2|CY7,NIAv2|NS5e" see_also : "https://workbench.cisecurity.org/files/2485" cmd : "/usr/bin/grep '^[[:space:]]*CRYPTO_POLICY=' /etc/sysconfig/sshd | /usr/bin/awk '{print} END {if (NR == 0) print \"pass\" ; else print \"fail\"}'" expect : "^pass$" system : "Linux" type : CMD_EXEC description : "5.3.1 Create custom authselect profile" info : "A custom profile can be created by copying and customizing one of the default profiles. The default profiles include: sssd, winbind, or the nis. Rationale: A custom profile is required to customize many of the pam options" solution : "Run the following command to create a custom authselect profile: # authselect create-profile -b Example: # authselect create-profile custom-profile -b sssd --symlink-meta" reference : "800-171|3.5.1,800-53|IA-2,CN-L3|7.1.3.1(a),CN-L3|7.1.3.1(e),CSCv7|5.1,CSF|PR.AC-1,ITSG-33|IA-2,LEVEL|1S,NESA|T2.3.8,NESA|T5.3.1,NESA|T5.4.2,NESA|T5.5.1,NESA|T5.5.2,NESA|T5.5.3,NIAv2|AM14b,NIAv2|AM2,NIAv2|AM8" see_also : "https://workbench.cisecurity.org/files/2485" cmd : "/usr/bin/authselect current | /usr/bin/grep 'Profile[[:space:]]*ID:'" # Note: Variable @CUSTOM_PROFILE@ replaced with "sssd" in field "expect". expect : "^[\\s]*Profile[\\s]*ID:[\\s]*sssd[\\s]*$" system : "Linux" type : CMD_EXEC description : "5.3.2 Select authselect profile" info : "You can select a profile for the authselect utility for a specific host. The profile will be applied to every user logging into the host. You can create and deploy a custom profile by customizing one of the default profiles, the sssd, winbind, or the nis profile. Rationale: When you deploy a profile, the profile is applied to every user logging into the given host NOTE: Nessus has provided the target output to assist in reviewing the benchmark to ensure target compliance." solution : "Run the following command to select a custom authselect profile # authselect select custom/ {with-} Example: # authselect select custom/custom-profile with-sudo with-faillock without-nullok" reference : "800-171|3.5.1,800-53|IA-2,CN-L3|7.1.3.1(a),CN-L3|7.1.3.1(e),CSCv7|16,CSF|PR.AC-1,ITSG-33|IA-2,LEVEL|1S,NESA|T2.3.8,NESA|T5.3.1,NESA|T5.4.2,NESA|T5.5.1,NESA|T5.5.2,NESA|T5.5.3,NIAv2|AM14b,NIAv2|AM2,NIAv2|AM8" see_also : "https://workbench.cisecurity.org/files/2485" cmd : "/usr/bin/authselect current" expect : "" severity : MEDIUM system : "Linux" type : CMD_EXEC description : "5.3.3 Ensure authselect includes with-faillock - 'authselect'" info : "The pam_faillock.so module maintains a list of failed authentication attempts per user during a specified interval and locks the account in case there were more than deny consecutive failed authentications. It stores the failure records into per-user files in the tally directory Rationale: Locking out user IDs after n unsuccessful consecutive login attempts mitigates brute force password attacks against your systems." solution : "Run the following command to include the with-faillock option # authselect select with-faillock Example: # authselect select custom/custom-profile with-sudo with-faillock without-nullok" reference : "800-171|3.5.1,800-53|IA-2,CN-L3|7.1.3.1(a),CN-L3|7.1.3.1(e),CSCv7|16.7,CSF|PR.AC-1,ITSG-33|IA-2,LEVEL|1S,NESA|T2.3.8,NESA|T5.3.1,NESA|T5.4.2,NESA|T5.5.1,NESA|T5.5.2,NESA|T5.5.3,NIAv2|AM14b,NIAv2|AM2,NIAv2|AM8" see_also : "https://workbench.cisecurity.org/files/2485" cmd : "/usr/bin/authselect current | /usr/bin/grep with-faillock" expect : "^[\\s]*-[\\s]*with-faillock[\\s]*$" system : "Linux" type : CMD_EXEC description : "5.3.3 Ensure authselect includes with-faillock - 'authselect.conf'" info : "The pam_faillock.so module maintains a list of failed authentication attempts per user during a specified interval and locks the account in case there were more than deny consecutive failed authentications. It stores the failure records into per-user files in the tally directory Rationale: Locking out user IDs after n unsuccessful consecutive login attempts mitigates brute force password attacks against your systems." solution : "Run the following command to include the with-faillock option # authselect select with-faillock Example: # authselect select custom/custom-profile with-sudo with-faillock without-nullok" reference : "800-171|3.1.8,800-53|AC-7,CSCv7|16.7,ITSG-33|AC-7,LEVEL|1S,NESA|T5.5.1,NIAv2|AM24,TBA-FIISB|45.1.2,TBA-FIISB|45.2.1,TBA-FIISB|45.2.2" see_also : "https://workbench.cisecurity.org/files/2485" cmd : "/usr/bin/grep with-faillock /etc/authselect/authselect.conf" expect : "^[\\s]*with-faillock[\\s]*$" system : "Linux" type : FILE_CONTENT_CHECK description : "5.4.1 Ensure password creation requirements are configured - password-auth try_first_pass" info : "The pam_pwquality.so module checks the strength of passwords. It performs checks such as making sure a password is not a dictionary word, it is a certain length, contains a mix of characters (e.g. alphabet, numeric, other) and more. The following are definitions of the pam_pwquality.so options. try_first_pass - retrieve the password from a previous stacked PAM module. If not available, then prompt the user for a password. retry=3 - Allow 3 tries before sending back a failure. minlen-14 - password must be 14 characters or more ** Either of the following can be used to enforce complex passwords:** minclass=4 - provide at least four classes of characters for the new password OR dcredit=-1 - provide at least one digit ucredit=-1 - provide at least one uppercase character ocredit=-1 - provide at least one special character lcredit=-1 - provide at least one lowercase character The settings shown above are one possible policy. Alter these values to conform to your own organization's password policies Rationale: Strong passwords protect systems from being hacked through brute force methods." solution : "Edit the file /etc/security/pwquality.conf and add or modify the following line for password length to conform to site policy minlen = 14 Edit the file /etc/security/pwquality.conf and add or modify the following line for password complexity to conform to site policy minclass = 4 OR dcredit = -1 ucredit = -1 ocredit = -1 lcredit = -1 Run the following to update the system-auth and password-auth files CP=$(authselect current | awk 'NR == 1 {print $3}' | grep custom/) for FN in system-auth password-auth; do [[ -n $CP ]] && PTF=/etc/authselect/$CP/$FN || PTF=/etc/authselect/$FN [[ -z $(grep -E '^\s*password\s+requisite\s+pam_pwquality.so\s+.*enforce-for-root\s*.*$' $PTF) ]] && sed -ri 's/^\s*(password\s+requisite\s+pam_pwquality.so\s+)(.*)$/\1\2 enforce-for-root/' $PTF [[ -n $(grep -E '^\s*password\s+requisite\s+pam_pwquality.so\s+.*\s+retry=\S+\s*.*$' $PTF) ]] && sed -ri '/pwquality/s/retry=\S+/retry=3/' $PTF || sed -ri 's/^\s*(password\s+requisite\s+pam_pwquality.so\s+)(.*)$/\1\2 retry=3/' $PTF done authselect apply-changes Notes: all default authselect profiles have pam_pwquality enabled with the expectation that options will be specified in pwquality.conf" reference : "800-171|3.1.8,800-53|AC-7,CSCv7|4.4,ITSG-33|AC-7,LEVEL|1S,NESA|T5.5.1,NIAv2|AM24,TBA-FIISB|45.1.2,TBA-FIISB|45.2.1,TBA-FIISB|45.2.2" see_also : "https://workbench.cisecurity.org/files/2485" file : "/etc/pam.d/password-auth" regex : "^[\\s]*password[\\s]+requisite[\\s]+pam_pwquality\\.so[\\s]" # Note: Variable @TRY_FIRST_PASS@ replaced with "try_first_pass" in field "expect". expect : "try_first_pass" system : "Linux" type : FILE_CONTENT_CHECK description : "5.4.1 Ensure password creation requirements are configured - system-auth try_first_pass" info : "The pam_pwquality.so module checks the strength of passwords. It performs checks such as making sure a password is not a dictionary word, it is a certain length, contains a mix of characters (e.g. alphabet, numeric, other) and more. The following are definitions of the pam_pwquality.so options. try_first_pass - retrieve the password from a previous stacked PAM module. If not available, then prompt the user for a password. retry=3 - Allow 3 tries before sending back a failure. minlen=14 - password must be 14 characters or more ** Either of the following can be used to enforce complex passwords:** minclass=4 - provide at least four classes of characters for the new password OR dcredit=-1 - provide at least one digit ucredit=-1 - provide at least one uppercase character ocredit=-1 - provide at least one special character lcredit=-1 - provide at least one lowercase character The settings shown above are one possible policy. Alter these values to conform to your own organization's password policies Rationale: Strong passwords protect systems from being hacked through brute force methods." solution : "Edit the file /etc/security/pwquality.conf and add or modify the following line for password length to conform to site policy minlen = 14 Edit the file /etc/security/pwquality.conf and add or modify the following line for password complexity to conform to site policy minclass = 4 OR dcredit = -1 ucredit = -1 ocredit = -1 lcredit = -1 Run the following to update the system-auth and password-auth files CP=$(authselect current | awk 'NR == 1 {print $3}' | grep custom/) for FN in system-auth password-auth; do [[ -n $CP ]] && PTF=/etc/authselect/$CP/$FN || PTF=/etc/authselect/$FN [[ -z $(grep -E '^\s*password\s+requisite\s+pam_pwquality.so\s+.*enforce-for-root\s*.*$' $PTF) ]] && sed -ri 's/^\s*(password\s+requisite\s+pam_pwquality.so\s+)(.*)$/\1\2 enforce-for-root/' $PTF [[ -n $(grep -E '^\s*password\s+requisite\s+pam_pwquality.so\s+.*\s+retry=\S+\s*.*$' $PTF) ]] && sed -ri '/pwquality/s/retry=\S+/retry=3/' $PTF || sed -ri 's/^\s*(password\s+requisite\s+pam_pwquality.so\s+)(.*)$/\1\2 retry=3/' $PTF done authselect apply-changes Notes: all default authselect profiles have pam_pwquality enabled with the expectation that options will be specified in pwquality.conf" reference : "800-53|IA-5,CSCv7|4.4,CSF|PR.AC-1,LEVEL|1S" see_also : "https://workbench.cisecurity.org/files/2485" file : "/etc/pam.d/system-auth" regex : "^[\\s]*password[\\s]+requisite[\\s]+pam_pwquality\\.so[\\s]" # Note: Variable @TRY_FIRST_PASS@ replaced with "try_first_pass" in field "expect". expect : "try_first_pass" system : "Linux" type : FILE_CONTENT_CHECK description : "5.4.1 Ensure password creation requirements are configured - password-auth retry=3" info : "The pam_pwquality.so module checks the strength of passwords. It performs checks such as making sure a password is not a dictionary word, it is a certain length, contains a mix of characters (e.g. alphabet, numeric, other) and more. The following are definitions of the pam_pwquality.so options. try_first_pass - retrieve the password from a previous stacked PAM module. If not available, then prompt the user for a password. retry=3 - Allow 3 tries before sending back a failure. minlen=14 - password must be 14 characters or more ** Either of the following can be used to enforce complex passwords:** minclass=4 - provide at least four classes of characters for the new password OR dcredit=-1 - provide at least one digit ucredit=-1 - provide at least one uppercase character ocredit=-1 - provide at least one special character lcredit=-1 - provide at least one lowercase character The settings shown above are one possible policy. Alter these values to conform to your own organization's password policies Rationale: Strong passwords protect systems from being hacked through brute force methods." solution : "Edit the file /etc/security/pwquality.conf and add or modify the following line for password length to conform to site policy minlen = 14 Edit the file /etc/security/pwquality.conf and add or modify the following line for password complexity to conform to site policy minclass = 4 OR dcredit = -1 ucredit = -1 ocredit = -1 lcredit = -1 Run the following to update the system-auth and password-auth files CP=$(authselect current | awk 'NR == 1 {print $3}' | grep custom/) for FN in system-auth password-auth; do [[ -n $CP ]] && PTF=/etc/authselect/$CP/$FN || PTF=/etc/authselect/$FN [[ -z $(grep -E '^\s*password\s+requisite\s+pam_pwquality.so\s+.*enforce-for-root\s*.*$' $PTF) ]] && sed -ri 's/^\s*(password\s+requisite\s+pam_pwquality.so\s+)(.*)$/\1\2 enforce-for-root/' $PTF [[ -n $(grep -E '^\s*password\s+requisite\s+pam_pwquality.so\s+.*\s+retry=\S+\s*.*$' $PTF) ]] && sed -ri '/pwquality/s/retry=\S+/retry=3/' $PTF || sed -ri 's/^\s*(password\s+requisite\s+pam_pwquality.so\s+)(.*)$/\1\2 retry=3/' $PTF done authselect apply-changes Notes: all default authselect profiles have pam_pwquality enabled with the expectation that options will be specified in pwquality.conf" reference : "800-171|3.1.8,800-53|AC-7,CSCv7|4.4,ITSG-33|AC-7,LEVEL|1S,NESA|T5.5.1,NIAv2|AM24,TBA-FIISB|45.1.2,TBA-FIISB|45.2.1,TBA-FIISB|45.2.2" see_also : "https://workbench.cisecurity.org/files/2485" file : "/etc/pam.d/password-auth" regex : "^[\\s]*password[\\s]+requisite[\\s]+pam_pwquality\\.so[\\s]" # Note: Variable @PW_RETRY@ replaced with "[1-3]" in field "expect". expect : "[\\s]+retry[\\s]*=[\\s]*[1-3]" system : "Linux" type : FILE_CONTENT_CHECK description : "5.4.1 Ensure password creation requirements are configured - system-auth retry=3" info : "The pam_pwquality.so module checks the strength of passwords. It performs checks such as making sure a password is not a dictionary word, it is a certain length, contains a mix of characters (e.g. alphabet, numeric, other) and more. The following are definitions of the pam_pwquality.so options. try_first_pass - retrieve the password from a previous stacked PAM module. If not available, then prompt the user for a password. retry=3 - Allow 3 tries before sending back a failure. minlen=14 - password must be 14 characters or more ** Either of the following can be used to enforce complex passwords:** minclass=4 - provide at least four classes of characters for the new password OR dcredit=-1 - provide at least one digit ucredit=-1 - provide at least one uppercase character ocredit=-1 - provide at least one special character lcredit=-1 - provide at least one lowercase character The settings shown above are one possible policy. Alter these values to conform to your own organization's password policies Rationale: Strong passwords protect systems from being hacked through brute force methods." solution : "Edit the file /etc/security/pwquality.conf and add or modify the following line for password length to conform to site policy minlen = 14 Edit the file /etc/security/pwquality.conf and add or modify the following line for password complexity to conform to site policy minclass = 4 OR dcredit = -1 ucredit = -1 ocredit = -1 lcredit = -1 Run the following to update the system-auth and password-auth files CP=$(authselect current | awk 'NR == 1 {print $3}' | grep custom/) for FN in system-auth password-auth; do [[ -n $CP ]] && PTF=/etc/authselect/$CP/$FN || PTF=/etc/authselect/$FN [[ -z $(grep -E '^\s*password\s+requisite\s+pam_pwquality.so\s+.*enforce-for-root\s*.*$' $PTF) ]] && sed -ri 's/^\s*(password\s+requisite\s+pam_pwquality.so\s+)(.*)$/\1\2 enforce-for-root/' $PTF [[ -n $(grep -E '^\s*password\s+requisite\s+pam_pwquality.so\s+.*\s+retry=\S+\s*.*$' $PTF) ]] && sed -ri '/pwquality/s/retry=\S+/retry=3/' $PTF || sed -ri 's/^\s*(password\s+requisite\s+pam_pwquality.so\s+)(.*)$/\1\2 retry=3/' $PTF done authselect apply-changes Notes: all default authselect profiles have pam_pwquality enabled with the expectation that options will be specified in pwquality.conf" reference : "800-171|3.1.8,800-53|AC-7,CSCv7|4.4,ITSG-33|AC-7,LEVEL|1S,NESA|T5.5.1,NIAv2|AM24,TBA-FIISB|45.1.2,TBA-FIISB|45.2.1,TBA-FIISB|45.2.2" see_also : "https://workbench.cisecurity.org/files/2485" file : "/etc/pam.d/system-auth" regex : "^[\\s]*password[\\s]+requisite[\\s]+pam_pwquality\\.so[\\s]" # Note: Variable @PW_RETRY@ replaced with "[1-3]" in field "expect". expect : "[\\s]+retry[\\s]*=[\\s]*[1-3]" system : "Linux" type : FILE_CONTENT_CHECK description : "5.4.1 Ensure password creation requirements are configured - minlen" info : "The pam_pwquality.so module checks the strength of passwords. It performs checks such as making sure a password is not a dictionary word, it is a certain length, contains a mix of characters (e.g. alphabet, numeric, other) and more. The following are definitions of the pam_pwquality.so options. try_first_pass - retrieve the password from a previous stacked PAM module. If not available, then prompt the user for a password. retry=3 - Allow 3 tries before sending back a failure. minlen=14 - password must be 14 characters or more ** Either of the following can be used to enforce complex passwords:** minclass=4 - provide at least four classes of characters for the new password OR dcredit=-1 - provide at least one digit ucredit=-1 - provide at least one uppercase character ocredit=-1 - provide at least one special character lcredit=-1 - provide at least one lowercase character The settings shown above are one possible policy. Alter these values to conform to your own organization's password policies Rationale: Strong passwords protect systems from being hacked through brute force methods." solution : "Edit the file /etc/security/pwquality.conf and add or modify the following line for password length to conform to site policy minlen = 14 Edit the file /etc/security/pwquality.conf and add or modify the following line for password complexity to conform to site policy minclass = 4 OR dcredit = -1 ucredit = -1 ocredit = -1 lcredit = -1 Run the following to update the system-auth and password-auth files CP=$(authselect current | awk 'NR == 1 {print $3}' | grep custom/) for FN in system-auth password-auth; do [[ -n $CP ]] && PTF=/etc/authselect/$CP/$FN || PTF=/etc/authselect/$FN [[ -z $(grep -E '^\s*password\s+requisite\s+pam_pwquality.so\s+.*enforce-for-root\s*.*$' $PTF) ]] && sed -ri 's/^\s*(password\s+requisite\s+pam_pwquality.so\s+)(.*)$/\1\2 enforce-for-root/' $PTF [[ -n $(grep -E '^\s*password\s+requisite\s+pam_pwquality.so\s+.*\s+retry=\S+\s*.*$' $PTF) ]] && sed -ri '/pwquality/s/retry=\S+/retry=3/' $PTF || sed -ri 's/^\s*(password\s+requisite\s+pam_pwquality.so\s+)(.*)$/\1\2 retry=3/' $PTF done authselect apply-changes Notes: all default authselect profiles have pam_pwquality enabled with the expectation that options will be specified in pwquality.conf" reference : "800-171|3.5.7,800-53|IA-5,CIP|007-6-R5,CN-L3|7.1.2.7(e),CN-L3|7.1.3.1(b),CSCv7|4.4,CSF|PR.AC-1,HIPAA|164.308(a)(5)(ii)(D),ISO/IEC-27001|A.9.4.3,ITSG-33|IA-5,LEVEL|1S,NESA|T5.2.3,NIAv2|AM19a,NIAv2|AM19b,NIAv2|AM19c,NIAv2|AM19d,NIAv2|AM22a,PCI-DSSv3.1|8.2.3,PCI-DSSv3.2|8.2.3,SWIFT-CSCv1|4.1,TBA-FIISB|26.2.1,TBA-FIISB|26.2.4" see_also : "https://workbench.cisecurity.org/files/2485" file : "/etc/security/pwquality.conf" regex : "^[\\s]*minlen[\\s]*=" # Note: Variable @PW_MINLEN@ replaced with "(1[4-9]|[2-9][0-9])" in field "expect". expect : "^[\\s]*minlen[\\s]*=[\\s]*(1[4-9]|[2-9][0-9])[\\s]*$" system : "Linux" type : FILE_CONTENT_CHECK description : "5.4.1 Ensure password creation requirements are configured - dcredit" info : "The pam_pwquality.so module checks the strength of passwords. It performs checks such as making sure a password is not a dictionary word, it is a certain length, contains a mix of characters (e.g. alphabet, numeric, other) and more. The following are definitions of the pam_pwquality.so options. try_first_pass - retrieve the password from a previous stacked PAM module. If not available, then prompt the user for a password. retry=3 - Allow 3 tries before sending back a failure. minlen=14 - password must be 14 characters or more ** Either of the following can be used to enforce complex passwords:** minclass=4 - provide at least four classes of characters for the new password OR dcredit=-1 - provide at least one digit ucredit=-1 - provide at least one uppercase character ocredit=-1 - provide at least one special character lcredit=-1 - provide at least one lowercase character The settings shown above are one possible policy. Alter these values to conform to your own organization's password policies Rationale: Strong passwords protect systems from being hacked through brute force methods." solution : "Edit the file /etc/security/pwquality.conf and add or modify the following line for password length to conform to site policy minlen = 14 Edit the file /etc/security/pwquality.conf and add or modify the following line for password complexity to conform to site policy minclass = 4 OR dcredit = -1 ucredit = -1 ocredit = -1 lcredit = -1 Run the following to update the system-auth and password-auth files CP=$(authselect current | awk 'NR == 1 {print $3}' | grep custom/) for FN in system-auth password-auth; do [[ -n $CP ]] && PTF=/etc/authselect/$CP/$FN || PTF=/etc/authselect/$FN [[ -z $(grep -E '^\s*password\s+requisite\s+pam_pwquality.so\s+.*enforce-for-root\s*.*$' $PTF) ]] && sed -ri 's/^\s*(password\s+requisite\s+pam_pwquality.so\s+)(.*)$/\1\2 enforce-for-root/' $PTF [[ -n $(grep -E '^\s*password\s+requisite\s+pam_pwquality.so\s+.*\s+retry=\S+\s*.*$' $PTF) ]] && sed -ri '/pwquality/s/retry=\S+/retry=3/' $PTF || sed -ri 's/^\s*(password\s+requisite\s+pam_pwquality.so\s+)(.*)$/\1\2 retry=3/' $PTF done authselect apply-changes Notes: all default authselect profiles have pam_pwquality enabled with the expectation that options will be specified in pwquality.conf" reference : "800-171|3.5.7,800-53|IA-5,CIP|007-6-R5,CN-L3|7.1.2.7(e),CN-L3|7.1.3.1(b),CSCv7|4.4,CSF|PR.AC-1,HIPAA|164.308(a)(5)(ii)(D),ISO/IEC-27001|A.9.4.3,ITSG-33|IA-5,LEVEL|1S,NESA|T5.2.3,NIAv2|AM19a,NIAv2|AM19b,NIAv2|AM19c,NIAv2|AM19d,NIAv2|AM22a,PCI-DSSv3.1|8.2.3,PCI-DSSv3.2|8.2.3,SWIFT-CSCv1|4.1,TBA-FIISB|26.2.1,TBA-FIISB|26.2.4" see_also : "https://workbench.cisecurity.org/files/2485" file : "/etc/security/pwquality.conf" regex : "^[\\s]*dcredit[\\s]*=" # Note: Variable @PW_DCREDIT@ replaced with "-1" in field "expect". expect : "^[\\s]*dcredit[\\s]*=[\\s]*-1[\\s]*$" system : "Linux" type : FILE_CONTENT_CHECK description : "5.4.1 Ensure password creation requirements are configured - ucredit" info : "The pam_pwquality.so module checks the strength of passwords. It performs checks such as making sure a password is not a dictionary word, it is a certain length, contains a mix of characters (e.g. alphabet, numeric, other) and more. The following are definitions of the pam_pwquality.so options. try_first_pass - retrieve the password from a previous stacked PAM module. If not available, then prompt the user for a password. retry=3 - Allow 3 tries before sending back a failure. minlen=14 - password must be 14 characters or more ** Either of the following can be used to enforce complex passwords:** minclass=4 - provide at least four classes of characters for the new password OR dcredit=-1 - provide at least one digit ucredit=-1 - provide at least one uppercase character ocredit=-1 - provide at least one special character lcredit=-1 - provide at least one lowercase character The settings shown above are one possible policy. Alter these values to conform to your own organization's password policies Rationale: Strong passwords protect systems from being hacked through brute force methods." solution : "Edit the file /etc/security/pwquality.conf and add or modify the following line for password length to conform to site policy minlen = 14 Edit the file /etc/security/pwquality.conf and add or modify the following line for password complexity to conform to site policy minclass = 4 OR dcredit = -1 ucredit = -1 ocredit = -1 lcredit = -1 Run the following to update the system-auth and password-auth files CP=$(authselect current | awk 'NR == 1 {print $3}' | grep custom/) for FN in system-auth password-auth; do [[ -n $CP ]] && PTF=/etc/authselect/$CP/$FN || PTF=/etc/authselect/$FN [[ -z $(grep -E '^\s*password\s+requisite\s+pam_pwquality.so\s+.*enforce-for-root\s*.*$' $PTF) ]] && sed -ri 's/^\s*(password\s+requisite\s+pam_pwquality.so\s+)(.*)$/\1\2 enforce-for-root/' $PTF [[ -n $(grep -E '^\s*password\s+requisite\s+pam_pwquality.so\s+.*\s+retry=\S+\s*.*$' $PTF) ]] && sed -ri '/pwquality/s/retry=\S+/retry=3/' $PTF || sed -ri 's/^\s*(password\s+requisite\s+pam_pwquality.so\s+)(.*)$/\1\2 retry=3/' $PTF done authselect apply-changes Notes: all default authselect profiles have pam_pwquality enabled with the expectation that options will be specified in pwquality.conf" reference : "800-171|3.5.7,800-53|IA-5,CIP|007-6-R5,CN-L3|7.1.2.7(e),CN-L3|7.1.3.1(b),CSCv7|4.4,CSF|PR.AC-1,HIPAA|164.308(a)(5)(ii)(D),ISO/IEC-27001|A.9.4.3,ITSG-33|IA-5,LEVEL|1S,NESA|T5.2.3,NIAv2|AM19a,NIAv2|AM19b,NIAv2|AM19c,NIAv2|AM19d,NIAv2|AM22a,PCI-DSSv3.1|8.2.3,PCI-DSSv3.2|8.2.3,SWIFT-CSCv1|4.1,TBA-FIISB|26.2.1,TBA-FIISB|26.2.4" see_also : "https://workbench.cisecurity.org/files/2485" file : "/etc/security/pwquality.conf" regex : "^[\\s]*ucredit[\\s]*=" # Note: Variable @PW_UCREDIT@ replaced with "-1" in field "expect". expect : "^[\\s]*ucredit[\\s]*=[\\s]*-1[\\s]*$" system : "Linux" type : FILE_CONTENT_CHECK description : "5.4.1 Ensure password creation requirements are configured - ocredit" info : "The pam_pwquality.so module checks the strength of passwords. It performs checks such as making sure a password is not a dictionary word, it is a certain length, contains a mix of characters (e.g. alphabet, numeric, other) and more. The following are definitions of the pam_pwquality.so options. try_first_pass - retrieve the password from a previous stacked PAM module. If not available, then prompt the user for a password. retry=3 - Allow 3 tries before sending back a failure. minlen-14 - password must be 8 characters or more ** Either of the following can be used to enforce complex passwords:** minclass=4 - provide at least four classes of characters for the new password OR dcredit=-1 - provide at least one digit ucredit=-1 - provide at least one uppercase character ocredit=-1 - provide at least one special character lcredit=-1 - provide at least one lowercase character The settings shown above are one possible policy. Alter these values to conform to your own organization's password policies Rationale: Strong passwords protect systems from being hacked through brute force methods." solution : "Edit the file /etc/security/pwquality.conf and add or modify the following line for password length to conform to site policy minlen = 14 Edit the file /etc/security/pwquality.conf and add or modify the following line for password complexity to conform to site policy minclass = 4 OR dcredit = -1 ucredit = -1 ocredit = -1 lcredit = -1 Run the following to update the system-auth and password-auth files CP=$(authselect current | awk 'NR == 1 {print $3}' | grep custom/) for FN in system-auth password-auth; do [[ -n $CP ]] && PTF=/etc/authselect/$CP/$FN || PTF=/etc/authselect/$FN [[ -z $(grep -E '^\s*password\s+requisite\s+pam_pwquality.so\s+.*enforce-for-root\s*.*$' $PTF) ]] && sed -ri 's/^\s*(password\s+requisite\s+pam_pwquality.so\s+)(.*)$/\1\2 enforce-for-root/' $PTF [[ -n $(grep -E '^\s*password\s+requisite\s+pam_pwquality.so\s+.*\s+retry=\S+\s*.*$' $PTF) ]] && sed -ri '/pwquality/s/retry=\S+/retry=3/' $PTF || sed -ri 's/^\s*(password\s+requisite\s+pam_pwquality.so\s+)(.*)$/\1\2 retry=3/' $PTF done authselect apply-changes Notes: all default authselect profiles have pam_pwquality enabled with the expectation that options will be specified in pwquality.conf" reference : "800-171|3.5.7,800-53|IA-5,CIP|007-6-R5,CN-L3|7.1.2.7(e),CN-L3|7.1.3.1(b),CSCv7|4.4,CSF|PR.AC-1,HIPAA|164.308(a)(5)(ii)(D),ISO/IEC-27001|A.9.4.3,ITSG-33|IA-5,LEVEL|1S,NESA|T5.2.3,NIAv2|AM19a,NIAv2|AM19b,NIAv2|AM19c,NIAv2|AM19d,NIAv2|AM22a,PCI-DSSv3.1|8.2.3,PCI-DSSv3.2|8.2.3,SWIFT-CSCv1|4.1,TBA-FIISB|26.2.1,TBA-FIISB|26.2.4" see_also : "https://workbench.cisecurity.org/files/2485" file : "/etc/security/pwquality.conf" regex : "^[\\s]*ocredit[\\s]*=" # Note: Variable @PW_OCREDIT@ replaced with "-1" in field "expect". expect : "^[\\s]*ocredit[\\s]*=[\\s]*-1[\\s]*$" system : "Linux" type : FILE_CONTENT_CHECK description : "5.4.1 Ensure password creation requirements are configured - lcredit" info : "The pam_pwquality.so module checks the strength of passwords. It performs checks such as making sure a password is not a dictionary word, it is a certain length, contains a mix of characters (e.g. alphabet, numeric, other) and more. The following are definitions of the pam_pwquality.so options. try_first_pass - retrieve the password from a previous stacked PAM module. If not available, then prompt the user for a password. retry=3 - Allow 3 tries before sending back a failure. minlen=14 - password must be 14 characters or more ** Either of the following can be used to enforce complex passwords:** minclass=4 - provide at least four classes of characters for the new password OR dcredit=-1 - provide at least one digit ucredit=-1 - provide at least one uppercase character ocredit=-1 - provide at least one special character lcredit=-1 - provide at least one lowercase character The settings shown above are one possible policy. Alter these values to conform to your own organization's password policies Rationale: Strong passwords protect systems from being hacked through brute force methods." solution : "Edit the file /etc/security/pwquality.conf and add or modify the following line for password length to conform to site policy minlen = 14 Edit the file /etc/security/pwquality.conf and add or modify the following line for password complexity to conform to site policy minclass = 4 OR dcredit = -1 ucredit = -1 ocredit = -1 lcredit = -1 Run the following to update the system-auth and password-auth files CP=$(authselect current | awk 'NR == 1 {print $3}' | grep custom/) for FN in system-auth password-auth; do [[ -n $CP ]] && PTF=/etc/authselect/$CP/$FN || PTF=/etc/authselect/$FN [[ -z $(grep -E '^\s*password\s+requisite\s+pam_pwquality.so\s+.*enforce-for-root\s*.*$' $PTF) ]] && sed -ri 's/^\s*(password\s+requisite\s+pam_pwquality.so\s+)(.*)$/\1\2 enforce-for-root/' $PTF [[ -n $(grep -E '^\s*password\s+requisite\s+pam_pwquality.so\s+.*\s+retry=\S+\s*.*$' $PTF) ]] && sed -ri '/pwquality/s/retry=\S+/retry=3/' $PTF || sed -ri 's/^\s*(password\s+requisite\s+pam_pwquality.so\s+)(.*)$/\1\2 retry=3/' $PTF done authselect apply-changes Notes: all default authselect profiles have pam_pwquality enabled with the expectation that options will be specified in pwquality.conf" reference : "800-171|3.5.7,800-53|IA-5,CIP|007-6-R5,CN-L3|7.1.2.7(e),CN-L3|7.1.3.1(b),CSCv7|4.4,CSF|PR.AC-1,HIPAA|164.308(a)(5)(ii)(D),ISO/IEC-27001|A.9.4.3,ITSG-33|IA-5,LEVEL|1S,NESA|T5.2.3,NIAv2|AM19a,NIAv2|AM19b,NIAv2|AM19c,NIAv2|AM19d,NIAv2|AM22a,PCI-DSSv3.1|8.2.3,PCI-DSSv3.2|8.2.3,SWIFT-CSCv1|4.1,TBA-FIISB|26.2.1,TBA-FIISB|26.2.4" see_also : "https://workbench.cisecurity.org/files/2485" file : "/etc/security/pwquality.conf" regex : "^[\\s]*lcredit[\\s]*=" # Note: Variable @PW_LCREDIT@ replaced with "-1" in field "expect". expect : "^[\\s]*lcredit[\\s]*=[\\s]*-1[\\s]*$" system : "Linux" type : FILE_CONTENT_CHECK description : "5.4.2 Ensure lockout for failed password attempts is configured - system-auth 'auth required pam_faillock.so'" info : "Lock out users after n unsuccessful consecutive login attempts. deny= - Number of attempts before the account is locked unlock_time= - Time in seconds before the account is unlocked Set the lockout number and unlock time to follow local site policy. Rationale: Locking out user IDs after n unsuccessful consecutive login attempts mitigates brute force password attacks against your systems." solution : "Set password lockouts and unlock times to conform to site policy Run the following to update the system-auth and password-auth files. This script will update/add the deny=3 and unlock_time=900 options. This script should be modified as needed to follow local site policy. CP=$(authselect current | awk 'NR == 1 {print $3}' | grep custom/) for FN in system-auth password-auth; do [[ -n $CP ]] && PTF=/etc/authselect/$CP/$FN || PTF=/etc/authselect/$FN [[ -n $(grep -E '^\s*auth\s+required\s+pam_faillock.so\s+.*deny=\S+\s*.*$' $PTF) ]] && sed -ri '/pam_faillock.so/s/deny=\S+/deny=3/g' $PTF || sed -ri 's/^\^\s*(auth\s+required\s+pam_faillock\.so\s+)(.*[^{}])(\{.*\}|)$/\1\2 deny=3 \3/' $PTF [[ -n $(grep -E '^\s*auth\s+required\s+pam_faillock.so\s+.*unlock_time=\S+\s*.*$' $PTF) ]] && sed -ri '/pam_faillock.so/s/unlock_time=\S+/unlock_time=900/g' $PTF || sed -ri 's/^\s*(auth\s+required\s+pam_faillock\.so\s+)(.*[^{}])(\{.*\}|)$/\1\2 unlock_time=900 \3/' $PTF done authselect apply-changes Notes: Additional module options may be set, recommendation only covers those listed here. If a user has been locked out because they have reached the maximum consecutive failure count defined by deny= in the pam_faillock.so module, the user can be unlocked by issuing the command faillock -u --reset. This command sets the failed count to 0, effectively unlocking the user. Use of the \"audit\" keyword may log credentials in the case of user error during authentication. This risk should be evaluated in the context of the site policies of your organization." reference : "800-171|3.1.8,800-53|AC-7,CSCv7|16.7,ITSG-33|AC-7,LEVEL|1S,NESA|T5.5.1,NIAv2|AM24,TBA-FIISB|45.1.2,TBA-FIISB|45.2.1,TBA-FIISB|45.2.2" see_also : "https://workbench.cisecurity.org/files/2485" file : "/etc/pam.d/system-auth" regex : "^[\\s]*auth[\\s]+sufficient[\\s]+pam_faillock\\.so[\\s]*" expect : "^[\\s]*auth[\\s]+sufficient[\\s]+pam_faillock\\.so[\\s]+authsucc[\\s]+audit[\\s]+deny=3[\\s]+unlock_time=900[\\s]*$" system : "Linux" type : FILE_CONTENT_CHECK description : "5.4.2 Ensure lockout for failed password attempts is configured - system-auth 'auth [success=1 default=bad] pam_unix.so'" info : "Lock out users after n unsuccessful consecutive login attempts. deny= - Number of attempts before the account is locked unlock_time= - Time in seconds before the account is unlocked Set the lockout number and unlock time to follow local site policy. Rationale: Locking out user IDs after n unsuccessful consecutive login attempts mitigates brute force password attacks against your systems." solution : "Set password lockouts and unlock times to conform to site policy Run the following to update the system-auth and password-auth files. This script will update/add the deny=3 and unlock_time=900 options. This script should be modified as needed to follow local site policy. CP=$(authselect current | awk 'NR == 1 {print $3}' | grep custom/) for FN in system-auth password-auth; do [[ -n $CP ]] && PTF=/etc/authselect/$CP/$FN || PTF=/etc/authselect/$FN [[ -n $(grep -E '^\s*auth\s+required\s+pam_faillock.so\s+.*deny=\S+\s*.*$' $PTF) ]] && sed -ri '/pam_faillock.so/s/deny=\S+/deny=3/g' $PTF || sed -ri 's/^\^\s*(auth\s+required\s+pam_faillock\.so\s+)(.*[^{}])(\{.*\}|)$/\1\2 deny=3 \3/' $PTF [[ -n $(grep -E '^\s*auth\s+required\s+pam_faillock.so\s+.*unlock_time=\S+\s*.*$' $PTF) ]] && sed -ri '/pam_faillock.so/s/unlock_time=\S+/unlock_time=900/g' $PTF || sed -ri 's/^\s*(auth\s+required\s+pam_faillock\.so\s+)(.*[^{}])(\{.*\}|)$/\1\2 unlock_time=900 \3/' $PTF done authselect apply-changes Notes: Additional module options may be set, recommendation only covers those listed here. If a user has been locked out because they have reached the maximum consecutive failure count defined by deny= in the pam_faillock.so module, the user can be unlocked by issuing the command faillock -u --reset. This command sets the failed count to 0, effectively unlocking the user. Use of the \"audit\" keyword may log credentials in the case of user error during authentication. This risk should be evaluated in the context of the site policies of your organization." reference : "800-171|3.1.8,800-53|AC-7,CSCv7|16.7,ITSG-33|AC-7,LEVEL|1S,NESA|T5.5.1,NIAv2|AM24,TBA-FIISB|45.1.2,TBA-FIISB|45.2.1,TBA-FIISB|45.2.2" see_also : "https://workbench.cisecurity.org/files/2485" file : "/etc/pam.d/system-auth" regex : "^[\\s]*auth[\\s]+\\[success=1[\\s]+default=bad\\][\\s]*" expect : "^[\\s]*auth[\\s]+\\[success=1[\\s]+default=bad\\][\\s]+pam_unix\.so[\\s]*$" system : "Linux" type : FILE_CONTENT_CHECK description : "5.4.2 Ensure lockout for failed password attempts is configured - system-auth 'auth [default=die] pam_faillock.so'" info : "Lock out users after n unsuccessful consecutive login attempts. deny= - Number of attempts before the account is locked unlock_time= - Time in seconds before the account is unlocked Set the lockout number and unlock time to follow local site policy. Rationale: Locking out user IDs after n unsuccessful consecutive login attempts mitigates brute force password attacks against your systems." solution : "Set password lockouts and unlock times to conform to site policy Run the following to update the system-auth and password-auth files. This script will update/add the deny=3 and unlock_time=900 options. This script should be modified as needed to follow local site policy. CP=$(authselect current | awk 'NR == 1 {print $3}' | grep custom/) for FN in system-auth password-auth; do [[ -n $CP ]] && PTF=/etc/authselect/$CP/$FN || PTF=/etc/authselect/$FN [[ -n $(grep -E '^\s*auth\s+required\s+pam_faillock.so\s+.*deny=\S+\s*.*$' $PTF) ]] && sed -ri '/pam_faillock.so/s/deny=\S+/deny=3/g' $PTF || sed -ri 's/^\^\s*(auth\s+required\s+pam_faillock\.so\s+)(.*[^{}])(\{.*\}|)$/\1\2 deny=3 \3/' $PTF [[ -n $(grep -E '^\s*auth\s+required\s+pam_faillock.so\s+.*unlock_time=\S+\s*.*$' $PTF) ]] && sed -ri '/pam_faillock.so/s/unlock_time=\S+/unlock_time=900/g' $PTF || sed -ri 's/^\s*(auth\s+required\s+pam_faillock\.so\s+)(.*[^{}])(\{.*\}|)$/\1\2 unlock_time=900 \3/' $PTF done authselect apply-changes Notes: Additional module options may be set, recommendation only covers those listed here. If a user has been locked out because they have reached the maximum consecutive failure count defined by deny= in the pam_faillock.so module, the user can be unlocked by issuing the command faillock -u --reset. This command sets the failed count to 0, effectively unlocking the user. Use of the \"audit\" keyword may log credentials in the case of user error during authentication. This risk should be evaluated in the context of the site policies of your organization." reference : "800-171|3.1.8,800-53|AC-7,CSCv7|16.7,ITSG-33|AC-7,LEVEL|1S,NESA|T5.5.1,NIAv2|AM24,TBA-FIISB|45.1.2,TBA-FIISB|45.2.1,TBA-FIISB|45.2.2" see_also : "https://workbench.cisecurity.org/files/2485" file : "/etc/pam.d/system-auth" regex : "^[\\s]*auth[\\s]+\\[default=die\\][\\s]+pam_faillock\\.so[\\s]*" expect : "^[\\s]*auth[\\s]+\\[default=die\\][\\s]+pam_faillock\\.so[\\s]+authfail[\\s]+audit[\\s]+deny=3[\\s]+unlock_time=900[\\s]*$" system : "Linux" type : FILE_CONTENT_CHECK description : "5.4.2 Ensure lockout for failed password attempts is configured - system-auth 'auth sufficient pam_faillock.so'" info : "Lock out users after n unsuccessful consecutive login attempts. deny= - Number of attempts before the account is locked unlock_time= - Time in seconds before the account is unlocked Set the lockout number and unlock time to follow local site policy. Rationale: Locking out user IDs after n unsuccessful consecutive login attempts mitigates brute force password attacks against your systems." solution : "Set password lockouts and unlock times to conform to site policy Run the following to update the system-auth and password-auth files. This script will update/add the deny=3 and unlock_time=900 options. This script should be modified as needed to follow local site policy. CP=$(authselect current | awk 'NR == 1 {print $3}' | grep custom/) for FN in system-auth password-auth; do [[ -n $CP ]] && PTF=/etc/authselect/$CP/$FN || PTF=/etc/authselect/$FN [[ -n $(grep -E '^\s*auth\s+required\s+pam_faillock.so\s+.*deny=\S+\s*.*$' $PTF) ]] && sed -ri '/pam_faillock.so/s/deny=\S+/deny=3/g' $PTF || sed -ri 's/^\^\s*(auth\s+required\s+pam_faillock\.so\s+)(.*[^{}])(\{.*\}|)$/\1\2 deny=3 \3/' $PTF [[ -n $(grep -E '^\s*auth\s+required\s+pam_faillock.so\s+.*unlock_time=\S+\s*.*$' $PTF) ]] && sed -ri '/pam_faillock.so/s/unlock_time=\S+/unlock_time=900/g' $PTF || sed -ri 's/^\s*(auth\s+required\s+pam_faillock\.so\s+)(.*[^{}])(\{.*\}|)$/\1\2 unlock_time=900 \3/' $PTF done authselect apply-changes Notes: Additional module options may be set, recommendation only covers those listed here. If a user has been locked out because they have reached the maximum consecutive failure count defined by deny= in the pam_faillock.so module, the user can be unlocked by issuing the command faillock -u --reset. This command sets the failed count to 0, effectively unlocking the user. Use of the \"audit\" keyword may log credentials in the case of user error during authentication. This risk should be evaluated in the context of the site policies of your organization." reference : "800-171|3.1.8,800-53|AC-7,CSCv7|16.7,ITSG-33|AC-7,LEVEL|1S,NESA|T5.5.1,NIAv2|AM24,TBA-FIISB|45.1.2,TBA-FIISB|45.2.1,TBA-FIISB|45.2.2" see_also : "https://workbench.cisecurity.org/files/2485" file : "/etc/pam.d/system-auth" regex : "^[\\s]*auth[\\s]+sufficient[\\s]+pam_faillock\\.so[\\s]*" expect : "^[\\s]*auth[\\s]+sufficient[\\s]+pam_faillock\\.so[\\s]+authsucc[\\s]+audit[\\s]+deny=3[\\s]+unlock_time=900[\\s]*$" system : "Linux" type : FILE_CONTENT_CHECK description : "5.4.2 Ensure lockout for failed password attempts is configured - password-auth 'auth required pam_faillock.so'" info : "Lock out users after n unsuccessful consecutive login attempts. deny= - Number of attempts before the account is locked unlock_time= - Time in seconds before the account is unlocked Set the lockout number and unlock time to follow local site policy. Rationale: Locking out user IDs after n unsuccessful consecutive login attempts mitigates brute force password attacks against your systems." solution : "Set password lockouts and unlock times to conform to site policy Run the following to update the system-auth and password-auth files. This script will update/add the deny=3 and unlock_time=900 options. This script should be modified as needed to follow local site policy. CP=$(authselect current | awk 'NR == 1 {print $3}' | grep custom/) for FN in system-auth password-auth; do [[ -n $CP ]] && PTF=/etc/authselect/$CP/$FN || PTF=/etc/authselect/$FN [[ -n $(grep -E '^\s*auth\s+required\s+pam_faillock.so\s+.*deny=\S+\s*.*$' $PTF) ]] && sed -ri '/pam_faillock.so/s/deny=\S+/deny=3/g' $PTF || sed -ri 's/^\^\s*(auth\s+required\s+pam_faillock\.so\s+)(.*[^{}])(\{.*\}|)$/\1\2 deny=3 \3/' $PTF [[ -n $(grep -E '^\s*auth\s+required\s+pam_faillock.so\s+.*unlock_time=\S+\s*.*$' $PTF) ]] && sed -ri '/pam_faillock.so/s/unlock_time=\S+/unlock_time=900/g' $PTF || sed -ri 's/^\s*(auth\s+required\s+pam_faillock\.so\s+)(.*[^{}])(\{.*\}|)$/\1\2 unlock_time=900 \3/' $PTF done authselect apply-changes Notes: Additional module options may be set, recommendation only covers those listed here. If a user has been locked out because they have reached the maximum consecutive failure count defined by deny= in the pam_faillock.so module, the user can be unlocked by issuing the command faillock -u --reset. This command sets the failed count to 0, effectively unlocking the user. Use of the \"audit\" keyword may log credentials in the case of user error during authentication. This risk should be evaluated in the context of the site policies of your organization." reference : "800-171|3.1.8,800-53|AC-7,CSCv7|16.7,ITSG-33|AC-7,LEVEL|1S,NESA|T5.5.1,NIAv2|AM24,TBA-FIISB|45.1.2,TBA-FIISB|45.2.1,TBA-FIISB|45.2.2" see_also : "https://workbench.cisecurity.org/files/2485" file : "/etc/pam.d/password-auth" regex : "^[\\s]*auth[\\s]+required[\\s]+pam_faillock\\.so[\\s]*" expect : "^[\\s]*auth[\\s]+required[\\s]+pam_faillock\\.so[\\s]+preauth[\\s]+audit[\\s]+silent[\\s]+deny=3[\\s]+unlock_time=900[\\s]*$" system : "Linux" type : FILE_CONTENT_CHECK description : "5.4.2 Ensure lockout for failed password attempts is configured - password-auth 'auth [success=1 default=bad] pam_unix.so'" info : "Lock out users after n unsuccessful consecutive login attempts. deny= - Number of attempts before the account is locked unlock_time= - Time in seconds before the account is unlocked Set the lockout number and unlock time to follow local site policy. Rationale: Locking out user IDs after n unsuccessful consecutive login attempts mitigates brute force password attacks against your systems." solution : "Set password lockouts and unlock times to conform to site policy Run the following to update the system-auth and password-auth files. This script will update/add the deny=3 and unlock_time=900 options. This script should be modified as needed to follow local site policy. CP=$(authselect current | awk 'NR == 1 {print $3}' | grep custom/) for FN in system-auth password-auth; do [[ -n $CP ]] && PTF=/etc/authselect/$CP/$FN || PTF=/etc/authselect/$FN [[ -n $(grep -E '^\s*auth\s+required\s+pam_faillock.so\s+.*deny=\S+\s*.*$' $PTF) ]] && sed -ri '/pam_faillock.so/s/deny=\S+/deny=3/g' $PTF || sed -ri 's/^\^\s*(auth\s+required\s+pam_faillock\.so\s+)(.*[^{}])(\{.*\}|)$/\1\2 deny=3 \3/' $PTF [[ -n $(grep -E '^\s*auth\s+required\s+pam_faillock.so\s+.*unlock_time=\S+\s*.*$' $PTF) ]] && sed -ri '/pam_faillock.so/s/unlock_time=\S+/unlock_time=900/g' $PTF || sed -ri 's/^\s*(auth\s+required\s+pam_faillock\.so\s+)(.*[^{}])(\{.*\}|)$/\1\2 unlock_time=900 \3/' $PTF done authselect apply-changes Notes: Additional module options may be set, recommendation only covers those listed here. If a user has been locked out because they have reached the maximum consecutive failure count defined by deny= in the pam_faillock.so module, the user can be unlocked by issuing the command faillock -u --reset. This command sets the failed count to 0, effectively unlocking the user. Use of the \"audit\" keyword may log credentials in the case of user error during authentication. This risk should be evaluated in the context of the site policies of your organization." reference : "800-171|3.1.8,800-53|AC-7,CSCv7|16.7,ITSG-33|AC-7,LEVEL|1S,NESA|T5.5.1,NIAv2|AM24,TBA-FIISB|45.1.2,TBA-FIISB|45.2.1,TBA-FIISB|45.2.2" see_also : "https://workbench.cisecurity.org/files/2485" file : "/etc/pam.d/password-auth" regex : "^[\\s]*auth[\\s]+\\[success=1[\\s]+default=bad\\][\\s]*" expect : "^[\\s]*auth[\\s]+\\[success=1[\\s]+default=bad\\][\\s]+pam_unix\.so[\\s]*$" system : "Linux" type : FILE_CONTENT_CHECK description : "5.4.2 Ensure lockout for failed password attempts is configured - password-auth 'auth [default=die] pam_faillock.so'" info : "Lock out users after n unsuccessful consecutive login attempts. deny= - Number of attempts before the account is locked unlock_time= - Time in seconds before the account is unlocked Set the lockout number and unlock time to follow local site policy. Rationale: Locking out user IDs after n unsuccessful consecutive login attempts mitigates brute force password attacks against your systems." solution : "Set password lockouts and unlock times to conform to site policy Run the following to update the system-auth and password-auth files. This script will update/add the deny=3 and unlock_time=900 options. This script should be modified as needed to follow local site policy. CP=$(authselect current | awk 'NR == 1 {print $3}' | grep custom/) for FN in system-auth password-auth; do [[ -n $CP ]] && PTF=/etc/authselect/$CP/$FN || PTF=/etc/authselect/$FN [[ -n $(grep -E '^\s*auth\s+required\s+pam_faillock.so\s+.*deny=\S+\s*.*$' $PTF) ]] && sed -ri '/pam_faillock.so/s/deny=\S+/deny=3/g' $PTF || sed -ri 's/^\^\s*(auth\s+required\s+pam_faillock\.so\s+)(.*[^{}])(\{.*\}|)$/\1\2 deny=3 \3/' $PTF [[ -n $(grep -E '^\s*auth\s+required\s+pam_faillock.so\s+.*unlock_time=\S+\s*.*$' $PTF) ]] && sed -ri '/pam_faillock.so/s/unlock_time=\S+/unlock_time=900/g' $PTF || sed -ri 's/^\s*(auth\s+required\s+pam_faillock\.so\s+)(.*[^{}])(\{.*\}|)$/\1\2 unlock_time=900 \3/' $PTF done authselect apply-changes Notes: Additional module options may be set, recommendation only covers those listed here. If a user has been locked out because they have reached the maximum consecutive failure count defined by deny= in the pam_faillock.so module, the user can be unlocked by issuing the command faillock -u --reset. This command sets the failed count to 0, effectively unlocking the user. Use of the \"audit\" keyword may log credentials in the case of user error during authentication. This risk should be evaluated in the context of the site policies of your organization." reference : "800-171|3.1.8,800-53|AC-7,CSCv7|16.7,ITSG-33|AC-7,LEVEL|1S,NESA|T5.5.1,NIAv2|AM24,TBA-FIISB|45.1.2,TBA-FIISB|45.2.1,TBA-FIISB|45.2.2" see_also : "https://workbench.cisecurity.org/files/2485" file : "/etc/pam.d/password-auth" regex : "^[\\s]*auth[\\s]+\\[default=die\\][\\s]+pam_faillock\\.so[\\s]*" expect : "^[\\s]*auth[\\s]+\\[default=die\\][\\s]+pam_faillock\\.so[\\s]+authfail[\\s]+audit[\\s]+deny=3[\\s]+unlock_time=900[\\s]*$" system : "Linux" type : FILE_CONTENT_CHECK description : "5.4.2 Ensure lockout for failed password attempts is configured - password-auth 'auth sufficient pam_faillock.so'" info : "Lock out users after n unsuccessful consecutive login attempts. deny= - Number of attempts before the account is locked unlock_time= - Time in seconds before the account is unlocked Set the lockout number and unlock time to follow local site policy. Rationale: Locking out user IDs after n unsuccessful consecutive login attempts mitigates brute force password attacks against your systems." solution : "Set password lockouts and unlock times to conform to site policy Run the following to update the system-auth and password-auth files. This script will update/add the deny=3 and unlock_time=900 options. This script should be modified as needed to follow local site policy. CP=$(authselect current | awk 'NR == 1 {print $3}' | grep custom/) for FN in system-auth password-auth; do [[ -n $CP ]] && PTF=/etc/authselect/$CP/$FN || PTF=/etc/authselect/$FN [[ -n $(grep -E '^\s*auth\s+required\s+pam_faillock.so\s+.*deny=\S+\s*.*$' $PTF) ]] && sed -ri '/pam_faillock.so/s/deny=\S+/deny=3/g' $PTF || sed -ri 's/^\^\s*(auth\s+required\s+pam_faillock\.so\s+)(.*[^{}])(\{.*\}|)$/\1\2 deny=3 \3/' $PTF [[ -n $(grep -E '^\s*auth\s+required\s+pam_faillock.so\s+.*unlock_time=\S+\s*.*$' $PTF) ]] && sed -ri '/pam_faillock.so/s/unlock_time=\S+/unlock_time=900/g' $PTF || sed -ri 's/^\s*(auth\s+required\s+pam_faillock\.so\s+)(.*[^{}])(\{.*\}|)$/\1\2 unlock_time=900 \3/' $PTF done authselect apply-changes Notes: Additional module options may be set, recommendation only covers those listed here. If a user has been locked out because they have reached the maximum consecutive failure count defined by deny= in the pam_faillock.so module, the user can be unlocked by issuing the command faillock -u --reset. This command sets the failed count to 0, effectively unlocking the user. Use of the \"audit\" keyword may log credentials in the case of user error during authentication. This risk should be evaluated in the context of the site policies of your organization." reference : "800-171|3.1.8,800-53|AC-7,CSCv7|16.7,ITSG-33|AC-7,LEVEL|1S,NESA|T5.5.1,NIAv2|AM24,TBA-FIISB|45.1.2,TBA-FIISB|45.2.1,TBA-FIISB|45.2.2" see_also : "https://workbench.cisecurity.org/files/2485" file : "/etc/pam.d/password-auth" regex : "^[\\s]*auth[\\s]+sufficient[\\s]+pam_faillock\\.so[\\s]*" expect : "^[\\s]*auth[\\s]+sufficient[\\s]+pam_faillock\\.so[\\s]+authsucc[\\s]+audit[\\s]+deny=3[\\s]+unlock_time=900[\\s]*$" system : "Linux" type : FILE_CONTENT_CHECK description : "5.4.3 Ensure password reuse is limited - system-auth" info : "The /etc/security/opasswd file stores the users' old passwords and can be checked to ensure that users are not recycling recent passwords. remember=<5> - Number of old passwords to remember Rationale: Forcing users not to reuse their past 24 passwords make it less likely that an attacker will be able to guess the password. Note that these change only apply to accounts configured on the local system." solution : "Set remembered password history to conform to site policy. Run the following script to add or modify the pam_pwhistory.so and pam_unix.so lines to include the remember option: CP=$(authselect current | awk 'NR == 1 {print $3}' | grep custom/) [[ -n $CP ]] && PTF=/etc/authselect/$CP/system-auth || PTF=/etc/authselect/system-auth [[ -n $(grep -E '^\s*password\s+(sufficient\s+pam_unix|requi(red|site)\s+pam_pwhistory).so\s+([^#]+\s+)*remember=\S+\s*.*$' $PTF) ]] && sed -ri 's/^\s*(password\s+(requisite|sufficient)\s+(pam_pwquality\.so|pam_unix\.so)\s+)(.*)(remember=\S+\s*)(.*)$/\1\4 remember=5 \6/' $PTF || sed -ri 's/^\s*(password\s+(requisite|sufficient)\s+(pam_pwquality\.so|pam_unix\.so)\s+)(.*)$/\1\4 remember=5/' $PTF authselect apply-changes Notes: Additional module options may be set, recommendation only covers those listed here." reference : "800-171|3.5.8,800-53|IA-5,CSCv7|16,CSF|PR.AC-1,HIPAA|164.308(a)(5)(ii)(D),ISO/IEC-27001|A.9.4.3,ITSG-33|IA-5,LEVEL|1S,NESA|T5.2.3,NIAv2|AM22c,PCI-DSSv3.1|8.2.5,PCI-DSSv3.2|8.2.5,SWIFT-CSCv1|4.1,TBA-FIISB|26.2.3" see_also : "https://workbench.cisecurity.org/files/2485" file : "/etc/pam.d/system-auth" regex : "^[\\s]*password[\\s]+sufficient[\\s]+pam_unix\\.so[\\s]*" expect : "remember[\\s]*=[\\s]*(2|[4-9][2-9][4-9]+)" system : "Linux" type : FILE_CONTENT_CHECK description : "5.4.3 Ensure password reuse is limited - password-auth" info : "The /etc/security/opasswd file stores the users' old passwords and can be checked to ensure that users are not recycling recent passwords. remember=<5> - Number of old passwords to remember Rationale: Forcing users not to reuse their past 24 passwords make it less likely that an attacker will be able to guess the password. Note that these change only apply to accounts configured on the local system." solution : "Set remembered password history to conform to site policy. Run the folloing script to add or modify the pam_pwhistory.so and pam_unix.so lines to include the remember option: CP=$(authselect current | awk 'NR == 1 {print $3}' | grep custom/) [[ -n $CP ]] && PTF=/etc/authselect/$CP/system-auth || PTF=/etc/authselect/system-auth [[ -n $(grep -E '^\s*password\s+(sufficient\s+pam_unix|requi(red|site)\s+pam_pwhistory).so\s+([^#]+\s+)*remember=\S+\s*.*$' $PTF) ]] && sed -ri 's/^\s*(password\s+(requisite|sufficient)\s+(pam_pwquality\.so|pam_unix\.so)\s+)(.*)(remember=\S+\s*)(.*)$/\1\4 remember=5 \6/' $PTF || sed -ri 's/^\s*(password\s+(requisite|sufficient)\s+(pam_pwquality\.so|pam_unix\.so)\s+)(.*)$/\1\4 remember=24 $PTF authselect apply-changes Notes: Additional module options may be set, recommendation only covers those listed here." reference : "800-171|3.5.8,800-53|IA-5,CSCv7|16,CSF|PR.AC-1,HIPAA|164.308(a)(5)(ii)(D),ISO/IEC-27001|A.9.4.3,ITSG-33|IA-5,LEVEL|1S,NESA|T5.2.3,NIAv2|AM22c,PCI-DSSv3.1|8.2.5,PCI-DSSv3.2|8.2.5,SWIFT-CSCv1|4.1,TBA-FIISB|26.2.3" see_also : "https://workbench.cisecurity.org/files/2485" file : "/etc/pam.d/password-auth" regex : "^[\\s]*password[\\s]+sufficient[\\s]+pam_unix\\.so[\\s]*" expect : "remember[\\s]*=[\\s]*(2|[4-9][2-9][0-9]+)" system : "Linux" type : FILE_CONTENT_CHECK description : "5.4.4 Ensure password hashing algorithm is SHA-512 - password-auth" info : "The commands below change password encryption from md5 to sha512 (a much stronger hashing algorithm). All existing accounts will need to perform a password change to upgrade the stored hashes to the new algorithm. Rationale: The SHA-512 algorithm provides much stronger hashing than MD5, thus providing additional protection to the system by increasing the level of effort for an attacker to successfully determine passwords. Note that these change only apply to accounts configured on the local system." solution : "Set password hashing algorithm to sha512. Run the following script to dd or modify the pam_unix.so lines in the password-auth and system-auth files to include the sha512 option: CP=$(authselect current | awk 'NR == 1 {print $3}' | grep custom/) for FN in system-auth password-auth; do [[ -z $(grep -E '^\s*password\s+sufficient\s+pam_unix.so\s+.*sha512\s*.*$' $PTF) ]] && sed -ri 's/^\s*(password\s+sufficient\s+pam_unix.so\s+)(.*)$/\1\2 sha512/' $PTF done authselect apply-changes Notes: Additional module options may be set, recommendation only covers those listed here. If it is determined that the password algorithm being used is not SHA-512, once it is changed, it is recommended that all user ID's be immediately expired and forced to change their passwords on next login. To accomplish that, the following commands can be used. Any system accounts that need to be expired should be carefully done separately by the system administrator to prevent any potential problems. # awk -F: '( $3<'\"$(awk '/^\s*UID_MIN/{print $2}' /etc/login.defs)\"' && $1 != \"nfsnobody\" ) { print $1 }' /etc/passwd | xargs -n 1 chage -d 0" reference : "800-171|3.13.11,800-171|3.5.10,800-53|IA-5,800-53|SC-13,CSCv7|16.4,CSF|PR.AC-1,CSF|PR.DS-5,ITSG-33|IA-5,ITSG-33|SC-13,LEVEL|1S,NESA|M5.2.6,NESA|T5.2.3,NESA|T7.4.1,NIAv2|CY3,NIAv2|CY4,NIAv2|CY5b,NIAv2|CY5c,NIAv2|CY5d,NIAv2|CY6,NIAv2|CY7,NIAv2|NS5e,SWIFT-CSCv1|4.1,TBA-FIISB|26.1" see_also : "https://workbench.cisecurity.org/files/2485" file : "/etc/pam.d/password-auth" regex : "^[\\s]*password[\\s]+sufficient[\\s]+pam_unix\\.so[\\s]*" expect : "sha512" system : "Linux" type : FILE_CONTENT_CHECK description : "5.4.4 Ensure password hashing algorithm is SHA-512 - system-auth" info : "The commands below change password encryption from md5 to sha512 (a much stronger hashing algorithm). All existing accounts will need to perform a password change to upgrade the stored hashes to the new algorithm. Rationale: The SHA-512 algorithm provides much stronger hashing than MD5, thus providing additional protection to the system by increasing the level of effort for an attacker to successfully determine passwords. Note that these change only apply to accounts configured on the local system." solution : "Set password hashing algorithm to sha512. Run the following script to dd or modify the pam_unix.so lines in the password-auth and system-auth files to include the sha512 option: CP=$(authselect current | awk 'NR == 1 {print $3}' | grep custom/) for FN in system-auth password-auth; do [[ -z $(grep -E '^\s*password\s+sufficient\s+pam_unix.so\s+.*sha512\s*.*$' $PTF) ]] && sed -ri 's/^\s*(password\s+sufficient\s+pam_unix.so\s+)(.*)$/\1\2 sha512/' $PTF done authselect apply-changes Notes: Additional module options may be set, recommendation only covers those listed here. If it is determined that the password algorithm being used is not SHA-512, once it is changed, it is recommended that all user ID's be immediately expired and forced to change their passwords on next login. To accomplish that, the following commands can be used. Any system accounts that need to be expired should be carefully done separately by the system administrator to prevent any potential problems. # awk -F: '( $3<'\"$(awk '/^\s*UID_MIN/{print $2}' /etc/login.defs)\"' && $1 != \"nfsnobody\" ) { print $1 }' /etc/passwd | xargs -n 1 chage -d 0" reference : "800-171|3.13.11,800-171|3.5.10,800-53|IA-5,800-53|SC-13,CSCv7|16.4,CSF|PR.AC-1,CSF|PR.DS-5,ITSG-33|IA-5,ITSG-33|SC-13,LEVEL|1S,NESA|M5.2.6,NESA|T5.2.3,NESA|T7.4.1,NIAv2|CY3,NIAv2|CY4,NIAv2|CY5b,NIAv2|CY5c,NIAv2|CY5d,NIAv2|CY6,NIAv2|CY7,NIAv2|NS5e,SWIFT-CSCv1|4.1,TBA-FIISB|26.1" see_also : "https://workbench.cisecurity.org/files/2485" file : "/etc/pam.d/system-auth" regex : "^[\\s]*password[\\s]+sufficient[\\s]+pam_unix\\.so[\\s]*" expect : "sha512" system : "Linux" type : FILE_CONTENT_CHECK description : "5.5.1.1 Ensure password expiration is 90 days or less" info : "The PASS_MAX_DAYS parameter in /etc/login.defs allows an administrator to force passwords to expire once they reach a defined age. It is recommended that the PASS_MAX_DAYS parameter be set to less than or equal to 365 days. Rationale: The window of opportunity for an attacker to leverage compromised credentials or successfully compromise credentials via an online brute force attack is limited by the age of the password. Therefore, reducing the maximum age of a password also reduces an attacker's window of opportunity." solution : "Set the PASS_MAX_DAYS parameter to conform to site policy in /etc/login.defs : PASS_MAX_DAYS 90 Modify user parameters for all users with a password set to match: # chage --maxdays 90 Notes: You can also check this setting in /etc/shadow directly. The 5th field should be 365 or less for all users with a password. Note: A value of -1 will disable password expiration. Additionally the password expiration must be greater than the minimum days between password changes or users will be unable to change their password." reference : "800-53|IA-5,CIP|007-6-R5,CN-L3|7.1.2.7(e),CN-L3|7.1.3.1(b),CSCv7|4.4,CSF|PR.AC-1,HIPAA|164.308(a)(5)(ii)(D),ISO/IEC-27001|A.9.4.3,ITSG-33|IA-5,LEVEL|1S,NESA|T5.2.3,NIAv2|AM20,NIAv2|AM21,PCI-DSSv3.1|8.2.4,PCI-DSSv3.2|8.2.4,SWIFT-CSCv1|4.1,TBA-FIISB|26.2.2" see_also : "https://workbench.cisecurity.org/files/2485" file : "/etc/login.defs" regex : "^[\\s]*PASS_MAX_DAYS[\\s]" expect : "^[\\s]*PASS_MAX_DAYS[\\s]+([1-9]|[1-8][0-9]|90)\\s*$" system : "Linux" type : FILE_CONTENT_CHECK description : "5.5.1.2 Ensure minimum days between password changes is 7 or more" info : "The PASS_MIN_DAYS parameter in /etc/login.defs allows an administrator to prevent users from changing their password until a minimum number of days have passed since the last time the user changed their password. It is recommended that PASS_MIN_DAYS parameter be set to 7 or more days. Rationale: By restricting the frequency of password changes, an administrator can prevent users from repeatedly changing their password in an attempt to circumvent password reuse controls." solution : "Set the PASS_MIN_DAYS parameter to 7 in /etc/login.defs : PASS_MIN_DAYS 7 Modify user parameters for all users with a password set to match: # chage --mindays 7 Notes: You can also check this setting in /etc/shadow directly. The 4th field should be 7 or more for all users with a password." reference : "800-53|IA-5,CIP|007-6-R5,CN-L3|7.1.2.7(e),CN-L3|7.1.3.1(b),CSCv7|4.4,CSF|PR.AC-1,HIPAA|164.308(a)(5)(ii)(D),ISO/IEC-27001|A.9.4.3,ITSG-33|IA-5,LEVEL|1S,NESA|T5.2.3,NIAv2|AM20,NIAv2|AM21,PCI-DSSv3.1|8.2.4,PCI-DSSv3.2|8.2.4,SWIFT-CSCv1|4.1,TBA-FIISB|26.2.2" see_also : "https://workbench.cisecurity.org/files/2485" file : "/etc/login.defs" regex : "^[\\s\\t]*PASS_MIN_DAYS\\s+" expect : "PASS_MIN_DAYS\\s+([1-9]|[1-9][0-9]+)\\s*$" system : "Linux" type : FILE_CONTENT_CHECK description : "5.5.1.3 Ensure password expiration warning days is 7 or more" info : "The PASS_WARN_AGE parameter in /etc/login.defs allows an administrator to notify users that their password will expire in a defined number of days. It is recommended that the PASS_WARN_AGE parameter be set to 7 or more days. Rationale: Providing an advance warning that a password will be expiring gives users time to think of a secure password. Users caught unaware may choose a simple password or write it down where it may be discovered." solution : "Set the PASS_WARN_AGE parameter to 7 in /etc/login.defs : PASS_WARN_AGE 7 Modify user parameters for all users with a password set to match: # chage --warndays 7 Notes: You can also check this setting in /etc/shadow directly. The 6th field should be 7 or more for all users with a password." reference : "800-53|IA-5,CIP|007-6-R5,CN-L3|7.1.2.7(e),CN-L3|7.1.3.1(b),CSCv7|4.4,CSF|PR.AC-1,HIPAA|164.308(a)(5)(ii)(D),ISO/IEC-27001|A.9.4.3,ITSG-33|IA-5,LEVEL|1S,NESA|T5.2.3,NIAv2|AM20,NIAv2|AM21,PCI-DSSv3.1|8.2.4,PCI-DSSv3.2|8.2.4,SWIFT-CSCv1|4.1,TBA-FIISB|26.2.2" see_also : "https://workbench.cisecurity.org/files/2485" file : "/etc/login.defs" regex : "^[\\s]*PASS_WARN_AGE\\s+" expect : "^[\\s]*PASS_WARN_AGE\\s+([1-9]|1[0-4]?)\\s*$" system : "Linux" type : FILE_CONTENT_CHECK description : "5.5.1.4 Ensure inactive password lock is 120 days or less" info : "User accounts that have been inactive for over a given period of time can be automatically disabled. It is recommended that accounts that are inactive for 30 days after password expiration be disabled. Rationale: Inactive accounts pose a threat to system security since the users are not logging in to notice failed login attempts or other anomalies." solution : "Run the following command to set the default password inactivity period to 30 days: # useradd -D -f 120 Modify user parameters for all users with a password set to match: # chage --inactive 120 Notes: You can also check this setting in /etc/shadow directly. The 7th field should be 1200 or less for all users with a password. Note: A value of -1 would disable this setting." reference : "800-53|AC-2,CIP|004-6-R5,CN-L3|7.1.3.2(e),CSCv7|4.4,CSF|PR.AC-1,CSF|PR.AC-4,ISO/IEC-27001|A.9.2.6,ITSG-33|AC-2,LEVEL|1S,NIAv2|AM26,PCI-DSSv3.1|8.1.4,PCI-DSSv3.2|8.1.4" see_also : "https://workbench.cisecurity.org/files/2485" file : "/etc/default/useradd" regex : "^[\\s]*INACTIVE[\\s]*=[\\s]*" expect : "^[\\s]*INACTIVE[\\s]*=[\\s]*(120|1[0-1][0-9]|[1-9][0-9]|[1-9])[\\s]*$" system : "Linux" type : CMD_EXEC description : "5.5.1.5 Ensure all users last password change date is in the past" info : "All users should have a password change date in the past. Rationale: If a users recorded password change date is in the future then they could bypass any set password expiration. NOTE: Nessus has provided the target output to assist in reviewing the benchmark to ensure target compliance." solution : "Investigate any users with a password change date in the future and correct them. Locking the account, expiring the password, or resetting the password manually may be appropriate." reference : "800-171|3.5.7,800-53|IA-5,CIP|007-6-R5,CN-L3|7.1.2.7(e),CN-L3|7.1.3.1(b),CSCv7|4.4,CSF|PR.AC-1,HIPAA|164.308(a)(5)(ii)(D),ISO/IEC-27001|A.9.4.3,ITSG-33|IA-5,LEVEL|1S,NESA|T5.2.3,NIAv2|AM19a,NIAv2|AM19b,NIAv2|AM19c,NIAv2|AM19d,NIAv2|AM22a,PCI-DSSv3.1|8.2.3,PCI-DSSv3.2|8.2.3,SWIFT-CSCv1|4.1,TBA-FIISB|26.2.1,TBA-FIISB|26.2.4" see_also : "https://workbench.cisecurity.org/files/2485" cmd : "for i in $(/usr/bin/cat /etc/shadow |cut -d: -f1); do /usr/bin/echo '\n'; /usr/bin/echo $i; /usr/bin/echo '------'; now=$(date '+%b %d, %Y'); /usr/bin/echo -n 'Current Date : '; /usr/bin/echo $now; change_date=$(chage --list $i |grep 'Last password change'| cut -d: -f2|awk '{$1=$1};1'); /usr/bin/echo -n 'Last Password Change : '; /usr/bin/echo $change_date; done" expect : "MANUAL_REVIEW" severity : MEDIUM system : "Linux" type : CMD_EXEC description : "5.5.2 Ensure system accounts are secured - 'login shell'" info : "There are a number of accounts provided with most distributions that are used to manage applications and are not intended to provide an interactive shell. Rationale: It is important to make sure that accounts that are not being used by regular users are prevented from being used to provide an interactive shell. By default, most distributions set the password field for these accounts to an invalid string, but it is also recommended that the shell field in the pazzword file be set to the nologin shell. This prevents the account from potentially being used to run any commands." solution : "Run the commands appropriate for your distribution: Set the shell for any accounts returned by the audit to nologin: # usermod -s $(which nologin) Lock any non root accounts returned by the audit: # usermod -L The following command will set all system accounts to a non login shell: awk -F: '($1!=\"root\" && $1!=\"sync\" && $1!=\"shutdown\" && $1!=\"halt\" && $1!~/^\+/ && $3<'\"$(awk '/^\s*UID_MIN/{print $2}' /etc/login.defs)\"' && $7!=\"'\"$(which nologin)\"'\" && $7!=\"/bin/false\") {print $1}' /etc/passwd | while read user do usermod -s $(which nologin) $user done The following command will automatically lock not root system accounts: awk -F: '($1!=\"root\" && $1!~/^\+/ && $3<'\"$(awk '/^\s*UID_MIN/{print $2}' /etc/login.defs)\"') {print $1}' /etc/passwd | xargs -I '{}' passwd -S '{}' | awk '($2!=\"L\" && $2!=\"LK\") {print $1}' | while read user do usermod -L $user done Notes: The root, sync, shutdown, and halt users are exempted from requiring a non-login shell." reference : "800-171|3.1.5,800-53|AC-6,CSCv7|16,CSF|PR.AC-4,ITSG-33|AC-6,LEVEL|1S,NESA|T5.1.1,NESA|T5.4.4,NESA|T5.5.4,NESA|T5.6.1,NESA|T7.5.3,NIAv2|AM31,NIAv2|GS3,NIAv2|GS4,NIAv2|GS8c,NIAv2|VL3b,SWIFT-CSCv1|5.1" see_also : "https://workbench.cisecurity.org/files/2485" cmd : "/usr/bin/awk -F: '($1!=\"root\" && $1!=\"sync\" && $1!=\"shutdown\" && $1!=\"halt\" && $1!~\/^\\+\/ && $3<'\"$(/usr/bin/awk '\/^[\\s]*UID_MIN\/{print $2}' /etc/login\.defs)\"' && $7!=\"'\"$(which nologin)\"'\" && $7!=\"\/bin\/false\") {print}' /etc/passwd | /usr/bin/awk '{print} END {if (NR == 0) print \"pass\" ; else print \"fail\"}'" expect : "^pass$" system : "Linux" type : CMD_EXEC description : "5.5.2 Ensure system accounts are secured - 'lock system accounts'" info : "There are a number of accounts provided with most distributions that are used to manage applications and are not intended to provide an interactive shell. Rationale: It is important to make sure that accounts that are not being used by regular users are prevented from being used to provide an interactive shell. By default, most distributions set the password field for these accounts to an invalid string, but it is also recommended that the shell field in the pazzword file be set to the nologin shell. This prevents the account from potentially being used to run any commands." solution : "Run the commands appropriate for your distribution: Set the shell for any accounts returned by the audit to nologin: # usermod -s $(which nologin) Lock any non root accounts returned by the audit: # usermod -L The following command will set all system accounts to a non login shell: awk -F: '($1!=\"root\" && $1!=\"sync\" && $1!=\"shutdown\" && $1!=\"halt\" && $1!~/^\+/ && $3<'\"$(awk '/^\s*UID_MIN/{print $2}' /etc/login.defs)\"' && $7!=\"'\"$(which nologin)\"'\" && $7!=\"/bin/false\") {print $1}' /etc/passwd | while read user do usermod -s $(which nologin) $user done The following command will automatically lock not root system accounts: awk -F: '($1!=\"root\" && $1!~/^\+/ && $3<'\"$(awk '/^\s*UID_MIN/{print $2}' /etc/login.defs)\"') {print $1}' /etc/passwd | xargs -I '{}' passwd -S '{}' | awk '($2!=\"L\" && $2!=\"LK\") {print $1}' | while read user do usermod -L $user done Notes: The root, sync, shutdown, and halt users are exempted from requiring a non-login shell." reference : "800-171|3.1.5,800-53|AC-6,CSCv7|16,CSF|PR.AC-4,ITSG-33|AC-6,LEVEL|1S,NESA|T5.1.1,NESA|T5.4.4,NESA|T5.5.4,NESA|T5.6.1,NESA|T7.5.3,NIAv2|AM31,NIAv2|GS3,NIAv2|GS4,NIAv2|GS8c,NIAv2|VL3b,SWIFT-CSCv1|5.1" see_also : "https://workbench.cisecurity.org/files/2485" cmd : "/usr/bin/awk -F: '($1!=\"root\" && $1!~\/^\\+\/ && $3<'\"$(awk '\/^[\\s]*UID_MIN\/{print $2}' /etc/login\.defs)\"') {print $1}' /etc/passwd | /usr/bin/xargs -I '{}' /usr/bin/passwd -S '{}' | /usr/bin/awk '($2!=\"L\" && $2!=\"LK\") {print $1}' | /usr/bin/awk '{print} END {if (NR == 0) print \"pass\" ; else print \"fail\"}'" expect : "^pass$" system : "Linux" type : FILE_CONTENT_CHECK description : "5.5.3 Ensure default user shell timeout is 1800 seconds or less - profile" info : "The default TMOUT determines the shell timeout for users. The TMOUT value is measured in seconds. Rationale: Having no timeout value associated with a shell could allow an unauthorized user access to another user's shell session (e.g. user walks away from their computer and doesn't lock the screen). Setting a timeout value at least reduces the risk of this happening." solution : "Edit the /etc/bashrc, /etc/profile and /etc/profile.d/*.sh files (and the appropriate files for any other shell supported on your system) and add or edit any umask parameters as follows: readonly TMOUT=900 ; export TMOUT Note that setting the value to readonly prevents unwanted modification during runtime. Notes: The audit and remediation in this recommendation apply to bash and shell. If other shells are supported on the system, it is recommended that their configuration files also are checked. Other methods of setting a timeout exist for other shells not covered here. Ensure that the timeout conforms to your local policy." reference : "800-171|3.1.11,800-53|AC-12,CN-L3|7.1.2.2(d),CN-L3|7.1.3.7(b),CSCv7|16.11,ITSG-33|AC-12,LEVEL|1S,NIAv2|NS49" see_also : "https://workbench.cisecurity.org/files/2485" file : "/etc/profile" regex : "^[\\s]*TMOUT[\\s]*" expect : "^[\\s]*TMOUT[\\s]*=[\\s]*([1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-7][0-9][0-9][0-9]|1800)[\\s]*$" system : "Linux" type : FILE_CONTENT_CHECK description : "5.5.3 Ensure default user shell timeout is 900 seconds or less - bashrc" info : "The default TMOUT determines the shell timeout for users. The TMOUT value is measured in seconds. Rationale: Having no timeout value associated with a shell could allow an unauthorized user access to another user's shell session (e.g. user walks away from their computer and doesn't lock the screen). Setting a timeout value at least reduces the risk of this happening." solution : "Edit the /etc/bashrc, /etc/profile and /etc/profile.d/*.sh files (and the appropriate files for any other shell supported on your system) and add or edit any umask parameters as follows: readonly TMOUT=900 ; export TMOUT Note that setting the value to readonly prevents unwanted modification during runtime. Notes: The audit and remediation in this recommendation apply to bash and shell. If other shells are supported on the system, it is recommended that their configuration files also are checked. Other methods of setting a timeout exist for other shells not covered here. Ensure that the timeout conforms to your local policy." reference : "800-171|3.1.11,800-53|AC-12,CN-L3|7.1.2.2(d),CN-L3|7.1.3.7(b),CSCv7|16.11,ITSG-33|AC-12,LEVEL|1S,NIAv2|NS49" see_also : "https://workbench.cisecurity.org/files/2485" file : "/etc/bashrc" regex : "^[\\s]*TMOUT[\\s]*" expect : "^[\\s]*TMOUT[\\s]*=[\\s]*(900|[1-8][0-9]{2}|[0-9]{1,2})[\\s]*$" system : "Linux" type : FILE_CONTENT_CHECK description : "5.5.4 Ensure default group for the root account is GID 0" info : "The usermod command can be used to specify which group the root user belongs to. This affects permissions of files that are created by the root user. Rationale: Using GID 0 for the root account helps prevent root -owned files from accidentally becoming accessible to non-privileged users." solution : "Run the following command to set the root user default group to GID 0 : # usermod -g 0 root" reference : "800-171|3.1.1,800-53|AC-2,CN-L3|7.1.3.2(d),CSCv7|5.1,CSF|DE.CM-1,CSF|DE.CM-3,CSF|PR.AC-1,CSF|PR.AC-4,ITSG-33|AC-2,LEVEL|1S,NESA|T5.2.1,NESA|T5.2.2,NIAv2|AM28,NIAv2|NS5j,NIAv2|SS14e" see_also : "https://workbench.cisecurity.org/files/2485" file : "/etc/passwd" regex : "^root:" expect : "^root:x:0:0:" system : "Linux" type : CMD_EXEC description : "5.5.5 Ensure default user umask is 027 or more restrictive - /etc/profile /etc/profile.d/*.sh" info : "The default umask determines the permissions of files created by users. The user creating the file has the discretion of making their files and directories readable by others via the chmod command. Users who wish to allow their files and directories to be readable by others by default may choose a different default umask by inserting the umask command into the standard shell configuration files ( .profile , .bashrc , etc.) in their home directories. Rationale: Setting a very secure default value for umask ensures that users make a conscious choice about their file permissions. A default umask setting of 077 causes files and directories created by users to not be readable by any other user on the system. A umask of 027 would make files and directories readable by users in the same Unix group, while a umask of 022 would make files readable by every user on the system." solution : "Edit the /etc/bashrc, /etc/profile and /etc/profile.d/*.sh files (and the appropriate files for any other shell supported on your system) and add or edit any umask parameters as follows: umask 027 Notes: The audit and remediation in this recommendation apply to bash and shell. If other shells are supported on the system, it is recommended that their configuration files also are checked. Other methods of setting a default user umask exist however the shell configuration files are the last run and will override other settings if they exist therefor our recommendation is to configure in the shell configuration files. If other methods are in use in your environment they should be audited and the shell configs should be verified to not override. 13 Data Protection Data Protection" reference : "800-171|3.1.1,800-53|AC-3,CSCv7|13,CSCv7|5.1,CSF|PR.AC-4,CSF|PR.PT-3,ITSG-33|AC-3,LEVEL|1S" see_also : "https://workbench.cisecurity.org/files/2485" cmd : "/usr/bin/grep 'umask' /etc/profile /etc/profile.d/*.sh" regex : "^(.*?:)?[\\s]*umask[\\s]" expect : "^(.*?:)?[\\s]*umask[\\s]+[0-7][2-7]7[\\s]*$" system : "Linux" type : FILE_CONTENT_CHECK description : "5.5.5 Ensure default user umask is 027 or more restrictive - bashrc" info : "The default umask determines the permissions of files created by users. The user creating the file has the discretion of making their files and directories readable by others via the chmod command. Users who wish to allow their files and directories to be readable by others by default may choose a different default umask by inserting the umask command into the standard shell configuration files ( .profile , .bashrc , etc.) in their home directories. Rationale: Setting a very secure default value for umask ensures that users make a conscious choice about their file permissions. A default umask setting of 077 causes files and directories created by users to not be readable by any other user on the system. A umask of 027 would make files and directories readable by users in the same Unix group, while a umask of 022 would make files readable by every user on the system." solution : "Edit the /etc/bashrc, /etc/profile and /etc/profile.d/*.sh files (and the appropriate files for any other shell supported on your system) and add or edit any umask parameters as follows: umask 027 Notes: The audit and remediation in this recommendation apply to bash and shell. If other shells are supported on the system, it is recommended that their configuration files also are checked. Other methods of setting a default user umask exist however the shell configuration files are the last run and will override other settings if they exist therefor our recommendation is to configure in the shell configuration files. If other methods are in use in your environment they should be audited and the shell configs should be verified to not override. 13 Data Protection Data Protection" reference : "800-171|3.1.1,800-53|AC-3,CSCv7|13,CSCv7|5.1,CSF|PR.AC-4,CSF|PR.PT-3,ITSG-33|AC-3,LEVEL|1S" see_also : "https://workbench.cisecurity.org/files/2485" file : "/etc/bashrc" regex : "^[\\s]*umask[\\s]" expect : "^[\\s]*umask[\\s]+[0-7][2-7]7[\\s]*$" system : "Linux" type : CMD_EXEC description : "5.6 Ensure root login is restricted to system console" info : "The file /etc/securetty contains a list of valid terminals that may be logged in directly as root. Rationale: Since the system console has special properties to handle emergency situations, it is important to ensure that the console is in a physically secure location and that unauthorized consoles have not been defined." solution : "Remove entries for any consoles that are not in a physically secure location." reference : "800-53|AC-6,CSCv7|5.1,CSF|PR.AC-4,ITSG-33|AC-6,LEVEL|1NS,NESA|T5.1.1,NESA|T5.5.4,SWIFT-CSCv1|5.1" see_also : "https://workbench.cisecurity.org/files/2485" cmd : "/usr/bin/grep -v \"console\" /etc/securetty | /usr/bin/awk '{ print } END { if (NR==0) print \"none\" }'" expect : "none" dont_echo_cmd : YES system : "Linux" type : CMD_EXEC description : "5.7 Ensure access to the su command is restricted - wheel group contains root" info : "The su command allows a user to run a command or shell as another user. The program has been superseded by sudo , which allows for more granular control over privileged access. Normally, the su command can be executed by any user. By uncommenting the pam_wheel.so statement in /etc/pam.d/su , the su command will only allow users in the wheel group to execute su . Rationale: Restricting the use of su , and using sudo in its place, provides system administrators better control of the escalation of user privileges to execute privileged commands. The sudo utility also provides a better logging and audit mechanism, as it can log each command executed via sudo , whereas su can only record that a user executed the su program." solution : "Add the following line to the /etc/pam.d/su file: auth required pam_wheel.so use_uid Create a comma separated list of users in the wheel statement in the /etc/group file: wheel:x::root, Example: wheel:x:10:root,user1,user2,user3" reference : "800-171|3.1.1,800-53|AC-2,CN-L3|7.1.3.2(d),CSCv7|5.1,CSF|DE.CM-1,CSF|DE.CM-3,CSF|PR.AC-1,CSF|PR.AC-4,ITSG-33|AC-2,LEVEL|1S,NESA|T5.2.1,NESA|T5.2.2,NIAv2|AM28,NIAv2|NS5j,NIAv2|SS14e" see_also : "https://workbench.cisecurity.org/files/2485" cmd : "/usr/bin/grep ^wheel: /etc/group" expect : "^wheel:x:10:root(,|$)" dont_echo_cmd : YES system : "Linux" type : FILE_CONTENT_CHECK description : "5.7 Ensure access to the su command is restricted - pam_wheel.so" info : "The su command allows a user to run a command or shell as another user. The program has been superseded by sudo , which allows for more granular control over privileged access. Normally, the su command can be executed by any user. By uncommenting the pam_wheel.so statement in /etc/pam.d/su , the su command will only allow users in the wheel group to execute su . Rationale: Restricting the use of su , and using sudo in its place, provides system administrators better control of the escalation of user privileges to execute privileged commands. The sudo utility also provides a better logging and audit mechanism, as it can log each command executed via sudo , whereas su can only record that a user executed the su program." solution : "Add the following line to the /etc/pam.d/su file: auth required pam_wheel.so use_uid Create a comma separated list of users in the wheel statement in the /etc/group file: wheel:x::root, Example: wheel:x:10:root,user1,user2,user3" reference : "800-171|3.1.7,800-53|AC-6,CSCv7|5.1,CSF|PR.AC-4,LEVEL|1S" see_also : "https://workbench.cisecurity.org/files/2485" file : "/etc/pam.d/su" regex : "^[\\s]*auth[\\s]+required[\\s]+pam_wheel\\.so[\\s]+use_uid[\\s]*$" expect : "^[\\s]*auth[\\s]+required[\\s]+pam_wheel\\.so[\\s]+use_uid[\\s]*$" system : "Linux" type : FILE_CHECK description : "6.1.2 Ensure permissions on /etc/passwd are configured" info : "The /etc/passwd file contains user account information that is used by many system utilities and therefore must be readable for these utilities to operate. Rationale: It is critical to ensure that the /etc/passwd file is protected from unauthorized write access. Although it is protected by default, the file permissions could be changed either inadvertently or through malicious actions." solution : "Run the following command to set permissions on /etc/passwd : # chown root:root /etc/passwd # chmod 644 /etc/passwd" reference : "800-53|IA-5,CSCv7|16.4,CSF|PR.AC-1,ITSG-33|IA-5,LEVEL|1S,PCI-DSSv3.1|2.2.4,PCI-DSSv3.2|2.2.4,SWIFT-CSCv1|5.4,TBA-FIISB|26.1" see_also : "https://workbench.cisecurity.org/files/2485" group : "root" owner : "root" file : "/etc/passwd" mask : "133" system : "Linux" type : FILE_CHECK description : "6.1.3 Ensure permissions on /etc/shadow are configured" info : "The /etc/shadow file is used to store the information about user accounts that is critical to the security of those accounts, such as the hashed password and other security information. Rationale: If attackers can gain read access to the /etc/shadow file, they can easily run a password cracking program against the hashed password to break it. Other security information that is stored in the /etc/shadow file (such as expiration) could also be useful to subvert the user accounts." solution : "Run the one of the following chown commands as appropriate and the chmod to set permissions on /etc/shadow : # chown root:root /etc/shadow # chown root:shadow /etc/shadow # chmod o-rwx,g-wx /etc/shadow" reference : "800-53|IA-5,CSCv7|16.4,CSF|PR.AC-1,ITSG-33|IA-5,LEVEL|1S,PCI-DSSv3.1|2.2.4,PCI-DSSv3.2|2.2.4,SWIFT-CSCv1|5.4,TBA-FIISB|26.1" see_also : "https://workbench.cisecurity.org/files/2485" group : "root" owner : "root" file : "/etc/shadow" mask : "137" system : "Linux" type : FILE_CHECK description : "6.1.4 Ensure permissions on /etc/group are configured" info : "The /etc/group file contains a list of all the valid groups defined in the system. The command below allows read/write access for root and read access for everyone else. Rationale: The /etc/group file needs to be protected from unauthorized changes by non-privileged users, but needs to be readable as this information is used with many non-privileged programs." solution : "Run the following command to set permissions on /etc/group : # chown root:root /etc/group # chmod 644 /etc/group" reference : "800-53|IA-5,CSCv7|16.4,CSF|PR.AC-1,ITSG-33|IA-5,LEVEL|1S,PCI-DSSv3.1|2.2.4,PCI-DSSv3.2|2.2.4,SWIFT-CSCv1|5.4,TBA-FIISB|26.1" see_also : "https://workbench.cisecurity.org/files/2485" group : "root" owner : "root" file : "/etc/group" mask : "133" system : "Linux" type : FILE_CHECK description : "6.1.5 Ensure permissions on /etc/gshadow are configured" info : "The /etc/gshadow file is used to store the information about groups that is critical to the security of those accounts, such as the hashed password and other security information. Rationale: If attackers can gain read access to the /etc/gshadow file, they can easily run a password cracking program against the hashed password to break it. Other security information that is stored in the /etc/gshadow file (such as group administrators) could also be useful to subvert the group." solution : "Run the one of the following chown commands as appropriate and the chmod to set permissions on /etc/gshadow : # chown root:root /etc/gshadow # chown root:shadow /etc/gshadow # chmod o-rwx,g-rw /etc/gshadow" reference : "800-53|IA-5,CSCv7|16.4,CSF|PR.AC-1,ITSG-33|IA-5,LEVEL|1S,PCI-DSSv3.1|2.2.4,PCI-DSSv3.2|2.2.4,SWIFT-CSCv1|5.4,TBA-FIISB|26.1" see_also : "https://workbench.cisecurity.org/files/2485" group : "root" owner : "root" file : "/etc/gshadow" mask : "137" system : "Linux" type : FILE_CHECK description : "6.1.6 Ensure permissions on /etc/passwd- are configured" info : "The /etc/passwd- file contains backup user account information. Rationale: It is critical to ensure that the /etc/passwd- file is protected from unauthorized access. Although it is protected by default, the file permissions could be changed either inadvertently or through malicious actions." solution : "Run the following command to set permissions on /etc/passwd- : # chown root:root /etc/passwd- # chmod u-x,go-rwx /etc/passwd-" reference : "800-171|3.4.2,800-53|CM-6,CSCv7|16.4,CSF|PR.IP-1,ITSG-33|CM-6,LEVEL|1S,NESA|T3.2.1,PCI-DSSv3.1|2.2.4,PCI-DSSv3.2|2.2.4,SWIFT-CSCv1|2.3" see_also : "https://workbench.cisecurity.org/files/2485" group : "root" owner : "root" file : "/etc/passwd-" mask : "177" system : "Linux" type : FILE_CHECK description : "6.1.7 Ensure permissions on /etc/shadow- are configured" info : "The /etc/shadow- file is used to store backup information about user accounts that is critical to the security of those accounts, such as the hashed password and other security information. Rationale: It is critical to ensure that the /etc/shadow- file is protected from unauthorized access. Although it is protected by default, the file permissions could be changed either inadvertently or through malicious actions." solution : "Run the one of the following chown commands as appropriate and the chmod to set permissions on /etc/shadow- : # chown root:root /etc/shadow- OR # chown root:shadow /etc/shadow- # chmod u-x,go-rwx /etc/shadow-" reference : "800-171|3.4.2,800-53|CM-6,CSCv7|16.4,CSF|PR.IP-1,ITSG-33|CM-6,LEVEL|1S,NESA|T3.2.1,PCI-DSSv3.1|2.2.4,PCI-DSSv3.2|2.2.4,SWIFT-CSCv1|2.3" see_also : "https://workbench.cisecurity.org/files/2485" group : "root" owner : "root" file : "/etc/shadow-" mask : "177" system : "Linux" type : FILE_CHECK description : "6.1.8 Ensure permissions on /etc/group- are configured" info : "The /etc/group- file contains a backup list of all the valid groups defined in the system. Rationale: It is critical to ensure that the /etc/group- file is protected from unauthorized access. Although it is protected by default, the file permissions could be changed either inadvertently or through malicious actions." solution : "Run the following command to set permissions on /etc/group- : # chown root:root /etc/group- # chmod u-x,go-wx /etc/group-" reference : "800-171|3.4.2,800-53|CM-6,CSCv7|16.4,CSF|PR.IP-1,ITSG-33|CM-6,LEVEL|1S,NESA|T3.2.1,PCI-DSSv3.1|2.2.4,PCI-DSSv3.2|2.2.4,SWIFT-CSCv1|2.3" see_also : "https://workbench.cisecurity.org/files/2485" group : "root" owner : "root" file : "/etc/group-" mask : "133" system : "Linux" type : FILE_CHECK description : "6.1.9 Ensure permissions on /etc/gshadow- are configured" info : "The /etc/gshadow- file is used to store backup information about groups that is critical to the security of those accounts, such as the hashed password and other security information. Rationale: It is critical to ensure that the /etc/gshadow- file is protected from unauthorized access. Although it is protected by default, the file permissions could be changed either inadvertently or through malicious actions." solution : "Run the one of the following chown commands as appropriate and the chmod to set permissions on /etc/gshadow- : # chown root:root /etc/gshadow- # chown root:shadow /etc/gshadow- # chmod o-rwx,g-rw /etc/gshadow-" reference : "800-171|3.4.2,800-53|CM-6,CSCv7|16.4,CSF|PR.IP-1,ITSG-33|CM-6,LEVEL|1S,NESA|T3.2.1,PCI-DSSv3.1|2.2.4,PCI-DSSv3.2|2.2.4,SWIFT-CSCv1|2.3" see_also : "https://workbench.cisecurity.org/files/2485" group : "root" owner : "root" file : "/etc/gshadow-" mask : "137" system : "Linux" description : "6.1.10 Ensure no world writable files exist" info : "Unix-based systems support variable settings to control access to files. World writable files are the least secure. See the chmod(2) man page for more information. Rationale: Data in world-writable files can be modified and compromised by any user on the system. World writable files may also indicate an incorrectly written script or program that could potentially be the cause of a larger compromise to the system's integrity." solution : "Removing write access for the \"other\" category ( chmod o-w ) is advisable, but always consult relevant vendor documentation to avoid breaking any application dependencies on a given file. 13 Data Protection Data Protection" reference : "800-171|3.1.5,800-53|AC-6,CN-L3|7.1.3.2(b),CN-L3|7.1.3.2(g),CSCv7|13,CSCv7|5.1,CSF|PR.AC-4,CSF|PR.DS-5,ITSG-33|AC-6,LEVEL|1S,NESA|T5.1.1,NESA|T5.2.2,NESA|T5.4.1,NESA|T5.4.4,NESA|T5.4.5,NESA|T5.5.4,NESA|T5.6.1,NESA|T7.5.3,NIAv2|AM1,NIAv2|AM23f,NIAv2|SS13c,NIAv2|SS15c,PCI-DSSv3.1|7.1.2,PCI-DSSv3.2|7.1.2,SWIFT-CSCv1|5.1" see_also : "https://workbench.cisecurity.org/files/2485" name : "find_world_writeable_files" system : "Linux" description : "6.1.11 Ensure no unowned files or directories exist" info : "Sometimes when administrators delete users from the pazzword file they neglect to remove all files owned by those users from the system. Rationale: A new user who is assigned the deleted user's user ID or group ID may then end up \"owning\" these files, and thus have more access on the system than was intended." solution : "Locate files that are owned by users or groups not listed in the system configuration files, and reset the ownership of these files to some active user on the system as appropriate." reference : "800-53|AC-16,CSCv7|13.2,CSF|PR.AC-4,ITSG-33|AC-16,LEVEL|1S" see_also : "https://workbench.cisecurity.org/files/2485" name : "find_orphan_files" system : "Linux" description : "6.1.12 Ensure no ungrouped files or directories exist" info : "Sometimes when administrators delete users or groups from the system they neglect to remove all files owned by those users or groups. Rationale: A new user who is assigned the deleted user's user ID or group ID may then end up \"owning\" these files, and thus have more access on the system than was intended." solution : "Locate files that are owned by users or groups not listed in the system configuration files, and reset the ownership of these files to some active user on the system as appropriate." reference : "800-53|AC-16,CSCv7|13.2,CSF|PR.AC-4,ITSG-33|AC-16,LEVEL|1S" see_also : "https://workbench.cisecurity.org/files/2485" name : "find_orphan_files" system : "Linux" description : "6.1.13 Audit SUID executables" info : "The owner of a file can set the file's permissions to run with the owner's or group's permissions, even if the user running the program is not the owner or a member of the group. The most common reason for a SUID program is to enable users to perform functions (such as changing their password) that require root privileges. Rationale: There are valid reasons for SUID programs, but it is important to identify and review such programs to ensure they are legitimate. NOTE: Nessus has provided the target output to assist in reviewing the benchmark to ensure target compliance." solution : "Ensure that no rogue SUID programs have been introduced into the system. Review the files returned by the action in the Audit section and confirm the integrity of these binaries." reference : "800-53|AC-6,CSCv7|5.1,CSF|PR.AC-4,LEVEL|1NS" see_also : "https://workbench.cisecurity.org/files/2485" name : "find_suid_sgid_files" severity : MEDIUM system : "Linux" description : "6.1.14 Audit SGID executables" info : "The owner of a file can set the file's permissions to run with the owner's or group's permissions, even if the user running the program is not the owner or a member of the group. The most common reason for a SGID program is to enable users to perform functions (such as changing their password) that require root privileges. Rationale: There are valid reasons for SGID programs, but it is important to identify and review such programs to ensure they are legitimate. Review the files returned by the action in the audit section and check to see if system binaries have a different md5 checksum than what from the package. This is an indication that the binary may have been replaced. NOTE: Nessus has provided the target output to assist in reviewing the benchmark to ensure target compliance." solution : "Ensure that no rogue SGID programs have been introduced into the system. Review the files returned by the action in the Audit section and confirm the integrity of these binaries." reference : "800-53|AC-6,CSCv7|5.1,CSF|PR.AC-4,LEVEL|1NS" see_also : "https://workbench.cisecurity.org/files/2485" name : "find_suid_sgid_files" severity : MEDIUM system : "Linux" type : CMD_EXEC description : "6.2.1 Ensure password fields are not empty" info : "An account with an empty password field means that anybody may log in as that user without providing a password. Rationale: All accounts must have passwords or be locked to prevent the account from being used by an unauthorized user." solution : "If any accounts in the /etc/shadow file do not have a password, run the following command to lock the account until it can be determined why it does not have a password: # passwd -l Also, check to see if the account is logged in and investigate what it is being used for to determine if it needs to be forced off." reference : "800-171|3.5.7,800-53|IA-5,CIP|007-6-R5,CN-L3|7.1.2.7(e),CN-L3|7.1.3.1(b),CSCv7|4.4,CSF|PR.AC-1,HIPAA|164.308(a)(5)(ii)(D),ISO/IEC-27001|A.9.4.3,ITSG-33|IA-5,LEVEL|1S,NESA|T5.2.3,NIAv2|AM19a,NIAv2|AM19b,NIAv2|AM19c,NIAv2|AM19d,NIAv2|AM22a,PCI-DSSv3.1|8.2.3,PCI-DSSv3.2|8.2.3,SWIFT-CSCv1|4.1,TBA-FIISB|26.2.1,TBA-FIISB|26.2.4" see_also : "https://workbench.cisecurity.org/files/2485" cmd : "/usr/bin/cat /etc/shadow | /usr/bin/awk -F : '($2 == \"\") { print $1 \" does not have a password.\"; flag++ } END { if(flag<1) print \"none\" }'" expect : "none" dont_echo_cmd : YES system : "Linux" type : FILE_CONTENT_CHECK_NOT description : "6.2.2 Ensure no legacy \"+\" entries exist in /etc/passwd" info : "The character + in various files used to be markers for systems to insert data from NIS maps at a certain point in a system configuration file. These entries are no longer required on most systems, but may exist in files that have been imported from other platforms. Rationale: These entries may provide an avenue for attackers to gain privileged access on the system." solution : "Remove any legacy '+' entries from /etc/passwd if they exist." reference : "800-171|3.5.1,800-53|IA-2,CN-L3|7.1.3.1(a),CN-L3|7.1.3.1(e),CSCv7|16.2,CSF|PR.AC-1,ITSG-33|IA-2,LEVEL|1S,NESA|T2.3.8,NESA|T5.3.1,NESA|T5.4.2,NESA|T5.5.1,NESA|T5.5.2,NESA|T5.5.3,NIAv2|AM14b,NIAv2|AM2,NIAv2|AM8" see_also : "https://workbench.cisecurity.org/files/2485" file : "/etc/passwd" regex : "^[\\s]*\\+:" expect : "^[\\s]*\\+:" system : "Linux" description : "6.2.3 Ensure root PATH Integrity" info : "The root user can execute any command on the system and could be fooled into executing programs unintentionally if the PATH is not set correctly. Rationale: Including the current working directory (.) or other writable directory in root 's executable path makes it likely that an attacker can gain superuser access by forcing an administrator operating as root to execute a Trojan horse program." solution : "Correct or justify any items discovered in the Audit step." reference : "800-171|3.4.7,800-53|CM-7,CSCv7|5.1,CSF|PR.IP-1,CSF|PR.PT-3,ITSG-33|CM-7,LEVEL|1S,SWIFT-CSCv1|2.3" see_also : "https://workbench.cisecurity.org/files/2485" name : "dot_in_root_path_variable" system : "Linux" type : FILE_CONTENT_CHECK_NOT description : "6.2.4 Ensure no legacy \"+\" entries exist in /etc/shadow" info : "The character + in various files used to be markers for systems to insert data from NIS maps at a certain point in a system configuration file. These entries are no longer required on most systems, but may exist in files that have been imported from other platforms. Rationale: These entries may provide an avenue for attackers to gain privileged access on the system." solution : "Remove any legacy '+' entries from /etc/shadow if they exist." reference : "800-171|3.5.1,800-53|IA-2,CN-L3|7.1.3.1(a),CN-L3|7.1.3.1(e),CSCv7|16.2,CSF|PR.AC-1,ITSG-33|IA-2,LEVEL|1S,NESA|T2.3.8,NESA|T5.3.1,NESA|T5.4.2,NESA|T5.5.1,NESA|T5.5.2,NESA|T5.5.3,NIAv2|AM14b,NIAv2|AM2,NIAv2|AM8" see_also : "https://workbench.cisecurity.org/files/2485" file : "/etc/shadow" regex : "^[\\s]*\\+:" expect : "^[\\s]*\\+:" system : "Linux" type : FILE_CONTENT_CHECK_NOT description : "6.2.5 Ensure no legacy \"+\" entries exist in /etc/group" info : "The character + in various files used to be markers for systems to insert data from NIS maps at a certain point in a system configuration file. These entries are no longer required on most systems, but may exist in files that have been imported from other platforms. Rationale: These entries may provide an avenue for attackers to gain privileged access on the system." solution : "Remove any legacy '+' entries from /etc/group if they exist." reference : "800-171|3.5.1,800-53|IA-2,CN-L3|7.1.3.1(a),CN-L3|7.1.3.1(e),CSCv7|16.2,CSF|PR.AC-1,ITSG-33|IA-2,LEVEL|1S,NESA|T2.3.8,NESA|T5.3.1,NESA|T5.4.2,NESA|T5.5.1,NESA|T5.5.2,NESA|T5.5.3,NIAv2|AM14b,NIAv2|AM2,NIAv2|AM8" see_also : "https://workbench.cisecurity.org/files/2485" file : "/etc/group" regex : "^[\\s]*\\+:" expect : "^[\\s]*\\+:" system : "Linux" description : "6.2.6 Ensure root is the only UID 0 account" info : "Any account with UID 0 has superuser privileges on the system. Rationale: This access must be limited to only the default root account and only from the system console. Administrative access must be through an unprivileged account using an approved mechanism as noted in Item 5.6 Ensure access to the su command is restricted." solution : "Remove any users other than root with UID 0 or assign them a new UID if appropriate." reference : "800-171|3.1.5,800-53|AC-6,CSCv7|5.1,CSF|PR.AC-4,ISO/IEC-27001|A.9.2.3,ITSG-33|AC-6,LEVEL|1S,NESA|T5.1.1,NESA|T5.2.2,NESA|T5.6.1,NIAv2|AM32,NIAv2|AM33,NIAv2|VL3a,SWIFT-CSCv1|1.2" see_also : "https://workbench.cisecurity.org/files/2485" name : "passwd_zero_uid" system : "Linux" type : CMD_EXEC description : "6.2.7 Ensure users' home directories permissions are 750 or more restrictive" info : "While the system administrator can establish secure permissions for users' home directories, the users can easily override these. Rationale: Group or world-writable user home directories may enable malicious users to steal or modify other users' data or to gain another user's system privileges." solution : "Making global modifications to user home directories without alerting the user community can result in unexpected outages and unhappy users. Therefore, it is recommended that a monitoring policy be established to report user file permissions and determine the action to be taken in accordance with site policy. Notes: On some distributions the /sbin/nologin should be replaced with /usr/sbin/nologin." reference : "800-171|3.4.2,800-53|CM-6,CSCv7|14.6,CSF|PR.IP-1,ITSG-33|CM-6,LEVEL|1S,NESA|T3.2.1,PCI-DSSv3.1|2.2.4,PCI-DSSv3.2|2.2.4,SWIFT-CSCv1|2.3" see_also : "https://workbench.cisecurity.org/files/2485" cmd : "for dir in $(/usr/bin/cat /etc/passwd | /usr/bin/egrep -v '(root|halt|sync|shutdown)' | /usr/bin/awk -F: '($7 != \"/sbin/nologin\") { print $6 }'); do if [ ! -d $dir ]; then /usr/bin/echo \"The home directory ($dir) of user $user does not exist.\"; else dirperm=$(ls -ld $dir | cut -f1 -d\" \"); if [ $(/usr/bin/echo $dirperm | cut -c6) != \"-\" ]; then /usr/bin/echo \"Group Write permission set on the home directory ($dir) of user $user\"; fi; if [ $(/usr/bin/echo $dirperm | cut -c8) != \"-\" ]; then /usr/bin/echo \"Other Read permission set on the home directory ($dir) of user $user\"; fi; if [ $(/usr/bin/echo $dirperm | cut -c9) != \"-\" ]; then /usr/bin/echo \"Other Write permission set on the home directory ($dir) of user $user\"; fi; if [ $(/usr/bin/echo $dirperm | cut -c10) != \"-\" ]; then /usr/bin/echo \"Other Execute permission set on the home directory ($dir) of user $user\"; fi; fi; done | /usr/bin/awk '{ print } END { if (NR==0) print \"All home directories have proper permissions\" }'" expect : "All home directories have proper permissions" dont_echo_cmd : YES system : "Linux" type : CMD_EXEC description : "6.2.8 Ensure users own their home directories" info : "The user home directory is space defined for the particular user to set local environment variables and to store personal files. Rationale: Since the user is accountable for files stored in the user home directory, the user must be the owner of the directory." solution : "Change the ownership of any home directories that are not owned by the defined user to the correct user. Notes: On some distributions the /sbin/nologin should be replaced with /usr/sbin/nologin." reference : "800-171|3.4.2,800-53|CM-6,CSCv7|14.6,CSF|PR.IP-1,ITSG-33|CM-6,LEVEL|1S,NESA|T3.2.1,SWIFT-CSCv1|2.3" see_also : "https://workbench.cisecurity.org/files/2485" cmd : "/usr/bin/cat /etc/passwd | /usr/bin/egrep -v '^(root|halt|sync|shutdown)' | /usr/bin/awk -F: '($7 != \"/sbin/nologin\") { print $1 \" \" $3 \" \" $6 }' | while read user uid dir; do if [ -d \"$dir\" ]; then owner=$(stat -L -c \"%U\" \"$dir\"); if [ \"$owner\" != \"$user\" ]; then /usr/bin/echo \"The home directory ($dir) of user $user is owned by $owner.\"; fi fi done | /usr/bin/awk '{ print } END { if (NR==0) print \"All home directories have proper owners\" }'" expect : "All home directories have proper owners" dont_echo_cmd : YES system : "Linux" type : CMD_EXEC description : "6.2.9 Ensure users' dot files are not group or world writable" info : "While the system administrator can establish secure permissions for users' \"dot\" files, the users can easily override these. Rationale: Group or world-writable user configuration files may enable malicious users to steal or modify other users' data or to gain another user's system privileges." solution : "Making global modifications to users' files without alerting the user community can result in unexpected outages and unhappy users. Therefore, it is recommended that a monitoring policy be established to report user dot file permissions and determine the action to be taken in accordance with site policy. Notes: On some distributions the /sbin/nologin should be replaced with /usr/sbin/nologin." reference : "800-171|3.4.2,800-53|CM-6,CSCv7|14.6,CSF|PR.IP-1,ITSG-33|CM-6,LEVEL|1S,NESA|T3.2.1,PCI-DSSv3.1|2.2.4,PCI-DSSv3.2|2.2.4,SWIFT-CSCv1|2.3" see_also : "https://workbench.cisecurity.org/files/2485" cmd : "for dir in $(/usr/bin/cat /etc/passwd | /usr/bin/egrep -v '(root|halt|sync|shutdown)' | /usr/bin/awk -F: '($7 != \"/sbin/nologin\") { print $6 }'); do if [ ! -d $dir ]; then /usr/bin/echo \"The home directory ($dir) does not exist.\"; else for file in $dir/.[A-Za-z0-9]*; do fileperm=$(ls -ld $file | cut -f1 -d\" \"); if [ $(/usr/bin/echo $fileperm | cut -c6) != \"-\" ]; then /usr/bin/echo \"Group Write permission set on file $file\"; fi; if [ $(/usr/bin/echo $fileperm | cut -c9) != \"-\" ]; then /usr/bin/echo \"Other Write permission set on file $file\"; fi; done; fi; done | /usr/bin/awk '{ print } END { if (NR==0) print \"All dot files are not group or world writable\" }'" expect : "All dot files are not group or world writable" dont_echo_cmd : YES system : "Linux" type : CMD_EXEC description : "6.2.10 Ensure no users have .forward files" info : "The .forward file specifies an email address to forward the user's mail to. Rationale: Use of the .forward file poses a security risk in that sensitive data may be inadvertently transferred outside the organization. The .forward file also poses a risk as it can be used to execute commands that may perform unintended actions." solution : "Making global modifications to users' files without alerting the user community can result in unexpected outages and unhappy users. Therefore, it is recommended that a monitoring policy be established to report user .forward files and determine the action to be taken in accordance with site policy. Notes: On some distributions the /sbin/nologin should be replaced with /usr/sbin/nologin." reference : "800-171|3.4.6,800-171|3.4.7,800-53|CM-7,CN-L3|7.1.3.5(c),CN-L3|7.1.3.7(d),CSCv7|5.1,CSF|PR.IP-1,CSF|PR.PT-3,ITSG-33|CM-7,LEVEL|1S,NIAv2|SS13b,NIAv2|SS14a,NIAv2|SS14c,NIAv2|SS15a,SWIFT-CSCv1|2.3" see_also : "https://workbench.cisecurity.org/files/2485" cmd : "/usr/bin/cat /etc/passwd | /usr/bin/egrep -v '^(root|halt|sync|shutdown)' | /usr/bin/awk -F: '($7 != \"/sbin/nologin\") { print $1 \" \" $3 \" \" $6 }' | while read user uid dir; do if [ -f \"$dir/.forward\" ]; then /usr/bin/echo \".forward file $dir/.forward exists\"; fi; done | /usr/bin/awk '{ print } END { if (NR==0) print \"No .forward files found\" }'" expect : "No .forward files found" dont_echo_cmd : YES system : "Linux" type : CMD_EXEC description : "6.2.11 Ensure no users have .netrc files" info : "The .netrc file contains data for logging into a remote host for file transfers via FTP. Rationale: The .netrc file presents a significant security risk since it stores passwords in unencrypted form. Even if FTP is disabled, user accounts may have brought over .netrc files from other systems which could pose a risk to those systems." solution : "Making global modifications to users' files without alerting the user community can result in unexpected outages and unhappy users. Therefore, it is recommended that a monitoring policy be established to report user .netrc files and determine the action to be taken in accordance with site policy. Notes: On some distributions the /sbin/nologin should be replaced with /usr/sbin/nologin." reference : "800-171|3.4.6,800-171|3.4.7,800-53|CM-7,CN-L3|7.1.3.5(c),CN-L3|7.1.3.7(d),CSCv7|16.4,CSF|PR.IP-1,CSF|PR.PT-3,ITSG-33|CM-7,LEVEL|1S,NIAv2|SS13b,NIAv2|SS14a,NIAv2|SS14c,NIAv2|SS15a,SWIFT-CSCv1|2.3" see_also : "https://workbench.cisecurity.org/files/2485" cmd : "/usr/bin/cat /etc/passwd | /usr/bin/egrep -v '^(root|halt|sync|shutdown)' | /usr/bin/awk -F: '($7 != \"/sbin/nologin\") { print $1 \" \" $3 \" \" $6 }' | while read user uid dir; do if [ -f \"$dir/.netrc\" ]; then /usr/bin/echo \".netrc file $dir/.netrc exists\"; fi; done | /usr/bin/awk '{ print } END { if (NR==0) print \"No .netrc files found\" }'" expect : "No .netrc files found" dont_echo_cmd : YES system : "Linux" type : CMD_EXEC description : "6.2.12 Ensure users' .netrc Files are not group or world accessible" info : "While the system administrator can establish secure permissions for users' .netrc files, the users can easily override these. Rationale: .netrcfiles may contain unencrypted passwords that may be used to attack other systems." solution : "Making global modifications to users' files without alerting the user community can result in unexpected outages and unhappy users. Therefore, it is recommended that a monitoring policy be established to report user .netrc file permissions and determine the action to be taken in accordance with site policy. Notes: While the complete removal of .netrc files is recommended if any are required on the system secure permissions must be applied." reference : "800-171|3.4.2,800-53|CM-6,CSCv7|14.6,CSF|PR.IP-1,ITSG-33|CM-6,LEVEL|1S,NESA|T3.2.1,SWIFT-CSCv1|2.3" see_also : "https://workbench.cisecurity.org/files/2485" cmd : "for dir in $(/usr/bin/cat /etc/passwd | /usr/bin/egrep -v '(root|halt|sync|shutdown)' | /usr/bin/awk -F: '($7 != \"/sbin/nologin\") { print $6 }'); do if [ -f \"$dir/.netrc\" ]; then fileperm=$(ls -ld $dir/.netrc | cut -f1 -d\" \"); if [ $(/usr/bin/echo $fileperm | cut -c5) != \"-\" ]; then /usr/bin/echo \"Group Read set on $dir/.netrc\"; fi; if [ $(/usr/bin/echo $fileperm | cut -c6) != \"-\" ]; then /usr/bin/echo \"Group Write set on $dir/.netrc\"; fi; if [ $(/usr/bin/echo $fileperm | cut -c7) != \"-\" ]; then /usr/bin/echo \"Group Execute set on $dir/.netrc\"; fi; if [ $(/usr/bin/echo $fileperm | cut -c8) != \"-\" ]; then /usr/bin/echo \"Other Read set on $dir/.netrc\"; fi; if [ $(/usr/bin/echo $fileperm | cut -c9) != \"-\" ]; then /usr/bin/echo \"Other Write set on $dir/.netrc\"; fi; if [ $(/usr/bin/echo $fileperm | cut -c10) != \"-\" ]; then /usr/bin/echo \"Other Execute set on $dir/.netrc\"; fi; fi; done | /usr/bin/awk '{ print } END { if (NR==0) print \"All .netrc files are not group or world accessible\" }'" expect : "All .netrc files are not group or world accessible" system : "Linux" type : CMD_EXEC description : "6.2.13 Ensure no users have .rhosts files" info : "While no .rhosts files are shipped by default, users can easily create them. Rationale: This action is only meaningful if .rhosts support is permitted in the file /etc/pam.conf . Even though the .rhosts files are ineffective if support is disabled in /etc/pam.conf , they may have been brought over from other systems and could contain information useful to an attacker for those other systems." solution : "Making global modifications to users' files without alerting the user community can result in unexpected outages and unhappy users. Therefore, it is recommended that a monitoring policy be established to report user .rhosts files and determine the action to be taken in accordance with site policy. Notes: On some distributions the /sbin/nologin should be replaced with /usr/sbin/nologin." reference : "800-171|3.4.6,800-171|3.4.7,800-53|CM-7,CN-L3|7.1.3.5(c),CN-L3|7.1.3.7(d),CSCv7|16.4,CSF|PR.IP-1,CSF|PR.PT-3,ITSG-33|CM-7,LEVEL|1S,NIAv2|SS13b,NIAv2|SS14a,NIAv2|SS14c,NIAv2|SS15a,SWIFT-CSCv1|2.3" see_also : "https://workbench.cisecurity.org/files/2485" cmd : "/usr/bin/cat /etc/passwd | /usr/bin/egrep -v '^(root|halt|sync|shutdown)' | /usr/bin/awk -F: '($7 != \"/sbin/nologin\") { print $1 \" \" $3 \" \" $6 }' | while read user uid dir; do if [ -f \"$dir/.rhosts\" ]; then /usr/bin/echo \".rhosts file $dir/.rhosts exists\"; fi; done | /usr/bin/awk '{ print } END { if (NR==0) print \"No .rhosts files found\" }'" expect : "No .rhosts files found" dont_echo_cmd : YES system : "Linux" description : "6.2.14 Ensure all groups in /etc/passwd exist in /etc/group" info : "Over time, system administration errors and changes can lead to groups being defined in /etc/passwd but not in /etc/group . Rationale: Groups defined in the /etc/passwd file but not in the /etc/group file pose a threat to system security since group permissions are not properly managed." solution : "Analyze the output of the Audit step above and perform the appropriate action to correct any discrepancies found." reference : "800-171|3.1.1,800-53|AC-2,CN-L3|7.1.3.2(d),CSCv7|16,CSF|DE.CM-1,CSF|DE.CM-3,CSF|PR.AC-1,CSF|PR.AC-4,ITSG-33|AC-2,LEVEL|1S,NESA|T5.2.1,NESA|T5.2.2,NIAv2|AM28,NIAv2|NS5j,NIAv2|SS14e" see_also : "https://workbench.cisecurity.org/files/2485" name : "passwd_invalid_gid" system : "Linux" description : "6.2.15 Ensure no duplicate UIDs exist" info : "Although the useradd program will not let you create a duplicate User ID (UID), it is possible for an administrator to manually edit the /etc/passwd file and change the UID field. Rationale: Users must be assigned unique UIDs for accountability and to ensure appropriate access protections." solution : "Based on the results of the audit script, establish unique UIDs and review all files owned by the shared UIDs to determine which UID they are supposed to belong to." reference : "800-171|3.5.5,800-171|3.5.6,800-53|IA-4,CN-L3|7.1.2.7(b),CSCv7|16,CSF|PR.AC-1,ITSG-33|IA-4,LEVEL|1S,NESA|T5.5.2,NIAv2|AM14a,SWIFT-CSCv1|5" see_also : "https://workbench.cisecurity.org/files/2485" name : "passwd_duplicate_uid" system : "Linux" description : "6.2.16 Ensure no duplicate GIDs exist" info : "Although the groupadd program will not let you create a duplicate Group ID (GID), it is possible for an administrator to manually edit the /etc/group file and change the GID field. Rationale: User groups must be assigned unique GIDs for accountability and to ensure appropriate access protections." solution : "Based on the results of the audit script, establish unique GIDs and review all files owned by the shared GID to determine which group they are supposed to belong to. Notes: You can also use the grpck command to check for other inconsistencies in the /etc/group file." reference : "800-171|3.5.5,800-171|3.5.6,800-53|IA-4,CN-L3|7.1.2.7(b),CSCv7|16,CSF|PR.AC-1,ITSG-33|IA-4,LEVEL|1S,NESA|T5.5.2,NIAv2|AM14a,SWIFT-CSCv1|5" see_also : "https://workbench.cisecurity.org/files/2485" name : "group_duplicate_gid" system : "Linux" description : "6.2.17 Ensure no duplicate user names exist" info : "Although the useradd program will not let you create a duplicate user name, it is possible for an administrator to manually edit the /etc/passwd file and change the user name. Rationale: If a user is assigned a duplicate user name, it will create and have access to files with the first UID for that username in /etc/passwd . For example, if \"test4\" has a UID of 1000 and a subsequent \"test4\" entry has a UID of 2000, logging in as \"test4\" will use UID 1000. Effectively, the UID is shared, which is a security problem." solution : "Based on the results of the audit script, establish unique user names for the users. File ownerships will automatically reflect the change as long as the users have unique UIDs." reference : "800-171|3.5.5,800-171|3.5.6,800-53|IA-4,CN-L3|7.1.2.7(b),CSCv7|16,CSF|PR.AC-1,ITSG-33|IA-4,LEVEL|1S,NESA|T5.5.2,NIAv2|AM14a,SWIFT-CSCv1|5" see_also : "https://workbench.cisecurity.org/files/2485" name : "passwd_duplicate_username" system : "Linux" description : "6.2.18 Ensure no duplicate group names exist" info : "Although the groupadd program will not let you create a duplicate group name, it is possible for an administrator to manually edit the /etc/group file and change the group name. Rationale: If a group is assigned a duplicate group name, it will create and have access to files with the first GID for that group in /etc/group . Effectively, the GID is shared, which is a security problem." solution : "Based on the results of the audit script, establish unique names for the user groups. File group ownerships will automatically reflect the change as long as the groups have unique GIDs." reference : "800-171|3.5.5,800-171|3.5.6,800-53|IA-4,CN-L3|7.1.2.7(b),CSCv7|16,CSF|PR.AC-1,ITSG-33|IA-4,LEVEL|1S,NESA|T5.5.2,NIAv2|AM14a,SWIFT-CSCv1|5" see_also : "https://workbench.cisecurity.org/files/2485" name : "group_duplicate_name" system : "Linux" type : CMD_EXEC description : "6.2.19 Ensure shadow group is empty - /etc/passwd" info : "The shadow group allows system programs which require access the ability to read the /etc/shadow file. No users should be assigned to the shadow group. Rationale: Any users assigned to the shadow group would be granted read access to the /etc/shadow file. If attackers can gain read access to the /etc/shadow file, they can easily run a password cracking program against the hashed passwords to break them. Other security information that is stored in the /etc/shadow file (such as expiration) could also be useful to subvert additional user accounts." solution : "Remove all users from the shadow group, and change the primary group of any users with shadow as their primary group." reference : "800-171|3.1.1,800-53|AC-2,CN-L3|7.1.3.2(d),CSCv7|5.1,CSF|DE.CM-1,CSF|DE.CM-3,CSF|PR.AC-1,CSF|PR.AC-4,ITSG-33|AC-2,LEVEL|1S,NESA|M4.4.3,NESA|T5.2.1,NIAv2|AM28,NIAv2|NS5j,NIAv2|SS14d,NIAv2|SS14e" see_also : "https://workbench.cisecurity.org/files/2485" # Note: Variable @SHADOW_GID@ replaced with "42" in field "cmd". cmd : "/usr/bin/awk -F: '($4 == \"42\") { print }' /etc/passwd | /usr/bin/awk '{print} END {if (NR == 0) print \"none\"'}" expect : "none" system : "Linux" type : CMD_EXEC description : "6.2.19 Ensure shadow group is empty - /etc/group" info : "The shadow group allows system programs which require access the ability to read the /etc/shadow file. No users should be assigned to the shadow group. Rationale: Any users assigned to the shadow group would be granted read access to the /etc/shadow file. If attackers can gain read access to the /etc/shadow file, they can easily run a password cracking program against the hashed passwords to break them. Other security information that is stored in the /etc/shadow file (such as expiration) could also be useful to subvert additional user accounts." solution : "Remove all users from the shadow group, and change the primary group of any users with shadow as their primary group." reference : "800-171|3.1.1,800-53|AC-2,CN-L3|7.1.3.2(d),CSCv7|5.1,CSF|DE.CM-1,CSF|DE.CM-3,CSF|PR.AC-1,CSF|PR.AC-4,ITSG-33|AC-2,LEVEL|1S,NESA|M4.4.3,NESA|T5.2.1,NIAv2|AM28,NIAv2|NS5j,NIAv2|SS14d,NIAv2|SS14e" see_also : "https://workbench.cisecurity.org/files/2485" cmd : "/usr/bin/grep ^shadow:[^:]*:[^:]*:[^:]+ /etc/group | /usr/bin/awk '{print} END {if (NR == 0) print \"none\"'}" expect : "none" system : "Linux" type : CMD_EXEC description : "6.2.20 Ensure all users' home directories exist" info : "Users can be defined in /etc/passwd without a home directory or with a home directory that does not actually exist. Rationale: If the user's home directory does not exist or is unassigned, the user will be placed in \"/\" and will not be able to write any files or have local environment variables set." solution : "If any users' home directories do not exist, create them and make sure the respective user owns the directory. Users without an assigned home directory should be removed or assigned a home directory as appropriate. Notes: The audit script checks all users with interactive shells except halt, sync, shutdown, and nfsnobody." reference : "800-171|3.4.2,800-53|CM-6,CSCv7|5.1,CSF|PR.IP-1,ITSG-33|CM-6,LEVEL|1S,NESA|T3.2.1,PCI-DSSv3.1|2.2.4,PCI-DSSv3.2|2.2.4,SWIFT-CSCv1|2.3" see_also : "https://workbench.cisecurity.org/files/2485" cmd : "/usr/bin/cat /etc/passwd | /usr/bin/egrep -v '^(root|halt|sync|shutdown)' | /usr/bin/awk -F: '($7 != \"/sbin/nologin\" && $7 != \"/bin/false\") { print $1 \" \" $3 \" \" $6 }'| while read user uid dir; do if [ ! -d \"$dir\" ]; then /usr/bin/echo \"The home directory ($dir) of user $user does not exist.\"; fi; done | /usr/bin/awk '{print} END {if (NR == 0) print \"none\"'}" expect : "^none" description : "CIS_Red_Hat_EL8_Server_L1_v1.0.0.audit from CIS Red Hat Enterprise Linux 8 Benchmark v1.0.0" info : "NOTE: Nessus has not identified that the chosen audit applies to the target device."