#TRUSTED 62ea6de15bcab730062184d8925c3cab8df5ded0920dc9ebb248734a82b03cec392d93307f5d2ac970daa6a5d14c3490ecd4deedbd98f1d385ae5a8a773dac48edcae9d3a750723a465a73bb206109e6af61ec6a6c8dc3376161464b2fa10b12da57e960637e775401c984f00b7f9b877dcee19e56a5cff01e90c5ae3ce85116a4a9c8e6fef75011838c5f4542141cfa375627b52023490c7f4d859f79c3d842942b1712f33c341479a82493d2b63d4c34a34a9b83d4c82af71f6fb56b082cd6aa4e6e50f539ce34bfd93854e2dbc54fd9a8ae50d542cc98a62155da00191eab32843564b08fa8169a93c00647b4ef0fcba2af02d6622be4eb4ba2848edf3bfc2d1d7f056af4e8f553ad1193489941bb1df2a5ede9eccf4e6b0d95023dc5e9416ae05b3e633e155a9d8156eaafbd0df99b6cf993fe89c35a2199e287759ffe7022e8bb5999a7183b790b559061230659e727a0c34e69bd0edc4092fc086c68da3bbb4cb914afacf8fac721505ee41aa430abbb969a65581673bd994e9d447635cd6e4a310e590b9117e4f11f4f03a8bed4801144f100c4992022e0de69ee1dab65055c03781b12ae3f257dd4d92f9771b0de410cd00dacba16fa44567812f04484daf1a1780f8e5c4a81c0f087ac45ba7c13f4df1206f8ce041ee5a1472dfe9e7473fcc14606ffa84152b7b68cc89155a6c5490787a54315c24ade8251d7b57c #TRUST-RSA-SHA256 533fbc50b17b26ff2488f4fcd57d7b6b5cfda59ca25c2ea4254abc6c40e0eec02ba0d74df9498174312b9b4ad17c990764b14c5afb080077ac741d1af1bf8e7e5078b16cbbf382dc5bd819ed6d16fbef9bc35bd532e06d05304085cac4c9d5c7c9b445860699cd485de07aabde4119728aebebe0421f84ba7abb174a9e3d15debfc81acddc452d791665a2cdd4292ed06bf19d30ebc582f8d2463f863e68bc57cab325db4e7ded63143404d5b06d5d38fd6ca7815980a2d3c27b585bb5a1b1a124b3c3c77fcdd29442a4aad5bebfabca6751a5b33b7f9ba15c741d69dec8bf54de19b464388c68b37f0c7e5cd6eaf01bcfe5928971a2a157ab415a57099fbcd8fb2ff04a7fe71c6e73a2acb7607b293f11f22881948d013d44cb4bcc878423c2f30d788f50b23826ca91663c91fc648baed5a8de9fc90fda795181b4ce8c5dc3bd815117874a0942e59fa6d7a653080cedccb6ab9bc94f1f6e55f7d7744127b62eb6a88cbed1781709fcb1ab1225b35352335663ba2f7a954930aed037f1c1e24cef2d26841fdf9e91ae40fac217a59f8312c47d53f176fe70cd368cf8353831b8169d617511be0830e711afdb365d2fbfaccce5d5526210cfe5f3f79fd888f2a0192c49278da32e70bdf0264b694330c6c63f6b8bbee21e7ded175a304c96e39117bfe8669080215f01a4b0fce3aa9e3ebb677bbd1883374e0b80457a91ec29 # # This script is Copyright (C) 2004-2025 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: 2025/02/18 $ # # description : This .audit is designed against the CIS SUSE Linux Enterprise 15 Benchmark 2.0.0 # # #Safeguard SUSE Linux Enterprise 15 v2.0.0 L1 Server # # CIS # SUSE Linux Enterprise 15 # L1 Server # 2.0.0 # https://workbench.cisecurity.org/benchmarks/20333 # #cis,suse_linux_15,agent,unix #CSCv6,CSCv7,CSCv8,LEVEL # # # 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. # STRING # # # NTP_SERVER # 10.0.0.2 # Network Time Server # Host address of the NTP server for the target. # STRING # # # FIND_TIMEOUT # 7200 # Timeout for checks that search for files # Timeout, in seconds, for checks that search for files. Range of 1-7200. # INTEGER # # # FIREWALLD_DEFAULT_ZONE # public # Firewalld default zone # The default zone adhering to company policy. Default is public. # STRING # # # SSH_BANNER_TEXT # Authorized users only. All activity may be monitored and reported. # SSH Banner Text # This is the text for the warning a user receives when logging onto the system. # STRING # # # SSH_BANNER_FILE # /etc/issue.net # SSH Banner File Path # The path to the SSH banner file as found in sshd_config. # UNIX_FILE_PATH # # # PASSWORD_DENY # [1-3] # Lock out users after unsuccessful consecutive login attempts. # The number of times to lock out users after unsuccessful consecutive login attempts. # STRING # # # PASSWORD_UNLOCK_TIME # (0|9[0-9][0-9]|[1-9][0-9]{3,}) # Time before the account is unlocked # Time in seconds before the account is unlocked found in faillock.conf # STRING # # # PASSWORD_DIFOK # ([2-9]|[1-9][0-9]+) # Password characters that must be changed. # The number of characters in a password that must not be present in the old password. # STRING # # # PASSWORD_MINIMUM_LENGTH # (1[4-9]|[2-9][0-9]|[1-9][0-9]{2,}) # Password Minimum Length # Password Minimum Length found in /etc/security/pwquality.conf /etc/security/pwquality.conf.d/*.conf # STRING # # # PASSWORD_MINCLASS # 4 # Password Complexity Value # Password complexity value found in /etc/security/pwquality.conf # STRING # # # PASSWORD_OCREDIT # -[1-9] # Password symbols required # Password symbols value found in /etc/security/pwquality.conf # STRING # # # PASSWORD_UCREDIT # -[1-9] # Password uppercase characters required # Password uppercase characters found in /etc/security/pwquality.conf # STRING # # # PASSWORD_LCREDIT # -[1-9] # Password lowercase characters required # Password lowercase characters found in /etc/security/pwquality.conf # STRING # # # PASSWORD_DCREDIT # -[1-9] # Password digits required # Password digits value found in /etc/security/pwquality.conf # STRING # # # PASSWORD_MAXREPEAT # [1-3] # Password maxrepeat. # The maximum number of allowed same consecutive characters in a new password. # STRING # # # PASSWORD_MAXSEQUENCE # [1-3] # Password maxsequence. # The maximum length of monotonic character sequences in the new password. # STRING # # # PASSWORD_HISTORY_REMEMBER # (2[4-9]|[3-9][0-9]|[1-9][0-9]{2,}) # Number of old passwords to remember. # The number of old passwords to remember. # STRING # # # PASSWORD_ENCRYPTION_PAM # (sha512) # Password encryption method pam # Password encryption method found in /etc/pam.d # STRING # # # PASSWORD_MAX_DAYS # 90 # Password expiration # Password expiration parameter found in /etc/login.defs # INTEGER # # # PASSWORD_WARN_AGE # 14 # Password expiration warning # Password expiration warning parameter found in /etc/login.defs # INTEGER # # # PASSWORD_ENCRYPTION_LOGIN # SHA512 # Password encryption method login.defs # Password encryption method found in /etc/login.defs # STRING # # # INACTIVE_PASSWORD_LOCK # 120 # Password lock for inactive users # The given period of time a user can be inactive before account is locked # STRING # # # LOG_SECURE # /var/log/secure # Rsyslog.conf - destination for auth,authpriv.* # The preferred destination for auth and authpriv messages. # STRING # # # LOG_MAIL # /var/log/mail # Rsyslog.conf - destination for mail.* # The preferred destination for mail.* messages. # STRING # # # LOG_MAIL_INFO # /var/log/mail.info # Rsyslog.conf - destination for mail.info # The preferred destination for mail.info messages. # STRING # # # LOG_MAIL_WARN # /var/log/mail.warn # Rsyslog.conf - destination for mail.warning # The preferred destination for mail.warning messages. # STRING # # # LOG_MAIL_ERR # /var/log/mail.err # Rsyslog.conf - destination for mail.err # The preferred destination for mail.err messages. # STRING # # # LOG_CRON # /var/log/cron # Rsyslog.conf - destination for cron.* # The preferred destination for cron.* messages. # STRING # # # LOG_WARN # /var/log/warn # Rsyslog.conf - destination for warning, err, and .crit # The preferred destination for *.=warning;*.=err, and *.crit messages. # STRING # # # LOG_MESSAGES # /var/log/messages # Rsyslog.conf - destination for catchall, mail.none, news.none # The preferred destination for *.*;mail.none;news.none messages. # STRING # # # LOG_LOCALMESSAGES # /var/log/localmessages # Rsyslog.conf - destination for local* # The preferred destination for local0-local7.* messages. # STRING # # # PLATFORM_VERSION # 15 # SUSE Version # SUSE Version # STRING # # # type : FILE_CONTENT_CHECK description : "SUSE Linux 15 is installed - VERSION" file : "/etc/os-release" regex : "^[\\s]*VERSION[\\s]*=" expect : "^[\\s]*VERSION[\\s]*=\"[\\s]*@PLATFORM_VERSION@" type : FILE_CONTENT_CHECK description : "SUSE Linux 15 is installed - NAME" file : "/etc/os-release" regex : "^[\\s]*NAME[\\s]*=" expect : "^[\\s]*NAME[\\s]*=\"[\\s]*SLES[\\s]*\"$" description : "CIS_SUSE_Linux_Enterprise_15_v2.0.0_L1_Server.audit from CIS SUSE Linux Enterprise 15 Benchmark v2.0.0" see_also : "https://workbench.cisecurity.org/benchmarks/20333" type : CMD_EXEC description : "1.1.1.1 Ensure cramfs kernel module is not available" 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. Removing support for unneeded filesystem types reduces the local attack surface of the system. If this filesystem type is not needed, disable it." solution : "Run the following script to unload and disable the cramfs module: - IF - the cramfs kernel module is available in ANY installed kernel: - Create a file ending inconf with install cramfs /bin/false in the /etc/modprobe.d/ directory - Create a file ending inconf with blacklist cramfs in the /etc/modprobe.d/ directory - Run modprobe -r cramfs 2>/dev/null; rmmod cramfs 2>/dev/null to remove cramfs from the kernel - IF - the cramfs kernel module is not available on the system, or pre-compiled into the kernel, no remediation is necessary #!/usr/bin/env bash { a_output2=() a_output3=() l_dl=\"\" l_mod_name=\"cramfs\" l_mod_type=\"fs\" l_mod_path=\"$(readlink -f /lib/modules/**/kernel/$l_mod_type || readlink -f /lib/modules/**/kernel/$l_mod_type)\" f_module_fix() { l_dl=\"y\" a_showconfig=() while IFS= read -r l_showconfig; do a_showconfig+=(\"$l_showconfig\") done < <(modprobe --showconfig | grep -P -- '\b(install|blacklist)\h+'\"${l_mod_chk_name//-/_}\"'\b') if lsmod | grep \"$l_mod_chk_name\" &> /dev/null; then a_output2+=(\" - unloading kernel module: \\\"$l_mod_name\\\"\") modprobe -r \"$l_mod_chk_name\" 2>/dev/null; rmmod \"$l_mod_name\" 2>/dev/null fi if ! grep -Pq -- '\binstall\h+'\"${l_mod_chk_name//-/_}\"'\h+(\/usr)?\/bin\/(true|false)\b' <<< \"${a_showconfig[*]}\"; then a_output2+=(\" - setting kernel module: \\\"$l_mod_name\\\" to \\\"$(readlink -f /bin/false)\\\"\") printf '%s\n' \"install $l_mod_chk_name $(readlink -f /bin/false)\" >> /etc/modprobe.d/\"$l_mod_name\".conf fi if ! grep -Pq -- '\bblacklist\h+'\"${l_mod_chk_name//-/_}\"'\b' <<< \"${a_showconfig[*]}\"; then a_output2+=(\" - denylisting kernel module: \\\"$l_mod_name\\\"\") printf '%s\n' \"blacklist $l_mod_chk_name\" >> /etc/modprobe.d/\"$l_mod_name\".conf fi } for l_mod_base_directory in $l_mod_path; do # Check if the module exists on the system if [ -d \"$l_mod_base_directory/${l_mod_name/-/\/}\" ] && [ -n \"$(ls -A \"$l_mod_base_directory/${l_mod_name/-/\/}\")\" ]; then a_output3+=(\" - \\\"$l_mod_base_directory\\\"\") l_mod_chk_name=\"$l_mod_name\" [[ \"$l_mod_name\" =~ overlay ]] && l_mod_chk_name=\"${l_mod_name::-2}\" [ \"$l_dl\" != \"y\" ] && f_module_fix else printf '%s\n' \" - kernel module: \\\"$l_mod_name\\\" doesn't exist in \\\"$l_mod_base_directory\\\"\" fi done [ \"${#a_output3[@]}\" -gt 0 ] && printf '%s\n' \"\" \" -- INFO --\" \" - module: \\\"$l_mod_name\\\" exists in:\" \"${a_output3[@]}\" [ \"${#a_output2[@]}\" -gt 0 ] && printf '%s\n' \"\" \"${a_output2[@]}\" || printf '%s\n' \"\" \" - No changes needed\" printf '%s\n' \"\" \" - remediation of kernel module: \\\"$l_mod_name\\\" complete\" \"\" }" reference : "800-171|3.4.2,800-171|3.4.6,800-171|3.4.7,800-171r3|03.04.02,800-171r3|03.04.06,800-53|CM-6,800-53|CM-7,800-53r5|CM-6,800-53r5|CM-7,CSCv7|9.2,CSCv8|4.8,CSF|PR.IP-1,CSF|PR.PT-3,CSF2.0|DE.CM-09,CSF2.0|PR.PS-01,GDPR|32.1.b,HIPAA|164.306(a)(1),ISO-27001-2022|A.8.9,ITSG-33|CM-6,ITSG-33|CM-7,LEVEL|1A,NIAv2|SS15a,PCI-DSSv3.2.1|2.2.2,SWIFT-CSCv1|2.3" see_also : "https://workbench.cisecurity.org/benchmarks/20333" cmd : "#!/bin/bash { l_output3=\"\" l_dl=\"\" # clear variables unset a_output; unset a_output2 # unset arrays l_mod_name=\"cramfs\" # set module name l_mod_type=\"fs\" # set module type l_mod_path=\"$(readlink -f /lib/modules/**/kernel/$l_mod_type | sort -u)\" f_module_chk() { l_dl=\"y\" # Set to ignore duplicate checks a_showconfig=() # Create array with modprobe output while IFS= read -r l_showconfig; do a_showconfig+=(\"$l_showconfig\") done < <(modprobe --showconfig | grep -P -- '\\b(install|blacklist)\\h+'\"${l_mod_name//-/_}\"'\\b') if ! lsmod | grep \"$l_mod_name\" &> /dev/null; then # Check if the module is currently loaded a_output+=(\" - kernel module: \\\"$l_mod_name\\\" is not loaded\") else a_output2+=(\" - kernel module: \\\"$l_mod_name\\\" is loaded\") fi if grep -Pq -- '\\binstall\\h+'\"${l_mod_name//-/_}\"'\\h+\\/bin\\/(true|false)\\b' <<< \"${a_showconfig[*]}\"; then a_output+=(\" - kernel module: \\\"$l_mod_name\\\" is not loadable\") else a_output2+=(\" - kernel module: \\\"$l_mod_name\\\" is loadable\") fi if grep -Pq -- '\\bblacklist\\h+'\"${l_mod_name//-/_}\"'\\b' <<< \"${a_showconfig[*]}\"; then a_output+=(\" - kernel module: \\\"$l_mod_name\\\" is deny listed\") else a_output2+=(\" - kernel module: \\\"$l_mod_name\\\" is not deny listed\") fi } for l_mod_base_directory in $l_mod_path; do # Check if the module exists on the system if [ -d \"$l_mod_base_directory/${l_mod_name/-/\\/}\" ] && [ -n \"$(ls -A $l_mod_base_directory/${l_mod_name/-/\\/})\" ]; then l_output3=\"$l_output3\\n - \\\"$l_mod_base_directory\\\"\" [[ \"$l_mod_name\" =~ overlay ]] && l_mod_name=\"${l_mod_name::-2}\" [ \"$l_dl\" != \"y\" ] && f_module_chk else a_output+=(\" - kernel module: \\\"$l_mod_name\\\" doesn't exist in \\\"$l_mod_base_directory\\\"\") fi done [ -n \"$l_output3\" ] && echo -e \"\\n\\n -- INFO --\\n - module: \\\"$l_mod_name\\\" exists in:$l_output3\" if [ \"${#a_output2[@]}\" -le 0 ]; then printf '%s\\n' \"\" \"- Audit Result:\" \" ** PASS **\" \"${a_output[@]}\" else printf '%s\\n' \"\" \"- Audit Result:\" \" ** FAIL **\" \" - Reason(s) for audit failure:\" \"${a_output2[@]}\" [ \"${#a_output[@]}\" -gt 0 ] && printf '%s\\n' \"- Correctly set:\" \"${a_output[@]}\" fi }" expect : "(?i)^[\\s]*\\**[\\s]*pass:?[\\s]*\\**$" type : CMD_EXEC description : "1.1.1.2 Ensure freevxfs kernel module is not available" info : "The freevxfs filesystem type is a free version of the Veritas type filesystem. This is the primary filesystem type for HP-UX operating systems. Removing support for unneeded filesystem types reduces the local attack surface of the system. If this filesystem type is not needed, disable it." solution : "Run the following script to unload and disable the freevxfs module: - IF - the freevxfs kernel module is available in ANY installed kernel: - Create a file ending inconf with install freevxfs /bin/false in the /etc/modprobe.d/ directory - Create a file ending inconf with blacklist freevxfs in the /etc/modprobe.d/ directory - Run modprobe -r freevxfs 2>/dev/null; rmmod freevxfs 2>/dev/null to remove freevxfs from the kernel - IF - the freevxfs kernel module is not available on the system, or pre-compiled into the kernel, no remediation is necessary #!/usr/bin/env bash { a_output2=() a_output3=() l_dl=\"\" l_mod_name=\"freevxfs\" l_mod_type=\"fs\" l_mod_path=\"$(readlink -f /usr/lib/modules/**/kernel/$l_mod_type || readlink -f /lib/modules/**/kernel/$l_mod_type)\" f_module_fix() { l_dl=\"y\" a_showconfig=() while IFS= read -r l_showconfig; do a_showconfig+=(\"$l_showconfig\") done < <(modprobe --showconfig | grep -P -- '\b(install|blacklist)\h+'\"${l_mod_chk_name//-/_}\"'\b') if lsmod | grep \"$l_mod_chk_name\" &> /dev/null; then a_output2+=(\" - unloading kernel module: \\\"$l_mod_name\\\"\") modprobe -r \"$l_mod_chk_name\" 2>/dev/null; rmmod \"$l_mod_name\" 2>/dev/null fi if ! grep -Pq -- '\binstall\h+'\"${l_mod_chk_name//-/_}\"'\h+(\/usr)?\/bin\/(true|false)\b' <<< \"${a_showconfig[*]}\"; then a_output2+=(\" - setting kernel module: \\\"$l_mod_name\\\" to \\\"$(readlink -f /bin/false)\\\"\") printf '%s\n' \"install $l_mod_chk_name $(readlink -f /bin/false)\" >> /etc/modprobe.d/\"$l_mod_name\".conf fi if ! grep -Pq -- '\bblacklist\h+'\"${l_mod_chk_name//-/_}\"'\b' <<< \"${a_showconfig[*]}\"; then a_output2+=(\" - denylisting kernel module: \\\"$l_mod_name\\\"\") printf '%s\n' \"blacklist $l_mod_chk_name\" >> /etc/modprobe.d/\"$l_mod_name\".conf fi } for l_mod_base_directory in $l_mod_path; do # Check if the module exists on the system if [ -d \"$l_mod_base_directory/${l_mod_name/-/\/}\" ] && [ -n \"$(ls -A \"$l_mod_base_directory/${l_mod_name/-/\/}\")\" ]; then a_output3+=(\" - \\\"$l_mod_base_directory\\\"\") l_mod_chk_name=\"$l_mod_name\" [[ \"$l_mod_name\" =~ overlay ]] && l_mod_chk_name=\"${l_mod_name::-2}\" [ \"$l_dl\" != \"y\" ] && f_module_fix else printf '%s\n' \" - kernel module: \\\"$l_mod_name\\\" doesn't exist in \\\"$l_mod_base_directory\\\"\" fi done [ \"${#a_output3[@]}\" -gt 0 ] && printf '%s\n' \"\" \" -- INFO --\" \" - module: \\\"$l_mod_name\\\" exists in:\" \"${a_output3[@]}\" [ \"${#a_output2[@]}\" -gt 0 ] && printf '%s\n' \"\" \"${a_output2[@]}\" || printf '%s\n' \"\" \" - No changes needed\" printf '%s\n' \"\" \" - remediation of kernel module: \\\"$l_mod_name\\\" complete\" \"\" }" reference : "800-171|3.4.2,800-171|3.4.6,800-171|3.4.7,800-171r3|03.04.02,800-171r3|03.04.06,800-53|CM-6,800-53|CM-7,800-53r5|CM-6,800-53r5|CM-7,CSCv7|9.2,CSCv8|4.8,CSF|PR.IP-1,CSF|PR.PT-3,CSF2.0|DE.CM-09,CSF2.0|PR.PS-01,GDPR|32.1.b,HIPAA|164.306(a)(1),ISO-27001-2022|A.8.9,ITSG-33|CM-6,ITSG-33|CM-7,LEVEL|1A,NIAv2|SS15a,PCI-DSSv3.2.1|2.2.2,SWIFT-CSCv1|2.3" see_also : "https://workbench.cisecurity.org/benchmarks/20333" cmd : "#!/bin/bash { l_output3=\"\" l_dl=\"\" # clear variables unset a_output; unset a_output2 # unset arrays l_mod_name=\"freevxfs\" # set module name l_mod_type=\"fs\" # set module type l_mod_path=\"$(readlink -f /lib/modules/**/kernel/$l_mod_type | sort -u)\" f_module_chk() { l_dl=\"y\" # Set to ignore duplicate checks a_showconfig=() # Create array with modprobe output while IFS= read -r l_showconfig; do a_showconfig+=(\"$l_showconfig\") done < <(modprobe --showconfig | grep -P -- '\\b(install|blacklist)\\h+'\"${l_mod_name//-/_}\"'\\b') if ! lsmod | grep \"$l_mod_name\" &> /dev/null; then # Check if the module is currently loaded a_output+=(\" - kernel module: \\\"$l_mod_name\\\" is not loaded\") else a_output2+=(\" - kernel module: \\\"$l_mod_name\\\" is loaded\") fi if grep -Pq -- '\\binstall\\h+'\"${l_mod_name//-/_}\"'\\h+\\/bin\\/(true|false)\\b' <<< \"${a_showconfig[*]}\"; then a_output+=(\" - kernel module: \\\"$l_mod_name\\\" is not loadable\") else a_output2+=(\" - kernel module: \\\"$l_mod_name\\\" is loadable\") fi if grep -Pq -- '\\bblacklist\\h+'\"${l_mod_name//-/_}\"'\\b' <<< \"${a_showconfig[*]}\"; then a_output+=(\" - kernel module: \\\"$l_mod_name\\\" is deny listed\") else a_output2+=(\" - kernel module: \\\"$l_mod_name\\\" is not deny listed\") fi } for l_mod_base_directory in $l_mod_path; do # Check if the module exists on the system if [ -d \"$l_mod_base_directory/${l_mod_name/-/\\/}\" ] && [ -n \"$(ls -A $l_mod_base_directory/${l_mod_name/-/\\/})\" ]; then l_output3=\"$l_output3\\n - \\\"$l_mod_base_directory\\\"\" [[ \"$l_mod_name\" =~ overlay ]] && l_mod_name=\"${l_mod_name::-2}\" [ \"$l_dl\" != \"y\" ] && f_module_chk else a_output+=(\" - kernel module: \\\"$l_mod_name\\\" doesn't exist in \\\"$l_mod_base_directory\\\"\") fi done [ -n \"$l_output3\" ] && echo -e \"\\n\\n -- INFO --\\n - module: \\\"$l_mod_name\\\" exists in:$l_output3\" if [ \"${#a_output2[@]}\" -le 0 ]; then printf '%s\\n' \"\" \"- Audit Result:\" \" ** PASS **\" \"${a_output[@]}\" else printf '%s\\n' \"\" \"- Audit Result:\" \" ** FAIL **\" \" - Reason(s) for audit failure:\" \"${a_output2[@]}\" [ \"${#a_output[@]}\" -gt 0 ] && printf '%s\\n' \"- Correctly set:\" \"${a_output[@]}\" fi }" expect : "(?i)^[\\s]*\\**[\\s]*pass:?[\\s]*\\**$" type : CMD_EXEC description : "1.1.1.3 Ensure hfs kernel module is not available" info : "The hfs filesystem type is a hierarchical filesystem that allows you to mount Mac OS filesystems. Removing support for unneeded filesystem types reduces the local attack surface of the system. If this filesystem type is not needed, disable it." solution : "Run the following script to unload and disable the hfs module: - IF - the hfs kernel module is available in ANY installed kernel: - Create a file ending inconf with install hfs /bin/false in the /etc/modprobe.d/ directory - Create a file ending inconf with blacklist hfs in the /etc/modprobe.d/ directory - Run modprobe -r hfs 2>/dev/null; rmmod hfs 2>/dev/null to remove hfs from the kernel - IF - the hfs kernel module is not available on the system, or pre-compiled into the kernel, no remediation is necessary #!/usr/bin/env bash { a_output2=() a_output3=() l_dl=\"\" l_mod_name=\"hfs\" l_mod_type=\"fs\" l_mod_path=\"$(readlink -f /lib/modules/**/kernel/$l_mod_type || readlink -f /lib/modules/**/kernel/$l_mod_type)\" f_module_fix() { l_dl=\"y\" a_showconfig=() while IFS= read -r l_showconfig; do a_showconfig+=(\"$l_showconfig\") done < <(modprobe --showconfig | grep -P -- '\b(install|blacklist)\h+'\"${l_mod_chk_name//-/_}\"'\b') if lsmod | grep \"$l_mod_chk_name\" &> /dev/null; then a_output2+=(\" - unloading kernel module: \\\"$l_mod_name\\\"\") modprobe -r \"$l_mod_chk_name\" 2>/dev/null; rmmod \"$l_mod_name\" 2>/dev/null fi if ! grep -Pq -- '\binstall\h+'\"${l_mod_chk_name//-/_}\"'\h+(\/usr)?\/bin\/(true|false)\b' <<< \"${a_showconfig[*]}\"; then a_output2+=(\" - setting kernel module: \\\"$l_mod_name\\\" to \\\"$(readlink -f /bin/false)\\\"\") printf '%s\n' \"install $l_mod_chk_name $(readlink -f /bin/false)\" >> /etc/modprobe.d/\"$l_mod_name\".conf fi if ! grep -Pq -- '\bblacklist\h+'\"${l_mod_chk_name//-/_}\"'\b' <<< \"${a_showconfig[*]}\"; then a_output2+=(\" - denylisting kernel module: \\\"$l_mod_name\\\"\") printf '%s\n' \"blacklist $l_mod_chk_name\" >> /etc/modprobe.d/\"$l_mod_name\".conf fi } for l_mod_base_directory in $l_mod_path; do # Check if the module exists on the system if [ -d \"$l_mod_base_directory/${l_mod_name/-/\/}\" ] && [ -n \"$(ls -A \"$l_mod_base_directory/${l_mod_name/-/\/}\")\" ]; then a_output3+=(\" - \\\"$l_mod_base_directory\\\"\") l_mod_chk_name=\"$l_mod_name\" [[ \"$l_mod_name\" =~ overlay ]] && l_mod_chk_name=\"${l_mod_name::-2}\" [ \"$l_dl\" != \"y\" ] && f_module_fix else printf '%s\n' \" - kernel module: \\\"$l_mod_name\\\" doesn't exist in \\\"$l_mod_base_directory\\\"\" fi done [ \"${#a_output3[@]}\" -gt 0 ] && printf '%s\n' \"\" \" -- INFO --\" \" - module: \\\"$l_mod_name\\\" exists in:\" \"${a_output3[@]}\" [ \"${#a_output2[@]}\" -gt 0 ] && printf '%s\n' \"\" \"${a_output2[@]}\" || printf '%s\n' \"\" \" - No changes needed\" printf '%s\n' \"\" \" - remediation of kernel module: \\\"$l_mod_name\\\" complete\" \"\" }" reference : "800-171|3.4.2,800-171|3.4.6,800-171|3.4.7,800-171r3|03.04.02,800-171r3|03.04.06,800-53|CM-6,800-53|CM-7,800-53r5|CM-6,800-53r5|CM-7,CSCv7|9.2,CSCv8|4.8,CSF|PR.IP-1,CSF|PR.PT-3,CSF2.0|DE.CM-09,CSF2.0|PR.PS-01,GDPR|32.1.b,HIPAA|164.306(a)(1),ISO-27001-2022|A.8.9,ITSG-33|CM-6,ITSG-33|CM-7,LEVEL|1A,NIAv2|SS15a,PCI-DSSv3.2.1|2.2.2,SWIFT-CSCv1|2.3" see_also : "https://workbench.cisecurity.org/benchmarks/20333" cmd : "#!/bin/bash { l_output3=\"\" l_dl=\"\" # clear variables unset a_output; unset a_output2 # unset arrays l_mod_name=\"hfs\" # set module name l_mod_type=\"fs\" # set module type l_mod_path=\"$(readlink -f /lib/modules/**/kernel/$l_mod_type | sort -u)\" f_module_chk() { l_dl=\"y\" # Set to ignore duplicate checks a_showconfig=() # Create array with modprobe output while IFS= read -r l_showconfig; do a_showconfig+=(\"$l_showconfig\") done < <(modprobe --showconfig | grep -P -- '\\b(install|blacklist)\\h+'\"${l_mod_name//-/_}\"'\\b') if ! lsmod | grep \"$l_mod_name\" &> /dev/null; then # Check if the module is currently loaded a_output+=(\" - kernel module: \\\"$l_mod_name\\\" is not loaded\") else a_output2+=(\" - kernel module: \\\"$l_mod_name\\\" is loaded\") fi if grep -Pq -- '\\binstall\\h+'\"${l_mod_name//-/_}\"'\\h+\\/bin\\/(true|false)\\b' <<< \"${a_showconfig[*]}\"; then a_output+=(\" - kernel module: \\\"$l_mod_name\\\" is not loadable\") else a_output2+=(\" - kernel module: \\\"$l_mod_name\\\" is loadable\") fi if grep -Pq -- '\\bblacklist\\h+'\"${l_mod_name//-/_}\"'\\b' <<< \"${a_showconfig[*]}\"; then a_output+=(\" - kernel module: \\\"$l_mod_name\\\" is deny listed\") else a_output2+=(\" - kernel module: \\\"$l_mod_name\\\" is not deny listed\") fi } for l_mod_base_directory in $l_mod_path; do # Check if the module exists on the system if [ -d \"$l_mod_base_directory/${l_mod_name/-/\\/}\" ] && [ -n \"$(ls -A $l_mod_base_directory/${l_mod_name/-/\\/})\" ]; then l_output3=\"$l_output3\\n - \\\"$l_mod_base_directory\\\"\" [[ \"$l_mod_name\" =~ overlay ]] && l_mod_name=\"${l_mod_name::-2}\" [ \"$l_dl\" != \"y\" ] && f_module_chk else a_output+=(\" - kernel module: \\\"$l_mod_name\\\" doesn't exist in \\\"$l_mod_base_directory\\\"\") fi done [ -n \"$l_output3\" ] && echo -e \"\\n\\n -- INFO --\\n - module: \\\"$l_mod_name\\\" exists in:$l_output3\" if [ \"${#a_output2[@]}\" -le 0 ]; then printf '%s\\n' \"\" \"- Audit Result:\" \" ** PASS **\" \"${a_output[@]}\" else printf '%s\\n' \"\" \"- Audit Result:\" \" ** FAIL **\" \" - Reason(s) for audit failure:\" \"${a_output2[@]}\" [ \"${#a_output[@]}\" -gt 0 ] && printf '%s\\n' \"- Correctly set:\" \"${a_output[@]}\" fi }" expect : "(?i)^[\\s]*\\**[\\s]*pass:?[\\s]*\\**$" type : CMD_EXEC description : "1.1.1.4 Ensure hfsplus kernel module is not available" info : "The hfsplus filesystem type is a hierarchical filesystem designed to replace hfs that allows you to mount Mac OS filesystems. Removing support for unneeded filesystem types reduces the local attack surface of the system. If this filesystem type is not needed, disable it." solution : "Run the following script to unload and disable the hfsplus module: - IF - the hfsplus kernel module is available in ANY installed kernel: - Create a file ending inconf with install hfsplus /bin/false in the /etc/modprobe.d/ directory - Create a file ending inconf with blacklist hfsplus in the /etc/modprobe.d/ directory - Run modprobe -r hfsplus 2>/dev/null; rmmod hfsplus 2>/dev/null to remove hfsplus from the kernel - IF - the hfsplus kernel module is not available on the system, or pre-compiled into the kernel, no remediation is necessary #!/usr/bin/env bash { a_output2=() a_output3=() l_dl=\"\" l_mod_name=\"hfsplus\" l_mod_type=\"fs\" l_mod_path=\"$(readlink -f /lib/modules/**/kernel/$l_mod_type || readlink -f /lib/modules/**/kernel/$l_mod_type)\" f_module_fix() { l_dl=\"y\" a_showconfig=() while IFS= read -r l_showconfig; do a_showconfig+=(\"$l_showconfig\") done < <(modprobe --showconfig | grep -P -- '\b(install|blacklist)\h+'\"${l_mod_chk_name//-/_}\"'\b') if lsmod | grep \"$l_mod_chk_name\" &> /dev/null; then a_output2+=(\" - unloading kernel module: \\\"$l_mod_name\\\"\") modprobe -r \"$l_mod_chk_name\" 2>/dev/null; rmmod \"$l_mod_name\" 2>/dev/null fi if ! grep -Pq -- '\binstall\h+'\"${l_mod_chk_name//-/_}\"'\h+(\/usr)?\/bin\/(true|false)\b' <<< \"${a_showconfig[*]}\"; then a_output2+=(\" - setting kernel module: \\\"$l_mod_name\\\" to \\\"$(readlink -f /bin/false)\\\"\") printf '%s\n' \"install $l_mod_chk_name $(readlink -f /bin/false)\" >> /etc/modprobe.d/\"$l_mod_name\".conf fi if ! grep -Pq -- '\bblacklist\h+'\"${l_mod_chk_name//-/_}\"'\b' <<< \"${a_showconfig[*]}\"; then a_output2+=(\" - denylisting kernel module: \\\"$l_mod_name\\\"\") printf '%s\n' \"blacklist $l_mod_chk_name\" >> /etc/modprobe.d/\"$l_mod_name\".conf fi } for l_mod_base_directory in $l_mod_path; do # Check if the module exists on the system if [ -d \"$l_mod_base_directory/${l_mod_name/-/\/}\" ] && [ -n \"$(ls -A \"$l_mod_base_directory/${l_mod_name/-/\/}\")\" ]; then a_output3+=(\" - \\\"$l_mod_base_directory\\\"\") l_mod_chk_name=\"$l_mod_name\" [[ \"$l_mod_name\" =~ overlay ]] && l_mod_chk_name=\"${l_mod_name::-2}\" [ \"$l_dl\" != \"y\" ] && f_module_fix else printf '%s\n' \" - kernel module: \\\"$l_mod_name\\\" doesn't exist in \\\"$l_mod_base_directory\\\"\" fi done [ \"${#a_output3[@]}\" -gt 0 ] && printf '%s\n' \"\" \" -- INFO --\" \" - module: \\\"$l_mod_name\\\" exists in:\" \"${a_output3[@]}\" [ \"${#a_output2[@]}\" -gt 0 ] && printf '%s\n' \"\" \"${a_output2[@]}\" || printf '%s\n' \"\" \" - No changes needed\" printf '%s\n' \"\" \" - remediation of kernel module: \\\"$l_mod_name\\\" complete\" \"\" }" reference : "800-171|3.4.2,800-171|3.4.6,800-171|3.4.7,800-171r3|03.04.02,800-171r3|03.04.06,800-53|CM-6,800-53|CM-7,800-53r5|CM-6,800-53r5|CM-7,CSCv7|9.2,CSCv8|4.8,CSF|PR.IP-1,CSF|PR.PT-3,CSF2.0|DE.CM-09,CSF2.0|PR.PS-01,GDPR|32.1.b,HIPAA|164.306(a)(1),ISO-27001-2022|A.8.9,ITSG-33|CM-6,ITSG-33|CM-7,LEVEL|1A,NIAv2|SS15a,PCI-DSSv3.2.1|2.2.2,SWIFT-CSCv1|2.3" see_also : "https://workbench.cisecurity.org/benchmarks/20333" cmd : "#!/bin/bash { l_output3=\"\" l_dl=\"\" # clear variables unset a_output; unset a_output2 # unset arrays l_mod_name=\"hfsplus\" # set module name l_mod_type=\"fs\" # set module type l_mod_path=\"$(readlink -f /lib/modules/**/kernel/$l_mod_type | sort -u)\" f_module_chk() { l_dl=\"y\" # Set to ignore duplicate checks a_showconfig=() # Create array with modprobe output while IFS= read -r l_showconfig; do a_showconfig+=(\"$l_showconfig\") done < <(modprobe --showconfig | grep -P -- '\\b(install|blacklist)\\h+'\"${l_mod_name//-/_}\"'\\b') if ! lsmod | grep \"$l_mod_name\" &> /dev/null; then # Check if the module is currently loaded a_output+=(\" - kernel module: \\\"$l_mod_name\\\" is not loaded\") else a_output2+=(\" - kernel module: \\\"$l_mod_name\\\" is loaded\") fi if grep -Pq -- '\\binstall\\h+'\"${l_mod_name//-/_}\"'\\h+\\/bin\\/(true|false)\\b' <<< \"${a_showconfig[*]}\"; then a_output+=(\" - kernel module: \\\"$l_mod_name\\\" is not loadable\") else a_output2+=(\" - kernel module: \\\"$l_mod_name\\\" is loadable\") fi if grep -Pq -- '\\bblacklist\\h+'\"${l_mod_name//-/_}\"'\\b' <<< \"${a_showconfig[*]}\"; then a_output+=(\" - kernel module: \\\"$l_mod_name\\\" is deny listed\") else a_output2+=(\" - kernel module: \\\"$l_mod_name\\\" is not deny listed\") fi } for l_mod_base_directory in $l_mod_path; do # Check if the module exists on the system if [ -d \"$l_mod_base_directory/${l_mod_name/-/\\/}\" ] && [ -n \"$(ls -A $l_mod_base_directory/${l_mod_name/-/\\/})\" ]; then l_output3=\"$l_output3\\n - \\\"$l_mod_base_directory\\\"\" [[ \"$l_mod_name\" =~ overlay ]] && l_mod_name=\"${l_mod_name::-2}\" [ \"$l_dl\" != \"y\" ] && f_module_chk else a_output+=(\" - kernel module: \\\"$l_mod_name\\\" doesn't exist in \\\"$l_mod_base_directory\\\"\") fi done [ -n \"$l_output3\" ] && echo -e \"\\n\\n -- INFO --\\n - module: \\\"$l_mod_name\\\" exists in:$l_output3\" if [ \"${#a_output2[@]}\" -le 0 ]; then printf '%s\\n' \"\" \"- Audit Result:\" \" ** PASS **\" \"${a_output[@]}\" else printf '%s\\n' \"\" \"- Audit Result:\" \" ** FAIL **\" \" - Reason(s) for audit failure:\" \"${a_output2[@]}\" [ \"${#a_output[@]}\" -gt 0 ] && printf '%s\\n' \"- Correctly set:\" \"${a_output[@]}\" fi }" expect : "(?i)^[\\s]*\\**[\\s]*pass:?[\\s]*\\**$" type : CMD_EXEC description : "1.1.1.5 Ensure jffs2 kernel module is not available" info : "The jffs2 (journaling flash filesystem 2) filesystem type is a log-structured filesystem used in flash memory devices. Removing support for unneeded filesystem types reduces the local attack surface of the system. If this filesystem type is not needed, disable it." solution : "Run the following script to unload and disable the jffs2 module: - IF - the jffs2 kernel module is available in ANY installed kernel: - Create a file ending inconf with install jffs2 /bin/false in the /etc/modprobe.d/ directory - Create a file ending inconf with blacklist jffs2 in the /etc/modprobe.d/ directory - Run modprobe -r jffs2 2>/dev/null; rmmod jffs2 2>/dev/null to remove jffs2 from the kernel - IF - the jffs2 kernel module is not available on the system, or pre-compiled into the kernel, no remediation is necessary #!/usr/bin/env bash { a_output2=() a_output3=() l_dl=\"\" l_mod_name=\"jffs2\" l_mod_type=\"fs\" l_mod_path=\"$(readlink -f /usr/lib/modules/**/kernel/$l_mod_type || readlink -f /lib/modules/**/kernel/$l_mod_type)\" f_module_fix() { l_dl=\"y\" a_showconfig=() while IFS= read -r l_showconfig; do a_showconfig+=(\"$l_showconfig\") done < <(modprobe --showconfig | grep -P -- '\b(install|blacklist)\h+'\"${l_mod_chk_name//-/_}\"'\b') if lsmod | grep \"$l_mod_chk_name\" &> /dev/null; then a_output2+=(\" - unloading kernel module: \\\"$l_mod_name\\\"\") modprobe -r \"$l_mod_chk_name\" 2>/dev/null; rmmod \"$l_mod_name\" 2>/dev/null fi if ! grep -Pq -- '\binstall\h+'\"${l_mod_chk_name//-/_}\"'\h+(\/usr)?\/bin\/(true|false)\b' <<< \"${a_showconfig[*]}\"; then a_output2+=(\" - setting kernel module: \\\"$l_mod_name\\\" to \\\"$(readlink -f /bin/false)\\\"\") printf '%s\n' \"install $l_mod_chk_name $(readlink -f /bin/false)\" >> /etc/modprobe.d/\"$l_mod_name\".conf fi if ! grep -Pq -- '\bblacklist\h+'\"${l_mod_chk_name//-/_}\"'\b' <<< \"${a_showconfig[*]}\"; then a_output2+=(\" - denylisting kernel module: \\\"$l_mod_name\\\"\") printf '%s\n' \"blacklist $l_mod_chk_name\" >> /etc/modprobe.d/\"$l_mod_name\".conf fi } for l_mod_base_directory in $l_mod_path; do # Check if the module exists on the system if [ -d \"$l_mod_base_directory/${l_mod_name/-/\/}\" ] && [ -n \"$(ls -A \"$l_mod_base_directory/${l_mod_name/-/\/}\")\" ]; then a_output3+=(\" - \\\"$l_mod_base_directory\\\"\") l_mod_chk_name=\"$l_mod_name\" [[ \"$l_mod_name\" =~ overlay ]] && l_mod_chk_name=\"${l_mod_name::-2}\" [ \"$l_dl\" != \"y\" ] && f_module_fix else printf '%s\n' \" - kernel module: \\\"$l_mod_name\\\" doesn't exist in \\\"$l_mod_base_directory\\\"\" fi done [ \"${#a_output3[@]}\" -gt 0 ] && printf '%s\n' \"\" \" -- INFO --\" \" - module: \\\"$l_mod_name\\\" exists in:\" \"${a_output3[@]}\" [ \"${#a_output2[@]}\" -gt 0 ] && printf '%s\n' \"\" \"${a_output2[@]}\" || printf '%s\n' \"\" \" - No changes needed\" printf '%s\n' \"\" \" - remediation of kernel module: \\\"$l_mod_name\\\" complete\" \"\" }" reference : "800-171|3.4.2,800-171|3.4.6,800-171|3.4.7,800-171r3|03.04.02,800-171r3|03.04.06,800-53|CM-6,800-53|CM-7,800-53r5|CM-6,800-53r5|CM-7,CSCv7|9.2,CSCv8|4.8,CSF|PR.IP-1,CSF|PR.PT-3,CSF2.0|DE.CM-09,CSF2.0|PR.PS-01,GDPR|32.1.b,HIPAA|164.306(a)(1),ISO-27001-2022|A.8.9,ITSG-33|CM-6,ITSG-33|CM-7,LEVEL|1A,NIAv2|SS15a,PCI-DSSv3.2.1|2.2.2,SWIFT-CSCv1|2.3" see_also : "https://workbench.cisecurity.org/benchmarks/20333" cmd : "#!/bin/bash { l_output3=\"\" l_dl=\"\" # clear variables unset a_output; unset a_output2 # unset arrays l_mod_name=\"jffs2\" # set module name l_mod_type=\"fs\" # set module type l_mod_path=\"$(readlink -f /lib/modules/**/kernel/$l_mod_type | sort -u)\" f_module_chk() { l_dl=\"y\" # Set to ignore duplicate checks a_showconfig=() # Create array with modprobe output while IFS= read -r l_showconfig; do a_showconfig+=(\"$l_showconfig\") done < <(modprobe --showconfig | grep -P -- '\\b(install|blacklist)\\h+'\"${l_mod_name//-/_}\"'\\b') if ! lsmod | grep \"$l_mod_name\" &> /dev/null; then # Check if the module is currently loaded a_output+=(\" - kernel module: \\\"$l_mod_name\\\" is not loaded\") else a_output2+=(\" - kernel module: \\\"$l_mod_name\\\" is loaded\") fi if grep -Pq -- '\\binstall\\h+'\"${l_mod_name//-/_}\"'\\h+\\/bin\\/(true|false)\\b' <<< \"${a_showconfig[*]}\"; then a_output+=(\" - kernel module: \\\"$l_mod_name\\\" is not loadable\") else a_output2+=(\" - kernel module: \\\"$l_mod_name\\\" is loadable\") fi if grep -Pq -- '\\bblacklist\\h+'\"${l_mod_name//-/_}\"'\\b' <<< \"${a_showconfig[*]}\"; then a_output+=(\" - kernel module: \\\"$l_mod_name\\\" is deny listed\") else a_output2+=(\" - kernel module: \\\"$l_mod_name\\\" is not deny listed\") fi } for l_mod_base_directory in $l_mod_path; do # Check if the module exists on the system if [ -d \"$l_mod_base_directory/${l_mod_name/-/\\/}\" ] && [ -n \"$(ls -A $l_mod_base_directory/${l_mod_name/-/\\/})\" ]; then l_output3=\"$l_output3\\n - \\\"$l_mod_base_directory\\\"\" [[ \"$l_mod_name\" =~ overlay ]] && l_mod_name=\"${l_mod_name::-2}\" [ \"$l_dl\" != \"y\" ] && f_module_chk else a_output+=(\" - kernel module: \\\"$l_mod_name\\\" doesn't exist in \\\"$l_mod_base_directory\\\"\") fi done [ -n \"$l_output3\" ] && echo -e \"\\n\\n -- INFO --\\n - module: \\\"$l_mod_name\\\" exists in:$l_output3\" if [ \"${#a_output2[@]}\" -le 0 ]; then printf '%s\\n' \"\" \"- Audit Result:\" \" ** PASS **\" \"${a_output[@]}\" else printf '%s\\n' \"\" \"- Audit Result:\" \" ** FAIL **\" \" - Reason(s) for audit failure:\" \"${a_output2[@]}\" [ \"${#a_output[@]}\" -gt 0 ] && printf '%s\\n' \"- Correctly set:\" \"${a_output[@]}\" fi }" expect : "(?i)^[\\s]*\\**[\\s]*pass:?[\\s]*\\**$" type : CMD_EXEC description : "1.1.1.9 Ensure unused filesystems kernel modules are not available" info : "Filesystem kernel modules are pieces of code that can be dynamically loaded into the Linux kernel to extend its filesystem capabilities, or so-called base kernel, of an operating system. Filesystem kernel modules are typically used to add support for new hardware (as device drivers), or for adding system calls. While loadable filesystem kernel modules are a convenient method of modifying the running kernel, this can be abused by attackers on a compromised system to prevent detection of their processes or files, allowing them to maintain control over the system. Many rootkits make use of loadable filesystem kernel modules in this way. Removing support for unneeded filesystem types reduces the local attack surface of the system. If this filesystem type is not needed, disable it. The following filesystem kernel modules have known CVE's and should be made unavailable if no dependencies exist: - afs - CVE-2022-37402 - ceph - CVE-2022-0670 - cifs - CVE-2022-29869 - exfat CVE-2022-29973 - ext CVE-2022-1184 - fat CVE-2022-22043 - fscache CVE-2022-3630 - fuse CVE-2023-0386 - gfs2 CVE-2023-3212 - nfs_common CVE-2023-6660 - nfsd CVE-2022-43945 - smbfs_common CVE-2022-2585 NOTE: Nessus has provided the target output to assist in reviewing the benchmark to ensure target compliance." solution : "- IF - the module is available in the running kernel: - Unload the filesystem kernel module from the kernel - Create a file ending inconf with install filesystem kernel modules /bin/false in the /etc/modprobe.d/ directory - Create a file ending inconf with deny list filesystem kernel modules in the /etc/modprobe.d/ directory WARNING : unloading, disabling or denylisting filesystem modules that are in use on the system maybe FATAL. It is extremely important to thoroughly review the filesystems returned by the audit before following the remediation procedure. Example of unloading the gfs2 kernel module: # modprobe -r gfs2 2>/dev/null # rmmod gfs2 2>/dev/null Example of fully disabling the gfs2 kernel module: # printf '%s\n' \"blacklist gfs2\" \"install gfs2 /bin/false\" >> /etc/modprobe.d/gfs2.conf Note: - Disabling a kernel module by modifying the command above for each unused filesystem kernel module - The example gfs2 must be updated with the appropriate module name for the command or example script bellow to run correctly. Below is an example Script that can be modified to use on various filesystem kernel modules manual remediation process: Example Script #!/usr/bin/env bash { a_output2=(); a_output3=(); l_dl=\"\" # Initialize arrays and clear variables l_mod_name=\"gfs2\" # set module name l_mod_type=\"fs\" # set module type l_mod_path=\"$(readlink -f /usr/lib/modules/**/kernel/$l_mod_type || readlink -f /lib/modules/**/kernel/$l_mod_type)\" f_module_fix() { l_dl=\"y\" # Set to ignore duplicate checks a_showconfig=() # Create array with modprobe output while IFS= read -r l_showconfig; do a_showconfig+=(\"$l_showconfig\") done < <(modprobe --showconfig | grep -P -- '\b(install|blacklist)\h+'\"${l_mod_name//-/_}\"'\b') if lsmod | grep \"$l_mod_name\" &> /dev/null; then # Check if the module is currently loaded a_output2+=(\" - unloading kernel module: \\\"$l_mod_name\\\"\") modprobe -r \"$l_mod_name\" 2>/dev/null; rmmod \"$l_mod_name\" 2>/dev/null fi if ! grep -Pq -- '\binstall\h+'\"${l_mod_name//-/_}\"'\h+(\/usr)?\/bin\/(true|false)\b' <<< \"${a_showconfig[*]}\"; then a_output2+=(\" - setting kernel module: \\\"$l_mod_name\\\" to \\\"$(readlink -f /bin/false)\\\"\") printf '%s\n' \"install $l_mod_name $(readlink -f /bin/false)\" >> /etc/modprobe.d/\"$l_mod_name\".conf fi if ! grep -Pq -- '\bblacklist\h+'\"${l_mod_name//-/_}\"'\b' <<< \"${a_showconfig[*]}\"; then a_output2+=(\" - denylisting kernel module: \\\"$l_mod_name\\\"\") printf '%s\n' \"blacklist $l_mod_name\" >> /etc/modprobe.d/\"$l_mod_name\".conf fi } for l_mod_base_directory in $l_mod_path; do # Check if the module exists on the system if [ -d \"$l_mod_base_directory/${l_mod_name/-/\/}\" ] && [ -n \"$(ls -A \"$l_mod_base_directory/${l_mod_name/-/\/}\")\" ]; then a_output3+=(\" - \\\"$l_mod_base_directory\\\"\") [[ \"$l_mod_name\" =~ overlay ]] && l_mod_name=\"${l_mod_name::-2}\" [ \"$l_dl\" != \"y\" ] && f_module_fix else echo -e \" - kernel module: \\\"$l_mod_name\\\" doesn't exist in \\\"$l_mod_base_directory\\\"\" fi done [ \"${#a_output3[@]}\" -gt 0 ] && printf '%s\n' \"\" \" -- INFO --\" \" - module: \\\"$l_mod_name\\\" exists in:\" \"${a_output3[@]}\" [ \"${#a_output2[@]}\" -gt 0 ] && printf '%s\n' \"\" \"${a_output2[@]}\" || printf '%s\n' \"\" \" - No changes needed\" printf '%s\n' \"\" \" - remediation of kernel module: \\\"$l_mod_name\\\" complete\" \"\" } Impact: This list may be quite extensive and covering all edges cases is difficult. Therefore, it's crucial to carefully consider the implications and dependencies before making any changes to the filesystem kernel module configurations." reference : "800-171|3.4.2,800-171|3.4.6,800-171|3.4.7,800-171r3|03.04.02,800-171r3|03.04.06,800-53|CM-6,800-53|CM-7,800-53r5|CM-6,800-53r5|CM-7,CSCv7|9.2,CSCv8|4.8,CSF|PR.IP-1,CSF|PR.PT-3,CSF2.0|DE.CM-09,CSF2.0|PR.PS-01,GDPR|32.1.b,HIPAA|164.306(a)(1),ISO-27001-2022|A.8.9,ITSG-33|CM-6,ITSG-33|CM-7,LEVEL|1M,NIAv2|SS15a,PCI-DSSv3.2.1|2.2.2,SWIFT-CSCv1|2.3" see_also : "https://workbench.cisecurity.org/benchmarks/20333" cmd : "#!/bin/bash { a_output=(); a_output2=(); a_modprope_config=(); a_excluded=(); a_available_modules=() a_ignore=(\"xfs\" \"vfat\" \"ext2\" \"ext3\" \"ext4\") a_cve_exists=(\"afs\" \"ceph\" \"cifs\" \"exfat\" \"ext\" \"fat\" \"fscache\" \"fuse\" \"gfs2\" \"nfs_common\" \"nfsd\" \"smbfs_common\") f_module_chk() { l_out2=\"\"; grep -Pq -- \"\\b$l_mod_name\\b\" <<< \"${a_cve_exists[*]}\" && l_out2=\" <- CVE exists!\" if ! grep -Pq -- '\\bblacklist\\h+'\"$l_mod_name\"'\\b' <<< \"${a_modprope_config[*]}\"; then a_output2+=(\" - Kernel module: \\\"$l_mod_name\\\" is not fully disabled $l_out2\") elif ! grep -Pq -- '\\binstall\\h+'\"$l_mod_name\"'\\h+(\\/usr)?\\/bin\\/(false|true)\\b' <<< \"${a_modprope_config[*]}\"; then a_output2+=(\" - Kernel module: \\\"$l_mod_name\\\" is not fully disabled $l_out2\") fi if lsmod | grep \"$l_mod_name\" &> /dev/null; then # Check if the module is currently loaded l_output2+=(\" - Kernel module: \\\"$l_mod_name\\\" is loaded\" \"\") fi } while IFS= read -r -d $'\\0' l_module_dir; do a_available_modules+=(\"$(basename \"$l_module_dir\")\") done < <(find \"$(readlink -f /usr/lib/modules/\"$(uname -r)\"/kernel/fs || readlink -f /lib/modules/\"$(uname -r)\"/kernel/fs)\" -mindepth 1 -maxdepth 1 -type d ! -empty -print0) while IFS= read -r l_exclude; do if grep -Pq -- \"\\b$l_exclude\\b\" <<< \"${a_cve_exists[*]}\"; then a_output2+=(\" - ** WARNING: kernel module: \\\"$l_exclude\\\" has a CVE and is currently mounted! **\") elif grep -Pq -- \"\\b$l_exclude\\b\" <<< \"${a_available_modules[*]}\"; then a_output+=(\" - Kernel module: \\\"$l_exclude\\\" is currently mounted - do NOT unload or disable\") fi ! grep -Pq -- \"\\b$l_exclude\\b\" <<< \"${a_ignore[*]}\" && a_ignore+=(\"$l_exclude\") done < <(findmnt -knD | awk '{print $2}' | sort -u) while IFS= read -r l_config; do a_modprope_config+=(\"$l_config\") done < <(modprobe --showconfig | grep -P '^\\h*(blacklist|install)') for l_mod_name in \"${a_available_modules[@]}\"; do # Iterate over all filesystem modules [[ \"$l_mod_name\" =~ overlay ]] && l_mod_name=\"${l_mod_name::-2}\" if grep -Pq -- \"\\b$l_mod_name\\b\" <<< \"${a_ignore[*]}\"; then a_excluded+=(\" - Kernel module: \\\"$l_mod_name\\\"\") else f_module_chk fi done [ \"${#a_excluded[@]}\" -gt 0 ] && printf '%s\\n' \"\" \" -- INFO --\" \\ \"The following intentionally skipped\" \\ \"${a_excluded[@]}\" if [ \"${#a_output2[@]}\" -le 0 ]; then printf '%s\\n' \"\" \" - No unused filesystem kernel modules are enabled\" \"${a_output[@]}\" \"\" else printf '%s\\n' \"\" \"-- Audit Result: --\" \" ** REVIEW the following **\" \"${a_output2[@]}\" [ \"${#a_output[@]}\" -gt 0 ] && printf '%s\\n' \"\" \"-- Correctly set: --\" \"${a_output[@]}\" \"\" fi }" expect : "^Manual Review Required$" severity : MEDIUM type : CMD_EXEC description : "1.1.2.1.1 Ensure /tmp is a separate partition" info : "The /tmp directory is a world-writable directory used for temporary storage by all users and some applications. Note: If an entry for /tmp exists in /etc/fstab it will take precedence over entries in a systemd unit file. There is an exception to this when a system is diskless and connected to iSCSI, entries in /etc/fstab may not take precedence over a systemd unit file. Making /tmp its own file system allows an administrator to set additional mount options such as the noexec option on the mount, making /tmp useless for an attacker to install executable code. It would also prevent an attacker from establishing a hard link to a system setuid program and wait for it to be updated. Once the program was updated, the hard link would be broken, and the attacker would have his own copy of the program. If the program happened to have a security vulnerability, the attacker could continue to exploit the known flaw. This can be accomplished by either mounting tmpfs to /tmp or creating a separate partition for /tmp" solution : "First ensure that systemd is correctly configured to ensure that /tmp will be mounted at boot time. # systemctl unmask tmp.mount For specific configuration requirements of the /tmp mount for your environment, modify /etc/fstab Example of using tmpfs with specific mount options: tmpfs /tmp tmpfs defaults,rw,nosuid,nodev,noexec,relatime,size=2G 0 0 Note: the size=2G is an example of setting a specific size for tmpfs Example of using a volume or disk with specific mount options. The source location of the volume or disk will vary depending on your environment: /tmp defaults,nodev,nosuid,noexec 0 0 Impact: By design files saved to /tmp should have no expectation of surviving a reboot of the system. tmpfs is ram based and all files stored to tmpfs will be lost when the system is rebooted. If files need to be persistent through a reboot, they should be saved to /var/tmp not /tmp Since the /tmp directory is intended to be world-writable, there is a risk of resource exhaustion if it is not bound to tmpfs or a separate partition. Running out of /tmp space is a problem regardless of what kind of filesystem lies under it, but in a configuration where /tmp is not a separate file system it will essentially have the whole disk available, as the default installation 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. Another alternative is to create a dedicated partition for /tmp from a separate volume or disk. One of the downsides of a disk-based dedicated partition is that it will be slower than tmpfs which is RAM-based." reference : "800-171|3.1.1,800-171|3.1.4,800-171|3.1.5,800-171|3.8.1,800-171|3.8.2,800-171|3.8.3,800-171r3|03.01.02,800-171r3|03.01.04,800-171r3|03.01.05a.,800-171r3|03.08.02,800-53|AC-3,800-53|AC-5,800-53|AC-6,800-53|MP-2,800-53r5|AC-3,800-53r5|AC-5,800-53r5|AC-6,800-53r5|MP-2,CN-L3|7.1.3.2(b),CN-L3|7.1.3.2(g),CN-L3|8.1.4.2(d),CN-L3|8.1.4.2(f),CN-L3|8.1.4.11(b),CN-L3|8.1.10.2(c),CN-L3|8.1.10.6(a),CN-L3|8.5.3.1,CN-L3|8.5.4.1(a),CSCv7|14.6,CSCv8|3.3,CSF|PR.AC-4,CSF|PR.DS-5,CSF|PR.PT-2,CSF|PR.PT-3,CSF2.0|PR.AA-05,CSF2.0|PR.DS-10,CSF2.0|PR.IR-01,GDPR|32.1.b,HIPAA|164.306(a)(1),HIPAA|164.312(a)(1),ISO-27001-2022|A.5.3,ISO-27001-2022|A.5.10,ISO-27001-2022|A.5.15,ISO-27001-2022|A.5.33,ISO-27001-2022|A.7.7,ISO-27001-2022|A.7.10,ISO-27001-2022|A.8.2,ISO-27001-2022|A.8.3,ISO-27001-2022|A.8.18,ISO-27001-2022|A.8.20,ISO/IEC-27001|A.6.1.2,ISO/IEC-27001|A.9.4.1,ISO/IEC-27001|A.9.4.5,ITSG-33|AC-3,ITSG-33|AC-5,ITSG-33|AC-6,ITSG-33|MP-2,ITSG-33|MP-2a.,LEVEL|1A,NESA|T1.3.2,NESA|T1.3.3,NESA|T1.4.1,NESA|T4.2.1,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.2,NESA|T7.5.3,NIAv2|AM1,NIAv2|AM3,NIAv2|AM23f,NIAv2|SS13c,NIAv2|SS15c,NIAv2|SS29,PCI-DSSv3.2.1|7.1.2,PCI-DSSv4.0|7.2.1,PCI-DSSv4.0|7.2.2,QCSC-v1|3.2,QCSC-v1|5.2.2,QCSC-v1|6.2,QCSC-v1|13.2,SWIFT-CSCv1|5.1,TBA-FIISB|31.1,TBA-FIISB|31.4.2,TBA-FIISB|31.4.3" see_also : "https://workbench.cisecurity.org/benchmarks/20333" cmd : "/bin/findmnt -nk /tmp" expect : "^[\\s]*/tmp[\\s]+" type : FILE_CONTENT_CHECK description : "1.1.2.1.2 Ensure nodev option set on /tmp partition" info : "The nodev mount option specifies that the filesystem cannot contain special devices. Since the /tmp filesystem is not intended to support devices, set this option to ensure that users cannot create a block or character special devices in /tmp" solution : "- IF - a separate partition exists for /tmp Edit the /etc/fstab file and add nodev to the fourth field (mounting options) for the /tmp partition. Example: /tmp defaults,rw,nosuid,nodev,noexec,relatime 0 0 Run the following command to remount /tmp with the configured options: # mount -o remount /tmp" reference : "800-171|3.4.2,800-171|3.4.6,800-171|3.4.7,800-171r3|03.04.02,800-171r3|03.04.06,800-53|CM-6,800-53|CM-7,800-53r5|CM-6,800-53r5|CM-7,CSCv7|9.2,CSCv8|4.8,CSF|PR.IP-1,CSF|PR.PT-3,CSF2.0|DE.CM-09,CSF2.0|PR.PS-01,GDPR|32.1.b,HIPAA|164.306(a)(1),ISO-27001-2022|A.8.9,ITSG-33|CM-6,ITSG-33|CM-7,LEVEL|1A,NIAv2|SS15a,PCI-DSSv3.2.1|2.2.2,SWIFT-CSCv1|2.3" see_also : "https://workbench.cisecurity.org/benchmarks/20333" file : "/proc/self/mountinfo" regex : "[\\s]+/tmp[\\s]+" expect : "nodev" required : NO type : FILE_CONTENT_CHECK description : "1.1.2.1.3 Ensure nosuid option set on /tmp partition" info : "The nosuid mount option specifies that the filesystem cannot contain setuid files. 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 : "- IF - a separate partition exists for /tmp Edit the /etc/fstab file and add nosuid to the fourth field (mounting options) for the /tmp partition. Example: /tmp defaults,rw,nosuid,nodev,noexec,relatime 0 0 Run the following command to remount /tmp with the configured options: # mount -o remount /tmp" reference : "800-171|3.1.1,800-171|3.1.4,800-171|3.1.5,800-171|3.8.1,800-171|3.8.2,800-171|3.8.3,800-171r3|03.01.02,800-171r3|03.01.04,800-171r3|03.01.05a.,800-171r3|03.08.02,800-53|AC-3,800-53|AC-5,800-53|AC-6,800-53|MP-2,800-53r5|AC-3,800-53r5|AC-5,800-53r5|AC-6,800-53r5|MP-2,CN-L3|7.1.3.2(b),CN-L3|7.1.3.2(g),CN-L3|8.1.4.2(d),CN-L3|8.1.4.2(f),CN-L3|8.1.4.11(b),CN-L3|8.1.10.2(c),CN-L3|8.1.10.6(a),CN-L3|8.5.3.1,CN-L3|8.5.4.1(a),CSCv7|14.6,CSCv8|3.3,CSF|PR.AC-4,CSF|PR.DS-5,CSF|PR.PT-2,CSF|PR.PT-3,CSF2.0|PR.AA-05,CSF2.0|PR.DS-10,CSF2.0|PR.IR-01,GDPR|32.1.b,HIPAA|164.306(a)(1),HIPAA|164.312(a)(1),ISO-27001-2022|A.5.3,ISO-27001-2022|A.5.10,ISO-27001-2022|A.5.15,ISO-27001-2022|A.5.33,ISO-27001-2022|A.7.7,ISO-27001-2022|A.7.10,ISO-27001-2022|A.8.2,ISO-27001-2022|A.8.3,ISO-27001-2022|A.8.18,ISO-27001-2022|A.8.20,ISO/IEC-27001|A.6.1.2,ISO/IEC-27001|A.9.4.1,ISO/IEC-27001|A.9.4.5,ITSG-33|AC-3,ITSG-33|AC-5,ITSG-33|AC-6,ITSG-33|MP-2,ITSG-33|MP-2a.,LEVEL|1A,NESA|T1.3.2,NESA|T1.3.3,NESA|T1.4.1,NESA|T4.2.1,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.2,NESA|T7.5.3,NIAv2|AM1,NIAv2|AM3,NIAv2|AM23f,NIAv2|SS13c,NIAv2|SS15c,NIAv2|SS29,PCI-DSSv3.2.1|7.1.2,PCI-DSSv4.0|7.2.1,PCI-DSSv4.0|7.2.2,QCSC-v1|3.2,QCSC-v1|5.2.2,QCSC-v1|6.2,QCSC-v1|13.2,SWIFT-CSCv1|5.1,TBA-FIISB|31.1,TBA-FIISB|31.4.2,TBA-FIISB|31.4.3" see_also : "https://workbench.cisecurity.org/benchmarks/20333" file : "/proc/self/mountinfo" regex : "[\\s]+/tmp[\\s]+" expect : "nosuid" required : NO type : FILE_CONTENT_CHECK description : "1.1.2.1.4 Ensure noexec option set on /tmp partition" info : "The noexec mount option specifies that the filesystem cannot contain executable binaries. 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 : "- IF - a separate partition exists for /tmp Edit the /etc/fstab file and add noexec to the fourth field (mounting options) for the /tmp partition. Example: /tmp defaults,rw,nosuid,nodev,noexec,relatime 0 0 Run the following command to remount /tmp with the configured options: # mount -o remount /tmp Impact: Setting the noexec option on /tmp may prevent installation and/or updating of some 3rd party software." reference : "800-171|3.1.1,800-171|3.1.4,800-171|3.1.5,800-171|3.8.1,800-171|3.8.2,800-171|3.8.3,800-171r3|03.01.02,800-171r3|03.01.04,800-171r3|03.01.05a.,800-171r3|03.08.02,800-53|AC-3,800-53|AC-5,800-53|AC-6,800-53|MP-2,800-53r5|AC-3,800-53r5|AC-5,800-53r5|AC-6,800-53r5|MP-2,CN-L3|7.1.3.2(b),CN-L3|7.1.3.2(g),CN-L3|8.1.4.2(d),CN-L3|8.1.4.2(f),CN-L3|8.1.4.11(b),CN-L3|8.1.10.2(c),CN-L3|8.1.10.6(a),CN-L3|8.5.3.1,CN-L3|8.5.4.1(a),CSCv7|14.6,CSCv8|3.3,CSF|PR.AC-4,CSF|PR.DS-5,CSF|PR.PT-2,CSF|PR.PT-3,CSF2.0|PR.AA-05,CSF2.0|PR.DS-10,CSF2.0|PR.IR-01,GDPR|32.1.b,HIPAA|164.306(a)(1),HIPAA|164.312(a)(1),ISO-27001-2022|A.5.3,ISO-27001-2022|A.5.10,ISO-27001-2022|A.5.15,ISO-27001-2022|A.5.33,ISO-27001-2022|A.7.7,ISO-27001-2022|A.7.10,ISO-27001-2022|A.8.2,ISO-27001-2022|A.8.3,ISO-27001-2022|A.8.18,ISO-27001-2022|A.8.20,ISO/IEC-27001|A.6.1.2,ISO/IEC-27001|A.9.4.1,ISO/IEC-27001|A.9.4.5,ITSG-33|AC-3,ITSG-33|AC-5,ITSG-33|AC-6,ITSG-33|MP-2,ITSG-33|MP-2a.,LEVEL|1A,NESA|T1.3.2,NESA|T1.3.3,NESA|T1.4.1,NESA|T4.2.1,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.2,NESA|T7.5.3,NIAv2|AM1,NIAv2|AM3,NIAv2|AM23f,NIAv2|SS13c,NIAv2|SS15c,NIAv2|SS29,PCI-DSSv3.2.1|7.1.2,PCI-DSSv4.0|7.2.1,PCI-DSSv4.0|7.2.2,QCSC-v1|3.2,QCSC-v1|5.2.2,QCSC-v1|6.2,QCSC-v1|13.2,SWIFT-CSCv1|5.1,TBA-FIISB|31.1,TBA-FIISB|31.4.2,TBA-FIISB|31.4.3" see_also : "https://workbench.cisecurity.org/benchmarks/20333" file : "/proc/self/mountinfo" regex : "[\\s]+/tmp[\\s]+" expect : "noexec" required : NO type : FILE_CONTENT_CHECK description : "1.1.2.2.1 Ensure /dev/shm is a separate partition" info : "The /dev/shm directory is a world-writable directory that can function as shared memory that facilitates inter process communication (IPC). Making /dev/shm its own file system allows an administrator to set additional mount options such as the noexec option on the mount, making /dev/shm useless for an attacker to install executable code. It would also prevent an attacker from establishing a hard link to a system setuid program and wait for it to be updated. Once the program was updated, the hard link would be broken and the attacker would have his own copy of the program. If the program happened to have a security vulnerability, the attacker could continue to exploit the known flaw. This can be accomplished by mounting tmpfs to /dev/shm" solution : "For specific configuration requirements of the /dev/shm mount for your environment, modify /etc/fstab Example: tmpfs /dev/shm tmpfs defaults,rw,nosuid,nodev,noexec,relatime,size=2G 0 0 Impact: Since the /dev/shm directory is intended to be world-writable, there is a risk of resource exhaustion if it is not bound to a separate partition. /dev/shm utilizing tmpfs can be resized using the size={size} parameter in the relevant entry in /etc/fstab" reference : "800-171|3.4.2,800-171|3.4.6,800-171|3.4.7,800-171r3|03.04.02,800-171r3|03.04.06,800-53|CM-6,800-53|CM-7,800-53r5|CM-6,800-53r5|CM-7,CSCv7|9.2,CSCv8|4.8,CSF|PR.IP-1,CSF|PR.PT-3,CSF2.0|DE.CM-09,CSF2.0|PR.PS-01,GDPR|32.1.b,HIPAA|164.306(a)(1),ISO-27001-2022|A.8.9,ITSG-33|CM-6,ITSG-33|CM-7,LEVEL|1A,NIAv2|SS15a,PCI-DSSv3.2.1|2.2.2,SWIFT-CSCv1|2.3" see_also : "https://workbench.cisecurity.org/benchmarks/20333" file : "/proc/self/mountinfo" regex : "[\\s]+/dev/shm[\\s]+" expect : "[\\s]+/dev/shm[\\s]+" required : NO type : FILE_CONTENT_CHECK description : "1.1.2.2.2 Ensure nodev option set on /dev/shm partition" info : "The nodev mount option specifies that the filesystem cannot contain special devices. 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 : "- IF - a separate partition exists for /dev/shm 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. Example: tmpfs /dev/shm tmpfs defaults,rw,nosuid,nodev,noexec,relatime 0 0 Run the following command to remount /dev/shm with the configured options: # mount -o remount /dev/shm Note: It is recommended to use tmpfs as the device/filesystem type as /dev/shm is used as shared memory space by applications." reference : "800-171|3.1.1,800-171|3.1.4,800-171|3.1.5,800-171|3.8.1,800-171|3.8.2,800-171|3.8.3,800-171r3|03.01.02,800-171r3|03.01.04,800-171r3|03.01.05a.,800-171r3|03.08.02,800-53|AC-3,800-53|AC-5,800-53|AC-6,800-53|MP-2,800-53r5|AC-3,800-53r5|AC-5,800-53r5|AC-6,800-53r5|MP-2,CN-L3|7.1.3.2(b),CN-L3|7.1.3.2(g),CN-L3|8.1.4.2(d),CN-L3|8.1.4.2(f),CN-L3|8.1.4.11(b),CN-L3|8.1.10.2(c),CN-L3|8.1.10.6(a),CN-L3|8.5.3.1,CN-L3|8.5.4.1(a),CSCv7|14.6,CSCv8|3.3,CSF|PR.AC-4,CSF|PR.DS-5,CSF|PR.PT-2,CSF|PR.PT-3,CSF2.0|PR.AA-05,CSF2.0|PR.DS-10,CSF2.0|PR.IR-01,GDPR|32.1.b,HIPAA|164.306(a)(1),HIPAA|164.312(a)(1),ISO-27001-2022|A.5.3,ISO-27001-2022|A.5.10,ISO-27001-2022|A.5.15,ISO-27001-2022|A.5.33,ISO-27001-2022|A.7.7,ISO-27001-2022|A.7.10,ISO-27001-2022|A.8.2,ISO-27001-2022|A.8.3,ISO-27001-2022|A.8.18,ISO-27001-2022|A.8.20,ISO/IEC-27001|A.6.1.2,ISO/IEC-27001|A.9.4.1,ISO/IEC-27001|A.9.4.5,ITSG-33|AC-3,ITSG-33|AC-5,ITSG-33|AC-6,ITSG-33|MP-2,ITSG-33|MP-2a.,LEVEL|1A,NESA|T1.3.2,NESA|T1.3.3,NESA|T1.4.1,NESA|T4.2.1,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.2,NESA|T7.5.3,NIAv2|AM1,NIAv2|AM3,NIAv2|AM23f,NIAv2|SS13c,NIAv2|SS15c,NIAv2|SS29,PCI-DSSv3.2.1|7.1.2,PCI-DSSv4.0|7.2.1,PCI-DSSv4.0|7.2.2,QCSC-v1|3.2,QCSC-v1|5.2.2,QCSC-v1|6.2,QCSC-v1|13.2,SWIFT-CSCv1|5.1,TBA-FIISB|31.1,TBA-FIISB|31.4.2,TBA-FIISB|31.4.3" see_also : "https://workbench.cisecurity.org/benchmarks/20333" file : "/proc/self/mountinfo" regex : "[\\s]+/dev/shm[\\s]+" expect : "nodev" required : NO type : FILE_CONTENT_CHECK description : "1.1.2.2.3 Ensure nosuid option set on /dev/shm partition" info : "The nosuid mount option specifies that the filesystem cannot contain setuid files. 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 : "- IF - a separate partition exists for /dev/shm 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. Example: tmpfs /dev/shm tmpfs defaults,rw,nosuid,nodev,noexec,relatime 0 0 Run the following command to remount /dev/shm with the configured options: # mount -o remount /dev/shm Note: It is recommended to use tmpfs as the device/filesystem type as /dev/shm is used as shared memory space by applications." reference : "800-171|3.1.1,800-171|3.1.4,800-171|3.1.5,800-171|3.8.1,800-171|3.8.2,800-171|3.8.3,800-171r3|03.01.02,800-171r3|03.01.04,800-171r3|03.01.05a.,800-171r3|03.08.02,800-53|AC-3,800-53|AC-5,800-53|AC-6,800-53|MP-2,800-53r5|AC-3,800-53r5|AC-5,800-53r5|AC-6,800-53r5|MP-2,CN-L3|7.1.3.2(b),CN-L3|7.1.3.2(g),CN-L3|8.1.4.2(d),CN-L3|8.1.4.2(f),CN-L3|8.1.4.11(b),CN-L3|8.1.10.2(c),CN-L3|8.1.10.6(a),CN-L3|8.5.3.1,CN-L3|8.5.4.1(a),CSCv7|14.6,CSCv8|3.3,CSF|PR.AC-4,CSF|PR.DS-5,CSF|PR.PT-2,CSF|PR.PT-3,CSF2.0|PR.AA-05,CSF2.0|PR.DS-10,CSF2.0|PR.IR-01,GDPR|32.1.b,HIPAA|164.306(a)(1),HIPAA|164.312(a)(1),ISO-27001-2022|A.5.3,ISO-27001-2022|A.5.10,ISO-27001-2022|A.5.15,ISO-27001-2022|A.5.33,ISO-27001-2022|A.7.7,ISO-27001-2022|A.7.10,ISO-27001-2022|A.8.2,ISO-27001-2022|A.8.3,ISO-27001-2022|A.8.18,ISO-27001-2022|A.8.20,ISO/IEC-27001|A.6.1.2,ISO/IEC-27001|A.9.4.1,ISO/IEC-27001|A.9.4.5,ITSG-33|AC-3,ITSG-33|AC-5,ITSG-33|AC-6,ITSG-33|MP-2,ITSG-33|MP-2a.,LEVEL|1A,NESA|T1.3.2,NESA|T1.3.3,NESA|T1.4.1,NESA|T4.2.1,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.2,NESA|T7.5.3,NIAv2|AM1,NIAv2|AM3,NIAv2|AM23f,NIAv2|SS13c,NIAv2|SS15c,NIAv2|SS29,PCI-DSSv3.2.1|7.1.2,PCI-DSSv4.0|7.2.1,PCI-DSSv4.0|7.2.2,QCSC-v1|3.2,QCSC-v1|5.2.2,QCSC-v1|6.2,QCSC-v1|13.2,SWIFT-CSCv1|5.1,TBA-FIISB|31.1,TBA-FIISB|31.4.2,TBA-FIISB|31.4.3" see_also : "https://workbench.cisecurity.org/benchmarks/20333" file : "/proc/self/mountinfo" regex : "[\\s]+/dev/shm[\\s]+" expect : "nosuid" required : NO type : FILE_CONTENT_CHECK description : "1.1.2.2.4 Ensure noexec option set on /dev/shm partition" info : "The noexec mount option specifies that the filesystem cannot contain executable binaries. 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 : "- IF - a separate partition exists for /dev/shm Edit the /etc/fstab file and add noexec to the fourth field (mounting options) for the /dev/shm partition. Example: tmpfs /dev/shm tmpfs defaults,rw,nosuid,nodev,noexec,relatime 0 0 Run the following command to remount /dev/shm with the configured options: # mount -o remount /dev/shm Note: It is recommended to use tmpfs as the device/filesystem type as /dev/shm is used as shared memory space by applications." reference : "800-171|3.1.1,800-171|3.1.4,800-171|3.1.5,800-171|3.8.1,800-171|3.8.2,800-171|3.8.3,800-171r3|03.01.02,800-171r3|03.01.04,800-171r3|03.01.05a.,800-171r3|03.08.02,800-53|AC-3,800-53|AC-5,800-53|AC-6,800-53|MP-2,800-53r5|AC-3,800-53r5|AC-5,800-53r5|AC-6,800-53r5|MP-2,CN-L3|7.1.3.2(b),CN-L3|7.1.3.2(g),CN-L3|8.1.4.2(d),CN-L3|8.1.4.2(f),CN-L3|8.1.4.11(b),CN-L3|8.1.10.2(c),CN-L3|8.1.10.6(a),CN-L3|8.5.3.1,CN-L3|8.5.4.1(a),CSCv7|14.6,CSCv8|3.3,CSF|PR.AC-4,CSF|PR.DS-5,CSF|PR.PT-2,CSF|PR.PT-3,CSF2.0|PR.AA-05,CSF2.0|PR.DS-10,CSF2.0|PR.IR-01,GDPR|32.1.b,HIPAA|164.306(a)(1),HIPAA|164.312(a)(1),ISO-27001-2022|A.5.3,ISO-27001-2022|A.5.10,ISO-27001-2022|A.5.15,ISO-27001-2022|A.5.33,ISO-27001-2022|A.7.7,ISO-27001-2022|A.7.10,ISO-27001-2022|A.8.2,ISO-27001-2022|A.8.3,ISO-27001-2022|A.8.18,ISO-27001-2022|A.8.20,ISO/IEC-27001|A.6.1.2,ISO/IEC-27001|A.9.4.1,ISO/IEC-27001|A.9.4.5,ITSG-33|AC-3,ITSG-33|AC-5,ITSG-33|AC-6,ITSG-33|MP-2,ITSG-33|MP-2a.,LEVEL|1A,NESA|T1.3.2,NESA|T1.3.3,NESA|T1.4.1,NESA|T4.2.1,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.2,NESA|T7.5.3,NIAv2|AM1,NIAv2|AM3,NIAv2|AM23f,NIAv2|SS13c,NIAv2|SS15c,NIAv2|SS29,PCI-DSSv3.2.1|7.1.2,PCI-DSSv4.0|7.2.1,PCI-DSSv4.0|7.2.2,QCSC-v1|3.2,QCSC-v1|5.2.2,QCSC-v1|6.2,QCSC-v1|13.2,SWIFT-CSCv1|5.1,TBA-FIISB|31.1,TBA-FIISB|31.4.2,TBA-FIISB|31.4.3" see_also : "https://workbench.cisecurity.org/benchmarks/20333" file : "/proc/self/mountinfo" regex : "[\\s]+/dev/shm[\\s]+" expect : "noexec" required : NO type : FILE_CONTENT_CHECK description : "1.1.2.3.2 Ensure nodev option set on /home partition" info : "The nodev mount option specifies that the filesystem cannot contain special devices. Since the /home filesystem is not intended to support devices, set this option to ensure that users cannot create a block or character special devices in /home" solution : "- IF - a separate partition exists for /home Edit the /etc/fstab file and add nodev to the fourth field (mounting options) for the /home partition. Example: /home defaults,rw,nosuid,nodev,relatime 0 0 Run the following command to remount /home with the configured options: # mount -o remount /home" reference : "800-171|3.1.1,800-171|3.1.4,800-171|3.1.5,800-171|3.8.1,800-171|3.8.2,800-171|3.8.3,800-171r3|03.01.02,800-171r3|03.01.04,800-171r3|03.01.05a.,800-171r3|03.08.02,800-53|AC-3,800-53|AC-5,800-53|AC-6,800-53|MP-2,800-53r5|AC-3,800-53r5|AC-5,800-53r5|AC-6,800-53r5|MP-2,CN-L3|7.1.3.2(b),CN-L3|7.1.3.2(g),CN-L3|8.1.4.2(d),CN-L3|8.1.4.2(f),CN-L3|8.1.4.11(b),CN-L3|8.1.10.2(c),CN-L3|8.1.10.6(a),CN-L3|8.5.3.1,CN-L3|8.5.4.1(a),CSCv7|14.6,CSCv8|3.3,CSF|PR.AC-4,CSF|PR.DS-5,CSF|PR.PT-2,CSF|PR.PT-3,CSF2.0|PR.AA-05,CSF2.0|PR.DS-10,CSF2.0|PR.IR-01,GDPR|32.1.b,HIPAA|164.306(a)(1),HIPAA|164.312(a)(1),ISO-27001-2022|A.5.3,ISO-27001-2022|A.5.10,ISO-27001-2022|A.5.15,ISO-27001-2022|A.5.33,ISO-27001-2022|A.7.7,ISO-27001-2022|A.7.10,ISO-27001-2022|A.8.2,ISO-27001-2022|A.8.3,ISO-27001-2022|A.8.18,ISO-27001-2022|A.8.20,ISO/IEC-27001|A.6.1.2,ISO/IEC-27001|A.9.4.1,ISO/IEC-27001|A.9.4.5,ITSG-33|AC-3,ITSG-33|AC-5,ITSG-33|AC-6,ITSG-33|MP-2,ITSG-33|MP-2a.,LEVEL|1A,NESA|T1.3.2,NESA|T1.3.3,NESA|T1.4.1,NESA|T4.2.1,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.2,NESA|T7.5.3,NIAv2|AM1,NIAv2|AM3,NIAv2|AM23f,NIAv2|SS13c,NIAv2|SS15c,NIAv2|SS29,PCI-DSSv3.2.1|7.1.2,PCI-DSSv4.0|7.2.1,PCI-DSSv4.0|7.2.2,QCSC-v1|3.2,QCSC-v1|5.2.2,QCSC-v1|6.2,QCSC-v1|13.2,SWIFT-CSCv1|5.1,TBA-FIISB|31.1,TBA-FIISB|31.4.2,TBA-FIISB|31.4.3" see_also : "https://workbench.cisecurity.org/benchmarks/20333" file : "/proc/self/mountinfo" regex : "[\\s]+/home[\\s]+" expect : "nodev" required : NO type : FILE_CONTENT_CHECK description : "1.1.2.3.3 Ensure nosuid option set on /home partition" info : "The nosuid mount option specifies that the filesystem cannot contain setuid files. Since the /home filesystem is only intended for user file storage, set this option to ensure that users cannot create setuid files in /home" solution : "- IF - a separate partition exists for /home Edit the /etc/fstab file and add nosuid to the fourth field (mounting options) for the /home partition. Example: /home defaults,rw,nosuid,nodev,relatime 0 0 Run the following command to remount /home with the configured options: # mount -o remount /home" reference : "800-171|3.1.1,800-171|3.1.4,800-171|3.1.5,800-171|3.8.1,800-171|3.8.2,800-171|3.8.3,800-171r3|03.01.02,800-171r3|03.01.04,800-171r3|03.01.05a.,800-171r3|03.08.02,800-53|AC-3,800-53|AC-5,800-53|AC-6,800-53|MP-2,800-53r5|AC-3,800-53r5|AC-5,800-53r5|AC-6,800-53r5|MP-2,CN-L3|7.1.3.2(b),CN-L3|7.1.3.2(g),CN-L3|8.1.4.2(d),CN-L3|8.1.4.2(f),CN-L3|8.1.4.11(b),CN-L3|8.1.10.2(c),CN-L3|8.1.10.6(a),CN-L3|8.5.3.1,CN-L3|8.5.4.1(a),CSCv7|14.6,CSCv8|3.3,CSF|PR.AC-4,CSF|PR.DS-5,CSF|PR.PT-2,CSF|PR.PT-3,CSF2.0|PR.AA-05,CSF2.0|PR.DS-10,CSF2.0|PR.IR-01,GDPR|32.1.b,HIPAA|164.306(a)(1),HIPAA|164.312(a)(1),ISO-27001-2022|A.5.3,ISO-27001-2022|A.5.10,ISO-27001-2022|A.5.15,ISO-27001-2022|A.5.33,ISO-27001-2022|A.7.7,ISO-27001-2022|A.7.10,ISO-27001-2022|A.8.2,ISO-27001-2022|A.8.3,ISO-27001-2022|A.8.18,ISO-27001-2022|A.8.20,ISO/IEC-27001|A.6.1.2,ISO/IEC-27001|A.9.4.1,ISO/IEC-27001|A.9.4.5,ITSG-33|AC-3,ITSG-33|AC-5,ITSG-33|AC-6,ITSG-33|MP-2,ITSG-33|MP-2a.,LEVEL|1A,NESA|T1.3.2,NESA|T1.3.3,NESA|T1.4.1,NESA|T4.2.1,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.2,NESA|T7.5.3,NIAv2|AM1,NIAv2|AM3,NIAv2|AM23f,NIAv2|SS13c,NIAv2|SS15c,NIAv2|SS29,PCI-DSSv3.2.1|7.1.2,PCI-DSSv4.0|7.2.1,PCI-DSSv4.0|7.2.2,QCSC-v1|3.2,QCSC-v1|5.2.2,QCSC-v1|6.2,QCSC-v1|13.2,SWIFT-CSCv1|5.1,TBA-FIISB|31.1,TBA-FIISB|31.4.2,TBA-FIISB|31.4.3" see_also : "https://workbench.cisecurity.org/benchmarks/20333" file : "/proc/self/mountinfo" regex : "[\\s]+/home[\\s]+" expect : "nosuid" required : NO type : FILE_CONTENT_CHECK description : "1.1.2.4.2 Ensure nodev option set on /var partition" info : "The nodev mount option specifies that the filesystem cannot contain special devices. Since the /var filesystem is not intended to support devices, set this option to ensure that users cannot create a block or character special devices in /var" solution : "- IF - a separate partition exists for /var Edit the /etc/fstab file and add nodev to the fourth field (mounting options) for the /var partition. Example: /var defaults,rw,nosuid,nodev,relatime 0 0 Run the following command to remount /var with the configured options: # mount -o remount /var" reference : "800-171|3.1.1,800-171|3.1.4,800-171|3.1.5,800-171|3.8.1,800-171|3.8.2,800-171|3.8.3,800-171r3|03.01.02,800-171r3|03.01.04,800-171r3|03.01.05a.,800-171r3|03.08.02,800-53|AC-3,800-53|AC-5,800-53|AC-6,800-53|MP-2,800-53r5|AC-3,800-53r5|AC-5,800-53r5|AC-6,800-53r5|MP-2,CN-L3|7.1.3.2(b),CN-L3|7.1.3.2(g),CN-L3|8.1.4.2(d),CN-L3|8.1.4.2(f),CN-L3|8.1.4.11(b),CN-L3|8.1.10.2(c),CN-L3|8.1.10.6(a),CN-L3|8.5.3.1,CN-L3|8.5.4.1(a),CSCv7|14.6,CSCv8|3.3,CSF|PR.AC-4,CSF|PR.DS-5,CSF|PR.PT-2,CSF|PR.PT-3,CSF2.0|PR.AA-05,CSF2.0|PR.DS-10,CSF2.0|PR.IR-01,GDPR|32.1.b,HIPAA|164.306(a)(1),HIPAA|164.312(a)(1),ISO-27001-2022|A.5.3,ISO-27001-2022|A.5.10,ISO-27001-2022|A.5.15,ISO-27001-2022|A.5.33,ISO-27001-2022|A.7.7,ISO-27001-2022|A.7.10,ISO-27001-2022|A.8.2,ISO-27001-2022|A.8.3,ISO-27001-2022|A.8.18,ISO-27001-2022|A.8.20,ISO/IEC-27001|A.6.1.2,ISO/IEC-27001|A.9.4.1,ISO/IEC-27001|A.9.4.5,ITSG-33|AC-3,ITSG-33|AC-5,ITSG-33|AC-6,ITSG-33|MP-2,ITSG-33|MP-2a.,LEVEL|1A,NESA|T1.3.2,NESA|T1.3.3,NESA|T1.4.1,NESA|T4.2.1,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.2,NESA|T7.5.3,NIAv2|AM1,NIAv2|AM3,NIAv2|AM23f,NIAv2|SS13c,NIAv2|SS15c,NIAv2|SS29,PCI-DSSv3.2.1|7.1.2,PCI-DSSv4.0|7.2.1,PCI-DSSv4.0|7.2.2,QCSC-v1|3.2,QCSC-v1|5.2.2,QCSC-v1|6.2,QCSC-v1|13.2,SWIFT-CSCv1|5.1,TBA-FIISB|31.1,TBA-FIISB|31.4.2,TBA-FIISB|31.4.3" see_also : "https://workbench.cisecurity.org/benchmarks/20333" file : "/proc/self/mountinfo" regex : "[\\s]+/var[\\s]+" expect : "nodev" required : NO type : FILE_CONTENT_CHECK description : "1.1.2.4.3 Ensure nosuid option set on /var partition" info : "The nosuid mount option specifies that the filesystem cannot contain setuid files. Since the /var filesystem is only intended for variable files such as logs, set this option to ensure that users cannot create setuid files in /var" solution : "- IF - a separate partition exists for /var Edit the /etc/fstab file and add nosuid to the fourth field (mounting options) for the /var partition. Example: /var defaults,rw,nosuid,nodev,relatime 0 0 Run the following command to remount /var with the configured options: # mount -o remount /var" reference : "800-171|3.1.1,800-171|3.1.4,800-171|3.1.5,800-171|3.8.1,800-171|3.8.2,800-171|3.8.3,800-171r3|03.01.02,800-171r3|03.01.04,800-171r3|03.01.05a.,800-171r3|03.08.02,800-53|AC-3,800-53|AC-5,800-53|AC-6,800-53|MP-2,800-53r5|AC-3,800-53r5|AC-5,800-53r5|AC-6,800-53r5|MP-2,CN-L3|7.1.3.2(b),CN-L3|7.1.3.2(g),CN-L3|8.1.4.2(d),CN-L3|8.1.4.2(f),CN-L3|8.1.4.11(b),CN-L3|8.1.10.2(c),CN-L3|8.1.10.6(a),CN-L3|8.5.3.1,CN-L3|8.5.4.1(a),CSCv7|14.6,CSCv8|3.3,CSF|PR.AC-4,CSF|PR.DS-5,CSF|PR.PT-2,CSF|PR.PT-3,CSF2.0|PR.AA-05,CSF2.0|PR.DS-10,CSF2.0|PR.IR-01,GDPR|32.1.b,HIPAA|164.306(a)(1),HIPAA|164.312(a)(1),ISO-27001-2022|A.5.3,ISO-27001-2022|A.5.10,ISO-27001-2022|A.5.15,ISO-27001-2022|A.5.33,ISO-27001-2022|A.7.7,ISO-27001-2022|A.7.10,ISO-27001-2022|A.8.2,ISO-27001-2022|A.8.3,ISO-27001-2022|A.8.18,ISO-27001-2022|A.8.20,ISO/IEC-27001|A.6.1.2,ISO/IEC-27001|A.9.4.1,ISO/IEC-27001|A.9.4.5,ITSG-33|AC-3,ITSG-33|AC-5,ITSG-33|AC-6,ITSG-33|MP-2,ITSG-33|MP-2a.,LEVEL|1A,NESA|T1.3.2,NESA|T1.3.3,NESA|T1.4.1,NESA|T4.2.1,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.2,NESA|T7.5.3,NIAv2|AM1,NIAv2|AM3,NIAv2|AM23f,NIAv2|SS13c,NIAv2|SS15c,NIAv2|SS29,PCI-DSSv3.2.1|7.1.2,PCI-DSSv4.0|7.2.1,PCI-DSSv4.0|7.2.2,QCSC-v1|3.2,QCSC-v1|5.2.2,QCSC-v1|6.2,QCSC-v1|13.2,SWIFT-CSCv1|5.1,TBA-FIISB|31.1,TBA-FIISB|31.4.2,TBA-FIISB|31.4.3" see_also : "https://workbench.cisecurity.org/benchmarks/20333" file : "/proc/self/mountinfo" regex : "[\\s]+/var[\\s]+" expect : "nosuid" required : NO type : FILE_CONTENT_CHECK description : "1.1.2.5.2 Ensure nodev option set on /var/tmp partition" info : "The nodev mount option specifies that the filesystem cannot contain special devices. Since the /var/tmp filesystem is not intended to support devices, set this option to ensure that users cannot create a block or character special devices in /var/tmp" solution : "- IF - a separate partition exists for /var/tmp Edit the /etc/fstab file and add nodev to the fourth field (mounting options) for the /var/tmp partition. Example: /var/tmp defaults,rw,nosuid,nodev,noexec,relatime 0 0 Run the following command to remount /var/tmp with the configured options: # mount -o remount /var/tmp" reference : "800-171|3.1.1,800-171|3.1.4,800-171|3.1.5,800-171|3.8.1,800-171|3.8.2,800-171|3.8.3,800-171r3|03.01.02,800-171r3|03.01.04,800-171r3|03.01.05a.,800-171r3|03.08.02,800-53|AC-3,800-53|AC-5,800-53|AC-6,800-53|MP-2,800-53r5|AC-3,800-53r5|AC-5,800-53r5|AC-6,800-53r5|MP-2,CN-L3|7.1.3.2(b),CN-L3|7.1.3.2(g),CN-L3|8.1.4.2(d),CN-L3|8.1.4.2(f),CN-L3|8.1.4.11(b),CN-L3|8.1.10.2(c),CN-L3|8.1.10.6(a),CN-L3|8.5.3.1,CN-L3|8.5.4.1(a),CSCv7|14.6,CSCv8|3.3,CSF|PR.AC-4,CSF|PR.DS-5,CSF|PR.PT-2,CSF|PR.PT-3,CSF2.0|PR.AA-05,CSF2.0|PR.DS-10,CSF2.0|PR.IR-01,GDPR|32.1.b,HIPAA|164.306(a)(1),HIPAA|164.312(a)(1),ISO-27001-2022|A.5.3,ISO-27001-2022|A.5.10,ISO-27001-2022|A.5.15,ISO-27001-2022|A.5.33,ISO-27001-2022|A.7.7,ISO-27001-2022|A.7.10,ISO-27001-2022|A.8.2,ISO-27001-2022|A.8.3,ISO-27001-2022|A.8.18,ISO-27001-2022|A.8.20,ISO/IEC-27001|A.6.1.2,ISO/IEC-27001|A.9.4.1,ISO/IEC-27001|A.9.4.5,ITSG-33|AC-3,ITSG-33|AC-5,ITSG-33|AC-6,ITSG-33|MP-2,ITSG-33|MP-2a.,LEVEL|1A,NESA|T1.3.2,NESA|T1.3.3,NESA|T1.4.1,NESA|T4.2.1,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.2,NESA|T7.5.3,NIAv2|AM1,NIAv2|AM3,NIAv2|AM23f,NIAv2|SS13c,NIAv2|SS15c,NIAv2|SS29,PCI-DSSv3.2.1|7.1.2,PCI-DSSv4.0|7.2.1,PCI-DSSv4.0|7.2.2,QCSC-v1|3.2,QCSC-v1|5.2.2,QCSC-v1|6.2,QCSC-v1|13.2,SWIFT-CSCv1|5.1,TBA-FIISB|31.1,TBA-FIISB|31.4.2,TBA-FIISB|31.4.3" see_also : "https://workbench.cisecurity.org/benchmarks/20333" file : "/proc/self/mountinfo" regex : "[\\s]+/var/tmp[\\s]+" expect : "nodev" required : NO type : FILE_CONTENT_CHECK description : "1.1.2.5.3 Ensure nosuid option set on /var/tmp partition" info : "The nosuid mount option specifies that the filesystem cannot contain setuid files. 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 : "- IF - a separate partition exists for /var/tmp Edit the /etc/fstab file and add nosuid to the fourth field (mounting options) for the /var/tmp partition. Example: /var/tmp defaults,rw,nosuid,nodev,noexec,relatime 0 0 Run the following command to remount /var/tmp with the configured options: # mount -o remount /var/tmp" reference : "800-171|3.1.1,800-171|3.1.4,800-171|3.1.5,800-171|3.8.1,800-171|3.8.2,800-171|3.8.3,800-171r3|03.01.02,800-171r3|03.01.04,800-171r3|03.01.05a.,800-171r3|03.08.02,800-53|AC-3,800-53|AC-5,800-53|AC-6,800-53|MP-2,800-53r5|AC-3,800-53r5|AC-5,800-53r5|AC-6,800-53r5|MP-2,CN-L3|7.1.3.2(b),CN-L3|7.1.3.2(g),CN-L3|8.1.4.2(d),CN-L3|8.1.4.2(f),CN-L3|8.1.4.11(b),CN-L3|8.1.10.2(c),CN-L3|8.1.10.6(a),CN-L3|8.5.3.1,CN-L3|8.5.4.1(a),CSCv7|14.6,CSCv8|3.3,CSF|PR.AC-4,CSF|PR.DS-5,CSF|PR.PT-2,CSF|PR.PT-3,CSF2.0|PR.AA-05,CSF2.0|PR.DS-10,CSF2.0|PR.IR-01,GDPR|32.1.b,HIPAA|164.306(a)(1),HIPAA|164.312(a)(1),ISO-27001-2022|A.5.3,ISO-27001-2022|A.5.10,ISO-27001-2022|A.5.15,ISO-27001-2022|A.5.33,ISO-27001-2022|A.7.7,ISO-27001-2022|A.7.10,ISO-27001-2022|A.8.2,ISO-27001-2022|A.8.3,ISO-27001-2022|A.8.18,ISO-27001-2022|A.8.20,ISO/IEC-27001|A.6.1.2,ISO/IEC-27001|A.9.4.1,ISO/IEC-27001|A.9.4.5,ITSG-33|AC-3,ITSG-33|AC-5,ITSG-33|AC-6,ITSG-33|MP-2,ITSG-33|MP-2a.,LEVEL|1A,NESA|T1.3.2,NESA|T1.3.3,NESA|T1.4.1,NESA|T4.2.1,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.2,NESA|T7.5.3,NIAv2|AM1,NIAv2|AM3,NIAv2|AM23f,NIAv2|SS13c,NIAv2|SS15c,NIAv2|SS29,PCI-DSSv3.2.1|7.1.2,PCI-DSSv4.0|7.2.1,PCI-DSSv4.0|7.2.2,QCSC-v1|3.2,QCSC-v1|5.2.2,QCSC-v1|6.2,QCSC-v1|13.2,SWIFT-CSCv1|5.1,TBA-FIISB|31.1,TBA-FIISB|31.4.2,TBA-FIISB|31.4.3" see_also : "https://workbench.cisecurity.org/benchmarks/20333" file : "/proc/self/mountinfo" regex : "[\\s]+/var/tmp[\\s]+" expect : "nosuid" required : NO type : FILE_CONTENT_CHECK description : "1.1.2.5.4 Ensure noexec option set on /var/tmp partition" info : "The noexec mount option specifies that the filesystem cannot contain executable binaries. 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 : "- IF - a separate partition exists for /var/tmp Edit the /etc/fstab file and add noexec to the fourth field (mounting options) for the /var/tmp partition. Example: /var/tmp defaults,rw,nosuid,nodev,noexec,relatime 0 0 Run the following command to remount /var/tmp with the configured options: # mount -o remount /var/tmp" reference : "800-171|3.1.1,800-171|3.1.4,800-171|3.1.5,800-171|3.8.1,800-171|3.8.2,800-171|3.8.3,800-171r3|03.01.02,800-171r3|03.01.04,800-171r3|03.01.05a.,800-171r3|03.08.02,800-53|AC-3,800-53|AC-5,800-53|AC-6,800-53|MP-2,800-53r5|AC-3,800-53r5|AC-5,800-53r5|AC-6,800-53r5|MP-2,CN-L3|7.1.3.2(b),CN-L3|7.1.3.2(g),CN-L3|8.1.4.2(d),CN-L3|8.1.4.2(f),CN-L3|8.1.4.11(b),CN-L3|8.1.10.2(c),CN-L3|8.1.10.6(a),CN-L3|8.5.3.1,CN-L3|8.5.4.1(a),CSCv7|14.6,CSCv8|3.3,CSF|PR.AC-4,CSF|PR.DS-5,CSF|PR.PT-2,CSF|PR.PT-3,CSF2.0|PR.AA-05,CSF2.0|PR.DS-10,CSF2.0|PR.IR-01,GDPR|32.1.b,HIPAA|164.306(a)(1),HIPAA|164.312(a)(1),ISO-27001-2022|A.5.3,ISO-27001-2022|A.5.10,ISO-27001-2022|A.5.15,ISO-27001-2022|A.5.33,ISO-27001-2022|A.7.7,ISO-27001-2022|A.7.10,ISO-27001-2022|A.8.2,ISO-27001-2022|A.8.3,ISO-27001-2022|A.8.18,ISO-27001-2022|A.8.20,ISO/IEC-27001|A.6.1.2,ISO/IEC-27001|A.9.4.1,ISO/IEC-27001|A.9.4.5,ITSG-33|AC-3,ITSG-33|AC-5,ITSG-33|AC-6,ITSG-33|MP-2,ITSG-33|MP-2a.,LEVEL|1A,NESA|T1.3.2,NESA|T1.3.3,NESA|T1.4.1,NESA|T4.2.1,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.2,NESA|T7.5.3,NIAv2|AM1,NIAv2|AM3,NIAv2|AM23f,NIAv2|SS13c,NIAv2|SS15c,NIAv2|SS29,PCI-DSSv3.2.1|7.1.2,PCI-DSSv4.0|7.2.1,PCI-DSSv4.0|7.2.2,QCSC-v1|3.2,QCSC-v1|5.2.2,QCSC-v1|6.2,QCSC-v1|13.2,SWIFT-CSCv1|5.1,TBA-FIISB|31.1,TBA-FIISB|31.4.2,TBA-FIISB|31.4.3" see_also : "https://workbench.cisecurity.org/benchmarks/20333" file : "/proc/self/mountinfo" regex : "[\\s]+/var/tmp[\\s]+" expect : "noexec" required : NO type : FILE_CONTENT_CHECK description : "1.1.2.6.2 Ensure nodev option set on /var/log partition" info : "The nodev mount option specifies that the filesystem cannot contain special devices. Since the /var/log filesystem is not intended to support devices, set this option to ensure that users cannot create a block or character special devices in /var/log" solution : "- IF - a separate partition exists for /var/log Edit the /etc/fstab file and add nodev to the fourth field (mounting options) for the /var/log partition. Example: /var/log defaults,rw,nosuid,nodev,noexec,relatime 0 0 Run the following command to remount /var/log with the configured options: # mount -o remount /var/log" reference : "800-171|3.1.1,800-171|3.1.4,800-171|3.1.5,800-171|3.8.1,800-171|3.8.2,800-171|3.8.3,800-171r3|03.01.02,800-171r3|03.01.04,800-171r3|03.01.05a.,800-171r3|03.08.02,800-53|AC-3,800-53|AC-5,800-53|AC-6,800-53|MP-2,800-53r5|AC-3,800-53r5|AC-5,800-53r5|AC-6,800-53r5|MP-2,CN-L3|7.1.3.2(b),CN-L3|7.1.3.2(g),CN-L3|8.1.4.2(d),CN-L3|8.1.4.2(f),CN-L3|8.1.4.11(b),CN-L3|8.1.10.2(c),CN-L3|8.1.10.6(a),CN-L3|8.5.3.1,CN-L3|8.5.4.1(a),CSCv7|14.6,CSCv8|3.3,CSF|PR.AC-4,CSF|PR.DS-5,CSF|PR.PT-2,CSF|PR.PT-3,CSF2.0|PR.AA-05,CSF2.0|PR.DS-10,CSF2.0|PR.IR-01,GDPR|32.1.b,HIPAA|164.306(a)(1),HIPAA|164.312(a)(1),ISO-27001-2022|A.5.3,ISO-27001-2022|A.5.10,ISO-27001-2022|A.5.15,ISO-27001-2022|A.5.33,ISO-27001-2022|A.7.7,ISO-27001-2022|A.7.10,ISO-27001-2022|A.8.2,ISO-27001-2022|A.8.3,ISO-27001-2022|A.8.18,ISO-27001-2022|A.8.20,ISO/IEC-27001|A.6.1.2,ISO/IEC-27001|A.9.4.1,ISO/IEC-27001|A.9.4.5,ITSG-33|AC-3,ITSG-33|AC-5,ITSG-33|AC-6,ITSG-33|MP-2,ITSG-33|MP-2a.,LEVEL|1A,NESA|T1.3.2,NESA|T1.3.3,NESA|T1.4.1,NESA|T4.2.1,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.2,NESA|T7.5.3,NIAv2|AM1,NIAv2|AM3,NIAv2|AM23f,NIAv2|SS13c,NIAv2|SS15c,NIAv2|SS29,PCI-DSSv3.2.1|7.1.2,PCI-DSSv4.0|7.2.1,PCI-DSSv4.0|7.2.2,QCSC-v1|3.2,QCSC-v1|5.2.2,QCSC-v1|6.2,QCSC-v1|13.2,SWIFT-CSCv1|5.1,TBA-FIISB|31.1,TBA-FIISB|31.4.2,TBA-FIISB|31.4.3" see_also : "https://workbench.cisecurity.org/benchmarks/20333" file : "/proc/self/mountinfo" regex : "[\\s]+/var/log[\\s]+" expect : "nodev" required : NO type : FILE_CONTENT_CHECK description : "1.1.2.6.3 Ensure nosuid option set on /var/log partition" info : "The nosuid mount option specifies that the filesystem cannot contain setuid files. Since the /var/log filesystem is only intended for log files, set this option to ensure that users cannot create setuid files in /var/log" solution : "- IF - a separate partition exists for /var/log Edit the /etc/fstab file and add nosuid to the fourth field (mounting options) for the /var/log partition. Example: /var/log defaults,rw,nosuid,nodev,noexec,relatime 0 0 Run the following command to remount /var/log with the configured options: # mount -o remount /var/log" reference : "800-171|3.1.1,800-171|3.1.4,800-171|3.1.5,800-171|3.8.1,800-171|3.8.2,800-171|3.8.3,800-171r3|03.01.02,800-171r3|03.01.04,800-171r3|03.01.05a.,800-171r3|03.08.02,800-53|AC-3,800-53|AC-5,800-53|AC-6,800-53|MP-2,800-53r5|AC-3,800-53r5|AC-5,800-53r5|AC-6,800-53r5|MP-2,CN-L3|7.1.3.2(b),CN-L3|7.1.3.2(g),CN-L3|8.1.4.2(d),CN-L3|8.1.4.2(f),CN-L3|8.1.4.11(b),CN-L3|8.1.10.2(c),CN-L3|8.1.10.6(a),CN-L3|8.5.3.1,CN-L3|8.5.4.1(a),CSCv7|14.6,CSCv8|3.3,CSF|PR.AC-4,CSF|PR.DS-5,CSF|PR.PT-2,CSF|PR.PT-3,CSF2.0|PR.AA-05,CSF2.0|PR.DS-10,CSF2.0|PR.IR-01,GDPR|32.1.b,HIPAA|164.306(a)(1),HIPAA|164.312(a)(1),ISO-27001-2022|A.5.3,ISO-27001-2022|A.5.10,ISO-27001-2022|A.5.15,ISO-27001-2022|A.5.33,ISO-27001-2022|A.7.7,ISO-27001-2022|A.7.10,ISO-27001-2022|A.8.2,ISO-27001-2022|A.8.3,ISO-27001-2022|A.8.18,ISO-27001-2022|A.8.20,ISO/IEC-27001|A.6.1.2,ISO/IEC-27001|A.9.4.1,ISO/IEC-27001|A.9.4.5,ITSG-33|AC-3,ITSG-33|AC-5,ITSG-33|AC-6,ITSG-33|MP-2,ITSG-33|MP-2a.,LEVEL|1A,NESA|T1.3.2,NESA|T1.3.3,NESA|T1.4.1,NESA|T4.2.1,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.2,NESA|T7.5.3,NIAv2|AM1,NIAv2|AM3,NIAv2|AM23f,NIAv2|SS13c,NIAv2|SS15c,NIAv2|SS29,PCI-DSSv3.2.1|7.1.2,PCI-DSSv4.0|7.2.1,PCI-DSSv4.0|7.2.2,QCSC-v1|3.2,QCSC-v1|5.2.2,QCSC-v1|6.2,QCSC-v1|13.2,SWIFT-CSCv1|5.1,TBA-FIISB|31.1,TBA-FIISB|31.4.2,TBA-FIISB|31.4.3" see_also : "https://workbench.cisecurity.org/benchmarks/20333" file : "/proc/self/mountinfo" regex : "[\\s]+/var/log[\\s]+" expect : "nosuid" required : NO type : FILE_CONTENT_CHECK description : "1.1.2.6.4 Ensure noexec option set on /var/log partition" info : "The noexec mount option specifies that the filesystem cannot contain executable binaries. Since the /var/log filesystem is only intended for log files, set this option to ensure that users cannot run executable binaries from /var/log" solution : "- IF - a separate partition exists for /var/log Edit the /etc/fstab file and add noexec to the fourth field (mounting options) for the /var/log partition. Example: /var/log defaults,rw,nosuid,nodev,noexec,relatime 0 0 Run the following command to remount /var/log with the configured options: # mount -o remount /var/log" reference : "800-171|3.1.1,800-171|3.1.4,800-171|3.1.5,800-171|3.8.1,800-171|3.8.2,800-171|3.8.3,800-171r3|03.01.02,800-171r3|03.01.04,800-171r3|03.01.05a.,800-171r3|03.08.02,800-53|AC-3,800-53|AC-5,800-53|AC-6,800-53|MP-2,800-53r5|AC-3,800-53r5|AC-5,800-53r5|AC-6,800-53r5|MP-2,CN-L3|7.1.3.2(b),CN-L3|7.1.3.2(g),CN-L3|8.1.4.2(d),CN-L3|8.1.4.2(f),CN-L3|8.1.4.11(b),CN-L3|8.1.10.2(c),CN-L3|8.1.10.6(a),CN-L3|8.5.3.1,CN-L3|8.5.4.1(a),CSCv7|14.6,CSCv8|3.3,CSF|PR.AC-4,CSF|PR.DS-5,CSF|PR.PT-2,CSF|PR.PT-3,CSF2.0|PR.AA-05,CSF2.0|PR.DS-10,CSF2.0|PR.IR-01,GDPR|32.1.b,HIPAA|164.306(a)(1),HIPAA|164.312(a)(1),ISO-27001-2022|A.5.3,ISO-27001-2022|A.5.10,ISO-27001-2022|A.5.15,ISO-27001-2022|A.5.33,ISO-27001-2022|A.7.7,ISO-27001-2022|A.7.10,ISO-27001-2022|A.8.2,ISO-27001-2022|A.8.3,ISO-27001-2022|A.8.18,ISO-27001-2022|A.8.20,ISO/IEC-27001|A.6.1.2,ISO/IEC-27001|A.9.4.1,ISO/IEC-27001|A.9.4.5,ITSG-33|AC-3,ITSG-33|AC-5,ITSG-33|AC-6,ITSG-33|MP-2,ITSG-33|MP-2a.,LEVEL|1A,NESA|T1.3.2,NESA|T1.3.3,NESA|T1.4.1,NESA|T4.2.1,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.2,NESA|T7.5.3,NIAv2|AM1,NIAv2|AM3,NIAv2|AM23f,NIAv2|SS13c,NIAv2|SS15c,NIAv2|SS29,PCI-DSSv3.2.1|7.1.2,PCI-DSSv4.0|7.2.1,PCI-DSSv4.0|7.2.2,QCSC-v1|3.2,QCSC-v1|5.2.2,QCSC-v1|6.2,QCSC-v1|13.2,SWIFT-CSCv1|5.1,TBA-FIISB|31.1,TBA-FIISB|31.4.2,TBA-FIISB|31.4.3" see_also : "https://workbench.cisecurity.org/benchmarks/20333" file : "/proc/self/mountinfo" regex : "[\\s]+/var/log[\\s]+" expect : "noexec" required : NO type : FILE_CONTENT_CHECK description : "1.1.2.7.2 Ensure nodev option set on /var/log/audit partition" info : "The nodev mount option specifies that the filesystem cannot contain special devices. Since the /var/log/audit filesystem is not intended to support devices, set this option to ensure that users cannot create a block or character special devices in /var/log/audit" solution : "- IF - a separate partition exists for /var/log/audit Edit the /etc/fstab file and add nodev to the fourth field (mounting options) for the /var/log/audit partition. Example: /var/log/audit defaults,rw,nosuid,nodev,noexec,relatime 0 0 Run the following command to remount /var/log/audit with the configured options: # mount -o remount /var/log/audit" reference : "800-171|3.1.1,800-171|3.1.4,800-171|3.1.5,800-171|3.8.1,800-171|3.8.2,800-171|3.8.3,800-171r3|03.01.02,800-171r3|03.01.04,800-171r3|03.01.05a.,800-171r3|03.08.02,800-53|AC-3,800-53|AC-5,800-53|AC-6,800-53|MP-2,800-53r5|AC-3,800-53r5|AC-5,800-53r5|AC-6,800-53r5|MP-2,CN-L3|7.1.3.2(b),CN-L3|7.1.3.2(g),CN-L3|8.1.4.2(d),CN-L3|8.1.4.2(f),CN-L3|8.1.4.11(b),CN-L3|8.1.10.2(c),CN-L3|8.1.10.6(a),CN-L3|8.5.3.1,CN-L3|8.5.4.1(a),CSCv7|14.6,CSCv8|3.3,CSF|PR.AC-4,CSF|PR.DS-5,CSF|PR.PT-2,CSF|PR.PT-3,CSF2.0|PR.AA-05,CSF2.0|PR.DS-10,CSF2.0|PR.IR-01,GDPR|32.1.b,HIPAA|164.306(a)(1),HIPAA|164.312(a)(1),ISO-27001-2022|A.5.3,ISO-27001-2022|A.5.10,ISO-27001-2022|A.5.15,ISO-27001-2022|A.5.33,ISO-27001-2022|A.7.7,ISO-27001-2022|A.7.10,ISO-27001-2022|A.8.2,ISO-27001-2022|A.8.3,ISO-27001-2022|A.8.18,ISO-27001-2022|A.8.20,ISO/IEC-27001|A.6.1.2,ISO/IEC-27001|A.9.4.1,ISO/IEC-27001|A.9.4.5,ITSG-33|AC-3,ITSG-33|AC-5,ITSG-33|AC-6,ITSG-33|MP-2,ITSG-33|MP-2a.,LEVEL|1A,NESA|T1.3.2,NESA|T1.3.3,NESA|T1.4.1,NESA|T4.2.1,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.2,NESA|T7.5.3,NIAv2|AM1,NIAv2|AM3,NIAv2|AM23f,NIAv2|SS13c,NIAv2|SS15c,NIAv2|SS29,PCI-DSSv3.2.1|7.1.2,PCI-DSSv4.0|7.2.1,PCI-DSSv4.0|7.2.2,QCSC-v1|3.2,QCSC-v1|5.2.2,QCSC-v1|6.2,QCSC-v1|13.2,SWIFT-CSCv1|5.1,TBA-FIISB|31.1,TBA-FIISB|31.4.2,TBA-FIISB|31.4.3" see_also : "https://workbench.cisecurity.org/benchmarks/20333" file : "/proc/self/mountinfo" regex : "[\\s]+/var/log/audit[\\s]+" expect : "nodev" required : NO type : FILE_CONTENT_CHECK description : "1.1.2.7.3 Ensure nosuid option set on /var/log/audit partition" info : "The nosuid mount option specifies that the filesystem cannot contain setuid files. Since the /var/log/audit filesystem is only intended for variable files such as logs, set this option to ensure that users cannot create setuid files in /var/log/audit" solution : "- IF - a separate partition exists for /var/log/audit Edit the /etc/fstab file and add nosuid to the fourth field (mounting options) for the /var/log/audit partition. Example: /var/log/audit defaults,rw,nosuid,nodev,noexec,relatime 0 0 Run the following command to remount /var/log/audit with the configured options: # mount -o remount /var/log/audit" reference : "800-171|3.1.1,800-171|3.1.4,800-171|3.1.5,800-171|3.8.1,800-171|3.8.2,800-171|3.8.3,800-171r3|03.01.02,800-171r3|03.01.04,800-171r3|03.01.05a.,800-171r3|03.08.02,800-53|AC-3,800-53|AC-5,800-53|AC-6,800-53|MP-2,800-53r5|AC-3,800-53r5|AC-5,800-53r5|AC-6,800-53r5|MP-2,CN-L3|7.1.3.2(b),CN-L3|7.1.3.2(g),CN-L3|8.1.4.2(d),CN-L3|8.1.4.2(f),CN-L3|8.1.4.11(b),CN-L3|8.1.10.2(c),CN-L3|8.1.10.6(a),CN-L3|8.5.3.1,CN-L3|8.5.4.1(a),CSCv7|14.6,CSCv8|3.3,CSF|PR.AC-4,CSF|PR.DS-5,CSF|PR.PT-2,CSF|PR.PT-3,CSF2.0|PR.AA-05,CSF2.0|PR.DS-10,CSF2.0|PR.IR-01,GDPR|32.1.b,HIPAA|164.306(a)(1),HIPAA|164.312(a)(1),ISO-27001-2022|A.5.3,ISO-27001-2022|A.5.10,ISO-27001-2022|A.5.15,ISO-27001-2022|A.5.33,ISO-27001-2022|A.7.7,ISO-27001-2022|A.7.10,ISO-27001-2022|A.8.2,ISO-27001-2022|A.8.3,ISO-27001-2022|A.8.18,ISO-27001-2022|A.8.20,ISO/IEC-27001|A.6.1.2,ISO/IEC-27001|A.9.4.1,ISO/IEC-27001|A.9.4.5,ITSG-33|AC-3,ITSG-33|AC-5,ITSG-33|AC-6,ITSG-33|MP-2,ITSG-33|MP-2a.,LEVEL|1A,NESA|T1.3.2,NESA|T1.3.3,NESA|T1.4.1,NESA|T4.2.1,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.2,NESA|T7.5.3,NIAv2|AM1,NIAv2|AM3,NIAv2|AM23f,NIAv2|SS13c,NIAv2|SS15c,NIAv2|SS29,PCI-DSSv3.2.1|7.1.2,PCI-DSSv4.0|7.2.1,PCI-DSSv4.0|7.2.2,QCSC-v1|3.2,QCSC-v1|5.2.2,QCSC-v1|6.2,QCSC-v1|13.2,SWIFT-CSCv1|5.1,TBA-FIISB|31.1,TBA-FIISB|31.4.2,TBA-FIISB|31.4.3" see_also : "https://workbench.cisecurity.org/benchmarks/20333" file : "/proc/self/mountinfo" regex : "[\\s]+/var/log/audit[\\s]+" expect : "nosuid" required : NO type : FILE_CONTENT_CHECK description : "1.1.2.7.4 Ensure noexec option set on /var/log/audit partition" info : "The noexec mount option specifies that the filesystem cannot contain executable binaries. Since the /var/log/audit filesystem is only intended for audit logs, set this option to ensure that users cannot run executable binaries from /var/log/audit" solution : "- IF - a separate partition exists for /var/log/audit Edit the /etc/fstab file and add noexec to the fourth field (mounting options) for the /var/log/audit partition. Example: /var/log/audit defaults,rw,nosuid,nodev,noexec,relatime 0 0 Run the following command to remount /var/log/audit with the configured options: # mount -o remount /var/log/audit" reference : "800-171|3.1.1,800-171|3.1.4,800-171|3.1.5,800-171|3.8.1,800-171|3.8.2,800-171|3.8.3,800-171r3|03.01.02,800-171r3|03.01.04,800-171r3|03.01.05a.,800-171r3|03.08.02,800-53|AC-3,800-53|AC-5,800-53|AC-6,800-53|MP-2,800-53r5|AC-3,800-53r5|AC-5,800-53r5|AC-6,800-53r5|MP-2,CN-L3|7.1.3.2(b),CN-L3|7.1.3.2(g),CN-L3|8.1.4.2(d),CN-L3|8.1.4.2(f),CN-L3|8.1.4.11(b),CN-L3|8.1.10.2(c),CN-L3|8.1.10.6(a),CN-L3|8.5.3.1,CN-L3|8.5.4.1(a),CSCv7|14.6,CSCv8|3.3,CSF|PR.AC-4,CSF|PR.DS-5,CSF|PR.PT-2,CSF|PR.PT-3,CSF2.0|PR.AA-05,CSF2.0|PR.DS-10,CSF2.0|PR.IR-01,GDPR|32.1.b,HIPAA|164.306(a)(1),HIPAA|164.312(a)(1),ISO-27001-2022|A.5.3,ISO-27001-2022|A.5.10,ISO-27001-2022|A.5.15,ISO-27001-2022|A.5.33,ISO-27001-2022|A.7.7,ISO-27001-2022|A.7.10,ISO-27001-2022|A.8.2,ISO-27001-2022|A.8.3,ISO-27001-2022|A.8.18,ISO-27001-2022|A.8.20,ISO/IEC-27001|A.6.1.2,ISO/IEC-27001|A.9.4.1,ISO/IEC-27001|A.9.4.5,ITSG-33|AC-3,ITSG-33|AC-5,ITSG-33|AC-6,ITSG-33|MP-2,ITSG-33|MP-2a.,LEVEL|1A,NESA|T1.3.2,NESA|T1.3.3,NESA|T1.4.1,NESA|T4.2.1,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.2,NESA|T7.5.3,NIAv2|AM1,NIAv2|AM3,NIAv2|AM23f,NIAv2|SS13c,NIAv2|SS15c,NIAv2|SS29,PCI-DSSv3.2.1|7.1.2,PCI-DSSv4.0|7.2.1,PCI-DSSv4.0|7.2.2,QCSC-v1|3.2,QCSC-v1|5.2.2,QCSC-v1|6.2,QCSC-v1|13.2,SWIFT-CSCv1|5.1,TBA-FIISB|31.1,TBA-FIISB|31.4.2,TBA-FIISB|31.4.3" see_also : "https://workbench.cisecurity.org/benchmarks/20333" file : "/proc/self/mountinfo" regex : "[\\s]+/var/log/audit[\\s]+" expect : "noexec" required : NO type : CMD_EXEC description : "1.2.1.1 Ensure GPG keys are configured" info : "The RPM Package Manager implements GPG key signing to verify package integrity during and after installation. 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. To this end, verify that GPG keys are configured correctly for your 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-171|3.11.2,800-171|3.11.3,800-171|3.14.1,800-171r3|03.11.02,800-171r3|03.14.01,800-53|RA-5,800-53|SI-2,800-53|SI-2(2),800-53r5|RA-5,800-53r5|RA-7,800-53r5|SI-2,800-53r5|SI-2(2),CN-L3|8.1.4.4(e),CN-L3|8.1.10.5(a),CN-L3|8.1.10.5(b),CN-L3|8.5.4.1(b),CN-L3|8.5.4.1(d),CN-L3|8.5.4.1(e),CSCv7|3.4,CSCv7|3.5,CSCv8|7.3,CSCv8|7.4,CSF|DE.CM-8,CSF|DE.DP-4,CSF|DE.DP-5,CSF|ID.RA-1,CSF|PR.IP-12,CSF|RS.CO-3,CSF|RS.MI-3,CSF2.0|GV.SC-10,CSF2.0|ID.IM-01,CSF2.0|ID.IM-02,CSF2.0|ID.IM-03,CSF2.0|ID.RA-01,CSF2.0|ID.RA-08,CSF2.0|PR.PS-02,GDPR|32.1.b,GDPR|32.1.d,HIPAA|164.306(a)(1),ISO-27001-2022|A.6.8,ISO-27001-2022|A.8.8,ISO-27001-2022|A.8.32,ISO/IEC-27001|A.12.6.1,ITSG-33|RA-5,ITSG-33|SI-2,ITSG-33|SI-2(2),LEVEL|1M,NESA|M1.2.2,NESA|M5.4.1,NESA|T7.6.2,NESA|T7.7.1,NIAv2|PR9,PCI-DSSv3.2.1|6.1,PCI-DSSv3.2.1|6.2,PCI-DSSv4.0|6.3,PCI-DSSv4.0|6.3.1,PCI-DSSv4.0|6.3.3,QCSC-v1|3.2,QCSC-v1|5.2.1,QCSC-v1|5.2.2,QCSC-v1|5.2.3,QCSC-v1|8.2.1,QCSC-v1|10.2.1,QCSC-v1|11.2,SWIFT-CSCv1|2.2,SWIFT-CSCv1|2.7" see_also : "https://workbench.cisecurity.org/benchmarks/20333" cmd : "rpm -q gpg-pubkey --queryformat '%{name}-%{version}-%{release} --> %{summary}\\n'" expect : "^Manual Review Required$" severity : MEDIUM type : FILE_CONTENT_CHECK_NOT description : "/etc/zypp/zypp.conf" file : "/etc/zypp/zypp.conf" regex : "^\\h*gpgcheck\\h*=\\h*(0|[2-9]|[1-9][0-9]+|false|no|off)\\b" expect : "^\\h*gpgcheck\\h*=\\h*(0|[2-9]|[1-9][0-9]+|false|no|off)\\b" type : FILE_CONTENT_CHECK_NOT description : "/etc/zypp/repos.d/*" file : "/etc/zypp/repos.d/*" regex : "^\\h*gpgcheck\\h*=\\h*(0|[2-9]|[1-9][0-9]+|false|off)\\b" expect : "^\\h*gpgcheck\\h*=\\h*(0|[2-9]|[1-9][0-9]+|false|off)\\b" description : "1.2.1.2 Ensure gpgcheck is globally activated" info : "The gpgcheck option, found in the main section of the /etc/zypp/zypp.conf and individual /etc/zypp/repos.d/*.repo files determines if an RPM package's signature is checked prior to its installation. 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/zypp/zypp.conf and set gpgcheck=on : Example # sed -i 's/^gpgcheck\s*=\s*.*/gpgcheck=on/' /etc/zypp/zypp.conf Edit any failing files in /etc/zypp/repos.d/* and set all instances starting with gpgcheck to on Example: # find /etc/zypp/repos.d/ -name \"*.repo\" -exec echo \"Checking:\" {} \; -exec sed -i 's/^gpgcheck\s*=\s*.*/gpgcheck=on/' {} \; Note: true yes or 1 is also acceptable." reference : "800-171|3.11.2,800-171|3.11.3,800-171|3.14.1,800-171r3|03.11.02,800-171r3|03.14.01,800-53|RA-5,800-53|SI-2,800-53|SI-2(2),800-53r5|RA-5,800-53r5|RA-7,800-53r5|SI-2,800-53r5|SI-2(2),CN-L3|8.1.4.4(e),CN-L3|8.1.10.5(a),CN-L3|8.1.10.5(b),CN-L3|8.5.4.1(b),CN-L3|8.5.4.1(d),CN-L3|8.5.4.1(e),CSCv7|3.4,CSCv8|7.3,CSF|DE.CM-8,CSF|DE.DP-4,CSF|DE.DP-5,CSF|ID.RA-1,CSF|PR.IP-12,CSF|RS.CO-3,CSF|RS.MI-3,CSF2.0|GV.SC-10,CSF2.0|ID.IM-01,CSF2.0|ID.IM-02,CSF2.0|ID.IM-03,CSF2.0|ID.RA-01,CSF2.0|ID.RA-08,CSF2.0|PR.PS-02,GDPR|32.1.b,GDPR|32.1.d,HIPAA|164.306(a)(1),ISO-27001-2022|A.6.8,ISO-27001-2022|A.8.8,ISO-27001-2022|A.8.32,ISO/IEC-27001|A.12.6.1,ITSG-33|RA-5,ITSG-33|SI-2,ITSG-33|SI-2(2),LEVEL|1A,NESA|M1.2.2,NESA|M5.4.1,NESA|T7.6.2,NESA|T7.7.1,NIAv2|PR9,PCI-DSSv3.2.1|6.1,PCI-DSSv3.2.1|6.2,PCI-DSSv4.0|6.3,PCI-DSSv4.0|6.3.1,PCI-DSSv4.0|6.3.3,QCSC-v1|3.2,QCSC-v1|5.2.1,QCSC-v1|5.2.2,QCSC-v1|5.2.3,QCSC-v1|8.2.1,QCSC-v1|10.2.1,QCSC-v1|11.2,SWIFT-CSCv1|2.2,SWIFT-CSCv1|2.7" see_also : "https://workbench.cisecurity.org/benchmarks/20333" show_output : YES type : CMD_EXEC description : "1.2.1.4 Ensure package manager repositories are configured" info : "Systems need to have the respective package manager repositories configured to ensure that the system is able to receive the latest patches and updates. 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.11.2,800-171|3.11.3,800-171|3.14.1,800-171r3|03.11.02,800-171r3|03.14.01,800-53|RA-5,800-53|SI-2,800-53|SI-2(2),800-53r5|RA-5,800-53r5|RA-7,800-53r5|SI-2,800-53r5|SI-2(2),CN-L3|8.1.4.4(e),CN-L3|8.1.10.5(a),CN-L3|8.1.10.5(b),CN-L3|8.5.4.1(b),CN-L3|8.5.4.1(d),CN-L3|8.5.4.1(e),CSCv7|3.4,CSCv7|3.5,CSCv8|7.3,CSCv8|7.4,CSF|DE.CM-8,CSF|DE.DP-4,CSF|DE.DP-5,CSF|ID.RA-1,CSF|PR.IP-12,CSF|RS.CO-3,CSF|RS.MI-3,CSF2.0|GV.SC-10,CSF2.0|ID.IM-01,CSF2.0|ID.IM-02,CSF2.0|ID.IM-03,CSF2.0|ID.RA-01,CSF2.0|ID.RA-08,CSF2.0|PR.PS-02,GDPR|32.1.b,GDPR|32.1.d,HIPAA|164.306(a)(1),ISO-27001-2022|A.6.8,ISO-27001-2022|A.8.8,ISO-27001-2022|A.8.32,ISO/IEC-27001|A.12.6.1,ITSG-33|RA-5,ITSG-33|SI-2,ITSG-33|SI-2(2),LEVEL|1M,NESA|M1.2.2,NESA|M5.4.1,NESA|T7.6.2,NESA|T7.7.1,NIAv2|PR9,PCI-DSSv3.2.1|6.1,PCI-DSSv3.2.1|6.2,PCI-DSSv4.0|6.3,PCI-DSSv4.0|6.3.1,PCI-DSSv4.0|6.3.3,QCSC-v1|3.2,QCSC-v1|5.2.1,QCSC-v1|5.2.2,QCSC-v1|5.2.3,QCSC-v1|8.2.1,QCSC-v1|10.2.1,QCSC-v1|11.2,SWIFT-CSCv1|2.2,SWIFT-CSCv1|2.7" see_also : "https://workbench.cisecurity.org/benchmarks/20333" cmd : "/bin/dnf repolist" expect : "^Manual Review Required$" severity : MEDIUM type : CMD_EXEC description : "updates" cmd : "/usr/bin/zypper list-updates" expect : "^No updates found" type : CMD_EXEC description : "patches" cmd : "/usr/bin/zypper list-patches" expect : "^No updates found" description : "1.2.2.1 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. 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." solution : "Use your package manager to update all packages on the system according to site policy. The following command will install all available updates: # zypper update The following command will install available patches: # zypper patch Once the update process is complete, verify if reboot is required to load changes. # zypper needs-rebooting" reference : "800-171|3.11.2,800-171|3.11.3,800-171|3.14.1,800-171r3|03.11.02,800-171r3|03.14.01,800-53|RA-5,800-53|SI-2,800-53|SI-2(2),800-53r5|RA-5,800-53r5|RA-7,800-53r5|SI-2,800-53r5|SI-2(2),CN-L3|8.1.4.4(e),CN-L3|8.1.10.5(a),CN-L3|8.1.10.5(b),CN-L3|8.5.4.1(b),CN-L3|8.5.4.1(d),CN-L3|8.5.4.1(e),CSCv7|3.4,CSCv7|3.5,CSCv8|7.3,CSCv8|7.4,CSF|DE.CM-8,CSF|DE.DP-4,CSF|DE.DP-5,CSF|ID.RA-1,CSF|PR.IP-12,CSF|RS.CO-3,CSF|RS.MI-3,CSF2.0|GV.SC-10,CSF2.0|ID.IM-01,CSF2.0|ID.IM-02,CSF2.0|ID.IM-03,CSF2.0|ID.RA-01,CSF2.0|ID.RA-08,CSF2.0|PR.PS-02,GDPR|32.1.b,GDPR|32.1.d,HIPAA|164.306(a)(1),ISO-27001-2022|A.6.8,ISO-27001-2022|A.8.8,ISO-27001-2022|A.8.32,ISO/IEC-27001|A.12.6.1,ITSG-33|RA-5,ITSG-33|SI-2,ITSG-33|SI-2(2),LEVEL|1M,NESA|M1.2.2,NESA|M5.4.1,NESA|T7.6.2,NESA|T7.7.1,NIAv2|PR9,PCI-DSSv3.2.1|6.1,PCI-DSSv3.2.1|6.2,PCI-DSSv4.0|6.3,PCI-DSSv4.0|6.3.1,PCI-DSSv4.0|6.3.3,QCSC-v1|3.2,QCSC-v1|5.2.1,QCSC-v1|5.2.2,QCSC-v1|5.2.3,QCSC-v1|8.2.1,QCSC-v1|10.2.1,QCSC-v1|11.2,SWIFT-CSCv1|2.2,SWIFT-CSCv1|2.7" see_also : "https://workbench.cisecurity.org/benchmarks/20333" show_output : YES type : RPM_CHECK description : "apparmor-utils" rpm : "apparmor-utils-0.0.0-0" operator : "gt" required : YES type : RPM_CHECK description : "apparmor-parser" rpm : "apparmor-parser-0.0.0-0" operator : "gt" required : YES type : RPM_CHECK description : "apparmor-profiles" rpm : "apparmor-profiles-0.0.0-0" operator : "gt" required : YES type : RPM_CHECK description : "libapparmor1" rpm : "libapparmor1-0.0.0-0" operator : "gt" required : YES description : "1.3.1.1 Ensure AppArmor is installed" info : "AppArmor - kernel enhancement to confine programs to a limited set of resources. Without a Mandatory Access Control system installed only the default Discretionary Access Control system will be available." solution : "Run the following command to install apparmor-utils : # zypper install apparmor-parser apparmor-profiles apparmor-utils libapparmor1" reference : "800-171|3.1.1,800-171|3.1.4,800-171|3.1.5,800-171|3.8.1,800-171|3.8.2,800-171|3.8.3,800-171r3|03.01.02,800-171r3|03.01.04,800-171r3|03.01.05a.,800-171r3|03.08.02,800-53|AC-3,800-53|AC-5,800-53|AC-6,800-53|MP-2,800-53r5|AC-3,800-53r5|AC-5,800-53r5|AC-6,800-53r5|MP-2,CN-L3|7.1.3.2(b),CN-L3|7.1.3.2(g),CN-L3|8.1.4.2(d),CN-L3|8.1.4.2(f),CN-L3|8.1.4.11(b),CN-L3|8.1.10.2(c),CN-L3|8.1.10.6(a),CN-L3|8.5.3.1,CN-L3|8.5.4.1(a),CSCv7|14.6,CSCv8|3.3,CSF|PR.AC-4,CSF|PR.DS-5,CSF|PR.PT-2,CSF|PR.PT-3,CSF2.0|PR.AA-05,CSF2.0|PR.DS-10,CSF2.0|PR.IR-01,GDPR|32.1.b,HIPAA|164.306(a)(1),HIPAA|164.312(a)(1),ISO-27001-2022|A.5.3,ISO-27001-2022|A.5.10,ISO-27001-2022|A.5.15,ISO-27001-2022|A.5.33,ISO-27001-2022|A.7.7,ISO-27001-2022|A.7.10,ISO-27001-2022|A.8.2,ISO-27001-2022|A.8.3,ISO-27001-2022|A.8.18,ISO-27001-2022|A.8.20,ISO/IEC-27001|A.6.1.2,ISO/IEC-27001|A.9.4.1,ISO/IEC-27001|A.9.4.5,ITSG-33|AC-3,ITSG-33|AC-5,ITSG-33|AC-6,ITSG-33|MP-2,ITSG-33|MP-2a.,LEVEL|1A,NESA|T1.3.2,NESA|T1.3.3,NESA|T1.4.1,NESA|T4.2.1,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.2,NESA|T7.5.3,NIAv2|AM1,NIAv2|AM3,NIAv2|AM23f,NIAv2|SS13c,NIAv2|SS15c,NIAv2|SS29,PCI-DSSv3.2.1|7.1.2,PCI-DSSv4.0|7.2.1,PCI-DSSv4.0|7.2.2,QCSC-v1|3.2,QCSC-v1|5.2.2,QCSC-v1|6.2,QCSC-v1|13.2,SWIFT-CSCv1|5.1,TBA-FIISB|31.1,TBA-FIISB|31.4.2,TBA-FIISB|31.4.3" see_also : "https://workbench.cisecurity.org/benchmarks/20333" show_output : YES type : FILE_CONTENT_CHECK description : "Ensure /boot/grub2/grub.cfg contents Pattern Match apparmor=1" file : "/boot/grub2/grub.cfg" regex : "^[\\s]*linux.*" expect : "(?i)[\\s]*apparmor[\\s]*=[\\s]*1" type : FILE_CONTENT_CHECK description : "security apparmor" file : "/boot/grub2/grub.cfg" regex : "^[\\s]*linux.*" expect : "(?i)[\\s]*security[\\s]*=[\\s]*apparmor" description : "1.3.1.2 Ensure AppArmor is enabled in the bootloader configuration" info : "Configure AppArmor to be enabled at boot time and verify that it has not been overwritten by the bootloader boot parameters. Note: This recommendation is designed around the grub bootloader, if LILO or another bootloader is in use in your environment enact equivalent settings. AppArmor must be enabled at boot time in your bootloader configuration to ensure that the controls it provides are not overridden." solution : "Edit /etc/default/grub and add the apparmor=1 and security=apparmor parameters to the GRUB_CMDLINE_LINUX= line GRUB_CMDLINE_LINUX=\"apparmor=1 security=apparmor\" Run the following command to update the grub2 configuration: # grub2-mkconfig -o /boot/grub2/grub.cfg" reference : "800-171|3.1.1,800-171|3.1.4,800-171|3.1.5,800-171|3.8.1,800-171|3.8.2,800-171|3.8.3,800-171r3|03.01.02,800-171r3|03.01.04,800-171r3|03.01.05a.,800-171r3|03.08.02,800-53|AC-3,800-53|AC-5,800-53|AC-6,800-53|MP-2,800-53r5|AC-3,800-53r5|AC-5,800-53r5|AC-6,800-53r5|MP-2,CN-L3|7.1.3.2(b),CN-L3|7.1.3.2(g),CN-L3|8.1.4.2(d),CN-L3|8.1.4.2(f),CN-L3|8.1.4.11(b),CN-L3|8.1.10.2(c),CN-L3|8.1.10.6(a),CN-L3|8.5.3.1,CN-L3|8.5.4.1(a),CSCv7|14.6,CSCv8|3.3,CSF|PR.AC-4,CSF|PR.DS-5,CSF|PR.PT-2,CSF|PR.PT-3,CSF2.0|PR.AA-05,CSF2.0|PR.DS-10,CSF2.0|PR.IR-01,GDPR|32.1.b,HIPAA|164.306(a)(1),HIPAA|164.312(a)(1),ISO-27001-2022|A.5.3,ISO-27001-2022|A.5.10,ISO-27001-2022|A.5.15,ISO-27001-2022|A.5.33,ISO-27001-2022|A.7.7,ISO-27001-2022|A.7.10,ISO-27001-2022|A.8.2,ISO-27001-2022|A.8.3,ISO-27001-2022|A.8.18,ISO-27001-2022|A.8.20,ISO/IEC-27001|A.6.1.2,ISO/IEC-27001|A.9.4.1,ISO/IEC-27001|A.9.4.5,ITSG-33|AC-3,ITSG-33|AC-5,ITSG-33|AC-6,ITSG-33|MP-2,ITSG-33|MP-2a.,LEVEL|1A,NESA|T1.3.2,NESA|T1.3.3,NESA|T1.4.1,NESA|T4.2.1,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.2,NESA|T7.5.3,NIAv2|AM1,NIAv2|AM3,NIAv2|AM23f,NIAv2|SS13c,NIAv2|SS15c,NIAv2|SS29,PCI-DSSv3.2.1|7.1.2,PCI-DSSv4.0|7.2.1,PCI-DSSv4.0|7.2.2,QCSC-v1|3.2,QCSC-v1|5.2.2,QCSC-v1|6.2,QCSC-v1|13.2,SWIFT-CSCv1|5.1,TBA-FIISB|31.1,TBA-FIISB|31.4.2,TBA-FIISB|31.4.3" see_also : "https://workbench.cisecurity.org/benchmarks/20333" show_output : YES type : CMD_EXEC description : "apparmor_status - processes are confined" cmd : "/sbin/apparmor_status" expect : "^[\\s]*0[\\s]+processes[\\s]+are[\\s]+unconfined" type : CMD_EXEC description : "apparmor_status - profiles are loaded" cmd : "/sbin/apparmor_status" expect : "^[\\s]*[1-9][0-9]*[\\s]+profiles[\\s]+are[\\s]+loaded" description : "1.3.1.3 Ensure all AppArmor Profiles are in enforce or complain mode" info : "AppArmor profiles define what resources applications are able to access. Security configuration requirements vary from site to site. Some sites may mandate a policy that is stricter than the default policy, which is perfectly acceptable. This item is intended to ensure that any policies that exist on the system are activated." solution : "Run the following command to set all profiles to enforce mode: # aa-enforce /etc/apparmor.d/* - OR - Run the following command to set all profiles to complain mode: # aa-complain /etc/apparmor.d/* Note: Any unconfined processes may need to have a profile created or activated for them and then be restarted" reference : "800-171|3.1.1,800-171|3.1.4,800-171|3.1.5,800-171|3.8.1,800-171|3.8.2,800-171|3.8.3,800-171r3|03.01.02,800-171r3|03.01.04,800-171r3|03.01.05a.,800-171r3|03.08.02,800-53|AC-3,800-53|AC-5,800-53|AC-6,800-53|MP-2,800-53r5|AC-3,800-53r5|AC-5,800-53r5|AC-6,800-53r5|MP-2,CN-L3|7.1.3.2(b),CN-L3|7.1.3.2(g),CN-L3|8.1.4.2(d),CN-L3|8.1.4.2(f),CN-L3|8.1.4.11(b),CN-L3|8.1.10.2(c),CN-L3|8.1.10.6(a),CN-L3|8.5.3.1,CN-L3|8.5.4.1(a),CSCv7|14.6,CSCv8|3.3,CSF|PR.AC-4,CSF|PR.DS-5,CSF|PR.PT-2,CSF|PR.PT-3,CSF2.0|PR.AA-05,CSF2.0|PR.DS-10,CSF2.0|PR.IR-01,GDPR|32.1.b,HIPAA|164.306(a)(1),HIPAA|164.312(a)(1),ISO-27001-2022|A.5.3,ISO-27001-2022|A.5.10,ISO-27001-2022|A.5.15,ISO-27001-2022|A.5.33,ISO-27001-2022|A.7.7,ISO-27001-2022|A.7.10,ISO-27001-2022|A.8.2,ISO-27001-2022|A.8.3,ISO-27001-2022|A.8.18,ISO-27001-2022|A.8.20,ISO/IEC-27001|A.6.1.2,ISO/IEC-27001|A.9.4.1,ISO/IEC-27001|A.9.4.5,ITSG-33|AC-3,ITSG-33|AC-5,ITSG-33|AC-6,ITSG-33|MP-2,ITSG-33|MP-2a.,LEVEL|1A,NESA|T1.3.2,NESA|T1.3.3,NESA|T1.4.1,NESA|T4.2.1,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.2,NESA|T7.5.3,NIAv2|AM1,NIAv2|AM3,NIAv2|AM23f,NIAv2|SS13c,NIAv2|SS15c,NIAv2|SS29,PCI-DSSv3.2.1|7.1.2,PCI-DSSv4.0|7.2.1,PCI-DSSv4.0|7.2.2,QCSC-v1|3.2,QCSC-v1|5.2.2,QCSC-v1|6.2,QCSC-v1|13.2,SWIFT-CSCv1|5.1,TBA-FIISB|31.1,TBA-FIISB|31.4.2,TBA-FIISB|31.4.3" see_also : "https://workbench.cisecurity.org/benchmarks/20333" show_output : YES type : FILE_CONTENT_CHECK description : "grub.cfg superusers" file : "/boot/grub2/grub.cfg" regex : "^[\\s]*set[\\s]*superusers[\\s]*=" expect : "^[\\s]*set[\\s]*superusers[\\s]*=\".+\"*$" type : CMD_EXEC description : "grub.cfg password_pbkdf2" cmd : "/bin/awk -F. '/^\\s*password_pbkdf2\\s+/ {print $1\".\"$2\".\"$3}' /boot/grub2/grub.cfg" expect : "^[\\s]*password_pbkdf2[\\s]+" description : "1.4.1 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. 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 auditing at boot time)." solution : "Create an encrypted password with grub2-mkpasswd-pbkdf2 : # grub2-mkpasswd-pbkdf2 Enter password: Reenter password: PBKDF2 hash of your password is Add the following into /etc/grub.d/40_custom set superusers=\"\" password_pbkdf2 Run the following command to import the changes into the main configuration file: # 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" reference : "800-171|3.1.1,800-171|3.1.4,800-171|3.1.5,800-171|3.8.1,800-171|3.8.2,800-171|3.8.3,800-171r3|03.01.02,800-171r3|03.01.04,800-171r3|03.01.05a.,800-171r3|03.08.02,800-53|AC-3,800-53|AC-5,800-53|AC-6,800-53|MP-2,800-53r5|AC-3,800-53r5|AC-5,800-53r5|AC-6,800-53r5|MP-2,CN-L3|7.1.3.2(b),CN-L3|7.1.3.2(g),CN-L3|8.1.4.2(d),CN-L3|8.1.4.2(f),CN-L3|8.1.4.11(b),CN-L3|8.1.10.2(c),CN-L3|8.1.10.6(a),CN-L3|8.5.3.1,CN-L3|8.5.4.1(a),CSCv7|14.6,CSCv8|3.3,CSF|PR.AC-4,CSF|PR.DS-5,CSF|PR.PT-2,CSF|PR.PT-3,CSF2.0|PR.AA-05,CSF2.0|PR.DS-10,CSF2.0|PR.IR-01,GDPR|32.1.b,HIPAA|164.306(a)(1),HIPAA|164.312(a)(1),ISO-27001-2022|A.5.3,ISO-27001-2022|A.5.10,ISO-27001-2022|A.5.15,ISO-27001-2022|A.5.33,ISO-27001-2022|A.7.7,ISO-27001-2022|A.7.10,ISO-27001-2022|A.8.2,ISO-27001-2022|A.8.3,ISO-27001-2022|A.8.18,ISO-27001-2022|A.8.20,ISO/IEC-27001|A.6.1.2,ISO/IEC-27001|A.9.4.1,ISO/IEC-27001|A.9.4.5,ITSG-33|AC-3,ITSG-33|AC-5,ITSG-33|AC-6,ITSG-33|MP-2,ITSG-33|MP-2a.,LEVEL|1A,NESA|T1.3.2,NESA|T1.3.3,NESA|T1.4.1,NESA|T4.2.1,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.2,NESA|T7.5.3,NIAv2|AM1,NIAv2|AM3,NIAv2|AM23f,NIAv2|SS13c,NIAv2|SS15c,NIAv2|SS29,PCI-DSSv3.2.1|7.1.2,PCI-DSSv4.0|7.2.1,PCI-DSSv4.0|7.2.2,QCSC-v1|3.2,QCSC-v1|5.2.2,QCSC-v1|6.2,QCSC-v1|13.2,SWIFT-CSCv1|5.1,TBA-FIISB|31.1,TBA-FIISB|31.4.2,TBA-FIISB|31.4.3" see_also : "https://workbench.cisecurity.org/benchmarks/20333" show_output : YES type : FILE_CHECK description : "1.4.2 Ensure access to bootloader config is configured" info : "The grub configuration file contains information on boot settings and passwords for unlocking boot options. The grub2 configuration is usually grub.cfg stored in /boot/grub2/ Note: - 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 and /boot/grub2/user.cfg with the appropriate boot configuration files for your environment 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 ownership and permissions on your grub configuration: # chown root:root /boot/grub2/grub.cfg # chmod og-rwx /boot/grub2/grub.cfg" reference : "800-171|3.1.1,800-171|3.1.4,800-171|3.1.5,800-171|3.8.1,800-171|3.8.2,800-171|3.8.3,800-171r3|03.01.02,800-171r3|03.01.04,800-171r3|03.01.05a.,800-171r3|03.08.02,800-53|AC-3,800-53|AC-5,800-53|AC-6,800-53|MP-2,800-53r5|AC-3,800-53r5|AC-5,800-53r5|AC-6,800-53r5|MP-2,CN-L3|7.1.3.2(b),CN-L3|7.1.3.2(g),CN-L3|8.1.4.2(d),CN-L3|8.1.4.2(f),CN-L3|8.1.4.11(b),CN-L3|8.1.10.2(c),CN-L3|8.1.10.6(a),CN-L3|8.5.3.1,CN-L3|8.5.4.1(a),CSCv7|14.6,CSCv8|3.3,CSF|PR.AC-4,CSF|PR.DS-5,CSF|PR.PT-2,CSF|PR.PT-3,CSF2.0|PR.AA-05,CSF2.0|PR.DS-10,CSF2.0|PR.IR-01,GDPR|32.1.b,HIPAA|164.306(a)(1),HIPAA|164.312(a)(1),ISO-27001-2022|A.5.3,ISO-27001-2022|A.5.10,ISO-27001-2022|A.5.15,ISO-27001-2022|A.5.33,ISO-27001-2022|A.7.7,ISO-27001-2022|A.7.10,ISO-27001-2022|A.8.2,ISO-27001-2022|A.8.3,ISO-27001-2022|A.8.18,ISO-27001-2022|A.8.20,ISO/IEC-27001|A.6.1.2,ISO/IEC-27001|A.9.4.1,ISO/IEC-27001|A.9.4.5,ITSG-33|AC-3,ITSG-33|AC-5,ITSG-33|AC-6,ITSG-33|MP-2,ITSG-33|MP-2a.,LEVEL|1A,NESA|T1.3.2,NESA|T1.3.3,NESA|T1.4.1,NESA|T4.2.1,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.2,NESA|T7.5.3,NIAv2|AM1,NIAv2|AM3,NIAv2|AM23f,NIAv2|SS13c,NIAv2|SS15c,NIAv2|SS29,PCI-DSSv3.2.1|7.1.2,PCI-DSSv4.0|7.2.1,PCI-DSSv4.0|7.2.2,QCSC-v1|3.2,QCSC-v1|5.2.2,QCSC-v1|6.2,QCSC-v1|13.2,SWIFT-CSCv1|5.1,TBA-FIISB|31.1,TBA-FIISB|31.4.2,TBA-FIISB|31.4.3" see_also : "https://workbench.cisecurity.org/benchmarks/20333" file : "/boot/grub2/grub.cfg" owner : "root" mask : "077" group : "root" type : CMD_EXEC description : "1.5.1 Ensure address space layout randomization is enabled" info : "Address space layout randomization (ASLR) is an exploit mitigation technique which randomly arranges the address space of key data areas of a process. 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 file in /etc/sysctl.d/ ending inconf : - kernel.randomize_va_space = 2 Example: # printf \"\n%s\n\" \"kernel.randomize_va_space = 2\" >> /etc/sysctl.d/60-kernel_sysctl.conf Run the following command to set the active kernel parameter: # sysctl -w kernel.randomize_va_space=2 Note: If these settings appear in a canonically later file, or later in the same file, these settings will be overwritten" reference : "800-53|SI-16,800-53r5|SI-16,CSCv7|8.3,CSCv8|10.5,CSF2.0|PR.DS-10,GDPR|32.1.b,HIPAA|164.306(a)(1),ITSG-33|SI-16,LEVEL|1A" see_also : "https://workbench.cisecurity.org/benchmarks/20333" cmd : "#!/bin/bash { a_output=(); a_output2=(); a_parlist=(kernel.randomize_va_space=2) l_ufwscf=\"$([ -f /etc/default/ufw ] && awk -F= '/^\\s*IPT_SYSCTL=/ {print $2}' /etc/default/ufw)\" f_kernel_parameter_chk() { l_running_parameter_value=\"$(sysctl \"$l_parameter_name\" | awk -F= '{print $2}' | xargs)\" # Check running configuration if grep -Pq -- '\\b'\"$l_parameter_value\"'\\b' <<< \"$l_running_parameter_value\"; then a_output+=(\" - \\\"$l_parameter_name\\\" is correctly set to \\\"$l_running_parameter_value\\\"\" \" in the running configuration\") else a_output2+=(\" - \\\"$l_parameter_name\\\" is incorrectly set to \\\"$l_running_parameter_value\\\"\" \\ \" in the running configuration\" \\ \" and should have a value of: \\\"$l_value_out\\\"\") fi unset A_out; declare -A A_out # Check durable setting (files) while read -r l_out; do if [ -n \"$l_out\" ]; then if [[ $l_out =~ ^\\s*# ]]; then l_file=\"${l_out//# /}\" else l_kpar=\"$(awk -F= '{print $1}' <<< \"$l_out\" | xargs)\" [ \"$l_kpar\" = \"$l_parameter_name\" ] && A_out+=([\"$l_kpar\"]=\"$l_file\") fi fi done < <(\"$l_systemdsysctl\" --cat-config | grep -Po '^\\h*([^#\\n\\r]+|#\\h*\\/[^#\\n\\r\\h]+\\.conf\\b)') if [ -n \"$l_ufwscf\" ]; then # Account for systems with UFW (Not covered by systemd-sysctl --cat-config) l_kpar=\"$(grep -Po \"^\\h*$l_parameter_name\\b\" \"$l_ufwscf\" | xargs)\" l_kpar=\"${l_kpar//\\//.}\" [ \"$l_kpar\" = \"$l_parameter_name\" ] && A_out+=([\"$l_kpar\"]=\"$l_ufwscf\") fi if (( ${#A_out[@]} > 0 )); then # Assess output from files and generate output while IFS=\"=\" read -r l_fkpname l_file_parameter_value; do l_fkpname=\"${l_fkpname// /}\"; l_file_parameter_value=\"${l_file_parameter_value// /}\" if grep -Pq -- '\\b'\"$l_parameter_value\"'\\b' <<< \"$l_file_parameter_value\"; then a_output+=(\" - \\\"$l_parameter_name\\\" is correctly set to \\\"$l_file_parameter_value\\\"\" \\ \" in \\\"$(printf '%s' \"${A_out[@]}\")\\\"\") else a_output2+=(\" - \\\"$l_parameter_name\\\" is incorrectly set to \\\"$l_file_parameter_value\\\"\" \" in \\\"$(printf '%s' \"${A_out[@]}\")\\\"\" \\ \" and should have a value of: \\\"$l_value_out\\\"\") fi done < <(grep -Po -- \"^\\h*$l_parameter_name\\h*=\\h*\\H+\" \"${A_out[@]}\") else a_output2+=(\" - \\\"$l_parameter_name\\\" is not set in an included file\" \\ \" ** Note: \\\"$l_parameter_name\\\" May be set in a file that's ignored by load procedure **\") fi } l_systemdsysctl=\"$(readlink -f /lib/systemd/systemd-sysctl)\" while IFS=\"=\" read -r l_parameter_name l_parameter_value; do # Assess and check parameters l_parameter_name=\"${l_parameter_name// /}\"; l_parameter_value=\"${l_parameter_value// /}\" l_value_out=\"${l_parameter_value//-/ through }\"; l_value_out=\"${l_value_out//|/ or }\" l_value_out=\"$(tr -d '(){}' <<< \"$l_value_out\")\" f_kernel_parameter_chk done < <(printf '%s\\n' \"${a_parlist[@]}\") if [ \"${#a_output2[@]}\" -le 0 ]; then printf '%s\\n' \"\" \"- Audit Result:\" \" ** PASS **\" \"${a_output[@]}\" \"\" else printf '%s\\n' \"\" \"- Audit Result:\" \" ** FAIL **\" \" - Reason(s) for audit failure:\" \"${a_output2[@]}\" [ \"${#a_output[@]}\" -gt 0 ] && printf '%s\\n' \"\" \"- Correctly set:\" \"${a_output[@]}\" \"\" fi }" expect : "(?i)^[\\s]*\\**[\\s]*pass:?[\\s]*\\**$" type : CMD_EXEC description : "limits.conf limits.d hard core" cmd : "/bin/grep -E '^\\s*\\*\\s+hard\\s+core\\s+0\\s*$' /etc/security/limits.conf /etc/security/limits.d/* | /bin/awk '{print} END {if (NR != 0) print \"pass\" ; else print \"fail\"}'" expect : "^pass$" type : CMD_EXEC description : "sysctl.conf sysctl.d fs.suid_dumpable" cmd : "/bin/grep -E '^\\s*fs\\.suid_dumpable\\s*=\\s*0\\s*$' /etc/sysctl.conf /etc/sysctl.d/* | /bin/awk '{print} END {if (NR != 0) print \"pass\" ; else print \"fail\"}'" expect : "^pass$" type : CMD_EXEC description : "sysctl - fs.suid_dumpable" cmd : "/sbin/sysctl fs.suid_dumpable" expect : "^[\\s]*fs\\.suid_dumpable[\\s]*=[\\s]*0[\\s]*$" description : "1.5.2 Ensure core dumps are restricted" 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. 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.4.2,800-171r3|03.04.02,800-53|CM-6,800-53r5|CM-6,CSCv7|5.1,CSF|PR.IP-1,CSF2.0|DE.CM-09,CSF2.0|PR.PS-01,GDPR|32.1.b,HIPAA|164.306(a)(1),ISO-27001-2022|A.8.9,ITSG-33|CM-6,LEVEL|1A,SWIFT-CSCv1|2.3" see_also : "https://workbench.cisecurity.org/benchmarks/20333" show_output : YES type : RPM_CHECK description : "1.5.3 Ensure prelink is disabled" info : "prelink is a program that modifies ELF shared libraries and ELF dynamically linked binaries in such a way that the time needed for the dynamic linker to perform relocations at startup significantly decreases. The prelinking feature can interfere with the operation of AIDE, because it changes binaries. Prelinking can also increase the vulnerability of the system if a malicious user is able to compromise a common library such as libc." solution : "Run the following command to restore binaries to normal: # prelink -ua Run the following command to uninstall prelink : # zypper remove prelink" reference : "800-171|3.1.7,800-171|3.3.1,800-171|3.3.2,800-171r3|03.01.07b.,800-171r3|03.03.01,800-171r3|03.03.03,800-53|AC-6(9),800-53|AU-2,800-53|AU-12,800-53r5|AC-6(9),800-53r5|AU-2,800-53r5|AU-12,CN-L3|7.1.3.2(b),CN-L3|7.1.3.2(g),CN-L3|8.1.4.2(d),CN-L3|8.1.4.3(a),CN-L3|8.1.10.6(a),CSCv7|14.9,CSCv8|3.14,CSF|DE.CM-1,CSF|DE.CM-3,CSF|DE.CM-7,CSF|PR.AC-4,CSF|PR.PT-1,CSF2.0|DE.CM-01,CSF2.0|DE.CM-03,CSF2.0|DE.CM-09,CSF2.0|PR.AA-05,CSF2.0|PR.PS-04,GDPR|32.1.b,HIPAA|164.306(a)(1),HIPAA|164.312(a)(1),HIPAA|164.312(b),ISO-27001-2022|A.5.15,ISO-27001-2022|A.8.2,ISO-27001-2022|A.8.15,ISO-27001-2022|A.8.18,ISO/IEC-27001|A.12.4.3,ITSG-33|AC-6,ITSG-33|AU-2,ITSG-33|AU-12,LEVEL|1A,NESA|M1.2.2,NESA|M5.5.1,NESA|T5.1.1,NESA|T5.2.2,NESA|T5.5.4,NESA|T7.5.3,NIAv2|AM1,NIAv2|AM7,NIAv2|AM11a,NIAv2|AM11b,NIAv2|AM11c,NIAv2|AM11d,NIAv2|AM11e,NIAv2|AM23f,NIAv2|SS13c,NIAv2|SS15c,NIAv2|SS30,NIAv2|VL8,PCI-DSSv3.2.1|7.1.2,PCI-DSSv3.2.1|10.1,PCI-DSSv4.0|7.2.1,PCI-DSSv4.0|7.2.2,QCSC-v1|3.2,QCSC-v1|5.2.2,QCSC-v1|6.2,QCSC-v1|8.2.1,QCSC-v1|13.2,SWIFT-CSCv1|5.1,SWIFT-CSCv1|6.4,TBA-FIISB|31.4.2,TBA-FIISB|31.4.3" see_also : "https://workbench.cisecurity.org/benchmarks/20333" rpm : "prelink-0.0.0-0" operator : "lte" type : RPM_CHECK description : "1.6.1 Ensure crypto-policies-scripts package is installed" info : "This package provides a tool update-crypto-policies which applies the policies provided by the crypto-policies package. These can be either the pre-built policies from the base package or custom policies defined in simple policy definition files. The package also provides a tool fips-mode-setup, which can be used to enable or disable the system FIPS mode. update-crypto-policies is used to set the policy applicable for the various cryptographic back-ends, such as SSL/TLS libraries. The policy aims to control the back-end default algorithm selections unless the application user configures them otherwise." solution : "Run the following command to install crypto-policies-scripts : # zypper install crypto-policies-scripts" reference : "800-171|3.1.13,800-171|3.5.2,800-171|3.13.8,800-171r3|03.05.07,800-171r3|03.05.12,800-171r3|03.13.08,800-53|AC-17(2),800-53|IA-5,800-53|IA-5(1),800-53|SC-8,800-53|SC-8(1),800-53r5|AC-17(2),800-53r5|IA-5,800-53r5|IA-5(1),800-53r5|SC-8,800-53r5|SC-8(1),CN-L3|7.1.2.7(g),CN-L3|7.1.3.1(d),CN-L3|8.1.2.2(a),CN-L3|8.1.2.2(b),CN-L3|8.1.4.1(c),CN-L3|8.1.4.7(a),CN-L3|8.1.4.8(a),CN-L3|8.2.4.5(c),CN-L3|8.2.4.5(d),CN-L3|8.5.2.2,CSCv7|14.4,CSCv8|3.10,CSF|PR.AC-1,CSF|PR.AC-3,CSF|PR.DS-2,CSF|PR.DS-5,CSF|PR.PT-4,CSF2.0|PR.AA-01,CSF2.0|PR.AA-03,CSF2.0|PR.AA-05,CSF2.0|PR.DS-02,GDPR|32.1.a,GDPR|32.1.b,HIPAA|164.306(a)(1),HIPAA|164.312(a)(1),HIPAA|164.312(a)(2)(i),HIPAA|164.312(d),HIPAA|164.312(e)(1),HIPAA|164.312(e)(2)(i),ISO-27001-2022|A.5.10,ISO-27001-2022|A.5.14,ISO-27001-2022|A.5.16,ISO-27001-2022|A.5.17,ISO-27001-2022|A.5.33,ISO-27001-2022|A.6.7,ISO-27001-2022|A.8.20,ISO/IEC-27001|A.6.2.2,ISO/IEC-27001|A.10.1.1,ISO/IEC-27001|A.13.2.3,ITSG-33|AC-17(2),ITSG-33|IA-5,ITSG-33|IA-5(1),ITSG-33|SC-8,ITSG-33|SC-8a.,ITSG-33|SC-8(1),LEVEL|1A,NESA|T4.3.1,NESA|T4.3.2,NESA|T4.5.1,NESA|T4.5.2,NESA|T5.2.3,NESA|T5.4.2,NESA|T7.3.3,NESA|T7.4.1,NIAv2|AM37,NIAv2|IE8,NIAv2|IE9,NIAv2|IE12,NIAv2|NS5d,NIAv2|NS6b,NIAv2|NS29,NIAv2|SS24,PCI-DSSv3.2.1|2.3,PCI-DSSv3.2.1|4.1,PCI-DSSv4.0|2.2.7,PCI-DSSv4.0|4.2.1,QCSC-v1|3.2,QCSC-v1|5.2.1,QCSC-v1|5.2.2,QCSC-v1|6.2,QCSC-v1|13.2,SWIFT-CSCv1|2.1,SWIFT-CSCv1|2.6,SWIFT-CSCv1|4.1,TBA-FIISB|29.1" see_also : "https://workbench.cisecurity.org/benchmarks/20333" rpm : "crypto-policies-scripts-0.0.0-0" operator : "gt" required : YES type : FILE_CONTENT_CHECK_NOT description : "1.6.2 Ensure system wide crypto policy is not set to legacy" info : "When a system-wide policy is set up, the default behavior of applications will be to follow the policy. Applications will be unable to use algorithms andprotocols that do not meet the policy, unless you explicitly request the application to do so. The system-wide crypto-policies followed by the crypto core components allow consistently deprecating and disabling algorithms system-wide. The LEGACY policy is less secure due to an increased attack surface. In addition to the DEFAULT level algorithms and protocols, it includes support for the TLS 1.0 and 1.1 protocols. The algorithms DSA 3DES and RC4 are allowed, while RSA keys and Diffie-Hellman parameters are accepted if they are at least 1023 bits long. 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: Environments that require compatibility with older insecure protocols may require the useof the less secure LEGACY policy level." reference : "800-171|3.1.13,800-171|3.5.2,800-171|3.13.8,800-171r3|03.05.07,800-171r3|03.05.12,800-171r3|03.13.08,800-53|AC-17(2),800-53|IA-5,800-53|IA-5(1),800-53|SC-8,800-53|SC-8(1),800-53r5|AC-17(2),800-53r5|IA-5,800-53r5|IA-5(1),800-53r5|SC-8,800-53r5|SC-8(1),CN-L3|7.1.2.7(g),CN-L3|7.1.3.1(d),CN-L3|8.1.2.2(a),CN-L3|8.1.2.2(b),CN-L3|8.1.4.1(c),CN-L3|8.1.4.7(a),CN-L3|8.1.4.8(a),CN-L3|8.2.4.5(c),CN-L3|8.2.4.5(d),CN-L3|8.5.2.2,CSCv7|14.4,CSCv8|3.10,CSF|PR.AC-1,CSF|PR.AC-3,CSF|PR.DS-2,CSF|PR.DS-5,CSF|PR.PT-4,CSF2.0|PR.AA-01,CSF2.0|PR.AA-03,CSF2.0|PR.AA-05,CSF2.0|PR.DS-02,GDPR|32.1.a,GDPR|32.1.b,HIPAA|164.306(a)(1),HIPAA|164.312(a)(1),HIPAA|164.312(a)(2)(i),HIPAA|164.312(d),HIPAA|164.312(e)(1),HIPAA|164.312(e)(2)(i),ISO-27001-2022|A.5.10,ISO-27001-2022|A.5.14,ISO-27001-2022|A.5.16,ISO-27001-2022|A.5.17,ISO-27001-2022|A.5.33,ISO-27001-2022|A.6.7,ISO-27001-2022|A.8.20,ISO/IEC-27001|A.6.2.2,ISO/IEC-27001|A.10.1.1,ISO/IEC-27001|A.13.2.3,ITSG-33|AC-17(2),ITSG-33|IA-5,ITSG-33|IA-5(1),ITSG-33|SC-8,ITSG-33|SC-8a.,ITSG-33|SC-8(1),LEVEL|1A,NESA|T4.3.1,NESA|T4.3.2,NESA|T4.5.1,NESA|T4.5.2,NESA|T5.2.3,NESA|T5.4.2,NESA|T7.3.3,NESA|T7.4.1,NIAv2|AM37,NIAv2|IE8,NIAv2|IE9,NIAv2|IE12,NIAv2|NS5d,NIAv2|NS6b,NIAv2|NS29,NIAv2|SS24,PCI-DSSv3.2.1|2.3,PCI-DSSv3.2.1|4.1,PCI-DSSv4.0|2.2.7,PCI-DSSv4.0|4.2.1,QCSC-v1|3.2,QCSC-v1|5.2.1,QCSC-v1|5.2.2,QCSC-v1|6.2,QCSC-v1|13.2,SWIFT-CSCv1|2.1,SWIFT-CSCv1|2.6,SWIFT-CSCv1|4.1,TBA-FIISB|29.1" see_also : "https://workbench.cisecurity.org/benchmarks/20333" file : "/etc/crypto-policies/config" regex : "(?i)^[\\s]*LEGACY[\\s]*([\\s]+#.*)?$" expect : "(?i)^[\\s]*LEGACY[\\s]*([\\s]+#.*)?$" type : FILE_CONTENT_CHECK_NOT description : "1.6.3 Ensure system wide crypto policy is not set in sshd configuration" info : "System-wide Crypto policy can be over-ridden or opted out of for openSSH Over-riding or opting out of the system-wide crypto policy could allow for the use of less secure Ciphers, MACs, KexAlgorithms and GSSAPIKexAlgorithm Note: If changes to the system-wide crypto policy are required to meet local site policy for the openSSH server, these changes should be done with a sub-policy assigned to the system-wide crypto policy. For additional information see the CRYPTO-POLICIES(7) man page" solution : "Run the following commands: # sed -ri \"s/^\s*(CRYPTO_POLICY\s*=.*)$/# \1/\" /etc/sysconfig/ssh # systemctl reload sshd" reference : "800-171|3.1.13,800-171|3.5.2,800-171|3.13.8,800-171r3|03.05.07,800-171r3|03.05.12,800-171r3|03.13.08,800-53|AC-17(2),800-53|IA-5,800-53|IA-5(1),800-53|SC-8,800-53|SC-8(1),800-53r5|AC-17(2),800-53r5|IA-5,800-53r5|IA-5(1),800-53r5|SC-8,800-53r5|SC-8(1),CN-L3|7.1.2.7(g),CN-L3|7.1.3.1(d),CN-L3|8.1.2.2(a),CN-L3|8.1.2.2(b),CN-L3|8.1.4.1(c),CN-L3|8.1.4.7(a),CN-L3|8.1.4.8(a),CN-L3|8.2.4.5(c),CN-L3|8.2.4.5(d),CN-L3|8.5.2.2,CSCv7|14.4,CSCv8|3.10,CSF|PR.AC-1,CSF|PR.AC-3,CSF|PR.DS-2,CSF|PR.DS-5,CSF|PR.PT-4,CSF2.0|PR.AA-01,CSF2.0|PR.AA-03,CSF2.0|PR.AA-05,CSF2.0|PR.DS-02,GDPR|32.1.a,GDPR|32.1.b,HIPAA|164.306(a)(1),HIPAA|164.312(a)(1),HIPAA|164.312(a)(2)(i),HIPAA|164.312(d),HIPAA|164.312(e)(1),HIPAA|164.312(e)(2)(i),ISO-27001-2022|A.5.10,ISO-27001-2022|A.5.14,ISO-27001-2022|A.5.16,ISO-27001-2022|A.5.17,ISO-27001-2022|A.5.33,ISO-27001-2022|A.6.7,ISO-27001-2022|A.8.20,ISO/IEC-27001|A.6.2.2,ISO/IEC-27001|A.10.1.1,ISO/IEC-27001|A.13.2.3,ITSG-33|AC-17(2),ITSG-33|IA-5,ITSG-33|IA-5(1),ITSG-33|SC-8,ITSG-33|SC-8a.,ITSG-33|SC-8(1),LEVEL|1A,NESA|T4.3.1,NESA|T4.3.2,NESA|T4.5.1,NESA|T4.5.2,NESA|T5.2.3,NESA|T5.4.2,NESA|T7.3.3,NESA|T7.4.1,NIAv2|AM37,NIAv2|IE8,NIAv2|IE9,NIAv2|IE12,NIAv2|NS5d,NIAv2|NS6b,NIAv2|NS29,NIAv2|SS24,PCI-DSSv3.2.1|2.3,PCI-DSSv3.2.1|4.1,PCI-DSSv4.0|2.2.7,PCI-DSSv4.0|4.2.1,QCSC-v1|3.2,QCSC-v1|5.2.1,QCSC-v1|5.2.2,QCSC-v1|6.2,QCSC-v1|13.2,SWIFT-CSCv1|2.1,SWIFT-CSCv1|2.6,SWIFT-CSCv1|4.1,TBA-FIISB|29.1" see_also : "https://workbench.cisecurity.org/benchmarks/20333" file : "/etc/sysconfig/sshd" regex : "(?i)^\\h*CRYPTO_POLICY\\h*=" expect : "(?i)^\\h*CRYPTO_POLICY\\h*=" required : NO type : CMD_EXEC description : "check CURRENT.pol for sha1_in_certs disabled" cmd : "/bin/awk -F= '($1~/(hash|sign)/ && $2~/SHA1/ && $2!~/^\\s*\\-\\s*([^#\\n\\r]+)?SHA1/){print}' /etc/crypto-policies/state/CURRENT.pol | /bin/awk '{print} END {if (NR == 0) print \"none\"}'" expect : "^none$" type : FILE_CONTENT_CHECK description : "check CURRENT.pol for sha1_in_certs disabled" file : "/etc/crypto-policies/state/CURRENT.pol" regex : "^\\h*sha1_in_certs\\h*=" expect : "^\\h*sha1_in_certs\\h*=\\h*0\\b" description : "1.6.4 Ensure system wide crypto policy disables sha1 hash and signature support" info : "SHA-1 (Secure Hash Algorithm) is a cryptographic hash function that produces a 160 bit hash value. The SHA-1 hash function has an inherently weak design, and advancing cryptanalysis has made it vulnerable to attacks. The most significant danger for a hash algorithm is when a \"collision\" which happens when two different pieces of data produce the same hash value occurs. This hashing algorithm has been considered weak since 2005. Note: The use of SHA-1 with hashbased message authentication codes (HMAC) do not rely on the collision resistance of the corresponding hash function, and therefore the recent attacks on SHA-1 have a significantly lower impact on the use of SHA-1 for HMAC. Because of this, the recommendation does not disable the hmac-sha1 MAC." solution : "Note: - The commands below are written for the included DEFAULT system-wide crypto policy. If another policy is in use and follows local site policy, replace DEFAULT with the name of your system-wide crypto policy. - Multiple subpolicies may be assigned to a policy as a colon separated list. e.g. DEFAULT:NO-SHA1:NO-SSHCBC - Subpolicies: - Not included in the update-crypto-policies --set command will not be applied to the system wide crypto policy. - must exist before they can be applied to the system wide crypto policy. - pmod file filenames must be in all upper case, upper case, e.g. NO-SHA1.pmod or they will not be read by the update-crypto-policies --set command. Create or edit a file in /etc/crypto-policies/policies/modules/ ending inpmod and add or modify the following lines: hash = -SHA1 sign = -*-SHA1 sha1_in_certs = 0 Example: # printf '%s\n' \"# This is a subpolicy dropping the SHA1 hash and signature support\" \"hash = -SHA1\" \"sign = -*-SHA1\" \"sha1_in_certs = 0\" >> /etc/crypto-policies/policies/modules/NO-SHA1.pmod Run the following command to update the system-wide cryptographic policy # update-crypto-policies --set ::: Example: update-crypto-policies --set DEFAULT:NO-SHA1 Run the following command to reboot the system to make your cryptographic settings effective for already running services and applications: # reboot" reference : "800-171|3.1.13,800-171|3.5.2,800-171|3.13.8,800-171r3|03.05.07,800-171r3|03.05.12,800-171r3|03.13.08,800-53|AC-17(2),800-53|IA-5,800-53|IA-5(1),800-53|SC-8,800-53|SC-8(1),800-53r5|AC-17(2),800-53r5|IA-5,800-53r5|IA-5(1),800-53r5|SC-8,800-53r5|SC-8(1),CN-L3|7.1.2.7(g),CN-L3|7.1.3.1(d),CN-L3|8.1.2.2(a),CN-L3|8.1.2.2(b),CN-L3|8.1.4.1(c),CN-L3|8.1.4.7(a),CN-L3|8.1.4.8(a),CN-L3|8.2.4.5(c),CN-L3|8.2.4.5(d),CN-L3|8.5.2.2,CSCv7|14.4,CSCv8|3.10,CSF|PR.AC-1,CSF|PR.AC-3,CSF|PR.DS-2,CSF|PR.DS-5,CSF|PR.PT-4,CSF2.0|PR.AA-01,CSF2.0|PR.AA-03,CSF2.0|PR.AA-05,CSF2.0|PR.DS-02,GDPR|32.1.a,GDPR|32.1.b,HIPAA|164.306(a)(1),HIPAA|164.312(a)(1),HIPAA|164.312(a)(2)(i),HIPAA|164.312(d),HIPAA|164.312(e)(1),HIPAA|164.312(e)(2)(i),ISO-27001-2022|A.5.10,ISO-27001-2022|A.5.14,ISO-27001-2022|A.5.16,ISO-27001-2022|A.5.17,ISO-27001-2022|A.5.33,ISO-27001-2022|A.6.7,ISO-27001-2022|A.8.20,ISO/IEC-27001|A.6.2.2,ISO/IEC-27001|A.10.1.1,ISO/IEC-27001|A.13.2.3,ITSG-33|AC-17(2),ITSG-33|IA-5,ITSG-33|IA-5(1),ITSG-33|SC-8,ITSG-33|SC-8a.,ITSG-33|SC-8(1),LEVEL|1A,NESA|T4.3.1,NESA|T4.3.2,NESA|T4.5.1,NESA|T4.5.2,NESA|T5.2.3,NESA|T5.4.2,NESA|T7.3.3,NESA|T7.4.1,NIAv2|AM37,NIAv2|IE8,NIAv2|IE9,NIAv2|IE12,NIAv2|NS5d,NIAv2|NS6b,NIAv2|NS29,NIAv2|SS24,PCI-DSSv3.2.1|2.3,PCI-DSSv3.2.1|4.1,PCI-DSSv4.0|2.2.7,PCI-DSSv4.0|4.2.1,QCSC-v1|3.2,QCSC-v1|5.2.1,QCSC-v1|5.2.2,QCSC-v1|6.2,QCSC-v1|13.2,SWIFT-CSCv1|2.1,SWIFT-CSCv1|2.6,SWIFT-CSCv1|4.1,TBA-FIISB|29.1" see_also : "https://workbench.cisecurity.org/benchmarks/20333" show_output : YES type : FILE_CONTENT_CHECK_NOT description : "1.6.5 Ensure system wide crypto policy disables macs less than 128 bits" info : "Message Authentication Code (MAC) algorithm is a family of cryptographic functions that is parameterized by a symmetric key. Each of the functions can act on input data (called a \"message\") of variable length to produce an output value of a specified length. The output value is called the MAC of the input message. A MAC algorithm can be used to provide data-origin authentication and data-integrity protection Weak algorithms continue to have a great deal of attention as a weak spot that can be exploited with expanded computing power. An attacker that breaks the algorithm could take advantage of a MiTM position to decrypt the tunnel and capture credentials and information. A MAC algorithm must be computationally infeasible to determine the MAC of a message without knowledge of the key, even if one has already seen the results of using that key to compute the MAC's of other messages." solution : "Note: - The commands below are written for the included DEFAULT system-wide crypto policy. If another policy is in use and follows local site policy, replace DEFAULT with the name of your system-wide crypto policy. - Multiple subpolicies may be assigned to a policy as a colon separated list. e.g. DEFAULT:NO-SHA1:NO-SSHCBC - Subpolicies: - Not included in the update-crypto-policies --set command will not be applied to the system wide crypto policy. - must exist before they can be applied to the system wide crypto policy. - pmod file filenames must be in all upper case, upper case, e.g. NO-WEAKMAC.pmod or they will not be read by the update-crypto-policies --set command. Create or edit a file in /etc/crypto-policies/policies/modules/ ending inpmod and add or modify one of the following lines: mac = -*-128* # Disables weak macs Example: # printf '%s\n' \"# This is a subpolicy to disable weak macs\" \"mac = -*-128\" >> /etc/crypto-policies/policies/modules/NO-WEAKMAC.pmod Run the following command to update the system-wide cryptographic policy # update-crypto-policies --set ::: Example: update-crypto-policies --set DEFAULT:NO-SHA1:NO-WEAKMAC Run the following command to reboot the system to make your cryptographic settings effective for already running services and applications: # reboot" reference : "800-171|3.1.13,800-171|3.5.2,800-171|3.13.8,800-171r3|03.05.07,800-171r3|03.05.12,800-171r3|03.13.08,800-53|AC-17(2),800-53|IA-5,800-53|IA-5(1),800-53|SC-8,800-53|SC-8(1),800-53r5|AC-17(2),800-53r5|IA-5,800-53r5|IA-5(1),800-53r5|SC-8,800-53r5|SC-8(1),CN-L3|7.1.2.7(g),CN-L3|7.1.3.1(d),CN-L3|8.1.2.2(a),CN-L3|8.1.2.2(b),CN-L3|8.1.4.1(c),CN-L3|8.1.4.7(a),CN-L3|8.1.4.8(a),CN-L3|8.2.4.5(c),CN-L3|8.2.4.5(d),CN-L3|8.5.2.2,CSCv7|14.4,CSCv8|3.10,CSF|PR.AC-1,CSF|PR.AC-3,CSF|PR.DS-2,CSF|PR.DS-5,CSF|PR.PT-4,CSF2.0|PR.AA-01,CSF2.0|PR.AA-03,CSF2.0|PR.AA-05,CSF2.0|PR.DS-02,GDPR|32.1.a,GDPR|32.1.b,HIPAA|164.306(a)(1),HIPAA|164.312(a)(1),HIPAA|164.312(a)(2)(i),HIPAA|164.312(d),HIPAA|164.312(e)(1),HIPAA|164.312(e)(2)(i),ISO-27001-2022|A.5.10,ISO-27001-2022|A.5.14,ISO-27001-2022|A.5.16,ISO-27001-2022|A.5.17,ISO-27001-2022|A.5.33,ISO-27001-2022|A.6.7,ISO-27001-2022|A.8.20,ISO/IEC-27001|A.6.2.2,ISO/IEC-27001|A.10.1.1,ISO/IEC-27001|A.13.2.3,ITSG-33|AC-17(2),ITSG-33|IA-5,ITSG-33|IA-5(1),ITSG-33|SC-8,ITSG-33|SC-8a.,ITSG-33|SC-8(1),LEVEL|1A,NESA|T4.3.1,NESA|T4.3.2,NESA|T4.5.1,NESA|T4.5.2,NESA|T5.2.3,NESA|T5.4.2,NESA|T7.3.3,NESA|T7.4.1,NIAv2|AM37,NIAv2|IE8,NIAv2|IE9,NIAv2|IE12,NIAv2|NS5d,NIAv2|NS6b,NIAv2|NS29,NIAv2|SS24,PCI-DSSv3.2.1|2.3,PCI-DSSv3.2.1|4.1,PCI-DSSv4.0|2.2.7,PCI-DSSv4.0|4.2.1,QCSC-v1|3.2,QCSC-v1|5.2.1,QCSC-v1|5.2.2,QCSC-v1|6.2,QCSC-v1|13.2,SWIFT-CSCv1|2.1,SWIFT-CSCv1|2.6,SWIFT-CSCv1|4.1,TBA-FIISB|29.1" see_also : "https://workbench.cisecurity.org/benchmarks/20333" file : "/etc/crypto-policies/state/CURRENT.pol" regex : "(?i)^\\h*mac\\h*=" expect : "(?i)^\\h*mac\\h*=\\h*([^#\\n\\r]+)?-128\\b" file_required : NO type : CMD_EXEC description : "1.6.6 Ensure system wide crypto policy disables cbc for ssh" info : "Cypher Block Chaining (CBC) is an algorithm that uses a block cipher. A vulnerability exists in SSH messages that employ CBC mode that may allow an attacker to recover plaintext from a block of ciphertext. If exploited, this attack can potentially allow an attacker to recover up to 32 bits of plaintext from an arbitrary block of ciphertext from a connection secured using the SSH protocol." solution : "Note: - The commands below are written for the included DEFAULT system-wide crypto policy. If another policy is in use and follows local site policy, replace DEFAULT with the name of your system-wide crypto policy. - CBC can be turned off globally by using the argument cipher opposed to cipher@SSH - Multiple subpolicies may be assigned to a policy as a colon separated list. e.g. DEFAULT:NO-SHA1:NO-SSHCBC - Subpolicies: - Not included in the update-crypto-policies --set command will not be applied to the system wide crypto policy. - must exist before they can be applied to the system wide crypto policy. - pmod file filenames must be in all upper case, upper case, e.g. NO-SSHCBC.pmod or they will not be read by the update-crypto-policies --set command.Create or edit a file in /etc/crypto-policies/policies/modules/ ending inpmod and add or modify one of the the following lines: cipher@SSH = -*-CBC # Disables the CBC cipher for SSH Example: # printf '%s\n' \"# This is a subpolicy to disable all CBC mode ciphers\" \"# for the SSH protocol (libssh and OpenSSH)\" \"cipher@SSH = -*-CBC\" >> /etc/crypto-policies/policies/modules/NO-SSHCBC.pmod Run the following command to update the system-wide cryptographic policy # update-crypto-policies --set ::: Example: update-crypto-policies --set DEFAULT:NO-SHA1:NO-WEAKMAC:NO-SSHCBC Run the following command to reboot the system to make your cryptographic settings effective for already running services and applications: # reboot Impact: CBC ciphers might be the only common cyphers when connecting to older SSH clients and servers" reference : "800-171|3.1.13,800-171|3.5.2,800-171|3.13.8,800-171r3|03.05.07,800-171r3|03.05.12,800-171r3|03.13.08,800-53|AC-17(2),800-53|IA-5,800-53|IA-5(1),800-53|SC-8,800-53|SC-8(1),800-53r5|AC-17(2),800-53r5|IA-5,800-53r5|IA-5(1),800-53r5|SC-8,800-53r5|SC-8(1),CN-L3|7.1.2.7(g),CN-L3|7.1.3.1(d),CN-L3|8.1.2.2(a),CN-L3|8.1.2.2(b),CN-L3|8.1.4.1(c),CN-L3|8.1.4.7(a),CN-L3|8.1.4.8(a),CN-L3|8.2.4.5(c),CN-L3|8.2.4.5(d),CN-L3|8.5.2.2,CSCv7|14.4,CSCv8|3.10,CSF|PR.AC-1,CSF|PR.AC-3,CSF|PR.DS-2,CSF|PR.DS-5,CSF|PR.PT-4,CSF2.0|PR.AA-01,CSF2.0|PR.AA-03,CSF2.0|PR.AA-05,CSF2.0|PR.DS-02,GDPR|32.1.a,GDPR|32.1.b,HIPAA|164.306(a)(1),HIPAA|164.312(a)(1),HIPAA|164.312(a)(2)(i),HIPAA|164.312(d),HIPAA|164.312(e)(1),HIPAA|164.312(e)(2)(i),ISO-27001-2022|A.5.10,ISO-27001-2022|A.5.14,ISO-27001-2022|A.5.16,ISO-27001-2022|A.5.17,ISO-27001-2022|A.5.33,ISO-27001-2022|A.6.7,ISO-27001-2022|A.8.20,ISO/IEC-27001|A.6.2.2,ISO/IEC-27001|A.10.1.1,ISO/IEC-27001|A.13.2.3,ITSG-33|AC-17(2),ITSG-33|IA-5,ITSG-33|IA-5(1),ITSG-33|SC-8,ITSG-33|SC-8a.,ITSG-33|SC-8(1),LEVEL|1A,NESA|T4.3.1,NESA|T4.3.2,NESA|T4.5.1,NESA|T4.5.2,NESA|T5.2.3,NESA|T5.4.2,NESA|T7.3.3,NESA|T7.4.1,NIAv2|AM37,NIAv2|IE8,NIAv2|IE9,NIAv2|IE12,NIAv2|NS5d,NIAv2|NS6b,NIAv2|NS29,NIAv2|SS24,PCI-DSSv3.2.1|2.3,PCI-DSSv3.2.1|4.1,PCI-DSSv4.0|2.2.7,PCI-DSSv4.0|4.2.1,QCSC-v1|3.2,QCSC-v1|5.2.1,QCSC-v1|5.2.2,QCSC-v1|6.2,QCSC-v1|13.2,SWIFT-CSCv1|2.1,SWIFT-CSCv1|2.6,SWIFT-CSCv1|4.1,TBA-FIISB|29.1" see_also : "https://workbench.cisecurity.org/benchmarks/20333" cmd : "#!/bin/bash { l_output=\"\" l_output2=\"\" if grep -Piq -- '^\\h*cipher\\h*=\\h*([^#\\n\\r]+)?-CBC\\b' /etc/crypto-policies/state/CURRENT.pol; then if grep -Piq -- '^\\h*cipher@(lib|open)ssh(-server|-client)?\\h*=\\h*' /etc/crypto-policies/state/CURRENT.pol; then if ! grep -Piq -- '^\\h*cipher@(lib|open)ssh(-server|-client)?\\h*=\\h*([^#\\n\\r]+)?-CBC\\b' /etc/crypto-policies/state/CURRENT.pol; then l_output=\"$l_output\\n - Cipher Block Chaining (CBC) is disabled for SSH\" else l_output2=\"$l_output2\\n - Cipher Block Chaining (CBC) is enabled for SSH\" fi else l_output2=\"$l_output2\\n - Cipher Block Chaining (CBC) is enabled for SSH\" fi else l_output=\" - Cipher Block Chaining (CBC) is disabled\" fi if [ -z \"$l_output2\" ]; then # Provide output from checks echo -e \"\\n- Audit Result:\\n ** PASS **\\n$l_output\\n\" else echo -e \"\\n- Audit Result:\\n ** FAIL **\\n - Reason(s) for audit failure:\\n$l_output2\\n\" [ -n \"$l_output\" ] && echo -e \"\\n- Correctly set:\\n$l_output\\n\" fi }" expect : "(?i)^[\\s]*\\**[\\s]*pass:?[\\s]*\\**$" type : CMD_EXEC description : "1.6.7 Ensure system wide crypto policy disables chacha20-poly1305 for ssh" info : "ChaCha20-Poly1305 is an authenticated encryption with additional data (AEAD) algorithm, that combines the ChaCha20 stream cipher with the Poly1305 message authentication code. Its usage in IETF protocols is standardized in RFC 8439. A vulnerability exists in ChaCha20-Poly1305 as referenced in CVE-2023-48795" solution : "Note: - The commands below are written for the included DEFAULT system-wide crypto policy. If another policy is in use and follows local site policy, replace DEFAULT with the name of your system-wide crypto policy. - chacha20-poly1305 can be turned off globally by using the argument cipher opposed to cipher@SSH - Multiple subpolicies may be assigned to a policy as a colon separated list. e.g. DEFAULT:NO-SHA1:NO-SSHCBC - Subpolicies: - Not included in the update-crypto-policies --set command will not be applied to the system wide crypto policy. - must exist before they can be applied to the system wide crypto policy. - pmod file filenames must be in all upper case, upper case, e.g. NO-SSHCHACHA20.pmod or they will not be read by the update-crypto-policies --set command. - IF - CVE-2023-48795 has been addressed, and it meets local site policy, this recommendation may be skipped. Create or edit a file in /etc/crypto-policies/policies/modules/ ending inpmod and add or modify one of the the following lines: cipher@SSH = -CHACHA20-POLY1305 # Disables the chacha20-poly1305 cipher for SSH Example: # printf '%s\n' \"# This is a subpolicy to disable the chacha20-poly1305 ciphers\" \"# for the SSH protocol (libssh and OpenSSH)\" \"cipher@SSH = -CHACHA20-POLY1305\" >> /etc/crypto-policies/policies/modules/NO-SSHCHACHA20.pmod Run the following command to update the system-wide cryptographic policy # update-crypto-policies --set ::: Example: # update-crypto-policies --set DEFAULT:NO-SHA1:NO-WEAKMAC:NO-SSHCBC:NO-SSHCHACHA20 Run the following command to reboot the system to make your cryptographic settings effective for already running services and applications: # reboot" reference : "800-171|3.1.13,800-171|3.5.2,800-171|3.13.8,800-171r3|03.05.07,800-171r3|03.05.12,800-171r3|03.13.08,800-53|AC-17(2),800-53|IA-5,800-53|IA-5(1),800-53|SC-8,800-53|SC-8(1),800-53r5|AC-17(2),800-53r5|IA-5,800-53r5|IA-5(1),800-53r5|SC-8,800-53r5|SC-8(1),CN-L3|7.1.2.7(g),CN-L3|7.1.3.1(d),CN-L3|8.1.2.2(a),CN-L3|8.1.2.2(b),CN-L3|8.1.4.1(c),CN-L3|8.1.4.7(a),CN-L3|8.1.4.8(a),CN-L3|8.2.4.5(c),CN-L3|8.2.4.5(d),CN-L3|8.5.2.2,CSCv7|14.4,CSCv8|3.10,CSF|PR.AC-1,CSF|PR.AC-3,CSF|PR.DS-2,CSF|PR.DS-5,CSF|PR.PT-4,CSF2.0|PR.AA-01,CSF2.0|PR.AA-03,CSF2.0|PR.AA-05,CSF2.0|PR.DS-02,GDPR|32.1.a,GDPR|32.1.b,HIPAA|164.306(a)(1),HIPAA|164.312(a)(1),HIPAA|164.312(a)(2)(i),HIPAA|164.312(d),HIPAA|164.312(e)(1),HIPAA|164.312(e)(2)(i),ISO-27001-2022|A.5.10,ISO-27001-2022|A.5.14,ISO-27001-2022|A.5.16,ISO-27001-2022|A.5.17,ISO-27001-2022|A.5.33,ISO-27001-2022|A.6.7,ISO-27001-2022|A.8.20,ISO/IEC-27001|A.6.2.2,ISO/IEC-27001|A.10.1.1,ISO/IEC-27001|A.13.2.3,ITSG-33|AC-17(2),ITSG-33|IA-5,ITSG-33|IA-5(1),ITSG-33|SC-8,ITSG-33|SC-8a.,ITSG-33|SC-8(1),LEVEL|1A,NESA|T4.3.1,NESA|T4.3.2,NESA|T4.5.1,NESA|T4.5.2,NESA|T5.2.3,NESA|T5.4.2,NESA|T7.3.3,NESA|T7.4.1,NIAv2|AM37,NIAv2|IE8,NIAv2|IE9,NIAv2|IE12,NIAv2|NS5d,NIAv2|NS6b,NIAv2|NS29,NIAv2|SS24,PCI-DSSv3.2.1|2.3,PCI-DSSv3.2.1|4.1,PCI-DSSv4.0|2.2.7,PCI-DSSv4.0|4.2.1,QCSC-v1|3.2,QCSC-v1|5.2.1,QCSC-v1|5.2.2,QCSC-v1|6.2,QCSC-v1|13.2,SWIFT-CSCv1|2.1,SWIFT-CSCv1|2.6,SWIFT-CSCv1|4.1,TBA-FIISB|29.1" see_also : "https://workbench.cisecurity.org/benchmarks/20333" cmd : "#!/bin/bash { l_output=\"\" l_output2=\"\" if grep -Piq -- '^\\h*cipher\\h*=\\h*([^#\\n\\r]+)?\\bchacha20-poly1305\\b' /etc/crypto-policies/state/CURRENT.pol; then if grep -Piq -- '^\\h*cipher@(lib|open)ssh(-server|-client)?\\h*=\\h*' /etc/crypto-policies/state/CURRENT.pol; then if ! grep -Piq -- '^\\h*cipher@(lib|open)ssh(-server|-client)?\\h*=\\h*([^#\\n\\r]+)?\\bchacha20-poly1305\\b' /etc/crypto-policies/state/CURRENT.pol; then l_output=\"$l_output\\n - chacha20-poly1305 is disabled for SSH\" else l_output2=\"$l_output2\\n - chacha20-poly1305 is enabled for SSH\" fi else l_output2=\"$l_output2\\n - chacha20-poly1305 is enabled for SSH\" fi else l_output=\" - chacha20-poly1305 is disabled\" fi if [ -z \"$l_output2\" ]; then # Provide output from checks echo -e \"\\n- Audit Result:\\n ** PASS **\\n$l_output\\n\" else echo -e \"\\n- Audit Result:\\n ** FAIL **\\n - Reason(s) for audit failure:\\n$l_output2\\n\" [ -n \"$l_output\" ] && echo -e \"\\n- Correctly set:\\n$l_output\\n\" fi }" expect : "(?i)^[\\s]*\\**[\\s]*pass:?[\\s]*\\**$" type : CMD_EXEC description : "1.7.1 Ensure /etc/motd is 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. 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 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 file found in /etc/motd.d/* 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 Run the following script and review and/or update all returned files' contents to: - Remove all system information ( \v \r ; \m \s ) - Remove any refence to the operating system - Ensure contents follow local site policy #!/usr/bin/env bash { a_files=() for l_file in /etc/motd{,.d/*}; do if grep -Psqi -- \"(\\\v|\\\r|\\\m|\\\s|\b$(grep ^ID= /etc/os-release | cut -d= -f2 | sed -e 's/\"//g')\b)\" \"$l_file\"; then echo -e \"\n - File: \\\"$l_file\\\" includes system information. Edit this file to remove these entries\" else a_files+=(\"$l_file\") fi done if [ \"${#a_files[@]}\" -gt 0 ]; then echo -e \"\n- ** Please review the following files and verify their contents follow local site policy **\n\" printf '%s\n' \"${a_files[@]}\" fi }" reference : "800-171|3.1.9,800-171r3|03.01.09,800-53|AC-8a.,800-53r5|AC-8a.,GDPR|32.1.b,HIPAA|164.306(a)(1),ISO-27001-2022|A.8.5,ITSG-33|AC-8a.,LEVEL|1A,NESA|M5.2.5,NESA|T5.5.1,NIAv2|AM10a,NIAv2|AM10b,NIAv2|AM10c,NIAv2|AM10d,NIAv2|AM10e,TBA-FIISB|45.2.4" see_also : "https://workbench.cisecurity.org/benchmarks/20333" cmd : "#!/bin/bash { l_output=\"\" l_output2=\"\" a_files=() for l_file in /etc/motd{,.d/*}; do if grep -Psqi -- \"(\\\\\\v|\\\\\\r|\\\\\\m|\\\\\\s|\\b$(grep ^ID= /etc/os-release | cut -d= -f2 | sed -e 's/\"//g')\\b)\" \"$l_file\"; then l_output2=\"$l_output2\\n - File: \\\"$l_file\\\" includes system information\" else a_files+=(\"$l_file\") fi done if [ \"${#a_files[@]}\" -gt 0 ]; then echo -e \"\\n- ** Please review the following files and verify their contents follow local site policy **\\n\" printf '%s\\n' \"${a_files[@]}\" elif [ -z \"$l_output2\" ]; then echo -e \"- ** No MOTD files with any size were found. Please verify this conforms to local site policy ** -\" fi if [ -z \"$l_output2\" ]; then l_output=\" - No MOTD files include system information\" echo -e \"\\n- Audit Result:\\n ** PASS **\\n$l_output\\n\" else echo -e \"\\n- Audit Result:\\n ** FAIL **\\n - Reason(s) for audit failure:\\n$l_output2\\n\" fi }" expect : "(?i)^[\\s]*\\**[\\s]*pass:?[\\s]*\\**$" type : FILE_CHECK description : "/etc/issue exist" file : "/etc/issue" type : BANNER_CHECK description : "Banner content" file : "/etc/issue" content : "@BANNER_TEXT@" type : FILE_CONTENT_CHECK_NOT description : "mrsv not included in /etc/issue" file : "/etc/issue" regex : "\\\\[mrsv]" expect : "\\\\[mrsv]" description : "1.7.2 Ensure local login warning banner is configured properly" 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 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 Example: # echo \"Authorized users only. All activity may be monitored and reported.\" > /etc/issue" reference : "800-171|3.1.9,800-171r3|03.01.09,800-53|AC-8,800-53r5|AC-8,GDPR|32.1.b,HIPAA|164.306(a)(1),ISO-27001-2022|A.8.5,ITSG-33|AC-8,LEVEL|1A,NESA|M1.3.6,TBA-FIISB|45.2.4" see_also : "https://workbench.cisecurity.org/benchmarks/20333" show_output : YES description : "1.7.2 Ensure local login warning banner is configured properly" 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 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 Example: # echo \"Authorized users only. All activity may be monitored and reported.\" > /etc/issue" reference : "800-171|3.1.9,800-171r3|03.01.09,800-53|AC-8,800-53r5|AC-8,GDPR|32.1.b,HIPAA|164.306(a)(1),ISO-27001-2022|A.8.5,ITSG-33|AC-8,LEVEL|1A,NESA|M1.3.6,TBA-FIISB|45.2.4" see_also : "https://workbench.cisecurity.org/benchmarks/20333" type : FILE_CHECK description : "/etc/issue.net exist" file : "/etc/issue.net" type : FILE_CONTENT_CHECK_NOT description : "mrsv not included in /etc/issue.net" file : "/etc/issue.net" regex : "\\\\[mrsv]" expect : "\\\\[mrsv]" type : BANNER_CHECK description : "banner text" file : "/etc/issue.net" content : "@BANNER_TEXT@" description : "1.7.3 Ensure remote login warning banner is configured properly" 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 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 Example: # echo \"Authorized users only. All activity may be monitored and reported.\" > /etc/issue.net" reference : "800-171|3.1.9,800-171r3|03.01.09,800-53|AC-8,800-53r5|AC-8,GDPR|32.1.b,HIPAA|164.306(a)(1),ISO-27001-2022|A.8.5,ITSG-33|AC-8,LEVEL|1A,NESA|M1.3.6,TBA-FIISB|45.2.4" see_also : "https://workbench.cisecurity.org/benchmarks/20333" show_output : YES description : "1.7.3 Ensure remote login warning banner is configured properly" 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 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 Example: # echo \"Authorized users only. All activity may be monitored and reported.\" > /etc/issue.net" reference : "800-171|3.1.9,800-171r3|03.01.09,800-53|AC-8,800-53r5|AC-8,GDPR|32.1.b,HIPAA|164.306(a)(1),ISO-27001-2022|A.8.5,ITSG-33|AC-8,LEVEL|1A,NESA|M1.3.6,TBA-FIISB|45.2.4" see_also : "https://workbench.cisecurity.org/benchmarks/20333" type : FILE_CHECK description : "1.7.4 Ensure access to /etc/motd is 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. - IF - the /etc/motd file does not have the correct access configured, it could be modified by unauthorized users with incorrect or misleading information." solution : "Run the following commands to set mode, owner, and group on /etc/motd : # chown root:root $(readlink -e /etc/motd) # chmod u-x,go-wx $(readlink -e /etc/motd) - OR - Run the following command to remove the /etc/motd file: # rm /etc/motd" reference : "800-171|3.1.1,800-171|3.1.4,800-171|3.1.5,800-171|3.8.1,800-171|3.8.2,800-171|3.8.3,800-171r3|03.01.02,800-171r3|03.01.04,800-171r3|03.01.05a.,800-171r3|03.08.02,800-53|AC-3,800-53|AC-5,800-53|AC-6,800-53|MP-2,800-53r5|AC-3,800-53r5|AC-5,800-53r5|AC-6,800-53r5|MP-2,CN-L3|7.1.3.2(b),CN-L3|7.1.3.2(g),CN-L3|8.1.4.2(d),CN-L3|8.1.4.2(f),CN-L3|8.1.4.11(b),CN-L3|8.1.10.2(c),CN-L3|8.1.10.6(a),CN-L3|8.5.3.1,CN-L3|8.5.4.1(a),CSCv7|14.6,CSCv8|3.3,CSF|PR.AC-4,CSF|PR.DS-5,CSF|PR.PT-2,CSF|PR.PT-3,CSF2.0|PR.AA-05,CSF2.0|PR.DS-10,CSF2.0|PR.IR-01,GDPR|32.1.b,HIPAA|164.306(a)(1),HIPAA|164.312(a)(1),ISO-27001-2022|A.5.3,ISO-27001-2022|A.5.10,ISO-27001-2022|A.5.15,ISO-27001-2022|A.5.33,ISO-27001-2022|A.7.7,ISO-27001-2022|A.7.10,ISO-27001-2022|A.8.2,ISO-27001-2022|A.8.3,ISO-27001-2022|A.8.18,ISO-27001-2022|A.8.20,ISO/IEC-27001|A.6.1.2,ISO/IEC-27001|A.9.4.1,ISO/IEC-27001|A.9.4.5,ITSG-33|AC-3,ITSG-33|AC-5,ITSG-33|AC-6,ITSG-33|MP-2,ITSG-33|MP-2a.,LEVEL|1A,NESA|T1.3.2,NESA|T1.3.3,NESA|T1.4.1,NESA|T4.2.1,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.2,NESA|T7.5.3,NIAv2|AM1,NIAv2|AM3,NIAv2|AM23f,NIAv2|SS13c,NIAv2|SS15c,NIAv2|SS29,PCI-DSSv3.2.1|7.1.2,PCI-DSSv4.0|7.2.1,PCI-DSSv4.0|7.2.2,QCSC-v1|3.2,QCSC-v1|5.2.2,QCSC-v1|6.2,QCSC-v1|13.2,SWIFT-CSCv1|5.1,TBA-FIISB|31.1,TBA-FIISB|31.4.2,TBA-FIISB|31.4.3" see_also : "https://workbench.cisecurity.org/benchmarks/20333" file : "/etc/motd" owner : "root" mask : "133" required : NO group : "root" type : FILE_CHECK description : "1.7.5 Ensure access to /etc/issue is configured" info : "The contents of the /etc/issue file are displayed to users prior to login for local terminals. - IF - the /etc/issue file does not have the correct access configured, it could be modified by unauthorized users with incorrect or misleading information." solution : "Run the following commands to set mode, owner, and group on /etc/issue : # chown root:root $(readlink -e /etc/issue) # chmod u-x,go-wx $(readlink -e /etc/issue)" reference : "800-171|3.1.1,800-171|3.1.4,800-171|3.1.5,800-171|3.8.1,800-171|3.8.2,800-171|3.8.3,800-171r3|03.01.02,800-171r3|03.01.04,800-171r3|03.01.05a.,800-171r3|03.08.02,800-53|AC-3,800-53|AC-5,800-53|AC-6,800-53|MP-2,800-53r5|AC-3,800-53r5|AC-5,800-53r5|AC-6,800-53r5|MP-2,CN-L3|7.1.3.2(b),CN-L3|7.1.3.2(g),CN-L3|8.1.4.2(d),CN-L3|8.1.4.2(f),CN-L3|8.1.4.11(b),CN-L3|8.1.10.2(c),CN-L3|8.1.10.6(a),CN-L3|8.5.3.1,CN-L3|8.5.4.1(a),CSCv7|14.6,CSCv8|3.3,CSF|PR.AC-4,CSF|PR.DS-5,CSF|PR.PT-2,CSF|PR.PT-3,CSF2.0|PR.AA-05,CSF2.0|PR.DS-10,CSF2.0|PR.IR-01,GDPR|32.1.b,HIPAA|164.306(a)(1),HIPAA|164.312(a)(1),ISO-27001-2022|A.5.3,ISO-27001-2022|A.5.10,ISO-27001-2022|A.5.15,ISO-27001-2022|A.5.33,ISO-27001-2022|A.7.7,ISO-27001-2022|A.7.10,ISO-27001-2022|A.8.2,ISO-27001-2022|A.8.3,ISO-27001-2022|A.8.18,ISO-27001-2022|A.8.20,ISO/IEC-27001|A.6.1.2,ISO/IEC-27001|A.9.4.1,ISO/IEC-27001|A.9.4.5,ITSG-33|AC-3,ITSG-33|AC-5,ITSG-33|AC-6,ITSG-33|MP-2,ITSG-33|MP-2a.,LEVEL|1A,NESA|T1.3.2,NESA|T1.3.3,NESA|T1.4.1,NESA|T4.2.1,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.2,NESA|T7.5.3,NIAv2|AM1,NIAv2|AM3,NIAv2|AM23f,NIAv2|SS13c,NIAv2|SS15c,NIAv2|SS29,PCI-DSSv3.2.1|7.1.2,PCI-DSSv4.0|7.2.1,PCI-DSSv4.0|7.2.2,QCSC-v1|3.2,QCSC-v1|5.2.2,QCSC-v1|6.2,QCSC-v1|13.2,SWIFT-CSCv1|5.1,TBA-FIISB|31.1,TBA-FIISB|31.4.2,TBA-FIISB|31.4.3" see_also : "https://workbench.cisecurity.org/benchmarks/20333" file : "/etc/issue" owner : "root" mask : "133" group : "root" type : FILE_CHECK description : "1.7.6 Ensure access to /etc/issue.net is configured" info : "The contents of the /etc/issue.net file are displayed to users prior to login for remote connections from configured services. - IF - the /etc/issue.net file does not have the correct access configured, it could be modified by unauthorized users with incorrect or misleading information." solution : "Run the following commands to set mode, owner, and group on /etc/issue.net : # chown root:root $(readlink -e /etc/issue.net) # chmod u-x,go-wx $(readlink -e /etc/issue.net)" reference : "800-171|3.1.1,800-171|3.1.4,800-171|3.1.5,800-171|3.8.1,800-171|3.8.2,800-171|3.8.3,800-171r3|03.01.02,800-171r3|03.01.04,800-171r3|03.01.05a.,800-171r3|03.08.02,800-53|AC-3,800-53|AC-5,800-53|AC-6,800-53|MP-2,800-53r5|AC-3,800-53r5|AC-5,800-53r5|AC-6,800-53r5|MP-2,CN-L3|7.1.3.2(b),CN-L3|7.1.3.2(g),CN-L3|8.1.4.2(d),CN-L3|8.1.4.2(f),CN-L3|8.1.4.11(b),CN-L3|8.1.10.2(c),CN-L3|8.1.10.6(a),CN-L3|8.5.3.1,CN-L3|8.5.4.1(a),CSCv7|14.6,CSCv8|3.3,CSF|PR.AC-4,CSF|PR.DS-5,CSF|PR.PT-2,CSF|PR.PT-3,CSF2.0|PR.AA-05,CSF2.0|PR.DS-10,CSF2.0|PR.IR-01,GDPR|32.1.b,HIPAA|164.306(a)(1),HIPAA|164.312(a)(1),ISO-27001-2022|A.5.3,ISO-27001-2022|A.5.10,ISO-27001-2022|A.5.15,ISO-27001-2022|A.5.33,ISO-27001-2022|A.7.7,ISO-27001-2022|A.7.10,ISO-27001-2022|A.8.2,ISO-27001-2022|A.8.3,ISO-27001-2022|A.8.18,ISO-27001-2022|A.8.20,ISO/IEC-27001|A.6.1.2,ISO/IEC-27001|A.9.4.1,ISO/IEC-27001|A.9.4.5,ITSG-33|AC-3,ITSG-33|AC-5,ITSG-33|AC-6,ITSG-33|MP-2,ITSG-33|MP-2a.,LEVEL|1A,NESA|T1.3.2,NESA|T1.3.3,NESA|T1.4.1,NESA|T4.2.1,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.2,NESA|T7.5.3,NIAv2|AM1,NIAv2|AM3,NIAv2|AM23f,NIAv2|SS13c,NIAv2|SS15c,NIAv2|SS29,PCI-DSSv3.2.1|7.1.2,PCI-DSSv4.0|7.2.1,PCI-DSSv4.0|7.2.2,QCSC-v1|3.2,QCSC-v1|5.2.2,QCSC-v1|6.2,QCSC-v1|13.2,SWIFT-CSCv1|5.1,TBA-FIISB|31.1,TBA-FIISB|31.4.2,TBA-FIISB|31.4.3" see_also : "https://workbench.cisecurity.org/benchmarks/20333" file : "/etc/issue.net" owner : "root" mask : "133" group : "root" type : RPM_CHECK description : "Check GDM installed" rpm : "gdm-0.0.0-0" operator : "gt" required : YES type : FILE_CONTENT_CHECK_NOT description : "1.8.10 Ensure XDMCP is not enabled" info : "X Display Manager Control Protocol (XDMCP) is designed to provide authenticated access to display management services for remote displays XDMCP is inherently insecure. - XDMCP is not a ciphered protocol. This may allow an attacker to capture keystrokes entered by a user - XDMCP is vulnerable to man-in-the-middle attacks. This may allow an attacker to steal the credentials of legitimate users by impersonating the XDMCP server." solution : "Edit the file /etc/gdm/custom.conf and remove the line: Enable=true" reference : "800-171|3.4.2,800-171|3.4.6,800-171|3.4.7,800-171r3|03.04.02,800-171r3|03.04.06,800-53|CM-6,800-53|CM-7,800-53r5|CM-6,800-53r5|CM-7,CSCv7|9.2,CSCv8|4.8,CSF|PR.IP-1,CSF|PR.PT-3,CSF2.0|DE.CM-09,CSF2.0|PR.PS-01,GDPR|32.1.b,HIPAA|164.306(a)(1),ISO-27001-2022|A.8.9,ITSG-33|CM-6,ITSG-33|CM-7,LEVEL|1A,NIAv2|SS15a,PCI-DSSv3.2.1|2.2.2,SWIFT-CSCv1|2.3" see_also : "https://workbench.cisecurity.org/benchmarks/20333" file : "/etc/gdm/custom.conf" regex : "^[\\s]*[Ee]nable[\\s]*=" expect : "^[\\s]*[Ee]nable[\\s]*=[\\s]*true[\\s]*$" description : "1.8.10 Ensure XDMCP is not enabled" info : "X Display Manager Control Protocol (XDMCP) is designed to provide authenticated access to display management services for remote displays XDMCP is inherently insecure. - XDMCP is not a ciphered protocol. This may allow an attacker to capture keystrokes entered by a user - XDMCP is vulnerable to man-in-the-middle attacks. This may allow an attacker to steal the credentials of legitimate users by impersonating the XDMCP server." solution : "Edit the file /etc/gdm/custom.conf and remove the line: Enable=true" reference : "800-171|3.4.2,800-171|3.4.6,800-171|3.4.7,800-171r3|03.04.02,800-171r3|03.04.06,800-53|CM-6,800-53|CM-7,800-53r5|CM-6,800-53r5|CM-7,CSCv7|9.2,CSCv8|4.8,CSF|PR.IP-1,CSF|PR.PT-3,CSF2.0|DE.CM-09,CSF2.0|PR.PS-01,GDPR|32.1.b,HIPAA|164.306(a)(1),ISO-27001-2022|A.8.9,ITSG-33|CM-6,ITSG-33|CM-7,LEVEL|1A,NIAv2|SS15a,PCI-DSSv3.2.1|2.2.2,SWIFT-CSCv1|2.3" see_also : "https://workbench.cisecurity.org/benchmarks/20333" type : CMD_EXEC description : "1.8.2 Ensure GDM login banner is configured" info : "GDM is the GNOME Display Manager which handles graphical login for GNOME based systems. 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 : "Run the following script to verify that the banner message is enabled and set: #!/usr/bin/env bash { l_pkgoutput=\"\" if command -v dpkg-query > /dev/null 2>&1; then l_pq=\"dpkg-query -W\" elif command -v rpm > /dev/null 2>&1; then l_pq=\"rpm -q\" fi l_pcl=\"gdm gdm3\" # Space separated list of packages to check for l_pn in $l_pcl; do $l_pq \"$l_pn\" > /dev/null 2>&1 && l_pkgoutput=\"$l_pkgoutput\n - Package: \\\"$l_pn\\\" exists on the system\n - checking configuration\" done if [ -n \"$l_pkgoutput\" ]; then l_gdmprofile=\"gdm\" # Set this to desired profile name IaW Local site policy l_bmessage=\"'Authorized uses only. All activity may be monitored and reported'\" # Set to desired banner message if [ ! -f \"/etc/dconf/profile/$l_gdmprofile\" ]; then echo \"Creating profile \\\"$l_gdmprofile\\\"\" echo -e \"user-db:user\nsystem-db:$l_gdmprofile\nfile-db:/usr/share/$l_gdmprofile/greeter-dconf-defaults\" > /etc/dconf/profile/$l_gdmprofile fi if [ ! -d \"/etc/dconf/db/$l_gdmprofile.d/\" ]; then echo \"Creating dconf database directory \\\"/etc/dconf/db/$l_gdmprofile.d/\\\"\" mkdir /etc/dconf/db/$l_gdmprofile.d/ fi if ! grep -Piq '^\h*banner-message-enable\h*=\h*true\b' /etc/dconf/db/$l_gdmprofile.d/*; then echo \"creating gdm keyfile for machine-wide settings\" if ! grep -Piq -- '^\h*banner-message-enable\h*=\h*' /etc/dconf/db/$l_gdmprofile.d/*; then l_kfile=\"/etc/dconf/db/$l_gdmprofile.d/01-banner-message\" echo -e \"\n[org/gnome/login-screen]\nbanner-message-enable=true\" >> \"$l_kfile\" else l_kfile=\"$(grep -Pil -- '^\h*banner-message-enable\h*=\h*' /etc/dconf/db/$l_gdmprofile.d/*)\" ! grep -Pq '^\h*\[org\/gnome\/login-screen\]' \"$l_kfile\" && sed -ri '/^\s*banner-message-enable/ i\[org/gnome/login-screen]' \"$l_kfile\" ! grep -Pq '^\h*banner-message-enable\h*=\h*true\b' \"$l_kfile\" && sed -ri 's/^\s*(banner-message-enable\s*=\s*)(\S+)(\s*.*$)/\1true \3//' \"$l_kfile\" # sed -ri '/^\s*\[org\/gnome\/login-screen\]/ a\\nbanner-message-enable=true' \"$l_kfile\" fi fi if ! grep -Piq \"^\h*banner-message-text=[\'\\\"]+\S+\" \"$l_kfile\"; then sed -ri \"/^\s*banner-message-enable/ a\banner-message-text=$l_bmessage\" \"$l_kfile\" fi dconf update else echo -e \"\n\n - GNOME Desktop Manager isn't installed\n - Recommendation is Not Applicable\n - No remediation required\n\" fi } Note: - There is no character limit for the banner message. gnome-shell autodetects longer stretches of text and enters two column mode. - The banner message cannot be read from an external file. - OR - Run the following command to remove the gdm package: # zypper remove gdm" reference : "800-171|3.1.9,800-171r3|03.01.09,800-53|AC-8,800-53r5|AC-8,GDPR|32.1.b,HIPAA|164.306(a)(1),ISO-27001-2022|A.8.5,ITSG-33|AC-8,LEVEL|1A,NESA|M1.3.6,TBA-FIISB|45.2.4" see_also : "https://workbench.cisecurity.org/benchmarks/20333" cmd : "l_pkgoutput=\"\" if command -v dpkg-query > /dev/null 2>&1; then l_pq=\"dpkg-query -W\" elif command -v rpm > /dev/null 2>&1; then l_pq=\"rpm -q\" fi l_pcl=\"gdm gdm3\" # Space seporated list of packages to check for l_pn in $l_pcl; do $l_pq \"$l_pn\" > /dev/null 2>&1 && l_pkgoutput=\"$l_pkgoutput - Package: \\\"$l_pn\\\" exists on the system - checking configuration\" done if [ -n \"$l_pkgoutput\" ]; then l_output=\"\" l_output2=\"\" echo -e \"$l_pkgoutput\" # Look for existing settings and set variables if they exist l_gdmfile=\"$(grep -Prils '^\\h*banner-message-enable\\b' /etc/dconf/db/*.d)\" if [ -n \"$l_gdmfile\" ]; then # Set profile name based on dconf db directory ({PROFILE_NAME}.d) l_gdmprofile=\"$(awk -F\\/ '{split($(NF-1),a,\".\");print a[1]}' <<< \"$l_gdmfile\")\" # Check if banner message is enabled if grep -Pisq '^\\h*banner-message-enable=true\\b' \"$l_gdmfile\"; then l_output=\"$l_output - The \\\"banner-message-enable\\\" option is enabled in \\\"$l_gdmfile\\\"\" else l_output2=\"$l_output2 - The \\\"banner-message-enable\\\" option is not enabled\" fi l_lsbt=\"$(grep -Pios '^\\h*banner-message-text=.*$' \"$l_gdmfile\")\" if [ -n \"$l_lsbt\" ]; then l_output=\"$l_output - The \\\"banner-message-text\\\" option is set in \\\"$l_gdmfile\\\" - banner-message-text is set to: - \\\"$l_lsbt\\\"\" else l_output2=\"$l_output2 - The \\\"banner-message-text\\\" option is not set\" fi if grep -Pq \"^\\h*system-db:$l_gdmprofile\" /etc/dconf/profile/\"$l_gdmprofile\"; then l_output=\"$l_output - The \\\"$l_gdmprofile\\\" profile exists\" else l_output2=\"$l_output2 - The \\\"$l_gdmprofile\\\" profile doesn't exist\" fi if [ -f \"/etc/dconf/db/$l_gdmprofile\" ]; then l_output=\"$l_output - The \\\"$l_gdmprofile\\\" profile exists in the dconf database\" else l_output2=\"$l_output2 - The \\\"$l_gdmprofile\\\" profile doesn't exist in the dconf database\" fi else l_output2=\"$l_output2 - The \\\"banner-message-enable\\\" option isn't configured\" fi else echo -e \" - GNOME Desktop Manager isn't installed - Recommendation is Not Applicable - Audit result: *** PASS *** \" fi # Report results. If no failures output in l_output2, we pass if [ -z \"$l_output2\" ]; then echo -e \" - Audit Result: ** PASS ** $l_output \" else echo -e \" - Audit Result: ** FAIL ** - Reason(s) for audit failure: $l_output2 \" [ -n \"$l_output\" ] && echo -e \" - Correctly set: $l_output \" fi" expect : "PASS" type : CMD_EXEC description : "1.8.3 Ensure GDM disable-user-list option is enabled" info : "GDM is the GNOME Display Manager which handles graphical login for GNOME based systems. The disable-user-list option controls if a list of users is displayed on the login screen Displaying the user list eliminates half of the Userid/Password equation that an unauthorized person would need to log on." solution : "Run the following script to enable the disable-user-list option: Note: the l_gdm_profile variable in the script can be changed if a different profile name is desired in accordance with local site policy. #!/usr/bin/env bash { l_gdmprofile=\"gdm\" if [ ! -f \"/etc/dconf/profile/$l_gdmprofile\" ]; then echo \"Creating profile \\\"$l_gdmprofile\\\"\" echo -e \"user-db:user\nsystem-db:$l_gdmprofile\nfile-db:/usr/share/$l_gdmprofile/greeter-dconf-defaults\" > /etc/dconf/profile/$l_gdmprofile fi if [ ! -d \"/etc/dconf/db/$l_gdmprofile.d/\" ]; then echo \"Creating dconf database directory \\\"/etc/dconf/db/$l_gdmprofile.d/\\\"\" mkdir /etc/dconf/db/$l_gdmprofile.d/ fi if ! grep -Piq '^\h*disable-user-list\h*=\h*true\b' /etc/dconf/db/$l_gdmprofile.d/*; then echo \"creating gdm keyfile for machine-wide settings\" if ! grep -Piq -- '^\h*\[org\/gnome\/login-screen\]' /etc/dconf/db/$l_gdmprofile.d/*; then echo -e \"\n[org/gnome/login-screen]\n# Do not show the user list\ndisable-user-list=true\" >> /etc/dconf/db/$l_gdmprofile.d/00-login-screen else sed -ri '/^\s*\[org\/gnome\/login-screen\]/ a\# Do not show the user list\ndisable-user-list=true' $(grep -Pil -- '^\h*\[org\/gnome\/login-screen\]' /etc/dconf/db/$l_gdmprofile.d/*) fi fi dconf update } Note: When the user profile is created or changed, the user will need to log out and log in again before the changes will be applied. - OR - Run the following command to remove the GNOME package: # zypper remove gdm" reference : "800-171|3.5.11,800-171r3|03.05.11,800-53|IA-6,800-53r5|IA-6,CSF2.0|PR.AA-01,GDPR|32.1.b,HIPAA|164.306(a)(1),HIPAA|164.312(d),ISO-27001-2022|A.8.5,ITSG-33|IA-6,ITSG-33|IA-6a.,LEVEL|1A,NESA|T5.5.1,QCSC-v1|13.2" see_also : "https://workbench.cisecurity.org/benchmarks/20333" cmd : "#!/bin/bash { l_pkgoutput=\"\" if command -v dpkg-query > /dev/null 2>&1; then l_pq=\"dpkg-query -W\" elif command -v rpm > /dev/null 2>&1; then l_pq=\"rpm -q\" fi l_pcl=\"gdm gdm3\" # Space seporated list of packages to check for l_pn in $l_pcl; do $l_pq \"$l_pn\" > /dev/null 2>&1 && l_pkgoutput=\"$l_pkgoutput\\n - Package: \\\"$l_pn\\\" exists on the system\\n - checking configuration\" done if [ -n \"$l_pkgoutput\" ]; then output=\"\" output2=\"\" l_gdmfile=\"$(grep -Pril '^\\h*disable-user-list\\h*=\\h*true\\b' /etc/dconf/db)\" if [ -n \"$l_gdmfile\" ]; then output=\"$output\\n - The \\\"disable-user-list\\\" option is enabled in \\\"$l_gdmfile\\\"\" l_gdmprofile=\"$(awk -F\\/ '{split($(NF-1),a,\".\");print a[1]}' <<< \"$l_gdmfile\")\" if grep -Pq \"^\\h*system-db:$l_gdmprofile\" /etc/dconf/profile/\"$l_gdmprofile\"; then output=\"$output\\n - The \\\"$l_gdmprofile\\\" exists\" else output2=\"$output2\\n - The \\\"$l_gdmprofile\\\" doesn't exist\" fi if [ -f \"/etc/dconf/db/$l_gdmprofile\" ]; then output=\"$output\\n - The \\\"$l_gdmprofile\\\" profile exists in the dconf database\" else output2=\"$output2\\n - The \\\"$l_gdmprofile\\\" profile doesn't exist in the dconf database\" fi else output2=\"$output2\\n - The \\\"disable-user-list\\\" option is not enabled\" fi if [ -z \"$output2\" ]; then echo -e \"$l_pkgoutput\\n- Audit result:\\n *** PASS: ***\\n$output\\n\" else echo -e \"$l_pkgoutput\\n- Audit Result:\\n *** FAIL: ***\\n$output2\\n\" [ -n \"$output\" ] && echo -e \"$output\\n\" fi else echo -e \"\\n\\n - GNOME Desktop Manager isn't installed\\n - Recommendation is Not Applicable\\n- Audit result:\\n *** PASS ***\\n\" fi }" expect : "(?i)^[\\s]*\\**[\\s]*pass:?[\\s]*\\**$" type : CMD_EXEC description : "1.8.4 Ensure GDM screen locks when the user is idle" info : "GNOME Desktop Manager can make the screen lock automatically whenever the user is idle for some amount of time. - idle-delay=uint32 {n} - Number of seconds of inactivity before the screen goes blank - lock-delay=uint32 {n} - Number of seconds after the screen is blank before locking the screen Example key file: # Specify the dconf path [org/gnome/desktop/session] # Number of seconds of inactivity before the screen goes blank # Set to 0 seconds if you want to deactivate the screensaver. idle-delay=uint32 900 # Specify the dconf path [org/gnome/desktop/screensaver] # Number of seconds after the screen is blank before locking the screen lock-delay=uint32 5 Setting a lock-out value reduces the window of opportunity for unauthorized user access to another user's session that has been left unattended." solution : "Create or edit a file in the /etc/dconf/profile/ and verify it includes the following: user-db:user system-db:{NAME_OF_DCONF_DATABASE} Note: local is the name of a dconf database used in the examples. Example: # echo -e '\nuser-db:user\nsystem-db:local' >> /etc/dconf/profile/user Create the directory /etc/dconf/db/{NAME_OF_DCONF_DATABASE}.d/ if it doesn't already exist: Example: # mkdir /etc/dconf/db/local.d Create the key file /etc/dconf/db/{NAME_OF_DCONF_DATABASE}.d/{FILE_NAME} to provide information for the {NAME_OF_DCONF_DATABASE} database: Example script: #!/usr/bin/env bash { l_key_file=\"/etc/dconf/db/local.d/00-screensaver\" l_idmv=\"900\" # Set max value for idle-delay in seconds (between 1 and 900) l_ldmv=\"5\" # Set max value for lock-delay in seconds (between 0 and 5) { echo '# Specify the dconf path' echo '[org/gnome/desktop/session]' echo '' echo '# Number of seconds of inactivity before the screen goes blank' echo '# Set to 0 seconds if you want to deactivate the screensaver.' echo \"idle-delay=uint32 $l_idmv\" echo '' echo '# Specify the dconf path' echo '[org/gnome/desktop/screensaver]' echo '' echo '# Number of seconds after the screen is blank before locking the screen' echo \"lock-delay=uint32 $l_ldmv\" } > \"$l_key_file\" } Note: You must include the uint32 along with the integer key values as shown. Run the following command to update the system databases: # dconf update Note: Users must log out and back in again before the system-wide settings take effect." reference : "800-171|3.1.1,800-171|3.1.10,800-171|3.1.11,800-171r3|03.01.01h.,800-171r3|03.01.10,800-171r3|03.01.11,800-53|AC-2(5),800-53|AC-11,800-53|AC-11(1),800-53|AC-12,800-53r5|AC-2(5),800-53r5|AC-11,800-53r5|AC-11(1),800-53r5|AC-12,CN-L3|7.1.2.2(d),CN-L3|7.1.3.2(d),CN-L3|7.1.3.7(b),CN-L3|8.1.4.1(b),CSCv7|16.11,CSCv8|4.3,CSF|PR.AC-1,CSF|PR.AC-4,CSF2.0|DE.CM-01,CSF2.0|DE.CM-03,CSF2.0|PR.AA-01,CSF2.0|PR.AA-03,CSF2.0|PR.AA-05,CSF2.0|PR.DS-10,GDPR|32.1.b,HIPAA|164.306(a)(1),HIPAA|164.312(a)(1),HIPAA|164.312(a)(2)(iii),ISO-27001-2022|A.5.16,ISO-27001-2022|A.5.18,ISO-27001-2022|A.7.7,ISO-27001-2022|A.8.1,ISO-27001-2022|A.8.2,ISO/IEC-27001|A.9.2.1,ISO/IEC-27001|A.11.2.8,ITSG-33|AC-2(5),ITSG-33|AC-11,ITSG-33|AC-11(1),ITSG-33|AC-12,LEVEL|1A,NIAv2|AM23c,NIAv2|AM23d,NIAv2|AM28,NIAv2|NS5j,NIAv2|NS49,NIAv2|SS14e,PCI-DSSv3.2.1|8.1.8,PCI-DSSv4.0|8.2.8,QCSC-v1|5.2.2,QCSC-v1|8.2.1,QCSC-v1|13.2,QCSC-v1|15.2,TBA-FIISB|36.2.1,TBA-FIISB|37.1.4" see_also : "https://workbench.cisecurity.org/benchmarks/20333" cmd : "#!/bin/bash { # Check if GNMOE Desktop Manager is installed. If package isn't installed, recommendation is Not Applicable\\n # determine system's package manager l_pkgoutput=\"\" if command -v dpkg-query > /dev/null 2>&1; then l_pq=\"dpkg-query -W\" elif command -v rpm > /dev/null 2>&1; then l_pq=\"rpm -q\" fi # Check if GDM is installed l_pcl=\"gdm gdm3\" # Space seporated list of packages to check for l_pn in $l_pcl; do $l_pq \"$l_pn\" > /dev/null 2>&1 && l_pkgoutput=\"$l_pkgoutput\\n - Package: \\\"$l_pn\\\" exists on the system\\n - checking configuration\" done # Check configuration (If applicable) if [ -n \"$l_pkgoutput\" ]; then l_output=\"\" l_output2=\"\" l_idmv=\"900\" # Set for max value for idle-delay in seconds l_ldmv=\"5\" # Set for max value for lock-delay in seconds # Look for idle-delay to determine profile in use, needed for remaining tests l_kfile=\"$(grep -Psril '^\\h*idle-delay\\h*=\\h*uint32\\h+\\d+\\b' /etc/dconf/db/*/)\" # Determine file containing idle-delay key if [ -n \"$l_kfile\" ]; then # set profile name (This is the name of a dconf database) l_profile=\"$(awk -F'/' '{split($(NF-1),a,\".\");print a[1]}' <<< \"$l_kfile\")\" #Set the key profile name l_pdbdir=\"/etc/dconf/db/$l_profile.d\" # Set the key file dconf db directory # Confirm that idle-delay exists, includes unit32, and value is between 1 and max value for idle-delay l_idv=\"$(awk -F 'uint32' '/idle-delay/{print $2}' \"$l_kfile\" | xargs)\" if [ -n \"$l_idv\" ]; then [ \"$l_idv\" -gt \"0\" -a \"$l_idv\" -le \"$l_idmv\" ] && l_output=\"$l_output\\n - The \\\"idle-delay\\\" option is set to \\\"$l_idv\\\" seconds in \\\"$l_kfile\\\"\" [ \"$l_idv\" = \"0\" ] && l_output2=\"$l_output2\\n - The \\\"idle-delay\\\" option is set to \\\"$l_idv\\\" (disabled) in \\\"$l_kfile\\\"\" [ \"$l_idv\" -gt \"$l_idmv\" ] && l_output2=\"$l_output2\\n - The \\\"idle-delay\\\" option is set to \\\"$l_idv\\\" seconds (greater than $l_idmv) in \\\"$l_kfile\\\"\" else l_output2=\"$l_output2\\n - The \\\"idle-delay\\\" option is not set in \\\"$l_kfile\\\"\" fi # Confirm that lock-delay exists, includes unit32, and value is between 0 and max value for lock-delay l_ldv=\"$(awk -F 'uint32' '/lock-delay/{print $2}' \"$l_kfile\" | xargs)\" if [ -n \"$l_ldv\" ]; then [ \"$l_ldv\" -ge \"0\" -a \"$l_ldv\" -le \"$l_ldmv\" ] && l_output=\"$l_output\\n - The \\\"lock-delay\\\" option is set to \\\"$l_ldv\\\" seconds in \\\"$l_kfile\\\"\" [ \"$l_ldv\" -gt \"$l_ldmv\" ] && l_output2=\"$l_output2\\n - The \\\"lock-delay\\\" option is set to \\\"$l_ldv\\\" seconds (greater than $l_ldmv) in \\\"$l_kfile\\\"\" else l_output2=\"$l_output2\\n - The \\\"lock-delay\\\" option is not set in \\\"$l_kfile\\\"\" fi # Confirm that dconf profile exists if grep -Psq \"^\\h*system-db:$l_profile\" /etc/dconf/profile/*; then l_output=\"$l_output\\n - The \\\"$l_profile\\\" profile exists\" else l_output2=\"$l_output2\\n - The \\\"$l_profile\\\" doesn't exist\" fi # Confirm that dconf profile database file exists if [ -f \"/etc/dconf/db/$l_profile\" ]; then l_output=\"$l_output\\n - The \\\"$l_profile\\\" profile exists in the dconf database\" else l_output2=\"$l_output2\\n - The \\\"$l_profile\\\" profile doesn't exist in the dconf database\" fi else l_output2=\"$l_output2\\n - The \\\"idle-delay\\\" option doesn't exist, remaining tests skipped\" fi else l_output=\"$l_output\\n - GNOME Desktop Manager package is not installed on the system\\n - Recommendation is not applicable\" fi # Report results. If no failures output in l_output2, we pass [ -n \"$l_pkgoutput\" ] && echo -e \"\\n$l_pkgoutput\" if [ -z \"$l_output2\" ]; then echo -e \"\\n- Audit Result:\\n ** PASS **\\n$l_output\\n\" else echo -e \"\\n- Audit Result:\\n ** FAIL **\\n - Reason(s) for audit failure:\\n$l_output2\\n\" [ -n \"$l_output\" ] && echo -e \"\\n- Correctly set:\\n$l_output\\n\" fi }" expect : "(?i)^[\\s]*\\**[\\s]*pass:?[\\s]*\\**$" type : CMD_EXEC description : "1.8.5 Ensure GDM screen locks cannot be overridden" info : "GNOME Desktop Manager can make the screen lock automatically whenever the user is idle for some amount of time. By using the lockdown mode in dconf, you can prevent users from changing specific settings. To lock down a dconf key or subpath, create a locks subdirectory in the keyfile directory. The files inside this directory contain a list of keys or subpaths to lock. Just as with the keyfiles, you may add any number of files to this directory. Example Lock File: # Lock desktop screensaver settings /org/gnome/desktop/session/idle-delay /org/gnome/desktop/screensaver/lock-delay Setting a lock-out value reduces the window of opportunity for unauthorized user access to another user's session that has been left unattended. Without locking down the system settings, user settings take precedence over the system settings." solution : "Run the following script to ensure screen locks cannot be overridden: #!/usr/bin/env bash { # Check if GNMOE Desktop Manager is installed. If package isn't installed, recommendation is Not Applicable\n # determine system's package manager l_pkgoutput=\"\" if command -v dpkg-query > /dev/null 2>&1; then l_pq=\"dpkg-query -W\" elif command -v rpm > /dev/null 2>&1; then l_pq=\"rpm -q\" fi # Check if GDM is installed l_pcl=\"gdm gdm3\" # Space separated list of packages to check for l_pn in $l_pcl; do $l_pq \"$l_pn\" > /dev/null 2>&1 && l_pkgoutput=\"y\" && echo -e \"\n - Package: \\\"$l_pn\\\" exists on the system\n - remediating configuration if needed\" done # Check configuration (If applicable) if [ -n \"$l_pkgoutput\" ]; then # Look for idle-delay to determine profile in use, needed for remaining tests l_kfd=\"/etc/dconf/db/$(grep -Psril '^\h*idle-delay\h*=\h*uint32\h+\d+\b' /etc/dconf/db/*/ | awk -F'/' '{split($(NF-1),a,\".\");print a[1]}').d\" #set directory of key file to be locked # Look for lock-delay to determine profile in use, needed for remaining tests l_kfd2=\"/etc/dconf/db/$(grep -Psril '^\h*lock-delay\h*=\h*uint32\h+\d+\b' /etc/dconf/db/*/ | awk -F'/' '{split($(NF-1),a,\".\");print a[1]}').d\" #set directory of key file to be locked if [ -d \"$l_kfd\" ]; then # If key file directory doesn't exist, options can't be locked if grep -Prilq '^\h*\/org\/gnome\/desktop\/session\/idle-delay\b' \"$l_kfd\"; then echo \" - \\\"idle-delay\\\" is locked in \\\"$(grep -Pril '^\h*\/org\/gnome\/desktop\/session\/idle-delay\b' \"$l_kfd\")\\\"\" else echo \"creating entry to lock \\\"idle-delay\\\"\" [ ! -d \"$l_kfd\"/locks ] && echo \"creating directory $l_kfd/locks\" && mkdir \"$l_kfd\"/locks { echo -e '\n# Lock desktop screensaver idle-delay setting' echo '/org/gnome/desktop/session/idle-delay' } >> \"$l_kfd\"/locks/00-screensaver fi else echo -e \" - \\\"idle-delay\\\" is not set so it can not be locked\n - Please follow Recommendation \\\"Ensure GDM screen locks when the user is idle\\\" and follow this Recommendation again\" fi if [ -d \"$l_kfd2\" ]; then # If key file directory doesn't exist, options can't be locked if grep -Prilq '^\h*\/org\/gnome\/desktop\/screensaver\/lock-delay\b' \"$l_kfd2\"; then echo \" - \\\"lock-delay\\\" is locked in \\\"$(grep -Pril '^\h*\/org\/gnome\/desktop\/screensaver\/lock-delay\b' \"$l_kfd2\")\\\"\" else echo \"creating entry to lock \\\"lock-delay\\\"\" [ ! -d \"$l_kfd2\"/locks ] && echo \"creating directory $l_kfd2/locks\" && mkdir \"$l_kfd2\"/locks { echo -e '\n# Lock desktop screensaver lock-delay setting' echo '/org/gnome/desktop/screensaver/lock-delay' } >> \"$l_kfd2\"/locks/00-screensaver fi else echo -e \" - \\\"lock-delay\\\" is not set so it can not be locked\n - Please follow Recommendation \\\"Ensure GDM screen locks when the user is idle\\\" and follow this Recommendation again\" fi else echo -e \" - GNOME Desktop Manager package is not installed on the system\n - Recommendation is not applicable\" fi } Run the following command to update the system databases: # dconf update Note: Users must log out and back in again before the system-wide settings take effect." reference : "800-171|3.1.1,800-171|3.1.10,800-171|3.1.11,800-171r3|03.01.01h.,800-171r3|03.01.10,800-171r3|03.01.11,800-53|AC-2(5),800-53|AC-11,800-53|AC-11(1),800-53|AC-12,800-53r5|AC-2(5),800-53r5|AC-11,800-53r5|AC-11(1),800-53r5|AC-12,CN-L3|7.1.2.2(d),CN-L3|7.1.3.2(d),CN-L3|7.1.3.7(b),CN-L3|8.1.4.1(b),CSCv7|16.11,CSCv8|4.3,CSF|PR.AC-1,CSF|PR.AC-4,CSF2.0|DE.CM-01,CSF2.0|DE.CM-03,CSF2.0|PR.AA-01,CSF2.0|PR.AA-03,CSF2.0|PR.AA-05,CSF2.0|PR.DS-10,GDPR|32.1.b,HIPAA|164.306(a)(1),HIPAA|164.312(a)(1),HIPAA|164.312(a)(2)(iii),ISO-27001-2022|A.5.16,ISO-27001-2022|A.5.18,ISO-27001-2022|A.7.7,ISO-27001-2022|A.8.1,ISO-27001-2022|A.8.2,ISO/IEC-27001|A.9.2.1,ISO/IEC-27001|A.11.2.8,ITSG-33|AC-2(5),ITSG-33|AC-11,ITSG-33|AC-11(1),ITSG-33|AC-12,LEVEL|1A,NIAv2|AM23c,NIAv2|AM23d,NIAv2|AM28,NIAv2|NS5j,NIAv2|NS49,NIAv2|SS14e,PCI-DSSv3.2.1|8.1.8,PCI-DSSv4.0|8.2.8,QCSC-v1|5.2.2,QCSC-v1|8.2.1,QCSC-v1|13.2,QCSC-v1|15.2,TBA-FIISB|36.2.1,TBA-FIISB|37.1.4" see_also : "https://workbench.cisecurity.org/benchmarks/20333" cmd : "#!/bin/bash { # Check if GNOME Desktop Manager is installed. If package isn't installed, recommendation is Not Applicable\\n # determine system's package manager l_pkgoutput=\"\" if command -v dpkg-query > /dev/null 2>&1; then l_pq=\"dpkg-query -W\" elif command -v rpm > /dev/null 2>&1; then l_pq=\"rpm -q\" fi # Check if GDM is installed l_pcl=\"gdm gdm3\" # Space seporated list of packages to check for l_pn in $l_pcl; do $l_pq \"$l_pn\" > /dev/null 2>&1 && l_pkgoutput=\"$l_pkgoutput\\n - Package: \\\"$l_pn\\\" exists on the system\\n - checking configuration\" done # Check configuration (If applicable) if [ -n \"$l_pkgoutput\" ]; then l_output=\"\" l_output2=\"\" # Look for idle-delay to determine profile in use, needed for remaining tests l_kfd=\"/etc/dconf/db/$(grep -Psril '^\\h*idle-delay\\h*=\\h*uint32\\h+\\d+\\b' /etc/dconf/db/*/ | awk -F'/' '{split($(NF-1),a,\".\");print a[1]}').d\" #set directory of key file to be locked l_kfd2=\"/etc/dconf/db/$(grep -Psril '^\\h*lock-delay\\h*=\\h*uint32\\h+\\d+\\b' /etc/dconf/db/*/ | awk -F'/' '{split($(NF-1),a,\".\");print a[1]}').d\" #set directory of key file to be locked if [ -d \"$l_kfd\" ]; then # If key file directory doesn't exist, options can't be locked if grep -Prilq '\\/org\\/gnome\\/desktop\\/session\\/idle-delay\\b' \"$l_kfd\"; then l_output=\"$l_output\\n - \\\"idle-delay\\\" is locked in \\\"$(grep -Pril '\\/org\\/gnome\\/desktop\\/session\\/idle-delay\\b' \"$l_kfd\")\\\"\" else l_output2=\"$l_output2\\n - \\\"idle-delay\\\" is not locked\" fi else l_output2=\"$l_output2\\n - \\\"idle-delay\\\" is not set so it can not be locked\" fi if [ -d \"$l_kfd2\" ]; then # If key file directory doesn't exist, options can't be locked if grep -Prilq '\\/org\\/gnome\\/desktop\\/screensaver\\/lock-delay\\b' \"$l_kfd2\"; then l_output=\"$l_output\\n - \\\"lock-delay\\\" is locked in \\\"$(grep -Pril '\\/org\\/gnome\\/desktop\\/screensaver\\/lock-delay\\b' \"$l_kfd2\")\\\"\" else l_output2=\"$l_output2\\n - \\\"lock-delay\\\" is not locked\" fi else l_output2=\"$l_output2\\n - \\\"lock-delay\\\" is not set so it can not be locked\" fi else l_output=\"$l_output\\n - GNOME Desktop Manager package is not installed on the system\\n - Recommendation is not applicable\" fi # Report results. If no failures output in l_output2, we pass [ -n \"$l_pkgoutput\" ] && echo -e \"\\n$l_pkgoutput\" if [ -z \"$l_output2\" ]; then echo -e \"\\n- Audit Result:\\n ** PASS **\\n$l_output\\n\" else echo -e \"\\n- Audit Result:\\n ** FAIL **\\n - Reason(s) for audit failure:\\n$l_output2\\n\" [ -n \"$l_output\" ] && echo -e \"\\n- Correctly set:\\n$l_output\\n\" fi }" expect : "(?i)^[\\s]*\\**[\\s]*pass:?[\\s]*\\**$" type : CMD_EXEC description : "1.8.6 Ensure GDM automatic mounting of removable media is disabled" info : "By default GNOME automatically mounts removable media when inserted as a convenience to the user. 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 script to disable automatic mounting of media for all GNOME users: #!/usr/bin/env bash { l_pkgoutput=\"\" l_gpname=\"local\" # Set to desired dconf profile name (default is local) # Check if GNOME Desktop Manager is installed. If package isn't installed, recommendation is Not Applicable\n # determine system's package manager if command -v dpkg-query > /dev/null 2>&1; then l_pq=\"dpkg-query -W\" elif command -v rpm > /dev/null 2>&1; then l_pq=\"rpm -q\" fi # Check if GDM is installed l_pcl=\"gdm gdm3\" # Space separated list of packages to check for l_pn in $l_pcl; do $l_pq \"$l_pn\" > /dev/null 2>&1 && l_pkgoutput=\"$l_pkgoutput\n - Package: \\\"$l_pn\\\" exists on the system\n - checking configuration\" done # Check configuration (If applicable) if [ -n \"$l_pkgoutput\" ]; then echo -e \"$l_pkgoutput\" # Look for existing settings and set variables if they exist l_kfile=\"$(grep -Prils -- '^\h*automount\b' /etc/dconf/db/*.d)\" l_kfile2=\"$(grep -Prils -- '^\h*automount-open\b' /etc/dconf/db/*.d)\" # Set profile name based on dconf db directory ({PROFILE_NAME}.d) if [ -f \"$l_kfile\" ]; then l_gpname=\"$(awk -F\/ '{split($(NF-1),a,\".\");print a[1]}' <<< \"$l_kfile\")\" echo \" - updating dconf profile name to \\\"$l_gpname\\\"\" elif [ -f \"$l_kfile2\" ]; then l_gpname=\"$(awk -F\/ '{split($(NF-1),a,\".\");print a[1]}' <<< \"$l_kfile2\")\" echo \" - updating dconf profile name to \\\"$l_gpname\\\"\" fi # check for consistency (Clean up configuration if needed) if [ -f \"$l_kfile\" ] && [ \"$(awk -F\/ '{split($(NF-1),a,\".\");print a[1]}' <<< \"$l_kfile\")\" != \"$l_gpname\" ]; then sed -ri \"/^\s*automount\s*=/s/^/# /\" \"$l_kfile\" l_kfile=\"/etc/dconf/db/$l_gpname.d/00-media-automount\" fi if [ -f \"$l_kfile2\" ] && [ \"$(awk -F\/ '{split($(NF-1),a,\".\");print a[1]}' <<< \"$l_kfile2\")\" != \"$l_gpname\" ]; then sed -ri \"/^\s*automount-open\s*=/s/^/# /\" \"$l_kfile2\" fi [ -z \"$l_kfile\" ] && l_kfile=\"/etc/dconf/db/$l_gpname.d/00-media-automount\" # Check if profile file exists if grep -Pq -- \"^\h*system-db:$l_gpname\b\" /etc/dconf/profile/*; then echo -e \"\n - dconf database profile exists in: \\\"$(grep -Pl -- \"^\h*system-db:$l_gpname\b\" /etc/dconf/profile/*)\\\"\" else if [ ! -f \"/etc/dconf/profile/user\" ]; then l_gpfile=\"/etc/dconf/profile/user\" else l_gpfile=\"/etc/dconf/profile/user2\" fi echo -e \" - creating dconf database profile\" { echo -e \"\nuser-db:user\" echo \"system-db:$l_gpname\" } >> \"$l_gpfile\" fi # create dconf directory if it doesn't exists l_gpdir=\"/etc/dconf/db/$l_gpname.d\" if [ -d \"$l_gpdir\" ]; then echo \" - The dconf database directory \\\"$l_gpdir\\\" exists\" else echo \" - creating dconf database directory \\\"$l_gpdir\\\"\" mkdir \"$l_gpdir\" fi # check automount-open setting if grep -Pqs -- '^\h*automount-open\h*=\h*false\b' \"$l_kfile\"; then echo \" - \\\"automount-open\\\" is set to false in: \\\"$l_kfile\\\"\" else echo \" - creating \\\"automount-open\\\" entry in \\\"$l_kfile\\\"\" ! grep -Psq -- '\^\h*\[org\/gnome\/desktop\/media-handling\]\b' \"$l_kfile\" && echo '[org/gnome/desktop/media-handling]' >> \"$l_kfile\" sed -ri '/^\s*\[org\/gnome\/desktop\/media-handling\]/a \\nautomount-open=false' \"$l_kfile\" fi # check automount setting if grep -Pqs -- '^\h*automount\h*=\h*false\b' \"$l_kfile\"; then echo \" - \\\"automount\\\" is set to false in: \\\"$l_kfile\\\"\" else echo \" - creating \\\"automount\\\" entry in \\\"$l_kfile\\\"\" ! grep -Psq -- '\^\h*\[org\/gnome\/desktop\/media-handling\]\b' \"$l_kfile\" && echo '[org/gnome/desktop/media-handling]' >> \"$l_kfile\" sed -ri '/^\s*\[org\/gnome\/desktop\/media-handling\]/a \\nautomount=false' \"$l_kfile\" fi # update dconf database dconf update else echo -e \"\n - GNOME Desktop Manager package is not installed on the system\n - Recommendation is not applicable\" fi } - OR - Run the following command to uninstall the GNOME desktop Manager package: # zypper remove gdm 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." reference : "800-171|3.8.7,800-171r3|03.08.07,800-53|MP-7,800-53r5|MP-7,CN-L3|8.5.4.1(c),CSCv7|8.5,CSCv8|10.3,CSF|PR.PT-2,GDPR|32.1.b,HIPAA|164.306(a)(1),HIPAA|164.312(a)(1),ISO-27001-2022|A.5.10,ISO-27001-2022|A.7.10,ISO/IEC-27001|A.8.3.1,ISO/IEC-27001|A.8.3.3,LEVEL|1A,NESA|T1.4.1" see_also : "https://workbench.cisecurity.org/benchmarks/20333" cmd : "#!/bin/bash { l_pkgoutput=\"\" l_output=\"\" l_output2=\"\" # Check if GNOME Desktop Manager is installed. If package isn't installed, recommendation is Not Applicable\\n # determine system's package manager if command -v dpkg-query > /dev/null 2>&1; then l_pq=\"dpkg-query -W\" elif command -v rpm > /dev/null 2>&1; then l_pq=\"rpm -q\" fi # Check if GDM is installed l_pcl=\"gdm gdm3\" # Space seporated list of packages to check for l_pn in $l_pcl; do $l_pq \"$l_pn\" > /dev/null 2>&1 && l_pkgoutput=\"$l_pkgoutput\\n - Package: \\\"$l_pn\\\" exists on the system\\n - checking configuration\" done # Check configuration (If applicable) if [ -n \"$l_pkgoutput\" ]; then echo -e \"$l_pkgoutput\" # Look for existing settings and set variables if they exist l_kfile=\"$(grep -Prils -- '^\\h*automount\\b' /etc/dconf/db/*.d)\" l_kfile2=\"$(grep -Prils -- '^\\h*automount-open\\b' /etc/dconf/db/*.d)\" # Set profile name based on dconf db directory ({PROFILE_NAME}.d) if [ -f \"$l_kfile\" ]; then l_gpname=\"$(awk -F\\/ '{split($(NF-1),a,\".\");print a[1]}' <<< \"$l_kfile\")\" elif [ -f \"$l_kfile2\" ]; then l_gpname=\"$(awk -F\\/ '{split($(NF-1),a,\".\");print a[1]}' <<< \"$l_kfile2\")\" fi # If the profile name exist, continue checks if [ -n \"$l_gpname\" ]; then l_gpdir=\"/etc/dconf/db/$l_gpname.d\" # Check if profile file exists if grep -Pq -- \"^\\h*system-db:$l_gpname\\b\" /etc/dconf/profile/*; then l_output=\"$l_output\\n - dconf database profile file \\\"$(grep -Pl -- \"^\\h*system-db:$l_gpname\\b\" /etc/dconf/profile/*)\\\" exists\" else l_output2=\"$l_output2\\n - dconf database profile isn't set\" fi # Check if the dconf database file exists if [ -f \"/etc/dconf/db/$l_gpname\" ]; then l_output=\"$l_output\\n - The dconf database \\\"$l_gpname\\\" exists\" else l_output2=\"$l_output2\\n - The dconf database \\\"$l_gpname\\\" doesn't exist\" fi # check if the dconf database directory exists if [ -d \"$l_gpdir\" ]; then l_output=\"$l_output\\n - The dconf directory \\\"$l_gpdir\\\" exitst\" else l_output2=\"$l_output2\\n - The dconf directory \\\"$l_gpdir\\\" doesn't exist\" fi # check automount setting if grep -Pqrs -- '^\\h*automount\\h*=\\h*false\\b' \"$l_kfile\"; then l_output=\"$l_output\\n - \\\"automount\\\" is set to false in: \\\"$l_kfile\\\"\" else l_output2=\"$l_output2\\n - \\\"automount\\\" is not set correctly\" fi # check automount-open setting if grep -Pqs -- '^\\h*automount-open\\h*=\\h*false\\b' \"$l_kfile2\"; then l_output=\"$l_output\\n - \\\"automount-open\\\" is set to false in: \\\"$l_kfile2\\\"\" else l_output2=\"$l_output2\\n - \\\"automount-open\\\" is not set correctly\" fi else # Setings don't exist. Nothing further to check l_output2=\"$l_output2\\n - neither \\\"automount\\\" or \\\"automount-open\\\" is set\" fi else l_output=\"$l_output\\n - GNOME Desktop Manager package is not installed on the system\\n - Recommendation is not applicable\" fi # Report results. If no failures output in l_output2, we pass if [ -z \"$l_output2\" ]; then echo -e \"\\n- Audit Result:\\n ** PASS **\\n$l_output\\n\" else echo -e \"\\n- Audit Result:\\n ** FAIL **\\n - Reason(s) for audit failure:\\n$l_output2\\n\" [ -n \"$l_output\" ] && echo -e \"\\n- Correctly set:\\n$l_output\\n\" fi }" expect : "(?i)^[\\s]*\\**[\\s]*pass:?[\\s]*\\**$" type : CMD_EXEC description : "1.8.7 Ensure GDM disabling automatic mounting of removable media is not overridden" info : "By default GNOME automatically mounts removable media when inserted as a convenience to the user By using the lockdown mode in dconf, you can prevent users from changing specific settings. To lock down a dconf key or subpath, create a locks subdirectory in the keyfile directory. The files inside this directory contain a list of keys or subpaths to lock. Just as with the keyfiles, you may add any number of files to this directory. Example Lock File: # Lock automount settings /org/gnome/desktop/media-handling/automount /org/gnome/desktop/media-handling/automount-open 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 script to lock disable automatic mounting of media for all GNOME users: #!/usr/bin/env bash { # Check if GNMOE Desktop Manager is installed. If package isn't installed, recommendation is Not Applicable\n # determine system's package manager l_pkgoutput=\"\" if command -v dpkg-query > /dev/null 2>&1; then l_pq=\"dpkg-query -W\" elif command -v rpm > /dev/null 2>&1; then l_pq=\"rpm -q\" fi # Check if GDM is installed l_pcl=\"gdm gdm3\" # Space separated list of packages to check for l_pn in $l_pcl; do $l_pq \"$l_pn\" > /dev/null 2>&1 && l_pkgoutput=\"y\" && echo -e \"\n - Package: \\\"$l_pn\\\" exists on the system\n - remediating configuration if needed\" done # Check configuration (If applicable) if [ -n \"$l_pkgoutput\" ]; then # Look for automount to determine profile in use, needed for remaining tests l_kfd=\"/etc/dconf/db/$(grep -Psril '^\h*automount\b' /etc/dconf/db/*/ | awk -F'/' '{split($(NF-1),a,\".\");print a[1]}').d\" #set directory of key file to be locked # Look for automount-open to determine profile in use, needed for remaining tests l_kfd2=\"/etc/dconf/db/$(grep -Psril '^\h*automount-open\b' /etc/dconf/db/*/ | awk -F'/' '{split($(NF-1),a,\".\");print a[1]}').d\" #set directory of key file to be locked if [ -d \"$l_kfd\" ]; then # If key file directory doesn't exist, options can't be locked if grep -Priq '^\h*\/org/gnome\/desktop\/media-handling\/automount\b' \"$l_kfd\"; then echo \" - \\\"automount\\\" is locked in \\\"$(grep -Pril '^\h*\/org/gnome\/desktop\/media-handling\/automount\b' \"$l_kfd\")\\\"\" else echo \" - creating entry to lock \\\"automount\\\"\" [ ! -d \"$l_kfd\"/locks ] && echo \"creating directory $l_kfd/locks\" && mkdir \"$l_kfd\"/locks { echo -e '\n# Lock desktop media-handling automount setting' echo '/org/gnome/desktop/media-handling/automount' } >> \"$l_kfd\"/locks/00-media-automount fi else echo -e \" - \\\"automount\\\" is not set so it can not be locked\n - Please follow Recommendation \\\"Ensure GDM automatic mounting of removable media is disabled\\\" and follow this Recommendation again\" fi if [ -d \"$l_kfd2\" ]; then # If key file directory doesn't exist, options can't be locked if grep -Priq '^\h*\/org/gnome\/desktop\/media-handling\/automount-open\b' \"$l_kfd2\"; then echo \" - \\\"automount-open\\\" is locked in \\\"$(grep -Pril '^\h*\/org/gnome\/desktop\/media-handling\/automount-open\b' \"$l_kfd2\")\\\"\" else echo \" - creating entry to lock \\\"automount-open\\\"\" [ ! -d \"$l_kfd2\"/locks ] && echo \"creating directory $l_kfd2/locks\" && mkdir \"$l_kfd2\"/locks { echo -e '\n# Lock desktop media-handling automount-open setting' echo '/org/gnome/desktop/media-handling/automount-open' } >> \"$l_kfd2\"/locks/00-media-automount fi else echo -e \" - \\\"automount-open\\\" is not set so it can not be locked\n - Please follow Recommendation \\\"Ensure GDM automatic mounting of removable media is disabled\\\" and follow this Recommendation again\" fi # update dconf database dconf update else echo -e \" - GNOME Desktop Manager package is not installed on the system\n - Recommendation is not applicable\" fi } Impact: The use of portable hard drives is very common for workstation users" reference : "800-171|3.8.7,800-171r3|03.08.07,800-53|MP-7,800-53r5|MP-7,CN-L3|8.5.4.1(c),CSCv7|8.5,CSCv8|10.3,CSF|PR.PT-2,GDPR|32.1.b,HIPAA|164.306(a)(1),HIPAA|164.312(a)(1),ISO-27001-2022|A.5.10,ISO-27001-2022|A.7.10,ISO/IEC-27001|A.8.3.1,ISO/IEC-27001|A.8.3.3,LEVEL|1A,NESA|T1.4.1" see_also : "https://workbench.cisecurity.org/benchmarks/20333" cmd : "#!/bin/bash { # Check if GNOME Desktop Manager is installed. If package isn't installed, recommendation is Not Applicable\\n # determine system's package manager l_pkgoutput=\"\" if command -v dpkg-query > /dev/null 2>&1; then l_pq=\"dpkg-query -W\" elif command -v rpm > /dev/null 2>&1; then l_pq=\"rpm -q\" fi # Check if GDM is installed l_pcl=\"gdm gdm3\" # Space seporated list of packages to check for l_pn in $l_pcl; do $l_pq \"$l_pn\" > /dev/null 2>&1 && l_pkgoutput=\"$l_pkgoutput\\n - Package: \\\"$l_pn\\\" exists on the system\\n - checking configuration\" done # Check configuration (If applicable) if [ -n \"$l_pkgoutput\" ]; then l_output=\"\" l_output2=\"\" echo -e \"$l_pkgoutput\\n\" # Look for idle-delay to determine profile in use, needed for remaining tests l_kfd=\"/etc/dconf/db/$(grep -Psril '^\\h*automount\\b' /etc/dconf/db/*/ | awk -F'/' '{split($(NF-1),a,\".\");print a[1]}').d\" #set directory of key file to be locked l_kfd2=\"/etc/dconf/db/$(grep -Psril '^\\h*automount-open\\b' /etc/dconf/db/*/ | awk -F'/' '{split($(NF-1),a,\".\");print a[1]}').d\" #set directory of key file to be locked if [ -d \"$l_kfd\" ]; then # If key file directory doesn't exist, options can't be locked if grep -Priq '^\\h*\\/org/gnome\\/desktop\\/media-handling\\/automount\\b' \"$l_kfd\"; then l_output=\"$l_output\\n - \\\"automount\\\" is locked in \\\"$(grep -Pril '^\\h*\\/org/gnome\\/desktop\\/media-handling\\/automount\\b' \"$l_kfd\")\\\"\" else l_output2=\"$l_output2\\n - \\\"automount\\\" is not locked\" fi else l_output2=\"$l_output2\\n - \\\"automount\\\" is not set so it can not be locked\" fi if [ -d \"$l_kfd2\" ]; then # If key file directory doesn't exist, options can't be locked if grep -Priq '^\\h*\\/org/gnome\\/desktop\\/media-handling\\/automount-open\\b' \"$l_kfd2\"; then l_output=\"$l_output\\n - \\\"lautomount-open\\\" is locked in \\\"$(grep -Pril '^\\h*\\/org/gnome\\/desktop\\/media-handling\\/automount-open\\b' \"$l_kfd2\")\\\"\" else l_output2=\"$l_output2\\n - \\\"automount-open\\\" is not locked\" fi else l_output2=\"$l_output2\\n - \\\"automount-open\\\" is not set so it can not be locked\" fi else l_output=\"$l_output\\n - GNOME Desktop Manager package is not installed on the system\\n - Recommendation is not applicable\" fi # Report results. If no failures output in l_output2, we pass if [ -z \"$l_output2\" ]; then echo -e \"\\n- Audit Result:\\n ** PASS **\\n$l_output\\n\" else echo -e \"\\n- Audit Result:\\n ** FAIL **\\n - Reason(s) for audit failure:\\n$l_output2\\n\" [ -n \"$l_output\" ] && echo -e \"\\n- Correctly set:\\n$l_output\\n\" fi }" expect : "(?i)^[\\s]*\\**[\\s]*pass:?[\\s]*\\**$" type : CMD_EXEC description : "1.8.8 Ensure GDM autorun-never is enabled" info : "The autorun-never setting allows the GNOME Desktop Display Manager to disable autorun through GDM. Malware on removable media may take advantage of Autorun features when the media is inserted into a system and execute." solution : "Run the following script to set autorun-never to true for GDM users: #!/usr/bin/env bash { l_pkgoutput=\"\" l_output=\"\" l_output2=\"\" l_gpname=\"local\" # Set to desired dconf profile name (default is local) # Check if GNOME Desktop Manager is installed. If package isn't installed, recommendation is Not Applicable\n # determine system's package manager if command -v dpkg-query > /dev/null 2>&1; then l_pq=\"dpkg-query -W\" elif command -v rpm > /dev/null 2>&1; then l_pq=\"rpm -q\" fi # Check if GDM is installed l_pcl=\"gdm gdm3\" # Space separated list of packages to check for l_pn in $l_pcl; do $l_pq \"$l_pn\" > /dev/null 2>&1 && l_pkgoutput=\"$l_pkgoutput\n - Package: \\\"$l_pn\\\" exists on the system\n - checking configuration\" done echo -e \"$l_pkgoutput\" # Check configuration (If applicable) if [ -n \"$l_pkgoutput\" ]; then echo -e \"$l_pkgoutput\" # Look for existing settings and set variables if they exist l_kfile=\"$(grep -Prils -- '^\h*autorun-never\b' /etc/dconf/db/*.d)\" # Set profile name based on dconf db directory ({PROFILE_NAME}.d) if [ -f \"$l_kfile\" ]; then l_gpname=\"$(awk -F\/ '{split($(NF-1),a,\".\");print a[1]}' <<< \"$l_kfile\")\" echo \" - updating dconf profile name to \\\"$l_gpname\\\"\" fi [ ! -f \"$l_kfile\" ] && l_kfile=\"/etc/dconf/db/$l_gpname.d/00-media-autorun\" # Check if profile file exists if grep -Pq -- \"^\h*system-db:$l_gpname\b\" /etc/dconf/profile/*; then echo -e \"\n - dconf database profile exists in: \\\"$(grep -Pl -- \"^\h*system-db:$l_gpname\b\" /etc/dconf/profile/*)\\\"\" else [ ! -f \"/etc/dconf/profile/user\" ] && l_gpfile=\"/etc/dconf/profile/user\" || l_gpfile=\"/etc/dconf/profile/user2\" echo -e \" - creating dconf database profile\" { echo -e \"\nuser-db:user\" echo \"system-db:$l_gpname\" } >> \"$l_gpfile\" fi # create dconf directory if it doesn't exists l_gpdir=\"/etc/dconf/db/$l_gpname.d\" if [ -d \"$l_gpdir\" ]; then echo \" - The dconf database directory \\\"$l_gpdir\\\" exists\" else echo \" - creating dconf database directory \\\"$l_gpdir\\\"\" mkdir \"$l_gpdir\" fi # check autorun-never setting if grep -Pqs -- '^\h*autorun-never\h*=\h*true\b' \"$l_kfile\"; then echo \" - \\\"autorun-never\\\" is set to true in: \\\"$l_kfile\\\"\" else echo \" - creating or updating \\\"autorun-never\\\" entry in \\\"$l_kfile\\\"\" if grep -Psq -- '^\h*autorun-never' \"$l_kfile\"; then sed -ri 's/(^\s*autorun-never\s*=\s*)(\S+)(\s*.*)$/\1true \3/' \"$l_kfile\" else ! grep -Psq -- '\^\h*\[org\/gnome\/desktop\/media-handling\]\b' \"$l_kfile\" && echo '[org/gnome/desktop/media-handling]' >> \"$l_kfile\" sed -ri '/^\s*\[org\/gnome\/desktop\/media-handling\]/a \\nautorun-never=true' \"$l_kfile\" fi fi else echo -e \"\n - GNOME Desktop Manager package is not installed on the system\n - Recommendation is not applicable\" fi # update dconf database dconf update }" reference : "800-171|3.8.7,800-171r3|03.08.07,800-53|MP-7,800-53r5|MP-7,CN-L3|8.5.4.1(c),CSCv7|8.5,CSCv8|10.3,CSF|PR.PT-2,GDPR|32.1.b,HIPAA|164.306(a)(1),HIPAA|164.312(a)(1),ISO-27001-2022|A.5.10,ISO-27001-2022|A.7.10,ISO/IEC-27001|A.8.3.1,ISO/IEC-27001|A.8.3.3,LEVEL|1A,NESA|T1.4.1" see_also : "https://workbench.cisecurity.org/benchmarks/20333" cmd : "#!/bin/bash { l_pkgoutput=\"\" l_output=\"\" l_output2=\"\" # Check if GNOME Desktop Manager is installed. If package isn't installed, recommendation is Not Applicable\\n # determine system's package manager if command -v dpkg-query > /dev/null 2>&1; then l_pq=\"dpkg-query -W\" elif command -v rpm > /dev/null 2>&1; then l_pq=\"rpm -q\" fi # Check if GDM is installed l_pcl=\"gdm gdm3\" # Space separated list of packages to check for l_pn in $l_pcl; do $l_pq \"$l_pn\" > /dev/null 2>&1 && l_pkgoutput=\"$l_pkgoutput\\n - Package: \\\"$l_pn\\\" exists on the system\\n - checking configuration\" echo -e \"$l_pkgoutput\" done # Check configuration (If applicable) if [ -n \"$l_pkgoutput\" ]; then echo -e \"$l_pkgoutput\" # Look for existing settings and set variables if they exist l_kfile=\"$(grep -Prils -- '^\\h*autorun-never\\b' /etc/dconf/db/*.d)\" # Set profile name based on dconf db directory ({PROFILE_NAME}.d) if [ -f \"$l_kfile\" ]; then l_gpname=\"$(awk -F\\/ '{split($(NF-1),a,\".\");print a[1]}' <<< \"$l_kfile\")\" fi # If the profile name exist, continue checks if [ -n \"$l_gpname\" ]; then l_gpdir=\"/etc/dconf/db/$l_gpname.d\" # Check if profile file exists if grep -Pq -- \"^\\h*system-db:$l_gpname\\b\" /etc/dconf/profile/*; then l_output=\"$l_output\\n - dconf database profile file \\\"$(grep -Pl -- \"^\\h*system-db:$l_gpname\\b\" /etc/dconf/profile/*)\\\" exists\" else l_output2=\"$l_output2\\n - dconf database profile isn't set\" fi # Check if the dconf database file exists if [ -f \"/etc/dconf/db/$l_gpname\" ]; then l_output=\"$l_output\\n - The dconf database \\\"$l_gpname\\\" exists\" else l_output2=\"$l_output2\\n - The dconf database \\\"$l_gpname\\\" doesn't exist\" fi # check if the dconf database directory exists if [ -d \"$l_gpdir\" ]; then l_output=\"$l_output\\n - The dconf directory \\\"$l_gpdir\\\" exitst\" else l_output2=\"$l_output2\\n - The dconf directory \\\"$l_gpdir\\\" doesn't exist\" fi # check autorun-never setting if grep -Pqrs -- '^\\h*autorun-never\\h*=\\h*true\\b' \"$l_kfile\"; then l_output=\"$l_output\\n - \\\"autorun-never\\\" is set to true in: \\\"$l_kfile\\\"\" else l_output2=\"$l_output2\\n - \\\"autorun-never\\\" is not set correctly\" fi else # Settings don't exist. Nothing further to check l_output2=\"$l_output2\\n - \\\"autorun-never\\\" is not set\" fi else l_output=\"$l_output\\n - GNOME Desktop Manager package is not installed on the system\\n - Recommendation is not applicable\" fi # Report results. If no failures output in l_output2, we pass if [ -z \"$l_output2\" ]; then echo -e \"\\n- Audit Result:\\n ** PASS **\\n$l_output\\n\" else echo -e \"\\n- Audit Result:\\n ** FAIL **\\n - Reason(s) for audit failure:\\n$l_output2\\n\" [ -n \"$l_output\" ] && echo -e \"\\n- Correctly set:\\n$l_output\\n\" fi }" expect : "(?i)^[\\s]*\\**[\\s]*pass:?[\\s]*\\**$" type : CMD_EXEC description : "1.8.9 Ensure GDM autorun-never is not overridden" info : "The autorun-never setting allows the GNOME Desktop Display Manager to disable autorun through GDM. By using the lockdown mode in dconf, you can prevent users from changing specific settings. To lock down a dconf key or subpath, create a locks subdirectory in the keyfile directory. The files inside this directory contain a list of keys or subpaths to lock. Just as with the keyfiles, you may add any number of files to this directory. Example Lock File: # Lock desktop media-handling settings /org/gnome/desktop/media-handling/autorun-never Malware on removable media may take advantage of Autorun features when the media is inserted into a system and execute." solution : "Run the following script to ensure that autorun-never=true cannot be overridden: #!/usr/bin/env bash { # Check if GNOME Desktop Manager is installed. If package isn't installed, recommendation is Not Applicable\n # determine system's package manager l_pkgoutput=\"\" if command -v dpkg-query > /dev/null 2>&1; then l_pq=\"dpkg-query -W\" elif command -v rpm > /dev/null 2>&1; then l_pq=\"rpm -q\" fi # Check if GDM is installed l_pcl=\"gdm gdm3\" # Space separated list of packages to check for l_pn in $l_pcl; do $l_pq \"$l_pn\" > /dev/null 2>&1 && l_pkgoutput=\"y\" && echo -e \"\n - Package: \\\"$l_pn\\\" exists on the system\n - remediating configuration if needed\" done # Check configuration (If applicable) if [ -n \"$l_pkgoutput\" ]; then # Look for autorun to determine profile in use, needed for remaining tests l_kfd=\"/etc/dconf/db/$(grep -Psril '^\h*autorun-never\b' /etc/dconf/db/*/ | awk -F'/' '{split($(NF-1),a,\".\");print a[1]}').d\" #set directory of key file to be locked if [ -d \"$l_kfd\" ]; then # If key file directory doesn't exist, options can't be locked if grep -Priq '^\h*\/org/gnome\/desktop\/media-handling\/autorun-never\b' \"$l_kfd\"; then echo \" - \\\"autorun-never\\\" is locked in \\\"$(grep -Pril '^\h*\/org/gnome\/desktop\/media-handling\/autorun-never\b' \"$l_kfd\")\\\"\" else echo \" - creating entry to lock \\\"autorun-never\\\"\" [ ! -d \"$l_kfd\"/locks ] && echo \"creating directory $l_kfd/locks\" && mkdir \"$l_kfd\"/locks { echo -e '\n# Lock desktop media-handling autorun-never setting' echo '/org/gnome/desktop/media-handling/autorun-never' } >> \"$l_kfd\"/locks/00-media-autorun fi else echo -e \" - \\\"autorun-never\\\" is not set so it can not be locked\n - Please follow Recommendation \\\"Ensure GDM autorun-never is enabled\\\" and follow this Recommendation again\" fi # update dconf database dconf update else echo -e \" - GNOME Desktop Manager package is not installed on the system\n - Recommendation is not applicable\" fi }" reference : "800-171|3.8.7,800-171r3|03.08.07,800-53|MP-7,800-53r5|MP-7,CN-L3|8.5.4.1(c),CSCv7|8.5,CSCv8|10.3,CSF|PR.PT-2,GDPR|32.1.b,HIPAA|164.306(a)(1),HIPAA|164.312(a)(1),ISO-27001-2022|A.5.10,ISO-27001-2022|A.7.10,ISO/IEC-27001|A.8.3.1,ISO/IEC-27001|A.8.3.3,LEVEL|1A,NESA|T1.4.1" see_also : "https://workbench.cisecurity.org/benchmarks/20333" cmd : "#!/bin/bash { # Check if GNOME Desktop Manager is installed. If package isn't installed, recommendation is Not Applicable\\n # determine system's package manager l_pkgoutput=\"\" if command -v dpkg-query > /dev/null 2>&1; then l_pq=\"dpkg-query -W\" elif command -v rpm > /dev/null 2>&1; then l_pq=\"rpm -q\" fi # Check if GDM is installed l_pcl=\"gdm gdm3\" # Space separated list of packages to check for l_pn in $l_pcl; do $l_pq \"$l_pn\" > /dev/null 2>&1 && l_pkgoutput=\"$l_pkgoutput\\n - Package: \\\"$l_pn\\\" exists on the system\\n - checking configuration\" done # Check configuration (If applicable) if [ -n \"$l_pkgoutput\" ]; then l_output=\"\" l_output2=\"\" echo -e \"$l_pkgoutput\\n\" # Look for idle-delay to determine profile in use, needed for remaining tests l_kfd=\"/etc/dconf/db/$(grep -Psril '^\\h*autorun-never\\b' /etc/dconf/db/*/ | awk -F'/' '{split($(NF-1),a,\".\");print a[1]}').d\" #set directory of key file to be locked if [ -d \"$l_kfd\" ]; then # If key file directory doesn't exist, options can't be locked if grep -Priq '^\\h*\\/org/gnome\\/desktop\\/media-handling\\/autorun-never\\b' \"$l_kfd\"; then l_output=\"$l_output\\n - \\\"autorun-never\\\" is locked in \\\"$(grep -Pril '^\\h*\\/org/gnome\\/desktop\\/media-handling\\/autorun-never\\b' \"$l_kfd\")\\\"\" else l_output2=\"$l_output2\\n - \\\"autorun-never\\\" is not locked\" fi else l_output2=\"$l_output2\\n - \\\"autorun-never\\\" is not set so it can not be locked\" fi else l_output=\"$l_output\\n - GNOME Desktop Manager package is not installed on the system\\n - Recommendation is not applicable\" fi # Report results. If no failures output in l_output2, we pass if [ -z \"$l_output2\" ]; then echo -e \"\\n- Audit Result:\\n ** PASS **\\n$l_output\\n\" else echo -e \"\\n- Audit Result:\\n ** FAIL **\\n - Reason(s) for audit failure:\\n$l_output2\\n\" [ -n \"$l_output\" ] && echo -e \"\\n- Correctly set:\\n$l_output\\n\" fi }" expect : "(?i)^[\\s]*\\**[\\s]*pass:?[\\s]*\\**$" type : RPM_CHECK description : "autofs" rpm : "autofs-0.0.0-0" operator : "lte" type : RPM_CHECK description : "2.1.1 Ensure autofs services are not in use" info : "autofs allows automatic mounting of devices, typically including CD/DVDs and USB drives. 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 commands to stop autofs.service and remove autofs package: # systemctl stop autofs.service # zypper remove autofs - OR - - IF - the autofs package is required as a dependency: Run the following commands to stop and mask autofs.service : # systemctl stop autofs.service # systemctl mask autofs.service 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. There may be packages that are dependent on the autofs package. If the autofs package is removed, these dependent packages will be removed as well. Before removing the autofs package, review any dependent packages to determine if they are required on the system. - IF - a dependent package is required: stop and mask the autofs.service leaving the autofs package installed." reference : "800-171|3.8.7,800-171r3|03.08.07,800-53|MP-7,800-53r5|MP-7,CN-L3|8.5.4.1(c),CSCv7|8.5,CSCv8|10.3,CSF|PR.PT-2,GDPR|32.1.b,HIPAA|164.306(a)(1),HIPAA|164.312(a)(1),ISO-27001-2022|A.5.10,ISO-27001-2022|A.7.10,ISO/IEC-27001|A.8.3.1,ISO/IEC-27001|A.8.3.3,LEVEL|1A,NESA|T1.4.1" see_also : "https://workbench.cisecurity.org/benchmarks/20333" rpm : "autofs-0.0.0-0" operator : "lte" type : CMD_EXEC description : "autofs.service active" cmd : "/bin/systemctl is-active autofs.service 2>/dev/null | /bin/grep '^active' | /bin/awk '{print} END {if (NR == 0) print \"pass\" ; else print \"fail\"}'" expect : "(?i)^[\\s]*\\**[\\s]*pass:?[\\s]*\\**$" type : CMD_EXEC description : "autofs.service enabled" cmd : "/bin/systemctl is-enabled autofs.service 2>/dev/null | /bin/grep 'enabled' | /bin/awk '{print} END {if (NR == 0) print \"pass\" ; else print \"fail\"}'" expect : "(?i)^[\\s]*\\**[\\s]*pass:?[\\s]*\\**$" description : "2.1.1 Ensure autofs services are not in use" info : "autofs allows automatic mounting of devices, typically including CD/DVDs and USB drives. 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 commands to stop autofs.service and remove autofs package: # systemctl stop autofs.service # zypper remove autofs - OR - - IF - the autofs package is required as a dependency: Run the following commands to stop and mask autofs.service : # systemctl stop autofs.service # systemctl mask autofs.service 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. There may be packages that are dependent on the autofs package. If the autofs package is removed, these dependent packages will be removed as well. Before removing the autofs package, review any dependent packages to determine if they are required on the system. - IF - a dependent package is required: stop and mask the autofs.service leaving the autofs package installed." reference : "800-171|3.8.7,800-171r3|03.08.07,800-53|MP-7,800-53r5|MP-7,CN-L3|8.5.4.1(c),CSCv7|8.5,CSCv8|10.3,CSF|PR.PT-2,GDPR|32.1.b,HIPAA|164.306(a)(1),HIPAA|164.312(a)(1),ISO-27001-2022|A.5.10,ISO-27001-2022|A.7.10,ISO/IEC-27001|A.8.3.1,ISO/IEC-27001|A.8.3.3,LEVEL|1A,NESA|T1.4.1" see_also : "https://workbench.cisecurity.org/benchmarks/20333" show_output : YES type : CMD_EXEC description : "nfs-kernel-server installed" cmd : "/bin/dpkg -s nfs-kernel-server 2>&1 | /bin/grep -E '(^Status:|not installed)'" expect : "^Status: install ok" type : CMD_EXEC description : "Ensure nfs-server.service is not active" cmd : "/bin/systemctl is-active nfs-server.service 2>/dev/null | /bin/grep '^active' | /bin/awk '{print} END {if (NR == 0) print \"pass\" ; else print \"fail\"}'" expect : "^pass$" type : CMD_EXEC description : "nfs-server.service is not enabled" cmd : "/bin/systemctl is-enabled nfs-server.service 2>/dev/null | /bin/grep '^enabled' | /bin/awk '{print} END {if (NR == 0) print \"pass\" ; else print \"fail\"}'" expect : "^pass$" description : "2.1.10 Ensure network file system services are not in use" 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. If the system does not require access to network shares or the ability to provide network file system services for other host's network shares, it is recommended that the nfs-kernel-server package be removed to reduce the attack surface of the system." solution : "Run the following command to stop nfs-server.service and remove nfs-kernel-server package: # systemctl stop nfs-server.service # zypper remove nfs-kernel-server - OR - - IF - the nfs-kernel-server package is required as a dependency: Run the following commands to stop and mask the nfs-server.service : # systemctl stop nfs-server.service # systemctl mask nfs-server.service Impact: Many of the libvirt packages used by Enterprise Linux virtualization are dependent on the nfs-kernel-server package. If the nfs-kernel-server package is removed, these dependent packages will be removed as well. Before removing the nfs-kernel-server package, review any dependent packages to determine if they are required on the system. - IF - a dependent package is required: stop and mask the nfs-server.service leaving the nfs-kernel-server package installed." reference : "800-171|3.4.2,800-171|3.4.6,800-171|3.4.7,800-171r3|03.04.02,800-171r3|03.04.06,800-53|CM-6,800-53|CM-7,800-53r5|CM-6,800-53r5|CM-7,CSCv7|9.2,CSCv8|4.8,CSF|PR.IP-1,CSF|PR.PT-3,CSF2.0|DE.CM-09,CSF2.0|PR.PS-01,GDPR|32.1.b,HIPAA|164.306(a)(1),ISO-27001-2022|A.8.9,ITSG-33|CM-6,ITSG-33|CM-7,LEVEL|1A,NIAv2|SS15a,PCI-DSSv3.2.1|2.2.2,SWIFT-CSCv1|2.3" see_also : "https://workbench.cisecurity.org/benchmarks/20333" show_output : YES type : CMD_EXEC description : "2.1.10 Ensure network file system services are not in use" 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. If the system does not require access to network shares or the ability to provide network file system services for other host's network shares, it is recommended that the nfs-kernel-server package be removed to reduce the attack surface of the system." solution : "Run the following command to stop nfs-server.service and remove nfs-kernel-server package: # systemctl stop nfs-server.service # zypper remove nfs-kernel-server - OR - - IF - the nfs-kernel-server package is required as a dependency: Run the following commands to stop and mask the nfs-server.service : # systemctl stop nfs-server.service # systemctl mask nfs-server.service Impact: Many of the libvirt packages used by Enterprise Linux virtualization are dependent on the nfs-kernel-server package. If the nfs-kernel-server package is removed, these dependent packages will be removed as well. Before removing the nfs-kernel-server package, review any dependent packages to determine if they are required on the system. - IF - a dependent package is required: stop and mask the nfs-server.service leaving the nfs-kernel-server package installed." reference : "800-171|3.4.2,800-171|3.4.6,800-171|3.4.7,800-171r3|03.04.02,800-171r3|03.04.06,800-53|CM-6,800-53|CM-7,800-53r5|CM-6,800-53r5|CM-7,CSCv7|9.2,CSCv8|4.8,CSF|PR.IP-1,CSF|PR.PT-3,CSF2.0|DE.CM-09,CSF2.0|PR.PS-01,GDPR|32.1.b,HIPAA|164.306(a)(1),ISO-27001-2022|A.8.9,ITSG-33|CM-6,ITSG-33|CM-7,LEVEL|1A,NIAv2|SS15a,PCI-DSSv3.2.1|2.2.2,SWIFT-CSCv1|2.3" see_also : "https://workbench.cisecurity.org/benchmarks/20333" cmd : "/bin/dpkg -s nfs-kernel-server 2>&1 | /bin/grep -E '(^Status:|not installed)'" expect : "(^Status: deinstall ok|not installed)" type : RPM_CHECK description : "ypserv installed" rpm : "ypserv-0.0.0-0" operator : "gt" required : YES type : CMD_EXEC description : "ypserv.service active" cmd : "/bin/systemctl is-active ypserv.service 2>/dev/null | /bin/grep '^active' | /bin/awk '{print} END {if (NR == 0) print \"pass\" ; else print \"fail\"}'" expect : "(?i)^[\\s]*\\**[\\s]*pass:?[\\s]*\\**$" type : CMD_EXEC description : "ypserv.service enabled" cmd : "/bin/systemctl is-enabled ypserv.service 2>/dev/null | /bin/grep 'enabled' | /bin/awk '{print} END {if (NR == 0) print \"pass\" ; else print \"fail\"}'" expect : "(?i)^[\\s]*\\**[\\s]*pass:?[\\s]*\\**$" description : "2.1.11 Ensure nis server services are not in use" 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. 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 commands to stop ypserv.service and remove ypserv package: # systemctl stop ypserv.service # zypper remove ypserv - OR - - IF - the ypserv package is required as a dependency: Run the following commands to stop and mask ypserv.service : # systemctl stop ypserv.service # systemctl mask ypserv.service Impact: There may be packages that are dependent on the ypserv package. If the ypserv package is removed, these dependent packages will be removed as well. Before removing the ypserv package, review any dependent packages to determine if they are required on the system. - IF - a dependent package is required: stop and mask the ypserv.service leaving the ypserv package installed." reference : "800-171|3.4.2,800-171|3.4.6,800-171|3.4.7,800-171r3|03.04.02,800-171r3|03.04.06,800-53|CM-6,800-53|CM-7,800-53r5|CM-6,800-53r5|CM-7,CSCv7|9.2,CSCv8|4.8,CSF|PR.IP-1,CSF|PR.PT-3,CSF2.0|DE.CM-09,CSF2.0|PR.PS-01,GDPR|32.1.b,HIPAA|164.306(a)(1),ISO-27001-2022|A.8.9,ITSG-33|CM-6,ITSG-33|CM-7,LEVEL|1A,NIAv2|SS15a,PCI-DSSv3.2.1|2.2.2,SWIFT-CSCv1|2.3" see_also : "https://workbench.cisecurity.org/benchmarks/20333" show_output : YES type : RPM_CHECK description : "2.1.11 Ensure nis server services are not in use" 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. 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 commands to stop ypserv.service and remove ypserv package: # systemctl stop ypserv.service # zypper remove ypserv - OR - - IF - the ypserv package is required as a dependency: Run the following commands to stop and mask ypserv.service : # systemctl stop ypserv.service # systemctl mask ypserv.service Impact: There may be packages that are dependent on the ypserv package. If the ypserv package is removed, these dependent packages will be removed as well. Before removing the ypserv package, review any dependent packages to determine if they are required on the system. - IF - a dependent package is required: stop and mask the ypserv.service leaving the ypserv package installed." reference : "800-171|3.4.2,800-171|3.4.6,800-171|3.4.7,800-171r3|03.04.02,800-171r3|03.04.06,800-53|CM-6,800-53|CM-7,800-53r5|CM-6,800-53r5|CM-7,CSCv7|9.2,CSCv8|4.8,CSF|PR.IP-1,CSF|PR.PT-3,CSF2.0|DE.CM-09,CSF2.0|PR.PS-01,GDPR|32.1.b,HIPAA|164.306(a)(1),ISO-27001-2022|A.8.9,ITSG-33|CM-6,ITSG-33|CM-7,LEVEL|1A,NIAv2|SS15a,PCI-DSSv3.2.1|2.2.2,SWIFT-CSCv1|2.3" see_also : "https://workbench.cisecurity.org/benchmarks/20333" rpm : "ypserv-0.0.0-0" operator : "lte" type : RPM_CHECK description : "Cups installed" rpm : "cups-0.0.0-0" operator : "gt" required : YES type : CMD_EXEC description : "cups.socket cups.service active" cmd : "/bin/systemctl is-active cups.socket cups.service 2>/dev/null | /bin/grep '^active' | /bin/awk '{print} END {if (NR == 0) print \"pass\" ; else print \"fail\"}'" expect : "(?i)^[\\s]*\\**[\\s]*pass:?[\\s]*\\**$" type : CMD_EXEC description : "cups.socket cups.service enabled" cmd : "/bin/systemctl is-enabled cups.socket cups.service 2>/dev/null | /bin/grep 'enabled' | /bin/awk '{print} END {if (NR == 0) print \"pass\" ; else print \"fail\"}'" expect : "(?i)^[\\s]*\\**[\\s]*pass:?[\\s]*\\**$" description : "2.1.12 Ensure print server services are not in use" 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. If the system does not need to print jobs or accept print jobs from other systems, it is recommended that CUPS be removed to reduce the potential attack surface." solution : "Run the following commands to stop cups.socket and cups.service and remove the cups package: # systemctl stop cups.socket cups.service # zypper remove cups - OR - - IF - the cups package is required as a dependency: Run the following commands to stop and mask the cups.socket and cups.service : # systemctl stop cups.socket cups.service # systemctl mask cups.socket cups.service Impact: Removing the cups package, or disabling cups.socket and/or cups.service will prevent printing from the system, a common task for workstation systems. There may be packages that are dependent on the cups package. If the cups package is removed, these dependent packages will be removed as well. Before removing the cups package, review any dependent packages to determine if they are required on the system. - IF - a dependent package is required: stop and mask cups.socket and cups.service leaving the cups package installed." reference : "800-171|3.4.2,800-171|3.4.6,800-171|3.4.7,800-171r3|03.04.02,800-171r3|03.04.06,800-53|CM-6,800-53|CM-7,800-53r5|CM-6,800-53r5|CM-7,CSCv7|9.2,CSCv8|4.8,CSF|PR.IP-1,CSF|PR.PT-3,CSF2.0|DE.CM-09,CSF2.0|PR.PS-01,GDPR|32.1.b,HIPAA|164.306(a)(1),ISO-27001-2022|A.8.9,ITSG-33|CM-6,ITSG-33|CM-7,LEVEL|1A,NIAv2|SS15a,PCI-DSSv3.2.1|2.2.2,SWIFT-CSCv1|2.3" see_also : "https://workbench.cisecurity.org/benchmarks/20333" show_output : YES type : RPM_CHECK description : "2.1.12 Ensure print server services are not in use" 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. If the system does not need to print jobs or accept print jobs from other systems, it is recommended that CUPS be removed to reduce the potential attack surface." solution : "Run the following commands to stop cups.socket and cups.service and remove the cups package: # systemctl stop cups.socket cups.service # zypper remove cups - OR - - IF - the cups package is required as a dependency: Run the following commands to stop and mask the cups.socket and cups.service : # systemctl stop cups.socket cups.service # systemctl mask cups.socket cups.service Impact: Removing the cups package, or disabling cups.socket and/or cups.service will prevent printing from the system, a common task for workstation systems. There may be packages that are dependent on the cups package. If the cups package is removed, these dependent packages will be removed as well. Before removing the cups package, review any dependent packages to determine if they are required on the system. - IF - a dependent package is required: stop and mask cups.socket and cups.service leaving the cups package installed." reference : "800-171|3.4.2,800-171|3.4.6,800-171|3.4.7,800-171r3|03.04.02,800-171r3|03.04.06,800-53|CM-6,800-53|CM-7,800-53r5|CM-6,800-53r5|CM-7,CSCv7|9.2,CSCv8|4.8,CSF|PR.IP-1,CSF|PR.PT-3,CSF2.0|DE.CM-09,CSF2.0|PR.PS-01,GDPR|32.1.b,HIPAA|164.306(a)(1),ISO-27001-2022|A.8.9,ITSG-33|CM-6,ITSG-33|CM-7,LEVEL|1A,NIAv2|SS15a,PCI-DSSv3.2.1|2.2.2,SWIFT-CSCv1|2.3" see_also : "https://workbench.cisecurity.org/benchmarks/20333" rpm : "cups-0.0.0-0" operator : "lte" type : RPM_CHECK description : "rpcbind exist" rpm : "rpcbind-0.0.0-0" operator : "gt" required : YES type : CMD_EXEC description : "rpcbind.socket rpcbind.service active" cmd : "/bin/systemctl is-active rpcbind.socket rpcbind.service 2>/dev/null | /bin/grep '^active' | /bin/awk '{print} END {if (NR == 0) print \"pass\" ; else print \"fail\"}'" expect : "(?i)^[\\s]*\\**[\\s]*pass:?[\\s]*\\**$" type : CMD_EXEC description : "rpcbind.socket rpcbind.service enabled" cmd : "/bin/systemctl is-enabled rpcbind.socket rpcbind.service 2>/dev/null | /bin/grep 'enabled' | /bin/awk '{print} END {if (NR == 0) print \"pass\" ; else print \"fail\"}'" expect : "(?i)^[\\s]*\\**[\\s]*pass:?[\\s]*\\**$" description : "2.1.13 Ensure rpcbind services are not in use" info : "The rpcbind utility maps 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. Portmapper is an RPC service, which always listens on tcp and udp 111, and is used to map other RPC services (such as nfs, nlockmgr, quotad, mountd, etc.) to their corresponding port number on the server. When a remote host makes an RPC call to that server, it first consults with portmap to determine where the RPC server is listening. A small request (~82 bytes via UDP) sent to the Portmapper generates a large response (7x to 28x amplification), which makes it a suitable tool for DDoS attacks. If rpcbind is not required, it is recommended to remove rpcbind package to reduce the potential attack surface." solution : "Run the following commands to stop rpcbind.socket and rpcbind.service and remove the rpcbind package: # systemctl stop rpcbind.socket rpcbind.service # zypper remove rpcbind - OR - - IF - the rpcbind package is required as a dependency: Run the following commands to stop and mask the rpcbind.socket and rpcbind.service : # systemctl stop rpcbind.socket rpcbind.service # systemctl mask rpcbind.socket rpcbind.service Impact: Many of the libvirt packages used by Enterprise Linux virtualization, and the nfs-utils package used for The Network File System (NFS), are dependent on the rpcbind package. If the rpcbind package is removed, these dependent packages will be removed as well. Before removing the rpcbind package, review any dependent packages to determine if they are required on the system. - IF - a dependent package is required: stop and mask the rpcbind.socket and rpcbind.service leaving the rpcbind package installed." reference : "800-171|3.4.2,800-171|3.4.6,800-171|3.4.7,800-171r3|03.04.02,800-171r3|03.04.06,800-53|CM-6,800-53|CM-7,800-53r5|CM-6,800-53r5|CM-7,CSCv7|9.2,CSCv8|4.8,CSF|PR.IP-1,CSF|PR.PT-3,CSF2.0|DE.CM-09,CSF2.0|PR.PS-01,GDPR|32.1.b,HIPAA|164.306(a)(1),ISO-27001-2022|A.8.9,ITSG-33|CM-6,ITSG-33|CM-7,LEVEL|1A,NIAv2|SS15a,PCI-DSSv3.2.1|2.2.2,SWIFT-CSCv1|2.3" see_also : "https://workbench.cisecurity.org/benchmarks/20333" show_output : YES type : RPM_CHECK description : "2.1.13 Ensure rpcbind services are not in use" info : "The rpcbind utility maps 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. Portmapper is an RPC service, which always listens on tcp and udp 111, and is used to map other RPC services (such as nfs, nlockmgr, quotad, mountd, etc.) to their corresponding port number on the server. When a remote host makes an RPC call to that server, it first consults with portmap to determine where the RPC server is listening. A small request (~82 bytes via UDP) sent to the Portmapper generates a large response (7x to 28x amplification), which makes it a suitable tool for DDoS attacks. If rpcbind is not required, it is recommended to remove rpcbind package to reduce the potential attack surface." solution : "Run the following commands to stop rpcbind.socket and rpcbind.service and remove the rpcbind package: # systemctl stop rpcbind.socket rpcbind.service # zypper remove rpcbind - OR - - IF - the rpcbind package is required as a dependency: Run the following commands to stop and mask the rpcbind.socket and rpcbind.service : # systemctl stop rpcbind.socket rpcbind.service # systemctl mask rpcbind.socket rpcbind.service Impact: Many of the libvirt packages used by Enterprise Linux virtualization, and the nfs-utils package used for The Network File System (NFS), are dependent on the rpcbind package. If the rpcbind package is removed, these dependent packages will be removed as well. Before removing the rpcbind package, review any dependent packages to determine if they are required on the system. - IF - a dependent package is required: stop and mask the rpcbind.socket and rpcbind.service leaving the rpcbind package installed." reference : "800-171|3.4.2,800-171|3.4.6,800-171|3.4.7,800-171r3|03.04.02,800-171r3|03.04.06,800-53|CM-6,800-53|CM-7,800-53r5|CM-6,800-53r5|CM-7,CSCv7|9.2,CSCv8|4.8,CSF|PR.IP-1,CSF|PR.PT-3,CSF2.0|DE.CM-09,CSF2.0|PR.PS-01,GDPR|32.1.b,HIPAA|164.306(a)(1),ISO-27001-2022|A.8.9,ITSG-33|CM-6,ITSG-33|CM-7,LEVEL|1A,NIAv2|SS15a,PCI-DSSv3.2.1|2.2.2,SWIFT-CSCv1|2.3" see_also : "https://workbench.cisecurity.org/benchmarks/20333" rpm : "rpcbind-0.0.0-0" operator : "lte" type : RPM_CHECK description : "Check rsync installed" rpm : "rsync-daemon-0.0.0-0" operator : "gt" required : YES type : CMD_EXEC description : "Check rsync installed" cmd : "/bin/systemctl is-enabled rsyncd.socket rsyncd.service 2>/dev/null | /bin/grep 'enabled' | /bin/awk '{print} END {if (NR == 0) print \"pass\" ; else print \"fail\"}'" expect : "(?i)^[\\s]*\\**[\\s]*pass:?[\\s]*\\**$" type : CMD_EXEC description : "rsyncd.socket rsyncd.service active" cmd : "/bin/systemctl is-active rsyncd.socket rsyncd.service 2>/dev/null | /bin/grep '^active' | /bin/awk '{print} END {if (NR == 0) print \"pass\" ; else print \"fail\"}'" expect : "(?i)^[\\s]*\\**[\\s]*pass:?[\\s]*\\**$" description : "2.1.14 Ensure rsync services are not in use" info : "The rsyncd.service can be used to synchronize files between systems over network links. Unless required, the rsync package should be removed to reduce the potential attack surface. The rsyncd.service presents a security risk as it uses unencrypted protocols for communication." solution : "Run the following commands to stop rsyncd.socket and rsyncd.service and remove the rsync package: # systemctl stop rsyncd.socket rsyncd.service # zypper remove rsync - OR - - IF - the rsync package is required as a dependency: Run the following commands to stop and mask the rsyncd.socket and rsyncd.service : # systemctl stop rsyncd.socket rsyncd.service # systemctl mask rsyncd.socket rsyncd.service Impact: There may be packages that are dependent on the rsync package. If the rsync package is removed, these dependent packages will be removed as well. Before removing the rsync package, review any dependent packages to determine if they are required on the system. - IF - a dependent package is required: stop and mask the rsyncd.socket and rsyncd.service leaving the rsync-daemon package installed." reference : "800-171|3.4.2,800-171|3.4.6,800-171|3.4.7,800-171r3|03.04.02,800-171r3|03.04.06,800-53|CM-6,800-53|CM-7,800-53r5|CM-6,800-53r5|CM-7,CSCv7|9.2,CSCv8|4.8,CSF|PR.IP-1,CSF|PR.PT-3,CSF2.0|DE.CM-09,CSF2.0|PR.PS-01,GDPR|32.1.b,HIPAA|164.306(a)(1),ISO-27001-2022|A.8.9,ITSG-33|CM-6,ITSG-33|CM-7,LEVEL|1A,NIAv2|SS15a,PCI-DSSv3.2.1|2.2.2,SWIFT-CSCv1|2.3" see_also : "https://workbench.cisecurity.org/benchmarks/20333" show_output : YES type : RPM_CHECK description : "2.1.14 Ensure rsync services are not in use" info : "The rsyncd.service can be used to synchronize files between systems over network links. Unless required, the rsync package should be removed to reduce the potential attack surface. The rsyncd.service presents a security risk as it uses unencrypted protocols for communication." solution : "Run the following commands to stop rsyncd.socket and rsyncd.service and remove the rsync package: # systemctl stop rsyncd.socket rsyncd.service # zypper remove rsync - OR - - IF - the rsync package is required as a dependency: Run the following commands to stop and mask the rsyncd.socket and rsyncd.service : # systemctl stop rsyncd.socket rsyncd.service # systemctl mask rsyncd.socket rsyncd.service Impact: There may be packages that are dependent on the rsync package. If the rsync package is removed, these dependent packages will be removed as well. Before removing the rsync package, review any dependent packages to determine if they are required on the system. - IF - a dependent package is required: stop and mask the rsyncd.socket and rsyncd.service leaving the rsync-daemon package installed." reference : "800-171|3.4.2,800-171|3.4.6,800-171|3.4.7,800-171r3|03.04.02,800-171r3|03.04.06,800-53|CM-6,800-53|CM-7,800-53r5|CM-6,800-53r5|CM-7,CSCv7|9.2,CSCv8|4.8,CSF|PR.IP-1,CSF|PR.PT-3,CSF2.0|DE.CM-09,CSF2.0|PR.PS-01,GDPR|32.1.b,HIPAA|164.306(a)(1),ISO-27001-2022|A.8.9,ITSG-33|CM-6,ITSG-33|CM-7,LEVEL|1A,NIAv2|SS15a,PCI-DSSv3.2.1|2.2.2,SWIFT-CSCv1|2.3" see_also : "https://workbench.cisecurity.org/benchmarks/20333" rpm : "rsync-daemon-0.0.0-0" operator : "lte" type : RPM_CHECK description : "net-snmp is installed" rpm : "net-snmp-0.0.0-0" operator : "gt" required : YES type : CMD_EXEC description : "snmpd.service enabled" cmd : "/bin/systemctl is-enabled snmpd.service 2>/dev/null | /bin/grep 'enabled' | /bin/awk '{print} END {if (NR == 0) print \"pass\" ; else print \"fail\"}'" expect : "(?i)^[\\s]*\\**[\\s]*pass:?[\\s]*\\**$" type : CMD_EXEC description : "snmpd.service active" cmd : "/bin/systemctl is-active snmpd.service 2>/dev/null | /bin/grep '^active' | /bin/awk '{print} END {if (NR == 0) print \"pass\" ; else print \"fail\"}'" expect : "(?i)^[\\s]*\\**[\\s]*pass:?[\\s]*\\**$" description : "2.1.15 Ensure snmp services are not in use" info : "Simple Network Management Protocol (SNMP) is a widely used protocol for monitoring the health and welfare of network equipment, computer equipment and devices like UPSs. Net-SNMP is a suite of applications used to implement SNMPv1 (RFC 1157), SNMPv2 (RFCs 1901-1908), and SNMPv3 (RFCs 3411-3418) using both IPv4 and IPv6. Support for SNMPv2 classic (a.k.a. \"SNMPv2 historic\" - RFCs 1441-1452) was dropped with the 4.0 release of the UCD-snmp package. 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. The SNMP server can communicate using SNMPv1 which transmits data in the clear and does not require authentication to execute commands. SNMPv3 replaces the simple/clear text password sharing used in SNMPv2 with more securely encoded parameters. If the the SNMP service is not required, the net-snmp package should be removed to reduce the attack surface of the system. Note: If SNMP is required: - The server should be configured for SNMP v3 only. User Authentication and Message Encryption should be configured. - If SNMP v2 is absolutely necessary, modify the community strings' values." solution : "Run the following commands to stop snmpd.service and remove net-snmp package: # systemctl stop snmpd.service # zypper remove net-snmp - OR - If the package is required for dependencies: Run the following commands to stop and mask the snmpd.service : # systemctl stop snmpd.service # systemctl mask snmpd.service Impact: There may be packages that are dependent on the net-snmp package. If the net-snmp package is removed, these packages will be removed as well. Before removing the net-snmp package, review any dependent packages to determine if they are required on the system. If a dependent package is required, stop and mask the snmpd.service leaving the net-snmp package installed." reference : "800-171|3.4.2,800-171|3.4.6,800-171|3.4.7,800-171r3|03.04.02,800-171r3|03.04.06,800-53|CM-6,800-53|CM-7,800-53r5|CM-6,800-53r5|CM-7,CSCv7|9.2,CSCv8|4.8,CSF|PR.IP-1,CSF|PR.PT-3,CSF2.0|DE.CM-09,CSF2.0|PR.PS-01,GDPR|32.1.b,HIPAA|164.306(a)(1),ISO-27001-2022|A.8.9,ITSG-33|CM-6,ITSG-33|CM-7,LEVEL|1A,NIAv2|SS15a,PCI-DSSv3.2.1|2.2.2,SWIFT-CSCv1|2.3" see_also : "https://workbench.cisecurity.org/benchmarks/20333" show_output : YES type : RPM_CHECK description : "2.1.15 Ensure snmp services are not in use" info : "Simple Network Management Protocol (SNMP) is a widely used protocol for monitoring the health and welfare of network equipment, computer equipment and devices like UPSs. Net-SNMP is a suite of applications used to implement SNMPv1 (RFC 1157), SNMPv2 (RFCs 1901-1908), and SNMPv3 (RFCs 3411-3418) using both IPv4 and IPv6. Support for SNMPv2 classic (a.k.a. \"SNMPv2 historic\" - RFCs 1441-1452) was dropped with the 4.0 release of the UCD-snmp package. 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. The SNMP server can communicate using SNMPv1 which transmits data in the clear and does not require authentication to execute commands. SNMPv3 replaces the simple/clear text password sharing used in SNMPv2 with more securely encoded parameters. If the the SNMP service is not required, the net-snmp package should be removed to reduce the attack surface of the system. Note: If SNMP is required: - The server should be configured for SNMP v3 only. User Authentication and Message Encryption should be configured. - If SNMP v2 is absolutely necessary, modify the community strings' values." solution : "Run the following commands to stop snmpd.service and remove net-snmp package: # systemctl stop snmpd.service # zypper remove net-snmp - OR - If the package is required for dependencies: Run the following commands to stop and mask the snmpd.service : # systemctl stop snmpd.service # systemctl mask snmpd.service Impact: There may be packages that are dependent on the net-snmp package. If the net-snmp package is removed, these packages will be removed as well. Before removing the net-snmp package, review any dependent packages to determine if they are required on the system. If a dependent package is required, stop and mask the snmpd.service leaving the net-snmp package installed." reference : "800-171|3.4.2,800-171|3.4.6,800-171|3.4.7,800-171r3|03.04.02,800-171r3|03.04.06,800-53|CM-6,800-53|CM-7,800-53r5|CM-6,800-53r5|CM-7,CSCv7|9.2,CSCv8|4.8,CSF|PR.IP-1,CSF|PR.PT-3,CSF2.0|DE.CM-09,CSF2.0|PR.PS-01,GDPR|32.1.b,HIPAA|164.306(a)(1),ISO-27001-2022|A.8.9,ITSG-33|CM-6,ITSG-33|CM-7,LEVEL|1A,NIAv2|SS15a,PCI-DSSv3.2.1|2.2.2,SWIFT-CSCv1|2.3" see_also : "https://workbench.cisecurity.org/benchmarks/20333" rpm : "net-snmp-0.0.0-0" operator : "lte" type : RPM_CHECK description : "telnet-server is installed" rpm : "telnet-server-0.0.0-0" operator : "gt" required : YES type : CMD_EXEC description : "telnet.socket active" cmd : "/bin/systemctl is-active telnet.socket 2>/dev/null | /bin/grep '^active' | /bin/awk '{print} END {if (NR == 0) print \"pass\" ; else print \"fail\"}'" expect : "(?i)^[\\s]*\\**[\\s]*pass:?[\\s]*\\**$" type : CMD_EXEC description : "telnet.socket enabled" cmd : "/bin/systemctl is-enabled telnet.socket 2>/dev/null | /bin/grep 'enabled' | /bin/awk '{print} END {if (NR == 0) print \"pass\" ; else print \"fail\"}'" expect : "(?i)^[\\s]*\\**[\\s]*pass:?[\\s]*\\**$" description : "2.1.16 Ensure telnet server services are not in use" info : "The telnet-server package contains the telnet daemon, which accepts connections from users from other systems via the telnet protocol. The telnet protocol is insecure and unencrypted. The use of an unencrypted transmission medium could allow a user with access to sniff network traffic the ability to steal credentials. The ssh package provides an encrypted session and stronger security." solution : "Run the following commands to stop telnet.socket and remove the telnet-server package: # systemctl stop telnet.socket # zypper remove telnet-server - OR - - IF - a package is installed and is required for dependencies: Run the following commands to stop and mask telnet.socket : # systemctl stop telnet.socket # systemctl mask telnet.socket Impact: There may be packages that are dependent on the telnet-server package. If the telnet-server package is removed, these dependent packages will be removed as well. Before removing the telnet-server package, review any dependent packages to determine if they are required on the system. - IF - a dependent package is required: stop and mask the telnet.socket leaving the telnet-server package installed." reference : "800-171|3.4.2,800-171|3.4.6,800-171|3.4.7,800-171r3|03.04.02,800-171r3|03.04.06,800-53|CM-6,800-53|CM-7,800-53r5|CM-6,800-53r5|CM-7,CSCv7|2.6,CSCv7|9.2,CSCv8|4.8,CSF|PR.IP-1,CSF|PR.PT-3,CSF2.0|DE.CM-09,CSF2.0|PR.PS-01,GDPR|32.1.b,HIPAA|164.306(a)(1),ISO-27001-2022|A.8.9,ITSG-33|CM-6,ITSG-33|CM-7,LEVEL|1A,NIAv2|SS15a,PCI-DSSv3.2.1|2.2.2,SWIFT-CSCv1|2.3" see_also : "https://workbench.cisecurity.org/benchmarks/20333" show_output : YES type : RPM_CHECK description : "2.1.16 Ensure telnet server services are not in use" info : "The telnet-server package contains the telnet daemon, which accepts connections from users from other systems via the telnet protocol. The telnet protocol is insecure and unencrypted. The use of an unencrypted transmission medium could allow a user with access to sniff network traffic the ability to steal credentials. The ssh package provides an encrypted session and stronger security." solution : "Run the following commands to stop telnet.socket and remove the telnet-server package: # systemctl stop telnet.socket # zypper remove telnet-server - OR - - IF - a package is installed and is required for dependencies: Run the following commands to stop and mask telnet.socket : # systemctl stop telnet.socket # systemctl mask telnet.socket Impact: There may be packages that are dependent on the telnet-server package. If the telnet-server package is removed, these dependent packages will be removed as well. Before removing the telnet-server package, review any dependent packages to determine if they are required on the system. - IF - a dependent package is required: stop and mask the telnet.socket leaving the telnet-server package installed." reference : "800-171|3.4.2,800-171|3.4.6,800-171|3.4.7,800-171r3|03.04.02,800-171r3|03.04.06,800-53|CM-6,800-53|CM-7,800-53r5|CM-6,800-53r5|CM-7,CSCv7|2.6,CSCv7|9.2,CSCv8|4.8,CSF|PR.IP-1,CSF|PR.PT-3,CSF2.0|DE.CM-09,CSF2.0|PR.PS-01,GDPR|32.1.b,HIPAA|164.306(a)(1),ISO-27001-2022|A.8.9,ITSG-33|CM-6,ITSG-33|CM-7,LEVEL|1A,NIAv2|SS15a,PCI-DSSv3.2.1|2.2.2,SWIFT-CSCv1|2.3" see_also : "https://workbench.cisecurity.org/benchmarks/20333" rpm : "telnet-server-0.0.0-0" operator : "lte" type : RPM_CHECK description : "tftp-server is installed" rpm : "tftp-server-0.0.0-0" operator : "gt" required : YES type : CMD_EXEC description : "tftp.socket tftp.service active" cmd : "/bin/systemctl is-active tftp.socket tftp.service 2>/dev/null | /bin/grep '^active' | /bin/awk '{print} END {if (NR == 0) print \"pass\" ; else print \"fail\"}'" expect : "(?i)^[\\s]*\\**[\\s]*pass:?[\\s]*\\**$" type : CMD_EXEC description : "tftp.socket tftp.service enabled" cmd : "/bin/systemctl is-enabled tftp.socket tftp.service 2>/dev/null | /bin/grep 'enabled' | /bin/awk '{print} END {if (NR == 0) print \"pass\" ; else print \"fail\"}'" expect : "(?i)^[\\s]*\\**[\\s]*pass:?[\\s]*\\**$" description : "2.1.17 Ensure tftp server services are not in use" info : "Trivial File Transfer Protocol (TFTP) is a simple protocol for exchanging files between two TCP/IP machines. TFTP servers allow connections from a TFTP Client for sending and receiving files. Unless there is a need to run the system as a TFTP server, it is recommended that the package be removed to reduce the potential attack surface. TFTP does not have built-in encryption, access control or authentication. This makes it very easy for an attacker to exploit TFTP to gain access to files" solution : "Run the following commands to stop tftp.socket and tftp.service and remove the tftp-server package: # systemctl stop tftp.socket tftp.service # zypper remove tftp-server - OR - - IF - the tftp-server package is required as a dependency: Run the following commands to stop and mask tftp.socket and tftp.service : # systemctl stop tftp.socket tftp.service # systemctl mask tftp.socket tftp.service Impact: TFTP is often used to provide files for network booting such as for PXE based installation of servers. There may be packages that are dependent on the tftp-server package. If the tftp-server package is removed, these dependent packages will be removed as well. Before removing the tftp-server package, review any dependent packages to determine if they are required on the system. - IF - a dependent package is required: stop and mask the tftp.socket and tftp.service leaving the tftp-server package installed." reference : "800-171|3.4.2,800-171|3.4.6,800-171|3.4.7,800-171r3|03.04.02,800-171r3|03.04.06,800-53|CM-6,800-53|CM-7,800-53r5|CM-6,800-53r5|CM-7,CSCv7|9.2,CSCv8|4.8,CSF|PR.IP-1,CSF|PR.PT-3,CSF2.0|DE.CM-09,CSF2.0|PR.PS-01,GDPR|32.1.b,HIPAA|164.306(a)(1),ISO-27001-2022|A.8.9,ITSG-33|CM-6,ITSG-33|CM-7,LEVEL|1A,NIAv2|SS15a,PCI-DSSv3.2.1|2.2.2,SWIFT-CSCv1|2.3" see_also : "https://workbench.cisecurity.org/benchmarks/20333" show_output : YES type : RPM_CHECK description : "2.1.17 Ensure tftp server services are not in use" info : "Trivial File Transfer Protocol (TFTP) is a simple protocol for exchanging files between two TCP/IP machines. TFTP servers allow connections from a TFTP Client for sending and receiving files. Unless there is a need to run the system as a TFTP server, it is recommended that the package be removed to reduce the potential attack surface. TFTP does not have built-in encryption, access control or authentication. This makes it very easy for an attacker to exploit TFTP to gain access to files" solution : "Run the following commands to stop tftp.socket and tftp.service and remove the tftp-server package: # systemctl stop tftp.socket tftp.service # zypper remove tftp-server - OR - - IF - the tftp-server package is required as a dependency: Run the following commands to stop and mask tftp.socket and tftp.service : # systemctl stop tftp.socket tftp.service # systemctl mask tftp.socket tftp.service Impact: TFTP is often used to provide files for network booting such as for PXE based installation of servers. There may be packages that are dependent on the tftp-server package. If the tftp-server package is removed, these dependent packages will be removed as well. Before removing the tftp-server package, review any dependent packages to determine if they are required on the system. - IF - a dependent package is required: stop and mask the tftp.socket and tftp.service leaving the tftp-server package installed." reference : "800-171|3.4.2,800-171|3.4.6,800-171|3.4.7,800-171r3|03.04.02,800-171r3|03.04.06,800-53|CM-6,800-53|CM-7,800-53r5|CM-6,800-53r5|CM-7,CSCv7|9.2,CSCv8|4.8,CSF|PR.IP-1,CSF|PR.PT-3,CSF2.0|DE.CM-09,CSF2.0|PR.PS-01,GDPR|32.1.b,HIPAA|164.306(a)(1),ISO-27001-2022|A.8.9,ITSG-33|CM-6,ITSG-33|CM-7,LEVEL|1A,NIAv2|SS15a,PCI-DSSv3.2.1|2.2.2,SWIFT-CSCv1|2.3" see_also : "https://workbench.cisecurity.org/benchmarks/20333" rpm : "tftp-server-0.0.0-0" operator : "lte" type : RPM_CHECK description : "squid installed" rpm : "squid-0.0.0-0" operator : "gt" required : YES type : CMD_EXEC description : "squid.service active" cmd : "/bin/systemctl is-active squid.service 2>/dev/null | /bin/grep '^active' | /bin/awk '{print} END {if (NR == 0) print \"pass\" ; else print \"fail\"}'" expect : "(?i)^[\\s]*\\**[\\s]*pass:?[\\s]*\\**$" type : CMD_EXEC description : "squid.service enabled" cmd : "/bin/systemctl is-enabled squid.service 2>/dev/null | /bin/grep 'enabled' | /bin/awk '{print} END {if (NR == 0) print \"pass\" ; else print \"fail\"}'" expect : "(?i)^[\\s]*\\**[\\s]*pass:?[\\s]*\\**$" description : "2.1.18 Ensure web proxy server services are not in use" info : "Squid is a standard proxy server used in many distributions and environments. Unless a system is specifically set up to act as a proxy server, it is recommended that the squid package be removed to reduce the potential attack surface. Note: Several HTTP proxy servers exist. These should be checked and removed unless required." solution : "Run the following commands to stop squid.service and remove the squid package: # systemctl stop squid.service # zypper remove squid - OR - If the squid package is required as a dependency: Run the following commands to stop and mask the squid.service : # systemctl stop squid.service # systemctl mask squid.service Impact: There may be packages that are dependent on the squid package. If the squid package is removed, these dependent packages will be removed as well. Before removing the squid package, review any dependent packages to determine if they are required on the system. - IF - a dependent package is required: stop and mask the squid.service leaving the squid package installed." reference : "800-171|3.4.2,800-171|3.4.6,800-171|3.4.7,800-171r3|03.04.02,800-171r3|03.04.06,800-53|CM-6,800-53|CM-7,800-53r5|CM-6,800-53r5|CM-7,CSCv7|9.2,CSCv8|4.8,CSF|PR.IP-1,CSF|PR.PT-3,CSF2.0|DE.CM-09,CSF2.0|PR.PS-01,GDPR|32.1.b,HIPAA|164.306(a)(1),ISO-27001-2022|A.8.9,ITSG-33|CM-6,ITSG-33|CM-7,LEVEL|1A,NIAv2|SS15a,PCI-DSSv3.2.1|2.2.2,SWIFT-CSCv1|2.3" see_also : "https://workbench.cisecurity.org/benchmarks/20333" show_output : YES type : RPM_CHECK description : "2.1.18 Ensure web proxy server services are not in use" info : "Squid is a standard proxy server used in many distributions and environments. Unless a system is specifically set up to act as a proxy server, it is recommended that the squid package be removed to reduce the potential attack surface. Note: Several HTTP proxy servers exist. These should be checked and removed unless required." solution : "Run the following commands to stop squid.service and remove the squid package: # systemctl stop squid.service # zypper remove squid - OR - If the squid package is required as a dependency: Run the following commands to stop and mask the squid.service : # systemctl stop squid.service # systemctl mask squid.service Impact: There may be packages that are dependent on the squid package. If the squid package is removed, these dependent packages will be removed as well. Before removing the squid package, review any dependent packages to determine if they are required on the system. - IF - a dependent package is required: stop and mask the squid.service leaving the squid package installed." reference : "800-171|3.4.2,800-171|3.4.6,800-171|3.4.7,800-171r3|03.04.02,800-171r3|03.04.06,800-53|CM-6,800-53|CM-7,800-53r5|CM-6,800-53r5|CM-7,CSCv7|9.2,CSCv8|4.8,CSF|PR.IP-1,CSF|PR.PT-3,CSF2.0|DE.CM-09,CSF2.0|PR.PS-01,GDPR|32.1.b,HIPAA|164.306(a)(1),ISO-27001-2022|A.8.9,ITSG-33|CM-6,ITSG-33|CM-7,LEVEL|1A,NIAv2|SS15a,PCI-DSSv3.2.1|2.2.2,SWIFT-CSCv1|2.3" see_also : "https://workbench.cisecurity.org/benchmarks/20333" rpm : "squid-0.0.0-0" operator : "lte" type : RPM_CHECK description : "apache2 services exist on the system" rpm : "apache2-0.0.0-0" operator : "gt" required : YES type : RPM_CHECK description : "nginx services exist on the system" rpm : "nginx-0.0.0-0" operator : "gt" required : YES type : CMD_EXEC description : "apache2.service nginx.service active" cmd : "/bin/systemctl is-active apache2.socket httpd.service nginx.service 2>/dev/null | /bin/grep '^active' | /bin/awk '{print} END {if (NR == 0) print \"pass\" ; else print \"fail\"}'" expect : "(?i)^[\\s]*\\**[\\s]*pass:?[\\s]*\\**$" type : CMD_EXEC description : "apache2.service nginx.service enabled" cmd : "/bin/systemctl is-enabled apache2.service nginx.service 2>/dev/null | /bin/grep 'enabled' | /bin/awk '{print} END {if (NR == 0) print \"pass\" ; else print \"fail\"}'" expect : "(?i)^[\\s]*\\**[\\s]*pass:?[\\s]*\\**$" description : "2.1.19 Ensure web server services are not in use" info : "Web servers provide the ability to host web site content. Unless there is a local site approved requirement to run a web server service on the system, web server packages should be removed to reduce the potential attack surface." solution : "Run the following commands to stop apache2.service and nginx.service and remove apache2 and nginx packages: # systemctl stop apache2.service nginx.service # zypper remove apache2 nginx - OR - - IF - a package is installed and is required for dependencies: Run the following commands to stop and mask apache2.service and nginx.service : # systemctl stop apache2.service nginx.service # systemctl mask apache2.service nginx.service Note: Other web server packages may exist. If not required and authorized by local site policy, they should also be removed. If the package is required for a dependency, the service and socket should be stopped and masked. Impact: Removal of web server packages will remove that ability for the server to host web services. - IF - the web server package is required for a dependency, any related service or socket should be stopped and masked. Note: If the remediation steps to mask a service are followed and that package is not installed on the system, the service and/or socket will still be masked. If the package is installed due to an approved requirement to host a web server, the associated service and/or socket would need to be unmasked before it could be enabled and/or started." reference : "800-171|3.4.2,800-171|3.4.6,800-171|3.4.7,800-171r3|03.04.02,800-171r3|03.04.06,800-53|CM-6,800-53|CM-7,800-53r5|CM-6,800-53r5|CM-7,CSCv7|9.2,CSCv8|4.8,CSF|PR.IP-1,CSF|PR.PT-3,CSF2.0|DE.CM-09,CSF2.0|PR.PS-01,GDPR|32.1.b,HIPAA|164.306(a)(1),ISO-27001-2022|A.8.9,ITSG-33|CM-6,ITSG-33|CM-7,LEVEL|1A,NIAv2|SS15a,PCI-DSSv3.2.1|2.2.2,SWIFT-CSCv1|2.3" see_also : "https://workbench.cisecurity.org/benchmarks/20333" show_output : YES type : RPM_CHECK description : "nginx services exist on the system" rpm : "nginx-0.0.0-0" operator : "lte" type : RPM_CHECK description : "apache2 services exist on the system" rpm : "apache2-0.0.0-0" operator : "lte" description : "2.1.19 Ensure web server services are not in use" info : "Web servers provide the ability to host web site content. Unless there is a local site approved requirement to run a web server service on the system, web server packages should be removed to reduce the potential attack surface." solution : "Run the following commands to stop apache2.service and nginx.service and remove apache2 and nginx packages: # systemctl stop apache2.service nginx.service # zypper remove apache2 nginx - OR - - IF - a package is installed and is required for dependencies: Run the following commands to stop and mask apache2.service and nginx.service : # systemctl stop apache2.service nginx.service # systemctl mask apache2.service nginx.service Note: Other web server packages may exist. If not required and authorized by local site policy, they should also be removed. If the package is required for a dependency, the service and socket should be stopped and masked. Impact: Removal of web server packages will remove that ability for the server to host web services. - IF - the web server package is required for a dependency, any related service or socket should be stopped and masked. Note: If the remediation steps to mask a service are followed and that package is not installed on the system, the service and/or socket will still be masked. If the package is installed due to an approved requirement to host a web server, the associated service and/or socket would need to be unmasked before it could be enabled and/or started." reference : "800-171|3.4.2,800-171|3.4.6,800-171|3.4.7,800-171r3|03.04.02,800-171r3|03.04.06,800-53|CM-6,800-53|CM-7,800-53r5|CM-6,800-53r5|CM-7,CSCv7|9.2,CSCv8|4.8,CSF|PR.IP-1,CSF|PR.PT-3,CSF2.0|DE.CM-09,CSF2.0|PR.PS-01,GDPR|32.1.b,HIPAA|164.306(a)(1),ISO-27001-2022|A.8.9,ITSG-33|CM-6,ITSG-33|CM-7,LEVEL|1A,NIAv2|SS15a,PCI-DSSv3.2.1|2.2.2,SWIFT-CSCv1|2.3" see_also : "https://workbench.cisecurity.org/benchmarks/20333" show_output : YES type : RPM_CHECK description : "avahi" rpm : "avahi-0.0.0-0" operator : "lte" type : RPM_CHECK description : "2.1.2 Ensure avahi daemon services are not in use" 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. Automatic discovery of network services is not normally required for system functionality. It is recommended to remove this package to reduce the potential attack surface." solution : "Run the following commands to stop avahi-daemon.socket and avahi-daemon.service and remove the avahi package: # systemctl stop avahi-daemon.socket avahi-daemon.service # zypper remove avahi - OR - - IF - the avahi package is required as a dependency: Run the following commands to stop and mask the avahi-daemon.socket and avahi-daemon.service : # systemctl stop avahi-daemon.socket avahi-daemon.service # systemctl mask avahi-daemon.socket avahi-daemon.service Impact: There may be packages that are dependent on the avahi package. If the avahi package is removed, these dependent packages will be removed as well. Before removing the avahi package, review any dependent packages to determine if they are required on the system. - IF - a dependent package is required: stop and mask the avahi-daemon.socket and avahi-daemon.service leaving the avahi package installed." reference : "800-171|3.4.2,800-171|3.4.6,800-171|3.4.7,800-171r3|03.04.02,800-171r3|03.04.06,800-53|CM-6,800-53|CM-7,800-53r5|CM-6,800-53r5|CM-7,CSCv7|9.2,CSCv8|4.8,CSF|PR.IP-1,CSF|PR.PT-3,CSF2.0|DE.CM-09,CSF2.0|PR.PS-01,GDPR|32.1.b,HIPAA|164.306(a)(1),ISO-27001-2022|A.8.9,ITSG-33|CM-6,ITSG-33|CM-7,LEVEL|1A,NIAv2|SS15a,PCI-DSSv3.2.1|2.2.2,SWIFT-CSCv1|2.3" see_also : "https://workbench.cisecurity.org/benchmarks/20333" rpm : "avahi-0.0.0-0" operator : "lte" type : CMD_EXEC description : "avahi-daemon.socket avahi-daemon.service active" cmd : "/bin/systemctl is-active avahi-daemon.socket avahi-daemon.service 2>/dev/null | /bin/grep '^active' | /bin/awk '{print} END {if (NR == 0) print \"pass\" ; else print \"fail\"}'" expect : "(?i)^[\\s]*\\**[\\s]*pass:?[\\s]*\\**$" type : CMD_EXEC description : "avahi-daemon.socket avahi-daemon.service enabled" cmd : "/bin/systemctl is-enabled avahi-daemon.socket avahi-daemon.service 2>/dev/null | /bin/grep 'enabled' | /bin/awk '{print} END {if (NR == 0) print \"pass\" ; else print \"fail\"}'" expect : "(?i)^[\\s]*\\**[\\s]*pass:?[\\s]*\\**$" description : "2.1.2 Ensure avahi daemon services are not in use" 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. Automatic discovery of network services is not normally required for system functionality. It is recommended to remove this package to reduce the potential attack surface." solution : "Run the following commands to stop avahi-daemon.socket and avahi-daemon.service and remove the avahi package: # systemctl stop avahi-daemon.socket avahi-daemon.service # zypper remove avahi - OR - - IF - the avahi package is required as a dependency: Run the following commands to stop and mask the avahi-daemon.socket and avahi-daemon.service : # systemctl stop avahi-daemon.socket avahi-daemon.service # systemctl mask avahi-daemon.socket avahi-daemon.service Impact: There may be packages that are dependent on the avahi package. If the avahi package is removed, these dependent packages will be removed as well. Before removing the avahi package, review any dependent packages to determine if they are required on the system. - IF - a dependent package is required: stop and mask the avahi-daemon.socket and avahi-daemon.service leaving the avahi package installed." reference : "800-171|3.4.2,800-171|3.4.6,800-171|3.4.7,800-171r3|03.04.02,800-171r3|03.04.06,800-53|CM-6,800-53|CM-7,800-53r5|CM-6,800-53r5|CM-7,CSCv7|9.2,CSCv8|4.8,CSF|PR.IP-1,CSF|PR.PT-3,CSF2.0|DE.CM-09,CSF2.0|PR.PS-01,GDPR|32.1.b,HIPAA|164.306(a)(1),ISO-27001-2022|A.8.9,ITSG-33|CM-6,ITSG-33|CM-7,LEVEL|1A,NIAv2|SS15a,PCI-DSSv3.2.1|2.2.2,SWIFT-CSCv1|2.3" see_also : "https://workbench.cisecurity.org/benchmarks/20333" show_output : YES type : RPM_CHECK description : "xinetd services are installed" rpm : "xinetd-0.0.0-0" operator : "gt" required : YES type : CMD_EXEC description : "xinetd.service enabled" cmd : "/bin/systemctl is-enabled xinetd.service 2>/dev/null | /bin/grep 'enabled' | /bin/awk '{print} END {if (NR == 0) print \"pass\" ; else print \"fail\"}'" expect : "(?i)^[\\s]*\\**[\\s]*pass:?[\\s]*\\**$" type : CMD_EXEC description : "xinetd.service active" cmd : "/bin/systemctl is-active xinetd.service 2>/dev/null | /bin/grep '^active' | /bin/awk '{print} END {if (NR == 0) print \"pass\" ; else print \"fail\"}'" expect : "(?i)^[\\s]*\\**[\\s]*pass:?[\\s]*\\**$" description : "2.1.20 Ensure xinetd services are not in use" 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. If there are no xinetd services required, it is recommended that the package be removed to reduce the attack surface are of the system. Note: If an xinetd service or services are required, ensure that any xinetd service not required is stopped and masked" solution : "Run the following commands to stop xinetd.service and remove the xinetd package: # systemctl stop xinetd.service # zypper remove xinetd - OR - - IF - the xinetd package is required as a dependency: Run the following commands to stop and mask the xinetd.service : # systemctl stop xinetd.service # systemctl mask xinetd.service Impact: There may be packages that are dependent on the xinetd package. If the xinetd package is removed, these dependent packages will be removed as well. Before removing the xinetd package, review any dependent packages to determine if they are required on the system. - IF - a dependent package is required: stop and mask the xinetd.service leaving the xinetd package installed." reference : "800-171|3.4.2,800-171|3.4.6,800-171|3.4.7,800-171r3|03.04.02,800-171r3|03.04.06,800-53|CM-6,800-53|CM-7,800-53r5|CM-6,800-53r5|CM-7,CSCv7|9.2,CSCv8|4.8,CSF|PR.IP-1,CSF|PR.PT-3,CSF2.0|DE.CM-09,CSF2.0|PR.PS-01,GDPR|32.1.b,HIPAA|164.306(a)(1),ISO-27001-2022|A.8.9,ITSG-33|CM-6,ITSG-33|CM-7,LEVEL|1A,NIAv2|SS15a,PCI-DSSv3.2.1|2.2.2,SWIFT-CSCv1|2.3" see_also : "https://workbench.cisecurity.org/benchmarks/20333" show_output : YES type : RPM_CHECK description : "2.1.20 Ensure xinetd services are not in use" 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. If there are no xinetd services required, it is recommended that the package be removed to reduce the attack surface are of the system. Note: If an xinetd service or services are required, ensure that any xinetd service not required is stopped and masked" solution : "Run the following commands to stop xinetd.service and remove the xinetd package: # systemctl stop xinetd.service # zypper remove xinetd - OR - - IF - the xinetd package is required as a dependency: Run the following commands to stop and mask the xinetd.service : # systemctl stop xinetd.service # systemctl mask xinetd.service Impact: There may be packages that are dependent on the xinetd package. If the xinetd package is removed, these dependent packages will be removed as well. Before removing the xinetd package, review any dependent packages to determine if they are required on the system. - IF - a dependent package is required: stop and mask the xinetd.service leaving the xinetd package installed." reference : "800-171|3.4.2,800-171|3.4.6,800-171|3.4.7,800-171r3|03.04.02,800-171r3|03.04.06,800-53|CM-6,800-53|CM-7,800-53r5|CM-6,800-53r5|CM-7,CSCv7|9.2,CSCv8|4.8,CSF|PR.IP-1,CSF|PR.PT-3,CSF2.0|DE.CM-09,CSF2.0|PR.PS-01,GDPR|32.1.b,HIPAA|164.306(a)(1),ISO-27001-2022|A.8.9,ITSG-33|CM-6,ITSG-33|CM-7,LEVEL|1A,NIAv2|SS15a,PCI-DSSv3.2.1|2.2.2,SWIFT-CSCv1|2.3" see_also : "https://workbench.cisecurity.org/benchmarks/20333" rpm : "xinetd-0.0.0-0" operator : "lte" type : CMD_EXEC description : "2.1.22 Ensure mail transfer agents are configured for local-only mode" info : "Mail Transfer Agents (MTA), such as sendmail, Exim 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. 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 Note: - This recommendation is designed around the postfix mail server. - Depending on your environment you may have an alternative MTA installed such as exim4 or 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-171|3.4.6,800-171|3.4.7,800-171r3|03.04.02,800-171r3|03.04.06,800-53|CM-6,800-53|CM-7,800-53r5|CM-6,800-53r5|CM-7,CSCv7|9.2,CSCv8|4.8,CSF|PR.IP-1,CSF|PR.PT-3,CSF2.0|DE.CM-09,CSF2.0|PR.PS-01,GDPR|32.1.b,HIPAA|164.306(a)(1),ISO-27001-2022|A.8.9,ITSG-33|CM-6,ITSG-33|CM-7,LEVEL|1A,NIAv2|SS15a,PCI-DSSv3.2.1|2.2.2,SWIFT-CSCv1|2.3" see_also : "https://workbench.cisecurity.org/benchmarks/20333" cmd : "#!/bin/bash { a_output=(); a_output2=(); a_port_list=(\"25\" \"465\" \"587\") for l_port_number in \"${a_port_list[@]}\"; do if ss -plntu | grep -P -- ':'\"$l_port_number\"'\\b' | grep -Pvq -- '\\h+(127\\.0\\.0\\.1|\\[?::1\\]?):'\"$l_port_number\"'\\b'; then a_output2+=(\" - Port \\\"$l_port_number\\\" is listening on a non-loopback network interface\") else a_output+=(\" - Port \\\"$l_port_number\\\" is not listening on a non-loopback network interface\") fi done if command -v postconf &> /dev/null; then l_interfaces=\"$(postconf -n inet_interfaces)\" elif command -v exim &> /dev/null; then l_interfaces=\"$(exim -bP local_interfaces)\" elif command -v sendmail &> /dev/null; then l_interfaces=\"$(grep -i \"0 DaemonPortOptions=\" /etc/mail/sendmail.cr | grep -oP '?<=Addr=)[^,+]+')\" fi if [ -n \"$l_interfaces\" ]; then if grep -Pqi '\\ball\\b' <<< \"$l_interfaces\"; then a_output2+=(\" - MTA is bound to all network interfaces\") elif ! grep -Pqi '(inet_interfaces\\h*=\\h*)?(0\\.0\\.0\\.0|::1|loopback-only|localhost)' <<< \"$l_interfaces\"; then a_output2+=(\" - MTA is bound to a network interface\" \" \\\"$l_interfaces\\\"\") else a_output+=(\" - MTA is not bound to a non loopback network interface\" \" \\\"$l_interfaces\\\"\") fi else a_output+=(\" - MTA not detected or in use\") fi if [ \"${#a_output2[@]}\" -le 0 ]; then printf '%s\\n' \"\" \"- Audit Result:\" \" ** PASS **\" \"${a_output[@]}\" else printf '%s\\n' \"\" \"- Audit Result:\" \" ** FAIL **\" \" * Reasons for audit failure *\" \"${a_output2[@]}\" \"\" [ \"${#a_output[@]}\" -gt 0 ] && printf '%s\\n' \"- Correctly set:\" \"${a_output[@]}\" fi }" expect : "(?i)^[\\s]*\\**[\\s]*pass:?[\\s]*\\**$" type : CMD_EXEC description : "2.1.23 Ensure only approved services are listening on a network interface" info : "A network port is identified by its number, the associated IP address, and the type of the communication protocol such as TCP or UDP. A listening port is a network port on which an application or process listens on, acting as a communication endpoint. Each listening port can be open or closed (filtered) using a firewall. In general terms, an open port is a network port that accepts incoming packets from remote locations. Services listening on the system pose a potential risk as an attack vector. These services should be reviewed, and if not required, the service should be stopped, and the package containing the service should be removed. If required packages have a dependency, the service should be stopped and masked to reduce the attack surface of the system. NOTE: Nessus has provided the target output to assist in reviewing the benchmark to ensure target compliance." solution : "Run the following commands to stop the service and remove the package containing the service: # systemctl stop .socket .service # zypper remove - OR - If required packages have a dependency: Run the following commands to stop and mask the service and socket: # systemctl stop .socket .service # systemctl mask .socket .service Note: replace with the appropriate service name. Impact: There may be packages that are dependent on the service's package. If the service's package is removed, these dependent packages will be removed as well. Before removing the service's package, review any dependent packages to determine if they are required on the system. - IF - a dependent package is required: stop and mask the .socket and .service leaving the service's package installed." reference : "800-171|3.4.2,800-171|3.4.6,800-171|3.4.7,800-171r3|03.04.02,800-171r3|03.04.06,800-53|CM-6,800-53|CM-7,800-53r5|CM-6,800-53r5|CM-7,CSCv7|9.2,CSCv8|4.8,CSF|PR.IP-1,CSF|PR.PT-3,CSF2.0|DE.CM-09,CSF2.0|PR.PS-01,GDPR|32.1.b,HIPAA|164.306(a)(1),ISO-27001-2022|A.8.9,ITSG-33|CM-6,ITSG-33|CM-7,LEVEL|1M,NIAv2|SS15a,PCI-DSSv3.2.1|2.2.2,SWIFT-CSCv1|2.3" see_also : "https://workbench.cisecurity.org/benchmarks/20333" cmd : "/usr/sbin/ss -plntu" expect : "^Manual Review Required$" severity : MEDIUM type : RPM_CHECK description : "dhcp server services exist" rpm : "dhcp-server-0.0.0-0" operator : "gt" required : YES type : CMD_EXEC description : "dhcpd.service dhcpd6.service enabled" cmd : "/bin/systemctl is-enabled dhcpd.service dhcpd6.service 2>/dev/null | /bin/grep 'enabled' | /bin/awk '{print} END {if (NR == 0) print \"pass\" ; else print \"fail\"}'" expect : "(?i)^[\\s]*\\**[\\s]*pass:?[\\s]*\\**$" type : CMD_EXEC description : "dhcpd.service dhcpd6.service active" cmd : "/bin/systemctl is-active dhcpd.service dhcpd6.service 2>/dev/null | /bin/grep '^active' | /bin/awk '{print} END {if (NR == 0) print \"pass\" ; else print \"fail\"}'" expect : "(?i)^[\\s]*\\**[\\s]*pass:?[\\s]*\\**$" description : "2.1.3 Ensure dhcp server services are not in use" info : "The Dynamic Host Configuration Protocol (DHCP) is a service that allows machines to be dynamically assigned IP addresses. There are two versions of the DHCP protocol DHCPv4 and DHCPv6 At startup the server may be started for one or the other via the -4 or -6 arguments. Unless a system is specifically set up to act as a DHCP server, it is recommended that the dhcp-server package be removed to reduce the potential attack surface." solution : "Run the following commands to stop dhcpd.service and dhcpd6.service and remove dhcp-server package: # systemctl stop dhcpd.service dhcpd6.service # zypper remove dhcp-server - OR - - IF - the dhcp-server package is required as a dependency: Run the following commands to stop and mask dhcpd.service and dhcpd6.service : # systemctl stop dhcpd.service dhcpd6.service # systemctl mask dhcpd.service dhcpd6.service Impact: There may be packages that are dependent on the dhcp-server package. If the dhcp-server package is removed, these dependent packages will be removed as well. Before removing the dhcp-server package, review any dependent packages to determine if they are required on the system. - IF - a dependent package is required: stop and mask the dhcpd.service and dhcpd6.service leaving the dhcp-server package installed." reference : "800-171|3.4.2,800-171|3.4.6,800-171|3.4.7,800-171r3|03.04.02,800-171r3|03.04.06,800-53|CM-6,800-53|CM-7,800-53r5|CM-6,800-53r5|CM-7,CSCv7|9.2,CSCv8|4.8,CSF|PR.IP-1,CSF|PR.PT-3,CSF2.0|DE.CM-09,CSF2.0|PR.PS-01,GDPR|32.1.b,HIPAA|164.306(a)(1),ISO-27001-2022|A.8.9,ITSG-33|CM-6,ITSG-33|CM-7,LEVEL|1A,NIAv2|SS15a,PCI-DSSv3.2.1|2.2.2,SWIFT-CSCv1|2.3" see_also : "https://workbench.cisecurity.org/benchmarks/20333" show_output : YES type : RPM_CHECK description : "2.1.3 Ensure dhcp server services are not in use" info : "The Dynamic Host Configuration Protocol (DHCP) is a service that allows machines to be dynamically assigned IP addresses. There are two versions of the DHCP protocol DHCPv4 and DHCPv6 At startup the server may be started for one or the other via the -4 or -6 arguments. Unless a system is specifically set up to act as a DHCP server, it is recommended that the dhcp-server package be removed to reduce the potential attack surface." solution : "Run the following commands to stop dhcpd.service and dhcpd6.service and remove dhcp-server package: # systemctl stop dhcpd.service dhcpd6.service # zypper remove dhcp-server - OR - - IF - the dhcp-server package is required as a dependency: Run the following commands to stop and mask dhcpd.service and dhcpd6.service : # systemctl stop dhcpd.service dhcpd6.service # systemctl mask dhcpd.service dhcpd6.service Impact: There may be packages that are dependent on the dhcp-server package. If the dhcp-server package is removed, these dependent packages will be removed as well. Before removing the dhcp-server package, review any dependent packages to determine if they are required on the system. - IF - a dependent package is required: stop and mask the dhcpd.service and dhcpd6.service leaving the dhcp-server package installed." reference : "800-171|3.4.2,800-171|3.4.6,800-171|3.4.7,800-171r3|03.04.02,800-171r3|03.04.06,800-53|CM-6,800-53|CM-7,800-53r5|CM-6,800-53r5|CM-7,CSCv7|9.2,CSCv8|4.8,CSF|PR.IP-1,CSF|PR.PT-3,CSF2.0|DE.CM-09,CSF2.0|PR.PS-01,GDPR|32.1.b,HIPAA|164.306(a)(1),ISO-27001-2022|A.8.9,ITSG-33|CM-6,ITSG-33|CM-7,LEVEL|1A,NIAv2|SS15a,PCI-DSSv3.2.1|2.2.2,SWIFT-CSCv1|2.3" see_also : "https://workbench.cisecurity.org/benchmarks/20333" rpm : "dhcp-server-0.0.0-0" operator : "lte" type : RPM_CHECK description : "dns services exist" rpm : "bind-0.0.0-0" operator : "gt" required : YES type : CMD_EXEC description : "named.service enabled" cmd : "/bin/systemctl is-enabled named.service 2>/dev/null | /bin/grep 'enabled' | /bin/awk '{print} END {if (NR == 0) print \"pass\" ; else print \"fail\"}'" expect : "(?i)^[\\s]*\\**[\\s]*pass:?[\\s]*\\**$" type : CMD_EXEC description : "named.service active" cmd : "/bin/systemctl is-active named.service 2>/dev/null | /bin/grep '^active' | /bin/awk '{print} END {if (NR == 0) print \"pass\" ; else print \"fail\"}'" expect : "(?i)^[\\s]*\\**[\\s]*pass:?[\\s]*\\**$" description : "2.1.4 Ensure dns server services are not in use" 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. Unless a system is specifically designated to act as a DNS server, it is recommended that the package be removed to reduce the potential attack surface." solution : "Run the following commands to stop named.service and remove bind package: # systemctl stop named.service # zypper remove bind - OR - - IF - the bind package is required as a dependency: Run the following commands to stop and mask named.service : # systemctl stop named.service # systemctl mask named.service Impact: There may be packages that are dependent on the bind package. If the bind package is removed, these dependent packages will be removed as well. Before removing the bind package, review any dependent packages to determine if they are required on the system. - IF - a dependent package is required: stop and mask the named.service leaving the bind package installed." reference : "800-171|3.4.2,800-171|3.4.6,800-171|3.4.7,800-171r3|03.04.02,800-171r3|03.04.06,800-53|CM-6,800-53|CM-7,800-53r5|CM-6,800-53r5|CM-7,CSCv7|9.2,CSCv8|4.8,CSF|PR.IP-1,CSF|PR.PT-3,CSF2.0|DE.CM-09,CSF2.0|PR.PS-01,GDPR|32.1.b,HIPAA|164.306(a)(1),ISO-27001-2022|A.8.9,ITSG-33|CM-6,ITSG-33|CM-7,LEVEL|1A,NIAv2|SS15a,PCI-DSSv3.2.1|2.2.2,SWIFT-CSCv1|2.3" see_also : "https://workbench.cisecurity.org/benchmarks/20333" show_output : YES type : RPM_CHECK description : "2.1.4 Ensure dns server services are not in use" 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. Unless a system is specifically designated to act as a DNS server, it is recommended that the package be removed to reduce the potential attack surface." solution : "Run the following commands to stop named.service and remove bind package: # systemctl stop named.service # zypper remove bind - OR - - IF - the bind package is required as a dependency: Run the following commands to stop and mask named.service : # systemctl stop named.service # systemctl mask named.service Impact: There may be packages that are dependent on the bind package. If the bind package is removed, these dependent packages will be removed as well. Before removing the bind package, review any dependent packages to determine if they are required on the system. - IF - a dependent package is required: stop and mask the named.service leaving the bind package installed." reference : "800-171|3.4.2,800-171|3.4.6,800-171|3.4.7,800-171r3|03.04.02,800-171r3|03.04.06,800-53|CM-6,800-53|CM-7,800-53r5|CM-6,800-53r5|CM-7,CSCv7|9.2,CSCv8|4.8,CSF|PR.IP-1,CSF|PR.PT-3,CSF2.0|DE.CM-09,CSF2.0|PR.PS-01,GDPR|32.1.b,HIPAA|164.306(a)(1),ISO-27001-2022|A.8.9,ITSG-33|CM-6,ITSG-33|CM-7,LEVEL|1A,NIAv2|SS15a,PCI-DSSv3.2.1|2.2.2,SWIFT-CSCv1|2.3" see_also : "https://workbench.cisecurity.org/benchmarks/20333" rpm : "bind-0.0.0-0" operator : "lte" type : RPM_CHECK description : "dnsmasq services exist" rpm : "dnsmasq-0.0.0-0" operator : "gt" required : YES type : CMD_EXEC description : "dnsmasq.service active" cmd : "/bin/systemctl is-active dnsmasq.service 2>/dev/null | /bin/grep '^active' | /bin/awk '{print} END {if (NR == 0) print \"pass\" ; else print \"fail\"}'" expect : "(?i)^[\\s]*\\**[\\s]*pass:?[\\s]*\\**$" type : CMD_EXEC description : "dnsmasq.service enabled" cmd : "/bin/systemctl is-enabled dnsmasq.service 2>/dev/null | /bin/grep 'enabled' | /bin/awk '{print} END {if (NR == 0) print \"pass\" ; else print \"fail\"}'" expect : "(?i)^[\\s]*\\**[\\s]*pass:?[\\s]*\\**$" description : "2.1.5 Ensure dnsmasq services are not in use" info : "dnsmasq is a lightweight tool that provides DNS caching, DNS forwarding and DHCP (Dynamic Host Configuration Protocol) services. Unless a system is specifically designated to act as a DNS caching, DNS forwarding and/or DHCP server, it is recommended that the package be removed to reduce the potential attack surface." solution : "Run the following commands to stop dnsmasq.service and remove dnsmasq package: # systemctl stop dnsmasq.service # zypper remove dnsmasq - OR - - IF - the dnsmasq package is required as a dependency: Run the following commands to stop and mask the dnsmasq.service : # systemctl stop dnsmasq.service # systemctl mask dnsmasq.service Impact: There may be packages that are dependent on the dnsmasq package. If the dnsmasq package is removed, these dependent packages will be removed as well. Before removing the dnsmasq package, review any dependent packages to determine if they are required on the system. - IF - a dependent package is required: stop and mask the dnsmasq.service leaving the dnsmasq package installed." reference : "800-171|3.4.2,800-171|3.4.6,800-171|3.4.7,800-171r3|03.04.02,800-171r3|03.04.06,800-53|CM-6,800-53|CM-7,800-53r5|CM-6,800-53r5|CM-7,CSCv7|9.2,CSCv8|4.8,CSF|PR.IP-1,CSF|PR.PT-3,CSF2.0|DE.CM-09,CSF2.0|PR.PS-01,GDPR|32.1.b,HIPAA|164.306(a)(1),ISO-27001-2022|A.8.9,ITSG-33|CM-6,ITSG-33|CM-7,LEVEL|1A,NIAv2|SS15a,PCI-DSSv3.2.1|2.2.2,SWIFT-CSCv1|2.3" see_also : "https://workbench.cisecurity.org/benchmarks/20333" show_output : YES type : RPM_CHECK description : "2.1.5 Ensure dnsmasq services are not in use" info : "dnsmasq is a lightweight tool that provides DNS caching, DNS forwarding and DHCP (Dynamic Host Configuration Protocol) services. Unless a system is specifically designated to act as a DNS caching, DNS forwarding and/or DHCP server, it is recommended that the package be removed to reduce the potential attack surface." solution : "Run the following commands to stop dnsmasq.service and remove dnsmasq package: # systemctl stop dnsmasq.service # zypper remove dnsmasq - OR - - IF - the dnsmasq package is required as a dependency: Run the following commands to stop and mask the dnsmasq.service : # systemctl stop dnsmasq.service # systemctl mask dnsmasq.service Impact: There may be packages that are dependent on the dnsmasq package. If the dnsmasq package is removed, these dependent packages will be removed as well. Before removing the dnsmasq package, review any dependent packages to determine if they are required on the system. - IF - a dependent package is required: stop and mask the dnsmasq.service leaving the dnsmasq package installed." reference : "800-171|3.4.2,800-171|3.4.6,800-171|3.4.7,800-171r3|03.04.02,800-171r3|03.04.06,800-53|CM-6,800-53|CM-7,800-53r5|CM-6,800-53r5|CM-7,CSCv7|9.2,CSCv8|4.8,CSF|PR.IP-1,CSF|PR.PT-3,CSF2.0|DE.CM-09,CSF2.0|PR.PS-01,GDPR|32.1.b,HIPAA|164.306(a)(1),ISO-27001-2022|A.8.9,ITSG-33|CM-6,ITSG-33|CM-7,LEVEL|1A,NIAv2|SS15a,PCI-DSSv3.2.1|2.2.2,SWIFT-CSCv1|2.3" see_also : "https://workbench.cisecurity.org/benchmarks/20333" rpm : "dnsmasq-0.0.0-0" operator : "lte" type : RPM_CHECK description : "samba services exist" rpm : "samba-0.0.0-0" operator : "gt" required : YES type : CMD_EXEC description : "smb.service enabled" cmd : "/bin/systemctl is-enabled smb.service 2>/dev/null | /bin/grep 'enabled' | /bin/awk '{print} END {if (NR == 0) print \"pass\" ; else print \"fail\"}'" expect : "(?i)^[\\s]*\\**[\\s]*pass:?[\\s]*\\**$" type : CMD_EXEC description : "smb.service active" cmd : "/bin/systemctl is-active smb.service 2>/dev/null | /bin/grep '^active' | /bin/awk '{print} END {if (NR == 0) print \"pass\" ; else print \"fail\"}'" expect : "(?i)^[\\s]*\\**[\\s]*pass:?[\\s]*\\**$" description : "2.1.6 Ensure samba file server services are not in use" 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. If there is no need to mount directories and file systems to Windows systems, then this package can be removed to reduce the potential attack surface." solution : "Run the following command to stop smb.service and remove samba package: # systemctl stop smb.service # zypper remove samba - OR - - IF - the samba package is required as a dependency: Run the following commands to stop and mask the smb.service : # systemctl stop smb.service # systemctl mask smb.service Impact: There may be packages that are dependent on the samba package. If the samba package is removed, these dependent packages will be removed as well. Before removing the samba package, review any dependent packages to determine if they are required on the system. - IF - a dependent package is required: stop and mask the smb.service leaving the samba package installed." reference : "800-171|3.4.2,800-171|3.4.6,800-171|3.4.7,800-171r3|03.04.02,800-171r3|03.04.06,800-53|CM-6,800-53|CM-7,800-53r5|CM-6,800-53r5|CM-7,CSCv7|9.2,CSCv8|4.8,CSF|PR.IP-1,CSF|PR.PT-3,CSF2.0|DE.CM-09,CSF2.0|PR.PS-01,GDPR|32.1.b,HIPAA|164.306(a)(1),ISO-27001-2022|A.8.9,ITSG-33|CM-6,ITSG-33|CM-7,LEVEL|1A,NIAv2|SS15a,PCI-DSSv3.2.1|2.2.2,SWIFT-CSCv1|2.3" see_also : "https://workbench.cisecurity.org/benchmarks/20333" show_output : YES type : RPM_CHECK description : "2.1.6 Ensure samba file server services are not in use" 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. If there is no need to mount directories and file systems to Windows systems, then this package can be removed to reduce the potential attack surface." solution : "Run the following command to stop smb.service and remove samba package: # systemctl stop smb.service # zypper remove samba - OR - - IF - the samba package is required as a dependency: Run the following commands to stop and mask the smb.service : # systemctl stop smb.service # systemctl mask smb.service Impact: There may be packages that are dependent on the samba package. If the samba package is removed, these dependent packages will be removed as well. Before removing the samba package, review any dependent packages to determine if they are required on the system. - IF - a dependent package is required: stop and mask the smb.service leaving the samba package installed." reference : "800-171|3.4.2,800-171|3.4.6,800-171|3.4.7,800-171r3|03.04.02,800-171r3|03.04.06,800-53|CM-6,800-53|CM-7,800-53r5|CM-6,800-53r5|CM-7,CSCv7|9.2,CSCv8|4.8,CSF|PR.IP-1,CSF|PR.PT-3,CSF2.0|DE.CM-09,CSF2.0|PR.PS-01,GDPR|32.1.b,HIPAA|164.306(a)(1),ISO-27001-2022|A.8.9,ITSG-33|CM-6,ITSG-33|CM-7,LEVEL|1A,NIAv2|SS15a,PCI-DSSv3.2.1|2.2.2,SWIFT-CSCv1|2.3" see_also : "https://workbench.cisecurity.org/benchmarks/20333" rpm : "samba-0.0.0-0" operator : "lte" type : RPM_CHECK description : "openldap2_5" rpm : "openldap2_5-0.0.0-0" operator : "lte" type : RPM_CHECK description : "openldap2" rpm : "openldap2-0.0.0-0" operator : "lte" description : "2.1.7 Ensure ldap server services are not in use" 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. If the system will not need to act as an LDAP server, it is recommended that the software be removed to reduce the potential attack surface." solution : "Run the following command remove the openldap2 and openldap2_5 package: # systemctl stop slapd.service # zypper remove openldap2 openldap2_5 - OR - - IF - the slapd package is required as a dependency: Run the following commands to stop and mask slapd.service : # systemctl stop slapd.service # systemctl mask slapd.service Impact: There may be packages that are dependent on the openldap2 package. If the openldap2 package is removed, these dependent packages will be removed as well. Before removing the openldap2 package, review any dependent packages to determine if they are required on the system. - IF - a dependent package is required: stop and mask the slapd.service leaving the openldap2-client package installed." reference : "800-171|3.4.2,800-171|3.4.6,800-171|3.4.7,800-171r3|03.04.02,800-171r3|03.04.06,800-53|CM-6,800-53|CM-7,800-53r5|CM-6,800-53r5|CM-7,CSCv7|9.2,CSCv8|4.8,CSF|PR.IP-1,CSF|PR.PT-3,CSF2.0|DE.CM-09,CSF2.0|PR.PS-01,GDPR|32.1.b,HIPAA|164.306(a)(1),ISO-27001-2022|A.8.9,ITSG-33|CM-6,ITSG-33|CM-7,LEVEL|1A,NIAv2|SS15a,PCI-DSSv3.2.1|2.2.2,SWIFT-CSCv1|2.3" see_also : "https://workbench.cisecurity.org/benchmarks/20333" show_output : YES type : CMD_EXEC description : "enabled" cmd : "/bin/systemctl is-enabled slapd.service 2>/dev/null | /bin/grep 'enabled' | /bin/awk '{print} END {if (NR == 0) print \"pass\" ; else print \"fail\"}'" expect : "(?i)^[\\s]*\\**[\\s]*pass:?[\\s]*\\**$" type : CMD_EXEC description : "active" cmd : "/bin/systemctl is-active slapd.service 2>/dev/null | /bin/grep '^active' | /bin/awk '{print} END {if (NR == 0) print \"pass\" ; else print \"fail\"}'" expect : "(?i)^[\\s]*\\**[\\s]*pass:?[\\s]*\\**$" description : "2.1.7 Ensure ldap server services are not in use" 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. If the system will not need to act as an LDAP server, it is recommended that the software be removed to reduce the potential attack surface." solution : "Run the following command remove the openldap2 and openldap2_5 package: # systemctl stop slapd.service # zypper remove openldap2 openldap2_5 - OR - - IF - the slapd package is required as a dependency: Run the following commands to stop and mask slapd.service : # systemctl stop slapd.service # systemctl mask slapd.service Impact: There may be packages that are dependent on the openldap2 package. If the openldap2 package is removed, these dependent packages will be removed as well. Before removing the openldap2 package, review any dependent packages to determine if they are required on the system. - IF - a dependent package is required: stop and mask the slapd.service leaving the openldap2-client package installed." reference : "800-171|3.4.2,800-171|3.4.6,800-171|3.4.7,800-171r3|03.04.02,800-171r3|03.04.06,800-53|CM-6,800-53|CM-7,800-53r5|CM-6,800-53r5|CM-7,CSCv7|9.2,CSCv8|4.8,CSF|PR.IP-1,CSF|PR.PT-3,CSF2.0|DE.CM-09,CSF2.0|PR.PS-01,GDPR|32.1.b,HIPAA|164.306(a)(1),ISO-27001-2022|A.8.9,ITSG-33|CM-6,ITSG-33|CM-7,LEVEL|1A,NIAv2|SS15a,PCI-DSSv3.2.1|2.2.2,SWIFT-CSCv1|2.3" see_also : "https://workbench.cisecurity.org/benchmarks/20333" show_output : YES type : RPM_CHECK description : "ftp services exist" rpm : "vsftpd-0.0.0-0" operator : "gt" required : YES type : CMD_EXEC description : "vsftpd.service active" cmd : "/bin/systemctl is-active vsftpd.service 2>/dev/null | /bin/grep '^active' | /bin/awk '{print} END {if (NR == 0) print \"pass\" ; else print \"fail\"}'" expect : "(?i)^[\\s]*\\**[\\s]*pass:?[\\s]*\\**$" type : CMD_EXEC description : "vsftpd.service enabled" cmd : "/bin/systemctl is-enabled vsftpd.service 2>/dev/null | /bin/grep 'enabled' | /bin/awk '{print} END {if (NR == 0) print \"pass\" ; else print \"fail\"}'" expect : "(?i)^[\\s]*\\**[\\s]*pass:?[\\s]*\\**$" description : "2.1.8 Ensure ftp server services are not in use" info : "FTP (File Transfer Protocol) is a traditional and widely used standard tool for transferring files between a server and clients over a network, especially where no authentication is necessary (permits anonymous users to connect to a server). Unless there is a need to run the system as a FTP server, it is recommended that the package be removed to reduce the potential attack surface." solution : "Run the following commands to stop vsftpd.service and remove vsftpd package: # systemctl stop vsftpd.service # zypper remove vsftpd - OR - - IF - the vsftpd package is required as a dependency: Run the following commands to stop and mask the vsftpd.service : # systemctl stop vsftpd.service # systemctl mask vsftpd.service Note: Other ftp server packages may exist. If not required and authorized by local site policy, they should also be removed. If the package is required for a dependency, the service should be stopped and masked. Impact: There may be packages that are dependent on the vsftpd package. If the vsftpd package is removed, these dependent packages will be removed as well. Before removing the vsftpd package, review any dependent packages to determine if they are required on the system. - IF - a dependent package is required: stop and mask the vsftpd.service leaving the vsftpd package installed." reference : "800-171|3.4.2,800-171|3.4.6,800-171|3.4.7,800-171r3|03.04.02,800-171r3|03.04.06,800-53|CM-6,800-53|CM-7,800-53r5|CM-6,800-53r5|CM-7,CSCv7|9.2,CSCv8|4.8,CSF|PR.IP-1,CSF|PR.PT-3,CSF2.0|DE.CM-09,CSF2.0|PR.PS-01,GDPR|32.1.b,HIPAA|164.306(a)(1),ISO-27001-2022|A.8.9,ITSG-33|CM-6,ITSG-33|CM-7,LEVEL|1A,NIAv2|SS15a,PCI-DSSv3.2.1|2.2.2,SWIFT-CSCv1|2.3" see_also : "https://workbench.cisecurity.org/benchmarks/20333" show_output : YES type : RPM_CHECK description : "2.1.8 Ensure ftp server services are not in use" info : "FTP (File Transfer Protocol) is a traditional and widely used standard tool for transferring files between a server and clients over a network, especially where no authentication is necessary (permits anonymous users to connect to a server). Unless there is a need to run the system as a FTP server, it is recommended that the package be removed to reduce the potential attack surface." solution : "Run the following commands to stop vsftpd.service and remove vsftpd package: # systemctl stop vsftpd.service # zypper remove vsftpd - OR - - IF - the vsftpd package is required as a dependency: Run the following commands to stop and mask the vsftpd.service : # systemctl stop vsftpd.service # systemctl mask vsftpd.service Note: Other ftp server packages may exist. If not required and authorized by local site policy, they should also be removed. If the package is required for a dependency, the service should be stopped and masked. Impact: There may be packages that are dependent on the vsftpd package. If the vsftpd package is removed, these dependent packages will be removed as well. Before removing the vsftpd package, review any dependent packages to determine if they are required on the system. - IF - a dependent package is required: stop and mask the vsftpd.service leaving the vsftpd package installed." reference : "800-171|3.4.2,800-171|3.4.6,800-171|3.4.7,800-171r3|03.04.02,800-171r3|03.04.06,800-53|CM-6,800-53|CM-7,800-53r5|CM-6,800-53r5|CM-7,CSCv7|9.2,CSCv8|4.8,CSF|PR.IP-1,CSF|PR.PT-3,CSF2.0|DE.CM-09,CSF2.0|PR.PS-01,GDPR|32.1.b,HIPAA|164.306(a)(1),ISO-27001-2022|A.8.9,ITSG-33|CM-6,ITSG-33|CM-7,LEVEL|1A,NIAv2|SS15a,PCI-DSSv3.2.1|2.2.2,SWIFT-CSCv1|2.3" see_also : "https://workbench.cisecurity.org/benchmarks/20333" rpm : "vsftpd-0.0.0-0" operator : "lte" type : RPM_CHECK description : "dovecot exist on the system" rpm : "dovecot-0.0.0-0" operator : "gt" required : YES type : RPM_CHECK description : "cyrus-imapd exist on the system" rpm : "cyrus-imapd-0.0.0-0" operator : "gt" required : YES type : CMD_EXEC description : "dovecot.socket dovecot.service cyrus-imapd.service active" cmd : "/bin/systemctl is-active dovecot.socket dovecot.service cyrus-imapd.service 2>/dev/null | /bin/grep '^active' | /bin/awk '{print} END {if (NR == 0) print \"pass\" ; else print \"fail\"}'" expect : "(?i)^[\\s]*\\**[\\s]*pass:?[\\s]*\\**$" type : CMD_EXEC description : "dovecot.socket dovecot.service cyrus-imapd.service enabled" cmd : "/bin/systemctl is-enabled dovecot.socket dovecot.service cyrus-imapd.service 2>/dev/null | /bin/grep 'enabled' | /bin/awk '{print} END {if (NR == 0) print \"pass\" ; else print \"fail\"}'" expect : "(?i)^[\\s]*\\**[\\s]*pass:?[\\s]*\\**$" description : "2.1.9 Ensure message access server services are not in use" info : "dovecot and cyrus-imapd are open source IMAP and POP3 server packages for Linux based systems. Unless POP3 and/or IMAP servers are to be provided by this system, it is recommended that the package be removed to reduce the potential attack surface. Note: Several IMAP/POP3 servers exist and can use other service names. These should also be audited and the packages removed if not required." solution : "Run the following commands to stop dovecot.socket dovecot.service and cyrus-imapd.service and remove dovecot and cyrus-imapd packages: # systemctl stop dovecot.socket dovecot.service cyrus-imapd.service # zypper remove dovecot cyrus-imapd - OR - - IF - a package is installed and is required for dependencies: Run the following commands to stop and mask dovecot.socket dovecot.service and cyrus-imapd.service : # systemctl stop dovecot.socket dovecot.service cyrus-imapd.service # systemctl mask dovecot.socket dovecot.service cyrus-imapd.service Impact: There may be packages that are dependent on dovecot and cyrus-imapd packages. If dovecot and cyrus-imapd packages are removed, these dependent packages will be removed as well. Before removing dovecot and cyrus-imapd packages, review any dependent packages to determine if they are required on the system. - IF - a dependent package is required: stop and mask dovecot.socket dovecot.service and cyrus-imapd.service leaving dovecot and cyrus-imapd packages installed." reference : "800-171|3.4.2,800-171|3.4.6,800-171|3.4.7,800-171r3|03.04.02,800-171r3|03.04.06,800-53|CM-6,800-53|CM-7,800-53r5|CM-6,800-53r5|CM-7,CSCv7|9.2,CSCv8|4.8,CSF|PR.IP-1,CSF|PR.PT-3,CSF2.0|DE.CM-09,CSF2.0|PR.PS-01,GDPR|32.1.b,HIPAA|164.306(a)(1),ISO-27001-2022|A.8.9,ITSG-33|CM-6,ITSG-33|CM-7,LEVEL|1A,NIAv2|SS15a,PCI-DSSv3.2.1|2.2.2,SWIFT-CSCv1|2.3" see_also : "https://workbench.cisecurity.org/benchmarks/20333" show_output : YES type : RPM_CHECK description : "cyrus-imapd exist on the system" rpm : "cyrus-imapd-0.0.0-0" operator : "lte" type : RPM_CHECK description : "dovecot exist on the system" rpm : "dovecot-0.0.0-0" operator : "lte" description : "2.1.9 Ensure message access server services are not in use" info : "dovecot and cyrus-imapd are open source IMAP and POP3 server packages for Linux based systems. Unless POP3 and/or IMAP servers are to be provided by this system, it is recommended that the package be removed to reduce the potential attack surface. Note: Several IMAP/POP3 servers exist and can use other service names. These should also be audited and the packages removed if not required." solution : "Run the following commands to stop dovecot.socket dovecot.service and cyrus-imapd.service and remove dovecot and cyrus-imapd packages: # systemctl stop dovecot.socket dovecot.service cyrus-imapd.service # zypper remove dovecot cyrus-imapd - OR - - IF - a package is installed and is required for dependencies: Run the following commands to stop and mask dovecot.socket dovecot.service and cyrus-imapd.service : # systemctl stop dovecot.socket dovecot.service cyrus-imapd.service # systemctl mask dovecot.socket dovecot.service cyrus-imapd.service Impact: There may be packages that are dependent on dovecot and cyrus-imapd packages. If dovecot and cyrus-imapd packages are removed, these dependent packages will be removed as well. Before removing dovecot and cyrus-imapd packages, review any dependent packages to determine if they are required on the system. - IF - a dependent package is required: stop and mask dovecot.socket dovecot.service and cyrus-imapd.service leaving dovecot and cyrus-imapd packages installed." reference : "800-171|3.4.2,800-171|3.4.6,800-171|3.4.7,800-171r3|03.04.02,800-171r3|03.04.06,800-53|CM-6,800-53|CM-7,800-53r5|CM-6,800-53r5|CM-7,CSCv7|9.2,CSCv8|4.8,CSF|PR.IP-1,CSF|PR.PT-3,CSF2.0|DE.CM-09,CSF2.0|PR.PS-01,GDPR|32.1.b,HIPAA|164.306(a)(1),ISO-27001-2022|A.8.9,ITSG-33|CM-6,ITSG-33|CM-7,LEVEL|1A,NIAv2|SS15a,PCI-DSSv3.2.1|2.2.2,SWIFT-CSCv1|2.3" see_also : "https://workbench.cisecurity.org/benchmarks/20333" show_output : YES type : RPM_CHECK description : "2.2.1 Ensure ftp client is not installed" info : "FTP (File Transfer Protocol) is a traditional and widely used standard tool for transferring files between a server and clients over a network, especially where no authentication is necessary (permits anonymous users to connect to a server). 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 removed to reduce the potential attack surface." solution : "Run the following command to remove ftp : # zypper remove ftp" reference : "800-171|3.4.2,800-171|3.4.6,800-171|3.4.7,800-171r3|03.04.02,800-171r3|03.04.06,800-53|CM-6,800-53|CM-7,800-53r5|CM-6,800-53r5|CM-7,CSCv7|9.2,CSCv8|4.8,CSF|PR.IP-1,CSF|PR.PT-3,CSF2.0|DE.CM-09,CSF2.0|PR.PS-01,GDPR|32.1.b,HIPAA|164.306(a)(1),ISO-27001-2022|A.8.9,ITSG-33|CM-6,ITSG-33|CM-7,LEVEL|1A,NIAv2|SS15a,PCI-DSSv3.2.1|2.2.2,SWIFT-CSCv1|2.3" see_also : "https://workbench.cisecurity.org/benchmarks/20333" rpm : "ftp-0.0.0-0" operator : "lte" type : RPM_CHECK description : "2.2.3 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. 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 remove the ypbind package: # zypper 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.2,800-171|3.4.6,800-171|3.4.7,800-171r3|03.04.02,800-171r3|03.04.06,800-53|CM-6,800-53|CM-7,800-53r5|CM-6,800-53r5|CM-7,CSCv7|9.2,CSCv8|4.8,CSF|PR.IP-1,CSF|PR.PT-3,CSF2.0|DE.CM-09,CSF2.0|PR.PS-01,GDPR|32.1.b,HIPAA|164.306(a)(1),ISO-27001-2022|A.8.9,ITSG-33|CM-6,ITSG-33|CM-7,LEVEL|1A,NIAv2|SS15a,PCI-DSSv3.2.1|2.2.2,SWIFT-CSCv1|2.3" see_also : "https://workbench.cisecurity.org/benchmarks/20333" rpm : "ypbind-0.0.0-0" operator : "lte" type : RPM_CHECK description : "2.2.4 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. 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 following command to remove the telnet package: # zypper 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.2,800-171|3.4.6,800-171|3.4.7,800-171r3|03.04.02,800-171r3|03.04.06,800-53|CM-6,800-53|CM-7,800-53r5|CM-6,800-53r5|CM-7,CSCv7|2.6,CSCv8|4.8,CSF|PR.IP-1,CSF|PR.PT-3,CSF2.0|DE.CM-09,CSF2.0|PR.PS-01,GDPR|32.1.b,HIPAA|164.306(a)(1),ISO-27001-2022|A.8.9,ITSG-33|CM-6,ITSG-33|CM-7,LEVEL|1A,NIAv2|SS15a,PCI-DSSv3.2.1|2.2.2,SWIFT-CSCv1|2.3" see_also : "https://workbench.cisecurity.org/benchmarks/20333" rpm : "telnet-0.0.0-0" operator : "lte" type : RPM_CHECK description : "2.2.5 Ensure tftp client is not installed" info : "Trivial File Transfer Protocol (TFTP) is a simple protocol for exchanging files between two TCP/IP machines. TFTP servers allow connections from a TFTP Client for sending and receiving files. TFTP does not have built-in encryption, access control or authentication. This makes it very easy for an attacker to exploit TFTP to gain access to files" solution : "Run the following command to remove tftp : # zypper remove tftp" reference : "800-171|3.4.2,800-171|3.4.6,800-171|3.4.7,800-171r3|03.04.02,800-171r3|03.04.06,800-53|CM-6,800-53|CM-7,800-53r5|CM-6,800-53r5|CM-7,CSCv7|9.2,CSCv8|4.8,CSF|PR.IP-1,CSF|PR.PT-3,CSF2.0|DE.CM-09,CSF2.0|PR.PS-01,GDPR|32.1.b,HIPAA|164.306(a)(1),ISO-27001-2022|A.8.9,ITSG-33|CM-6,ITSG-33|CM-7,LEVEL|1A,NIAv2|SS15a,PCI-DSSv3.2.1|2.2.2,SWIFT-CSCv1|2.3" see_also : "https://workbench.cisecurity.org/benchmarks/20333" rpm : "tftp-0.0.0-0" operator : "lte" type : CMD_EXEC description : "2.3.1.1 Ensure a single time synchronization daemon 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. Note: - On virtual systems where host based time synchronization is available consult your virtualization software documentation and verify that host based synchronization is in use and follows local site policy. In this scenario, this section should be skipped - Only one time synchronization method should be in use on the system. Configuring multiple time synchronization methods could lead to unexpected or unreliable results Time synchronization is important to support time sensitive security mechanisms and ensures log files have consistent time records across the enterprise, which aids in forensic investigations." solution : "On physical systems, and virtual systems where host based time synchronization is not available. Select one of the two time synchronization daemons; chrony (1) or systemd-timesyncd (2) and following the remediation procedure for the selected daemon. Note: enabling more than one synchronization daemon could lead to unexpected or unreliable results: - chrony Run the following command to install chrony : # zypper install chrony Run the following commands to stop and mask the systemd-timesyncd daemon: # systemctl stop systemd-timesyncd.service # systemctl mask systemd-timesyncd.service Note: - Subsection: Configure chrony should be followed - Subsection: Configure systemd-timesyncd should be skipped - systemd-timesyncd Run the following command to remove the chrony package: # zypper remove chrony Note: - Subsection: Configure systemd-timesyncd should be followed - Subsection: Configure chrony should be skipped" reference : "800-171|3.3.6,800-171|3.3.7,800-171r3|03.03.06a.,800-171r3|03.03.07,800-53|AU-7,800-53|AU-8,800-53r5|AU-7,800-53r5|AU-8,CN-L3|7.1.2.3(c),CN-L3|8.1.4.3(b),CSCv7|6.1,CSCv8|8.4,CSF|PR.PT-1,CSF|RS.AN-3,CSF2.0|PR.PS-04,CSF2.0|RS.AN-03,CSF2.0|RS.AN-06,CSF2.0|RS.AN-07,GDPR|32.1.b,HIPAA|164.306(a)(1),HIPAA|164.312(b),ISO-27001-2022|A.8.17,ITSG-33|AU-7,ITSG-33|AU-8,LEVEL|1A,NESA|T3.6.2,QCSC-v1|8.2.1,QCSC-v1|10.2.1,QCSC-v1|11.2,QCSC-v1|13.2,SWIFT-CSCv1|6.4,TBA-FIISB|37.4" see_also : "https://workbench.cisecurity.org/benchmarks/20333" cmd : "#!/bin/bash { active_enabled_service=() services=(\"systemd-timesyncd.service\" \"chrony.service\" \"chronyd.service\") # Determine which time synchronization daemon is in use for service in \"${services[@]}\"; do if systemctl is-enabled --quiet $service && systemctl is-active --quiet $service; then active_enabled_service+=(\"$service\") fi done # Display audit results if [ ${#active_enabled_service[@]} -eq 1 ]; then printf '%s\\n' \"\" \"Audit Results:\" \" ** PASS **\" \" - A single time synchronization daemon is in use follow the recommendation in ${active_enabled_service[0]} subsection ONLY\" elif [ ${#active_enabled_service[@]} -eq 0 ]; then printf '%s\\n' \"\" \" Audit Results:\" \" ** FAIL **\" \"- No time synchronization daemon in use or unable to determine time synchronization daemon status\" else printf '%s\\n' \"\" \" Audit Results:\" \" ** FAIL **\" \" - Multiple services are in use: ${active_enabled_service[*]}\" fi }" expect : "(?i)^[\\s]*\\**[\\s]*pass:?[\\s]*\\**$" type : CMD_EXEC description : "active" cmd : "/bin/systemctl is-active systemd-timesyncd" expect : "^[\\s]*active[\\s]*$" type : CMD_EXEC description : "enabled" cmd : "/bin/systemctl is-enabled systemd-timesyncd" expect : "^[\\s]*enabled[\\s]*$" type : CMD_EXEC description : "2.3.2.1 Ensure systemd-timesyncd configured with authorized timeserver" info : "NTP= - A space-separated list of NTP server host names or IP addresses. During runtime this list is combined with any per-interface NTP servers acquired from systemd-networkd.service(8). systemd-timesyncd will contact all configured system or per-interface servers in turn, until one responds. When the empty string is assigned, the list of NTP servers is reset, and all prior assignments will have no effect. This setting defaults to an empty list. FallbackNTP= - A space-separated list of NTP server host names or IP addresses to be used as the fallback NTP servers. Any per-interface NTP servers obtained from systemd-networkd.service(8) take precedence over this setting, as do any servers set via NTP= above. This setting is hence only relevant if no other NTP server information is known. When the empty string is assigned, the list of NTP servers is reset, and all prior assignments will have no effect. If this option is not given, a compiled-in list of NTP servers is used. Time synchronization is important to support time sensitive security mechanisms and to ensure log files have consistent time records across the enterprise to aid in forensic investigations" solution : "Set NTP and/or FallbackNPT parameters to local site approved authoritative time server(s) in /etc/systemd/timesyncd.conf or a file in /etc/systemd/timesyncd.conf.d/ ending inconf in the [Time] section: Example file: [Time] NTP=time.nist.gov # Uses the generic name for NIST's time servers FallbackNTP=time-a-g.nist.gov time-b-g.nist.gov time-c-g.nist.gov # Space separated list of NIST time servers Example script to create systemd drop-in configuration file: #!/usr/bin/env bash { a_settings=(\"NTP=time.nist.gov\" \"FallbackNTP=time-a-g.nist.gov time-b-g.nist.gov time-c-g.nist.gov\") [ ! -d /etc/systemd/timesyncd.conf.d/ ] && mkdir /etc/systemd/timesyncd.conf.d/ if grep -Psq -- '^\h*\[Time\]' /etc/systemd/timesyncd.conf.d/60-timesyncd.conf; then printf '%s\n' \"\" \"${a_settings[@]}\" >> /etc/systemd/timesyncd.conf.d/60-timesyncd.conf else printf '%s\n' \"\" \"[Time]\" \"${a_settings[@]}\" >> /etc/systemd/timesyncd.conf.d/60-timesyncd.conf fi } Note: If this setting appears in a canonically later file, or later in the same file, the setting will be overwritten Run to following command to update the parameters in the service: # systemctl reload-or-restart systemd-timesyncd" reference : "800-171|3.3.6,800-171|3.3.7,800-171r3|03.03.06a.,800-171r3|03.03.07,800-53|AU-7,800-53|AU-8,800-53r5|AU-7,800-53r5|AU-8,CN-L3|7.1.2.3(c),CN-L3|8.1.4.3(b),CSCv7|6.1,CSCv8|8.4,CSF|PR.PT-1,CSF|RS.AN-3,CSF2.0|PR.PS-04,CSF2.0|RS.AN-03,CSF2.0|RS.AN-06,CSF2.0|RS.AN-07,GDPR|32.1.b,HIPAA|164.306(a)(1),HIPAA|164.312(b),ISO-27001-2022|A.8.17,ITSG-33|AU-7,ITSG-33|AU-8,LEVEL|1A,NESA|T3.6.2,QCSC-v1|8.2.1,QCSC-v1|10.2.1,QCSC-v1|11.2,QCSC-v1|13.2,SWIFT-CSCv1|6.4,TBA-FIISB|37.4" see_also : "https://workbench.cisecurity.org/benchmarks/20333" cmd : "#!/bin/bash { l_output=\"\" l_output2=\"\" a_parlist=(\"NTP=[^#\\n\\r]+\" \"FallbackNTP=[^#\\n\\r]+\") l_systemd_config_file=\"/etc/systemd/timesyncd.conf\" # Main systemd configuration file config_file_parameter_chk() { unset A_out; declare -A A_out # Check config file(s) setting while read -r l_out; do if [ -n \"$l_out\" ]; then if [[ $l_out =~ ^\\s*# ]]; then l_file=\"${l_out//# /}\" else l_systemd_parameter=\"$(awk -F= '{print $1}' <<< \"$l_out\" | xargs)\" grep -Piq -- \"^\\h*$l_systemd_parameter_name\\b\" <<< \"$l_systemd_parameter\" && A_out+=([\"$l_systemd_parameter\"]=\"$l_file\") fi fi done < <(/usr/bin/systemd-analyze cat-config \"$l_systemd_config_file\" | grep -Pio '^\\h*([^#\\n\\r]+|#\\h*\\/[^#\\n\\r\\h]+\\.conf\\b)') if (( ${#A_out[@]} > 0 )); then # Assess output from files and generate output while IFS=\"=\" read -r l_systemd_file_parameter_name l_systemd_file_parameter_value; do l_systemd_file_parameter_name=\"${l_systemd_file_parameter_name// /}\" l_systemd_file_parameter_value=\"${l_systemd_file_parameter_value// /}\" if grep -Piq \"^\\h*$l_systemd_parameter_value\\b\" <<< \"$l_systemd_file_parameter_value\"; then l_output=\"$l_output\\n - \\\"$l_systemd_parameter_name\\\" is correctly set to \\\"$l_systemd_file_parameter_value\\\" in \\\"$(printf '%s' \"${A_out[@]}\")\\\"\\n\" else l_output2=\"$l_output2\\n - \\\"$l_systemd_parameter_name\\\" is incorrectly set to \\\"$l_systemd_file_parameter_value\\\" in \\\"$(printf '%s' \"${A_out[@]}\")\\\" and should have a value matching: \\\"$l_systemd_parameter_value\\\"\\n\" fi done < <(grep -Pio -- \"^\\h*$l_systemd_parameter_name\\h*=\\h*\\H+\" \"${A_out[@]}\") else l_output2=\"$l_output2\\n - \\\"$l_systemd_parameter_name\\\" is not set in an included file\\n ** Note: \\\"$l_systemd_parameter_name\\\" May be set in a file that's ignored by load procedure **\\n\" fi } while IFS=\"=\" read -r l_systemd_parameter_name l_systemd_parameter_value; do # Assess and check parameters l_systemd_parameter_name=\"${l_systemd_parameter_name// /}\" l_systemd_parameter_value=\"${l_systemd_parameter_value// /}\" config_file_parameter_chk done < <(printf '%s\\n' \"${a_parlist[@]}\") if [ -z \"$l_output2\" ]; then # Provide output from checks echo -e \"\\n- Audit Result:\\n ** PASS **\\n$l_output\\n\" else echo -e \"\\n- Audit Result:\\n ** FAIL **\\n - Reason(s) for audit failure:\\n$l_output2\" [ -n \"$l_output\" ] && echo -e \"\\n- Correctly set:\\n$l_output\\n\" fi }" expect : "(?i)^[\\s]*\\**[\\s]*pass:?[\\s]*\\**$" description : "2.3.2.1 Ensure systemd-timesyncd configured with authorized timeserver" info : "NTP= - A space-separated list of NTP server host names or IP addresses. During runtime this list is combined with any per-interface NTP servers acquired from systemd-networkd.service(8). systemd-timesyncd will contact all configured system or per-interface servers in turn, until one responds. When the empty string is assigned, the list of NTP servers is reset, and all prior assignments will have no effect. This setting defaults to an empty list. FallbackNTP= - A space-separated list of NTP server host names or IP addresses to be used as the fallback NTP servers. Any per-interface NTP servers obtained from systemd-networkd.service(8) take precedence over this setting, as do any servers set via NTP= above. This setting is hence only relevant if no other NTP server information is known. When the empty string is assigned, the list of NTP servers is reset, and all prior assignments will have no effect. If this option is not given, a compiled-in list of NTP servers is used. Time synchronization is important to support time sensitive security mechanisms and to ensure log files have consistent time records across the enterprise to aid in forensic investigations" solution : "Set NTP and/or FallbackNPT parameters to local site approved authoritative time server(s) in /etc/systemd/timesyncd.conf or a file in /etc/systemd/timesyncd.conf.d/ ending inconf in the [Time] section: Example file: [Time] NTP=time.nist.gov # Uses the generic name for NIST's time servers FallbackNTP=time-a-g.nist.gov time-b-g.nist.gov time-c-g.nist.gov # Space separated list of NIST time servers Example script to create systemd drop-in configuration file: #!/usr/bin/env bash { a_settings=(\"NTP=time.nist.gov\" \"FallbackNTP=time-a-g.nist.gov time-b-g.nist.gov time-c-g.nist.gov\") [ ! -d /etc/systemd/timesyncd.conf.d/ ] && mkdir /etc/systemd/timesyncd.conf.d/ if grep -Psq -- '^\h*\[Time\]' /etc/systemd/timesyncd.conf.d/60-timesyncd.conf; then printf '%s\n' \"\" \"${a_settings[@]}\" >> /etc/systemd/timesyncd.conf.d/60-timesyncd.conf else printf '%s\n' \"\" \"[Time]\" \"${a_settings[@]}\" >> /etc/systemd/timesyncd.conf.d/60-timesyncd.conf fi } Note: If this setting appears in a canonically later file, or later in the same file, the setting will be overwritten Run to following command to update the parameters in the service: # systemctl reload-or-restart systemd-timesyncd" reference : "800-171|3.3.6,800-171|3.3.7,800-171r3|03.03.06a.,800-171r3|03.03.07,800-53|AU-7,800-53|AU-8,800-53r5|AU-7,800-53r5|AU-8,CN-L3|7.1.2.3(c),CN-L3|8.1.4.3(b),CSCv7|6.1,CSCv8|8.4,CSF|PR.PT-1,CSF|RS.AN-3,CSF2.0|PR.PS-04,CSF2.0|RS.AN-03,CSF2.0|RS.AN-06,CSF2.0|RS.AN-07,GDPR|32.1.b,HIPAA|164.306(a)(1),HIPAA|164.312(b),ISO-27001-2022|A.8.17,ITSG-33|AU-7,ITSG-33|AU-8,LEVEL|1A,NESA|T3.6.2,QCSC-v1|8.2.1,QCSC-v1|10.2.1,QCSC-v1|11.2,QCSC-v1|13.2,SWIFT-CSCv1|6.4,TBA-FIISB|37.4" see_also : "https://workbench.cisecurity.org/benchmarks/20333" type : CMD_EXEC description : "active" cmd : "/bin/systemctl is-active systemd-timesyncd" expect : "^[\\s]*active[\\s]*$" type : CMD_EXEC description : "enabled" cmd : "/bin/systemctl is-enabled systemd-timesyncd" expect : "^[\\s]*enabled[\\s]*$" description : "2.3.2.2 Ensure systemd-timesyncd is enabled and running" info : "systemd-timesyncd is a daemon that has been added for synchronizing the system clock across the network systemd-timesyncd needs to be enabled and running in order to synchronize the system to a timeserver. Time synchronization is important to support time sensitive security mechanisms and to ensure log files have consistent time records across the enterprise to aid in forensic investigations" solution : "- IF - systemd-timesyncd is in use on the system, run the following commands: Run the following command to unmask systemd-timesyncd.service : # systemctl unmask systemd-timesyncd.service Run the following command to enable and start systemd-timesyncd.service : # systemctl --now enable systemd-timesyncd.service - OR - If another time synchronization service is in use on the system, run the following command to stop and mask systemd-timesyncd : # systemctl --now mask systemd-timesyncd.service" reference : "800-171|3.3.6,800-171|3.3.7,800-171r3|03.03.06a.,800-171r3|03.03.07,800-53|AU-7,800-53|AU-8,800-53r5|AU-7,800-53r5|AU-8,CN-L3|7.1.2.3(c),CN-L3|8.1.4.3(b),CSCv7|6.1,CSCv8|8.4,CSF|PR.PT-1,CSF|RS.AN-3,CSF2.0|PR.PS-04,CSF2.0|RS.AN-03,CSF2.0|RS.AN-06,CSF2.0|RS.AN-07,GDPR|32.1.b,HIPAA|164.306(a)(1),HIPAA|164.312(b),ISO-27001-2022|A.8.17,ITSG-33|AU-7,ITSG-33|AU-8,LEVEL|1A,NESA|T3.6.2,QCSC-v1|8.2.1,QCSC-v1|10.2.1,QCSC-v1|11.2,QCSC-v1|13.2,SWIFT-CSCv1|6.4,TBA-FIISB|37.4" see_also : "https://workbench.cisecurity.org/benchmarks/20333" show_output : YES description : "2.3.2.2 Ensure systemd-timesyncd is enabled and running" info : "systemd-timesyncd is a daemon that has been added for synchronizing the system clock across the network systemd-timesyncd needs to be enabled and running in order to synchronize the system to a timeserver. Time synchronization is important to support time sensitive security mechanisms and to ensure log files have consistent time records across the enterprise to aid in forensic investigations NOTE: Nessus has not performed this check. Please review the benchmark to ensure target compliance." solution : "- IF - systemd-timesyncd is in use on the system, run the following commands: Run the following command to unmask systemd-timesyncd.service : # systemctl unmask systemd-timesyncd.service Run the following command to enable and start systemd-timesyncd.service : # systemctl --now enable systemd-timesyncd.service - OR - If another time synchronization service is in use on the system, run the following command to stop and mask systemd-timesyncd : # systemctl --now mask systemd-timesyncd.service" reference : "800-171|3.3.6,800-171|3.3.7,800-171r3|03.03.06a.,800-171r3|03.03.07,800-53|AU-7,800-53|AU-8,800-53r5|AU-7,800-53r5|AU-8,CN-L3|7.1.2.3(c),CN-L3|8.1.4.3(b),CSCv7|6.1,CSCv8|8.4,CSF|PR.PT-1,CSF|RS.AN-3,CSF2.0|PR.PS-04,CSF2.0|RS.AN-03,CSF2.0|RS.AN-06,CSF2.0|RS.AN-07,GDPR|32.1.b,HIPAA|164.306(a)(1),HIPAA|164.312(b),ISO-27001-2022|A.8.17,ITSG-33|AU-7,ITSG-33|AU-8,LEVEL|1A,NESA|T3.6.2,QCSC-v1|8.2.1,QCSC-v1|10.2.1,QCSC-v1|11.2,QCSC-v1|13.2,SWIFT-CSCv1|6.4,TBA-FIISB|37.4" see_also : "https://workbench.cisecurity.org/benchmarks/20333" show_output : YES type : RPM_CHECK description : "Check if chrony is installed" rpm : "chrony-0.0.0-0" operator : "gt" required : YES type : FILE_CONTENT_CHECK description : "chronyd options" file : "/etc/sysconfig/chronyd" regex : "^[\\s]*OPTIONS[\\s]*=" expect : "^[\\s]*OPTIONS[\\s]*=[\\s]*\"([^\"#]*\\s+)*-u\\schrony\\b[^\"#]*\"\\s*(?:#.*)?$" type : FILE_CONTENT_CHECK description : "chrony.conf - server/pool" file : "/etc/chrony.conf" regex : "^[\\s]*(server|pool)[\\s]+@NTP_SERVER@" expect : "^[\\s]*(server|pool)[\\s]+@NTP_SERVER@" description : "2.3.3.1 Ensure chrony is configured" info : "chrony is a daemon which implements the Network Time Protocol (NTP) and 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. If chrony is in use on the system proper configuration is vital to ensuring time synchronization is working properly. Note: This recommendation only applies if chrony is in use on the system. If another method of time synchronization is in use on the system, this recommendation can be skipped." solution : "Add or edit server or pool lines to /etc/chrony.conf as appropriate: server Add or edit the OPTIONS in /etc/sysconfig/chronyd to include ' -u chrony ': OPTIONS=\"-u chrony\" Run the following command to reload the chrony config: # systemctl reload-or-restart chronyd" reference : "800-171|3.3.6,800-171|3.3.7,800-171r3|03.03.06a.,800-171r3|03.03.07,800-53|AU-7,800-53|AU-8,800-53r5|AU-7,800-53r5|AU-8,CN-L3|7.1.2.3(c),CN-L3|8.1.4.3(b),CSCv7|6.1,CSCv8|8.4,CSF|PR.PT-1,CSF|RS.AN-3,CSF2.0|PR.PS-04,CSF2.0|RS.AN-03,CSF2.0|RS.AN-06,CSF2.0|RS.AN-07,GDPR|32.1.b,HIPAA|164.306(a)(1),HIPAA|164.312(b),ISO-27001-2022|A.8.17,ITSG-33|AU-7,ITSG-33|AU-8,LEVEL|1A,NESA|T3.6.2,QCSC-v1|8.2.1,QCSC-v1|10.2.1,QCSC-v1|11.2,QCSC-v1|13.2,SWIFT-CSCv1|6.4,TBA-FIISB|37.4" see_also : "https://workbench.cisecurity.org/benchmarks/20333" show_output : YES description : "2.3.3.1 Ensure chrony is configured" info : "chrony is a daemon which implements the Network Time Protocol (NTP) and 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. If chrony is in use on the system proper configuration is vital to ensuring time synchronization is working properly. Note: This recommendation only applies if chrony is in use on the system. If another method of time synchronization is in use on the system, this recommendation can be skipped." solution : "Add or edit server or pool lines to /etc/chrony.conf as appropriate: server Add or edit the OPTIONS in /etc/sysconfig/chronyd to include ' -u chrony ': OPTIONS=\"-u chrony\" Run the following command to reload the chrony config: # systemctl reload-or-restart chronyd" reference : "800-171|3.3.6,800-171|3.3.7,800-171r3|03.03.06a.,800-171r3|03.03.07,800-53|AU-7,800-53|AU-8,800-53r5|AU-7,800-53r5|AU-8,CN-L3|7.1.2.3(c),CN-L3|8.1.4.3(b),CSCv7|6.1,CSCv8|8.4,CSF|PR.PT-1,CSF|RS.AN-3,CSF2.0|PR.PS-04,CSF2.0|RS.AN-03,CSF2.0|RS.AN-06,CSF2.0|RS.AN-07,GDPR|32.1.b,HIPAA|164.306(a)(1),HIPAA|164.312(b),ISO-27001-2022|A.8.17,ITSG-33|AU-7,ITSG-33|AU-8,LEVEL|1A,NESA|T3.6.2,QCSC-v1|8.2.1,QCSC-v1|10.2.1,QCSC-v1|11.2,QCSC-v1|13.2,SWIFT-CSCv1|6.4,TBA-FIISB|37.4" see_also : "https://workbench.cisecurity.org/benchmarks/20333" type : RPM_CHECK description : "Check if chrony is installed" rpm : "chrony-0.0.0-0" operator : "gt" required : YES type : CMD_EXEC description : "active" cmd : "/bin/systemctl is-active chronyd.service" expect : "^[\\s]*active[\\s]*$" type : CMD_EXEC description : "enabled" cmd : "/bin/systemctl is-enabled chronyd.service" expect : "^[\\s]*enabled[\\s]*$" description : "2.3.3.2 Ensure chrony is enabled and running" info : "chrony is a daemon for synchronizing the system clock across the network chrony needs to be enabled and running in order to synchronize the system to a timeserver. Time synchronization is important to support time sensitive security mechanisms and to ensure log files have consistent time records across the enterprise to aid in forensic investigations Note: - If systemd-timesyncd is being used, chrony should be removed and this section skipped - Only one time synchronization method should be in use on the system" solution : "- IF - chrony is in use on the system, run the following commands: Run the following command to unmask chronyd.service : # systemctl unmask chronyd.service Run the following command to enable and start chronyd.service : # systemctl --now enable chronyd.service - OR - If another time synchronization service is in use on the system, run the following command to remove chrony : # zypper remove chrony" reference : "800-171|3.3.6,800-171|3.3.7,800-171r3|03.03.06a.,800-171r3|03.03.07,800-53|AU-7,800-53|AU-8,800-53r5|AU-7,800-53r5|AU-8,CN-L3|7.1.2.3(c),CN-L3|8.1.4.3(b),CSCv7|6.1,CSCv8|8.4,CSF|PR.PT-1,CSF|RS.AN-3,CSF2.0|PR.PS-04,CSF2.0|RS.AN-03,CSF2.0|RS.AN-06,CSF2.0|RS.AN-07,GDPR|32.1.b,HIPAA|164.306(a)(1),HIPAA|164.312(b),ISO-27001-2022|A.8.17,ITSG-33|AU-7,ITSG-33|AU-8,LEVEL|1A,NESA|T3.6.2,QCSC-v1|8.2.1,QCSC-v1|10.2.1,QCSC-v1|11.2,QCSC-v1|13.2,SWIFT-CSCv1|6.4,TBA-FIISB|37.4" see_also : "https://workbench.cisecurity.org/benchmarks/20333" show_output : YES description : "2.3.3.2 Ensure chrony is enabled and running" info : "chrony is a daemon for synchronizing the system clock across the network chrony needs to be enabled and running in order to synchronize the system to a timeserver. Time synchronization is important to support time sensitive security mechanisms and to ensure log files have consistent time records across the enterprise to aid in forensic investigations Note: - If systemd-timesyncd is being used, chrony should be removed and this section skipped - Only one time synchronization method should be in use on the system" solution : "- IF - chrony is in use on the system, run the following commands: Run the following command to unmask chronyd.service : # systemctl unmask chronyd.service Run the following command to enable and start chronyd.service : # systemctl --now enable chronyd.service - OR - If another time synchronization service is in use on the system, run the following command to remove chrony : # zypper remove chrony" reference : "800-171|3.3.6,800-171|3.3.7,800-171r3|03.03.06a.,800-171r3|03.03.07,800-53|AU-7,800-53|AU-8,800-53r5|AU-7,800-53r5|AU-8,CN-L3|7.1.2.3(c),CN-L3|8.1.4.3(b),CSCv7|6.1,CSCv8|8.4,CSF|PR.PT-1,CSF|RS.AN-3,CSF2.0|PR.PS-04,CSF2.0|RS.AN-03,CSF2.0|RS.AN-06,CSF2.0|RS.AN-07,GDPR|32.1.b,HIPAA|164.306(a)(1),HIPAA|164.312(b),ISO-27001-2022|A.8.17,ITSG-33|AU-7,ITSG-33|AU-8,LEVEL|1A,NESA|T3.6.2,QCSC-v1|8.2.1,QCSC-v1|10.2.1,QCSC-v1|11.2,QCSC-v1|13.2,SWIFT-CSCv1|6.4,TBA-FIISB|37.4" see_also : "https://workbench.cisecurity.org/benchmarks/20333" type : CMD_EXEC description : "cron installed" cmd : "/bin/dpkg -s cron 2>&1 | /bin/grep -E '(^Status:|not installed)'" expect : "^Status: install ok" type : CMD_EXEC description : "cronie installed" cmd : "/bin/dpkg -s cronie 2>&1 | /bin/grep -E '(^Status:|not installed)'" expect : "^Status: install ok" type : CMD_EXEC description : "enabled" cmd : "/bin/systemctl list-unit-files | /bin/awk '$1~/^crond?\\.service/{print $2}'" expect : "^[\\s]*enabled[\\s]*$" type : CMD_EXEC description : "active" cmd : "/bin/systemctl list-units | /bin/awk '$1~/^crond?\\.service/{print $3}'" expect : "^[\\s]*active[\\s]*$" description : "2.4.1.1 Ensure cron daemon is enabled and active" info : "The cron daemon is used to execute batch jobs on the system. 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 : "- IF - cron is installed on the system: Run the following commands to unmask, enable, and start cron : # systemctl unmask \"$(systemctl list-unit-files | awk '$1~/^crond?\.service/{print $1}')\" # systemctl --now enable \"$(systemctl list-unit-files | awk '$1~/^crond?\.service/{print $1}')\"" reference : "800-171|3.4.2,800-171r3|03.04.02a.,800-53|CM-6b.,800-53r5|CM-6b.,CN-L3|8.1.10.6(d),CSF|PR.IP-1,CSF2.0|DE.CM-09,CSF2.0|PR.PS-01,GDPR|32.1.b,HIPAA|164.306(a)(1),ISO-27001-2022|A.8.9,ITSG-33|CM-6b.,LEVEL|1A,NESA|T3.2.1,SWIFT-CSCv1|2.3" see_also : "https://workbench.cisecurity.org/benchmarks/20333" show_output : YES description : "2.4.1.1 Ensure cron daemon is enabled and active" info : "The cron daemon is used to execute batch jobs on the system. 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 : "- IF - cron is installed on the system: Run the following commands to unmask, enable, and start cron : # systemctl unmask \"$(systemctl list-unit-files | awk '$1~/^crond?\.service/{print $1}')\" # systemctl --now enable \"$(systemctl list-unit-files | awk '$1~/^crond?\.service/{print $1}')\"" reference : "800-171|3.4.2,800-171r3|03.04.02a.,800-53|CM-6b.,800-53r5|CM-6b.,CN-L3|8.1.10.6(d),CSF|PR.IP-1,CSF2.0|DE.CM-09,CSF2.0|PR.PS-01,GDPR|32.1.b,HIPAA|164.306(a)(1),ISO-27001-2022|A.8.9,ITSG-33|CM-6b.,LEVEL|1A,NESA|T3.2.1,SWIFT-CSCv1|2.3" see_also : "https://workbench.cisecurity.org/benchmarks/20333" type : CMD_EXEC description : "cron installed" cmd : "/bin/dpkg -s cron 2>&1 | /bin/grep -E '(^Status:|not installed)'" expect : "^Status: install ok" type : CMD_EXEC description : "cronie installed" cmd : "/bin/dpkg -s cronie 2>&1 | /bin/grep -E '(^Status:|not installed)'" expect : "^Status: install ok" type : FILE_CHECK description : "2.4.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. 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 : "- IF - cron is installed on the system: 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.1.1,800-171|3.1.4,800-171|3.1.5,800-171|3.8.1,800-171|3.8.2,800-171|3.8.3,800-171r3|03.01.02,800-171r3|03.01.04,800-171r3|03.01.05a.,800-171r3|03.08.02,800-53|AC-3,800-53|AC-5,800-53|AC-6,800-53|MP-2,800-53r5|AC-3,800-53r5|AC-5,800-53r5|AC-6,800-53r5|MP-2,CN-L3|7.1.3.2(b),CN-L3|7.1.3.2(g),CN-L3|8.1.4.2(d),CN-L3|8.1.4.2(f),CN-L3|8.1.4.11(b),CN-L3|8.1.10.2(c),CN-L3|8.1.10.6(a),CN-L3|8.5.3.1,CN-L3|8.5.4.1(a),CSCv7|14.6,CSCv8|3.3,CSF|PR.AC-4,CSF|PR.DS-5,CSF|PR.PT-2,CSF|PR.PT-3,CSF2.0|PR.AA-05,CSF2.0|PR.DS-10,CSF2.0|PR.IR-01,GDPR|32.1.b,HIPAA|164.306(a)(1),HIPAA|164.312(a)(1),ISO-27001-2022|A.5.3,ISO-27001-2022|A.5.10,ISO-27001-2022|A.5.15,ISO-27001-2022|A.5.33,ISO-27001-2022|A.7.7,ISO-27001-2022|A.7.10,ISO-27001-2022|A.8.2,ISO-27001-2022|A.8.3,ISO-27001-2022|A.8.18,ISO-27001-2022|A.8.20,ISO/IEC-27001|A.6.1.2,ISO/IEC-27001|A.9.4.1,ISO/IEC-27001|A.9.4.5,ITSG-33|AC-3,ITSG-33|AC-5,ITSG-33|AC-6,ITSG-33|MP-2,ITSG-33|MP-2a.,LEVEL|1A,NESA|T1.3.2,NESA|T1.3.3,NESA|T1.4.1,NESA|T4.2.1,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.2,NESA|T7.5.3,NIAv2|AM1,NIAv2|AM3,NIAv2|AM23f,NIAv2|SS13c,NIAv2|SS15c,NIAv2|SS29,PCI-DSSv3.2.1|7.1.2,PCI-DSSv4.0|7.2.1,PCI-DSSv4.0|7.2.2,QCSC-v1|3.2,QCSC-v1|5.2.2,QCSC-v1|6.2,QCSC-v1|13.2,SWIFT-CSCv1|5.1,TBA-FIISB|31.1,TBA-FIISB|31.4.2,TBA-FIISB|31.4.3" see_also : "https://workbench.cisecurity.org/benchmarks/20333" file : "/etc/crontab" owner : "root" mask : "177" group : "root" description : "2.4.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. 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 : "- IF - cron is installed on the system: 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.1.1,800-171|3.1.4,800-171|3.1.5,800-171|3.8.1,800-171|3.8.2,800-171|3.8.3,800-171r3|03.01.02,800-171r3|03.01.04,800-171r3|03.01.05a.,800-171r3|03.08.02,800-53|AC-3,800-53|AC-5,800-53|AC-6,800-53|MP-2,800-53r5|AC-3,800-53r5|AC-5,800-53r5|AC-6,800-53r5|MP-2,CN-L3|7.1.3.2(b),CN-L3|7.1.3.2(g),CN-L3|8.1.4.2(d),CN-L3|8.1.4.2(f),CN-L3|8.1.4.11(b),CN-L3|8.1.10.2(c),CN-L3|8.1.10.6(a),CN-L3|8.5.3.1,CN-L3|8.5.4.1(a),CSCv7|14.6,CSCv8|3.3,CSF|PR.AC-4,CSF|PR.DS-5,CSF|PR.PT-2,CSF|PR.PT-3,CSF2.0|PR.AA-05,CSF2.0|PR.DS-10,CSF2.0|PR.IR-01,GDPR|32.1.b,HIPAA|164.306(a)(1),HIPAA|164.312(a)(1),ISO-27001-2022|A.5.3,ISO-27001-2022|A.5.10,ISO-27001-2022|A.5.15,ISO-27001-2022|A.5.33,ISO-27001-2022|A.7.7,ISO-27001-2022|A.7.10,ISO-27001-2022|A.8.2,ISO-27001-2022|A.8.3,ISO-27001-2022|A.8.18,ISO-27001-2022|A.8.20,ISO/IEC-27001|A.6.1.2,ISO/IEC-27001|A.9.4.1,ISO/IEC-27001|A.9.4.5,ITSG-33|AC-3,ITSG-33|AC-5,ITSG-33|AC-6,ITSG-33|MP-2,ITSG-33|MP-2a.,LEVEL|1A,NESA|T1.3.2,NESA|T1.3.3,NESA|T1.4.1,NESA|T4.2.1,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.2,NESA|T7.5.3,NIAv2|AM1,NIAv2|AM3,NIAv2|AM23f,NIAv2|SS13c,NIAv2|SS15c,NIAv2|SS29,PCI-DSSv3.2.1|7.1.2,PCI-DSSv4.0|7.2.1,PCI-DSSv4.0|7.2.2,QCSC-v1|3.2,QCSC-v1|5.2.2,QCSC-v1|6.2,QCSC-v1|13.2,SWIFT-CSCv1|5.1,TBA-FIISB|31.1,TBA-FIISB|31.4.2,TBA-FIISB|31.4.3" see_also : "https://workbench.cisecurity.org/benchmarks/20333" type : CMD_EXEC description : "cron installed" cmd : "/bin/dpkg -s cron 2>&1 | /bin/grep -E '(^Status:|not installed)'" expect : "^Status: install ok" type : CMD_EXEC description : "cronie installed" cmd : "/bin/dpkg -s cronie 2>&1 | /bin/grep -E '(^Status:|not installed)'" expect : "^Status: install ok" type : FILE_CHECK description : "2.4.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. 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 : "- IF - cron is installed on the system: Run the following commands to set ownership and permissions on the /etc/cron.hourly directory: # chown root:root /etc/cron.hourly/ # chmod og-rwx /etc/cron.hourly/" reference : "800-171|3.1.1,800-171|3.1.4,800-171|3.1.5,800-171|3.8.1,800-171|3.8.2,800-171|3.8.3,800-171r3|03.01.02,800-171r3|03.01.04,800-171r3|03.01.05a.,800-171r3|03.08.02,800-53|AC-3,800-53|AC-5,800-53|AC-6,800-53|MP-2,800-53r5|AC-3,800-53r5|AC-5,800-53r5|AC-6,800-53r5|MP-2,CN-L3|7.1.3.2(b),CN-L3|7.1.3.2(g),CN-L3|8.1.4.2(d),CN-L3|8.1.4.2(f),CN-L3|8.1.4.11(b),CN-L3|8.1.10.2(c),CN-L3|8.1.10.6(a),CN-L3|8.5.3.1,CN-L3|8.5.4.1(a),CSCv7|14.6,CSCv8|3.3,CSF|PR.AC-4,CSF|PR.DS-5,CSF|PR.PT-2,CSF|PR.PT-3,CSF2.0|PR.AA-05,CSF2.0|PR.DS-10,CSF2.0|PR.IR-01,GDPR|32.1.b,HIPAA|164.306(a)(1),HIPAA|164.312(a)(1),ISO-27001-2022|A.5.3,ISO-27001-2022|A.5.10,ISO-27001-2022|A.5.15,ISO-27001-2022|A.5.33,ISO-27001-2022|A.7.7,ISO-27001-2022|A.7.10,ISO-27001-2022|A.8.2,ISO-27001-2022|A.8.3,ISO-27001-2022|A.8.18,ISO-27001-2022|A.8.20,ISO/IEC-27001|A.6.1.2,ISO/IEC-27001|A.9.4.1,ISO/IEC-27001|A.9.4.5,ITSG-33|AC-3,ITSG-33|AC-5,ITSG-33|AC-6,ITSG-33|MP-2,ITSG-33|MP-2a.,LEVEL|1A,NESA|T1.3.2,NESA|T1.3.3,NESA|T1.4.1,NESA|T4.2.1,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.2,NESA|T7.5.3,NIAv2|AM1,NIAv2|AM3,NIAv2|AM23f,NIAv2|SS13c,NIAv2|SS15c,NIAv2|SS29,PCI-DSSv3.2.1|7.1.2,PCI-DSSv4.0|7.2.1,PCI-DSSv4.0|7.2.2,QCSC-v1|3.2,QCSC-v1|5.2.2,QCSC-v1|6.2,QCSC-v1|13.2,SWIFT-CSCv1|5.1,TBA-FIISB|31.1,TBA-FIISB|31.4.2,TBA-FIISB|31.4.3" see_also : "https://workbench.cisecurity.org/benchmarks/20333" file : "/etc/cron.hourly" owner : "root" mask : "077" group : "root" description : "2.4.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. 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 : "- IF - cron is installed on the system: Run the following commands to set ownership and permissions on the /etc/cron.hourly directory: # chown root:root /etc/cron.hourly/ # chmod og-rwx /etc/cron.hourly/" reference : "800-171|3.1.1,800-171|3.1.4,800-171|3.1.5,800-171|3.8.1,800-171|3.8.2,800-171|3.8.3,800-171r3|03.01.02,800-171r3|03.01.04,800-171r3|03.01.05a.,800-171r3|03.08.02,800-53|AC-3,800-53|AC-5,800-53|AC-6,800-53|MP-2,800-53r5|AC-3,800-53r5|AC-5,800-53r5|AC-6,800-53r5|MP-2,CN-L3|7.1.3.2(b),CN-L3|7.1.3.2(g),CN-L3|8.1.4.2(d),CN-L3|8.1.4.2(f),CN-L3|8.1.4.11(b),CN-L3|8.1.10.2(c),CN-L3|8.1.10.6(a),CN-L3|8.5.3.1,CN-L3|8.5.4.1(a),CSCv7|14.6,CSCv8|3.3,CSF|PR.AC-4,CSF|PR.DS-5,CSF|PR.PT-2,CSF|PR.PT-3,CSF2.0|PR.AA-05,CSF2.0|PR.DS-10,CSF2.0|PR.IR-01,GDPR|32.1.b,HIPAA|164.306(a)(1),HIPAA|164.312(a)(1),ISO-27001-2022|A.5.3,ISO-27001-2022|A.5.10,ISO-27001-2022|A.5.15,ISO-27001-2022|A.5.33,ISO-27001-2022|A.7.7,ISO-27001-2022|A.7.10,ISO-27001-2022|A.8.2,ISO-27001-2022|A.8.3,ISO-27001-2022|A.8.18,ISO-27001-2022|A.8.20,ISO/IEC-27001|A.6.1.2,ISO/IEC-27001|A.9.4.1,ISO/IEC-27001|A.9.4.5,ITSG-33|AC-3,ITSG-33|AC-5,ITSG-33|AC-6,ITSG-33|MP-2,ITSG-33|MP-2a.,LEVEL|1A,NESA|T1.3.2,NESA|T1.3.3,NESA|T1.4.1,NESA|T4.2.1,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.2,NESA|T7.5.3,NIAv2|AM1,NIAv2|AM3,NIAv2|AM23f,NIAv2|SS13c,NIAv2|SS15c,NIAv2|SS29,PCI-DSSv3.2.1|7.1.2,PCI-DSSv4.0|7.2.1,PCI-DSSv4.0|7.2.2,QCSC-v1|3.2,QCSC-v1|5.2.2,QCSC-v1|6.2,QCSC-v1|13.2,SWIFT-CSCv1|5.1,TBA-FIISB|31.1,TBA-FIISB|31.4.2,TBA-FIISB|31.4.3" see_also : "https://workbench.cisecurity.org/benchmarks/20333" type : CMD_EXEC description : "cron installed" cmd : "/bin/dpkg -s cron 2>&1 | /bin/grep -E '(^Status:|not installed)'" expect : "^Status: install ok" type : CMD_EXEC description : "cronie installed" cmd : "/bin/dpkg -s cronie 2>&1 | /bin/grep -E '(^Status:|not installed)'" expect : "^Status: install ok" type : FILE_CHECK description : "2.4.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. 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 : "- IF - cron is installed on the system: Run the following commands to set ownership and permissions on the /etc/cron.daily directory: # chown root:root /etc/cron.daily/ # chmod og-rwx /etc/cron.daily/" reference : "800-171|3.1.1,800-171|3.1.4,800-171|3.1.5,800-171|3.8.1,800-171|3.8.2,800-171|3.8.3,800-171r3|03.01.02,800-171r3|03.01.04,800-171r3|03.01.05a.,800-171r3|03.08.02,800-53|AC-3,800-53|AC-5,800-53|AC-6,800-53|MP-2,800-53r5|AC-3,800-53r5|AC-5,800-53r5|AC-6,800-53r5|MP-2,CN-L3|7.1.3.2(b),CN-L3|7.1.3.2(g),CN-L3|8.1.4.2(d),CN-L3|8.1.4.2(f),CN-L3|8.1.4.11(b),CN-L3|8.1.10.2(c),CN-L3|8.1.10.6(a),CN-L3|8.5.3.1,CN-L3|8.5.4.1(a),CSCv7|14.6,CSCv8|3.3,CSF|PR.AC-4,CSF|PR.DS-5,CSF|PR.PT-2,CSF|PR.PT-3,CSF2.0|PR.AA-05,CSF2.0|PR.DS-10,CSF2.0|PR.IR-01,GDPR|32.1.b,HIPAA|164.306(a)(1),HIPAA|164.312(a)(1),ISO-27001-2022|A.5.3,ISO-27001-2022|A.5.10,ISO-27001-2022|A.5.15,ISO-27001-2022|A.5.33,ISO-27001-2022|A.7.7,ISO-27001-2022|A.7.10,ISO-27001-2022|A.8.2,ISO-27001-2022|A.8.3,ISO-27001-2022|A.8.18,ISO-27001-2022|A.8.20,ISO/IEC-27001|A.6.1.2,ISO/IEC-27001|A.9.4.1,ISO/IEC-27001|A.9.4.5,ITSG-33|AC-3,ITSG-33|AC-5,ITSG-33|AC-6,ITSG-33|MP-2,ITSG-33|MP-2a.,LEVEL|1A,NESA|T1.3.2,NESA|T1.3.3,NESA|T1.4.1,NESA|T4.2.1,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.2,NESA|T7.5.3,NIAv2|AM1,NIAv2|AM3,NIAv2|AM23f,NIAv2|SS13c,NIAv2|SS15c,NIAv2|SS29,PCI-DSSv3.2.1|7.1.2,PCI-DSSv4.0|7.2.1,PCI-DSSv4.0|7.2.2,QCSC-v1|3.2,QCSC-v1|5.2.2,QCSC-v1|6.2,QCSC-v1|13.2,SWIFT-CSCv1|5.1,TBA-FIISB|31.1,TBA-FIISB|31.4.2,TBA-FIISB|31.4.3" see_also : "https://workbench.cisecurity.org/benchmarks/20333" file : "/etc/cron.daily" owner : "root" mask : "077" group : "root" description : "2.4.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. 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 : "- IF - cron is installed on the system: Run the following commands to set ownership and permissions on the /etc/cron.daily directory: # chown root:root /etc/cron.daily/ # chmod og-rwx /etc/cron.daily/" reference : "800-171|3.1.1,800-171|3.1.4,800-171|3.1.5,800-171|3.8.1,800-171|3.8.2,800-171|3.8.3,800-171r3|03.01.02,800-171r3|03.01.04,800-171r3|03.01.05a.,800-171r3|03.08.02,800-53|AC-3,800-53|AC-5,800-53|AC-6,800-53|MP-2,800-53r5|AC-3,800-53r5|AC-5,800-53r5|AC-6,800-53r5|MP-2,CN-L3|7.1.3.2(b),CN-L3|7.1.3.2(g),CN-L3|8.1.4.2(d),CN-L3|8.1.4.2(f),CN-L3|8.1.4.11(b),CN-L3|8.1.10.2(c),CN-L3|8.1.10.6(a),CN-L3|8.5.3.1,CN-L3|8.5.4.1(a),CSCv7|14.6,CSCv8|3.3,CSF|PR.AC-4,CSF|PR.DS-5,CSF|PR.PT-2,CSF|PR.PT-3,CSF2.0|PR.AA-05,CSF2.0|PR.DS-10,CSF2.0|PR.IR-01,GDPR|32.1.b,HIPAA|164.306(a)(1),HIPAA|164.312(a)(1),ISO-27001-2022|A.5.3,ISO-27001-2022|A.5.10,ISO-27001-2022|A.5.15,ISO-27001-2022|A.5.33,ISO-27001-2022|A.7.7,ISO-27001-2022|A.7.10,ISO-27001-2022|A.8.2,ISO-27001-2022|A.8.3,ISO-27001-2022|A.8.18,ISO-27001-2022|A.8.20,ISO/IEC-27001|A.6.1.2,ISO/IEC-27001|A.9.4.1,ISO/IEC-27001|A.9.4.5,ITSG-33|AC-3,ITSG-33|AC-5,ITSG-33|AC-6,ITSG-33|MP-2,ITSG-33|MP-2a.,LEVEL|1A,NESA|T1.3.2,NESA|T1.3.3,NESA|T1.4.1,NESA|T4.2.1,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.2,NESA|T7.5.3,NIAv2|AM1,NIAv2|AM3,NIAv2|AM23f,NIAv2|SS13c,NIAv2|SS15c,NIAv2|SS29,PCI-DSSv3.2.1|7.1.2,PCI-DSSv4.0|7.2.1,PCI-DSSv4.0|7.2.2,QCSC-v1|3.2,QCSC-v1|5.2.2,QCSC-v1|6.2,QCSC-v1|13.2,SWIFT-CSCv1|5.1,TBA-FIISB|31.1,TBA-FIISB|31.4.2,TBA-FIISB|31.4.3" see_also : "https://workbench.cisecurity.org/benchmarks/20333" type : CMD_EXEC description : "cron installed" cmd : "/bin/dpkg -s cron 2>&1 | /bin/grep -E '(^Status:|not installed)'" expect : "^Status: install ok" type : CMD_EXEC description : "cronie installed" cmd : "/bin/dpkg -s cronie 2>&1 | /bin/grep -E '(^Status:|not installed)'" expect : "^Status: install ok" type : FILE_CHECK description : "2.4.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. 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 : "- IF - cron is installed on the system: Run the following commands to set ownership and permissions on the /etc/cron.weekly directory: # chown root:root /etc/cron.weekly/ # chmod og-rwx /etc/cron.weekly/" reference : "800-171|3.1.1,800-171|3.1.4,800-171|3.1.5,800-171|3.8.1,800-171|3.8.2,800-171|3.8.3,800-171r3|03.01.02,800-171r3|03.01.04,800-171r3|03.01.05a.,800-171r3|03.08.02,800-53|AC-3,800-53|AC-5,800-53|AC-6,800-53|MP-2,800-53r5|AC-3,800-53r5|AC-5,800-53r5|AC-6,800-53r5|MP-2,CN-L3|7.1.3.2(b),CN-L3|7.1.3.2(g),CN-L3|8.1.4.2(d),CN-L3|8.1.4.2(f),CN-L3|8.1.4.11(b),CN-L3|8.1.10.2(c),CN-L3|8.1.10.6(a),CN-L3|8.5.3.1,CN-L3|8.5.4.1(a),CSCv7|14.6,CSCv8|3.3,CSF|PR.AC-4,CSF|PR.DS-5,CSF|PR.PT-2,CSF|PR.PT-3,CSF2.0|PR.AA-05,CSF2.0|PR.DS-10,CSF2.0|PR.IR-01,GDPR|32.1.b,HIPAA|164.306(a)(1),HIPAA|164.312(a)(1),ISO-27001-2022|A.5.3,ISO-27001-2022|A.5.10,ISO-27001-2022|A.5.15,ISO-27001-2022|A.5.33,ISO-27001-2022|A.7.7,ISO-27001-2022|A.7.10,ISO-27001-2022|A.8.2,ISO-27001-2022|A.8.3,ISO-27001-2022|A.8.18,ISO-27001-2022|A.8.20,ISO/IEC-27001|A.6.1.2,ISO/IEC-27001|A.9.4.1,ISO/IEC-27001|A.9.4.5,ITSG-33|AC-3,ITSG-33|AC-5,ITSG-33|AC-6,ITSG-33|MP-2,ITSG-33|MP-2a.,LEVEL|1A,NESA|T1.3.2,NESA|T1.3.3,NESA|T1.4.1,NESA|T4.2.1,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.2,NESA|T7.5.3,NIAv2|AM1,NIAv2|AM3,NIAv2|AM23f,NIAv2|SS13c,NIAv2|SS15c,NIAv2|SS29,PCI-DSSv3.2.1|7.1.2,PCI-DSSv4.0|7.2.1,PCI-DSSv4.0|7.2.2,QCSC-v1|3.2,QCSC-v1|5.2.2,QCSC-v1|6.2,QCSC-v1|13.2,SWIFT-CSCv1|5.1,TBA-FIISB|31.1,TBA-FIISB|31.4.2,TBA-FIISB|31.4.3" see_also : "https://workbench.cisecurity.org/benchmarks/20333" file : "/etc/cron.weekly" owner : "root" mask : "077" group : "root" description : "2.4.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. 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 : "- IF - cron is installed on the system: Run the following commands to set ownership and permissions on the /etc/cron.weekly directory: # chown root:root /etc/cron.weekly/ # chmod og-rwx /etc/cron.weekly/" reference : "800-171|3.1.1,800-171|3.1.4,800-171|3.1.5,800-171|3.8.1,800-171|3.8.2,800-171|3.8.3,800-171r3|03.01.02,800-171r3|03.01.04,800-171r3|03.01.05a.,800-171r3|03.08.02,800-53|AC-3,800-53|AC-5,800-53|AC-6,800-53|MP-2,800-53r5|AC-3,800-53r5|AC-5,800-53r5|AC-6,800-53r5|MP-2,CN-L3|7.1.3.2(b),CN-L3|7.1.3.2(g),CN-L3|8.1.4.2(d),CN-L3|8.1.4.2(f),CN-L3|8.1.4.11(b),CN-L3|8.1.10.2(c),CN-L3|8.1.10.6(a),CN-L3|8.5.3.1,CN-L3|8.5.4.1(a),CSCv7|14.6,CSCv8|3.3,CSF|PR.AC-4,CSF|PR.DS-5,CSF|PR.PT-2,CSF|PR.PT-3,CSF2.0|PR.AA-05,CSF2.0|PR.DS-10,CSF2.0|PR.IR-01,GDPR|32.1.b,HIPAA|164.306(a)(1),HIPAA|164.312(a)(1),ISO-27001-2022|A.5.3,ISO-27001-2022|A.5.10,ISO-27001-2022|A.5.15,ISO-27001-2022|A.5.33,ISO-27001-2022|A.7.7,ISO-27001-2022|A.7.10,ISO-27001-2022|A.8.2,ISO-27001-2022|A.8.3,ISO-27001-2022|A.8.18,ISO-27001-2022|A.8.20,ISO/IEC-27001|A.6.1.2,ISO/IEC-27001|A.9.4.1,ISO/IEC-27001|A.9.4.5,ITSG-33|AC-3,ITSG-33|AC-5,ITSG-33|AC-6,ITSG-33|MP-2,ITSG-33|MP-2a.,LEVEL|1A,NESA|T1.3.2,NESA|T1.3.3,NESA|T1.4.1,NESA|T4.2.1,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.2,NESA|T7.5.3,NIAv2|AM1,NIAv2|AM3,NIAv2|AM23f,NIAv2|SS13c,NIAv2|SS15c,NIAv2|SS29,PCI-DSSv3.2.1|7.1.2,PCI-DSSv4.0|7.2.1,PCI-DSSv4.0|7.2.2,QCSC-v1|3.2,QCSC-v1|5.2.2,QCSC-v1|6.2,QCSC-v1|13.2,SWIFT-CSCv1|5.1,TBA-FIISB|31.1,TBA-FIISB|31.4.2,TBA-FIISB|31.4.3" see_also : "https://workbench.cisecurity.org/benchmarks/20333" type : CMD_EXEC description : "cron installed" cmd : "/bin/dpkg -s cron 2>&1 | /bin/grep -E '(^Status:|not installed)'" expect : "^Status: install ok" type : CMD_EXEC description : "cronie installed" cmd : "/bin/dpkg -s cronie 2>&1 | /bin/grep -E '(^Status:|not installed)'" expect : "^Status: install ok" type : FILE_CHECK description : "2.4.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. 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 : "- IF - cron is installed on the system: Run the following commands to set ownership and permissions on the /etc/cron.monthly directory: # chown root:root /etc/cron.monthly/ # chmod og-rwx /etc/cron.monthly/" reference : "800-171|3.1.1,800-171|3.1.4,800-171|3.1.5,800-171|3.8.1,800-171|3.8.2,800-171|3.8.3,800-171r3|03.01.02,800-171r3|03.01.04,800-171r3|03.01.05a.,800-171r3|03.08.02,800-53|AC-3,800-53|AC-5,800-53|AC-6,800-53|MP-2,800-53r5|AC-3,800-53r5|AC-5,800-53r5|AC-6,800-53r5|MP-2,CN-L3|7.1.3.2(b),CN-L3|7.1.3.2(g),CN-L3|8.1.4.2(d),CN-L3|8.1.4.2(f),CN-L3|8.1.4.11(b),CN-L3|8.1.10.2(c),CN-L3|8.1.10.6(a),CN-L3|8.5.3.1,CN-L3|8.5.4.1(a),CSCv7|14.6,CSCv8|3.3,CSF|PR.AC-4,CSF|PR.DS-5,CSF|PR.PT-2,CSF|PR.PT-3,CSF2.0|PR.AA-05,CSF2.0|PR.DS-10,CSF2.0|PR.IR-01,GDPR|32.1.b,HIPAA|164.306(a)(1),HIPAA|164.312(a)(1),ISO-27001-2022|A.5.3,ISO-27001-2022|A.5.10,ISO-27001-2022|A.5.15,ISO-27001-2022|A.5.33,ISO-27001-2022|A.7.7,ISO-27001-2022|A.7.10,ISO-27001-2022|A.8.2,ISO-27001-2022|A.8.3,ISO-27001-2022|A.8.18,ISO-27001-2022|A.8.20,ISO/IEC-27001|A.6.1.2,ISO/IEC-27001|A.9.4.1,ISO/IEC-27001|A.9.4.5,ITSG-33|AC-3,ITSG-33|AC-5,ITSG-33|AC-6,ITSG-33|MP-2,ITSG-33|MP-2a.,LEVEL|1A,NESA|T1.3.2,NESA|T1.3.3,NESA|T1.4.1,NESA|T4.2.1,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.2,NESA|T7.5.3,NIAv2|AM1,NIAv2|AM3,NIAv2|AM23f,NIAv2|SS13c,NIAv2|SS15c,NIAv2|SS29,PCI-DSSv3.2.1|7.1.2,PCI-DSSv4.0|7.2.1,PCI-DSSv4.0|7.2.2,QCSC-v1|3.2,QCSC-v1|5.2.2,QCSC-v1|6.2,QCSC-v1|13.2,SWIFT-CSCv1|5.1,TBA-FIISB|31.1,TBA-FIISB|31.4.2,TBA-FIISB|31.4.3" see_also : "https://workbench.cisecurity.org/benchmarks/20333" file : "/etc/cron.monthly" owner : "root" mask : "077" group : "root" description : "2.4.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. 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 : "- IF - cron is installed on the system: Run the following commands to set ownership and permissions on the /etc/cron.monthly directory: # chown root:root /etc/cron.monthly/ # chmod og-rwx /etc/cron.monthly/" reference : "800-171|3.1.1,800-171|3.1.4,800-171|3.1.5,800-171|3.8.1,800-171|3.8.2,800-171|3.8.3,800-171r3|03.01.02,800-171r3|03.01.04,800-171r3|03.01.05a.,800-171r3|03.08.02,800-53|AC-3,800-53|AC-5,800-53|AC-6,800-53|MP-2,800-53r5|AC-3,800-53r5|AC-5,800-53r5|AC-6,800-53r5|MP-2,CN-L3|7.1.3.2(b),CN-L3|7.1.3.2(g),CN-L3|8.1.4.2(d),CN-L3|8.1.4.2(f),CN-L3|8.1.4.11(b),CN-L3|8.1.10.2(c),CN-L3|8.1.10.6(a),CN-L3|8.5.3.1,CN-L3|8.5.4.1(a),CSCv7|14.6,CSCv8|3.3,CSF|PR.AC-4,CSF|PR.DS-5,CSF|PR.PT-2,CSF|PR.PT-3,CSF2.0|PR.AA-05,CSF2.0|PR.DS-10,CSF2.0|PR.IR-01,GDPR|32.1.b,HIPAA|164.306(a)(1),HIPAA|164.312(a)(1),ISO-27001-2022|A.5.3,ISO-27001-2022|A.5.10,ISO-27001-2022|A.5.15,ISO-27001-2022|A.5.33,ISO-27001-2022|A.7.7,ISO-27001-2022|A.7.10,ISO-27001-2022|A.8.2,ISO-27001-2022|A.8.3,ISO-27001-2022|A.8.18,ISO-27001-2022|A.8.20,ISO/IEC-27001|A.6.1.2,ISO/IEC-27001|A.9.4.1,ISO/IEC-27001|A.9.4.5,ITSG-33|AC-3,ITSG-33|AC-5,ITSG-33|AC-6,ITSG-33|MP-2,ITSG-33|MP-2a.,LEVEL|1A,NESA|T1.3.2,NESA|T1.3.3,NESA|T1.4.1,NESA|T4.2.1,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.2,NESA|T7.5.3,NIAv2|AM1,NIAv2|AM3,NIAv2|AM23f,NIAv2|SS13c,NIAv2|SS15c,NIAv2|SS29,PCI-DSSv3.2.1|7.1.2,PCI-DSSv4.0|7.2.1,PCI-DSSv4.0|7.2.2,QCSC-v1|3.2,QCSC-v1|5.2.2,QCSC-v1|6.2,QCSC-v1|13.2,SWIFT-CSCv1|5.1,TBA-FIISB|31.1,TBA-FIISB|31.4.2,TBA-FIISB|31.4.3" see_also : "https://workbench.cisecurity.org/benchmarks/20333" type : CMD_EXEC description : "cron installed" cmd : "/bin/dpkg -s cron 2>&1 | /bin/grep -E '(^Status:|not installed)'" expect : "^Status: install ok" type : CMD_EXEC description : "cronie installed" cmd : "/bin/dpkg -s cronie 2>&1 | /bin/grep -E '(^Status:|not installed)'" expect : "^Status: install ok" type : FILE_CHECK description : "2.4.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. 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 : "- IF - cron is installed on the system: Run the following commands to set ownership and permissions on the /etc/cron.d directory: # chown root:root /etc/cron.d/ # chmod og-rwx /etc/cron.d/" reference : "800-171|3.1.1,800-171|3.1.4,800-171|3.1.5,800-171|3.8.1,800-171|3.8.2,800-171|3.8.3,800-171r3|03.01.02,800-171r3|03.01.04,800-171r3|03.01.05a.,800-171r3|03.08.02,800-53|AC-3,800-53|AC-5,800-53|AC-6,800-53|MP-2,800-53r5|AC-3,800-53r5|AC-5,800-53r5|AC-6,800-53r5|MP-2,CN-L3|7.1.3.2(b),CN-L3|7.1.3.2(g),CN-L3|8.1.4.2(d),CN-L3|8.1.4.2(f),CN-L3|8.1.4.11(b),CN-L3|8.1.10.2(c),CN-L3|8.1.10.6(a),CN-L3|8.5.3.1,CN-L3|8.5.4.1(a),CSCv7|14.6,CSCv8|3.3,CSF|PR.AC-4,CSF|PR.DS-5,CSF|PR.PT-2,CSF|PR.PT-3,CSF2.0|PR.AA-05,CSF2.0|PR.DS-10,CSF2.0|PR.IR-01,GDPR|32.1.b,HIPAA|164.306(a)(1),HIPAA|164.312(a)(1),ISO-27001-2022|A.5.3,ISO-27001-2022|A.5.10,ISO-27001-2022|A.5.15,ISO-27001-2022|A.5.33,ISO-27001-2022|A.7.7,ISO-27001-2022|A.7.10,ISO-27001-2022|A.8.2,ISO-27001-2022|A.8.3,ISO-27001-2022|A.8.18,ISO-27001-2022|A.8.20,ISO/IEC-27001|A.6.1.2,ISO/IEC-27001|A.9.4.1,ISO/IEC-27001|A.9.4.5,ITSG-33|AC-3,ITSG-33|AC-5,ITSG-33|AC-6,ITSG-33|MP-2,ITSG-33|MP-2a.,LEVEL|1A,NESA|T1.3.2,NESA|T1.3.3,NESA|T1.4.1,NESA|T4.2.1,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.2,NESA|T7.5.3,NIAv2|AM1,NIAv2|AM3,NIAv2|AM23f,NIAv2|SS13c,NIAv2|SS15c,NIAv2|SS29,PCI-DSSv3.2.1|7.1.2,PCI-DSSv4.0|7.2.1,PCI-DSSv4.0|7.2.2,QCSC-v1|3.2,QCSC-v1|5.2.2,QCSC-v1|6.2,QCSC-v1|13.2,SWIFT-CSCv1|5.1,TBA-FIISB|31.1,TBA-FIISB|31.4.2,TBA-FIISB|31.4.3" see_also : "https://workbench.cisecurity.org/benchmarks/20333" file : "/etc/cron.d" owner : "root" mask : "077" group : "root" description : "2.4.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. 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 : "- IF - cron is installed on the system: Run the following commands to set ownership and permissions on the /etc/cron.d directory: # chown root:root /etc/cron.d/ # chmod og-rwx /etc/cron.d/" reference : "800-171|3.1.1,800-171|3.1.4,800-171|3.1.5,800-171|3.8.1,800-171|3.8.2,800-171|3.8.3,800-171r3|03.01.02,800-171r3|03.01.04,800-171r3|03.01.05a.,800-171r3|03.08.02,800-53|AC-3,800-53|AC-5,800-53|AC-6,800-53|MP-2,800-53r5|AC-3,800-53r5|AC-5,800-53r5|AC-6,800-53r5|MP-2,CN-L3|7.1.3.2(b),CN-L3|7.1.3.2(g),CN-L3|8.1.4.2(d),CN-L3|8.1.4.2(f),CN-L3|8.1.4.11(b),CN-L3|8.1.10.2(c),CN-L3|8.1.10.6(a),CN-L3|8.5.3.1,CN-L3|8.5.4.1(a),CSCv7|14.6,CSCv8|3.3,CSF|PR.AC-4,CSF|PR.DS-5,CSF|PR.PT-2,CSF|PR.PT-3,CSF2.0|PR.AA-05,CSF2.0|PR.DS-10,CSF2.0|PR.IR-01,GDPR|32.1.b,HIPAA|164.306(a)(1),HIPAA|164.312(a)(1),ISO-27001-2022|A.5.3,ISO-27001-2022|A.5.10,ISO-27001-2022|A.5.15,ISO-27001-2022|A.5.33,ISO-27001-2022|A.7.7,ISO-27001-2022|A.7.10,ISO-27001-2022|A.8.2,ISO-27001-2022|A.8.3,ISO-27001-2022|A.8.18,ISO-27001-2022|A.8.20,ISO/IEC-27001|A.6.1.2,ISO/IEC-27001|A.9.4.1,ISO/IEC-27001|A.9.4.5,ITSG-33|AC-3,ITSG-33|AC-5,ITSG-33|AC-6,ITSG-33|MP-2,ITSG-33|MP-2a.,LEVEL|1A,NESA|T1.3.2,NESA|T1.3.3,NESA|T1.4.1,NESA|T4.2.1,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.2,NESA|T7.5.3,NIAv2|AM1,NIAv2|AM3,NIAv2|AM23f,NIAv2|SS13c,NIAv2|SS15c,NIAv2|SS29,PCI-DSSv3.2.1|7.1.2,PCI-DSSv4.0|7.2.1,PCI-DSSv4.0|7.2.2,QCSC-v1|3.2,QCSC-v1|5.2.2,QCSC-v1|6.2,QCSC-v1|13.2,SWIFT-CSCv1|5.1,TBA-FIISB|31.1,TBA-FIISB|31.4.2,TBA-FIISB|31.4.3" see_also : "https://workbench.cisecurity.org/benchmarks/20333" type : CMD_EXEC description : "cron installed" cmd : "/bin/dpkg -s cron 2>&1 | /bin/grep -E '(^Status:|not installed)'" expect : "^Status: install ok" type : CMD_EXEC description : "cronie installed" cmd : "/bin/dpkg -s cronie 2>&1 | /bin/grep -E '(^Status:|not installed)'" expect : "^Status: install ok" type : FILE_CHECK description : "/etc/cron.allow file permissions" file : "/etc/cron.allow" owner : "root" mask : "7137" group : "root" || "crontab" type : FILE_CHECK description : "/etc/cron.deny file permissions" file : "/etc/cron.deny" owner : "root" mask : "7137" file_required : NO group : "root" || "crontab" description : "2.4.1.8 Ensure crontab is restricted to authorized users" info : "crontab is the program used to install, deinstall, or list the tables used to drive the cron daemon. Each user can have their own crontab, and though files are created, they are not intended to be edited directly. If the /etc/cron.allow file exists, then you must be listed (one user per line) therein in order to be allowed to use this command. If the /etc/cron.allow file does not exist but the /etc/cron.deny file does exist, then you must not be listed in the /etc/cron.deny file in order to use this command. If neither of these files exists, then depending on site-dependent configuration parameters, only the super user will be allowed to use this command, or all users will be able to use this command. If both files exist then /etc/cron.allow takes precedence. Which means that /etc/cron.deny is not considered and your user must be listed in /etc/cron.allow in order to be able to use the crontab. Regardless of the existence of any of these files, the root administrative user is always allowed to setup a crontab. The files /etc/cron.allow and /etc/cron.deny if they exist, must be either world-readable, or readable by group crontab If they are not, then cron will deny access to all users until the permissions are fixed. There is one file for each user's crontab. Users are not allowed to edit the file directly to ensure that only users allowed by the system to run periodic tasks can add them, and only syntactically correct crontabs will be written. This is enforced by having the directory writable only by the crontab group and configuring crontab command with the setgid bid set for that specific group. Note: - Even though a given user is not listed in cron.allow cron jobs can still be run as that user - The files /etc/cron.allow and /etc/cron.deny if they exist, only controls administrative access to the crontab command for scheduling and modifying cron jobs 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 : "- IF - cron is installed on the system: Run the following script to: - Create /etc/cron.allow if it doesn't exist - Change owner to user root - Change group owner to group root - OR - group crontab if it exists - Change mode to 640 or more restrictive #!/usr/bin/env bash { [ ! -e \"/etc/cron.deny\" ] && touch /etc/cron.allow chmod u-x,g-wx,o-rwx /etc/cron.allow if grep -Pq -- '^\h*crontab\:' /etc/group; then chown root:crontab /etc/cron.allow else chown root:root /etc/cron.allow fi } - IF - /etc/cron.deny exists, run the following script to: - Change owner to user root - Change group owner to group root - OR - group crontab if it exists - Change mode to 640 or more restrictive #!/usr/bin/env bash { if [ -e \"/etc/cron.deny\" ]; then chmod u-x,g-wx,o-rwx /etc/cron.deny if grep -Pq -- '^\h*crontab\:' /etc/group; then chown root:crontab /etc/cron.deny else chown root:root /etc/cron.deny fi fi } Note: On systems where cron is configured to use the group crontab if the group crontab is not set as the owner of cron.allow then cron will deny access to all users and you will see an error similar to: You () are not allowed to use this program (crontab) See crontab(1) for more information" reference : "800-171|3.1.1,800-171|3.1.4,800-171|3.1.5,800-171|3.8.1,800-171|3.8.2,800-171|3.8.3,800-171r3|03.01.02,800-171r3|03.01.04,800-171r3|03.01.05a.,800-171r3|03.08.02,800-53|AC-3,800-53|AC-5,800-53|AC-6,800-53|MP-2,800-53r5|AC-3,800-53r5|AC-5,800-53r5|AC-6,800-53r5|MP-2,CN-L3|7.1.3.2(b),CN-L3|7.1.3.2(g),CN-L3|8.1.4.2(d),CN-L3|8.1.4.2(f),CN-L3|8.1.4.11(b),CN-L3|8.1.10.2(c),CN-L3|8.1.10.6(a),CN-L3|8.5.3.1,CN-L3|8.5.4.1(a),CSCv7|14.6,CSCv8|3.3,CSF|PR.AC-4,CSF|PR.DS-5,CSF|PR.PT-2,CSF|PR.PT-3,CSF2.0|PR.AA-05,CSF2.0|PR.DS-10,CSF2.0|PR.IR-01,GDPR|32.1.b,HIPAA|164.306(a)(1),HIPAA|164.312(a)(1),ISO-27001-2022|A.5.3,ISO-27001-2022|A.5.10,ISO-27001-2022|A.5.15,ISO-27001-2022|A.5.33,ISO-27001-2022|A.7.7,ISO-27001-2022|A.7.10,ISO-27001-2022|A.8.2,ISO-27001-2022|A.8.3,ISO-27001-2022|A.8.18,ISO-27001-2022|A.8.20,ISO/IEC-27001|A.6.1.2,ISO/IEC-27001|A.9.4.1,ISO/IEC-27001|A.9.4.5,ITSG-33|AC-3,ITSG-33|AC-5,ITSG-33|AC-6,ITSG-33|MP-2,ITSG-33|MP-2a.,LEVEL|1A,NESA|T1.3.2,NESA|T1.3.3,NESA|T1.4.1,NESA|T4.2.1,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.2,NESA|T7.5.3,NIAv2|AM1,NIAv2|AM3,NIAv2|AM23f,NIAv2|SS13c,NIAv2|SS15c,NIAv2|SS29,PCI-DSSv3.2.1|7.1.2,PCI-DSSv4.0|7.2.1,PCI-DSSv4.0|7.2.2,QCSC-v1|3.2,QCSC-v1|5.2.2,QCSC-v1|6.2,QCSC-v1|13.2,SWIFT-CSCv1|5.1,TBA-FIISB|31.1,TBA-FIISB|31.4.2,TBA-FIISB|31.4.3" see_also : "https://workbench.cisecurity.org/benchmarks/20333" show_output : YES description : "2.4.1.8 Ensure crontab is restricted to authorized users" info : "crontab is the program used to install, deinstall, or list the tables used to drive the cron daemon. Each user can have their own crontab, and though files are created, they are not intended to be edited directly. If the /etc/cron.allow file exists, then you must be listed (one user per line) therein in order to be allowed to use this command. If the /etc/cron.allow file does not exist but the /etc/cron.deny file does exist, then you must not be listed in the /etc/cron.deny file in order to use this command. If neither of these files exists, then depending on site-dependent configuration parameters, only the super user will be allowed to use this command, or all users will be able to use this command. If both files exist then /etc/cron.allow takes precedence. Which means that /etc/cron.deny is not considered and your user must be listed in /etc/cron.allow in order to be able to use the crontab. Regardless of the existence of any of these files, the root administrative user is always allowed to setup a crontab. The files /etc/cron.allow and /etc/cron.deny if they exist, must be either world-readable, or readable by group crontab If they are not, then cron will deny access to all users until the permissions are fixed. There is one file for each user's crontab. Users are not allowed to edit the file directly to ensure that only users allowed by the system to run periodic tasks can add them, and only syntactically correct crontabs will be written. This is enforced by having the directory writable only by the crontab group and configuring crontab command with the setgid bid set for that specific group. Note: - Even though a given user is not listed in cron.allow cron jobs can still be run as that user - The files /etc/cron.allow and /etc/cron.deny if they exist, only controls administrative access to the crontab command for scheduling and modifying cron jobs 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 : "- IF - cron is installed on the system: Run the following script to: - Create /etc/cron.allow if it doesn't exist - Change owner to user root - Change group owner to group root - OR - group crontab if it exists - Change mode to 640 or more restrictive #!/usr/bin/env bash { [ ! -e \"/etc/cron.deny\" ] && touch /etc/cron.allow chmod u-x,g-wx,o-rwx /etc/cron.allow if grep -Pq -- '^\h*crontab\:' /etc/group; then chown root:crontab /etc/cron.allow else chown root:root /etc/cron.allow fi } - IF - /etc/cron.deny exists, run the following script to: - Change owner to user root - Change group owner to group root - OR - group crontab if it exists - Change mode to 640 or more restrictive #!/usr/bin/env bash { if [ -e \"/etc/cron.deny\" ]; then chmod u-x,g-wx,o-rwx /etc/cron.deny if grep -Pq -- '^\h*crontab\:' /etc/group; then chown root:crontab /etc/cron.deny else chown root:root /etc/cron.deny fi fi } Note: On systems where cron is configured to use the group crontab if the group crontab is not set as the owner of cron.allow then cron will deny access to all users and you will see an error similar to: You () are not allowed to use this program (crontab) See crontab(1) for more information" reference : "800-171|3.1.1,800-171|3.1.4,800-171|3.1.5,800-171|3.8.1,800-171|3.8.2,800-171|3.8.3,800-171r3|03.01.02,800-171r3|03.01.04,800-171r3|03.01.05a.,800-171r3|03.08.02,800-53|AC-3,800-53|AC-5,800-53|AC-6,800-53|MP-2,800-53r5|AC-3,800-53r5|AC-5,800-53r5|AC-6,800-53r5|MP-2,CN-L3|7.1.3.2(b),CN-L3|7.1.3.2(g),CN-L3|8.1.4.2(d),CN-L3|8.1.4.2(f),CN-L3|8.1.4.11(b),CN-L3|8.1.10.2(c),CN-L3|8.1.10.6(a),CN-L3|8.5.3.1,CN-L3|8.5.4.1(a),CSCv7|14.6,CSCv8|3.3,CSF|PR.AC-4,CSF|PR.DS-5,CSF|PR.PT-2,CSF|PR.PT-3,CSF2.0|PR.AA-05,CSF2.0|PR.DS-10,CSF2.0|PR.IR-01,GDPR|32.1.b,HIPAA|164.306(a)(1),HIPAA|164.312(a)(1),ISO-27001-2022|A.5.3,ISO-27001-2022|A.5.10,ISO-27001-2022|A.5.15,ISO-27001-2022|A.5.33,ISO-27001-2022|A.7.7,ISO-27001-2022|A.7.10,ISO-27001-2022|A.8.2,ISO-27001-2022|A.8.3,ISO-27001-2022|A.8.18,ISO-27001-2022|A.8.20,ISO/IEC-27001|A.6.1.2,ISO/IEC-27001|A.9.4.1,ISO/IEC-27001|A.9.4.5,ITSG-33|AC-3,ITSG-33|AC-5,ITSG-33|AC-6,ITSG-33|MP-2,ITSG-33|MP-2a.,LEVEL|1A,NESA|T1.3.2,NESA|T1.3.3,NESA|T1.4.1,NESA|T4.2.1,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.2,NESA|T7.5.3,NIAv2|AM1,NIAv2|AM3,NIAv2|AM23f,NIAv2|SS13c,NIAv2|SS15c,NIAv2|SS29,PCI-DSSv3.2.1|7.1.2,PCI-DSSv4.0|7.2.1,PCI-DSSv4.0|7.2.2,QCSC-v1|3.2,QCSC-v1|5.2.2,QCSC-v1|6.2,QCSC-v1|13.2,SWIFT-CSCv1|5.1,TBA-FIISB|31.1,TBA-FIISB|31.4.2,TBA-FIISB|31.4.3" see_also : "https://workbench.cisecurity.org/benchmarks/20333" type : RPM_CHECK description : "at is installed" rpm : "at-0.0.0-0" operator : "gt" required : YES type : FILE_CHECK description : "/etc/at.allow file permissions" file : "/etc/at.allow" owner : "root" mask : "137" group : "root" || "daemon" type : FILE_CHECK description : "/etc/at.deny file permissions" file : "/etc/at.deny" owner : "root" mask : "137" file_required : NO group : "root" || "daemon" description : "2.4.2.1 Ensure at is restricted to authorized users" info : "at allows fairly complex time specifications, extending the POSIX.2 standard. It accepts times of the form HH:MM to run a job at a specific time of day. (If that time is already past, the next day is assumed.) You may also specify midnight, noon, or teatime (4pm) and you can have a time-of-day suffixed with AM or PM for running in the morning or the evening. You can also say what day the job will be run, by giving a date in the form month-name day with an optional year, or giving a date of the form MMDD[CC]YY, MM/DD/[CC]YY, DD.MM.[CC]YY or [CC]YY-MM-DD. The specification of a date must follow the specification of the time of day. You can also give times like now + count time-units, where the time-units can be minutes, hours, days, or weeks and you can tell at to run the job today by suffixing the time with today and to run the job tomorrow by suffixing the time with tomorrow. The /etc/at.allow and /etc/at.deny files determine which user can submit commands for later execution via at or batch. The format of the files is a list of usernames, one on each line. Whitespace is not permitted. If the file /etc/at.allow exists, only usernames mentioned in it are allowed to use at. If /etc/at.allow does not exist, /etc/at.deny is checked, every username not mentioned in it is then allowed to use at. An empty /etc/at.deny means that every user may use at. If neither file exists, only the superuser is allowed to use at. On many systems, only the system administrator is authorized to schedule at jobs. Using the at.allow file to control who can run at 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 : "- IF - at is installed on the system: Run the following script to: - /etc/at.allow : - Create the file if it doesn't exist - Change owner or user root - If group daemon exists, change to group daemon else change group to root - Change mode to 640 or more restrictive - - IF - /etc/at.deny exists: - Change owner or user root - If group daemon exists, change to group daemon else change group to root - Change mode to 640 or more restrictive #!/usr/bin/env bash { grep -Pq -- '^daemon\b' /etc/group && l_group=\"daemon\" || l_group=\"root\" [ ! -e \"/etc/at.allow\" ] && touch /etc/at.allow chown root:\"$l_group\" /etc/at.allow chmod u-x,g-wx,o-rwx /etc/at.allow [ -e \"/etc/at.deny\" ] && chown root:\"$l_group\" /etc/at.deny [ -e \"/etc/at.deny\" ] && chmod u-x,g-wx,o-rwx /etc/at.deny }" reference : "800-171|3.1.1,800-171|3.1.4,800-171|3.1.5,800-171|3.8.1,800-171|3.8.2,800-171|3.8.3,800-171r3|03.01.02,800-171r3|03.01.04,800-171r3|03.01.05a.,800-171r3|03.08.02,800-53|AC-3,800-53|AC-5,800-53|AC-6,800-53|MP-2,800-53r5|AC-3,800-53r5|AC-5,800-53r5|AC-6,800-53r5|MP-2,CN-L3|7.1.3.2(b),CN-L3|7.1.3.2(g),CN-L3|8.1.4.2(d),CN-L3|8.1.4.2(f),CN-L3|8.1.4.11(b),CN-L3|8.1.10.2(c),CN-L3|8.1.10.6(a),CN-L3|8.5.3.1,CN-L3|8.5.4.1(a),CSCv7|14.6,CSCv8|3.3,CSF|PR.AC-4,CSF|PR.DS-5,CSF|PR.PT-2,CSF|PR.PT-3,CSF2.0|PR.AA-05,CSF2.0|PR.DS-10,CSF2.0|PR.IR-01,GDPR|32.1.b,HIPAA|164.306(a)(1),HIPAA|164.312(a)(1),ISO-27001-2022|A.5.3,ISO-27001-2022|A.5.10,ISO-27001-2022|A.5.15,ISO-27001-2022|A.5.33,ISO-27001-2022|A.7.7,ISO-27001-2022|A.7.10,ISO-27001-2022|A.8.2,ISO-27001-2022|A.8.3,ISO-27001-2022|A.8.18,ISO-27001-2022|A.8.20,ISO/IEC-27001|A.6.1.2,ISO/IEC-27001|A.9.4.1,ISO/IEC-27001|A.9.4.5,ITSG-33|AC-3,ITSG-33|AC-5,ITSG-33|AC-6,ITSG-33|MP-2,ITSG-33|MP-2a.,LEVEL|1A,NESA|T1.3.2,NESA|T1.3.3,NESA|T1.4.1,NESA|T4.2.1,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.2,NESA|T7.5.3,NIAv2|AM1,NIAv2|AM3,NIAv2|AM23f,NIAv2|SS13c,NIAv2|SS15c,NIAv2|SS29,PCI-DSSv3.2.1|7.1.2,PCI-DSSv4.0|7.2.1,PCI-DSSv4.0|7.2.2,QCSC-v1|3.2,QCSC-v1|5.2.2,QCSC-v1|6.2,QCSC-v1|13.2,SWIFT-CSCv1|5.1,TBA-FIISB|31.1,TBA-FIISB|31.4.2,TBA-FIISB|31.4.3" see_also : "https://workbench.cisecurity.org/benchmarks/20333" show_output : YES description : "2.4.2.1 Ensure at is restricted to authorized users" info : "at allows fairly complex time specifications, extending the POSIX.2 standard. It accepts times of the form HH:MM to run a job at a specific time of day. (If that time is already past, the next day is assumed.) You may also specify midnight, noon, or teatime (4pm) and you can have a time-of-day suffixed with AM or PM for running in the morning or the evening. You can also say what day the job will be run, by giving a date in the form month-name day with an optional year, or giving a date of the form MMDD[CC]YY, MM/DD/[CC]YY, DD.MM.[CC]YY or [CC]YY-MM-DD. The specification of a date must follow the specification of the time of day. You can also give times like now + count time-units, where the time-units can be minutes, hours, days, or weeks and you can tell at to run the job today by suffixing the time with today and to run the job tomorrow by suffixing the time with tomorrow. The /etc/at.allow and /etc/at.deny files determine which user can submit commands for later execution via at or batch. The format of the files is a list of usernames, one on each line. Whitespace is not permitted. If the file /etc/at.allow exists, only usernames mentioned in it are allowed to use at. If /etc/at.allow does not exist, /etc/at.deny is checked, every username not mentioned in it is then allowed to use at. An empty /etc/at.deny means that every user may use at. If neither file exists, only the superuser is allowed to use at. On many systems, only the system administrator is authorized to schedule at jobs. Using the at.allow file to control who can run at 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 : "- IF - at is installed on the system: Run the following script to: - /etc/at.allow : - Create the file if it doesn't exist - Change owner or user root - If group daemon exists, change to group daemon else change group to root - Change mode to 640 or more restrictive - - IF - /etc/at.deny exists: - Change owner or user root - If group daemon exists, change to group daemon else change group to root - Change mode to 640 or more restrictive #!/usr/bin/env bash { grep -Pq -- '^daemon\b' /etc/group && l_group=\"daemon\" || l_group=\"root\" [ ! -e \"/etc/at.allow\" ] && touch /etc/at.allow chown root:\"$l_group\" /etc/at.allow chmod u-x,g-wx,o-rwx /etc/at.allow [ -e \"/etc/at.deny\" ] && chown root:\"$l_group\" /etc/at.deny [ -e \"/etc/at.deny\" ] && chmod u-x,g-wx,o-rwx /etc/at.deny }" reference : "800-171|3.1.1,800-171|3.1.4,800-171|3.1.5,800-171|3.8.1,800-171|3.8.2,800-171|3.8.3,800-171r3|03.01.02,800-171r3|03.01.04,800-171r3|03.01.05a.,800-171r3|03.08.02,800-53|AC-3,800-53|AC-5,800-53|AC-6,800-53|MP-2,800-53r5|AC-3,800-53r5|AC-5,800-53r5|AC-6,800-53r5|MP-2,CN-L3|7.1.3.2(b),CN-L3|7.1.3.2(g),CN-L3|8.1.4.2(d),CN-L3|8.1.4.2(f),CN-L3|8.1.4.11(b),CN-L3|8.1.10.2(c),CN-L3|8.1.10.6(a),CN-L3|8.5.3.1,CN-L3|8.5.4.1(a),CSCv7|14.6,CSCv8|3.3,CSF|PR.AC-4,CSF|PR.DS-5,CSF|PR.PT-2,CSF|PR.PT-3,CSF2.0|PR.AA-05,CSF2.0|PR.DS-10,CSF2.0|PR.IR-01,GDPR|32.1.b,HIPAA|164.306(a)(1),HIPAA|164.312(a)(1),ISO-27001-2022|A.5.3,ISO-27001-2022|A.5.10,ISO-27001-2022|A.5.15,ISO-27001-2022|A.5.33,ISO-27001-2022|A.7.7,ISO-27001-2022|A.7.10,ISO-27001-2022|A.8.2,ISO-27001-2022|A.8.3,ISO-27001-2022|A.8.18,ISO-27001-2022|A.8.20,ISO/IEC-27001|A.6.1.2,ISO/IEC-27001|A.9.4.1,ISO/IEC-27001|A.9.4.5,ITSG-33|AC-3,ITSG-33|AC-5,ITSG-33|AC-6,ITSG-33|MP-2,ITSG-33|MP-2a.,LEVEL|1A,NESA|T1.3.2,NESA|T1.3.3,NESA|T1.4.1,NESA|T4.2.1,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.2,NESA|T7.5.3,NIAv2|AM1,NIAv2|AM3,NIAv2|AM23f,NIAv2|SS13c,NIAv2|SS15c,NIAv2|SS29,PCI-DSSv3.2.1|7.1.2,PCI-DSSv4.0|7.2.1,PCI-DSSv4.0|7.2.2,QCSC-v1|3.2,QCSC-v1|5.2.2,QCSC-v1|6.2,QCSC-v1|13.2,SWIFT-CSCv1|5.1,TBA-FIISB|31.1,TBA-FIISB|31.4.2,TBA-FIISB|31.4.3" see_also : "https://workbench.cisecurity.org/benchmarks/20333" type : CMD_EXEC description : "3.1.1 Ensure IPv6 status is identified" info : "Internet Protocol Version 6 (IPv6) is the most recent version of Internet Protocol (IP). It's designed to supply IP addressing and additional security to support the predicted growth of connected devices. IPv6 is based on 128-bit addressing and can support 340 undecillion, which is 340,282,366,920,938,463,463,374,607,431,768,211,456 unique addresses. Features of IPv6 - Hierarchical addressing and routing infrastructure - Statefull and Stateless configuration - Support for quality of service (QoS) - An ideal protocol for neighboring node interaction IETF RFC 4038 recommends that applications are built with an assumption of dual stack. It is recommended that IPv6 be enabled and configured in accordance with Benchmark recommendations. - IF - dual stack and IPv6 are not used in your environment, IPv6 may be disabled to reduce the attack surface of the system, and recommendations pertaining to IPv6 can be skipped. Note: It is recommended that IPv6 be enabled and configured unless this is against local site policy NOTE: Nessus has provided the target output to assist in reviewing the benchmark to ensure target compliance." solution : "Enable or disable IPv6 in accordance with system requirements and local site policy Impact: IETF RFC 4038 recommends that applications are built with an assumption of dual stack. When enabled, IPv6 will require additional configuration to reduce risk to the system." reference : "800-171|3.4.2,800-171|3.4.6,800-171|3.4.7,800-171r3|03.04.02,800-171r3|03.04.06,800-53|CM-6,800-53|CM-7,800-53r5|CM-6,800-53r5|CM-7,CSCv7|9.2,CSCv8|4.8,CSF|PR.IP-1,CSF|PR.PT-3,CSF2.0|DE.CM-09,CSF2.0|PR.PS-01,GDPR|32.1.b,HIPAA|164.306(a)(1),ISO-27001-2022|A.8.9,ITSG-33|CM-6,ITSG-33|CM-7,LEVEL|1M,NIAv2|SS15a,PCI-DSSv3.2.1|2.2.2,SWIFT-CSCv1|2.3" see_also : "https://workbench.cisecurity.org/benchmarks/20333" cmd : "/bin/grep -Pqs '^\\h*0\\b' /sys/module/ipv6/parameters/disable && echo -e \"\\n - IPv6 is enabled\\n\" || echo -e \"\\n - IPv6 is not enabled\\n\"" expect : "Manual Review Required" severity : MEDIUM type : CMD_EXEC description : "3.1.2 Ensure wireless interfaces are disabled" info : "Wireless networking is used when wired networks are unavailable. - IF - wireless is not to be used, wireless devices can be disabled to reduce the potential attack surface." solution : "Run the following script to disable any wireless interfaces: #!/usr/bin/env bash { module_fix() { if ! modprobe -n -v \"$l_mname\" | grep -P -- '^\h*install \/bin\/(true|false)'; then echo -e \" - setting module: \\\"$l_mname\\\" to be un-loadable\" echo -e \"install $l_mname /bin/false\" >> /etc/modprobe.d/\"$l_mname\".conf fi if lsmod | grep \"$l_mname\" > /dev/null 2>&1; then echo -e \" - unloading module \\\"$l_mname\\\"\" modprobe -r \"$l_mname\" fi if ! grep -Pq -- \"^\h*blacklist\h+$l_mname\b\" /etc/modprobe.d/*; then echo -e \" - deny listing \\\"$l_mname\\\"\" echo -e \"blacklist $l_mname\" >> /etc/modprobe.d/\"$l_mname\".conf fi } if [ -n \"$(find /sys/class/net/*/ -type d -name wireless)\" ]; then l_dname=$(for driverdir in $(find /sys/class/net/*/ -type d -name wireless | xargs -0 dirname); do basename \"$(readlink -f \"$driverdir\"/device/driver/module)\";done | sort -u) for l_mname in $l_dname; do module_fix done fi } Impact: Many if not all laptop workstations and some desktop workstations will connect via wireless requiring these interfaces be enabled." reference : "800-171|3.4.2,800-171|3.4.6,800-171|3.4.7,800-171r3|03.04.02,800-171r3|03.04.06,800-53|CM-6,800-53|CM-7,800-53r5|CM-6,800-53r5|CM-7,CSCv7|15.4,CSCv7|15.5,CSCv8|4.8,CSF|PR.IP-1,CSF|PR.PT-3,CSF2.0|DE.CM-09,CSF2.0|PR.PS-01,GDPR|32.1.b,HIPAA|164.306(a)(1),ISO-27001-2022|A.8.9,ITSG-33|CM-6,ITSG-33|CM-7,LEVEL|1A,NIAv2|SS15a,PCI-DSSv3.2.1|2.2.2,SWIFT-CSCv1|2.3" see_also : "https://workbench.cisecurity.org/benchmarks/20333" cmd : "#!/bin/bash { l_output=\"\" l_output2=\"\" module_chk() { # Check how module will be loaded l_loadable=\"$(modprobe -n -v \"$l_mname\")\" if grep -Pq -- '^\\h*install \\/bin\\/(true|false)' <<< \"$l_loadable\"; then l_output=\"$l_output - module: \\\"$l_mname\\\" is not loadable: \\\"$l_loadable\\\"\" else l_output2=\"$l_output2 - module: \\\"$l_mname\\\" is loadable: \\\"$l_loadable\\\"\" fi # Check is the module currently loaded if ! lsmod | grep \"$l_mname\" > /dev/null 2>&1; then l_output=\"$l_output - module: \\\"$l_mname\\\" is not loaded\" else l_output2=\"$l_output2 - module: \\\"$l_mname\\\" is loaded\" fi # Check if the module is deny listed if modprobe --showconfig | grep -Pq -- \"^\\h*blacklist\\h+$l_mname\\b\"; then l_output=\"$l_output - module: \\\"$l_mname\\\" is deny listed in: \\\"$(grep -Pl -- \"^\\h*blacklist\\h+$l_mname\\b\" /etc/modprobe.d/*)\\\"\" else l_output2=\"$l_output2 - module: \\\"$l_mname\\\" is not deny listed\" fi } if [ -n \"$(find /sys/class/net/*/ -type d -name wireless)\" ]; then l_dname=$(for driverdir in $(find /sys/class/net/*/ -type d -name wireless | xargs -0 dirname); do basename \"$(readlink -f \"$driverdir\"/device/driver/module)\";done | sort -u) for l_mname in $l_dname; do module_chk done fi # Report results. If no failures output in l_output2, we pass if [ -z \"$l_output2\" ]; then echo -e \" - Audit Result: ** PASS **\" if [ -z \"$l_output\" ]; then echo -e \" - System has no wireless NICs installed\" else echo -e \" $l_output \" fi else echo -e \" - Audit Result: ** FAIL ** - Reason(s) for audit failure: $l_output2 \" [ -n \"$l_output\" ] && echo -e \" - Correctly set: $l_output \" fi }" expect : "(?i)^[\\s]*\\**[\\s]*pass:?[\\s]*\\**$" timeout : "@FIND_TIMEOUT@" type : RPM_CHECK description : "bluez" rpm : "bluez-0.0.0-0" operator : "lte" type : RPM_CHECK description : "3.1.3 Ensure bluetooth services are not in use" info : "Bluetooth is a short-range wireless technology standard that is used for exchanging data between devices over short distances. It employs UHF radio waves in the ISM bands, from 2.402 GHz to 2.48 GHz. It is mainly used as an alternative to wire connections. An attacker may be able to find a way to access or corrupt your data. One example of this type of activity is bluesnarfing which refers to attackers using a Bluetooth connection to steal information off of your Bluetooth device. Also, viruses or other malicious code can take advantage of Bluetooth technology to infect other devices. If you are infected, your data may be corrupted, compromised, stolen, or lost." solution : "Run the following commands to stop bluetooth.service and remove the bluez package: # systemctl stop bluetooth.service # zypper remove bluez - OR - - IF - the bluez package is required as a dependency: Run the following commands to stop and mask bluetooth.service : # systemctl stop bluetooth.service # systemctl mask bluetooth.service Note: A reboot may be required Impact: Many personal electronic devices (PEDs) use Bluetooth technology. For example, you may be able to operate your computer with a wireless keyboard. Disabling Bluetooth will prevent these devices from connecting to the system. There may be packages that are dependent on the bluez package. If the bluez package is removed, these dependent packages will be removed as well. Before removing the bluez package, review any dependent packages to determine if they are required on the system. - IF - a dependent package is required: stop and mask bluetooth.service leaving the bluez package installed." reference : "800-171|3.4.2,800-171|3.4.6,800-171|3.4.7,800-171r3|03.04.02,800-171r3|03.04.06,800-53|CM-6,800-53|CM-7,800-53r5|CM-6,800-53r5|CM-7,CSCv7|9.2,CSCv8|4.8,CSF|PR.IP-1,CSF|PR.PT-3,CSF2.0|DE.CM-09,CSF2.0|PR.PS-01,GDPR|32.1.b,HIPAA|164.306(a)(1),ISO-27001-2022|A.8.9,ITSG-33|CM-6,ITSG-33|CM-7,LEVEL|1A,NIAv2|SS15a,PCI-DSSv3.2.1|2.2.2,SWIFT-CSCv1|2.3" see_also : "https://workbench.cisecurity.org/benchmarks/20333" rpm : "bluez-0.0.0-0" operator : "lte" type : CMD_EXEC description : "bluetooth.service active" cmd : "/bin/systemctl is-active bluetooth.service 2>/dev/null | /bin/grep '^active' | /bin/awk '{print} END {if (NR == 0) print \"pass\" ; else print \"fail\"}'" expect : "(?i)^[\\s]*\\**[\\s]*pass:?[\\s]*\\**$" type : CMD_EXEC description : "bluetooth.service enabled" cmd : "/bin/systemctl is-enabled bluetooth.service 2>/dev/null | /bin/grep 'enabled' | /bin/awk '{print} END {if (NR == 0) print \"pass\" ; else print \"fail\"}'" expect : "(?i)^[\\s]*\\**[\\s]*pass:?[\\s]*\\**$" description : "3.1.3 Ensure bluetooth services are not in use" info : "Bluetooth is a short-range wireless technology standard that is used for exchanging data between devices over short distances. It employs UHF radio waves in the ISM bands, from 2.402 GHz to 2.48 GHz. It is mainly used as an alternative to wire connections. An attacker may be able to find a way to access or corrupt your data. One example of this type of activity is bluesnarfing which refers to attackers using a Bluetooth connection to steal information off of your Bluetooth device. Also, viruses or other malicious code can take advantage of Bluetooth technology to infect other devices. If you are infected, your data may be corrupted, compromised, stolen, or lost." solution : "Run the following commands to stop bluetooth.service and remove the bluez package: # systemctl stop bluetooth.service # zypper remove bluez - OR - - IF - the bluez package is required as a dependency: Run the following commands to stop and mask bluetooth.service : # systemctl stop bluetooth.service # systemctl mask bluetooth.service Note: A reboot may be required Impact: Many personal electronic devices (PEDs) use Bluetooth technology. For example, you may be able to operate your computer with a wireless keyboard. Disabling Bluetooth will prevent these devices from connecting to the system. There may be packages that are dependent on the bluez package. If the bluez package is removed, these dependent packages will be removed as well. Before removing the bluez package, review any dependent packages to determine if they are required on the system. - IF - a dependent package is required: stop and mask bluetooth.service leaving the bluez package installed." reference : "800-171|3.4.2,800-171|3.4.6,800-171|3.4.7,800-171r3|03.04.02,800-171r3|03.04.06,800-53|CM-6,800-53|CM-7,800-53r5|CM-6,800-53r5|CM-7,CSCv7|9.2,CSCv8|4.8,CSF|PR.IP-1,CSF|PR.PT-3,CSF2.0|DE.CM-09,CSF2.0|PR.PS-01,GDPR|32.1.b,HIPAA|164.306(a)(1),ISO-27001-2022|A.8.9,ITSG-33|CM-6,ITSG-33|CM-7,LEVEL|1A,NIAv2|SS15a,PCI-DSSv3.2.1|2.2.2,SWIFT-CSCv1|2.3" see_also : "https://workbench.cisecurity.org/benchmarks/20333" show_output : YES type : CMD_EXEC description : "3.3.1 Ensure ip forwarding is disabled" 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. Setting net.ipv4.ip_forward and net.ipv6.conf.all.forwarding 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 : "Set the following parameter in /etc/sysctl.conf or a file in /etc/sysctl.d/ ending inconf : - net.ipv4.ip_forward = 0 Example: # printf '%s\n' \"net.ipv4.ip_forward = 0\" >> /etc/sysctl.d/60-netipv4_sysctl.conf Run the following script to set the active kernel parameters: #!/usr/bin/env bash { sysctl -w net.ipv4.ip_forward=0 sysctl -w net.ipv4.route.flush=1 } - IF - IPv6 is enabled on the system: Set the following parameter in /etc/sysctl.conf or a file in /etc/sysctl.d/ ending inconf : - net.ipv6.conf.all.forwarding = 0 Example: # printf '%s\n' \"net.ipv6.conf.all.forwarding = 0\" >> /etc/sysctl.d/60-netipv6_sysctl.conf Run the following script to set the active kernel parameters: #!/usr/bin/env bash { sysctl -w net.ipv6.conf.all.forwarding=0 sysctl -w net.ipv6.route.flush=1 } Note: If these settings appear in a canonically later file, or later in the same file, these settings will be overwritten Impact: IP forwarding is required on systems configured to act as a router. If these parameters are disabled, the system will not be able to perform as a router. Many Cloud Service Provider (CSP) hosted systems require IP forwarding to be enabled. If the system is running on a CSP platform, this requirement should be reviewed before disabling IP forwarding." reference : "800-171|3.4.2,800-171|3.4.6,800-171|3.4.7,800-171r3|03.04.02,800-171r3|03.04.06,800-53|CM-6,800-53|CM-7,800-53r5|CM-6,800-53r5|CM-7,CSCv7|9.2,CSCv8|4.8,CSF|PR.IP-1,CSF|PR.PT-3,CSF2.0|DE.CM-09,CSF2.0|PR.PS-01,GDPR|32.1.b,HIPAA|164.306(a)(1),ISO-27001-2022|A.8.9,ITSG-33|CM-6,ITSG-33|CM-7,LEVEL|1A,NIAv2|SS15a,PCI-DSSv3.2.1|2.2.2,SWIFT-CSCv1|2.3" see_also : "https://workbench.cisecurity.org/benchmarks/20333" cmd : "#!/bin/bash { a_output=(); a_output2=(); l_ipv6_disabled=\"\" a_parlist=(\"net.ipv4.ip_forward=0\" \"net.ipv6.conf.all.forwarding=0\") l_ufwscf=\"$([ -f /etc/default/ufw ] && awk -F= '/^\\s*IPT_SYSCTL=/ {print $2}' /etc/default/ufw)\" f_ipv6_chk() { l_ipv6_disabled=\"no\" ! grep -Pqs -- '^\\h*0\\b' /sys/module/ipv6/parameters/disable && l_ipv6_disabled=\"yes\" if sysctl net.ipv6.conf.all.disable_ipv6 | grep -Pqs -- \"^\\h*net\\.ipv6\\.conf\\.all\\.disable_ipv6\\h*=\\h*1\\b\" && \\ sysctl net.ipv6.conf.default.disable_ipv6 | grep -Pqs -- \"^\\h*net\\.ipv6\\.conf\\.default\\.disable_ipv6\\h*=\\h*1\\b\"; then l_ipv6_disabled=\"yes\" fi } f_kernel_parameter_chk() { l_running_parameter_value=\"$(sysctl \"$l_parameter_name\" | awk -F= '{print $2}' | xargs)\" # Check running configuration if grep -Pq -- '\\b'\"$l_parameter_value\"'\\b' <<< \"$l_running_parameter_value\"; then a_output+=(\" - \\\"$l_parameter_name\\\" is correctly set to \\\"$l_running_parameter_value\\\"\" \" in the running configuration\") else a_output2+=(\" - \\\"$l_parameter_name\\\" is incorrectly set to \\\"$l_running_parameter_value\\\"\" \\ \" in the running configuration\" \\ \" and should have a value of: \\\"$l_value_out\\\"\") fi unset A_out; declare -A A_out # Check durable setting (files) while read -r l_out; do if [ -n \"$l_out\" ]; then if [[ $l_out =~ ^\\s*# ]]; then l_file=\"${l_out//# /}\" else l_kpar=\"$(awk -F= '{print $1}' <<< \"$l_out\" | xargs)\" [ \"$l_kpar\" = \"$l_parameter_name\" ] && A_out+=([\"$l_kpar\"]=\"$l_file\") fi fi done < <(\"$l_systemdsysctl\" --cat-config | grep -Po '^\\h*([^#\\n\\r]+|#\\h*\\/[^#\\n\\r\\h]+\\.conf\\b)') if [ -n \"$l_ufwscf\" ]; then # Account for systems with UFW (Not covered by systemd-sysctl --cat-config) l_kpar=\"$(grep -Po \"^\\h*$l_parameter_name\\b\" \"$l_ufwscf\" | xargs)\" l_kpar=\"${l_kpar//\\//.}\" [ \"$l_kpar\" = \"$l_parameter_name\" ] && A_out+=([\"$l_kpar\"]=\"$l_ufwscf\") fi if (( ${#A_out[@]} > 0 )); then # Assess output from files and generate output while IFS=\"=\" read -r l_fkpname l_file_parameter_value; do l_fkpname=\"${l_fkpname// /}\"; l_file_parameter_value=\"${l_file_parameter_value// /}\" if grep -Pq -- '\\b'\"$l_parameter_value\"'\\b' <<< \"$l_file_parameter_value\"; then a_output+=(\" - \\\"$l_parameter_name\\\" is correctly set to \\\"$l_file_parameter_value\\\"\" \\ \" in \\\"$(printf '%s' \"${A_out[@]}\")\\\"\") else a_output2+=(\" - \\\"$l_parameter_name\\\" is incorrectly set to \\\"$l_file_parameter_value\\\"\" \" in \\\"$(printf '%s' \"${A_out[@]}\")\\\"\" \\ \" and should have a value of: \\\"$l_value_out\\\"\") fi done < <(grep -Po -- \"^\\h*$l_parameter_name\\h*=\\h*\\H+\" \"${A_out[@]}\") else a_output2+=(\" - \\\"$l_parameter_name\\\" is not set in an included file\" \\ \" ** Note: \\\"$l_parameter_name\\\" May be set in a file that's ignored by load procedure **\") fi } l_systemdsysctl=\"$(readlink -f /lib/systemd/systemd-sysctl)\" while IFS=\"=\" read -r l_parameter_name l_parameter_value; do # Assess and check parameters l_parameter_name=\"${l_parameter_name// /}\"; l_parameter_value=\"${l_parameter_value// /}\" l_value_out=\"${l_parameter_value//-/ through }\"; l_value_out=\"${l_value_out//|/ or }\" l_value_out=\"$(tr -d '(){}' <<< \"$l_value_out\")\" if grep -q '^net.ipv6.' <<< \"$l_parameter_name\"; then [ -z \"$l_ipv6_disabled\" ] && f_ipv6_chk if [ \"$l_ipv6_disabled\" = \"yes\" ]; then a_output+=(\" - IPv6 is disabled on the system, \\\"$l_parameter_name\\\" is not applicable\") else f_kernel_parameter_chk fi else f_kernel_parameter_chk fi done < <(printf '%s\\n' \"${a_parlist[@]}\") if [ \"${#a_output2[@]}\" -le 0 ]; then printf '%s\\n' \"\" \"- Audit Result:\" \" ** PASS **\" \"${a_output[@]}\" \"\" else printf '%s\\n' \"\" \"- Audit Result:\" \" ** FAIL **\" \" - Reason(s) for audit failure:\" \"${a_output2[@]}\" [ \"${#a_output[@]}\" -gt 0 ] && printf '%s\\n' \"\" \"- Correctly set:\" \"${a_output[@]}\" \"\" fi }" expect : "(?i)^[\\s]*\\**[\\s]*pass:?[\\s]*\\**$" type : CMD_EXEC description : "3.3.10 Ensure tcp syn cookies is enabled" 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. 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. Setting net.ipv4.tcp_syncookies to 1 enables SYN cookies, allowing the system to keep accepting valid connections, even if under a denial of service attack." solution : "Set the following parameter in /etc/sysctl.conf or a file in /etc/sysctl.d/ ending inconf : - net.ipv4.tcp_syncookies = 1 Example: # printf '%s\n' \"net.ipv4.tcp_syncookies = 1\" >> /etc/sysctl.d/60-netipv4_sysctl.conf Run the following script to set the active kernel parameters: #!/usr/bin/env bash { sysctl -w net.ipv4.tcp_syncookies=1 sysctl -w net.ipv4.route.flush=1 } Note: If these settings appear in a canonically later file, or later in the same file, these settings will be overwritten" reference : "800-171|3.4.2,800-171|3.4.6,800-171|3.4.7,800-171r3|03.04.02,800-171r3|03.04.06,800-53|CM-6,800-53|CM-7,800-53r5|CM-6,800-53r5|CM-7,CSCv7|9.2,CSCv8|4.8,CSF|PR.IP-1,CSF|PR.PT-3,CSF2.0|DE.CM-09,CSF2.0|PR.PS-01,GDPR|32.1.b,HIPAA|164.306(a)(1),ISO-27001-2022|A.8.9,ITSG-33|CM-6,ITSG-33|CM-7,LEVEL|1A,NIAv2|SS15a,PCI-DSSv3.2.1|2.2.2,SWIFT-CSCv1|2.3" see_also : "https://workbench.cisecurity.org/benchmarks/20333" cmd : "#!/bin/bash { a_output=(); a_output2=(); l_ipv6_disabled=\"\" a_parlist=(\"net.ipv4.tcp_syncookies=1\") l_ufwscf=\"$([ -f /etc/default/ufw ] && awk -F= '/^\\s*IPT_SYSCTL=/ {print $2}' /etc/default/ufw)\" f_ipv6_chk() { l_ipv6_disabled=\"no\" ! grep -Pqs -- '^\\h*0\\b' /sys/module/ipv6/parameters/disable && l_ipv6_disabled=\"yes\" if sysctl net.ipv6.conf.all.disable_ipv6 | grep -Pqs -- \"^\\h*net\\.ipv6\\.conf\\.all\\.disable_ipv6\\h*=\\h*1\\b\" && \\ sysctl net.ipv6.conf.default.disable_ipv6 | grep -Pqs -- \"^\\h*net\\.ipv6\\.conf\\.default\\.disable_ipv6\\h*=\\h*1\\b\"; then l_ipv6_disabled=\"yes\" fi } f_kernel_parameter_chk() { l_running_parameter_value=\"$(sysctl \"$l_parameter_name\" | awk -F= '{print $2}' | xargs)\" # Check running configuration if grep -Pq -- '\\b'\"$l_parameter_value\"'\\b' <<< \"$l_running_parameter_value\"; then a_output+=(\" - \\\"$l_parameter_name\\\" is correctly set to \\\"$l_running_parameter_value\\\"\" \" in the running configuration\") else a_output2+=(\" - \\\"$l_parameter_name\\\" is incorrectly set to \\\"$l_running_parameter_value\\\"\" \\ \" in the running configuration\" \\ \" and should have a value of: \\\"$l_value_out\\\"\") fi unset A_out; declare -A A_out # Check durable setting (files) while read -r l_out; do if [ -n \"$l_out\" ]; then if [[ $l_out =~ ^\\s*# ]]; then l_file=\"${l_out//# /}\" else l_kpar=\"$(awk -F= '{print $1}' <<< \"$l_out\" | xargs)\" [ \"$l_kpar\" = \"$l_parameter_name\" ] && A_out+=([\"$l_kpar\"]=\"$l_file\") fi fi done < <(\"$l_systemdsysctl\" --cat-config | grep -Po '^\\h*([^#\\n\\r]+|#\\h*\\/[^#\\n\\r\\h]+\\.conf\\b)') if [ -n \"$l_ufwscf\" ]; then # Account for systems with UFW (Not covered by systemd-sysctl --cat-config) l_kpar=\"$(grep -Po \"^\\h*$l_parameter_name\\b\" \"$l_ufwscf\" | xargs)\" l_kpar=\"${l_kpar//\\//.}\" [ \"$l_kpar\" = \"$l_parameter_name\" ] && A_out+=([\"$l_kpar\"]=\"$l_ufwscf\") fi if (( ${#A_out[@]} > 0 )); then # Assess output from files and generate output while IFS=\"=\" read -r l_fkpname l_file_parameter_value; do l_fkpname=\"${l_fkpname// /}\"; l_file_parameter_value=\"${l_file_parameter_value// /}\" if grep -Pq -- '\\b'\"$l_parameter_value\"'\\b' <<< \"$l_file_parameter_value\"; then a_output+=(\" - \\\"$l_parameter_name\\\" is correctly set to \\\"$l_file_parameter_value\\\"\" \\ \" in \\\"$(printf '%s' \"${A_out[@]}\")\\\"\") else a_output2+=(\" - \\\"$l_parameter_name\\\" is incorrectly set to \\\"$l_file_parameter_value\\\"\" \" in \\\"$(printf '%s' \"${A_out[@]}\")\\\"\" \\ \" and should have a value of: \\\"$l_value_out\\\"\") fi done < <(grep -Po -- \"^\\h*$l_parameter_name\\h*=\\h*\\H+\" \"${A_out[@]}\") else a_output2+=(\" - \\\"$l_parameter_name\\\" is not set in an included file\" \\ \" ** Note: \\\"$l_parameter_name\\\" May be set in a file that's ignored by load procedure **\") fi } l_systemdsysctl=\"$(readlink -f /lib/systemd/systemd-sysctl)\" while IFS=\"=\" read -r l_parameter_name l_parameter_value; do # Assess and check parameters l_parameter_name=\"${l_parameter_name// /}\"; l_parameter_value=\"${l_parameter_value// /}\" l_value_out=\"${l_parameter_value//-/ through }\"; l_value_out=\"${l_value_out//|/ or }\" l_value_out=\"$(tr -d '(){}' <<< \"$l_value_out\")\" if grep -q '^net.ipv6.' <<< \"$l_parameter_name\"; then [ -z \"$l_ipv6_disabled\" ] && f_ipv6_chk if [ \"$l_ipv6_disabled\" = \"yes\" ]; then a_output+=(\" - IPv6 is disabled on the system, \\\"$l_parameter_name\\\" is not applicable\") else f_kernel_parameter_chk fi else f_kernel_parameter_chk fi done < <(printf '%s\\n' \"${a_parlist[@]}\") if [ \"${#a_output2[@]}\" -le 0 ]; then printf '%s\\n' \"\" \"- Audit Result:\" \" ** PASS **\" \"${a_output[@]}\" \"\" else printf '%s\\n' \"\" \"- Audit Result:\" \" ** FAIL **\" \" - Reason(s) for audit failure:\" \"${a_output2[@]}\" [ \"${#a_output[@]}\" -gt 0 ] && printf '%s\\n' \"\" \"- Correctly set:\" \"${a_output[@]}\" \"\" fi }" expect : "(?i)^[\\s]*\\**[\\s]*pass:?[\\s]*\\**$" type : CMD_EXEC description : "3.3.11 Ensure ipv6 router advertisements are not accepted" info : "Routers periodically multicast Router Advertisement messages to announce their availability and convey information to neighboring nodes that enable them to be automatically configured on the network. net.ipv6.conf.all.accept_ra and net.ipv6.conf.default.accept_ra determine the systems ability to accept these advertisements 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. Setting net.ipv6.conf.all.accept_ra and net.ipv6.conf.default.accept_ra to 0 disables the system's ability to accept IPv6 router advertisements." solution : "- IF - IPv6 is enabled on the system: Set the following parameters in /etc/sysctl.conf or a file in /etc/sysctl.d/ ending inconf : - net.ipv6.conf.all.accept_ra = 0 - net.ipv6.conf.default.accept_ra = 0 Example: # printf '%s\n' \"net.ipv6.conf.all.accept_ra = 0\" \"net.ipv6.conf.default.accept_ra = 0\" >> /etc/sysctl.d/60-netipv6_sysctl.conf Run the following script to set the active kernel parameters: #!/usr/bin/env bash { 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 } Note: If these settings appear in a canonically later file, or later in the same file, these settings will be overwritten" reference : "800-171|3.4.2,800-171|3.4.6,800-171|3.4.7,800-171r3|03.04.02,800-171r3|03.04.06,800-53|CM-6,800-53|CM-7,800-53r5|CM-6,800-53r5|CM-7,CSCv7|9.2,CSCv8|4.8,CSF|PR.IP-1,CSF|PR.PT-3,CSF2.0|DE.CM-09,CSF2.0|PR.PS-01,GDPR|32.1.b,HIPAA|164.306(a)(1),ISO-27001-2022|A.8.9,ITSG-33|CM-6,ITSG-33|CM-7,LEVEL|1A,NIAv2|SS15a,PCI-DSSv3.2.1|2.2.2,SWIFT-CSCv1|2.3" see_also : "https://workbench.cisecurity.org/benchmarks/20333" cmd : "#!/bin/bash { a_output=(); a_output2=(); l_ipv6_disabled=\"\" a_parlist=(\"net.ipv6.conf.all.accept_ra=0\" \"net.ipv6.conf.default.accept_ra=0\") l_ufwscf=\"$([ -f /etc/default/ufw ] && awk -F= '/^\\s*IPT_SYSCTL=/ {print $2}' /etc/default/ufw)\" f_ipv6_chk() { l_ipv6_disabled=\"no\" ! grep -Pqs -- '^\\h*0\\b' /sys/module/ipv6/parameters/disable && l_ipv6_disabled=\"yes\" if sysctl net.ipv6.conf.all.disable_ipv6 | grep -Pqs -- \"^\\h*net\\.ipv6\\.conf\\.all\\.disable_ipv6\\h*=\\h*1\\b\" && \\ sysctl net.ipv6.conf.default.disable_ipv6 | grep -Pqs -- \"^\\h*net\\.ipv6\\.conf\\.default\\.disable_ipv6\\h*=\\h*1\\b\"; then l_ipv6_disabled=\"yes\" fi } f_kernel_parameter_chk() { l_running_parameter_value=\"$(sysctl \"$l_parameter_name\" | awk -F= '{print $2}' | xargs)\" # Check running configuration if grep -Pq -- '\\b'\"$l_parameter_value\"'\\b' <<< \"$l_running_parameter_value\"; then a_output+=(\" - \\\"$l_parameter_name\\\" is correctly set to \\\"$l_running_parameter_value\\\"\" \" in the running configuration\") else a_output2+=(\" - \\\"$l_parameter_name\\\" is incorrectly set to \\\"$l_running_parameter_value\\\"\" \\ \" in the running configuration\" \\ \" and should have a value of: \\\"$l_value_out\\\"\") fi unset A_out; declare -A A_out # Check durable setting (files) while read -r l_out; do if [ -n \"$l_out\" ]; then if [[ $l_out =~ ^\\s*# ]]; then l_file=\"${l_out//# /}\" else l_kpar=\"$(awk -F= '{print $1}' <<< \"$l_out\" | xargs)\" [ \"$l_kpar\" = \"$l_parameter_name\" ] && A_out+=([\"$l_kpar\"]=\"$l_file\") fi fi done < <(\"$l_systemdsysctl\" --cat-config | grep -Po '^\\h*([^#\\n\\r]+|#\\h*\\/[^#\\n\\r\\h]+\\.conf\\b)') if [ -n \"$l_ufwscf\" ]; then # Account for systems with UFW (Not covered by systemd-sysctl --cat-config) l_kpar=\"$(grep -Po \"^\\h*$l_parameter_name\\b\" \"$l_ufwscf\" | xargs)\" l_kpar=\"${l_kpar//\\//.}\" [ \"$l_kpar\" = \"$l_parameter_name\" ] && A_out+=([\"$l_kpar\"]=\"$l_ufwscf\") fi if (( ${#A_out[@]} > 0 )); then # Assess output from files and generate output while IFS=\"=\" read -r l_fkpname l_file_parameter_value; do l_fkpname=\"${l_fkpname// /}\"; l_file_parameter_value=\"${l_file_parameter_value// /}\" if grep -Pq -- '\\b'\"$l_parameter_value\"'\\b' <<< \"$l_file_parameter_value\"; then a_output+=(\" - \\\"$l_parameter_name\\\" is correctly set to \\\"$l_file_parameter_value\\\"\" \\ \" in \\\"$(printf '%s' \"${A_out[@]}\")\\\"\") else a_output2+=(\" - \\\"$l_parameter_name\\\" is incorrectly set to \\\"$l_file_parameter_value\\\"\" \" in \\\"$(printf '%s' \"${A_out[@]}\")\\\"\" \\ \" and should have a value of: \\\"$l_value_out\\\"\") fi done < <(grep -Po -- \"^\\h*$l_parameter_name\\h*=\\h*\\H+\" \"${A_out[@]}\") else a_output2+=(\" - \\\"$l_parameter_name\\\" is not set in an included file\" \\ \" ** Note: \\\"$l_parameter_name\\\" May be set in a file that's ignored by load procedure **\") fi } l_systemdsysctl=\"$(readlink -f /lib/systemd/systemd-sysctl)\" while IFS=\"=\" read -r l_parameter_name l_parameter_value; do # Assess and check parameters l_parameter_name=\"${l_parameter_name// /}\"; l_parameter_value=\"${l_parameter_value// /}\" l_value_out=\"${l_parameter_value//-/ through }\"; l_value_out=\"${l_value_out//|/ or }\" l_value_out=\"$(tr -d '(){}' <<< \"$l_value_out\")\" if grep -q '^net.ipv6.' <<< \"$l_parameter_name\"; then [ -z \"$l_ipv6_disabled\" ] && f_ipv6_chk if [ \"$l_ipv6_disabled\" = \"yes\" ]; then a_output+=(\" - IPv6 is disabled on the system, \\\"$l_parameter_name\\\" is not applicable\") else f_kernel_parameter_chk fi else f_kernel_parameter_chk fi done < <(printf '%s\\n' \"${a_parlist[@]}\") if [ \"${#a_output2[@]}\" -le 0 ]; then printf '%s\\n' \"\" \"- Audit Result:\" \" ** PASS **\" \"${a_output[@]}\" \"\" else printf '%s\\n' \"\" \"- Audit Result:\" \" ** FAIL **\" \" - Reason(s) for audit failure:\" \"${a_output2[@]}\" [ \"${#a_output[@]}\" -gt 0 ] && printf '%s\\n' \"\" \"- Correctly set:\" \"${a_output[@]}\" \"\" fi }" expect : "(?i)^[\\s]*\\**[\\s]*pass:?[\\s]*\\**$" type : CMD_EXEC description : "3.3.2 Ensure packet redirect sending is disabled" 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. 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 file in /etc/sysctl.d/ ending inconf : - net.ipv4.conf.all.send_redirects = 0 - net.ipv4.conf.default.send_redirects = 0 Example: # printf '%s\n' \"net.ipv4.conf.all.send_redirects = 0\" \"net.ipv4.conf.default.send_redirects = 0\" >> /etc/sysctl.d/60-netipv4_sysctl.conf Run the following script to set the active kernel parameters: #!/usr/bin/env bash { 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 } Note: If these settings appear in a canonically later file, or later in the same file, these settings will be overwritten Impact: IP forwarding is required on systems configured to act as a router. If these parameters are disabled, the system will not be able to perform as a router." reference : "800-171|3.4.2,800-171|3.4.6,800-171|3.4.7,800-171r3|03.04.02,800-171r3|03.04.06,800-53|CM-6,800-53|CM-7,800-53r5|CM-6,800-53r5|CM-7,CSCv7|9.2,CSCv8|4.8,CSF|PR.IP-1,CSF|PR.PT-3,CSF2.0|DE.CM-09,CSF2.0|PR.PS-01,GDPR|32.1.b,HIPAA|164.306(a)(1),ISO-27001-2022|A.8.9,ITSG-33|CM-6,ITSG-33|CM-7,LEVEL|1A,NIAv2|SS15a,PCI-DSSv3.2.1|2.2.2,SWIFT-CSCv1|2.3" see_also : "https://workbench.cisecurity.org/benchmarks/20333" cmd : "#!/bin/bash { a_output=(); a_output2=(); l_ipv6_disabled=\"\" a_parlist=(\"net.ipv4.conf.all.send_redirects=0\" \"net.ipv4.conf.default.send_redirects=0\") l_ufwscf=\"$([ -f /etc/default/ufw ] && awk -F= '/^\\s*IPT_SYSCTL=/ {print $2}' /etc/default/ufw)\" f_ipv6_chk() { l_ipv6_disabled=\"no\" ! grep -Pqs -- '^\\h*0\\b' /sys/module/ipv6/parameters/disable && l_ipv6_disabled=\"yes\" if sysctl net.ipv6.conf.all.disable_ipv6 | grep -Pqs -- \"^\\h*net\\.ipv6\\.conf\\.all\\.disable_ipv6\\h*=\\h*1\\b\" && \\ sysctl net.ipv6.conf.default.disable_ipv6 | grep -Pqs -- \"^\\h*net\\.ipv6\\.conf\\.default\\.disable_ipv6\\h*=\\h*1\\b\"; then l_ipv6_disabled=\"yes\" fi } f_kernel_parameter_chk() { l_running_parameter_value=\"$(sysctl \"$l_parameter_name\" | awk -F= '{print $2}' | xargs)\" # Check running configuration if grep -Pq -- '\\b'\"$l_parameter_value\"'\\b' <<< \"$l_running_parameter_value\"; then a_output+=(\" - \\\"$l_parameter_name\\\" is correctly set to \\\"$l_running_parameter_value\\\"\" \" in the running configuration\") else a_output2+=(\" - \\\"$l_parameter_name\\\" is incorrectly set to \\\"$l_running_parameter_value\\\"\" \\ \" in the running configuration\" \\ \" and should have a value of: \\\"$l_value_out\\\"\") fi unset A_out; declare -A A_out # Check durable setting (files) while read -r l_out; do if [ -n \"$l_out\" ]; then if [[ $l_out =~ ^\\s*# ]]; then l_file=\"${l_out//# /}\" else l_kpar=\"$(awk -F= '{print $1}' <<< \"$l_out\" | xargs)\" [ \"$l_kpar\" = \"$l_parameter_name\" ] && A_out+=([\"$l_kpar\"]=\"$l_file\") fi fi done < <(\"$l_systemdsysctl\" --cat-config | grep -Po '^\\h*([^#\\n\\r]+|#\\h*\\/[^#\\n\\r\\h]+\\.conf\\b)') if [ -n \"$l_ufwscf\" ]; then # Account for systems with UFW (Not covered by systemd-sysctl --cat-config) l_kpar=\"$(grep -Po \"^\\h*$l_parameter_name\\b\" \"$l_ufwscf\" | xargs)\" l_kpar=\"${l_kpar//\\//.}\" [ \"$l_kpar\" = \"$l_parameter_name\" ] && A_out+=([\"$l_kpar\"]=\"$l_ufwscf\") fi if (( ${#A_out[@]} > 0 )); then # Assess output from files and generate output while IFS=\"=\" read -r l_fkpname l_file_parameter_value; do l_fkpname=\"${l_fkpname// /}\"; l_file_parameter_value=\"${l_file_parameter_value// /}\" if grep -Pq -- '\\b'\"$l_parameter_value\"'\\b' <<< \"$l_file_parameter_value\"; then a_output+=(\" - \\\"$l_parameter_name\\\" is correctly set to \\\"$l_file_parameter_value\\\"\" \\ \" in \\\"$(printf '%s' \"${A_out[@]}\")\\\"\") else a_output2+=(\" - \\\"$l_parameter_name\\\" is incorrectly set to \\\"$l_file_parameter_value\\\"\" \" in \\\"$(printf '%s' \"${A_out[@]}\")\\\"\" \\ \" and should have a value of: \\\"$l_value_out\\\"\") fi done < <(grep -Po -- \"^\\h*$l_parameter_name\\h*=\\h*\\H+\" \"${A_out[@]}\") else a_output2+=(\" - \\\"$l_parameter_name\\\" is not set in an included file\" \\ \" ** Note: \\\"$l_parameter_name\\\" May be set in a file that's ignored by load procedure **\") fi } l_systemdsysctl=\"$(readlink -f /lib/systemd/systemd-sysctl)\" while IFS=\"=\" read -r l_parameter_name l_parameter_value; do # Assess and check parameters l_parameter_name=\"${l_parameter_name// /}\"; l_parameter_value=\"${l_parameter_value// /}\" l_value_out=\"${l_parameter_value//-/ through }\"; l_value_out=\"${l_value_out//|/ or }\" l_value_out=\"$(tr -d '(){}' <<< \"$l_value_out\")\" if grep -q '^net.ipv6.' <<< \"$l_parameter_name\"; then [ -z \"$l_ipv6_disabled\" ] && f_ipv6_chk if [ \"$l_ipv6_disabled\" = \"yes\" ]; then a_output+=(\" - IPv6 is disabled on the system, \\\"$l_parameter_name\\\" is not applicable\") else f_kernel_parameter_chk fi else f_kernel_parameter_chk fi done < <(printf '%s\\n' \"${a_parlist[@]}\") if [ \"${#a_output2[@]}\" -le 0 ]; then printf '%s\\n' \"\" \"- Audit Result:\" \" ** PASS **\" \"${a_output[@]}\" \"\" else printf '%s\\n' \"\" \"- Audit Result:\" \" ** FAIL **\" \" - Reason(s) for audit failure:\" \"${a_output2[@]}\" [ \"${#a_output[@]}\" -gt 0 ] && printf '%s\\n' \"\" \"- Correctly set:\" \"${a_output[@]}\" \"\" fi }" expect : "(?i)^[\\s]*\\**[\\s]*pass:?[\\s]*\\**$" type : CMD_EXEC description : "3.3.3 Ensure bogus icmp responses are ignored" info : "Setting net.ipv4.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. 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 : "Set the following parameter in /etc/sysctl.conf or a file in /etc/sysctl.d/ ending inconf : - net.ipv4.icmp_ignore_bogus_error_responses = 1 Example: # printf '%s\n' \"net.ipv4.icmp_ignore_bogus_error_responses = 1\" >> /etc/sysctl.d/60-netipv4_sysctl.conf Run the following script to set the active kernel parameters: #!/usr/bin/env bash { sysctl -w net.ipv4.icmp_ignore_bogus_error_responses=1 sysctl -w net.ipv4.route.flush=1 } Note: If these settings appear in a canonically later file, or later in the same file, these settings will be overwritten" reference : "800-171|3.4.2,800-171|3.4.6,800-171|3.4.7,800-171r3|03.04.02,800-171r3|03.04.06,800-53|CM-6,800-53|CM-7,800-53r5|CM-6,800-53r5|CM-7,CSCv7|9.2,CSCv8|4.8,CSF|PR.IP-1,CSF|PR.PT-3,CSF2.0|DE.CM-09,CSF2.0|PR.PS-01,GDPR|32.1.b,HIPAA|164.306(a)(1),ISO-27001-2022|A.8.9,ITSG-33|CM-6,ITSG-33|CM-7,LEVEL|1A,NIAv2|SS15a,PCI-DSSv3.2.1|2.2.2,SWIFT-CSCv1|2.3" see_also : "https://workbench.cisecurity.org/benchmarks/20333" cmd : "#!/bin/bash { a_output=(); a_output2=(); l_ipv6_disabled=\"\" a_parlist=(\"net.ipv4.icmp_ignore_bogus_error_responses=1\") l_ufwscf=\"$([ -f /etc/default/ufw ] && awk -F= '/^\\s*IPT_SYSCTL=/ {print $2}' /etc/default/ufw)\" f_ipv6_chk() { l_ipv6_disabled=\"no\" ! grep -Pqs -- '^\\h*0\\b' /sys/module/ipv6/parameters/disable && l_ipv6_disabled=\"yes\" if sysctl net.ipv6.conf.all.disable_ipv6 | grep -Pqs -- \"^\\h*net\\.ipv6\\.conf\\.all\\.disable_ipv6\\h*=\\h*1\\b\" && \\ sysctl net.ipv6.conf.default.disable_ipv6 | grep -Pqs -- \"^\\h*net\\.ipv6\\.conf\\.default\\.disable_ipv6\\h*=\\h*1\\b\"; then l_ipv6_disabled=\"yes\" fi } f_kernel_parameter_chk() { l_running_parameter_value=\"$(sysctl \"$l_parameter_name\" | awk -F= '{print $2}' | xargs)\" # Check running configuration if grep -Pq -- '\\b'\"$l_parameter_value\"'\\b' <<< \"$l_running_parameter_value\"; then a_output+=(\" - \\\"$l_parameter_name\\\" is correctly set to \\\"$l_running_parameter_value\\\"\" \" in the running configuration\") else a_output2+=(\" - \\\"$l_parameter_name\\\" is incorrectly set to \\\"$l_running_parameter_value\\\"\" \\ \" in the running configuration\" \\ \" and should have a value of: \\\"$l_value_out\\\"\") fi unset A_out; declare -A A_out # Check durable setting (files) while read -r l_out; do if [ -n \"$l_out\" ]; then if [[ $l_out =~ ^\\s*# ]]; then l_file=\"${l_out//# /}\" else l_kpar=\"$(awk -F= '{print $1}' <<< \"$l_out\" | xargs)\" [ \"$l_kpar\" = \"$l_parameter_name\" ] && A_out+=([\"$l_kpar\"]=\"$l_file\") fi fi done < <(\"$l_systemdsysctl\" --cat-config | grep -Po '^\\h*([^#\\n\\r]+|#\\h*\\/[^#\\n\\r\\h]+\\.conf\\b)') if [ -n \"$l_ufwscf\" ]; then # Account for systems with UFW (Not covered by systemd-sysctl --cat-config) l_kpar=\"$(grep -Po \"^\\h*$l_parameter_name\\b\" \"$l_ufwscf\" | xargs)\" l_kpar=\"${l_kpar//\\//.}\" [ \"$l_kpar\" = \"$l_parameter_name\" ] && A_out+=([\"$l_kpar\"]=\"$l_ufwscf\") fi if (( ${#A_out[@]} > 0 )); then # Assess output from files and generate output while IFS=\"=\" read -r l_fkpname l_file_parameter_value; do l_fkpname=\"${l_fkpname// /}\"; l_file_parameter_value=\"${l_file_parameter_value// /}\" if grep -Pq -- '\\b'\"$l_parameter_value\"'\\b' <<< \"$l_file_parameter_value\"; then a_output+=(\" - \\\"$l_parameter_name\\\" is correctly set to \\\"$l_file_parameter_value\\\"\" \\ \" in \\\"$(printf '%s' \"${A_out[@]}\")\\\"\") else a_output2+=(\" - \\\"$l_parameter_name\\\" is incorrectly set to \\\"$l_file_parameter_value\\\"\" \" in \\\"$(printf '%s' \"${A_out[@]}\")\\\"\" \\ \" and should have a value of: \\\"$l_value_out\\\"\") fi done < <(grep -Po -- \"^\\h*$l_parameter_name\\h*=\\h*\\H+\" \"${A_out[@]}\") else a_output2+=(\" - \\\"$l_parameter_name\\\" is not set in an included file\" \\ \" ** Note: \\\"$l_parameter_name\\\" May be set in a file that's ignored by load procedure **\") fi } l_systemdsysctl=\"$(readlink -f /lib/systemd/systemd-sysctl)\" while IFS=\"=\" read -r l_parameter_name l_parameter_value; do # Assess and check parameters l_parameter_name=\"${l_parameter_name// /}\"; l_parameter_value=\"${l_parameter_value// /}\" l_value_out=\"${l_parameter_value//-/ through }\"; l_value_out=\"${l_value_out//|/ or }\" l_value_out=\"$(tr -d '(){}' <<< \"$l_value_out\")\" if grep -q '^net.ipv6.' <<< \"$l_parameter_name\"; then [ -z \"$l_ipv6_disabled\" ] && f_ipv6_chk if [ \"$l_ipv6_disabled\" = \"yes\" ]; then a_output+=(\" - IPv6 is disabled on the system, \\\"$l_parameter_name\\\" is not applicable\") else f_kernel_parameter_chk fi else f_kernel_parameter_chk fi done < <(printf '%s\\n' \"${a_parlist[@]}\") if [ \"${#a_output2[@]}\" -le 0 ]; then printf '%s\\n' \"\" \"- Audit Result:\" \" ** PASS **\" \"${a_output[@]}\" \"\" else printf '%s\\n' \"\" \"- Audit Result:\" \" ** FAIL **\" \" - Reason(s) for audit failure:\" \"${a_output2[@]}\" [ \"${#a_output[@]}\" -gt 0 ] && printf '%s\\n' \"\" \"- Correctly set:\" \"${a_output[@]}\" \"\" fi }" expect : "(?i)^[\\s]*\\**[\\s]*pass:?[\\s]*\\**$" type : CMD_EXEC description : "3.3.4 Ensure broadcast icmp requests are ignored" 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. 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 : "Set the following parameter in /etc/sysctl.conf or a file in /etc/sysctl.d/ ending inconf : - net.ipv4.icmp_echo_ignore_broadcasts = 1 Example: # printf '%s\n' \"net.ipv4.icmp_echo_ignore_broadcasts = 1\" >> /etc/sysctl.d/60-netipv4_sysctl.conf Run the following script to set the active kernel parameters: #!/usr/bin/env bash { sysctl -w net.ipv4.icmp_echo_ignore_broadcasts=1 sysctl -w net.ipv4.route.flush=1 } Note: If these settings appear in a canonically later file, or later in the same file, these settings will be overwritten" reference : "800-171|3.4.2,800-171|3.4.6,800-171|3.4.7,800-171r3|03.04.02,800-171r3|03.04.06,800-53|CM-6,800-53|CM-7,800-53r5|CM-6,800-53r5|CM-7,CSCv7|9.2,CSCv8|4.8,CSF|PR.IP-1,CSF|PR.PT-3,CSF2.0|DE.CM-09,CSF2.0|PR.PS-01,GDPR|32.1.b,HIPAA|164.306(a)(1),ISO-27001-2022|A.8.9,ITSG-33|CM-6,ITSG-33|CM-7,LEVEL|1A,NIAv2|SS15a,PCI-DSSv3.2.1|2.2.2,SWIFT-CSCv1|2.3" see_also : "https://workbench.cisecurity.org/benchmarks/20333" cmd : "#!/bin/bash { a_output=(); a_output2=(); l_ipv6_disabled=\"\" a_parlist=(\"net.ipv4.icmp_echo_ignore_broadcasts=1\") l_ufwscf=\"$([ -f /etc/default/ufw ] && awk -F= '/^\\s*IPT_SYSCTL=/ {print $2}' /etc/default/ufw)\" f_ipv6_chk() { l_ipv6_disabled=\"no\" ! grep -Pqs -- '^\\h*0\\b' /sys/module/ipv6/parameters/disable && l_ipv6_disabled=\"yes\" if sysctl net.ipv6.conf.all.disable_ipv6 | grep -Pqs -- \"^\\h*net\\.ipv6\\.conf\\.all\\.disable_ipv6\\h*=\\h*1\\b\" && \\ sysctl net.ipv6.conf.default.disable_ipv6 | grep -Pqs -- \"^\\h*net\\.ipv6\\.conf\\.default\\.disable_ipv6\\h*=\\h*1\\b\"; then l_ipv6_disabled=\"yes\" fi } f_kernel_parameter_chk() { l_running_parameter_value=\"$(sysctl \"$l_parameter_name\" | awk -F= '{print $2}' | xargs)\" # Check running configuration if grep -Pq -- '\\b'\"$l_parameter_value\"'\\b' <<< \"$l_running_parameter_value\"; then a_output+=(\" - \\\"$l_parameter_name\\\" is correctly set to \\\"$l_running_parameter_value\\\"\" \" in the running configuration\") else a_output2+=(\" - \\\"$l_parameter_name\\\" is incorrectly set to \\\"$l_running_parameter_value\\\"\" \\ \" in the running configuration\" \\ \" and should have a value of: \\\"$l_value_out\\\"\") fi unset A_out; declare -A A_out # Check durable setting (files) while read -r l_out; do if [ -n \"$l_out\" ]; then if [[ $l_out =~ ^\\s*# ]]; then l_file=\"${l_out//# /}\" else l_kpar=\"$(awk -F= '{print $1}' <<< \"$l_out\" | xargs)\" [ \"$l_kpar\" = \"$l_parameter_name\" ] && A_out+=([\"$l_kpar\"]=\"$l_file\") fi fi done < <(\"$l_systemdsysctl\" --cat-config | grep -Po '^\\h*([^#\\n\\r]+|#\\h*\\/[^#\\n\\r\\h]+\\.conf\\b)') if [ -n \"$l_ufwscf\" ]; then # Account for systems with UFW (Not covered by systemd-sysctl --cat-config) l_kpar=\"$(grep -Po \"^\\h*$l_parameter_name\\b\" \"$l_ufwscf\" | xargs)\" l_kpar=\"${l_kpar//\\//.}\" [ \"$l_kpar\" = \"$l_parameter_name\" ] && A_out+=([\"$l_kpar\"]=\"$l_ufwscf\") fi if (( ${#A_out[@]} > 0 )); then # Assess output from files and generate output while IFS=\"=\" read -r l_fkpname l_file_parameter_value; do l_fkpname=\"${l_fkpname// /}\"; l_file_parameter_value=\"${l_file_parameter_value// /}\" if grep -Pq -- '\\b'\"$l_parameter_value\"'\\b' <<< \"$l_file_parameter_value\"; then a_output+=(\" - \\\"$l_parameter_name\\\" is correctly set to \\\"$l_file_parameter_value\\\"\" \\ \" in \\\"$(printf '%s' \"${A_out[@]}\")\\\"\") else a_output2+=(\" - \\\"$l_parameter_name\\\" is incorrectly set to \\\"$l_file_parameter_value\\\"\" \" in \\\"$(printf '%s' \"${A_out[@]}\")\\\"\" \\ \" and should have a value of: \\\"$l_value_out\\\"\") fi done < <(grep -Po -- \"^\\h*$l_parameter_name\\h*=\\h*\\H+\" \"${A_out[@]}\") else a_output2+=(\" - \\\"$l_parameter_name\\\" is not set in an included file\" \\ \" ** Note: \\\"$l_parameter_name\\\" May be set in a file that's ignored by load procedure **\") fi } l_systemdsysctl=\"$(readlink -f /lib/systemd/systemd-sysctl)\" while IFS=\"=\" read -r l_parameter_name l_parameter_value; do # Assess and check parameters l_parameter_name=\"${l_parameter_name// /}\"; l_parameter_value=\"${l_parameter_value// /}\" l_value_out=\"${l_parameter_value//-/ through }\"; l_value_out=\"${l_value_out//|/ or }\" l_value_out=\"$(tr -d '(){}' <<< \"$l_value_out\")\" if grep -q '^net.ipv6.' <<< \"$l_parameter_name\"; then [ -z \"$l_ipv6_disabled\" ] && f_ipv6_chk if [ \"$l_ipv6_disabled\" = \"yes\" ]; then a_output+=(\" - IPv6 is disabled on the system, \\\"$l_parameter_name\\\" is not applicable\") else f_kernel_parameter_chk fi else f_kernel_parameter_chk fi done < <(printf '%s\\n' \"${a_parlist[@]}\") if [ \"${#a_output2[@]}\" -le 0 ]; then printf '%s\\n' \"\" \"- Audit Result:\" \" ** PASS **\" \"${a_output[@]}\" \"\" else printf '%s\\n' \"\" \"- Audit Result:\" \" ** FAIL **\" \" - Reason(s) for audit failure:\" \"${a_output2[@]}\" [ \"${#a_output[@]}\" -gt 0 ] && printf '%s\\n' \"\" \"- Correctly set:\" \"${a_output[@]}\" \"\" fi }" expect : "(?i)^[\\s]*\\**[\\s]*pass:?[\\s]*\\**$" type : CMD_EXEC description : "3.3.5 Ensure icmp redirects are not accepted" 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. 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 net.ipv4.conf.default.accept_redirects net.ipv6.conf.all.accept_redirects and net.ipv6.conf.default.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." solution : "Set the following parameters in /etc/sysctl.conf or a file in /etc/sysctl.d/ ending inconf : - net.ipv4.conf.all.accept_redirects = 0 - net.ipv4.conf.default.accept_redirects = 0 Example: # printf '%s\n' \"net.ipv4.conf.all.accept_redirects = 0\" \"net.ipv4.conf.default.accept_redirects = 0\" >> /etc/sysctl.d/60-netipv4_sysctl.conf Run the following script to set the active kernel parameters: #!/usr/bin/env bash { sysctl -w net.ipv4.conf.all.accept_redirects=0 sysctl -w net.ipv4.conf.default.accept_redirects=0 sysctl -w net.ipv4.route.flush=1 } - IF - IPv6 is enabled on the system: Set the following parameters in /etc/sysctl.conf or a file in /etc/sysctl.d/ ending inconf : - net.ipv6.conf.all.accept_redirects = 0 - net.ipv6.conf.default.accept_redirects = 0 Example: # printf '%s\n' \"net.ipv6.conf.all.accept_redirects = 0\" \"net.ipv6.conf.default.accept_redirects = 0\" >> /etc/sysctl.d/60-netipv6_sysctl.conf Run the following script to set the active kernel parameters: #!/usr/bin/env bash { sysctl -w net.ipv6.conf.all.accept_redirects=0 sysctl -w net.ipv6.conf.default.accept_redirects=0 sysctl -w net.ipv6.route.flush=1 } Note: If these settings appear in a canonically later file, or later in the same file, these settings will be overwritten" reference : "800-171|3.4.2,800-171|3.4.6,800-171|3.4.7,800-171r3|03.04.02,800-171r3|03.04.06,800-53|CM-6,800-53|CM-7,800-53r5|CM-6,800-53r5|CM-7,CSCv7|9.2,CSCv8|4.8,CSF|PR.IP-1,CSF|PR.PT-3,CSF2.0|DE.CM-09,CSF2.0|PR.PS-01,GDPR|32.1.b,HIPAA|164.306(a)(1),ISO-27001-2022|A.8.9,ITSG-33|CM-6,ITSG-33|CM-7,LEVEL|1A,NIAv2|SS15a,PCI-DSSv3.2.1|2.2.2,SWIFT-CSCv1|2.3" see_also : "https://workbench.cisecurity.org/benchmarks/20333" cmd : "#!/bin/bash { a_output=(); a_output2=(); l_ipv6_disabled=\"\" a_parlist=(\"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\") l_ufwscf=\"$([ -f /etc/default/ufw ] && awk -F= '/^\\s*IPT_SYSCTL=/ {print $2}' /etc/default/ufw)\" f_ipv6_chk() { l_ipv6_disabled=\"no\" ! grep -Pqs -- '^\\h*0\\b' /sys/module/ipv6/parameters/disable && l_ipv6_disabled=\"yes\" if sysctl net.ipv6.conf.all.disable_ipv6 | grep -Pqs -- \"^\\h*net\\.ipv6\\.conf\\.all\\.disable_ipv6\\h*=\\h*1\\b\" && \\ sysctl net.ipv6.conf.default.disable_ipv6 | grep -Pqs -- \"^\\h*net\\.ipv6\\.conf\\.default\\.disable_ipv6\\h*=\\h*1\\b\"; then l_ipv6_disabled=\"yes\" fi } f_kernel_parameter_chk() { l_running_parameter_value=\"$(sysctl \"$l_parameter_name\" | awk -F= '{print $2}' | xargs)\" # Check running configuration if grep -Pq -- '\\b'\"$l_parameter_value\"'\\b' <<< \"$l_running_parameter_value\"; then a_output+=(\" - \\\"$l_parameter_name\\\" is correctly set to \\\"$l_running_parameter_value\\\"\" \" in the running configuration\") else a_output2+=(\" - \\\"$l_parameter_name\\\" is incorrectly set to \\\"$l_running_parameter_value\\\"\" \\ \" in the running configuration\" \\ \" and should have a value of: \\\"$l_value_out\\\"\") fi unset A_out; declare -A A_out # Check durable setting (files) while read -r l_out; do if [ -n \"$l_out\" ]; then if [[ $l_out =~ ^\\s*# ]]; then l_file=\"${l_out//# /}\" else l_kpar=\"$(awk -F= '{print $1}' <<< \"$l_out\" | xargs)\" [ \"$l_kpar\" = \"$l_parameter_name\" ] && A_out+=([\"$l_kpar\"]=\"$l_file\") fi fi done < <(\"$l_systemdsysctl\" --cat-config | grep -Po '^\\h*([^#\\n\\r]+|#\\h*\\/[^#\\n\\r\\h]+\\.conf\\b)') if [ -n \"$l_ufwscf\" ]; then # Account for systems with UFW (Not covered by systemd-sysctl --cat-config) l_kpar=\"$(grep -Po \"^\\h*$l_parameter_name\\b\" \"$l_ufwscf\" | xargs)\" l_kpar=\"${l_kpar//\\//.}\" [ \"$l_kpar\" = \"$l_parameter_name\" ] && A_out+=([\"$l_kpar\"]=\"$l_ufwscf\") fi if (( ${#A_out[@]} > 0 )); then # Assess output from files and generate output while IFS=\"=\" read -r l_fkpname l_file_parameter_value; do l_fkpname=\"${l_fkpname// /}\"; l_file_parameter_value=\"${l_file_parameter_value// /}\" if grep -Pq -- '\\b'\"$l_parameter_value\"'\\b' <<< \"$l_file_parameter_value\"; then a_output+=(\" - \\\"$l_parameter_name\\\" is correctly set to \\\"$l_file_parameter_value\\\"\" \\ \" in \\\"$(printf '%s' \"${A_out[@]}\")\\\"\") else a_output2+=(\" - \\\"$l_parameter_name\\\" is incorrectly set to \\\"$l_file_parameter_value\\\"\" \" in \\\"$(printf '%s' \"${A_out[@]}\")\\\"\" \\ \" and should have a value of: \\\"$l_value_out\\\"\") fi done < <(grep -Po -- \"^\\h*$l_parameter_name\\h*=\\h*\\H+\" \"${A_out[@]}\") else a_output2+=(\" - \\\"$l_parameter_name\\\" is not set in an included file\" \\ \" ** Note: \\\"$l_parameter_name\\\" May be set in a file that's ignored by load procedure **\") fi } l_systemdsysctl=\"$(readlink -f /lib/systemd/systemd-sysctl)\" while IFS=\"=\" read -r l_parameter_name l_parameter_value; do # Assess and check parameters l_parameter_name=\"${l_parameter_name// /}\"; l_parameter_value=\"${l_parameter_value// /}\" l_value_out=\"${l_parameter_value//-/ through }\"; l_value_out=\"${l_value_out//|/ or }\" l_value_out=\"$(tr -d '(){}' <<< \"$l_value_out\")\" if grep -q '^net.ipv6.' <<< \"$l_parameter_name\"; then [ -z \"$l_ipv6_disabled\" ] && f_ipv6_chk if [ \"$l_ipv6_disabled\" = \"yes\" ]; then a_output+=(\" - IPv6 is disabled on the system, \\\"$l_parameter_name\\\" is not applicable\") else f_kernel_parameter_chk fi else f_kernel_parameter_chk fi done < <(printf '%s\\n' \"${a_parlist[@]}\") if [ \"${#a_output2[@]}\" -le 0 ]; then printf '%s\\n' \"\" \"- Audit Result:\" \" ** PASS **\" \"${a_output[@]}\" \"\" else printf '%s\\n' \"\" \"- Audit Result:\" \" ** FAIL **\" \" - Reason(s) for audit failure:\" \"${a_output2[@]}\" [ \"${#a_output[@]}\" -gt 0 ] && printf '%s\\n' \"\" \"- Correctly set:\" \"${a_output[@]}\" \"\" fi }" expect : "(?i)^[\\s]*\\**[\\s]*pass:?[\\s]*\\**$" type : CMD_EXEC description : "3.3.6 Ensure secure icmp redirects are not accepted" 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. It is still possible for even known gateways to be compromised. Setting net.ipv4.conf.all.secure_redirects and net.ipv4.conf.default.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 file in /etc/sysctl.d/ ending inconf : - net.ipv4.conf.all.secure_redirects = 0 - net.ipv4.conf.default.secure_redirects = 0 Example: # printf '%s\n' \"net.ipv4.conf.all.secure_redirects = 0\" \"net.ipv4.conf.default.secure_redirects = 0\" >> /etc/sysctl.d/60-netipv4_sysctl.conf Run the following script to set the active kernel parameters: #!/usr/bin/env bash { 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 } Note: If these settings appear in a canonically later file, or later in the same file, these settings will be overwritten" reference : "800-171|3.4.2,800-171|3.4.6,800-171|3.4.7,800-171r3|03.04.02,800-171r3|03.04.06,800-53|CM-6,800-53|CM-7,800-53r5|CM-6,800-53r5|CM-7,CSCv7|9.2,CSCv8|4.8,CSF|PR.IP-1,CSF|PR.PT-3,CSF2.0|DE.CM-09,CSF2.0|PR.PS-01,GDPR|32.1.b,HIPAA|164.306(a)(1),ISO-27001-2022|A.8.9,ITSG-33|CM-6,ITSG-33|CM-7,LEVEL|1A,NIAv2|SS15a,PCI-DSSv3.2.1|2.2.2,SWIFT-CSCv1|2.3" see_also : "https://workbench.cisecurity.org/benchmarks/20333" cmd : "#!/bin/bash { a_output=(); a_output2=(); l_ipv6_disabled=\"\" a_parlist=(\"net.ipv4.conf.all.secure_redirects=0\" \"net.ipv4.conf.default.secure_redirects=0\") l_ufwscf=\"$([ -f /etc/default/ufw ] && awk -F= '/^\\s*IPT_SYSCTL=/ {print $2}' /etc/default/ufw)\" f_ipv6_chk() { l_ipv6_disabled=\"no\" ! grep -Pqs -- '^\\h*0\\b' /sys/module/ipv6/parameters/disable && l_ipv6_disabled=\"yes\" if sysctl net.ipv6.conf.all.disable_ipv6 | grep -Pqs -- \"^\\h*net\\.ipv6\\.conf\\.all\\.disable_ipv6\\h*=\\h*1\\b\" && \\ sysctl net.ipv6.conf.default.disable_ipv6 | grep -Pqs -- \"^\\h*net\\.ipv6\\.conf\\.default\\.disable_ipv6\\h*=\\h*1\\b\"; then l_ipv6_disabled=\"yes\" fi } f_kernel_parameter_chk() { l_running_parameter_value=\"$(sysctl \"$l_parameter_name\" | awk -F= '{print $2}' | xargs)\" # Check running configuration if grep -Pq -- '\\b'\"$l_parameter_value\"'\\b' <<< \"$l_running_parameter_value\"; then a_output+=(\" - \\\"$l_parameter_name\\\" is correctly set to \\\"$l_running_parameter_value\\\"\" \" in the running configuration\") else a_output2+=(\" - \\\"$l_parameter_name\\\" is incorrectly set to \\\"$l_running_parameter_value\\\"\" \\ \" in the running configuration\" \\ \" and should have a value of: \\\"$l_value_out\\\"\") fi unset A_out; declare -A A_out # Check durable setting (files) while read -r l_out; do if [ -n \"$l_out\" ]; then if [[ $l_out =~ ^\\s*# ]]; then l_file=\"${l_out//# /}\" else l_kpar=\"$(awk -F= '{print $1}' <<< \"$l_out\" | xargs)\" [ \"$l_kpar\" = \"$l_parameter_name\" ] && A_out+=([\"$l_kpar\"]=\"$l_file\") fi fi done < <(\"$l_systemdsysctl\" --cat-config | grep -Po '^\\h*([^#\\n\\r]+|#\\h*\\/[^#\\n\\r\\h]+\\.conf\\b)') if [ -n \"$l_ufwscf\" ]; then # Account for systems with UFW (Not covered by systemd-sysctl --cat-config) l_kpar=\"$(grep -Po \"^\\h*$l_parameter_name\\b\" \"$l_ufwscf\" | xargs)\" l_kpar=\"${l_kpar//\\//.}\" [ \"$l_kpar\" = \"$l_parameter_name\" ] && A_out+=([\"$l_kpar\"]=\"$l_ufwscf\") fi if (( ${#A_out[@]} > 0 )); then # Assess output from files and generate output while IFS=\"=\" read -r l_fkpname l_file_parameter_value; do l_fkpname=\"${l_fkpname// /}\"; l_file_parameter_value=\"${l_file_parameter_value// /}\" if grep -Pq -- '\\b'\"$l_parameter_value\"'\\b' <<< \"$l_file_parameter_value\"; then a_output+=(\" - \\\"$l_parameter_name\\\" is correctly set to \\\"$l_file_parameter_value\\\"\" \\ \" in \\\"$(printf '%s' \"${A_out[@]}\")\\\"\") else a_output2+=(\" - \\\"$l_parameter_name\\\" is incorrectly set to \\\"$l_file_parameter_value\\\"\" \" in \\\"$(printf '%s' \"${A_out[@]}\")\\\"\" \\ \" and should have a value of: \\\"$l_value_out\\\"\") fi done < <(grep -Po -- \"^\\h*$l_parameter_name\\h*=\\h*\\H+\" \"${A_out[@]}\") else a_output2+=(\" - \\\"$l_parameter_name\\\" is not set in an included file\" \\ \" ** Note: \\\"$l_parameter_name\\\" May be set in a file that's ignored by load procedure **\") fi } l_systemdsysctl=\"$(readlink -f /lib/systemd/systemd-sysctl)\" while IFS=\"=\" read -r l_parameter_name l_parameter_value; do # Assess and check parameters l_parameter_name=\"${l_parameter_name// /}\"; l_parameter_value=\"${l_parameter_value// /}\" l_value_out=\"${l_parameter_value//-/ through }\"; l_value_out=\"${l_value_out//|/ or }\" l_value_out=\"$(tr -d '(){}' <<< \"$l_value_out\")\" if grep -q '^net.ipv6.' <<< \"$l_parameter_name\"; then [ -z \"$l_ipv6_disabled\" ] && f_ipv6_chk if [ \"$l_ipv6_disabled\" = \"yes\" ]; then a_output+=(\" - IPv6 is disabled on the system, \\\"$l_parameter_name\\\" is not applicable\") else f_kernel_parameter_chk fi else f_kernel_parameter_chk fi done < <(printf '%s\\n' \"${a_parlist[@]}\") if [ \"${#a_output2[@]}\" -le 0 ]; then printf '%s\\n' \"\" \"- Audit Result:\" \" ** PASS **\" \"${a_output[@]}\" \"\" else printf '%s\\n' \"\" \"- Audit Result:\" \" ** FAIL **\" \" - Reason(s) for audit failure:\" \"${a_output2[@]}\" [ \"${#a_output[@]}\" -gt 0 ] && printf '%s\\n' \"\" \"- Correctly set:\" \"${a_output[@]}\" \"\" fi }" expect : "(?i)^[\\s]*\\**[\\s]*pass:?[\\s]*\\**$" type : CMD_EXEC description : "3.3.7 Ensure reverse path filtering is enabled" 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). Setting net.ipv4.conf.all.rp_filter and net.ipv4.conf.default.rp_filter to 1 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 : "Set the following parameters in /etc/sysctl.conf or a file in /etc/sysctl.d/ ending inconf : - net.ipv4.conf.all.rp_filter = 1 - net.ipv4.conf.default.rp_filter = 1 Example: # printf '%s\n' \"net.ipv4.conf.all.rp_filter = 1\" \"net.ipv4.conf.default.rp_filter = 1\" >> /etc/sysctl.d/60-netipv4_sysctl.conf Run the following script to set the active kernel parameters: #!/usr/bin/env bash { sysctl -w net.ipv4.conf.all.rp_filter=1 sysctl -w net.ipv4.conf.default.rp_filter=1 sysctl -w net.ipv4.route.flush=1 } Note: If these settings appear in a canonically later file, or later in the same file, these settings will be overwritten Impact: If you are using asymmetrical routing on your system, you will not be able to enable this feature without breaking the routing." reference : "800-171|3.4.2,800-171|3.4.6,800-171|3.4.7,800-171r3|03.04.02,800-171r3|03.04.06,800-53|CM-6,800-53|CM-7,800-53r5|CM-6,800-53r5|CM-7,CSCv7|9.2,CSCv8|4.8,CSF|PR.IP-1,CSF|PR.PT-3,CSF2.0|DE.CM-09,CSF2.0|PR.PS-01,GDPR|32.1.b,HIPAA|164.306(a)(1),ISO-27001-2022|A.8.9,ITSG-33|CM-6,ITSG-33|CM-7,LEVEL|1A,NIAv2|SS15a,PCI-DSSv3.2.1|2.2.2,SWIFT-CSCv1|2.3" see_also : "https://workbench.cisecurity.org/benchmarks/20333" cmd : "#!/bin/bash { a_output=(); a_output2=(); l_ipv6_disabled=\"\" a_parlist=(\"net.ipv4.conf.all.rp_filter=1\" \"net.ipv4.conf.default.rp_filter=1\") l_ufwscf=\"$([ -f /etc/default/ufw ] && awk -F= '/^\\s*IPT_SYSCTL=/ {print $2}' /etc/default/ufw)\" f_ipv6_chk() { l_ipv6_disabled=\"no\" ! grep -Pqs -- '^\\h*0\\b' /sys/module/ipv6/parameters/disable && l_ipv6_disabled=\"yes\" if sysctl net.ipv6.conf.all.disable_ipv6 | grep -Pqs -- \"^\\h*net\\.ipv6\\.conf\\.all\\.disable_ipv6\\h*=\\h*1\\b\" && \\ sysctl net.ipv6.conf.default.disable_ipv6 | grep -Pqs -- \"^\\h*net\\.ipv6\\.conf\\.default\\.disable_ipv6\\h*=\\h*1\\b\"; then l_ipv6_disabled=\"yes\" fi } f_kernel_parameter_chk() { l_running_parameter_value=\"$(sysctl \"$l_parameter_name\" | awk -F= '{print $2}' | xargs)\" # Check running configuration if grep -Pq -- '\\b'\"$l_parameter_value\"'\\b' <<< \"$l_running_parameter_value\"; then a_output+=(\" - \\\"$l_parameter_name\\\" is correctly set to \\\"$l_running_parameter_value\\\"\" \" in the running configuration\") else a_output2+=(\" - \\\"$l_parameter_name\\\" is incorrectly set to \\\"$l_running_parameter_value\\\"\" \\ \" in the running configuration\" \\ \" and should have a value of: \\\"$l_value_out\\\"\") fi unset A_out; declare -A A_out # Check durable setting (files) while read -r l_out; do if [ -n \"$l_out\" ]; then if [[ $l_out =~ ^\\s*# ]]; then l_file=\"${l_out//# /}\" else l_kpar=\"$(awk -F= '{print $1}' <<< \"$l_out\" | xargs)\" [ \"$l_kpar\" = \"$l_parameter_name\" ] && A_out+=([\"$l_kpar\"]=\"$l_file\") fi fi done < <(\"$l_systemdsysctl\" --cat-config | grep -Po '^\\h*([^#\\n\\r]+|#\\h*\\/[^#\\n\\r\\h]+\\.conf\\b)') if [ -n \"$l_ufwscf\" ]; then # Account for systems with UFW (Not covered by systemd-sysctl --cat-config) l_kpar=\"$(grep -Po \"^\\h*$l_parameter_name\\b\" \"$l_ufwscf\" | xargs)\" l_kpar=\"${l_kpar//\\//.}\" [ \"$l_kpar\" = \"$l_parameter_name\" ] && A_out+=([\"$l_kpar\"]=\"$l_ufwscf\") fi if (( ${#A_out[@]} > 0 )); then # Assess output from files and generate output while IFS=\"=\" read -r l_fkpname l_file_parameter_value; do l_fkpname=\"${l_fkpname// /}\"; l_file_parameter_value=\"${l_file_parameter_value// /}\" if grep -Pq -- '\\b'\"$l_parameter_value\"'\\b' <<< \"$l_file_parameter_value\"; then a_output+=(\" - \\\"$l_parameter_name\\\" is correctly set to \\\"$l_file_parameter_value\\\"\" \\ \" in \\\"$(printf '%s' \"${A_out[@]}\")\\\"\") else a_output2+=(\" - \\\"$l_parameter_name\\\" is incorrectly set to \\\"$l_file_parameter_value\\\"\" \" in \\\"$(printf '%s' \"${A_out[@]}\")\\\"\" \\ \" and should have a value of: \\\"$l_value_out\\\"\") fi done < <(grep -Po -- \"^\\h*$l_parameter_name\\h*=\\h*\\H+\" \"${A_out[@]}\") else a_output2+=(\" - \\\"$l_parameter_name\\\" is not set in an included file\" \\ \" ** Note: \\\"$l_parameter_name\\\" May be set in a file that's ignored by load procedure **\") fi } l_systemdsysctl=\"$(readlink -f /lib/systemd/systemd-sysctl)\" while IFS=\"=\" read -r l_parameter_name l_parameter_value; do # Assess and check parameters l_parameter_name=\"${l_parameter_name// /}\"; l_parameter_value=\"${l_parameter_value// /}\" l_value_out=\"${l_parameter_value//-/ through }\"; l_value_out=\"${l_value_out//|/ or }\" l_value_out=\"$(tr -d '(){}' <<< \"$l_value_out\")\" if grep -q '^net.ipv6.' <<< \"$l_parameter_name\"; then [ -z \"$l_ipv6_disabled\" ] && f_ipv6_chk if [ \"$l_ipv6_disabled\" = \"yes\" ]; then a_output+=(\" - IPv6 is disabled on the system, \\\"$l_parameter_name\\\" is not applicable\") else f_kernel_parameter_chk fi else f_kernel_parameter_chk fi done < <(printf '%s\\n' \"${a_parlist[@]}\") if [ \"${#a_output2[@]}\" -le 0 ]; then printf '%s\\n' \"\" \"- Audit Result:\" \" ** PASS **\" \"${a_output[@]}\" \"\" else printf '%s\\n' \"\" \"- Audit Result:\" \" ** FAIL **\" \" - Reason(s) for audit failure:\" \"${a_output2[@]}\" [ \"${#a_output[@]}\" -gt 0 ] && printf '%s\\n' \"\" \"- Correctly set:\" \"${a_output[@]}\" \"\" fi }" expect : "(?i)^[\\s]*\\**[\\s]*pass:?[\\s]*\\**$" type : CMD_EXEC description : "3.3.8 Ensure source routed packets are not accepted" 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. 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 file in /etc/sysctl.d/ ending inconf : - net.ipv4.conf.all.accept_source_route = 0 - net.ipv4.conf.default.accept_source_route = 0 Example: # printf '%s\n' \"net.ipv4.conf.all.accept_source_route = 0\" \"net.ipv4.conf.default.accept_source_route = 0\" >> /etc/sysctl.d/60-netipv4_sysctl.conf Run the following script to set the active kernel parameters: #!/usr/bin/env bash { sysctl -w net.ipv4.conf.all.accept_source_route=0 sysctl -w net.ipv4.conf.default.accept_source_route=0 sysctl -w net.ipv4.route.flush=1 } - IF - IPv6 is enabled on the system: Set the following parameters in /etc/sysctl.conf or a file in /etc/sysctl.d/ ending inconf : - net.ipv6.conf.all.accept_source_route = 0 - net.ipv6.conf.default.accept_source_route = 0 Example: # printf '%s\n' \"net.ipv6.conf.all.accept_source_route = 0\" \"net.ipv6.conf.default.accept_source_route = 0\" >> /etc/sysctl.d/60-netipv6_sysctl.conf Run the following command to set the active kernel parameters: #!/usr/bin/env bash { sysctl -w net.ipv6.conf.all.accept_source_route=0 sysctl -w net.ipv6.conf.default.accept_source_route=0 sysctl -w net.ipv6.route.flush=1 } Note: If these settings appear in a canonically later file, or later in the same file, these settings will be overwritten" reference : "800-171|3.4.2,800-171|3.4.6,800-171|3.4.7,800-171r3|03.04.02,800-171r3|03.04.06,800-53|CM-6,800-53|CM-7,800-53r5|CM-6,800-53r5|CM-7,CSCv7|9.2,CSCv8|4.8,CSF|PR.IP-1,CSF|PR.PT-3,CSF2.0|DE.CM-09,CSF2.0|PR.PS-01,GDPR|32.1.b,HIPAA|164.306(a)(1),ISO-27001-2022|A.8.9,ITSG-33|CM-6,ITSG-33|CM-7,LEVEL|1A,NIAv2|SS15a,PCI-DSSv3.2.1|2.2.2,SWIFT-CSCv1|2.3" see_also : "https://workbench.cisecurity.org/benchmarks/20333" cmd : "#!/bin/bash { a_output=(); a_output2=(); l_ipv6_disabled=\"\" a_parlist=(\"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\") l_ufwscf=\"$([ -f /etc/default/ufw ] && awk -F= '/^\\s*IPT_SYSCTL=/ {print $2}' /etc/default/ufw)\" f_ipv6_chk() { l_ipv6_disabled=\"no\" ! grep -Pqs -- '^\\h*0\\b' /sys/module/ipv6/parameters/disable && l_ipv6_disabled=\"yes\" if sysctl net.ipv6.conf.all.disable_ipv6 | grep -Pqs -- \"^\\h*net\\.ipv6\\.conf\\.all\\.disable_ipv6\\h*=\\h*1\\b\" && \\ sysctl net.ipv6.conf.default.disable_ipv6 | grep -Pqs -- \"^\\h*net\\.ipv6\\.conf\\.default\\.disable_ipv6\\h*=\\h*1\\b\"; then l_ipv6_disabled=\"yes\" fi } f_kernel_parameter_chk() { l_running_parameter_value=\"$(sysctl \"$l_parameter_name\" | awk -F= '{print $2}' | xargs)\" # Check running configuration if grep -Pq -- '\\b'\"$l_parameter_value\"'\\b' <<< \"$l_running_parameter_value\"; then a_output+=(\" - \\\"$l_parameter_name\\\" is correctly set to \\\"$l_running_parameter_value\\\"\" \" in the running configuration\") else a_output2+=(\" - \\\"$l_parameter_name\\\" is incorrectly set to \\\"$l_running_parameter_value\\\"\" \\ \" in the running configuration\" \\ \" and should have a value of: \\\"$l_value_out\\\"\") fi unset A_out; declare -A A_out # Check durable setting (files) while read -r l_out; do if [ -n \"$l_out\" ]; then if [[ $l_out =~ ^\\s*# ]]; then l_file=\"${l_out//# /}\" else l_kpar=\"$(awk -F= '{print $1}' <<< \"$l_out\" | xargs)\" [ \"$l_kpar\" = \"$l_parameter_name\" ] && A_out+=([\"$l_kpar\"]=\"$l_file\") fi fi done < <(\"$l_systemdsysctl\" --cat-config | grep -Po '^\\h*([^#\\n\\r]+|#\\h*\\/[^#\\n\\r\\h]+\\.conf\\b)') if [ -n \"$l_ufwscf\" ]; then # Account for systems with UFW (Not covered by systemd-sysctl --cat-config) l_kpar=\"$(grep -Po \"^\\h*$l_parameter_name\\b\" \"$l_ufwscf\" | xargs)\" l_kpar=\"${l_kpar//\\//.}\" [ \"$l_kpar\" = \"$l_parameter_name\" ] && A_out+=([\"$l_kpar\"]=\"$l_ufwscf\") fi if (( ${#A_out[@]} > 0 )); then # Assess output from files and generate output while IFS=\"=\" read -r l_fkpname l_file_parameter_value; do l_fkpname=\"${l_fkpname// /}\"; l_file_parameter_value=\"${l_file_parameter_value// /}\" if grep -Pq -- '\\b'\"$l_parameter_value\"'\\b' <<< \"$l_file_parameter_value\"; then a_output+=(\" - \\\"$l_parameter_name\\\" is correctly set to \\\"$l_file_parameter_value\\\"\" \\ \" in \\\"$(printf '%s' \"${A_out[@]}\")\\\"\") else a_output2+=(\" - \\\"$l_parameter_name\\\" is incorrectly set to \\\"$l_file_parameter_value\\\"\" \" in \\\"$(printf '%s' \"${A_out[@]}\")\\\"\" \\ \" and should have a value of: \\\"$l_value_out\\\"\") fi done < <(grep -Po -- \"^\\h*$l_parameter_name\\h*=\\h*\\H+\" \"${A_out[@]}\") else a_output2+=(\" - \\\"$l_parameter_name\\\" is not set in an included file\" \\ \" ** Note: \\\"$l_parameter_name\\\" May be set in a file that's ignored by load procedure **\") fi } l_systemdsysctl=\"$(readlink -f /lib/systemd/systemd-sysctl)\" while IFS=\"=\" read -r l_parameter_name l_parameter_value; do # Assess and check parameters l_parameter_name=\"${l_parameter_name// /}\"; l_parameter_value=\"${l_parameter_value// /}\" l_value_out=\"${l_parameter_value//-/ through }\"; l_value_out=\"${l_value_out//|/ or }\" l_value_out=\"$(tr -d '(){}' <<< \"$l_value_out\")\" if grep -q '^net.ipv6.' <<< \"$l_parameter_name\"; then [ -z \"$l_ipv6_disabled\" ] && f_ipv6_chk if [ \"$l_ipv6_disabled\" = \"yes\" ]; then a_output+=(\" - IPv6 is disabled on the system, \\\"$l_parameter_name\\\" is not applicable\") else f_kernel_parameter_chk fi else f_kernel_parameter_chk fi done < <(printf '%s\\n' \"${a_parlist[@]}\") if [ \"${#a_output2[@]}\" -le 0 ]; then printf '%s\\n' \"\" \"- Audit Result:\" \" ** PASS **\" \"${a_output[@]}\" \"\" else printf '%s\\n' \"\" \"- Audit Result:\" \" ** FAIL **\" \" - Reason(s) for audit failure:\" \"${a_output2[@]}\" [ \"${#a_output[@]}\" -gt 0 ] && printf '%s\\n' \"\" \"- Correctly set:\" \"${a_output[@]}\" \"\" fi }" expect : "(?i)^[\\s]*\\**[\\s]*pass:?[\\s]*\\**$" type : CMD_EXEC description : "3.3.9 Ensure suspicious packets are logged" info : "When enabled, this feature logs packets with un-routable source addresses to the kernel log. Setting net.ipv4.conf.all.log_martians and net.ipv4.conf.default.log_martians to 1 enables this feature. 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 file in /etc/sysctl.d/ ending inconf : - net.ipv4.conf.all.log_martians = 1 - net.ipv4.conf.default.log_martians = 1 Example: # printf '%s\n' \"net.ipv4.conf.all.log_martians = 1\" \"net.ipv4.conf.default.log_martians = 1\" >> /etc/sysctl.d/60-netipv4_sysctl.conf Run the following script to set the active kernel parameters: #!/usr/bin/env bash { 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 } Note: If these settings appear in a canonically later file, or later in the same file, these settings will be overwritten" reference : "800-171|3.3.1,800-171|3.3.2,800-171|3.3.6,800-171r3|03.03.02a.,800-171r3|03.03.02b.,800-171r3|03.03.03,800-171r3|03.03.06a.,800-53|AU-3,800-53|AU-3(1),800-53|AU-7,800-53|AU-12,800-53r5|AU-3,800-53r5|AU-3(1),800-53r5|AU-7,800-53r5|AU-12,CN-L3|7.1.2.3(a),CN-L3|7.1.2.3(b),CN-L3|7.1.2.3(c),CN-L3|7.1.3.3(a),CN-L3|7.1.3.3(b),CN-L3|8.1.4.3(b),CSCv7|6.2,CSCv7|6.3,CSCv8|8.5,CSF|DE.CM-1,CSF|DE.CM-3,CSF|DE.CM-7,CSF|PR.PT-1,CSF|RS.AN-3,CSF2.0|DE.CM-01,CSF2.0|DE.CM-03,CSF2.0|DE.CM-09,CSF2.0|PR.PS-04,CSF2.0|RS.AN-03,CSF2.0|RS.AN-06,CSF2.0|RS.AN-07,GDPR|32.1.b,HIPAA|164.306(a)(1),HIPAA|164.312(b),ISO-27001-2022|A.5.28,ISO-27001-2022|A.8.15,ITSG-33|AU-3,ITSG-33|AU-3(1),ITSG-33|AU-7,ITSG-33|AU-12,LEVEL|1A,NESA|T3.6.2,NIAv2|AM34a,NIAv2|AM34b,NIAv2|AM34c,NIAv2|AM34d,NIAv2|AM34e,NIAv2|AM34f,NIAv2|AM34g,PCI-DSSv3.2.1|10.1,PCI-DSSv3.2.1|10.3,PCI-DSSv3.2.1|10.3.1,PCI-DSSv3.2.1|10.3.2,PCI-DSSv3.2.1|10.3.3,PCI-DSSv3.2.1|10.3.4,PCI-DSSv3.2.1|10.3.5,PCI-DSSv3.2.1|10.3.6,PCI-DSSv4.0|10.2.2,QCSC-v1|3.2,QCSC-v1|6.2,QCSC-v1|8.2.1,QCSC-v1|10.2.1,QCSC-v1|11.2,QCSC-v1|13.2,SWIFT-CSCv1|6.4" see_also : "https://workbench.cisecurity.org/benchmarks/20333" cmd : "#!/bin/bash { a_output=(); a_output2=(); l_ipv6_disabled=\"\" a_parlist=(\"net.ipv4.conf.all.log_martians=1\" \"net.ipv4.conf.default.log_martians=1\") l_ufwscf=\"$([ -f /etc/default/ufw ] && awk -F= '/^\\s*IPT_SYSCTL=/ {print $2}' /etc/default/ufw)\" f_ipv6_chk() { l_ipv6_disabled=\"no\" ! grep -Pqs -- '^\\h*0\\b' /sys/module/ipv6/parameters/disable && l_ipv6_disabled=\"yes\" if sysctl net.ipv6.conf.all.disable_ipv6 | grep -Pqs -- \"^\\h*net\\.ipv6\\.conf\\.all\\.disable_ipv6\\h*=\\h*1\\b\" && \\ sysctl net.ipv6.conf.default.disable_ipv6 | grep -Pqs -- \"^\\h*net\\.ipv6\\.conf\\.default\\.disable_ipv6\\h*=\\h*1\\b\"; then l_ipv6_disabled=\"yes\" fi } f_kernel_parameter_chk() { l_running_parameter_value=\"$(sysctl \"$l_parameter_name\" | awk -F= '{print $2}' | xargs)\" # Check running configuration if grep -Pq -- '\\b'\"$l_parameter_value\"'\\b' <<< \"$l_running_parameter_value\"; then a_output+=(\" - \\\"$l_parameter_name\\\" is correctly set to \\\"$l_running_parameter_value\\\"\" \" in the running configuration\") else a_output2+=(\" - \\\"$l_parameter_name\\\" is incorrectly set to \\\"$l_running_parameter_value\\\"\" \\ \" in the running configuration\" \\ \" and should have a value of: \\\"$l_value_out\\\"\") fi unset A_out; declare -A A_out # Check durable setting (files) while read -r l_out; do if [ -n \"$l_out\" ]; then if [[ $l_out =~ ^\\s*# ]]; then l_file=\"${l_out//# /}\" else l_kpar=\"$(awk -F= '{print $1}' <<< \"$l_out\" | xargs)\" [ \"$l_kpar\" = \"$l_parameter_name\" ] && A_out+=([\"$l_kpar\"]=\"$l_file\") fi fi done < <(\"$l_systemdsysctl\" --cat-config | grep -Po '^\\h*([^#\\n\\r]+|#\\h*\\/[^#\\n\\r\\h]+\\.conf\\b)') if [ -n \"$l_ufwscf\" ]; then # Account for systems with UFW (Not covered by systemd-sysctl --cat-config) l_kpar=\"$(grep -Po \"^\\h*$l_parameter_name\\b\" \"$l_ufwscf\" | xargs)\" l_kpar=\"${l_kpar//\\//.}\" [ \"$l_kpar\" = \"$l_parameter_name\" ] && A_out+=([\"$l_kpar\"]=\"$l_ufwscf\") fi if (( ${#A_out[@]} > 0 )); then # Assess output from files and generate output while IFS=\"=\" read -r l_fkpname l_file_parameter_value; do l_fkpname=\"${l_fkpname// /}\"; l_file_parameter_value=\"${l_file_parameter_value// /}\" if grep -Pq -- '\\b'\"$l_parameter_value\"'\\b' <<< \"$l_file_parameter_value\"; then a_output+=(\" - \\\"$l_parameter_name\\\" is correctly set to \\\"$l_file_parameter_value\\\"\" \\ \" in \\\"$(printf '%s' \"${A_out[@]}\")\\\"\") else a_output2+=(\" - \\\"$l_parameter_name\\\" is incorrectly set to \\\"$l_file_parameter_value\\\"\" \" in \\\"$(printf '%s' \"${A_out[@]}\")\\\"\" \\ \" and should have a value of: \\\"$l_value_out\\\"\") fi done < <(grep -Po -- \"^\\h*$l_parameter_name\\h*=\\h*\\H+\" \"${A_out[@]}\") else a_output2+=(\" - \\\"$l_parameter_name\\\" is not set in an included file\" \\ \" ** Note: \\\"$l_parameter_name\\\" May be set in a file that's ignored by load procedure **\") fi } l_systemdsysctl=\"$(readlink -f /lib/systemd/systemd-sysctl)\" while IFS=\"=\" read -r l_parameter_name l_parameter_value; do # Assess and check parameters l_parameter_name=\"${l_parameter_name// /}\"; l_parameter_value=\"${l_parameter_value// /}\" l_value_out=\"${l_parameter_value//-/ through }\"; l_value_out=\"${l_value_out//|/ or }\" l_value_out=\"$(tr -d '(){}' <<< \"$l_value_out\")\" if grep -q '^net.ipv6.' <<< \"$l_parameter_name\"; then [ -z \"$l_ipv6_disabled\" ] && f_ipv6_chk if [ \"$l_ipv6_disabled\" = \"yes\" ]; then a_output+=(\" - IPv6 is disabled on the system, \\\"$l_parameter_name\\\" is not applicable\") else f_kernel_parameter_chk fi else f_kernel_parameter_chk fi done < <(printf '%s\\n' \"${a_parlist[@]}\") if [ \"${#a_output2[@]}\" -le 0 ]; then printf '%s\\n' \"\" \"- Audit Result:\" \" ** PASS **\" \"${a_output[@]}\" \"\" else printf '%s\\n' \"\" \"- Audit Result:\" \" ** FAIL **\" \" - Reason(s) for audit failure:\" \"${a_output2[@]}\" [ \"${#a_output[@]}\" -gt 0 ] && printf '%s\\n' \"\" \"- Correctly set:\" \"${a_output[@]}\" \"\" fi }" expect : "(?i)^[\\s]*\\**[\\s]*pass:?[\\s]*\\**$" type : CMD_EXEC description : "4.1.1 Ensure a single firewall configuration utility is in use" info : "In Linux security, employing a single, effective firewall configuration utility ensures that only legitimate traffic gets processed, reducing the system's exposure to potential threats. Proper configuration of a single firewall utility minimizes cyber threats and protects services and data, while avoiding vulnerabilities like open ports or exposed services. Standardizing on a single tool simplifies management, reduces errors, and fortifies security across Linux systems." solution : "Remediating to a single firewall configuration is a complex process and involves several steps. The following provides the basic steps to follow for a single firewall configuration: - Determine which firewall utility best fits organizational needs - If you are upgrading from a release older than SUSE Linux Enterprise Server 15 GA, SuSEfirewall2 will be unchanged and you must manually upgrade to firewalld - Return to this recommendation to ensure a single firewall configuration utility is in use Impact: If you are upgrading from a release older than SUSE Linux Enterprise Server 15 GA, SuSEfirewall2 will be unchanged and you must manually upgrade to firewalld The use of more than one firewall utility may produce unexpected results." reference : "800-171|3.13.1,800-171|3.13.5,800-171|3.13.6,800-171r3|03.13.01,800-171r3|03.13.06,800-53|CA-9,800-53|SC-7,800-53|SC-7(5),800-53r5|CA-9,800-53r5|SC-7,800-53r5|SC-7(5),CN-L3|7.1.2.2(c),CN-L3|8.1.10.6(j),CSCv7|9.4,CSCv8|4.4,CSCv8|4.5,CSF|DE.CM-1,CSF|ID.AM-3,CSF|PR.AC-5,CSF|PR.DS-5,CSF|PR.PT-4,CSF2.0|DE.CM-01,CSF2.0|ID.AM-03,CSF2.0|PR.DS-01,CSF2.0|PR.DS-02,CSF2.0|PR.DS-10,CSF2.0|PR.IR-01,GDPR|32.1.b,GDPR|32.1.d,GDPR|32.2,HIPAA|164.306(a)(1),ISO-27001-2022|A.5.14,ISO-27001-2022|A.8.16,ISO-27001-2022|A.8.20,ISO/IEC-27001|A.13.1.3,ITSG-33|SC-7,ITSG-33|SC-7(5),LEVEL|1A,NESA|T4.5.4,NIAv2|GS1,NIAv2|GS2a,NIAv2|GS2b,NIAv2|GS7b,NIAv2|NS25,PCI-DSSv3.2.1|1.1,PCI-DSSv3.2.1|1.2,PCI-DSSv3.2.1|1.2.1,PCI-DSSv3.2.1|1.3,PCI-DSSv4.0|1.2.1,PCI-DSSv4.0|1.4.1,QCSC-v1|4.2,QCSC-v1|5.2.1,QCSC-v1|5.2.2,QCSC-v1|5.2.3,QCSC-v1|6.2,QCSC-v1|8.2.1,SWIFT-CSCv1|2.1,TBA-FIISB|43.1" see_also : "https://workbench.cisecurity.org/benchmarks/20333" cmd : "#!/bin/bash { active_firewall=() firewalls=(\"firewalld\" \"susefirewall2\") # Determine which firewall is in use for firewall in \"${firewalls[@]}\"; do case $firewall in firewalld|susefirewall2) cmd=$firewall esac if command -v $cmd &> /dev/null && systemctl is-enabled --quiet $firewall && systemctl is-active --quiet $firewall; then active_firewall+=(\"$firewall\") fi done # Display audit results if [ ${#active_firewall[@]} -eq 1 ]; then printf '%s\\n' \"\" \"Audit Results:\" \" ** PASS **\" \" - A single firewall is in use follow the recommendation in ${active_firewall[0]} subsection ONLY\" elif [ ${#active_firewall[@]} -eq 0 ]; then printf '%s\\n' \"\" \" Audit Results:\" \" ** FAIL **\" \"- No firewall in use or unable to determine firewall status\" else printf '%s\\n' \"\" \" Audit Results:\" \" ** FAIL **\" \" - Multiple firewalls are in use: ${active_firewall[*]}\" fi }" expect : "(?i)^[\\s]*\\**[\\s]*pass:?[\\s]*\\**$" type : RPM_CHECK description : "4.2.1 Ensure firewalld is installed" info : "firewalld provides a dynamically managed firewall with support for network/firewall zones to define the trust level of network connections or interfaces. It has support for IPv4, IPv6 firewall settings and for ethernet bridges and has a separation of runtime and permanent configuration options. It also supports an interface for services or applications to add firewall rules directly. firewalld is installed and enabled by default as the host-based firewall in SUSE 15. When appropriately configured firewalld can protect against threats originating from within a corporate network to include malicious mobile code and poorly configured software on a host." solution : "Run the following command to install firewalld : # zypper install firewalld Note: If you are upgrading from a release older than SUSE Linux Enterprise Server 15 GA, SuSEfirewall2 will be unchanged and you must manually upgrade to firewalld Impact: firewalld replaces SuSEfirewall2 SUSE Linux Enterprise Server 15 introduces firewalld as the new default software firewall, replacing SuSEfirewall2 If you are upgrading from a release older than SUSE Linux Enterprise Server 15 GA, SuSEfirewall2 will be unchanged and you must manually upgrade to firewalld" reference : "800-171|3.13.1,800-171|3.13.5,800-171|3.13.6,800-171r3|03.13.01,800-171r3|03.13.06,800-53|CA-9,800-53|SC-7,800-53|SC-7(5),800-53r5|CA-9,800-53r5|SC-7,800-53r5|SC-7(5),CN-L3|7.1.2.2(c),CN-L3|8.1.10.6(j),CSCv7|9.4,CSCv8|4.4,CSF|DE.CM-1,CSF|ID.AM-3,CSF|PR.AC-5,CSF|PR.DS-5,CSF|PR.PT-4,CSF2.0|DE.CM-01,CSF2.0|ID.AM-03,CSF2.0|PR.DS-01,CSF2.0|PR.DS-02,CSF2.0|PR.DS-10,CSF2.0|PR.IR-01,GDPR|32.1.b,GDPR|32.1.d,GDPR|32.2,HIPAA|164.306(a)(1),ISO-27001-2022|A.5.14,ISO-27001-2022|A.8.16,ISO-27001-2022|A.8.20,ISO/IEC-27001|A.13.1.3,ITSG-33|SC-7,ITSG-33|SC-7(5),LEVEL|1A,NESA|T4.5.4,NIAv2|GS1,NIAv2|GS2a,NIAv2|GS2b,NIAv2|GS7b,NIAv2|NS25,PCI-DSSv3.2.1|1.1,PCI-DSSv3.2.1|1.2,PCI-DSSv3.2.1|1.2.1,PCI-DSSv3.2.1|1.3,PCI-DSSv4.0|1.2.1,PCI-DSSv4.0|1.4.1,QCSC-v1|4.2,QCSC-v1|5.2.1,QCSC-v1|5.2.2,QCSC-v1|5.2.3,QCSC-v1|6.2,QCSC-v1|8.2.1,SWIFT-CSCv1|2.1,TBA-FIISB|43.1" see_also : "https://workbench.cisecurity.org/benchmarks/20333" rpm : "firewalld-0.0.0-0" operator : "gt" required : YES type : CMD_EXEC description : "4.2.2 Ensure firewalld drops unnecessary services and ports" 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. - ACCEPT - you accept all incoming packets except those disabled by a specific rule. - REJECT - you disable all incoming packets except those that you have allowed in specific rules and the source machine is informed about the rejection. - DROP - you disable all incoming packets except those that you have allowed in specific rules and no information sent to the source machine. Note: - Allow port 22(ssh) needs to be updated to only allow systems requiring ssh connectivity to connect, as per site policy. 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 : "If Firewalld is in use on the system: 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-171|3.13.6,800-171r3|03.13.01,800-171r3|03.13.06,800-53|CA-9,800-53|SC-7,800-53|SC-7(5),800-53r5|CA-9,800-53r5|SC-7,800-53r5|SC-7(5),CN-L3|7.1.2.2(c),CN-L3|8.1.10.6(j),CSCv7|9.4,CSCv8|4.4,CSF|DE.CM-1,CSF|ID.AM-3,CSF|PR.AC-5,CSF|PR.DS-5,CSF|PR.PT-4,CSF2.0|DE.CM-01,CSF2.0|ID.AM-03,CSF2.0|PR.DS-01,CSF2.0|PR.DS-02,CSF2.0|PR.DS-10,CSF2.0|PR.IR-01,GDPR|32.1.b,GDPR|32.1.d,GDPR|32.2,HIPAA|164.306(a)(1),ISO-27001-2022|A.5.14,ISO-27001-2022|A.8.16,ISO-27001-2022|A.8.20,ISO/IEC-27001|A.13.1.3,ITSG-33|SC-7,ITSG-33|SC-7(5),LEVEL|1M,NESA|T4.5.4,NIAv2|GS1,NIAv2|GS2a,NIAv2|GS2b,NIAv2|GS7b,NIAv2|NS25,PCI-DSSv3.2.1|1.1,PCI-DSSv3.2.1|1.2,PCI-DSSv3.2.1|1.2.1,PCI-DSSv3.2.1|1.3,PCI-DSSv4.0|1.2.1,PCI-DSSv4.0|1.4.1,QCSC-v1|4.2,QCSC-v1|5.2.1,QCSC-v1|5.2.2,QCSC-v1|5.2.3,QCSC-v1|6.2,QCSC-v1|8.2.1,SWIFT-CSCv1|2.1,TBA-FIISB|43.1" see_also : "https://workbench.cisecurity.org/benchmarks/20333" cmd : "/bin/systemctl is-enabled firewalld.service | /bin/grep -q 'enabled' && /usr/bin/firewall-cmd --list-all --zone=\"$(firewall-cmd --list-all | /bin/awk '/\\(active\\)/ { print $1 }')\" | /bin/grep -P -- '^\\h*(services:|ports:)'" expect : "^Manual Review Required$" severity : MEDIUM type : CMD_EXEC description : "4.2.3 Ensure firewalld loopback traffic is configured" info : "Configure the loopback interface to accept traffic. Configure all other interfaces to deny traffic to the loopback network 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." solution : "Run the following script to implement the loopback rules: #!/usr/bin/env bash { l_hbfw=\"\" if systemctl is-enabled firewalld.service | grep -q 'enabled'; then echo -e \"\n - FirewallD is in use on the system\" && l_hbfw=\"fwd\" elif systemctl is-enabled nftables.service 2>/dev/null | grep -q 'enabled'; then echo -e \"\n - nftables is in use on the system \n - Recommendation is NA \n - Remediation Complete\" && l_hbfw=\"nft\" fi if [ \"$l_hbfw\" = \"fwd\" ]; then l_ipsaddr=\"$(nft list ruleset | awk '/filter_IN_public_deny|hook\s+input\s+/,/\}\s*(#.*)?$/' | grep -P -- 'ip\h+saddr')\" if ! nft list ruleset | awk '/hook\s+input\s+/,/\}\s*(#.*)?$/' | grep -Pq -- '\H+\h+\"lo\"\h+accept'; then echo -e \"\n - Enabling input to accept for loopback address\" firewall-cmd --permanent --zone=trusted --add-interface=lo firewall-cmd --reload else echo -e \"\n - firewalld input correctly set to accept for loopback address\" if ! grep -Pq -- 'ip\h+saddr\h+127\.0\.0\.0\/8\h+(counter\h+packets\h+\d+\h+bytes\h+\d+\h+)?drop' <<< \"$l_ipsaddr\" && ! grep -Pq -- 'ip\h+daddr\h+\!\=\h+127\.0\.0\.1\h+ip\h+saddr\h+127\.0\.0\.1\h+drop' <<< \"$l_ipsaddr\"; then echo -e \"\n - Setting IPv4 network traffic from loopback address to drop\" firewall-cmd --permanent --add-rich-rule='rule family=ipv4 source address=\"127.0.0.1\" destination not address=\"127.0.0.1\" drop' firewall-cmd --permanent --zone=trusted --add-rich-rule='rule family=ipv4 source address=\"127.0.0.1\" destination not address=\"127.0.0.1\" drop' firewall-cmd --reload else echo -e \"\n - firewalld correctly set IPv4 network traffic from loopback address to drop\" fi if grep -Pq -- '^\h*0\h*$' /sys/module/ipv6/parameters/disable; then l_ip6saddr=\"$(nft list ruleset | awk '/filter_IN_public_deny|hook input/,/}/' | grep 'ip6 saddr')\" if ! grep -Pq 'ip6\h+saddr\h+::1\h+(counter\h+packets\h+\d+\h+bytes\h+\d+\h+)?drop' <<< \"$l_ip6saddr\" && ! grep -Pq -- 'ip6\h+daddr\h+\!=\h+::1\h+ip6\h+saddr\h+::1\h+drop' <<< \"$l_ip6saddr\"; then echo -e \"\n - Setting IPv6 network traffic from loopback address to drop\" firewall-cmd --permanent --add-rich-rule='rule family=ipv6 source address=\"::1\" destination not address=\"::1\" drop' firewall-cmd --permanent --zone=trusted --add-rich-rule='rule family=ipv6 source address=\"::1\" destination not address=\"::1\" drop' firewall-cmd --reload else echo -e \"\n - firewalld correctly set IPv6 network traffic from loopback address to drop\" fi fi fi fi }" reference : "800-171|3.13.1,800-171|3.13.5,800-171|3.13.6,800-171r3|03.13.01,800-171r3|03.13.06,800-53|CA-9,800-53|SC-7,800-53|SC-7(5),800-53r5|CA-9,800-53r5|SC-7,800-53r5|SC-7(5),CN-L3|7.1.2.2(c),CN-L3|8.1.10.6(j),CSCv7|9.4,CSCv8|4.4,CSF|DE.CM-1,CSF|ID.AM-3,CSF|PR.AC-5,CSF|PR.DS-5,CSF|PR.PT-4,CSF2.0|DE.CM-01,CSF2.0|ID.AM-03,CSF2.0|PR.DS-01,CSF2.0|PR.DS-02,CSF2.0|PR.DS-10,CSF2.0|PR.IR-01,GDPR|32.1.b,GDPR|32.1.d,GDPR|32.2,HIPAA|164.306(a)(1),ISO-27001-2022|A.5.14,ISO-27001-2022|A.8.16,ISO-27001-2022|A.8.20,ISO/IEC-27001|A.13.1.3,ITSG-33|SC-7,ITSG-33|SC-7(5),LEVEL|1A,NESA|T4.5.4,NIAv2|GS1,NIAv2|GS2a,NIAv2|GS2b,NIAv2|GS7b,NIAv2|NS25,PCI-DSSv3.2.1|1.1,PCI-DSSv3.2.1|1.2,PCI-DSSv3.2.1|1.2.1,PCI-DSSv3.2.1|1.3,PCI-DSSv4.0|1.2.1,PCI-DSSv4.0|1.4.1,QCSC-v1|4.2,QCSC-v1|5.2.1,QCSC-v1|5.2.2,QCSC-v1|5.2.3,QCSC-v1|6.2,QCSC-v1|8.2.1,SWIFT-CSCv1|2.1,TBA-FIISB|43.1" see_also : "https://workbench.cisecurity.org/benchmarks/20333" cmd : "#!/bin/bash { l_output=\"\" l_output2=\"\" l_hbfw=\"\" if systemctl is-enabled firewalld.service | grep -q 'enabled'; then echo -e \"\\n - FirewallD is in use on the system\" && l_hbfw=\"fwd\" elif systemctl is-enabled nftables.service 2>/dev/null | grep -q 'enabled'; then echo -e \"\\n - nftables is in use on the system \\n - Recommendation is NA\" && l_hbfw=\"nft\" else echo -e \"\\n - Error - Neither FirewallD or NFTables is enabled\\n - Please follow recommendation: \\\"Ensure a single firewall configuration utility is in use\\\"\" fi if [ \"$l_hbfw\" = \"fwd\" ]; then if nft list ruleset | awk '/hook\\s+input\\s+/,/\\}\\s*(#.*)?$/' | grep -Pq -- '\\H+\\h+\"lo\"\\h+accept'; then l_output=\"$l_output\\n - Network traffic to the loopback address is correctly set to accept\" else l_output2=\"$l_output2\\n - Network traffic to the loopback address is not set to accept\" fi l_ipsaddr=\"$(nft list ruleset | awk '/filter_IN_public_deny|hook\\s+input\\s+/,/\\}\\s*(#.*)?$/' | grep -P -- 'ip\\h+saddr')\" if grep -Pq -- 'ip\\h+saddr\\h+127\\.0\\.0\\.0\\/8\\h+(counter\\h+packets\\h+\\d+\\h+bytes\\h+\\d+\\h+)?drop' <<< \"$l_ipsaddr\" || grep -Pq -- 'ip\\h+daddr\\h+\\!\\=\\h+127\\.0\\.0\\.1\\h+ip\\h+saddr\\h+127\\.0\\.0\\.1\\h+drop' <<< \"$l_ipsaddr\"; then l_output=\"$l_output\\n - IPv4 network traffic from loopback address correctly set to drop\" else l_output2=\"$l_output2\\n - IPv4 network traffic from loopback address not set to drop\" fi if grep -Pq -- '^\\h*0\\h*$' /sys/module/ipv6/parameters/disable; then l_ip6saddr=\"$(nft list ruleset | awk '/filter_IN_public_deny|hook input/,/}/' | grep 'ip6 saddr')\" if grep -Pq 'ip6\\h+saddr\\h+::1\\h+(counter\\h+packets\\h+\\d+\\h+bytes\\h+\\d+\\h+)?drop' <<< \"$l_ip6saddr\" || grep -Pq -- 'ip6\\h+daddr\\h+\\!=\\h+::1\\h+ip6\\h+saddr\\h+::1\\h+drop' <<< \"$l_ip6saddr\"; then l_output=\"$l_output\\n - IPv6 network traffic from loopback address correctly set to drop\" else l_output2=\"$l_output2\\n - IPv6 network traffic from loopback address not set to drop\" fi fi fi if [ \"$l_hbfw\" = \"nft\" ] || [ -z \"$l_output2\" ]; then echo -e \"\\n- Audit Result:\\n *** PASS ***\\n$l_output\" else echo -e \"\\n- Audit Result:\\n *** FAIL ***\\n$l_output2\\n\\n - Correctly set:\\n$l_output\" fi }" expect : "(?i)^[\\s]*\\**[\\s]*pass:?[\\s]*\\**$" type : CMD_EXEC description : "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 explicitly bound/assigned to another zone.If 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. Note: - A firewalld zone configuration file contains the information for a zone. - These are the zone description, services, ports, protocols, icmp-blocks, masquerade, forward-ports and rich language rules in an XML file format. - The file name has to be zone_name.xml where length of zone_name is currently limited to 17 chars. - NetworkManager binds interfaces to zones automatically 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" 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-171|3.13.6,800-171r3|03.13.01,800-171r3|03.13.06,800-53|CA-9,800-53|SC-7,800-53|SC-7(5),800-53r5|CA-9,800-53r5|SC-7,800-53r5|SC-7(5),CN-L3|7.1.2.2(c),CN-L3|8.1.10.6(j),CSCv7|9.4,CSCv8|4.4,CSF|DE.CM-1,CSF|ID.AM-3,CSF|PR.AC-5,CSF|PR.DS-5,CSF|PR.PT-4,CSF2.0|DE.CM-01,CSF2.0|ID.AM-03,CSF2.0|PR.DS-01,CSF2.0|PR.DS-02,CSF2.0|PR.DS-10,CSF2.0|PR.IR-01,GDPR|32.1.b,GDPR|32.1.d,GDPR|32.2,HIPAA|164.306(a)(1),ISO-27001-2022|A.5.14,ISO-27001-2022|A.8.16,ISO-27001-2022|A.8.20,ISO/IEC-27001|A.13.1.3,ITSG-33|SC-7,ITSG-33|SC-7(5),LEVEL|1A,NESA|T4.5.4,NIAv2|GS1,NIAv2|GS2a,NIAv2|GS2b,NIAv2|GS7b,NIAv2|NS25,PCI-DSSv3.2.1|1.1,PCI-DSSv3.2.1|1.2,PCI-DSSv3.2.1|1.2.1,PCI-DSSv3.2.1|1.3,PCI-DSSv4.0|1.2.1,PCI-DSSv4.0|1.4.1,QCSC-v1|4.2,QCSC-v1|5.2.1,QCSC-v1|5.2.2,QCSC-v1|5.2.3,QCSC-v1|6.2,QCSC-v1|8.2.1,SWIFT-CSCv1|2.1,TBA-FIISB|43.1" see_also : "https://workbench.cisecurity.org/benchmarks/20333" cmd : "/usr/bin/firewall-cmd --get-default-zone" expect : "@FIREWALLD_DEFAULT_ZONE@" type : CMD_EXEC description : "firewall-cmd --state" cmd : "/usr/bin/firewall-cmd --state" expect : "^running$" type : CMD_EXEC description : "systemctl is-enabled firewalld" cmd : "/bin/systemctl is-enabled firewalld | /bin/awk '{print} END {if(NR==0) print \"disabled\" }'" expect : "^enabled$" description : "4.2.5 Ensure firewalld service is enabled and running" info : "firewalld.service enables the enforcement of firewall rules configured through firewalld SUSE Linux Enterprise Server 15 GA introduces firewalld as the new default software firewall, replacing SuSEfirewall2" solution : "Run the following command to unmask firewalld # systemctl unmask firewalld 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-171|3.13.5,800-171|3.13.6,800-171r3|03.13.01,800-171r3|03.13.06,800-53|CA-9,800-53|SC-7,800-53|SC-7(5),800-53r5|CA-9,800-53r5|SC-7,800-53r5|SC-7(5),CN-L3|7.1.2.2(c),CN-L3|8.1.10.6(j),CSCv7|9.4,CSCv8|4.4,CSF|DE.CM-1,CSF|ID.AM-3,CSF|PR.AC-5,CSF|PR.DS-5,CSF|PR.PT-4,CSF2.0|DE.CM-01,CSF2.0|ID.AM-03,CSF2.0|PR.DS-01,CSF2.0|PR.DS-02,CSF2.0|PR.DS-10,CSF2.0|PR.IR-01,GDPR|32.1.b,GDPR|32.1.d,GDPR|32.2,HIPAA|164.306(a)(1),ISO-27001-2022|A.5.14,ISO-27001-2022|A.8.16,ISO-27001-2022|A.8.20,ISO/IEC-27001|A.13.1.3,ITSG-33|SC-7,ITSG-33|SC-7(5),LEVEL|1A,NESA|T4.5.4,NIAv2|GS1,NIAv2|GS2a,NIAv2|GS2b,NIAv2|GS7b,NIAv2|NS25,PCI-DSSv3.2.1|1.1,PCI-DSSv3.2.1|1.2,PCI-DSSv3.2.1|1.2.1,PCI-DSSv3.2.1|1.3,PCI-DSSv4.0|1.2.1,PCI-DSSv4.0|1.4.1,QCSC-v1|4.2,QCSC-v1|5.2.1,QCSC-v1|5.2.2,QCSC-v1|5.2.3,QCSC-v1|6.2,QCSC-v1|8.2.1,SWIFT-CSCv1|2.1,TBA-FIISB|43.1" see_also : "https://workbench.cisecurity.org/benchmarks/20333" show_output : YES type : CMD_EXEC description : "5.1.1 Ensure permissions on /etc/ssh/sshd_config are configured" info : "The file /etc/ssh/sshd_config and files ending inconf in the /etc/ssh/sshd_config.d directory, contain configuration specifications for sshd configuration specifications for sshd need to be protected from unauthorized changes by non-privileged users." solution : "Run the following script to set ownership and permissions on /etc/ssh/sshd_config and files ending inconf in the /etc/ssh/sshd_config.d directory: #!/usr/bin/env bash { chmod u-x,og-rwx /etc/ssh/sshd_config chown root:root /etc/ssh/sshd_config while IFS= read -r -d $'\0' l_file; do if [ -e \"$l_file\" ]; then chmod u-x,og-rwx \"$l_file\" chown root:root \"$l_file\" fi done < <(find /etc/ssh/sshd_config.d -type f -print0 2>/dev/null) } - IF - other locations are listed in an Include statement, *.conf files in these locations access should also be modified." reference : "800-171|3.1.1,800-171|3.1.4,800-171|3.1.5,800-171|3.8.1,800-171|3.8.2,800-171|3.8.3,800-171r3|03.01.02,800-171r3|03.01.04,800-171r3|03.01.05a.,800-171r3|03.08.02,800-53|AC-3,800-53|AC-5,800-53|AC-6,800-53|MP-2,800-53r5|AC-3,800-53r5|AC-5,800-53r5|AC-6,800-53r5|MP-2,CN-L3|7.1.3.2(b),CN-L3|7.1.3.2(g),CN-L3|8.1.4.2(d),CN-L3|8.1.4.2(f),CN-L3|8.1.4.11(b),CN-L3|8.1.10.2(c),CN-L3|8.1.10.6(a),CN-L3|8.5.3.1,CN-L3|8.5.4.1(a),CSCv7|14.6,CSCv8|3.3,CSF|PR.AC-4,CSF|PR.DS-5,CSF|PR.PT-2,CSF|PR.PT-3,CSF2.0|PR.AA-05,CSF2.0|PR.DS-10,CSF2.0|PR.IR-01,GDPR|32.1.b,HIPAA|164.306(a)(1),HIPAA|164.312(a)(1),ISO-27001-2022|A.5.3,ISO-27001-2022|A.5.10,ISO-27001-2022|A.5.15,ISO-27001-2022|A.5.33,ISO-27001-2022|A.7.7,ISO-27001-2022|A.7.10,ISO-27001-2022|A.8.2,ISO-27001-2022|A.8.3,ISO-27001-2022|A.8.18,ISO-27001-2022|A.8.20,ISO/IEC-27001|A.6.1.2,ISO/IEC-27001|A.9.4.1,ISO/IEC-27001|A.9.4.5,ITSG-33|AC-3,ITSG-33|AC-5,ITSG-33|AC-6,ITSG-33|MP-2,ITSG-33|MP-2a.,LEVEL|1A,NESA|T1.3.2,NESA|T1.3.3,NESA|T1.4.1,NESA|T4.2.1,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.2,NESA|T7.5.3,NIAv2|AM1,NIAv2|AM3,NIAv2|AM23f,NIAv2|SS13c,NIAv2|SS15c,NIAv2|SS29,PCI-DSSv3.2.1|7.1.2,PCI-DSSv4.0|7.2.1,PCI-DSSv4.0|7.2.2,QCSC-v1|3.2,QCSC-v1|5.2.2,QCSC-v1|6.2,QCSC-v1|13.2,SWIFT-CSCv1|5.1,TBA-FIISB|31.1,TBA-FIISB|31.4.2,TBA-FIISB|31.4.3" see_also : "https://workbench.cisecurity.org/benchmarks/20333" cmd : "#!/bin/bash { l_output=\"\" l_output2=\"\" perm_mask='0177' && maxperm=\"$( printf '%o' $(( 0777 & ~$perm_mask)) )\" SSHD_FILES_CHK() { while IFS=: read -r l_mode l_user l_group; do l_out2=\"\" [ $(( $l_mode & $perm_mask )) -gt 0 ] && l_out2=\"$l_out2\\n - Is mode: \\\"$l_mode\\\" should be: \\\"$maxperm\\\" or more restrictive\" [ \"$l_user\" != \"root\" ] && l_out2=\"$l_out2\\n - Is owned by \\\"$l_user\\\" should be owned by \\\"root\\\"\" [ \"$l_group\" != \"root\" ] && l_out2=\"$l_out2\\n - Is group owned by \\\"$l_user\\\" should be group owned by \\\"root\\\"\" if [ -n \"$l_out2\" ]; then l_output2=\"$l_output2\\n - File: \\\"$l_file\\\":$l_out2\" else l_output=\"$l_output\\n - File: \\\"$l_file\\\":\\n - Correct: mode ($l_mode), owner ($l_user), and group owner ($l_group) configured\" fi done < <(stat -Lc '%#a:%U:%G' \"$l_file\") } [ -e \"/etc/ssh/sshd_config\" ] && l_file=\"/etc/ssh/sshd_config\" && SSHD_FILES_CHK while IFS= read -r -d $'\\0' l_file; do [ -e \"$l_file\" ] && SSHD_FILES_CHK done < <(find -L /etc/ssh/sshd_config.d -type f \\( -perm /077 -o ! -user root -o ! -group root \\) -print0) if [ -z \"$l_output2\" ]; then echo -e \"\\n- Audit Result:\\n *** PASS ***\\n- * Correctly set * :\\n$l_output\\n\" else echo -e \"\\n- Audit Result:\\n ** FAIL **\\n - * Reasons for audit failure * :\\n$l_output2\\n\" [ -n \"$l_output\" ] && echo -e \" - * Correctly set * :\\n$l_output\\n\" fi }" expect : "(?i)^[\\s]*\\**[\\s]*pass:?[\\s]*\\**$" type : CMD_EXEC description : "openssh-server is installed" cmd : "/bin/dpkg -s openssh-server 2>&1 | /bin/grep -E '(Status:|not installed)'" expect : "^Status: install ok" type : CMD_EXEC description : "5.1.12 Ensure sshd HostbasedAuthentication is disabled" info : "The HostbasedAuthentication parameter specifies if authentication is allowed through trusted hosts via the user ofrhosts or /etc/hosts.equiv along with successful public key client host authentication. Even though therhosts files are ineffective if support is disabled in /etc/pam.conf disabling the ability to userhosts files in SSH provides an additional layer of protection." solution : "Edit the /etc/ssh/sshd_config file to set the HostbasedAuthentication parameter to no above any Include and Match entries as follows: HostbasedAuthentication no Note: First occurrence of a option takes precedence, Match set statements withstanding. If Include locations are enabled, used, and order of precedence is understood in your environment, the entry may be created in a file in Include location." reference : "800-171|3.4.6,800-171|3.4.7,800-171r3|03.04.06b.,800-53|CM-7b.,800-53r5|CM-7b.,CN-L3|7.1.3.5(c),CN-L3|7.1.3.7(d),CN-L3|8.1.4.4(b),CSF|PR.IP-1,CSF|PR.PT-3,CSF2.0|PR.PS-01,GDPR|32.1.b,HIPAA|164.306(a)(1),ITSG-33|CM-7a.,LEVEL|1A,NIAv2|SS13b,NIAv2|SS14a,NIAv2|SS14c,PCI-DSSv3.2.1|2.2.2,PCI-DSSv4.0|2.2.4,QCSC-v1|3.2,SWIFT-CSCv1|2.3" see_also : "https://workbench.cisecurity.org/benchmarks/20333" cmd : "#!/bin/bash { ports=$(/bin/grep -s -P \"^(Port|Match)\" /etc/ssh/sshd_config /etc/ssh/sshd_config.d/*.conf | /bin/grep -P -o \"(Port|LocalPort)[\\s]+[\\d]+\" | /bin/awk '{print $2}; END {if (NR == 0) print \"22\"}' | /bin/uniq); for port in ${ports[@]}; do /sbin/sshd -T -C user=root -C host=\"$(hostname)\" -C addr=\"$(/bin/grep $(hostname) /etc/hosts | /bin/awk '{print $1}')\" -C lport=$port | echo \"port $port: $(/bin/grep -i ^hostbasedauthentication)\"; done | /bin/awk 'BEGIN {f=0} /HostbasedAuthentication/i { if ($NF == \"yes\") f++; print $0} END {if (NR == 0) print \"Fail: no results returned\"; else if (f > 0) print \"Fail\"; else print \"Pass\" }' }" expect : "^Pass$" description : "5.1.12 Ensure sshd HostbasedAuthentication is disabled" info : "The HostbasedAuthentication parameter specifies if authentication is allowed through trusted hosts via the user ofrhosts or /etc/hosts.equiv along with successful public key client host authentication. Even though therhosts files are ineffective if support is disabled in /etc/pam.conf disabling the ability to userhosts files in SSH provides an additional layer of protection." solution : "Edit the /etc/ssh/sshd_config file to set the HostbasedAuthentication parameter to no above any Include and Match entries as follows: HostbasedAuthentication no Note: First occurrence of a option takes precedence, Match set statements withstanding. If Include locations are enabled, used, and order of precedence is understood in your environment, the entry may be created in a file in Include location." reference : "800-171|3.4.6,800-171|3.4.7,800-171r3|03.04.06b.,800-53|CM-7b.,800-53r5|CM-7b.,CN-L3|7.1.3.5(c),CN-L3|7.1.3.7(d),CN-L3|8.1.4.4(b),CSF|PR.IP-1,CSF|PR.PT-3,CSF2.0|PR.PS-01,GDPR|32.1.b,HIPAA|164.306(a)(1),ITSG-33|CM-7a.,LEVEL|1A,NIAv2|SS13b,NIAv2|SS14a,NIAv2|SS14c,PCI-DSSv3.2.1|2.2.2,PCI-DSSv4.0|2.2.4,QCSC-v1|3.2,SWIFT-CSCv1|2.3" see_also : "https://workbench.cisecurity.org/benchmarks/20333" type : CMD_EXEC description : "openssh-server is installed" cmd : "/bin/dpkg -s openssh-server 2>&1 | /bin/grep -E '(Status:|not installed)'" expect : "^Status: install ok" type : CMD_EXEC description : "5.1.13 Ensure sshd IgnoreRhosts is enabled" info : "The IgnoreRhosts parameter specifies thatrhosts andshosts files will not be used in RhostsRSAAuthentication or HostbasedAuthentication Setting this parameter forces users to enter a password when authenticating with SSH." solution : "Edit the /etc/ssh/sshd_config file to set the IgnoreRhosts parameter to yes above any Include and Match entries as follows: IgnoreRhosts yes Note: First occurrence of a option takes precedence, Match set statements withstanding. If Include locations are enabled, used, and order of precedence is understood in your environment, the entry may be created in a file in Include location." reference : "800-171|3.5.2,800-171r3|03.05.07,800-53|IA-5(1),800-53r5|IA-5(1),CSCv7|4.4,CSCv8|5.2,CSF|PR.AC-1,CSF2.0|PR.AA-01,CSF2.0|PR.AA-03,GDPR|32.1.b,HIPAA|164.306(a)(1),HIPAA|164.312(a)(2)(i),HIPAA|164.312(d),ISO-27001-2022|A.5.16,ISO-27001-2022|A.5.17,ITSG-33|IA-5(1),LEVEL|1A,NESA|T5.2.3,QCSC-v1|5.2.2,QCSC-v1|13.2,SWIFT-CSCv1|4.1" see_also : "https://workbench.cisecurity.org/benchmarks/20333" cmd : "#!/bin/bash { ports=$(/bin/grep -s -P \"^(Port|Match)\" /etc/ssh/sshd_config /etc/ssh/sshd_config.d/*.conf | /bin/grep -P -o \"(Port|LocalPort)[\\s]+[\\d]+\" | /bin/awk '{print $2}; END {if (NR == 0) print \"22\"}' | /bin/uniq); for port in ${ports[@]}; do /sbin/sshd -T -C user=root -C host=\"$(hostname)\" -C addr=\"$(/bin/grep $(hostname) /etc/hosts | /bin/awk '{print $1}')\" -C lport=$port | echo \"port $port: $(/bin/grep -i ^ignorerhosts)\"; done | /bin/awk 'BEGIN {f=0} /IgnoreRhosts/i { if ($NF == \"no\") f++; print $0} END {if (NR == 0) print \"Fail: no results returned\"; else if (f > 0) print \"Fail\"; else print \"Pass\" }' }" expect : "^Pass$" description : "5.1.13 Ensure sshd IgnoreRhosts is enabled" info : "The IgnoreRhosts parameter specifies thatrhosts andshosts files will not be used in RhostsRSAAuthentication or HostbasedAuthentication Setting this parameter forces users to enter a password when authenticating with SSH." solution : "Edit the /etc/ssh/sshd_config file to set the IgnoreRhosts parameter to yes above any Include and Match entries as follows: IgnoreRhosts yes Note: First occurrence of a option takes precedence, Match set statements withstanding. If Include locations are enabled, used, and order of precedence is understood in your environment, the entry may be created in a file in Include location." reference : "800-171|3.5.2,800-171r3|03.05.07,800-53|IA-5(1),800-53r5|IA-5(1),CSCv7|4.4,CSCv8|5.2,CSF|PR.AC-1,CSF2.0|PR.AA-01,CSF2.0|PR.AA-03,GDPR|32.1.b,HIPAA|164.306(a)(1),HIPAA|164.312(a)(2)(i),HIPAA|164.312(d),ISO-27001-2022|A.5.16,ISO-27001-2022|A.5.17,ITSG-33|IA-5(1),LEVEL|1A,NESA|T5.2.3,QCSC-v1|5.2.2,QCSC-v1|13.2,SWIFT-CSCv1|4.1" see_also : "https://workbench.cisecurity.org/benchmarks/20333" type : CMD_EXEC description : "openssh-server is installed" cmd : "/bin/dpkg -s openssh-server 2>&1 | /bin/grep -E '(Status:|not installed)'" expect : "^Status: install ok" type : CMD_EXEC description : "5.1.14 Ensure sshd LoginGraceTime is configured" 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. 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 LoginGraceTime parameter to 60 seconds or less above any Include entry as follows: LoginGraceTime 60 Note: First occurrence of a option takes precedence. If Include locations are enabled, used, and order of precedence is understood in your environment, the entry may be created in a file in Include location." reference : "800-171|3.1.11,800-171r3|03.01.11,800-53|AC-10,800-53|AC-12,800-53r5|AC-10,800-53r5|AC-12,CN-L3|7.1.2.2(d),CN-L3|7.1.3.7(b),CN-L3|8.1.4.1(b),CSF2.0|PR.AA-03,CSF2.0|PR.AA-05,GDPR|32.1.b,HIPAA|164.306(a)(1),HIPAA|164.312(a)(2)(iii),ITSG-33|AC-10,ITSG-33|AC-12,LEVEL|1A,NESA|T5.5.1,NIAv2|NS49,QCSC-v1|5.2.1,QCSC-v1|5.2.2" see_also : "https://workbench.cisecurity.org/benchmarks/20333" cmd : "#!/bin/bash { ports=$(/bin/grep -s -P \"^(Port|Match)\" /etc/ssh/sshd_config /etc/ssh/sshd_config.d/*.conf | /bin/grep -P -o \"(Port|LocalPort)[\\s]+[\\d]+\" | /bin/awk '{print $2}; END {if (NR == 0) print \"22\"}' | /bin/uniq); for port in ${ports[@]}; do /sbin/sshd -T -C user=root -C host=\"$(hostname)\" -C addr=\"$(/bin/grep $(hostname) /etc/hosts | /bin/awk '{print $1}')\" -C lport=$port | echo \"port $port: $(/bin/grep -i ^logingracetime)\"; done | /bin/awk 'BEGIN {f=0} /logingracetime/i { if ($NF !~ /^([1-9]|[1-5][0-9]|60|1m)$/) f++; print $0} END {if (NR == 0) print \"Fail: no results returned\"; else if (f > 0) print \"Fail\"; else print \"Pass\" }' }" expect : "^Pass$" description : "5.1.14 Ensure sshd LoginGraceTime is configured" 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. 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 LoginGraceTime parameter to 60 seconds or less above any Include entry as follows: LoginGraceTime 60 Note: First occurrence of a option takes precedence. If Include locations are enabled, used, and order of precedence is understood in your environment, the entry may be created in a file in Include location." reference : "800-171|3.1.11,800-171r3|03.01.11,800-53|AC-10,800-53|AC-12,800-53r5|AC-10,800-53r5|AC-12,CN-L3|7.1.2.2(d),CN-L3|7.1.3.7(b),CN-L3|8.1.4.1(b),CSF2.0|PR.AA-03,CSF2.0|PR.AA-05,GDPR|32.1.b,HIPAA|164.306(a)(1),HIPAA|164.312(a)(2)(iii),ITSG-33|AC-10,ITSG-33|AC-12,LEVEL|1A,NESA|T5.5.1,NIAv2|NS49,QCSC-v1|5.2.1,QCSC-v1|5.2.2" see_also : "https://workbench.cisecurity.org/benchmarks/20333" type : CMD_EXEC description : "openssh-server is installed" cmd : "/bin/dpkg -s openssh-server 2>&1 | /bin/grep -E '(Status:|not installed)'" expect : "^Status: install ok" type : CMD_EXEC description : "5.1.15 Ensure sshd LogLevel is configured" info : "SSH provides several logging levels with varying amounts of verbosity. The DEBUG options are specifically not recommended other than strictly for debugging SSH communications. These levels provide so much data that it is difficult to identify important security information, and may violate the privacy of users. The 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. The 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." solution : "Edit the /etc/ssh/sshd_config file to set the LogLevel parameter to VERBOSE or INFO above any Include and Match entries as follows: LogLevel VERBOSE - OR - LogLevel INFO Note: First occurrence of an option takes precedence, Match set statements withstanding. If Include locations are enabled, used, and order of precedence is understood in your environment, the entry may be created in a file in Include location." reference : "800-171|3.3.1,800-171|3.3.2,800-171|3.3.6,800-171r3|03.03.01,800-171r3|03.03.03,800-171r3|03.03.06a.,800-53|AU-2,800-53|AU-7,800-53|AU-12,800-53r5|AU-2,800-53r5|AU-7,800-53r5|AU-12,CN-L3|7.1.2.3(c),CN-L3|8.1.4.3(a),CSCv7|6.2,CSCv7|6.3,CSCv8|8.2,CSF|DE.CM-1,CSF|DE.CM-3,CSF|DE.CM-7,CSF|PR.PT-1,CSF|RS.AN-3,CSF2.0|DE.CM-01,CSF2.0|DE.CM-03,CSF2.0|DE.CM-09,CSF2.0|PR.PS-04,CSF2.0|RS.AN-03,CSF2.0|RS.AN-06,CSF2.0|RS.AN-07,GDPR|32.1.b,HIPAA|164.306(a)(1),HIPAA|164.312(b),ISO-27001-2022|A.8.15,ITSG-33|AU-2,ITSG-33|AU-7,ITSG-33|AU-12,LEVEL|1A,NESA|M1.2.2,NESA|M5.5.1,NIAv2|AM7,NIAv2|AM11a,NIAv2|AM11b,NIAv2|AM11c,NIAv2|AM11d,NIAv2|AM11e,NIAv2|SS30,NIAv2|VL8,PCI-DSSv3.2.1|10.1,QCSC-v1|3.2,QCSC-v1|6.2,QCSC-v1|8.2.1,QCSC-v1|10.2.1,QCSC-v1|11.2,QCSC-v1|13.2,SWIFT-CSCv1|6.4" see_also : "https://workbench.cisecurity.org/benchmarks/20333" cmd : "#!/bin/bash { ports=$(/bin/grep -s -P \"^(Port|Match)\" /etc/ssh/sshd_config /etc/ssh/sshd_config.d/*.conf | /bin/grep -P -o \"(Port|LocalPort)[\\s]+[\\d]+\" | /bin/awk '{print $2}; END {if (NR == 0) print \"22\"}' | /bin/uniq); for port in ${ports[@]}; do /sbin/sshd -T -C user=root -C host=\"$(hostname)\" -C addr=\"$(/bin/grep $(hostname) /etc/hosts | /bin/awk '{print $1}')\" -C lport=$port | echo \"port $port: $(/bin/grep -i loglevel)\"; done | /bin/awk 'BEGIN {f=0} /LogLevel/i { if ($NF !~ /^(INFO|VERBOSE)$/) f++; print $0} END {if (NR == 0) print \"Fail: no results returned\"; else if (f > 0) print \"Fail\"; else print \"Pass\" }' }" expect : "^Pass$" description : "5.1.15 Ensure sshd LogLevel is configured" info : "SSH provides several logging levels with varying amounts of verbosity. The DEBUG options are specifically not recommended other than strictly for debugging SSH communications. These levels provide so much data that it is difficult to identify important security information, and may violate the privacy of users. The 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. The 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." solution : "Edit the /etc/ssh/sshd_config file to set the LogLevel parameter to VERBOSE or INFO above any Include and Match entries as follows: LogLevel VERBOSE - OR - LogLevel INFO Note: First occurrence of an option takes precedence, Match set statements withstanding. If Include locations are enabled, used, and order of precedence is understood in your environment, the entry may be created in a file in Include location." reference : "800-171|3.3.1,800-171|3.3.2,800-171|3.3.6,800-171r3|03.03.01,800-171r3|03.03.03,800-171r3|03.03.06a.,800-53|AU-2,800-53|AU-7,800-53|AU-12,800-53r5|AU-2,800-53r5|AU-7,800-53r5|AU-12,CN-L3|7.1.2.3(c),CN-L3|8.1.4.3(a),CSCv7|6.2,CSCv7|6.3,CSCv8|8.2,CSF|DE.CM-1,CSF|DE.CM-3,CSF|DE.CM-7,CSF|PR.PT-1,CSF|RS.AN-3,CSF2.0|DE.CM-01,CSF2.0|DE.CM-03,CSF2.0|DE.CM-09,CSF2.0|PR.PS-04,CSF2.0|RS.AN-03,CSF2.0|RS.AN-06,CSF2.0|RS.AN-07,GDPR|32.1.b,HIPAA|164.306(a)(1),HIPAA|164.312(b),ISO-27001-2022|A.8.15,ITSG-33|AU-2,ITSG-33|AU-7,ITSG-33|AU-12,LEVEL|1A,NESA|M1.2.2,NESA|M5.5.1,NIAv2|AM7,NIAv2|AM11a,NIAv2|AM11b,NIAv2|AM11c,NIAv2|AM11d,NIAv2|AM11e,NIAv2|SS30,NIAv2|VL8,PCI-DSSv3.2.1|10.1,QCSC-v1|3.2,QCSC-v1|6.2,QCSC-v1|8.2.1,QCSC-v1|10.2.1,QCSC-v1|11.2,QCSC-v1|13.2,SWIFT-CSCv1|6.4" see_also : "https://workbench.cisecurity.org/benchmarks/20333" type : CMD_EXEC description : "openssh-server is installed" cmd : "/bin/dpkg -s openssh-server 2>&1 | /bin/grep -E '(Status:|not installed)'" expect : "^Status: install ok" type : CMD_EXEC description : "5.1.16 Ensure sshd MaxAuthTries is configured" 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. 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 MaxAuthTries parameter to 4 or less above any Include and Match entries as follows: MaxAuthTries 3 Note: First occurrence of an option takes precedence, Match set statements withstanding. If Include locations are enabled, used, and order of precedence is understood in your environment, the entry may be created in a file in Include location." reference : "800-171|3.3.1,800-171|3.3.2,800-171|3.3.6,800-171r3|03.03.02a.,800-171r3|03.03.02b.,800-171r3|03.03.03,800-171r3|03.03.06a.,800-53|AU-3,800-53|AU-3(1),800-53|AU-7,800-53|AU-12,800-53r5|AU-3,800-53r5|AU-3(1),800-53r5|AU-7,800-53r5|AU-12,CN-L3|7.1.2.3(a),CN-L3|7.1.2.3(b),CN-L3|7.1.2.3(c),CN-L3|7.1.3.3(a),CN-L3|7.1.3.3(b),CN-L3|8.1.4.3(b),CSCv7|16.13,CSCv8|8.5,CSF|DE.CM-1,CSF|DE.CM-3,CSF|DE.CM-7,CSF|PR.PT-1,CSF|RS.AN-3,CSF2.0|DE.CM-01,CSF2.0|DE.CM-03,CSF2.0|DE.CM-09,CSF2.0|PR.PS-04,CSF2.0|RS.AN-03,CSF2.0|RS.AN-06,CSF2.0|RS.AN-07,GDPR|32.1.b,HIPAA|164.306(a)(1),HIPAA|164.312(b),ISO-27001-2022|A.5.28,ISO-27001-2022|A.8.15,ITSG-33|AU-3,ITSG-33|AU-3(1),ITSG-33|AU-7,ITSG-33|AU-12,LEVEL|1A,NESA|T3.6.2,NIAv2|AM34a,NIAv2|AM34b,NIAv2|AM34c,NIAv2|AM34d,NIAv2|AM34e,NIAv2|AM34f,NIAv2|AM34g,PCI-DSSv3.2.1|10.1,PCI-DSSv3.2.1|10.3,PCI-DSSv3.2.1|10.3.1,PCI-DSSv3.2.1|10.3.2,PCI-DSSv3.2.1|10.3.3,PCI-DSSv3.2.1|10.3.4,PCI-DSSv3.2.1|10.3.5,PCI-DSSv3.2.1|10.3.6,PCI-DSSv4.0|10.2.2,QCSC-v1|3.2,QCSC-v1|6.2,QCSC-v1|8.2.1,QCSC-v1|10.2.1,QCSC-v1|11.2,QCSC-v1|13.2,SWIFT-CSCv1|6.4" see_also : "https://workbench.cisecurity.org/benchmarks/20333" cmd : "#!/bin/bash { ports=$(/bin/grep -s -P \"^(Port|Match)\" /etc/ssh/sshd_config /etc/ssh/sshd_config.d/*.conf | /bin/grep -P -o \"(Port|LocalPort)[\\s]+[\\d]+\" | /bin/awk '{print $2}; END {if (NR == 0) print \"22\"}' | /bin/uniq); for port in ${ports[@]}; do /sbin/sshd -T -C user=root -C host=\"$(hostname)\" -C addr=\"$(/bin/grep $(hostname) /etc/hosts | /bin/awk '{print $1}')\" -C lport=$port | echo \"port $port: $(/bin/grep -i ^maxauthtries)\"; done | /bin/awk 'BEGIN {f=0} /maxauthtries/i { if ($NF !~ /^[0-4]$/) f++; print $0} END {if (NR == 0) print \"Fail: no results returned\"; else if (f > 0) print \"Fail\"; else print \"Pass\" }' }" expect : "^Pass$" description : "5.1.16 Ensure sshd MaxAuthTries is configured" 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. 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 MaxAuthTries parameter to 4 or less above any Include and Match entries as follows: MaxAuthTries 3 Note: First occurrence of an option takes precedence, Match set statements withstanding. If Include locations are enabled, used, and order of precedence is understood in your environment, the entry may be created in a file in Include location." reference : "800-171|3.3.1,800-171|3.3.2,800-171|3.3.6,800-171r3|03.03.02a.,800-171r3|03.03.02b.,800-171r3|03.03.03,800-171r3|03.03.06a.,800-53|AU-3,800-53|AU-3(1),800-53|AU-7,800-53|AU-12,800-53r5|AU-3,800-53r5|AU-3(1),800-53r5|AU-7,800-53r5|AU-12,CN-L3|7.1.2.3(a),CN-L3|7.1.2.3(b),CN-L3|7.1.2.3(c),CN-L3|7.1.3.3(a),CN-L3|7.1.3.3(b),CN-L3|8.1.4.3(b),CSCv7|16.13,CSCv8|8.5,CSF|DE.CM-1,CSF|DE.CM-3,CSF|DE.CM-7,CSF|PR.PT-1,CSF|RS.AN-3,CSF2.0|DE.CM-01,CSF2.0|DE.CM-03,CSF2.0|DE.CM-09,CSF2.0|PR.PS-04,CSF2.0|RS.AN-03,CSF2.0|RS.AN-06,CSF2.0|RS.AN-07,GDPR|32.1.b,HIPAA|164.306(a)(1),HIPAA|164.312(b),ISO-27001-2022|A.5.28,ISO-27001-2022|A.8.15,ITSG-33|AU-3,ITSG-33|AU-3(1),ITSG-33|AU-7,ITSG-33|AU-12,LEVEL|1A,NESA|T3.6.2,NIAv2|AM34a,NIAv2|AM34b,NIAv2|AM34c,NIAv2|AM34d,NIAv2|AM34e,NIAv2|AM34f,NIAv2|AM34g,PCI-DSSv3.2.1|10.1,PCI-DSSv3.2.1|10.3,PCI-DSSv3.2.1|10.3.1,PCI-DSSv3.2.1|10.3.2,PCI-DSSv3.2.1|10.3.3,PCI-DSSv3.2.1|10.3.4,PCI-DSSv3.2.1|10.3.5,PCI-DSSv3.2.1|10.3.6,PCI-DSSv4.0|10.2.2,QCSC-v1|3.2,QCSC-v1|6.2,QCSC-v1|8.2.1,QCSC-v1|10.2.1,QCSC-v1|11.2,QCSC-v1|13.2,SWIFT-CSCv1|6.4" see_also : "https://workbench.cisecurity.org/benchmarks/20333" type : CMD_EXEC description : "openssh-server is installed" cmd : "/bin/dpkg -s openssh-server 2>&1 | /bin/grep -E '(Status:|not installed)'" expect : "^Status: install ok" type : CMD_EXEC description : "5.1.17 Ensure sshd MaxStartups is configured" info : "The MaxStartups parameter specifies the maximum number of concurrent unauthenticated connections to the SSH daemon. 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 MaxStartups parameter to 10:30:60 or more restrictive above any Include entries as follows: MaxStartups 10:30:60 Note: First occurrence of a option takes precedence. If Include locations are enabled, used, and order of precedence is understood in your environment, the entry may be created in a file in Include location." reference : "800-53|AC-10,800-53r5|AC-10,CSF2.0|PR.AA-05,GDPR|32.1.b,HIPAA|164.306(a)(1),ITSG-33|AC-10,LEVEL|1A,NESA|T5.5.1,QCSC-v1|5.2.1,QCSC-v1|5.2.2" see_also : "https://workbench.cisecurity.org/benchmarks/20333" cmd : "#!/bin/bash { ports=$(/bin/grep -s -P \"^(Port|Match)\" /etc/ssh/sshd_config /etc/ssh/sshd_config.d/*.conf | /bin/grep -P -o \"(Port|LocalPort)[\\s]+[\\d]+\" | /bin/awk '{print $2}; END {if (NR == 0) print \"22\"}' | /bin/uniq); for port in ${ports[@]}; do /sbin/sshd -T -C user=root -C host=\"$(hostname)\" -C addr=\"$(/bin/grep $(hostname) /etc/hosts | /bin/awk '{print $1}')\" -C lport=$port | echo \"port $port: $(/bin/grep -i ^maxstartups)\"; done | /bin/awk 'BEGIN {f=0} /maxstartups/i { if ($NF !~ /^([1-9]|10):([1-9]|[12][0-9]|30):([1-9]|[1-5][0-9]|60)$/) f++; print $0} END {if (NR == 0) print \"Fail: no results returned\"; else if (f > 0) print \"Fail\"; else print \"Pass\" }' }" expect : "^Pass$" description : "5.1.17 Ensure sshd MaxStartups is configured" info : "The MaxStartups parameter specifies the maximum number of concurrent unauthenticated connections to the SSH daemon. 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 MaxStartups parameter to 10:30:60 or more restrictive above any Include entries as follows: MaxStartups 10:30:60 Note: First occurrence of a option takes precedence. If Include locations are enabled, used, and order of precedence is understood in your environment, the entry may be created in a file in Include location." reference : "800-53|AC-10,800-53r5|AC-10,CSF2.0|PR.AA-05,GDPR|32.1.b,HIPAA|164.306(a)(1),ITSG-33|AC-10,LEVEL|1A,NESA|T5.5.1,QCSC-v1|5.2.1,QCSC-v1|5.2.2" see_also : "https://workbench.cisecurity.org/benchmarks/20333" type : CMD_EXEC description : "openssh-server is installed" cmd : "/bin/dpkg -s openssh-server 2>&1 | /bin/grep -E '(Status:|not installed)'" expect : "^Status: install ok" type : FILE_CONTENT_CHECK_NOT description : "config file MaxSessions setting" file : "/etc/ssh/sshd_config /etc/ssh/sshd_config.d/*.conf" regex : "^[\\s]*(?i)MaxSessions(?-i)[\\s]" expect : "^[\\s]*(?i)MaxSessions(?-i)[\\s]+\"?(1[1-9]|[2-9][0-9]|[1-9][0-9][0-9]+)\"?[\\s]*$" type : CMD_EXEC description : "sshd maxsessions setting" cmd : "#!/bin/bash { ports=$(/bin/grep -s -P \"^(Port|Match)\" /etc/ssh/sshd_config /etc/ssh/sshd_config.d/*.conf | /bin/grep -P -o \"(Port|LocalPort)[\\s]+[\\d]+\" | /bin/awk '{print $2}; END {if (NR == 0) print \"22\"}' | /bin/uniq); for port in ${ports[@]}; do /sbin/sshd -T -C user=root -C host=\"$(hostname)\" -C addr=\"$(/bin/grep $(hostname) /etc/hosts | /bin/awk '{print $1}')\" -C lport=$port | echo \"port $port: $(/bin/grep -i ^maxsessions)\"; done | /bin/awk 'BEGIN {f=0} /maxsessions/i { if ($NF !~ /^([0-9]|10)$/) f++; print $0} END {if (NR == 0) print \"Fail: no results returned\"; else if (f > 0) print \"Fail\"; else print \"Pass\" }' }" expect : "^Pass$" description : "5.1.18 Ensure sshd MaxSessions is configured" info : "The MaxSessions parameter specifies the maximum number of open sessions permitted from a given connection. 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 MaxSessions parameter to 10 or less above any Include and Match entries as follows: MaxSessions 10 Note: First occurrence of an option takes precedence, Match set statements withstanding. If Include locations are enabled, used, and order of precedence is understood in your environment, the entry may be created in a file in Include location." reference : "800-53|AC-10,800-53r5|AC-10,CSF2.0|PR.AA-05,GDPR|32.1.b,HIPAA|164.306(a)(1),ITSG-33|AC-10,LEVEL|1A,NESA|T5.5.1,QCSC-v1|5.2.1,QCSC-v1|5.2.2" see_also : "https://workbench.cisecurity.org/benchmarks/20333" show_output : YES description : "5.1.18 Ensure sshd MaxSessions is configured" info : "The MaxSessions parameter specifies the maximum number of open sessions permitted from a given connection. 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 MaxSessions parameter to 10 or less above any Include and Match entries as follows: MaxSessions 10 Note: First occurrence of an option takes precedence, Match set statements withstanding. If Include locations are enabled, used, and order of precedence is understood in your environment, the entry may be created in a file in Include location." reference : "800-53|AC-10,800-53r5|AC-10,CSF2.0|PR.AA-05,GDPR|32.1.b,HIPAA|164.306(a)(1),ITSG-33|AC-10,LEVEL|1A,NESA|T5.5.1,QCSC-v1|5.2.1,QCSC-v1|5.2.2" see_also : "https://workbench.cisecurity.org/benchmarks/20333" type : CMD_EXEC description : "openssh-server is installed" cmd : "/bin/dpkg -s openssh-server 2>&1 | /bin/grep -E '(Status:|not installed)'" expect : "^Status: install ok" type : CMD_EXEC description : "5.1.19 Ensure sshd PermitEmptyPasswords is disabled" info : "The PermitEmptyPasswords parameter specifies if the SSH server allows login to accounts with empty password strings. Disallowing remote shell access to accounts that have an empty password reduces the probability of unauthorized access to the system." solution : "Edit /etc/ssh/sshd_config and set the PermitEmptyPasswords parameter to no above any Include and Match entries as follows: PermitEmptyPasswords no Note: First occurrence of an option takes precedence, Match set statements withstanding. If Include locations are enabled, used, and order of precedence is understood in your environment, the entry may be created in a file in Include location." reference : "800-171|3.5.2,800-171r3|03.05.07,800-53|IA-5(1),800-53r5|IA-5(1),CSCv7|4.4,CSCv8|5.2,CSF|PR.AC-1,CSF2.0|PR.AA-01,CSF2.0|PR.AA-03,GDPR|32.1.b,HIPAA|164.306(a)(1),HIPAA|164.312(a)(2)(i),HIPAA|164.312(d),ISO-27001-2022|A.5.16,ISO-27001-2022|A.5.17,ITSG-33|IA-5(1),LEVEL|1A,NESA|T5.2.3,QCSC-v1|5.2.2,QCSC-v1|13.2,SWIFT-CSCv1|4.1" see_also : "https://workbench.cisecurity.org/benchmarks/20333" cmd : "#!/bin/bash { ports=$(/bin/grep -s -P \"^(Port|Match)\" /etc/ssh/sshd_config /etc/ssh/sshd_config.d/*.conf | /bin/grep -P -o \"(Port|LocalPort)[\\s]+[\\d]+\" | /bin/awk '{print $2}; END {if (NR == 0) print \"22\"}' | /bin/uniq); for port in ${ports[@]}; do /sbin/sshd -T -C user=root -C host=\"$(hostname)\" -C addr=\"$(/bin/grep $(hostname) /etc/hosts | /bin/awk '{print $1}')\" -C lport=$port | echo \"port $port: $(/bin/grep -i ^PermitEmptyPasswords)\"; done | /bin/awk 'BEGIN {f=0} /PermitEmptyPasswords/i { if ($NF == \"yes\") f++; print $0} END {if (NR == 0) print \"Fail: no results returned\"; else if (f > 0) print \"Fail\"; else print \"Pass\" }' }" expect : "^Pass$" description : "5.1.19 Ensure sshd PermitEmptyPasswords is disabled" info : "The PermitEmptyPasswords parameter specifies if the SSH server allows login to accounts with empty password strings. Disallowing remote shell access to accounts that have an empty password reduces the probability of unauthorized access to the system." solution : "Edit /etc/ssh/sshd_config and set the PermitEmptyPasswords parameter to no above any Include and Match entries as follows: PermitEmptyPasswords no Note: First occurrence of an option takes precedence, Match set statements withstanding. If Include locations are enabled, used, and order of precedence is understood in your environment, the entry may be created in a file in Include location." reference : "800-171|3.5.2,800-171r3|03.05.07,800-53|IA-5(1),800-53r5|IA-5(1),CSCv7|4.4,CSCv8|5.2,CSF|PR.AC-1,CSF2.0|PR.AA-01,CSF2.0|PR.AA-03,GDPR|32.1.b,HIPAA|164.306(a)(1),HIPAA|164.312(a)(2)(i),HIPAA|164.312(d),ISO-27001-2022|A.5.16,ISO-27001-2022|A.5.17,ITSG-33|IA-5(1),LEVEL|1A,NESA|T5.2.3,QCSC-v1|5.2.2,QCSC-v1|13.2,SWIFT-CSCv1|4.1" see_also : "https://workbench.cisecurity.org/benchmarks/20333" type : CMD_EXEC description : "openssh-server is installed" cmd : "/bin/dpkg -s openssh-server 2>&1 | /bin/grep -E '(Status:|not installed)'" expect : "^Status: install ok" type : CMD_EXEC description : "5.1.2 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. If an unauthorized user obtains the private SSH host key file, the host could be impersonated" solution : "Run the following script to set mode, ownership, and group on the private SSH host key files: #!/usr/bin/env bash { a_output=(); a_output2=(); l_ssh_group_name=\"$(awk -F: '($1 ~ /^(ssh_keys|_?ssh)$/) {print $1}' /etc/group)\" f_file_access_fix() { while IFS=: read -r l_file_mode l_file_owner l_file_group; do a_out2=() [ \"$l_file_group\" = \"$l_ssh_group_name\" ] && l_pmask=\"0137\" || l_pmask=\"0177\" l_maxperm=\"$( printf '%o' $(( 0777 & ~$l_pmask )) )\" if [ $(( $l_file_mode & $l_pmask )) -gt 0 ]; then a_out2+=(\" Mode: \\\"$l_file_mode\\\" should be mode: \\\"$l_maxperm\\\" or more restrictive\" \ \" updating to mode: \:$l_maxperm\\\"\") if [ \"l_file_group\" = \"$l_ssh_group_name\" ]; then chmod u-x,g-wx,o-rwx \"$l_file\" else chmod u-x,go-rwx \"$l_file\" fi fi if [ \"$l_file_owner\" != \"root\" ]; then a_out2+=(\" Owned by: \\\"$l_file_owner\\\" should be owned by \\\"root\\\"\" \ \" Changing ownership to \\\"root\\\"\") chown root \"$l_file\" fi if [[ ! \"$l_file_group\" =~ ($l_ssh_group_name|root) ]]; then [ -n \"$l_ssh_group_name\" ] && l_new_group=\"$l_ssh_group_name\" || l_new_group=\"root\" a_out2+=(\" Owned by group \\\"$l_file_group\\\" should be group owned by: \\\"$l_ssh_group_name\\\" or \\\"root\\\"\" \ \" Changing group ownership to \\\"$l_new_group\\\"\") chgrp \"$l_new_group\" \"$l_file\" fi if [ \"${#a_out2[@]}\" -gt \"0\" ]; then a_output2+=(\" - File: \\\"$l_file\\\"\" \"${a_out2[@]}\") else a_output+=(\" - File: \\\"$l_file\\\"\" \ \"Correct: mode: \\\"$l_file_mode\\\", owner: \\\"$l_file_owner\\\", and group owner: \\\"$l_file_group\\\" configured\") fi done < <(stat -Lc '%#a:%U:%G' \"$l_file\") } while IFS= read -r -d $'\0' l_file; do if ssh-keygen -lf &>/dev/null \"$l_file\"; then file \"$l_file\" | grep -Piq -- '\bopenssh\h+([^#\n\r]+\h+)?private\h+key\b' && f_file_access_fix fi done < <(find -L /etc/ssh -xdev -type f -print0 2>/dev/null) if [ \"${#a_output2[@]}\" -le \"0\" ]; then printf '%s\n' \"\" \" - No access changes required\" \"\" else printf '%s\n' \"\" \" - Remediation results:\" \"${a_output2[@]}\" \"\" fi }" reference : "800-171|3.1.1,800-171|3.1.4,800-171|3.1.5,800-171|3.8.1,800-171|3.8.2,800-171|3.8.3,800-171r3|03.01.02,800-171r3|03.01.04,800-171r3|03.01.05a.,800-171r3|03.08.02,800-53|AC-3,800-53|AC-5,800-53|AC-6,800-53|MP-2,800-53r5|AC-3,800-53r5|AC-5,800-53r5|AC-6,800-53r5|MP-2,CN-L3|7.1.3.2(b),CN-L3|7.1.3.2(g),CN-L3|8.1.4.2(d),CN-L3|8.1.4.2(f),CN-L3|8.1.4.11(b),CN-L3|8.1.10.2(c),CN-L3|8.1.10.6(a),CN-L3|8.5.3.1,CN-L3|8.5.4.1(a),CSCv7|14.6,CSCv8|3.3,CSF|PR.AC-4,CSF|PR.DS-5,CSF|PR.PT-2,CSF|PR.PT-3,CSF2.0|PR.AA-05,CSF2.0|PR.DS-10,CSF2.0|PR.IR-01,GDPR|32.1.b,HIPAA|164.306(a)(1),HIPAA|164.312(a)(1),ISO-27001-2022|A.5.3,ISO-27001-2022|A.5.10,ISO-27001-2022|A.5.15,ISO-27001-2022|A.5.33,ISO-27001-2022|A.7.7,ISO-27001-2022|A.7.10,ISO-27001-2022|A.8.2,ISO-27001-2022|A.8.3,ISO-27001-2022|A.8.18,ISO-27001-2022|A.8.20,ISO/IEC-27001|A.6.1.2,ISO/IEC-27001|A.9.4.1,ISO/IEC-27001|A.9.4.5,ITSG-33|AC-3,ITSG-33|AC-5,ITSG-33|AC-6,ITSG-33|MP-2,ITSG-33|MP-2a.,LEVEL|1A,NESA|T1.3.2,NESA|T1.3.3,NESA|T1.4.1,NESA|T4.2.1,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.2,NESA|T7.5.3,NIAv2|AM1,NIAv2|AM3,NIAv2|AM23f,NIAv2|SS13c,NIAv2|SS15c,NIAv2|SS29,PCI-DSSv3.2.1|7.1.2,PCI-DSSv4.0|7.2.1,PCI-DSSv4.0|7.2.2,QCSC-v1|3.2,QCSC-v1|5.2.2,QCSC-v1|6.2,QCSC-v1|13.2,SWIFT-CSCv1|5.1,TBA-FIISB|31.1,TBA-FIISB|31.4.2,TBA-FIISB|31.4.3" see_also : "https://workbench.cisecurity.org/benchmarks/20333" cmd : "#!/bin/bash { a_output=(); a_output2=() l_ssh_group_name=\"$(awk -F: '($1 ~ /^(ssh_keys|_?ssh)$/) {print $1}' /etc/group)\" f_file_chk() { while IFS=: read -r l_file_mode l_file_owner l_file_group; do a_out2=() [ \"$l_file_group\" = \"$l_ssh_group_name\" ] && l_pmask=\"0137\" || l_pmask=\"0177\" l_maxperm=\"$( printf '%o' $(( 0777 & ~$l_pmask )) )\" if [ $(( $l_file_mode & $l_pmask )) -gt 0 ]; then a_out2+=(\" Mode: \\\"$l_file_mode\\\" should be mode: \\\"$l_maxperm\\\" or more restrictive\") fi if [ \"$l_file_owner\" != \"root\" ]; then a_out2+=(\" Owned by: \\\"$l_file_owner\\\" should be owned by \\\"root\\\"\") fi if [[ ! \"$l_file_group\" =~ ($l_ssh_group_name|root) ]]; then a_out2+=(\" Owned by group \\\"$l_file_group\\\" should be group owned by: \\\"$l_ssh_group_name\\\" or \\\"root\\\"\") fi if [ \"${#a_out2[@]}\" -gt \"0\" ]; then a_output2+=(\" - File: \\\"$l_file\\\"${a_out2[@]}\") else a_output+=(\" - File: \\\"$l_file\\\"\" \\ \" Correct: mode: \\\"$l_file_mode\\\", owner: \\\"$l_file_owner\\\" and group owner: \\\"$l_file_group\\\" configured\") fi done < <(stat -Lc '%#a:%U:%G' \"$l_file\") } while IFS= read -r -d $'\\0' l_file; do if ssh-keygen -lf &>/dev/null \"$l_file\"; then file \"$l_file\" | grep -Piq -- '\\bopenssh\\h+([^#\\n\\r]+\\h+)?private\\h+key\\b' && f_file_chk fi done < <(find -L /etc/ssh -xdev -type f -print0 2>/dev/null) if [ \"${#a_output2[@]}\" -le 0 ]; then printf '%s\\n' \"\" \"- Audit Result:\" \" ** PASS **\" \"${a_output[@]}\" \"\" else printf '%s\\n' \"\" \"- Audit Result:\" \" ** FAIL **\" \" - Reason(s) for audit failure:\" \"${a_output2[@]}\" [ \"${#a_output[@]}\" -gt 0 ] && printf '%s\\n' \"\" \"- Correctly set:\" \"${a_output[@]}\" \"\" fi }" expect : "(?i)^[\\s]*\\**[\\s]*pass:?[\\s]*\\**$" description : "5.1.2 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. If an unauthorized user obtains the private SSH host key file, the host could be impersonated" solution : "Run the following script to set mode, ownership, and group on the private SSH host key files: #!/usr/bin/env bash { a_output=(); a_output2=(); l_ssh_group_name=\"$(awk -F: '($1 ~ /^(ssh_keys|_?ssh)$/) {print $1}' /etc/group)\" f_file_access_fix() { while IFS=: read -r l_file_mode l_file_owner l_file_group; do a_out2=() [ \"$l_file_group\" = \"$l_ssh_group_name\" ] && l_pmask=\"0137\" || l_pmask=\"0177\" l_maxperm=\"$( printf '%o' $(( 0777 & ~$l_pmask )) )\" if [ $(( $l_file_mode & $l_pmask )) -gt 0 ]; then a_out2+=(\" Mode: \\\"$l_file_mode\\\" should be mode: \\\"$l_maxperm\\\" or more restrictive\" \ \" updating to mode: \:$l_maxperm\\\"\") if [ \"l_file_group\" = \"$l_ssh_group_name\" ]; then chmod u-x,g-wx,o-rwx \"$l_file\" else chmod u-x,go-rwx \"$l_file\" fi fi if [ \"$l_file_owner\" != \"root\" ]; then a_out2+=(\" Owned by: \\\"$l_file_owner\\\" should be owned by \\\"root\\\"\" \ \" Changing ownership to \\\"root\\\"\") chown root \"$l_file\" fi if [[ ! \"$l_file_group\" =~ ($l_ssh_group_name|root) ]]; then [ -n \"$l_ssh_group_name\" ] && l_new_group=\"$l_ssh_group_name\" || l_new_group=\"root\" a_out2+=(\" Owned by group \\\"$l_file_group\\\" should be group owned by: \\\"$l_ssh_group_name\\\" or \\\"root\\\"\" \ \" Changing group ownership to \\\"$l_new_group\\\"\") chgrp \"$l_new_group\" \"$l_file\" fi if [ \"${#a_out2[@]}\" -gt \"0\" ]; then a_output2+=(\" - File: \\\"$l_file\\\"\" \"${a_out2[@]}\") else a_output+=(\" - File: \\\"$l_file\\\"\" \ \"Correct: mode: \\\"$l_file_mode\\\", owner: \\\"$l_file_owner\\\", and group owner: \\\"$l_file_group\\\" configured\") fi done < <(stat -Lc '%#a:%U:%G' \"$l_file\") } while IFS= read -r -d $'\0' l_file; do if ssh-keygen -lf &>/dev/null \"$l_file\"; then file \"$l_file\" | grep -Piq -- '\bopenssh\h+([^#\n\r]+\h+)?private\h+key\b' && f_file_access_fix fi done < <(find -L /etc/ssh -xdev -type f -print0 2>/dev/null) if [ \"${#a_output2[@]}\" -le \"0\" ]; then printf '%s\n' \"\" \" - No access changes required\" \"\" else printf '%s\n' \"\" \" - Remediation results:\" \"${a_output2[@]}\" \"\" fi }" reference : "800-171|3.1.1,800-171|3.1.4,800-171|3.1.5,800-171|3.8.1,800-171|3.8.2,800-171|3.8.3,800-171r3|03.01.02,800-171r3|03.01.04,800-171r3|03.01.05a.,800-171r3|03.08.02,800-53|AC-3,800-53|AC-5,800-53|AC-6,800-53|MP-2,800-53r5|AC-3,800-53r5|AC-5,800-53r5|AC-6,800-53r5|MP-2,CN-L3|7.1.3.2(b),CN-L3|7.1.3.2(g),CN-L3|8.1.4.2(d),CN-L3|8.1.4.2(f),CN-L3|8.1.4.11(b),CN-L3|8.1.10.2(c),CN-L3|8.1.10.6(a),CN-L3|8.5.3.1,CN-L3|8.5.4.1(a),CSCv7|14.6,CSCv8|3.3,CSF|PR.AC-4,CSF|PR.DS-5,CSF|PR.PT-2,CSF|PR.PT-3,CSF2.0|PR.AA-05,CSF2.0|PR.DS-10,CSF2.0|PR.IR-01,GDPR|32.1.b,HIPAA|164.306(a)(1),HIPAA|164.312(a)(1),ISO-27001-2022|A.5.3,ISO-27001-2022|A.5.10,ISO-27001-2022|A.5.15,ISO-27001-2022|A.5.33,ISO-27001-2022|A.7.7,ISO-27001-2022|A.7.10,ISO-27001-2022|A.8.2,ISO-27001-2022|A.8.3,ISO-27001-2022|A.8.18,ISO-27001-2022|A.8.20,ISO/IEC-27001|A.6.1.2,ISO/IEC-27001|A.9.4.1,ISO/IEC-27001|A.9.4.5,ITSG-33|AC-3,ITSG-33|AC-5,ITSG-33|AC-6,ITSG-33|MP-2,ITSG-33|MP-2a.,LEVEL|1A,NESA|T1.3.2,NESA|T1.3.3,NESA|T1.4.1,NESA|T4.2.1,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.2,NESA|T7.5.3,NIAv2|AM1,NIAv2|AM3,NIAv2|AM23f,NIAv2|SS13c,NIAv2|SS15c,NIAv2|SS29,PCI-DSSv3.2.1|7.1.2,PCI-DSSv4.0|7.2.1,PCI-DSSv4.0|7.2.2,QCSC-v1|3.2,QCSC-v1|5.2.2,QCSC-v1|6.2,QCSC-v1|13.2,SWIFT-CSCv1|5.1,TBA-FIISB|31.1,TBA-FIISB|31.4.2,TBA-FIISB|31.4.3" see_also : "https://workbench.cisecurity.org/benchmarks/20333" type : CMD_EXEC description : "openssh-server is installed" cmd : "/bin/dpkg -s openssh-server 2>&1 | /bin/grep -E '(Status:|not installed)'" expect : "^Status: install ok" type : CMD_EXEC description : "5.1.20 Ensure sshd PermitRootLogin is disabled" info : "The PermitRootLogin parameter specifies if the root user can log in using SSH. The default is prohibit-password Disallowing root logins over SSH requires system admins to authenticate using their own individual account, then escalating to root This 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 PermitRootLogin parameter to no above any Include and Match entries as follows: PermitRootLogin no Note: First occurrence of an option takes precedence, Match set statements withstanding. If Include locations are enabled, used, and order of precedence is understood in your environment, the entry may be created in a file in Include location." reference : "800-171|3.1.5,800-171|3.1.6,800-171r3|03.01.06a.,800-171r3|03.01.06b.,800-53|AC-6(2),800-53|AC-6(5),800-53r5|AC-6(2),800-53r5|AC-6(5),CN-L3|7.1.3.2(b),CN-L3|7.1.3.2(g),CN-L3|8.1.4.2(d),CN-L3|8.1.10.6(a),CSCv7|4.3,CSCv8|5.4,CSF|PR.AC-4,CSF2.0|PR.AA-05,GDPR|32.1.b,HIPAA|164.306(a)(1),HIPAA|164.312(a)(1),ISO-27001-2022|A.5.15,ISO-27001-2022|A.8.2,ISO-27001-2022|A.8.18,ISO/IEC-27001|A.9.2.3,ITSG-33|AC-6(2),ITSG-33|AC-6(5),LEVEL|1A,NESA|T5.1.1,NESA|T5.2.2,NESA|T5.6.1,NIAv2|AM1,NIAv2|AM23f,NIAv2|AM32,NIAv2|AM33,NIAv2|SS13c,NIAv2|SS15c,NIAv2|VL3a,PCI-DSSv3.2.1|7.1.2,PCI-DSSv4.0|7.2.1,PCI-DSSv4.0|7.2.2,QCSC-v1|5.2.2,QCSC-v1|6.2,SWIFT-CSCv1|1.2,SWIFT-CSCv1|5.1,TBA-FIISB|31.4.2,TBA-FIISB|31.4.3" see_also : "https://workbench.cisecurity.org/benchmarks/20333" cmd : "#!/bin/bash { ports=$(/bin/grep -s -P \"^(Port|Match)\" /etc/ssh/sshd_config /etc/ssh/sshd_config.d/*.conf | /bin/grep -P -o \"(Port|LocalPort)[\\s]+[\\d]+\" | /bin/awk '{print $2}; END {if (NR == 0) print \"22\"}' | /bin/uniq); for port in ${ports[@]}; do /sbin/sshd -T -C user=root -C host=\"$(hostname)\" -C addr=\"$(/bin/grep $(hostname) /etc/hosts | /bin/awk '{print $1}')\" -C lport=$port | echo \"port $port: $(/bin/grep -i ^permitrootlogin)\"; done | /bin/awk 'BEGIN {f=0} /permitrootlogin/i { if ($NF != \"no\") f++; print $0} END {if (NR == 0) print \"Fail: no results returned\"; else if (f > 0) print \"Fail\"; else print \"Pass\"}' }" expect : "^Pass$" description : "5.1.20 Ensure sshd PermitRootLogin is disabled" info : "The PermitRootLogin parameter specifies if the root user can log in using SSH. The default is prohibit-password Disallowing root logins over SSH requires system admins to authenticate using their own individual account, then escalating to root This 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 PermitRootLogin parameter to no above any Include and Match entries as follows: PermitRootLogin no Note: First occurrence of an option takes precedence, Match set statements withstanding. If Include locations are enabled, used, and order of precedence is understood in your environment, the entry may be created in a file in Include location." reference : "800-171|3.1.5,800-171|3.1.6,800-171r3|03.01.06a.,800-171r3|03.01.06b.,800-53|AC-6(2),800-53|AC-6(5),800-53r5|AC-6(2),800-53r5|AC-6(5),CN-L3|7.1.3.2(b),CN-L3|7.1.3.2(g),CN-L3|8.1.4.2(d),CN-L3|8.1.10.6(a),CSCv7|4.3,CSCv8|5.4,CSF|PR.AC-4,CSF2.0|PR.AA-05,GDPR|32.1.b,HIPAA|164.306(a)(1),HIPAA|164.312(a)(1),ISO-27001-2022|A.5.15,ISO-27001-2022|A.8.2,ISO-27001-2022|A.8.18,ISO/IEC-27001|A.9.2.3,ITSG-33|AC-6(2),ITSG-33|AC-6(5),LEVEL|1A,NESA|T5.1.1,NESA|T5.2.2,NESA|T5.6.1,NIAv2|AM1,NIAv2|AM23f,NIAv2|AM32,NIAv2|AM33,NIAv2|SS13c,NIAv2|SS15c,NIAv2|VL3a,PCI-DSSv3.2.1|7.1.2,PCI-DSSv4.0|7.2.1,PCI-DSSv4.0|7.2.2,QCSC-v1|5.2.2,QCSC-v1|6.2,SWIFT-CSCv1|1.2,SWIFT-CSCv1|5.1,TBA-FIISB|31.4.2,TBA-FIISB|31.4.3" see_also : "https://workbench.cisecurity.org/benchmarks/20333" type : CMD_EXEC description : "openssh-server is installed" cmd : "/bin/dpkg -s openssh-server 2>&1 | /bin/grep -E '(Status:|not installed)'" expect : "^Status: install ok" type : CMD_EXEC description : "5.1.21 Ensure sshd PermitUserEnvironment is disabled" info : "The PermitUserEnvironment option allows users to present environment options to the SSH daemon. 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 PermitUserEnvironment parameter to no above any Include entries as follows: PermitUserEnvironment no Note: First occurrence of an option takes precedence. If Include locations are enabled, used, and order of precedence is understood in your environment, the entry may be created in a file in Include location." reference : "800-171|3.4.6,800-171|3.4.7,800-171r3|03.04.06b.,800-53|CM-7b.,800-53r5|CM-7b.,CN-L3|7.1.3.5(c),CN-L3|7.1.3.7(d),CN-L3|8.1.4.4(b),CSF|PR.IP-1,CSF|PR.PT-3,CSF2.0|PR.PS-01,GDPR|32.1.b,HIPAA|164.306(a)(1),ITSG-33|CM-7a.,LEVEL|1A,NIAv2|SS13b,NIAv2|SS14a,NIAv2|SS14c,PCI-DSSv3.2.1|2.2.2,PCI-DSSv4.0|2.2.4,QCSC-v1|3.2,SWIFT-CSCv1|2.3" see_also : "https://workbench.cisecurity.org/benchmarks/20333" cmd : "#!/bin/bash { ports=$(/bin/grep -s -P \"^(Port|Match)\" /etc/ssh/sshd_config /etc/ssh/sshd_config.d/*.conf | /bin/grep -P -o \"(Port|LocalPort)[\\s]+[\\d]+\" | /bin/awk '{print $2}; END {if (NR == 0) print \"22\"}' | /bin/uniq); for port in ${ports[@]}; do /sbin/sshd -T -C user=root -C host=\"$(hostname)\" -C addr=\"$(/bin/grep $(hostname) /etc/hosts | /bin/awk '{print $1}')\" -C lport=$port | echo \"port $port: $(/bin/grep -i ^permituserenvironment)\"; done | /bin/awk 'BEGIN {f=0} /permituserenvironment/i { if ($NF == \"yes\") f++; print $0} END {if (NR == 0) print \"Fail: no results returned\"; else if (f > 0) print \"Fail\"; else print \"Pass\" }' }" expect : "^Pass$" description : "5.1.21 Ensure sshd PermitUserEnvironment is disabled" info : "The PermitUserEnvironment option allows users to present environment options to the SSH daemon. 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 PermitUserEnvironment parameter to no above any Include entries as follows: PermitUserEnvironment no Note: First occurrence of an option takes precedence. If Include locations are enabled, used, and order of precedence is understood in your environment, the entry may be created in a file in Include location." reference : "800-171|3.4.6,800-171|3.4.7,800-171r3|03.04.06b.,800-53|CM-7b.,800-53r5|CM-7b.,CN-L3|7.1.3.5(c),CN-L3|7.1.3.7(d),CN-L3|8.1.4.4(b),CSF|PR.IP-1,CSF|PR.PT-3,CSF2.0|PR.PS-01,GDPR|32.1.b,HIPAA|164.306(a)(1),ITSG-33|CM-7a.,LEVEL|1A,NIAv2|SS13b,NIAv2|SS14a,NIAv2|SS14c,PCI-DSSv3.2.1|2.2.2,PCI-DSSv4.0|2.2.4,QCSC-v1|3.2,SWIFT-CSCv1|2.3" see_also : "https://workbench.cisecurity.org/benchmarks/20333" type : CMD_EXEC description : "openssh-server is installed" cmd : "/bin/dpkg -s openssh-server 2>&1 | /bin/grep -E '(Status:|not installed)'" expect : "^Status: install ok" type : CMD_EXEC description : "5.1.22 Ensure sshd UsePAM is enabled" info : "The UsePAM directive enables the Pluggable Authentication Module (PAM) interface. If set to yes this will enable PAM authentication using ChallengeResponseAuthentication and PasswordAuthentication directives in addition to PAM account and session module processing for all authentication types. 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 UsePAM parameter to yes above any Include entries as follows: UsePAM yes Note: First occurrence of an option takes precedence. If Include locations are enabled, used, and order of precedence is understood in your environment, the entry may be created in a file in Include location." reference : "800-171|3.5.2,800-171r3|03.05.07,800-53|IA-5(1),800-53r5|IA-5(1),CSCv7|4.4,CSCv8|5.2,CSF|PR.AC-1,CSF2.0|PR.AA-01,CSF2.0|PR.AA-03,GDPR|32.1.b,HIPAA|164.306(a)(1),HIPAA|164.312(a)(2)(i),HIPAA|164.312(d),ISO-27001-2022|A.5.16,ISO-27001-2022|A.5.17,ITSG-33|IA-5(1),LEVEL|1A,NESA|T5.2.3,QCSC-v1|5.2.2,QCSC-v1|13.2,SWIFT-CSCv1|4.1" see_also : "https://workbench.cisecurity.org/benchmarks/20333" cmd : "#!/bin/bash { ports=$(/bin/grep -s -P \"^(Port|Match)\" /etc/ssh/sshd_config /etc/ssh/sshd_config.d/*.conf | /bin/grep -P -o \"(Port|LocalPort)[\\s]+[\\d]+\" | /bin/awk '{print $2}; END {if (NR == 0) print \"22\"}' | /bin/uniq); for port in ${ports[@]}; do /sbin/sshd -T -C user=root -C host=\"$(hostname)\" -C addr=\"$(/bin/grep $(hostname) /etc/hosts | /bin/awk '{print $1}')\" -C lport=$port | echo \"port $port: $(/bin/grep -i ^usepam)\"; done | /bin/awk 'BEGIN {f=0} /usepam/i { if ($NF == \"no\") f++; print $0} END {if (NR == 0) print \"Fail: no results returned\"; else if (f > 0) print \"Fail\"; else print \"Pass\" }' }" expect : "^Pass$" description : "5.1.22 Ensure sshd UsePAM is enabled" info : "The UsePAM directive enables the Pluggable Authentication Module (PAM) interface. If set to yes this will enable PAM authentication using ChallengeResponseAuthentication and PasswordAuthentication directives in addition to PAM account and session module processing for all authentication types. 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 UsePAM parameter to yes above any Include entries as follows: UsePAM yes Note: First occurrence of an option takes precedence. If Include locations are enabled, used, and order of precedence is understood in your environment, the entry may be created in a file in Include location." reference : "800-171|3.5.2,800-171r3|03.05.07,800-53|IA-5(1),800-53r5|IA-5(1),CSCv7|4.4,CSCv8|5.2,CSF|PR.AC-1,CSF2.0|PR.AA-01,CSF2.0|PR.AA-03,GDPR|32.1.b,HIPAA|164.306(a)(1),HIPAA|164.312(a)(2)(i),HIPAA|164.312(d),ISO-27001-2022|A.5.16,ISO-27001-2022|A.5.17,ITSG-33|IA-5(1),LEVEL|1A,NESA|T5.2.3,QCSC-v1|5.2.2,QCSC-v1|13.2,SWIFT-CSCv1|4.1" see_also : "https://workbench.cisecurity.org/benchmarks/20333" type : CMD_EXEC description : "openssh-server is installed" cmd : "/bin/dpkg -s openssh-server 2>&1 | /bin/grep -E '(Status:|not installed)'" expect : "^Status: install ok" type : CMD_EXEC description : "5.1.3 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. If a public host key file is modified by an unauthorized user, the SSH service may be compromised." solution : "Run the following script to set mode, ownership, and group on the public SSH host key files: #!/usr/bin/env bash { a_output=(); a_output2=() l_pmask=\"0133\"; l_maxperm=\"$( printf '%o' $(( 0777 & ~$l_pmask )) )\" f_file_access_fix() { while IFS=: read -r l_file_mode l_file_owner l_file_group; do a_out2=() [ $(( $l_file_mode & $l_pmask )) -gt 0 ] && \ a_out2+=(\" Mode: \\\"$l_file_mode\\\" should be mode: \\\"$l_maxperm\\\" or more restrictive\" \ \" updating to mode: \\\"$l_maxperm\\\"\") && chmod u-x,go-wx \"$l_file\" [ \"$l_file_owner\" != \"root\" ] && \ a_out2+=(\" Owned by: \\\"$l_file_owner\\\" should be owned by \\\"root\\\"\" \ \" Changing ownership to \\\"root\\\"\") && chown root \"$l_file\" [ \"$l_file_group\" != \"root\" ] && \ a_out2+=(\" Owned by group \\\"$l_file_group\\\" should be group owned by: \\\"root\\\"\" \ \" Changing group ownership to \\\"root\\\"\") && chgrp root \"$l_file\" if [ \"${#a_out2[@]}\" -gt \"0\" ]; then a_output2+=(\" - File: \\\"$l_file\\\"\" \"${a_out2[@]}\") else a_output+=(\" - File: \\\"$l_file\\\"\" \ \" Correct: mode: \\\"$l_file_mode\\\", owner: \\\"$l_file_owner\\\", and group owner: \\\"$l_file_group\\\" configured\") fi done < <(stat -Lc '%#a:%U:%G' \"$l_file\") } while IFS= read -r -d $'\0' l_file; do if ssh-keygen -lf &>/dev/null \"$l_file\"; then file \"$l_file\" | grep -Piq -- '\bopenssh\h+([^#\n\r]+\h+)?public\h+key\b' && f_file_access_fix fi done < <(find -L /etc/ssh -xdev -type f -print0 2>/dev/null) if [ \"${#a_output2[@]}\" -le \"0\" ]; then printf '%s\n' \"\" \" - No access changes required\" \"\" else printf '%s\n' \" - Remediation results:\" \"${a_output2[@]}\" \"\" fi }" reference : "800-171|3.1.1,800-171|3.1.4,800-171|3.1.5,800-171|3.8.1,800-171|3.8.2,800-171|3.8.3,800-171r3|03.01.02,800-171r3|03.01.04,800-171r3|03.01.05a.,800-171r3|03.08.02,800-53|AC-3,800-53|AC-5,800-53|AC-6,800-53|MP-2,800-53r5|AC-3,800-53r5|AC-5,800-53r5|AC-6,800-53r5|MP-2,CN-L3|7.1.3.2(b),CN-L3|7.1.3.2(g),CN-L3|8.1.4.2(d),CN-L3|8.1.4.2(f),CN-L3|8.1.4.11(b),CN-L3|8.1.10.2(c),CN-L3|8.1.10.6(a),CN-L3|8.5.3.1,CN-L3|8.5.4.1(a),CSCv7|14.6,CSCv8|3.3,CSF|PR.AC-4,CSF|PR.DS-5,CSF|PR.PT-2,CSF|PR.PT-3,CSF2.0|PR.AA-05,CSF2.0|PR.DS-10,CSF2.0|PR.IR-01,GDPR|32.1.b,HIPAA|164.306(a)(1),HIPAA|164.312(a)(1),ISO-27001-2022|A.5.3,ISO-27001-2022|A.5.10,ISO-27001-2022|A.5.15,ISO-27001-2022|A.5.33,ISO-27001-2022|A.7.7,ISO-27001-2022|A.7.10,ISO-27001-2022|A.8.2,ISO-27001-2022|A.8.3,ISO-27001-2022|A.8.18,ISO-27001-2022|A.8.20,ISO/IEC-27001|A.6.1.2,ISO/IEC-27001|A.9.4.1,ISO/IEC-27001|A.9.4.5,ITSG-33|AC-3,ITSG-33|AC-5,ITSG-33|AC-6,ITSG-33|MP-2,ITSG-33|MP-2a.,LEVEL|1A,NESA|T1.3.2,NESA|T1.3.3,NESA|T1.4.1,NESA|T4.2.1,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.2,NESA|T7.5.3,NIAv2|AM1,NIAv2|AM3,NIAv2|AM23f,NIAv2|SS13c,NIAv2|SS15c,NIAv2|SS29,PCI-DSSv3.2.1|7.1.2,PCI-DSSv4.0|7.2.1,PCI-DSSv4.0|7.2.2,QCSC-v1|3.2,QCSC-v1|5.2.2,QCSC-v1|6.2,QCSC-v1|13.2,SWIFT-CSCv1|5.1,TBA-FIISB|31.1,TBA-FIISB|31.4.2,TBA-FIISB|31.4.3" see_also : "https://workbench.cisecurity.org/benchmarks/20333" cmd : "#!/bin/bash { a_output=(); a_output2=() l_pmask=\"0133\"; l_maxperm=\"$( printf '%o' $(( 0777 & ~$l_pmask )) )\" f_file_chk() { while IFS=: read -r l_file_mode l_file_owner l_file_group; do a_out2=() if [ $(( $l_file_mode & $l_pmask )) -gt 0 ]; then a_out2+=(\" Mode: \\\"$l_file_mode\\\" should be mode: \\\"$l_maxperm\\\" or more restrictive\") fi if [ \"$l_file_owner\" != \"root\" ]; then a_out2+=(\" Owned by: \\\"$l_file_owner\\\" should be owned by: \\\"root\\\"\") fi if [ \"$l_file_group\" != \"root\" ]; then a_out2+=(\" Owned by group \\\"$l_file_group\\\" should be group owned by group: \\\"root\\\"\") fi if [ \"${#a_out2[@]}\" -gt \"0\" ]; then a_output2+=(\" - File: \\\"$l_file\\\"\" \"${a_out2[@]}\") else a_output+=(\" - File: \\\"$l_file\\\"\" \\ \" Correct: mode: \\\"$l_file_mode\\\", owner: \\\"$l_file_owner\\\" and group owner: \\\"$l_file_group\\\" configured\") fi done < <(stat -Lc '%#a:%U:%G' \"$l_file\") } while IFS= read -r -d $'\\0' l_file; do if ssh-keygen -lf &>/dev/null \"$l_file\"; then file \"$l_file\" | grep -Piq -- '\\bopenssh\\h+([^#\\n\\r]+\\h+)?public\\h+key\\b' && f_file_chk fi done < <(find -L /etc/ssh -xdev -type f -print0 2>/dev/null) if [ \"${#a_output2[@]}\" -le 0 ]; then [ \"${#a_output[@]}\" -le 0 ] && a_output+=(\" - No openSSH public keys found\") printf '%s\\n' \"\" \"- Audit Result:\" \" ** PASS **\" \"${a_output[@]}\" \"\" else printf '%s\\n' \"\" \"- Audit Result:\" \" ** FAIL **\" \" - Reason(s) for audit failure:\" \"${a_output2[@]}\" [ \"${#a_output[@]}\" -gt 0 ] && printf '%s\\n' \"\" \"- Correctly set:\" \"${a_output[@]}\" \"\" fi }" expect : "(?i)^[\\s]*\\**[\\s]*pass:?[\\s]*\\**$" description : "5.1.3 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. If a public host key file is modified by an unauthorized user, the SSH service may be compromised." solution : "Run the following script to set mode, ownership, and group on the public SSH host key files: #!/usr/bin/env bash { a_output=(); a_output2=() l_pmask=\"0133\"; l_maxperm=\"$( printf '%o' $(( 0777 & ~$l_pmask )) )\" f_file_access_fix() { while IFS=: read -r l_file_mode l_file_owner l_file_group; do a_out2=() [ $(( $l_file_mode & $l_pmask )) -gt 0 ] && \ a_out2+=(\" Mode: \\\"$l_file_mode\\\" should be mode: \\\"$l_maxperm\\\" or more restrictive\" \ \" updating to mode: \\\"$l_maxperm\\\"\") && chmod u-x,go-wx \"$l_file\" [ \"$l_file_owner\" != \"root\" ] && \ a_out2+=(\" Owned by: \\\"$l_file_owner\\\" should be owned by \\\"root\\\"\" \ \" Changing ownership to \\\"root\\\"\") && chown root \"$l_file\" [ \"$l_file_group\" != \"root\" ] && \ a_out2+=(\" Owned by group \\\"$l_file_group\\\" should be group owned by: \\\"root\\\"\" \ \" Changing group ownership to \\\"root\\\"\") && chgrp root \"$l_file\" if [ \"${#a_out2[@]}\" -gt \"0\" ]; then a_output2+=(\" - File: \\\"$l_file\\\"\" \"${a_out2[@]}\") else a_output+=(\" - File: \\\"$l_file\\\"\" \ \" Correct: mode: \\\"$l_file_mode\\\", owner: \\\"$l_file_owner\\\", and group owner: \\\"$l_file_group\\\" configured\") fi done < <(stat -Lc '%#a:%U:%G' \"$l_file\") } while IFS= read -r -d $'\0' l_file; do if ssh-keygen -lf &>/dev/null \"$l_file\"; then file \"$l_file\" | grep -Piq -- '\bopenssh\h+([^#\n\r]+\h+)?public\h+key\b' && f_file_access_fix fi done < <(find -L /etc/ssh -xdev -type f -print0 2>/dev/null) if [ \"${#a_output2[@]}\" -le \"0\" ]; then printf '%s\n' \"\" \" - No access changes required\" \"\" else printf '%s\n' \" - Remediation results:\" \"${a_output2[@]}\" \"\" fi }" reference : "800-171|3.1.1,800-171|3.1.4,800-171|3.1.5,800-171|3.8.1,800-171|3.8.2,800-171|3.8.3,800-171r3|03.01.02,800-171r3|03.01.04,800-171r3|03.01.05a.,800-171r3|03.08.02,800-53|AC-3,800-53|AC-5,800-53|AC-6,800-53|MP-2,800-53r5|AC-3,800-53r5|AC-5,800-53r5|AC-6,800-53r5|MP-2,CN-L3|7.1.3.2(b),CN-L3|7.1.3.2(g),CN-L3|8.1.4.2(d),CN-L3|8.1.4.2(f),CN-L3|8.1.4.11(b),CN-L3|8.1.10.2(c),CN-L3|8.1.10.6(a),CN-L3|8.5.3.1,CN-L3|8.5.4.1(a),CSCv7|14.6,CSCv8|3.3,CSF|PR.AC-4,CSF|PR.DS-5,CSF|PR.PT-2,CSF|PR.PT-3,CSF2.0|PR.AA-05,CSF2.0|PR.DS-10,CSF2.0|PR.IR-01,GDPR|32.1.b,HIPAA|164.306(a)(1),HIPAA|164.312(a)(1),ISO-27001-2022|A.5.3,ISO-27001-2022|A.5.10,ISO-27001-2022|A.5.15,ISO-27001-2022|A.5.33,ISO-27001-2022|A.7.7,ISO-27001-2022|A.7.10,ISO-27001-2022|A.8.2,ISO-27001-2022|A.8.3,ISO-27001-2022|A.8.18,ISO-27001-2022|A.8.20,ISO/IEC-27001|A.6.1.2,ISO/IEC-27001|A.9.4.1,ISO/IEC-27001|A.9.4.5,ITSG-33|AC-3,ITSG-33|AC-5,ITSG-33|AC-6,ITSG-33|MP-2,ITSG-33|MP-2a.,LEVEL|1A,NESA|T1.3.2,NESA|T1.3.3,NESA|T1.4.1,NESA|T4.2.1,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.2,NESA|T7.5.3,NIAv2|AM1,NIAv2|AM3,NIAv2|AM23f,NIAv2|SS13c,NIAv2|SS15c,NIAv2|SS29,PCI-DSSv3.2.1|7.1.2,PCI-DSSv4.0|7.2.1,PCI-DSSv4.0|7.2.2,QCSC-v1|3.2,QCSC-v1|5.2.2,QCSC-v1|6.2,QCSC-v1|13.2,SWIFT-CSCv1|5.1,TBA-FIISB|31.1,TBA-FIISB|31.4.2,TBA-FIISB|31.4.3" see_also : "https://workbench.cisecurity.org/benchmarks/20333" type : CMD_EXEC description : "openssh-server is installed" cmd : "/bin/dpkg -s openssh-server 2>&1 | /bin/grep -E '(Status:|not installed)'" expect : "^Status: install ok" type : CMD_EXEC description : "5.1.4 Ensure sshd Ciphers are configured" info : "This variable limits the ciphers that SSH can use during communication. Notes: - Some organizations may have stricter requirements for approved ciphers. - Ensure that ciphers used are in compliance with site policy. - The only \"strong\" ciphers currently FIPS 140 compliant are: - aes256-gcm@openssh.com - aes128-gcm@openssh.com - aes256-ctr - aes192-ctr - aes128-ctr Weak ciphers that are used for authentication to the cryptographic module cannot be relied upon to provide confidentiality or integrity, and system data may be compromised. - The Triple DES ciphers, as used in SSH, have a birthday bound of approximately four billion blocks, which makes it easier for remote attackers to obtain clear text data via a birthday attack against a long-duration encrypted session, aka a \"Sweet32\" attack. - Error handling in the SSH protocol; Client and Server, when using a block cipher algorithm in Cipher Block Chaining (CBC) mode, makes it easier for remote attackers to recover certain plain text data from an arbitrary block of cipher text in an SSH session via unknown vectors. NOTE: Nessus has provided the target output to assist in reviewing the benchmark to ensure target compliance." solution : "Edit the /etc/ssh/sshd_config file and add/modify the Ciphers line to contain a comma separated list of the site unapproved (weak) Ciphers preceded with a - above any Include entries: Example: Ciphers -3des-cbc,aes128-cbc,aes192-cbc,aes256-cbc,chacha20-poly1305@openssh.com - IF - CVE-2023-48795 has been addressed, and it meets local site policy, chacha20-poly1305@openssh.com may be removed from the list of excluded ciphers. Note: First occurrence of an option takes precedence. If Include locations are enabled, used, and order of precedence is understood in your environment, the entry may be created in a file in Include location." reference : "800-171|3.1.13,800-171|3.5.2,800-171|3.13.8,800-171r3|03.05.07,800-171r3|03.05.12,800-171r3|03.13.08,800-53|AC-17(2),800-53|IA-5,800-53|IA-5(1),800-53|SC-8,800-53|SC-8(1),800-53r5|AC-17(2),800-53r5|IA-5,800-53r5|IA-5(1),800-53r5|SC-8,800-53r5|SC-8(1),CN-L3|7.1.2.7(g),CN-L3|7.1.3.1(d),CN-L3|8.1.2.2(a),CN-L3|8.1.2.2(b),CN-L3|8.1.4.1(c),CN-L3|8.1.4.7(a),CN-L3|8.1.4.8(a),CN-L3|8.2.4.5(c),CN-L3|8.2.4.5(d),CN-L3|8.5.2.2,CSCv7|14.4,CSCv8|3.10,CSF|PR.AC-1,CSF|PR.AC-3,CSF|PR.DS-2,CSF|PR.DS-5,CSF|PR.PT-4,CSF2.0|PR.AA-01,CSF2.0|PR.AA-03,CSF2.0|PR.AA-05,CSF2.0|PR.DS-02,GDPR|32.1.a,GDPR|32.1.b,HIPAA|164.306(a)(1),HIPAA|164.312(a)(1),HIPAA|164.312(a)(2)(i),HIPAA|164.312(d),HIPAA|164.312(e)(1),HIPAA|164.312(e)(2)(i),ISO-27001-2022|A.5.10,ISO-27001-2022|A.5.14,ISO-27001-2022|A.5.16,ISO-27001-2022|A.5.17,ISO-27001-2022|A.5.33,ISO-27001-2022|A.6.7,ISO-27001-2022|A.8.20,ISO/IEC-27001|A.6.2.2,ISO/IEC-27001|A.10.1.1,ISO/IEC-27001|A.13.2.3,ITSG-33|AC-17(2),ITSG-33|IA-5,ITSG-33|IA-5(1),ITSG-33|SC-8,ITSG-33|SC-8a.,ITSG-33|SC-8(1),LEVEL|1A,NESA|T4.3.1,NESA|T4.3.2,NESA|T4.5.1,NESA|T4.5.2,NESA|T5.2.3,NESA|T5.4.2,NESA|T7.3.3,NESA|T7.4.1,NIAv2|AM37,NIAv2|IE8,NIAv2|IE9,NIAv2|IE12,NIAv2|NS5d,NIAv2|NS6b,NIAv2|NS29,NIAv2|SS24,PCI-DSSv3.2.1|2.3,PCI-DSSv3.2.1|4.1,PCI-DSSv4.0|2.2.7,PCI-DSSv4.0|4.2.1,QCSC-v1|3.2,QCSC-v1|5.2.1,QCSC-v1|5.2.2,QCSC-v1|6.2,QCSC-v1|13.2,SWIFT-CSCv1|2.1,SWIFT-CSCv1|2.6,SWIFT-CSCv1|4.1,TBA-FIISB|29.1" see_also : "https://workbench.cisecurity.org/benchmarks/20333" cmd : "#!/bin/bash { ports=$(/bin/grep -s -P \"^(Port|Match)\" /etc/ssh/sshd_config /etc/ssh/sshd_config.d/*.conf | /bin/grep -P -o \"(Port|LocalPort)[\\s]+[\\d]+\" | /bin/awk '{print $2}; END {if (NR == 0) print \"22\"}' | /bin/uniq); for port in ${ports[@]}; do /sbin/sshd -T -C user=root -C host=\"$(hostname)\" -C addr=\"$(/bin/grep $(hostname) /etc/hosts | /bin/awk '{print $1}')\" -C lport=$port | echo \"port $port: $(/bin/grep -i ^ciphers)\"; done | /bin/awk 'BEGIN {f=0} /ciphers/i { if ($NF ~ \"(3des|blowfish|cast128|aes(128|192|256))-cbc|arcfour(128|256)?|rijndael-cbc@lysator\.liu\.se|chacha20-poly1305@openssh\.com)\") f++; print $0} END {if (NR == 0) print \"Fail: no results returned\"; else if (f > 0) print \"Fail\"; else print \"Pass\" }' }" expect : "^Manual Review Required$" severity : MEDIUM description : "5.1.4 Ensure sshd Ciphers are configured" info : "This variable limits the ciphers that SSH can use during communication. Notes: - Some organizations may have stricter requirements for approved ciphers. - Ensure that ciphers used are in compliance with site policy. - The only \"strong\" ciphers currently FIPS 140 compliant are: - aes256-gcm@openssh.com - aes128-gcm@openssh.com - aes256-ctr - aes192-ctr - aes128-ctr Weak ciphers that are used for authentication to the cryptographic module cannot be relied upon to provide confidentiality or integrity, and system data may be compromised. - The Triple DES ciphers, as used in SSH, have a birthday bound of approximately four billion blocks, which makes it easier for remote attackers to obtain clear text data via a birthday attack against a long-duration encrypted session, aka a \"Sweet32\" attack. - Error handling in the SSH protocol; Client and Server, when using a block cipher algorithm in Cipher Block Chaining (CBC) mode, makes it easier for remote attackers to recover certain plain text data from an arbitrary block of cipher text in an SSH session via unknown vectors." solution : "Edit the /etc/ssh/sshd_config file and add/modify the Ciphers line to contain a comma separated list of the site unapproved (weak) Ciphers preceded with a - above any Include entries: Example: Ciphers -3des-cbc,aes128-cbc,aes192-cbc,aes256-cbc,chacha20-poly1305@openssh.com - IF - CVE-2023-48795 has been addressed, and it meets local site policy, chacha20-poly1305@openssh.com may be removed from the list of excluded ciphers. Note: First occurrence of an option takes precedence. If Include locations are enabled, used, and order of precedence is understood in your environment, the entry may be created in a file in Include location." reference : "800-171|3.1.13,800-171|3.5.2,800-171|3.13.8,800-171r3|03.05.07,800-171r3|03.05.12,800-171r3|03.13.08,800-53|AC-17(2),800-53|IA-5,800-53|IA-5(1),800-53|SC-8,800-53|SC-8(1),800-53r5|AC-17(2),800-53r5|IA-5,800-53r5|IA-5(1),800-53r5|SC-8,800-53r5|SC-8(1),CN-L3|7.1.2.7(g),CN-L3|7.1.3.1(d),CN-L3|8.1.2.2(a),CN-L3|8.1.2.2(b),CN-L3|8.1.4.1(c),CN-L3|8.1.4.7(a),CN-L3|8.1.4.8(a),CN-L3|8.2.4.5(c),CN-L3|8.2.4.5(d),CN-L3|8.5.2.2,CSCv7|14.4,CSCv8|3.10,CSF|PR.AC-1,CSF|PR.AC-3,CSF|PR.DS-2,CSF|PR.DS-5,CSF|PR.PT-4,CSF2.0|PR.AA-01,CSF2.0|PR.AA-03,CSF2.0|PR.AA-05,CSF2.0|PR.DS-02,GDPR|32.1.a,GDPR|32.1.b,HIPAA|164.306(a)(1),HIPAA|164.312(a)(1),HIPAA|164.312(a)(2)(i),HIPAA|164.312(d),HIPAA|164.312(e)(1),HIPAA|164.312(e)(2)(i),ISO-27001-2022|A.5.10,ISO-27001-2022|A.5.14,ISO-27001-2022|A.5.16,ISO-27001-2022|A.5.17,ISO-27001-2022|A.5.33,ISO-27001-2022|A.6.7,ISO-27001-2022|A.8.20,ISO/IEC-27001|A.6.2.2,ISO/IEC-27001|A.10.1.1,ISO/IEC-27001|A.13.2.3,ITSG-33|AC-17(2),ITSG-33|IA-5,ITSG-33|IA-5(1),ITSG-33|SC-8,ITSG-33|SC-8a.,ITSG-33|SC-8(1),LEVEL|1A,NESA|T4.3.1,NESA|T4.3.2,NESA|T4.5.1,NESA|T4.5.2,NESA|T5.2.3,NESA|T5.4.2,NESA|T7.3.3,NESA|T7.4.1,NIAv2|AM37,NIAv2|IE8,NIAv2|IE9,NIAv2|IE12,NIAv2|NS5d,NIAv2|NS6b,NIAv2|NS29,NIAv2|SS24,PCI-DSSv3.2.1|2.3,PCI-DSSv3.2.1|4.1,PCI-DSSv4.0|2.2.7,PCI-DSSv4.0|4.2.1,QCSC-v1|3.2,QCSC-v1|5.2.1,QCSC-v1|5.2.2,QCSC-v1|6.2,QCSC-v1|13.2,SWIFT-CSCv1|2.1,SWIFT-CSCv1|2.6,SWIFT-CSCv1|4.1,TBA-FIISB|29.1" see_also : "https://workbench.cisecurity.org/benchmarks/20333" type : CMD_EXEC description : "openssh-server is installed" cmd : "/bin/dpkg -s openssh-server 2>&1 | /bin/grep -E '(Status:|not installed)'" expect : "^Status: install ok" type : CMD_EXEC description : "5.1.5 Ensure sshd KexAlgorithms is configured" info : "Key exchange is any method in cryptography by which cryptographic keys are exchanged between two parties, allowing use of a cryptographic algorithm. If the sender and receiver wish to exchange encrypted messages, each must be equipped to encrypt messages to be sent and decrypt messages received Notes: - Kex algorithms have a higher preference the earlier they appear in the list - Some organizations may have stricter requirements for approved Key exchange algorithms - Ensure that Key exchange algorithms used are in compliance with site policy - The only Key Exchange Algorithms currently FIPS 140 approved are: - ecdh-sha2-nistp256 - ecdh-sha2-nistp384 - ecdh-sha2-nistp521 - diffie-hellman-group-exchange-sha256 - diffie-hellman-group16-sha512 - diffie-hellman-group18-sha512 - diffie-hellman-group14-sha256 Key exchange methods that are considered weak should be removed. A key exchange method may be weak because too few bits are used, or the hashing algorithm is considered too weak. Using weak algorithms could expose connections to man-in-the-middle attacks" solution : "Edit the /etc/ssh/sshd_config file and add/modify the KexAlgorithms line to contain a comma separated list of the site unapproved (weak) KexAlgorithms preceded with a - above any Include entries: Example: KexAlgorithms -diffie-hellman-group1-sha1,diffie-hellman-group14-sha1,diffie-hellman-group-exchange-sha1 Note: First occurrence of an option takes precedence. If Include locations are enabled, used, and order of precedence is understood in your environment, the entry may be created in a file in Include location." reference : "800-171|3.1.13,800-171|3.5.2,800-171|3.13.8,800-171r3|03.05.07,800-171r3|03.05.12,800-171r3|03.13.08,800-53|AC-17(2),800-53|IA-5,800-53|IA-5(1),800-53|SC-8,800-53|SC-8(1),800-53r5|AC-17(2),800-53r5|IA-5,800-53r5|IA-5(1),800-53r5|SC-8,800-53r5|SC-8(1),CN-L3|7.1.2.7(g),CN-L3|7.1.3.1(d),CN-L3|8.1.2.2(a),CN-L3|8.1.2.2(b),CN-L3|8.1.4.1(c),CN-L3|8.1.4.7(a),CN-L3|8.1.4.8(a),CN-L3|8.2.4.5(c),CN-L3|8.2.4.5(d),CN-L3|8.5.2.2,CSCv7|14.4,CSCv8|3.10,CSF|PR.AC-1,CSF|PR.AC-3,CSF|PR.DS-2,CSF|PR.DS-5,CSF|PR.PT-4,CSF2.0|PR.AA-01,CSF2.0|PR.AA-03,CSF2.0|PR.AA-05,CSF2.0|PR.DS-02,GDPR|32.1.a,GDPR|32.1.b,HIPAA|164.306(a)(1),HIPAA|164.312(a)(1),HIPAA|164.312(a)(2)(i),HIPAA|164.312(d),HIPAA|164.312(e)(1),HIPAA|164.312(e)(2)(i),ISO-27001-2022|A.5.10,ISO-27001-2022|A.5.14,ISO-27001-2022|A.5.16,ISO-27001-2022|A.5.17,ISO-27001-2022|A.5.33,ISO-27001-2022|A.6.7,ISO-27001-2022|A.8.20,ISO/IEC-27001|A.6.2.2,ISO/IEC-27001|A.10.1.1,ISO/IEC-27001|A.13.2.3,ITSG-33|AC-17(2),ITSG-33|IA-5,ITSG-33|IA-5(1),ITSG-33|SC-8,ITSG-33|SC-8a.,ITSG-33|SC-8(1),LEVEL|1A,NESA|T4.3.1,NESA|T4.3.2,NESA|T4.5.1,NESA|T4.5.2,NESA|T5.2.3,NESA|T5.4.2,NESA|T7.3.3,NESA|T7.4.1,NIAv2|AM37,NIAv2|IE8,NIAv2|IE9,NIAv2|IE12,NIAv2|NS5d,NIAv2|NS6b,NIAv2|NS29,NIAv2|SS24,PCI-DSSv3.2.1|2.3,PCI-DSSv3.2.1|4.1,PCI-DSSv4.0|2.2.7,PCI-DSSv4.0|4.2.1,QCSC-v1|3.2,QCSC-v1|5.2.1,QCSC-v1|5.2.2,QCSC-v1|6.2,QCSC-v1|13.2,SWIFT-CSCv1|2.1,SWIFT-CSCv1|2.6,SWIFT-CSCv1|4.1,TBA-FIISB|29.1" see_also : "https://workbench.cisecurity.org/benchmarks/20333" cmd : "#!/bin/bash { ports=$(/bin/grep -s -P \"^(Port|Match)\" /etc/ssh/sshd_config /etc/ssh/sshd_config.d/*.conf | /bin/grep -P -o \"(Port|LocalPort)[\\s]+[\\d]+\" | /bin/awk '{print $2}; END {if (NR == 0) print \"22\"}' | /bin/uniq); for port in ${ports[@]}; do /sbin/sshd -T -C user=root -C host=\"$(hostname)\" -C addr=\"$(/bin/grep $(hostname) /etc/hosts | /bin/awk '{print $1}')\" -C lport=$port | echo \"port $port: $(/bin/grep -i ^kexalgorithms)\"; done | /bin/awk 'BEGIN {f=0} /kexalgorithms/i { if ($NF ~ \"(diffie-hellman-group1-sha1|diffie-hellman-group14-sha1|diffie-hellman-group-exchange-sha1)\") f++; print $0} END {if (NR == 0) print \"Fail: no results returned\"; else if (f > 0) print \"Fail\"; else print \"Pass\" }' }" expect : "^Pass$" description : "5.1.5 Ensure sshd KexAlgorithms is configured" info : "Key exchange is any method in cryptography by which cryptographic keys are exchanged between two parties, allowing use of a cryptographic algorithm. If the sender and receiver wish to exchange encrypted messages, each must be equipped to encrypt messages to be sent and decrypt messages received Notes: - Kex algorithms have a higher preference the earlier they appear in the list - Some organizations may have stricter requirements for approved Key exchange algorithms - Ensure that Key exchange algorithms used are in compliance with site policy - The only Key Exchange Algorithms currently FIPS 140 approved are: - ecdh-sha2-nistp256 - ecdh-sha2-nistp384 - ecdh-sha2-nistp521 - diffie-hellman-group-exchange-sha256 - diffie-hellman-group16-sha512 - diffie-hellman-group18-sha512 - diffie-hellman-group14-sha256 Key exchange methods that are considered weak should be removed. A key exchange method may be weak because too few bits are used, or the hashing algorithm is considered too weak. Using weak algorithms could expose connections to man-in-the-middle attacks" solution : "Edit the /etc/ssh/sshd_config file and add/modify the KexAlgorithms line to contain a comma separated list of the site unapproved (weak) KexAlgorithms preceded with a - above any Include entries: Example: KexAlgorithms -diffie-hellman-group1-sha1,diffie-hellman-group14-sha1,diffie-hellman-group-exchange-sha1 Note: First occurrence of an option takes precedence. If Include locations are enabled, used, and order of precedence is understood in your environment, the entry may be created in a file in Include location." reference : "800-171|3.1.13,800-171|3.5.2,800-171|3.13.8,800-171r3|03.05.07,800-171r3|03.05.12,800-171r3|03.13.08,800-53|AC-17(2),800-53|IA-5,800-53|IA-5(1),800-53|SC-8,800-53|SC-8(1),800-53r5|AC-17(2),800-53r5|IA-5,800-53r5|IA-5(1),800-53r5|SC-8,800-53r5|SC-8(1),CN-L3|7.1.2.7(g),CN-L3|7.1.3.1(d),CN-L3|8.1.2.2(a),CN-L3|8.1.2.2(b),CN-L3|8.1.4.1(c),CN-L3|8.1.4.7(a),CN-L3|8.1.4.8(a),CN-L3|8.2.4.5(c),CN-L3|8.2.4.5(d),CN-L3|8.5.2.2,CSCv7|14.4,CSCv8|3.10,CSF|PR.AC-1,CSF|PR.AC-3,CSF|PR.DS-2,CSF|PR.DS-5,CSF|PR.PT-4,CSF2.0|PR.AA-01,CSF2.0|PR.AA-03,CSF2.0|PR.AA-05,CSF2.0|PR.DS-02,GDPR|32.1.a,GDPR|32.1.b,HIPAA|164.306(a)(1),HIPAA|164.312(a)(1),HIPAA|164.312(a)(2)(i),HIPAA|164.312(d),HIPAA|164.312(e)(1),HIPAA|164.312(e)(2)(i),ISO-27001-2022|A.5.10,ISO-27001-2022|A.5.14,ISO-27001-2022|A.5.16,ISO-27001-2022|A.5.17,ISO-27001-2022|A.5.33,ISO-27001-2022|A.6.7,ISO-27001-2022|A.8.20,ISO/IEC-27001|A.6.2.2,ISO/IEC-27001|A.10.1.1,ISO/IEC-27001|A.13.2.3,ITSG-33|AC-17(2),ITSG-33|IA-5,ITSG-33|IA-5(1),ITSG-33|SC-8,ITSG-33|SC-8a.,ITSG-33|SC-8(1),LEVEL|1A,NESA|T4.3.1,NESA|T4.3.2,NESA|T4.5.1,NESA|T4.5.2,NESA|T5.2.3,NESA|T5.4.2,NESA|T7.3.3,NESA|T7.4.1,NIAv2|AM37,NIAv2|IE8,NIAv2|IE9,NIAv2|IE12,NIAv2|NS5d,NIAv2|NS6b,NIAv2|NS29,NIAv2|SS24,PCI-DSSv3.2.1|2.3,PCI-DSSv3.2.1|4.1,PCI-DSSv4.0|2.2.7,PCI-DSSv4.0|4.2.1,QCSC-v1|3.2,QCSC-v1|5.2.1,QCSC-v1|5.2.2,QCSC-v1|6.2,QCSC-v1|13.2,SWIFT-CSCv1|2.1,SWIFT-CSCv1|2.6,SWIFT-CSCv1|4.1,TBA-FIISB|29.1" see_also : "https://workbench.cisecurity.org/benchmarks/20333" type : CMD_EXEC description : "openssh-server is installed" cmd : "/bin/dpkg -s openssh-server 2>&1 | /bin/grep -E '(Status:|not installed)'" expect : "^Status: install ok" type : CMD_EXEC description : "5.1.6 Ensure sshd MACs are configured" info : "This variable limits the types of MAC algorithms that SSH can use during communication. Notes: - Some organizations may have stricter requirements for approved MACs. - Ensure that MACs used are in compliance with site policy. - The only \"strong\" MACs currently FIPS 140 approved are: - HMAC-SHA1 - HMAC-SHA2-256 - HMAC-SHA2-384 - HMAC-SHA2-512 MD5 and 96-bit MAC algorithms are considered weak and have been shown to increase exploitability in SSH downgrade attacks. Weak algorithms continue to have a great deal of attention as a weak spot that can be exploited with expanded computing power. An attacker that breaks the algorithm could take advantage of a MiTM position to decrypt the SSH tunnel and capture credentials and information." solution : "Edit the /etc/ssh/sshd_config file and add/modify the MACs line to contain a comma separated list of the site unapproved (weak) MACs preceded with a - above any Include entries: Example: MACs -hmac-md5,hmac-md5-96,hmac-ripemd160,hmac-sha1-96,umac-64@openssh.com,hmac-md5-etm@openssh.com,hmac-md5-96-etm@openssh.com,hmac-ripemd160-etm@openssh.com,hmac-sha1-96-etm@openssh.com,umac-64-etm@openssh.com - IF - CVE-2023-48795 has not been reviewed and addressed, the following etm MACs should be added to the exclude list: hmac-sha1-etm@openssh.com , hmac-sha2-256-etm@openssh.com , hmac-sha2-512-etm@openssh.com Note: First occurrence of an option takes precedence. If Include locations are enabled, used, and order of precedence is understood in your environment, the entry may be created in a file in Include location." reference : "800-171|3.1.13,800-171|3.5.2,800-171|3.13.8,800-171r3|03.05.07,800-171r3|03.05.12,800-171r3|03.13.08,800-53|AC-17(2),800-53|IA-5,800-53|IA-5(1),800-53|SC-8,800-53|SC-8(1),800-53r5|AC-17(2),800-53r5|IA-5,800-53r5|IA-5(1),800-53r5|SC-8,800-53r5|SC-8(1),CN-L3|7.1.2.7(g),CN-L3|7.1.3.1(d),CN-L3|8.1.2.2(a),CN-L3|8.1.2.2(b),CN-L3|8.1.4.1(c),CN-L3|8.1.4.7(a),CN-L3|8.1.4.8(a),CN-L3|8.2.4.5(c),CN-L3|8.2.4.5(d),CN-L3|8.5.2.2,CSCv7|14.4,CSCv7|16.5,CSCv8|3.10,CSF|PR.AC-1,CSF|PR.AC-3,CSF|PR.DS-2,CSF|PR.DS-5,CSF|PR.PT-4,CSF2.0|PR.AA-01,CSF2.0|PR.AA-03,CSF2.0|PR.AA-05,CSF2.0|PR.DS-02,GDPR|32.1.a,GDPR|32.1.b,HIPAA|164.306(a)(1),HIPAA|164.312(a)(1),HIPAA|164.312(a)(2)(i),HIPAA|164.312(d),HIPAA|164.312(e)(1),HIPAA|164.312(e)(2)(i),ISO-27001-2022|A.5.10,ISO-27001-2022|A.5.14,ISO-27001-2022|A.5.16,ISO-27001-2022|A.5.17,ISO-27001-2022|A.5.33,ISO-27001-2022|A.6.7,ISO-27001-2022|A.8.20,ISO/IEC-27001|A.6.2.2,ISO/IEC-27001|A.10.1.1,ISO/IEC-27001|A.13.2.3,ITSG-33|AC-17(2),ITSG-33|IA-5,ITSG-33|IA-5(1),ITSG-33|SC-8,ITSG-33|SC-8a.,ITSG-33|SC-8(1),LEVEL|1A,NESA|T4.3.1,NESA|T4.3.2,NESA|T4.5.1,NESA|T4.5.2,NESA|T5.2.3,NESA|T5.4.2,NESA|T7.3.3,NESA|T7.4.1,NIAv2|AM37,NIAv2|IE8,NIAv2|IE9,NIAv2|IE12,NIAv2|NS5d,NIAv2|NS6b,NIAv2|NS29,NIAv2|SS24,PCI-DSSv3.2.1|2.3,PCI-DSSv3.2.1|4.1,PCI-DSSv4.0|2.2.7,PCI-DSSv4.0|4.2.1,QCSC-v1|3.2,QCSC-v1|5.2.1,QCSC-v1|5.2.2,QCSC-v1|6.2,QCSC-v1|13.2,SWIFT-CSCv1|2.1,SWIFT-CSCv1|2.6,SWIFT-CSCv1|4.1,TBA-FIISB|29.1" see_also : "https://workbench.cisecurity.org/benchmarks/20333" cmd : "#!/bin/bash { ports=$(/bin/grep -s -P \"^(Port|Match)\" /etc/ssh/sshd_config /etc/sshd_config.d/*.conf | /bin/grep -P -o \"(Port|LocalPort)[\\s]+[\\d]+\" | /bin/awk '{print $2}; END {if (NR == 0) print \"22\"}' | /bin/uniq); for port in ${ports[@]}; do /sbin/sshd -T -C user=root -C host=\"$(hostname)\" -C addr=\"$(/bin/grep $(hostname) /etc/hosts | /bin/awk '{print $1}')\" -C lport=$port | echo \"port $port: $(/bin/grep -Ei '^macs\\s')\"; done | /bin/awk 'BEGIN {f=0} /\\smacs\\s/i { if ($NF ~ \"(hmac-md5|hmac-md5-96|hmac-ripemd160|hmac-sha1-96|umac-64@openssh.com|hmac-md5-etm@openssh.com|hmac-md5-96-etm@openssh.com|hmac-ripemd160-etm@openssh.com|hmac-sha1-96-etm@openssh.com|umac-64-etm@openssh.com|umac-128-etm@openssh.com)\") f++; print $0} END {if (NR == 0) print \"Fail: no results returned\"; else if (f > 0) print \"Fail\"; else print \"Pass\" }' }" expect : "^Pass$" description : "5.1.6 Ensure sshd MACs are configured" info : "This variable limits the types of MAC algorithms that SSH can use during communication. Notes: - Some organizations may have stricter requirements for approved MACs. - Ensure that MACs used are in compliance with site policy. - The only \"strong\" MACs currently FIPS 140 approved are: - HMAC-SHA1 - HMAC-SHA2-256 - HMAC-SHA2-384 - HMAC-SHA2-512 MD5 and 96-bit MAC algorithms are considered weak and have been shown to increase exploitability in SSH downgrade attacks. Weak algorithms continue to have a great deal of attention as a weak spot that can be exploited with expanded computing power. An attacker that breaks the algorithm could take advantage of a MiTM position to decrypt the SSH tunnel and capture credentials and information." solution : "Edit the /etc/ssh/sshd_config file and add/modify the MACs line to contain a comma separated list of the site unapproved (weak) MACs preceded with a - above any Include entries: Example: MACs -hmac-md5,hmac-md5-96,hmac-ripemd160,hmac-sha1-96,umac-64@openssh.com,hmac-md5-etm@openssh.com,hmac-md5-96-etm@openssh.com,hmac-ripemd160-etm@openssh.com,hmac-sha1-96-etm@openssh.com,umac-64-etm@openssh.com - IF - CVE-2023-48795 has not been reviewed and addressed, the following etm MACs should be added to the exclude list: hmac-sha1-etm@openssh.com , hmac-sha2-256-etm@openssh.com , hmac-sha2-512-etm@openssh.com Note: First occurrence of an option takes precedence. If Include locations are enabled, used, and order of precedence is understood in your environment, the entry may be created in a file in Include location." reference : "800-171|3.1.13,800-171|3.5.2,800-171|3.13.8,800-171r3|03.05.07,800-171r3|03.05.12,800-171r3|03.13.08,800-53|AC-17(2),800-53|IA-5,800-53|IA-5(1),800-53|SC-8,800-53|SC-8(1),800-53r5|AC-17(2),800-53r5|IA-5,800-53r5|IA-5(1),800-53r5|SC-8,800-53r5|SC-8(1),CN-L3|7.1.2.7(g),CN-L3|7.1.3.1(d),CN-L3|8.1.2.2(a),CN-L3|8.1.2.2(b),CN-L3|8.1.4.1(c),CN-L3|8.1.4.7(a),CN-L3|8.1.4.8(a),CN-L3|8.2.4.5(c),CN-L3|8.2.4.5(d),CN-L3|8.5.2.2,CSCv7|14.4,CSCv7|16.5,CSCv8|3.10,CSF|PR.AC-1,CSF|PR.AC-3,CSF|PR.DS-2,CSF|PR.DS-5,CSF|PR.PT-4,CSF2.0|PR.AA-01,CSF2.0|PR.AA-03,CSF2.0|PR.AA-05,CSF2.0|PR.DS-02,GDPR|32.1.a,GDPR|32.1.b,HIPAA|164.306(a)(1),HIPAA|164.312(a)(1),HIPAA|164.312(a)(2)(i),HIPAA|164.312(d),HIPAA|164.312(e)(1),HIPAA|164.312(e)(2)(i),ISO-27001-2022|A.5.10,ISO-27001-2022|A.5.14,ISO-27001-2022|A.5.16,ISO-27001-2022|A.5.17,ISO-27001-2022|A.5.33,ISO-27001-2022|A.6.7,ISO-27001-2022|A.8.20,ISO/IEC-27001|A.6.2.2,ISO/IEC-27001|A.10.1.1,ISO/IEC-27001|A.13.2.3,ITSG-33|AC-17(2),ITSG-33|IA-5,ITSG-33|IA-5(1),ITSG-33|SC-8,ITSG-33|SC-8a.,ITSG-33|SC-8(1),LEVEL|1A,NESA|T4.3.1,NESA|T4.3.2,NESA|T4.5.1,NESA|T4.5.2,NESA|T5.2.3,NESA|T5.4.2,NESA|T7.3.3,NESA|T7.4.1,NIAv2|AM37,NIAv2|IE8,NIAv2|IE9,NIAv2|IE12,NIAv2|NS5d,NIAv2|NS6b,NIAv2|NS29,NIAv2|SS24,PCI-DSSv3.2.1|2.3,PCI-DSSv3.2.1|4.1,PCI-DSSv4.0|2.2.7,PCI-DSSv4.0|4.2.1,QCSC-v1|3.2,QCSC-v1|5.2.1,QCSC-v1|5.2.2,QCSC-v1|6.2,QCSC-v1|13.2,SWIFT-CSCv1|2.1,SWIFT-CSCv1|2.6,SWIFT-CSCv1|4.1,TBA-FIISB|29.1" see_also : "https://workbench.cisecurity.org/benchmarks/20333" type : CMD_EXEC description : "openssh-server is installed" cmd : "/bin/dpkg -s openssh-server 2>&1 | /bin/grep -E '(Status:|not installed)'" expect : "^Status: install ok" type : CMD_EXEC description : "5.1.7 Ensure sshd access is configured" 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. 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 parameters above any Include and Match set statements as follows: AllowUsers - AND/OR - AllowGroups Note: - First occurrence of a option takes precedence, Match set statements withstanding. If Include locations are enabled, used, and order of precedence is understood in your environment, the entry may be created in aconf file in a Include directory. - Be advised that these options are \"ANDed\" together. If both AllowUsers and AllowGroups are set, connections will be limited to the list of users that are also a member of an allowed group. It is recommended that only one be set for clarity and ease of administration. - It is easier to manage an allow list than a deny list. In a deny list, you could potentially add a user or group and forget to add it to the deny list." reference : "800-171|3.1.1,800-171|3.1.4,800-171|3.1.5,800-171|3.8.1,800-171|3.8.2,800-171|3.8.3,800-171r3|03.01.02,800-171r3|03.01.04,800-171r3|03.01.05a.,800-171r3|03.08.02,800-53|AC-3,800-53|AC-5,800-53|AC-6,800-53|MP-2,800-53r5|AC-3,800-53r5|AC-5,800-53r5|AC-6,800-53r5|MP-2,CN-L3|7.1.3.2(b),CN-L3|7.1.3.2(g),CN-L3|8.1.4.2(d),CN-L3|8.1.4.2(f),CN-L3|8.1.4.11(b),CN-L3|8.1.10.2(c),CN-L3|8.1.10.6(a),CN-L3|8.5.3.1,CN-L3|8.5.4.1(a),CSCv7|4.3,CSCv8|3.3,CSF|PR.AC-4,CSF|PR.DS-5,CSF|PR.PT-2,CSF|PR.PT-3,CSF2.0|PR.AA-05,CSF2.0|PR.DS-10,CSF2.0|PR.IR-01,GDPR|32.1.b,HIPAA|164.306(a)(1),HIPAA|164.312(a)(1),ISO-27001-2022|A.5.3,ISO-27001-2022|A.5.10,ISO-27001-2022|A.5.15,ISO-27001-2022|A.5.33,ISO-27001-2022|A.7.7,ISO-27001-2022|A.7.10,ISO-27001-2022|A.8.2,ISO-27001-2022|A.8.3,ISO-27001-2022|A.8.18,ISO-27001-2022|A.8.20,ISO/IEC-27001|A.6.1.2,ISO/IEC-27001|A.9.4.1,ISO/IEC-27001|A.9.4.5,ITSG-33|AC-3,ITSG-33|AC-5,ITSG-33|AC-6,ITSG-33|MP-2,ITSG-33|MP-2a.,LEVEL|1A,NESA|T1.3.2,NESA|T1.3.3,NESA|T1.4.1,NESA|T4.2.1,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.2,NESA|T7.5.3,NIAv2|AM1,NIAv2|AM3,NIAv2|AM23f,NIAv2|SS13c,NIAv2|SS15c,NIAv2|SS29,PCI-DSSv3.2.1|7.1.2,PCI-DSSv4.0|7.2.1,PCI-DSSv4.0|7.2.2,QCSC-v1|3.2,QCSC-v1|5.2.2,QCSC-v1|6.2,QCSC-v1|13.2,SWIFT-CSCv1|5.1,TBA-FIISB|31.1,TBA-FIISB|31.4.2,TBA-FIISB|31.4.3" see_also : "https://workbench.cisecurity.org/benchmarks/20333" cmd : "#!/bin/bash { ports=$(/bin/grep -s -P \"^(Port|Match)\" /etc/ssh/sshd_config /etc/ssh/sshd_config.d/*.conf | /bin/grep -P -o \"(Port|LocalPort)[\\s]+[\\d]+\" | /bin/awk '{print $2}; END {if (NR == 0) print \"22\"}' | /bin/uniq); for port in ${ports[@]}; do /sbin/sshd -T -C user=root -C host=\"$(hostname)\" -C addr=\"$(/bin/grep $(hostname) /etc/hosts | /bin/awk '{print $1}')\" -C lport=$port | echo \"port $port: $(/bin/grep -Pi '^\\h*(allow|deny)(users|groups)\\h+\\H+(\\h+.*)?$')\"; done | /bin/awk 'BEGIN {f=0} /(allow|deny)(users|groups)/i { if ($NF ~ \":\") f++; print $0} END {if (NR == 0) print \"Fail: no results returned\"; else if (f > 0) print \"Fail\"; else print \"Pass\"}' }" expect : "^Pass$" description : "5.1.7 Ensure sshd access is configured" 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. 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 parameters above any Include and Match set statements as follows: AllowUsers - AND/OR - AllowGroups Note: - First occurrence of a option takes precedence, Match set statements withstanding. If Include locations are enabled, used, and order of precedence is understood in your environment, the entry may be created in aconf file in a Include directory. - Be advised that these options are \"ANDed\" together. If both AllowUsers and AllowGroups are set, connections will be limited to the list of users that are also a member of an allowed group. It is recommended that only one be set for clarity and ease of administration. - It is easier to manage an allow list than a deny list. In a deny list, you could potentially add a user or group and forget to add it to the deny list." reference : "800-171|3.1.1,800-171|3.1.4,800-171|3.1.5,800-171|3.8.1,800-171|3.8.2,800-171|3.8.3,800-171r3|03.01.02,800-171r3|03.01.04,800-171r3|03.01.05a.,800-171r3|03.08.02,800-53|AC-3,800-53|AC-5,800-53|AC-6,800-53|MP-2,800-53r5|AC-3,800-53r5|AC-5,800-53r5|AC-6,800-53r5|MP-2,CN-L3|7.1.3.2(b),CN-L3|7.1.3.2(g),CN-L3|8.1.4.2(d),CN-L3|8.1.4.2(f),CN-L3|8.1.4.11(b),CN-L3|8.1.10.2(c),CN-L3|8.1.10.6(a),CN-L3|8.5.3.1,CN-L3|8.5.4.1(a),CSCv7|4.3,CSCv8|3.3,CSF|PR.AC-4,CSF|PR.DS-5,CSF|PR.PT-2,CSF|PR.PT-3,CSF2.0|PR.AA-05,CSF2.0|PR.DS-10,CSF2.0|PR.IR-01,GDPR|32.1.b,HIPAA|164.306(a)(1),HIPAA|164.312(a)(1),ISO-27001-2022|A.5.3,ISO-27001-2022|A.5.10,ISO-27001-2022|A.5.15,ISO-27001-2022|A.5.33,ISO-27001-2022|A.7.7,ISO-27001-2022|A.7.10,ISO-27001-2022|A.8.2,ISO-27001-2022|A.8.3,ISO-27001-2022|A.8.18,ISO-27001-2022|A.8.20,ISO/IEC-27001|A.6.1.2,ISO/IEC-27001|A.9.4.1,ISO/IEC-27001|A.9.4.5,ITSG-33|AC-3,ITSG-33|AC-5,ITSG-33|AC-6,ITSG-33|MP-2,ITSG-33|MP-2a.,LEVEL|1A,NESA|T1.3.2,NESA|T1.3.3,NESA|T1.4.1,NESA|T4.2.1,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.2,NESA|T7.5.3,NIAv2|AM1,NIAv2|AM3,NIAv2|AM23f,NIAv2|SS13c,NIAv2|SS15c,NIAv2|SS29,PCI-DSSv3.2.1|7.1.2,PCI-DSSv4.0|7.2.1,PCI-DSSv4.0|7.2.2,QCSC-v1|3.2,QCSC-v1|5.2.2,QCSC-v1|6.2,QCSC-v1|13.2,SWIFT-CSCv1|5.1,TBA-FIISB|31.1,TBA-FIISB|31.4.2,TBA-FIISB|31.4.3" see_also : "https://workbench.cisecurity.org/benchmarks/20333" type : CMD_EXEC description : "openssh-server is installed" cmd : "/bin/dpkg -s openssh-server 2>&1 | /bin/grep -E '(Status:|not installed)'" expect : "^Status: install ok" type : CMD_EXEC description : "Ensure banner is set to /etc/issue.net" cmd : "#!/bin/bash { ports=$(/bin/grep -s -P \"^(Port|Match)\" /etc/ssh/sshd_config /etc/ssh/sshd_config.d/*.conf | /bin/grep -P -o \"(Port|LocalPort)[\\s]+[\\d]+\" | /bin/awk '{print $2}; END {if (NR == 0) print \"22\"}' | /bin/uniq); for port in ${ports[@]}; do /sbin/sshd -T -C user=root -C host=\"$(hostname)\" -C addr=\"$(/bin/grep $(hostname) /etc/hosts | /bin/awk '{print $1}')\" -C lport=$port | echo \"port $port: $(/bin/grep -i ^banner)\"; done | /bin/awk 'BEGIN {f=0} /banner/i { if ($NF != \"@SSH_BANNER_FILE@\") f++; print $0} END {if (NR == 0) print \"Fail: no results returned\"; else if (f > 0) print \"Fail\"; else print \"Pass\" }' }" expect : "^Pass$" type : CMD_EXEC description : "Ensure any instances of \m, \s, \r, \v or any references to the OS platform are removed from /etc/issue.net" cmd : "/bin/grep -Psi -- \"(\\\\\\v|\\\\\\r|\\\\\\m|\\\\\\s|\\b$(/bin/grep '^ID=' /etc/os-release | /bin/cut -d= -f2 | /bin/sed -e 's/\"//g')\\b)\" \"$(/sbin/sshd -T | /bin/awk '$1 == \"banner\" {print $2}')\" | /bin/awk '{ print } END { if(NR==0) print \"Pass\"; else print \"Fail\" }'" expect : "^Pass$" type : BANNER_CHECK description : "FIX: DESCRIPTION MUST BE UPDATED" file : "@SSH_BANNER_FILE@" content : "@SSH_BANNER_TEXT@" is_substring : YES description : "5.1.8 Ensure sshd 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. 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 Banner parameter above any Include and Match entries as follows: Banner /etc/issue.net Note: First occurrence of a option takes precedence, Match set statements withstanding. If Include locations are enabled, used, and order of precedence is understood in your environment, the entry may be created in a file in Include location. Edit the file being called by the Banner argument with the appropriate contents according to your site policy, remove any instances of \m \r \s \v or references to the OS platform Example: # printf '%s\n' \"Authorized users only. All activity may be monitored and reported.\" > \"$(sshd -T | awk '$1 == \"banner\" {print $2}')\"" reference : "800-171|3.1.9,800-171r3|03.01.09,800-53|AC-8,800-53r5|AC-8,GDPR|32.1.b,HIPAA|164.306(a)(1),ISO-27001-2022|A.8.5,ITSG-33|AC-8,LEVEL|1A,NESA|M1.3.6,TBA-FIISB|45.2.4" see_also : "https://workbench.cisecurity.org/benchmarks/20333" show_output : YES description : "5.1.8 Ensure sshd 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. 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 Banner parameter above any Include and Match entries as follows: Banner /etc/issue.net Note: First occurrence of a option takes precedence, Match set statements withstanding. If Include locations are enabled, used, and order of precedence is understood in your environment, the entry may be created in a file in Include location. Edit the file being called by the Banner argument with the appropriate contents according to your site policy, remove any instances of \m \r \s \v or references to the OS platform Example: # printf '%s\n' \"Authorized users only. All activity may be monitored and reported.\" > \"$(sshd -T | awk '$1 == \"banner\" {print $2}')\"" reference : "800-171|3.1.9,800-171r3|03.01.09,800-53|AC-8,800-53r5|AC-8,GDPR|32.1.b,HIPAA|164.306(a)(1),ISO-27001-2022|A.8.5,ITSG-33|AC-8,LEVEL|1A,NESA|M1.3.6,TBA-FIISB|45.2.4" see_also : "https://workbench.cisecurity.org/benchmarks/20333" type : CMD_EXEC description : "openssh-server is installed" cmd : "/bin/dpkg -s openssh-server 2>&1 | /bin/grep -E '(Status:|not installed)'" expect : "^Status: install ok" type : CMD_EXEC description : "ClientAliveCountMax is greater than 0" cmd : "#!/bin/bash { ports=$(/bin/grep -s -P \"^(Port|Match)\" /etc/ssh/sshd_config /etc/ssh/sshd_config.d/*.conf | /bin/grep -P -o \"(Port|LocalPort)[\\s]+[\\d]+\" | /bin/awk '{print $2}; END {if (NR == 0) print \"22\"}' | /bin/uniq); for port in ${ports[@]}; do /sbin/sshd -T -C user=root -C host=\"$(hostname)\" -C addr=\"$(/bin/grep $(hostname) /etc/hosts | /bin/awk '{print $1}')\" -C lport=$port | echo \"port $port: $(/bin/grep -i ^clientalivecountmax)\"; done | /bin/awk 'BEGIN {f=0} /clientalivecountmax/i { if ($NF !~ /^[1-9][0-9]*$/) f++; print $0} END {if (NR == 0) print \"Fail: no results returned\"; else if (f > 0) print \"Fail\"; else print \"Pass\" }' }" expect : "^Pass$" type : CMD_EXEC description : "ClientAliveInterval is greater than 0" cmd : "#!/bin/bash { ports=$(/bin/grep -s -P \"^(Port|Match)\" /etc/ssh/sshd_config /etc/ssh/sshd_config.d/*.conf | /bin/grep -P -o \"(Port|LocalPort)[\\s]+[\\d]+\" | /bin/awk '{print $2}; END {if (NR == 0) print \"22\"}' | /bin/uniq); for port in ${ports[@]}; do /sbin/sshd -T -C user=root -C host=\"$(hostname)\" -C addr=\"$(/bin/grep $(hostname) /etc/hosts | /bin/awk '{print $1}')\" -C lport=$port | echo \"port $port: $(/bin/grep -i ^clientaliveinterval)\"; done | /bin/awk 'BEGIN {f=0} /clientaliveinterval/i { if ($NF !~ /^[1-9][0-9]*$/) f++; print $0} END {if (NR == 0) print \"Fail: no results returned\"; else if (f > 0) print \"Fail\"; else print \"Pass\" }' }" expect : "^Pass$" description : "5.1.9 Ensure sshd ClientAliveInterval and ClientAliveCountMax are configured" info : "Note: To clarify, the two settings described below are only meant for idle connections from a protocol perspective and are not meant to check if the user is active or not. An idle user does not mean an idle connection. SSH does not and never had, intentionally, the capability to drop idle users. In SSH versions before 8.2p1 there was a bug that caused these values to behave in such a manner that they were abused to disconnect idle users. This bug has been resolved in 8.2p1 and thus it can no longer be abused disconnect idle users. The two options ClientAliveInterval and ClientAliveCountMax control the timeout of SSH sessions. Taken directly from man 5 sshd_config : - ClientAliveInterval Sets a timeout interval in seconds after which if no data has been received from the client, sshd(8) will send a message through the encrypted channel to request a response from the client. The default is 0, indicating that these messages will not be sent to the client. - ClientAliveCountMax Sets the number of client alive messages which may be sent without sshd(8) receiving any messages back from the client. If this threshold is reached while client alive messages are being sent, sshd will disconnect the client, terminating the session. It is important to note that the use of client alive messages is very different from TCPKeepAlive. The client alive messages are sent through the encrypted channel and therefore will not be spoofable. The TCP keepalive option en-abled by TCPKeepAlive is spoofable. The client alive mechanism is valuable when the client or server depend on knowing when a connection has become unresponsive.The default value is 3. If ClientAliveInterval is set to 15, and ClientAliveCountMax is left at the default, unresponsive SSH clients will be disconnected after approximately 45 seconds. Setting a zero ClientAliveCountMax disables connection termination. In order to prevent resource exhaustion, appropriate values should be set for both ClientAliveInterval and ClientAliveCountMax Specifically, looking at the source code, ClientAliveCountMax must be greater than zero in order to utilize the ability of SSH to drop idle connections. If connections are allowed to stay open indefinitely, this can potentially be used as a DDOS attack or simple resource exhaustion could occur over unreliable networks. The example set here is a 45 second timeout. Consult your site policy for network timeouts and apply as appropriate." solution : "Edit the /etc/ssh/sshd_config file to set the ClientAliveInterval and ClientAliveCountMax parameters above any Include and Match entries according to site policy. Example: ClientAliveInterval 15 ClientAliveCountMax 3 Note: First occurrence of a option takes precedence, Match set statements withstanding. If Include locations are enabled, used, and order of precedence is understood in your environment, the entry may be created in a file in Include location." reference : "800-171|3.1.11,800-171r3|03.01.11,800-53|AC-12,800-53r5|AC-12,CN-L3|7.1.2.2(d),CN-L3|7.1.3.7(b),CN-L3|8.1.4.1(b),CSF2.0|PR.AA-03,GDPR|32.1.b,HIPAA|164.306(a)(1),HIPAA|164.312(a)(2)(iii),ITSG-33|AC-12,LEVEL|1A,NIAv2|NS49" see_also : "https://workbench.cisecurity.org/benchmarks/20333" show_output : YES description : "5.1.9 Ensure sshd ClientAliveInterval and ClientAliveCountMax are configured" info : "Note: To clarify, the two settings described below are only meant for idle connections from a protocol perspective and are not meant to check if the user is active or not. An idle user does not mean an idle connection. SSH does not and never had, intentionally, the capability to drop idle users. In SSH versions before 8.2p1 there was a bug that caused these values to behave in such a manner that they were abused to disconnect idle users. This bug has been resolved in 8.2p1 and thus it can no longer be abused disconnect idle users. The two options ClientAliveInterval and ClientAliveCountMax control the timeout of SSH sessions. Taken directly from man 5 sshd_config : - ClientAliveInterval Sets a timeout interval in seconds after which if no data has been received from the client, sshd(8) will send a message through the encrypted channel to request a response from the client. The default is 0, indicating that these messages will not be sent to the client. - ClientAliveCountMax Sets the number of client alive messages which may be sent without sshd(8) receiving any messages back from the client. If this threshold is reached while client alive messages are being sent, sshd will disconnect the client, terminating the session. It is important to note that the use of client alive messages is very different from TCPKeepAlive. The client alive messages are sent through the encrypted channel and therefore will not be spoofable. The TCP keepalive option en-abled by TCPKeepAlive is spoofable. The client alive mechanism is valuable when the client or server depend on knowing when a connection has become unresponsive.The default value is 3. If ClientAliveInterval is set to 15, and ClientAliveCountMax is left at the default, unresponsive SSH clients will be disconnected after approximately 45 seconds. Setting a zero ClientAliveCountMax disables connection termination. In order to prevent resource exhaustion, appropriate values should be set for both ClientAliveInterval and ClientAliveCountMax Specifically, looking at the source code, ClientAliveCountMax must be greater than zero in order to utilize the ability of SSH to drop idle connections. If connections are allowed to stay open indefinitely, this can potentially be used as a DDOS attack or simple resource exhaustion could occur over unreliable networks. The example set here is a 45 second timeout. Consult your site policy for network timeouts and apply as appropriate." solution : "Edit the /etc/ssh/sshd_config file to set the ClientAliveInterval and ClientAliveCountMax parameters above any Include and Match entries according to site policy. Example: ClientAliveInterval 15 ClientAliveCountMax 3 Note: First occurrence of a option takes precedence, Match set statements withstanding. If Include locations are enabled, used, and order of precedence is understood in your environment, the entry may be created in a file in Include location." reference : "800-171|3.1.11,800-171r3|03.01.11,800-53|AC-12,800-53r5|AC-12,CN-L3|7.1.2.2(d),CN-L3|7.1.3.7(b),CN-L3|8.1.4.1(b),CSF2.0|PR.AA-03,GDPR|32.1.b,HIPAA|164.306(a)(1),HIPAA|164.312(a)(2)(iii),ITSG-33|AC-12,LEVEL|1A,NIAv2|NS49" see_also : "https://workbench.cisecurity.org/benchmarks/20333" type : RPM_CHECK description : "5.2.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. sudo supports a plug-in architecture for security policies and input/output logging. Third parties can develop and distribute their own policy and I/O logging plug-ins to work seamlessly with the sudo front end. The default security policy is sudoers which is configured via the file /etc/sudoers and any entries in /etc/sudoers.d 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 : # zypper install sudo" reference : "800-171|3.1.5,800-171|3.1.6,800-171r3|03.01.06a.,800-171r3|03.01.06b.,800-53|AC-6(2),800-53|AC-6(5),800-53r5|AC-6(2),800-53r5|AC-6(5),CN-L3|7.1.3.2(b),CN-L3|7.1.3.2(g),CN-L3|8.1.4.2(d),CN-L3|8.1.10.6(a),CSCv7|4.3,CSCv8|5.4,CSF|PR.AC-4,CSF2.0|PR.AA-05,GDPR|32.1.b,HIPAA|164.306(a)(1),HIPAA|164.312(a)(1),ISO-27001-2022|A.5.15,ISO-27001-2022|A.8.2,ISO-27001-2022|A.8.18,ISO/IEC-27001|A.9.2.3,ITSG-33|AC-6(2),ITSG-33|AC-6(5),LEVEL|1A,NESA|T5.1.1,NESA|T5.2.2,NESA|T5.6.1,NIAv2|AM1,NIAv2|AM23f,NIAv2|AM32,NIAv2|AM33,NIAv2|SS13c,NIAv2|SS15c,NIAv2|VL3a,PCI-DSSv3.2.1|7.1.2,PCI-DSSv4.0|7.2.1,PCI-DSSv4.0|7.2.2,QCSC-v1|5.2.2,QCSC-v1|6.2,SWIFT-CSCv1|1.2,SWIFT-CSCv1|5.1,TBA-FIISB|31.4.2,TBA-FIISB|31.4.3" see_also : "https://workbench.cisecurity.org/benchmarks/20333" rpm : "sudo-0.0.0-0" operator : "gt" required : YES type : FILE_CONTENT_CHECK description : "Defaults use_pty is configured" file : "/etc/sudoers /etc/sudoers.d/*" regex : "^\\h*Defaults\\h+([^#\\n\\r]+,\\h*)?use_pty\\b" expect : "^\\h*Defaults\\h+([^#\\n\\r]+,\\h*)?use_pty\\b" required : NO min_occurrences : "1" type : FILE_CONTENT_CHECK_NOT description : "Defaults !use_pty is not configured" file : "/etc/sudoers /etc/sudoers.d/*" regex : "^\\h*Defaults\\h+([^#\\n\\r]+,\\h*)?\\!use_pty\\b" expect : "^\\h*Defaults\\h+([^#\\n\\r]+,\\h*)?\\!use_pty\\b" description : "5.2.2 Ensure sudo commands use pty" info : "sudo can be configured to run only from a pseudo terminal ( pseudo-pty ). 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 with visudo or a file in /etc/sudoers.d/ with visudo -f and add the following line: Defaults use_pty Edit the file /etc/sudoers with visudo and any files in /etc/sudoers.d/ with visudo -f and remove any occurrence of !use_pty Note: - sudo will read each file in /etc/sudoers.d skipping file names that end in ~ or contain a character to avoid causing problems with package manager or editor temporary/backup files. - Files are parsed in sorted lexical order. That is, /etc/sudoers.d/01_first will be parsed before /etc/sudoers.d/10_second - Be aware that because the sorting is lexical, not numeric, /etc/sudoers.d/1_whoops would be loaded after /etc/sudoers.d/10_second - Using a consistent number of leading zeroes in the file names can be used to avoid such problems. Impact: WARNING: Editing the sudo configuration incorrectly can cause sudo to stop functioning. Always use visudo to modify sudo configuration files." reference : "800-171|3.1.5,800-171|3.1.6,800-171r3|03.01.06a.,800-171r3|03.01.06b.,800-53|AC-6(2),800-53|AC-6(5),800-53r5|AC-6(2),800-53r5|AC-6(5),CN-L3|7.1.3.2(b),CN-L3|7.1.3.2(g),CN-L3|8.1.4.2(d),CN-L3|8.1.10.6(a),CSCv7|5.1,CSCv8|5.4,CSF|PR.AC-4,CSF2.0|PR.AA-05,GDPR|32.1.b,HIPAA|164.306(a)(1),HIPAA|164.312(a)(1),ISO-27001-2022|A.5.15,ISO-27001-2022|A.8.2,ISO-27001-2022|A.8.18,ISO/IEC-27001|A.9.2.3,ITSG-33|AC-6(2),ITSG-33|AC-6(5),LEVEL|1A,NESA|T5.1.1,NESA|T5.2.2,NESA|T5.6.1,NIAv2|AM1,NIAv2|AM23f,NIAv2|AM32,NIAv2|AM33,NIAv2|SS13c,NIAv2|SS15c,NIAv2|VL3a,PCI-DSSv3.2.1|7.1.2,PCI-DSSv4.0|7.2.1,PCI-DSSv4.0|7.2.2,QCSC-v1|5.2.2,QCSC-v1|6.2,SWIFT-CSCv1|1.2,SWIFT-CSCv1|5.1,TBA-FIISB|31.4.2,TBA-FIISB|31.4.3" see_also : "https://workbench.cisecurity.org/benchmarks/20333" show_output : YES type : FILE_CONTENT_CHECK description : "5.2.3 Ensure sudo log file exists" info : "The Defaults logfile entry sets the path to the sudo log file. Setting a path turns on logging to a file; negating this option turns it off. By default, sudo logs via syslog. Defining a dedicated log file for sudo simplifies auditing of sudo commands and creation of auditd rules for sudo." 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\" Notes: - sudo will read each file in /etc/sudoers.d skipping file names that end in ~ or contain a character to avoid causing problems with package manager or editor temporary/backup files. - Files are parsed in sorted lexical order. That is, /etc/sudoers.d/01_first will be parsed before /etc/sudoers.d/10_second - Be aware that because the sorting is lexical, not numeric, /etc/sudoers.d/1_whoops would be loaded after /etc/sudoers.d/10_second - Using a consistent number of leading zeroes in the file names can be used to avoid such problems. Impact: WARNING: Editing the sudo configuration incorrectly can cause sudo to stop functioning. Always use visudo to modify sudo configuration files. Creation of additional log files can cause disk space exhaustion if not correctly managed. You should configure logrotate to manage the sudo log in accordance with your local policy." reference : "800-171|3.3.1,800-171|3.3.2,800-171|3.3.6,800-171r3|03.03.02a.,800-171r3|03.03.02b.,800-171r3|03.03.03,800-171r3|03.03.06a.,800-53|AU-3,800-53|AU-3(1),800-53|AU-7,800-53|AU-12,800-53r5|AU-3,800-53r5|AU-3(1),800-53r5|AU-7,800-53r5|AU-12,CN-L3|7.1.2.3(a),CN-L3|7.1.2.3(b),CN-L3|7.1.2.3(c),CN-L3|7.1.3.3(a),CN-L3|7.1.3.3(b),CN-L3|8.1.4.3(b),CSCv7|6.3,CSCv8|8.5,CSF|DE.CM-1,CSF|DE.CM-3,CSF|DE.CM-7,CSF|PR.PT-1,CSF|RS.AN-3,CSF2.0|DE.CM-01,CSF2.0|DE.CM-03,CSF2.0|DE.CM-09,CSF2.0|PR.PS-04,CSF2.0|RS.AN-03,CSF2.0|RS.AN-06,CSF2.0|RS.AN-07,GDPR|32.1.b,HIPAA|164.306(a)(1),HIPAA|164.312(b),ISO-27001-2022|A.5.28,ISO-27001-2022|A.8.15,ITSG-33|AU-3,ITSG-33|AU-3(1),ITSG-33|AU-7,ITSG-33|AU-12,LEVEL|1A,NESA|T3.6.2,NIAv2|AM34a,NIAv2|AM34b,NIAv2|AM34c,NIAv2|AM34d,NIAv2|AM34e,NIAv2|AM34f,NIAv2|AM34g,PCI-DSSv3.2.1|10.1,PCI-DSSv3.2.1|10.3,PCI-DSSv3.2.1|10.3.1,PCI-DSSv3.2.1|10.3.2,PCI-DSSv3.2.1|10.3.3,PCI-DSSv3.2.1|10.3.4,PCI-DSSv3.2.1|10.3.5,PCI-DSSv3.2.1|10.3.6,PCI-DSSv4.0|10.2.2,QCSC-v1|3.2,QCSC-v1|6.2,QCSC-v1|8.2.1,QCSC-v1|10.2.1,QCSC-v1|11.2,QCSC-v1|13.2,SWIFT-CSCv1|6.4" see_also : "https://workbench.cisecurity.org/benchmarks/20333" file : "/etc/sudoers /etc/sudoers.d/*" regex : "(?i)^\\h*Defaults\\h+([^#]+,\\h*)?logfile\\h*=\\h*(\\\"|\\')?\\H+(\\\"|\\')?(,\\h*\\H+\\h*)*\\h*(#.*)?$" expect : "(?i)^\\h*Defaults\\h+([^#]+,\\h*)?logfile\\h*=\\h*(\\\"|\\')?\\H+(\\\"|\\')?(,\\h*\\H+\\h*)*\\h*(#.*)?$" min_occurrences : "1" string_required : NO type : FILE_CONTENT_CHECK_NOT description : "5.2.5 Ensure re-authentication for privilege escalation is not disabled globally" info : "The operating system must be configured so that users must re-authenticate for privilege escalation. Without re-authentication, users may access resources or perform tasks for which they do not have authorization. When operating systems provide the capability to escalate a functional capability, it is critical the user re-authenticate." solution : "Configure the operating system to require users to reauthenticate for privilege escalation. Based on the outcome of the audit procedure, use visudo -f to edit the relevant sudoers file. Remove any occurrences of !authenticate tags in the file(s)." reference : "800-171|3.1.5,800-171|3.1.6,800-171r3|03.01.06a.,800-171r3|03.01.06b.,800-53|AC-6(2),800-53|AC-6(5),800-53r5|AC-6(2),800-53r5|AC-6(5),CN-L3|7.1.3.2(b),CN-L3|7.1.3.2(g),CN-L3|8.1.4.2(d),CN-L3|8.1.10.6(a),CSCv7|4.3,CSCv8|5.4,CSF|PR.AC-4,CSF2.0|PR.AA-05,GDPR|32.1.b,HIPAA|164.306(a)(1),HIPAA|164.312(a)(1),ISO-27001-2022|A.5.15,ISO-27001-2022|A.8.2,ISO-27001-2022|A.8.18,ISO/IEC-27001|A.9.2.3,ITSG-33|AC-6(2),ITSG-33|AC-6(5),LEVEL|1A,NESA|T5.1.1,NESA|T5.2.2,NESA|T5.6.1,NIAv2|AM1,NIAv2|AM23f,NIAv2|AM32,NIAv2|AM33,NIAv2|SS13c,NIAv2|SS15c,NIAv2|VL3a,PCI-DSSv3.2.1|7.1.2,PCI-DSSv4.0|7.2.1,PCI-DSSv4.0|7.2.2,QCSC-v1|5.2.2,QCSC-v1|6.2,SWIFT-CSCv1|1.2,SWIFT-CSCv1|5.1,TBA-FIISB|31.4.2,TBA-FIISB|31.4.3" see_also : "https://workbench.cisecurity.org/benchmarks/20333" file : "/etc/sudoers /etc/sudoers.d/*" regex : "^[^#].*\!authenticate" expect : "^[^#].*\!authenticate" type : CMD_EXEC description : "sudo timeout" cmd : "/bin/sudo -V | /bin/grep 'Authentication timestamp timeout:'" expect : "Authentication timestamp timeout:[\\s]*([1-9]|1[0-5])\\." type : FILE_CONTENT_CHECK_NOT description : "On disk timestamp_timeout" file : "/etc/sudoers /etc/sudoers.d/*" regex : "(?i)^\\h*defaults\\h+(?:[^#\\n\\r]+\\h*,\\h*)?timestamp_timeout=(-1|1[6-9]|[2-9][0-9]|[1-9][0-9][0-9]+)\\b(\\h*,\\h*.*)?$" expect : "(?i)^\\h*defaults\\h+(?:[^#\\n\\r]+\\h*,\\h*)?timestamp_timeout=(-1|1[6-9]|[2-9][0-9]|[1-9][0-9][0-9]+)\\b(\\h*,\\h*.*)?$" required : NO min_occurrences : "1" description : "5.2.6 Ensure sudo authentication timeout is configured correctly" info : "sudo caches used credentials for a default of 5 minutes. This is for ease of use when there are multiple administrative tasks to perform. The timeout can be modified to suit local security policies. Setting a timeout value reduces the window of opportunity for unauthorized privileged access to another user." solution : "If the currently configured timeout is larger than 15 minutes, edit the file listed in the audit section with visudo -f and modify the entry timestamp_timeout= to 15 minutes or less as per your site policy. The value is in minutes. This particular entry may appear on its own, or on the same line as env_reset See the following two examples: Defaults env_reset, timestamp_timeout=15 Defaults timestamp_timeout=15 Defaults env_reset" reference : "800-171|3.1.5,800-171|3.1.6,800-171r3|03.01.06a.,800-171r3|03.01.06b.,800-53|AC-6(2),800-53|AC-6(5),800-53r5|AC-6(2),800-53r5|AC-6(5),CN-L3|7.1.3.2(b),CN-L3|7.1.3.2(g),CN-L3|8.1.4.2(d),CN-L3|8.1.10.6(a),CSCv7|4.3,CSCv8|5.4,CSF|PR.AC-4,CSF2.0|PR.AA-05,GDPR|32.1.b,HIPAA|164.306(a)(1),HIPAA|164.312(a)(1),ISO-27001-2022|A.5.15,ISO-27001-2022|A.8.2,ISO-27001-2022|A.8.18,ISO/IEC-27001|A.9.2.3,ITSG-33|AC-6(2),ITSG-33|AC-6(5),LEVEL|1A,NESA|T5.1.1,NESA|T5.2.2,NESA|T5.6.1,NIAv2|AM1,NIAv2|AM23f,NIAv2|AM32,NIAv2|AM33,NIAv2|SS13c,NIAv2|SS15c,NIAv2|VL3a,PCI-DSSv3.2.1|7.1.2,PCI-DSSv4.0|7.2.1,PCI-DSSv4.0|7.2.2,QCSC-v1|5.2.2,QCSC-v1|6.2,SWIFT-CSCv1|1.2,SWIFT-CSCv1|5.1,TBA-FIISB|31.4.2,TBA-FIISB|31.4.3" see_also : "https://workbench.cisecurity.org/benchmarks/20333" show_output : YES type : CMD_EXEC description : "5.2.7 Ensure access to the su command is restricted" 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 a specific groups to execute su This group should be empty to reinforce the use of sudo for privileged access. 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 : "Create an empty group that will be specified for use of the su command. The group should be named according to site policy. Example: # groupadd sugroup Add the following line to both the /etc/pam.d/su and /etc/pam.d/su-l files, specifying the empty group: auth required pam_wheel.so use_uid group=sugroup Impact: - IF - GNOME is installed, it will also be necessary to add pam_wheel.so to /etc/pam.d/gnomesu-pam to restrict use of the gnomesu command." reference : "800-171|3.1.1,800-171|3.1.4,800-171|3.1.5,800-171|3.8.1,800-171|3.8.2,800-171|3.8.3,800-171r3|03.01.02,800-171r3|03.01.04,800-171r3|03.01.05a.,800-171r3|03.08.02,800-53|AC-3,800-53|AC-5,800-53|AC-6,800-53|MP-2,800-53r5|AC-3,800-53r5|AC-5,800-53r5|AC-6,800-53r5|MP-2,CN-L3|7.1.3.2(b),CN-L3|7.1.3.2(g),CN-L3|8.1.4.2(d),CN-L3|8.1.4.2(f),CN-L3|8.1.4.11(b),CN-L3|8.1.10.2(c),CN-L3|8.1.10.6(a),CN-L3|8.5.3.1,CN-L3|8.5.4.1(a),CSCv7|5.1,CSCv8|3.3,CSF|PR.AC-4,CSF|PR.DS-5,CSF|PR.PT-2,CSF|PR.PT-3,CSF2.0|PR.AA-05,CSF2.0|PR.DS-10,CSF2.0|PR.IR-01,GDPR|32.1.b,HIPAA|164.306(a)(1),HIPAA|164.312(a)(1),ISO-27001-2022|A.5.3,ISO-27001-2022|A.5.10,ISO-27001-2022|A.5.15,ISO-27001-2022|A.5.33,ISO-27001-2022|A.7.7,ISO-27001-2022|A.7.10,ISO-27001-2022|A.8.2,ISO-27001-2022|A.8.3,ISO-27001-2022|A.8.18,ISO-27001-2022|A.8.20,ISO/IEC-27001|A.6.1.2,ISO/IEC-27001|A.9.4.1,ISO/IEC-27001|A.9.4.5,ITSG-33|AC-3,ITSG-33|AC-5,ITSG-33|AC-6,ITSG-33|MP-2,ITSG-33|MP-2a.,LEVEL|1A,NESA|T1.3.2,NESA|T1.3.3,NESA|T1.4.1,NESA|T4.2.1,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.2,NESA|T7.5.3,NIAv2|AM1,NIAv2|AM3,NIAv2|AM23f,NIAv2|SS13c,NIAv2|SS15c,NIAv2|SS29,PCI-DSSv3.2.1|7.1.2,PCI-DSSv4.0|7.2.1,PCI-DSSv4.0|7.2.2,QCSC-v1|3.2,QCSC-v1|5.2.2,QCSC-v1|6.2,QCSC-v1|13.2,SWIFT-CSCv1|5.1,TBA-FIISB|31.1,TBA-FIISB|31.4.2,TBA-FIISB|31.4.3" see_also : "https://workbench.cisecurity.org/benchmarks/20333" cmd : "sugroup=$(/bin/grep -Pi '^\\h*auth\\h+(?:required|requisite)\\h+pam_wheel\\.so\\h+(?:[^#\\n\\r]+\\h+)?((?!\\2)(use_uid\\b|group=\\H+\\b))\\h+(?:[^#\\n\\r]+\\h+)?((?!\\1)(use_uid\\b|group=\\H+\\b))(\\h+.*)?$' /etc/pam.d/su | /bin/awk 'BEGIN { FS = \"=\"} ; { print $2 }'); if [ ! -z $sugroup ]; then /bin/grep $sugroup /etc/group | /bin/awk 'BEGIN { FS = \":\" }; { print $4 }' | /bin/awk '{print} END {if (NF == 0) print \"pass - group empty\"; else print \"fail - group not empty\"}'; else echo \"fail - sugroup not found in /etc/pam.d/su\"; fi" expect : "pass - group empty" type : RPM_CHECK description : "5.3.1.1 Ensure latest version of pam is installed" info : "Updated versions of PAM include additional functionality To ensure the system has full functionality and access to the options covered by this Benchmark the latest version of pam should be installed." solution : "Run the following command to update to the latest version of PAM : # zypper update pam" reference : "800-171|3.5.1,800-171r3|03.05.01a.,800-53|IA-2(11),800-53r5|IA-2(6),CN-L3|8.1.4.1(d),CSF|PR.AC-1,CSF2.0|PR.AA-01,CSF2.0|PR.AA-03,GDPR|32.1.b,HIPAA|164.306(a)(1),HIPAA|164.312(a)(2)(i),HIPAA|164.312(d),ISO-27001-2022|A.5.16,ITSG-33|IA-2(100),LEVEL|1A,NESA|T5.4.2,NIAv2|AM2,NIAv2|AM8,NIAv2|AM14b,PCI-DSSv3.2.1|8.3,PCI-DSSv3.2.1|8.3.1,PCI-DSSv3.2.1|8.3.2,PCI-DSSv4.0|8.4.1,PCI-DSSv4.0|8.4.3,QCSC-v1|5.2.2,QCSC-v1|13.2,SWIFT-CSCv1|4.2,TBA-FIISB|35.1,TBA-FIISB|36.1" see_also : "https://workbench.cisecurity.org/benchmarks/20333" rpm : "pam-0.0.0-0" operator : "gt" required : YES type : FILE_CONTENT_CHECK description : "5.3.2.1.1 Ensure password failed attempts lockout is configured" info : "The deny= option will deny access if the number of consecutive authentication failures for this user during the recent interval exceeds . Locking out user IDs after n unsuccessful consecutive login attempts mitigates brute force password attacks against your systems." solution : "Create or edit the following line in /etc/security/faillock.conf setting the deny option to 5 or less: deny = 5" reference : "800-171|3.1.1,800-171r3|03.01.01,800-171r3|03.15.01,800-53|AC-1,800-53|AC-2,800-53|AC-2(1),800-53r5|AC-1,800-53r5|AC-2,800-53r5|AC-2(1),CN-L3|7.1.3.2(d),CN-L3|8.1.4.2(e),CN-L3|8.1.10.6(c),CSCv7|16.7,CSCv8|6.2,CSF|DE.CM-1,CSF|DE.CM-3,CSF|ID.GV-1,CSF|ID.GV-3,CSF|PR.AC-1,CSF|PR.AC-4,CSF2.0|DE.CM-01,CSF2.0|DE.CM-03,CSF2.0|GV.OC-03,CSF2.0|GV.OV-01,CSF2.0|GV.PO-01,CSF2.0|GV.PO-02,CSF2.0|GV.SC-03,CSF2.0|ID.IM-01,CSF2.0|ID.IM-02,CSF2.0|ID.IM-03,CSF2.0|PR.AA-01,CSF2.0|PR.AA-05,CSF2.0|PR.DS-10,GDPR|32.1.b,HIPAA|164.306(a)(1),HIPAA|164.312(a)(1),ISO-27001-2022|A.5.1,ISO-27001-2022|A.5.2,ISO-27001-2022|A.5.4,ISO-27001-2022|A.5.15,ISO-27001-2022|A.5.16,ISO-27001-2022|A.5.18,ISO-27001-2022|A.5.31,ISO-27001-2022|A.5.36,ISO-27001-2022|A.5.37,ISO-27001-2022|A.8.2,ISO-27001-2022|5.2,ISO-27001-2022|5.3,ISO-27001-2022|7.5.1,ISO-27001-2022|7.5.2,ISO-27001-2022|7.5.3,ISO/IEC-27001|A.9.1.1,ISO/IEC-27001|A.9.2.1,ITSG-33|AC-1,ITSG-33|AC-2,ITSG-33|AC-2(1),LEVEL|1A,NESA|M1.2.2,NIAv2|AM28,NIAv2|AM29,NIAv2|AM30,NIAv2|NS5j,NIAv2|SS14e,QCSC-v1|3.2,QCSC-v1|5.2.2,QCSC-v1|8.2.1,QCSC-v1|13.2,QCSC-v1|15.2" see_also : "https://workbench.cisecurity.org/benchmarks/20333" file : "/etc/security/faillock.conf" regex : "(?i)^\\h*deny\\h*=" expect : "(?i)^\\h*deny\\h*=\\h*@PASSWORD_DENY@\\b" type : FILE_CONTENT_CHECK description : "5.3.2.1.2 Ensure password unlock time is configured" info : "unlock_time= - The access will be re-enabled after seconds after the lock out. The value 0 has the same meaning as value never - the access will not be re-enabled without resetting the faillock entries by the faillock(8) command. Notes: - It is usually undesirable to permanently lock out users as they can become easily a target of denial of service attack unless the usernames are random and kept secret to potential attackers. - The maximum configurable value for unlock_time is 604800 Locking out user IDs after n unsuccessful consecutive login attempts mitigates brute force password attacks against your systems." solution : "Set password unlock time to conform to site policy. unlock_time should be 0 (never), or 900 seconds or greater. Edit /etc/security/faillock.conf file and update or add the following line: unlock_time = 900 Impact: Use of unlock_time=0 may allow an attacker to cause denial of service to legitimate users. This will also require a systems administrator with elevated privileges to unlock the account." reference : "800-171|3.1.1,800-171r3|03.01.01,800-171r3|03.15.01,800-53|AC-1,800-53|AC-2,800-53|AC-2(1),800-53r5|AC-1,800-53r5|AC-2,800-53r5|AC-2(1),CN-L3|7.1.3.2(d),CN-L3|8.1.4.2(e),CN-L3|8.1.10.6(c),CSCv7|16.7,CSCv8|6.2,CSF|DE.CM-1,CSF|DE.CM-3,CSF|ID.GV-1,CSF|ID.GV-3,CSF|PR.AC-1,CSF|PR.AC-4,CSF2.0|DE.CM-01,CSF2.0|DE.CM-03,CSF2.0|GV.OC-03,CSF2.0|GV.OV-01,CSF2.0|GV.PO-01,CSF2.0|GV.PO-02,CSF2.0|GV.SC-03,CSF2.0|ID.IM-01,CSF2.0|ID.IM-02,CSF2.0|ID.IM-03,CSF2.0|PR.AA-01,CSF2.0|PR.AA-05,CSF2.0|PR.DS-10,GDPR|32.1.b,HIPAA|164.306(a)(1),HIPAA|164.312(a)(1),ISO-27001-2022|A.5.1,ISO-27001-2022|A.5.2,ISO-27001-2022|A.5.4,ISO-27001-2022|A.5.15,ISO-27001-2022|A.5.16,ISO-27001-2022|A.5.18,ISO-27001-2022|A.5.31,ISO-27001-2022|A.5.36,ISO-27001-2022|A.5.37,ISO-27001-2022|A.8.2,ISO-27001-2022|5.2,ISO-27001-2022|5.3,ISO-27001-2022|7.5.1,ISO-27001-2022|7.5.2,ISO-27001-2022|7.5.3,ISO/IEC-27001|A.9.1.1,ISO/IEC-27001|A.9.2.1,ITSG-33|AC-1,ITSG-33|AC-2,ITSG-33|AC-2(1),LEVEL|1A,NESA|M1.2.2,NIAv2|AM28,NIAv2|AM29,NIAv2|AM30,NIAv2|NS5j,NIAv2|SS14e,QCSC-v1|3.2,QCSC-v1|5.2.2,QCSC-v1|8.2.1,QCSC-v1|13.2,QCSC-v1|15.2" see_also : "https://workbench.cisecurity.org/benchmarks/20333" file : "/etc/security/faillock.conf" regex : "(?i)^\\h*unlock_time\\h*=" expect : "(?i)^\\h*unlock_time\\h*=\\h*@PASSWORD_UNLOCK_TIME@\\b" type : FILE_CONTENT_CHECK description : "Check for pam_cracklib.so in /etc/pam.d/common-password" file : "/etc/pam.d/common-password" regex : "^[^#]*pam_cracklib\\.so" expect : "^[^#]*pam_cracklib\\.so" type : FILE_CONTENT_CHECK description : "Check for pam_cracklib.so in /etc/pam.d/common-password-pc" file : "/etc/pam.d/common-password-pc" regex : "^[^#]*pam_cracklib\\.so" expect : "^[^#]*pam_cracklib\\.so" description : "5.3.2.2.1 Ensure password dictionary check is enabled" info : "The pwquality dictcheck option sets whether to check for the words from the cracklib dictionary. If the operating system allows the user to select passwords based on dictionary words, this increases the chances of password compromise by increasing the opportunity for successful guesses, and brute-force attacks." solution : "Edit any file ending inconf in the /etc/security/pwquality.conf.d/ directory and/or the file /etc/security/pwquality.conf and comment out or remove any instance of dictcheck = 0 : Example: # sed -ri 's/^\s*dictcheck\s*=/# &/' /etc/security/pwquality.conf /etc/security/pwquality.conf.d/*.conf - OR/IF - the pam-config tool has been used to configure the global PAM configuration files.Run the following command to enable dictcheck : # pam-config -a --cracklib" reference : "800-171|3.5.2,800-171r3|03.05.07,800-53|IA-5(1),800-53r5|IA-5(1),CSCv7|4.4,CSCv8|5.2,CSF|PR.AC-1,CSF2.0|PR.AA-01,CSF2.0|PR.AA-03,GDPR|32.1.b,HIPAA|164.306(a)(1),HIPAA|164.312(a)(2)(i),HIPAA|164.312(d),ISO-27001-2022|A.5.16,ISO-27001-2022|A.5.17,ITSG-33|IA-5(1),LEVEL|1A,NESA|T5.2.3,QCSC-v1|5.2.2,QCSC-v1|13.2,SWIFT-CSCv1|4.1" see_also : "https://workbench.cisecurity.org/benchmarks/20333" show_output : YES type : FILE_CONTENT_CHECK description : "5.3.2.2.1 Ensure password dictionary check is enabled" info : "The pwquality dictcheck option sets whether to check for the words from the cracklib dictionary. If the operating system allows the user to select passwords based on dictionary words, this increases the chances of password compromise by increasing the opportunity for successful guesses, and brute-force attacks." solution : "Edit any file ending inconf in the /etc/security/pwquality.conf.d/ directory and/or the file /etc/security/pwquality.conf and comment out or remove any instance of dictcheck = 0 : Example: # sed -ri 's/^\s*dictcheck\s*=/# &/' /etc/security/pwquality.conf /etc/security/pwquality.conf.d/*.conf - OR/IF - the pam-config tool has been used to configure the global PAM configuration files.Run the following command to enable dictcheck : # pam-config -a --cracklib" reference : "800-171|3.5.2,800-171r3|03.05.07,800-53|IA-5(1),800-53r5|IA-5(1),CSCv7|4.4,CSCv8|5.2,CSF|PR.AC-1,CSF2.0|PR.AA-01,CSF2.0|PR.AA-03,GDPR|32.1.b,HIPAA|164.306(a)(1),HIPAA|164.312(a)(2)(i),HIPAA|164.312(d),ISO-27001-2022|A.5.16,ISO-27001-2022|A.5.17,ITSG-33|IA-5(1),LEVEL|1A,NESA|T5.2.3,QCSC-v1|5.2.2,QCSC-v1|13.2,SWIFT-CSCv1|4.1" see_also : "https://workbench.cisecurity.org/benchmarks/20333" file : "/etc/security/pwquality.conf.d/*.conf /etc/security/pwquality.conf" regex : "(?i)^\\h*dictcheck\\h*=" expect : "(?i)^\\h*dictcheck\\h*=\\h*[1-9]\\b" required : NO file_supersedence : YES type : CMD_EXEC description : "Check for difok in pam module" cmd : "/usr/sbin/pam-config --query --cracklib --cracklib-difok" expect : "difok\\h*=" type : CMD_EXEC description : "5.3.2.2.2 Ensure password number of changed characters is configured" info : "The pwquality difok option sets the number of characters in a password that must not be present in the old password. Use of a complex password helps to increase the time and resources required to compromise the password. Password complexity, or strength, is a measure of the effectiveness of a password in resisting attempts at guessing and brute-force attacks. Password complexity is one factor of several that determines how long it takes to crack a password. The more complex the password, the greater the number of possible combinations that need to be tested before the password is compromised." solution : "Create or modify a file ending inconf in the /etc/security/pwquality.conf.d/ directory or the file /etc/security/pwquality.conf and add or modify the following line to set difok to 2 or more. Ensure setting conforms to local site policy: difok = 2 Example: # sed -ri 's/^\s*difok\s*=/# &/' /etc/security/pwquality.conf # printf '\n%s' \"difok = 2\" >> /etc/security/pwquality.conf.d/50-pwdifok.conf - OR - If the pam-config tool has been used to configure the global PAM configuration files: Run the following command to add the difok option to 2 or more and follows local site policy # pam-config -a --cracklib-difok=2 Note: - The difok option maybe set to 2 or more and depending on local site policy. - Best practice for updating pam modules is to configure settings in aconf file in the /etc/security/pwquality.conf.d/ directory or /etc/security/pwquality.conf" reference : "800-171|3.5.2,800-171r3|03.05.07,800-53|IA-5(1),800-53r5|IA-5(1),CSCv7|4.4,CSCv8|5.2,CSF|PR.AC-1,CSF2.0|PR.AA-01,CSF2.0|PR.AA-03,GDPR|32.1.b,HIPAA|164.306(a)(1),HIPAA|164.312(a)(2)(i),HIPAA|164.312(d),ISO-27001-2022|A.5.16,ISO-27001-2022|A.5.17,ITSG-33|IA-5(1),LEVEL|1A,NESA|T5.2.3,QCSC-v1|5.2.2,QCSC-v1|13.2,SWIFT-CSCv1|4.1" see_also : "https://workbench.cisecurity.org/benchmarks/20333" cmd : "/usr/sbin/pam-config --query --cracklib --cracklib-difok" expect : "difok\\h*=\\h*@PASSWORD_DIFOK@\\b" type : FILE_CONTENT_CHECK description : "5.3.2.2.2 Ensure password number of changed characters is configured" info : "The pwquality difok option sets the number of characters in a password that must not be present in the old password. Use of a complex password helps to increase the time and resources required to compromise the password. Password complexity, or strength, is a measure of the effectiveness of a password in resisting attempts at guessing and brute-force attacks. Password complexity is one factor of several that determines how long it takes to crack a password. The more complex the password, the greater the number of possible combinations that need to be tested before the password is compromised." solution : "Create or modify a file ending inconf in the /etc/security/pwquality.conf.d/ directory or the file /etc/security/pwquality.conf and add or modify the following line to set difok to 2 or more. Ensure setting conforms to local site policy: difok = 2 Example: # sed -ri 's/^\s*difok\s*=/# &/' /etc/security/pwquality.conf # printf '\n%s' \"difok = 2\" >> /etc/security/pwquality.conf.d/50-pwdifok.conf - OR - If the pam-config tool has been used to configure the global PAM configuration files: Run the following command to add the difok option to 2 or more and follows local site policy # pam-config -a --cracklib-difok=2 Note: - The difok option maybe set to 2 or more and depending on local site policy. - Best practice for updating pam modules is to configure settings in aconf file in the /etc/security/pwquality.conf.d/ directory or /etc/security/pwquality.conf" reference : "800-171|3.5.2,800-171r3|03.05.07,800-53|IA-5(1),800-53r5|IA-5(1),CSCv7|4.4,CSCv8|5.2,CSF|PR.AC-1,CSF2.0|PR.AA-01,CSF2.0|PR.AA-03,GDPR|32.1.b,HIPAA|164.306(a)(1),HIPAA|164.312(a)(2)(i),HIPAA|164.312(d),ISO-27001-2022|A.5.16,ISO-27001-2022|A.5.17,ITSG-33|IA-5(1),LEVEL|1A,NESA|T5.2.3,QCSC-v1|5.2.2,QCSC-v1|13.2,SWIFT-CSCv1|4.1" see_also : "https://workbench.cisecurity.org/benchmarks/20333" file : "/etc/security/pwquality.conf.d/*.conf /etc/security/pwquality.conf" regex : "(?i)^\\h*difok\\h*=" expect : "(?i)^\\h*difok\\h*=\\h*@PASSWORD_DIFOK@\\b" file_supersedence : YES type : CMD_EXEC description : "Check for minlen in pam module" cmd : "/usr/sbin/pam-config --query --cracklib --cracklib-minlen" expect : "minlen\\h*=" type : CMD_EXEC description : "5.3.2.2.3 Ensure password length is configured" info : "minlen - Minimum acceptable size for the new password (plus one if credits are not disabled which is the default). Cannot be set to lower value than 6. Strong passwords protect systems from being hacked through brute force methods." solution : "Create or modify a file ending inconf in the /etc/security/pwquality.conf.d/ directory or the file /etc/security/pwquality.conf and add or modify the following line to set minlen to 14 or more. Ensure that password setting conforms to local site policy: minlen=14 Example : # sed -ri 's/^\s*minlen\s*=/# &/' /etc/security/pwquality.conf # printf '\n%s' \"minlen = 14\" >> /etc/security/pwquality.conf.d/50-pwlength.conf - OR/IF - the pam-config tool has been used to configure the global PAM configuration files. Run the following command to set password length of 14 or more characters. Ensure that password length conforms to local site policy: # pam-config -a --cracklib-minlen=14" reference : "800-171|3.5.2,800-171r3|03.05.07,800-53|IA-5(1),800-53r5|IA-5(1),CSCv7|4.4,CSCv8|5.2,CSF|PR.AC-1,CSF2.0|PR.AA-01,CSF2.0|PR.AA-03,GDPR|32.1.b,HIPAA|164.306(a)(1),HIPAA|164.312(a)(2)(i),HIPAA|164.312(d),ISO-27001-2022|A.5.16,ISO-27001-2022|A.5.17,ITSG-33|IA-5(1),LEVEL|1A,NESA|T5.2.3,QCSC-v1|5.2.2,QCSC-v1|13.2,SWIFT-CSCv1|4.1" see_also : "https://workbench.cisecurity.org/benchmarks/20333" cmd : "/usr/sbin/pam-config --query --cracklib --cracklib-minlen" expect : "minlen\\h*=\\h*@PASSWORD_MINIMUM_LENGTH@\\b" type : FILE_CONTENT_CHECK description : "5.3.2.2.3 Ensure password length is configured" info : "minlen - Minimum acceptable size for the new password (plus one if credits are not disabled which is the default). Cannot be set to lower value than 6. Strong passwords protect systems from being hacked through brute force methods." solution : "Create or modify a file ending inconf in the /etc/security/pwquality.conf.d/ directory or the file /etc/security/pwquality.conf and add or modify the following line to set minlen to 14 or more. Ensure that password setting conforms to local site policy: minlen=14 Example : # sed -ri 's/^\s*minlen\s*=/# &/' /etc/security/pwquality.conf # printf '\n%s' \"minlen = 14\" >> /etc/security/pwquality.conf.d/50-pwlength.conf - OR/IF - the pam-config tool has been used to configure the global PAM configuration files. Run the following command to set password length of 14 or more characters. Ensure that password length conforms to local site policy: # pam-config -a --cracklib-minlen=14" reference : "800-171|3.5.2,800-171r3|03.05.07,800-53|IA-5(1),800-53r5|IA-5(1),CSCv7|4.4,CSCv8|5.2,CSF|PR.AC-1,CSF2.0|PR.AA-01,CSF2.0|PR.AA-03,GDPR|32.1.b,HIPAA|164.306(a)(1),HIPAA|164.312(a)(2)(i),HIPAA|164.312(d),ISO-27001-2022|A.5.16,ISO-27001-2022|A.5.17,ITSG-33|IA-5(1),LEVEL|1A,NESA|T5.2.3,QCSC-v1|5.2.2,QCSC-v1|13.2,SWIFT-CSCv1|4.1" see_also : "https://workbench.cisecurity.org/benchmarks/20333" file : "/etc/security/pwquality.conf.d/*.conf /etc/security/pwquality.conf" regex : "(?i)^\\h*minlen\\h*=" expect : "(?i)^\\h*minlen\\h*=\\h*@PASSWORD_MINIMUM_LENGTH@\\b" file_supersedence : YES type : CMD_EXEC description : "Check for minclass in pam module" cmd : "/usr/sbin/pam-config --query --cracklib --cracklib" expect : "minclass\\h*=" type : CMD_EXEC description : "5.3.2.2.4 Ensure password complexity is configured" info : "Password complexity can be set through: - minclass - The minimum number of classes of characters required in a new password. (digits, uppercase, lowercase, others). e.g. minclass = 4 requires digits, uppercase, lower case, and special characters. - dcredit - The maximum credit for having digits in the new password. If less than 0 it is the minimum number of digits in the new password. e.g. dcredit = -1 requires at least one digit - ucredit - The maximum credit for having uppercase characters in the new password. If less than 0 it is the minimum number of uppercase characters in the new password. e.g. ucredit = -1 requires at least one uppercase character - ocredit - The maximum credit for having other characters in the new password. If less than 0 it is the minimum number of other characters in the new password. e.g. ocredit = -1 requires at least one special character - lcredit - The maximum credit for having lowercase characters in the new password. If less than 0 it is the minimum number of lowercase characters in the new password. e.g. lcredit = -1 requires at least one lowercase character Strong passwords protect systems from being hacked through brute force methods." solution : "Create or modify a file ending inconf in the /etc/security/pwquality.conf.d/ directory or the file /etc/security/pwquality.conf and add or modify the following line to set: - minclass = 4 --AND/OR-- - dcredit = -_N_ - ucredit = -_N_ - ocredit = -_N_ - lcredit = -_N_ Example: # sed -ri 's/^\s*minclass\s*=/# &/' /etc/security/pwquality.conf # printf '\n%s' \"minclass = 4\" >> /etc/security/pwquality.conf.d/50-pwcomplexity.conf --AND/OR-- # sed -ri 's/^\s*[dulo]credit\s*=/# &/' /etc/security/pwquality.conf # printf '%s\n' \"dcredit = -1\" \"ucredit = -1\" \"ocredit = -1\" \"lcredit = -1\" > /etc/security/pwquality.conf.d/50-pwcomplexity.conf - OR/IF - the pam-config tool has been used to configure the global PAM configuration files.Run the following command to add minclass = 4 : # pam-config -a --cracklib-minclass=4 --AND/OR-- Run the following commands to add password complexity that conforms to local site policy: # pam-config -a --cracklib-dcredit= # pam-config -a --cracklib-ucredit= # pam-config -a --cracklib-lcredit= # pam-config -a --cracklib-ocredit=" reference : "800-171|3.5.2,800-171r3|03.05.07,800-53|IA-5(1),800-53r5|IA-5(1),CSCv7|4.4,CSCv8|5.2,CSF|PR.AC-1,CSF2.0|PR.AA-01,CSF2.0|PR.AA-03,GDPR|32.1.b,HIPAA|164.306(a)(1),HIPAA|164.312(a)(2)(i),HIPAA|164.312(d),ISO-27001-2022|A.5.16,ISO-27001-2022|A.5.17,ITSG-33|IA-5(1),LEVEL|1A,NESA|T5.2.3,QCSC-v1|5.2.2,QCSC-v1|13.2,SWIFT-CSCv1|4.1" see_also : "https://workbench.cisecurity.org/benchmarks/20333" cmd : "/usr/sbin/pam-config --query --cracklib --cracklib" expect : "minclass\\h*=\h*@PASSWORD_MINCLASS@\\b" type : CMD_EXEC description : "Check for credit in pam module" cmd : "/usr/sbin/pam-config --query --cracklib --cracklib" expect : "credit\\h*=" type : CMD_EXEC description : "Check for dcredit in pam module" cmd : "/usr/sbin/pam-config --query --cracklib --cracklib" expect : "dcredit\\h*=\\h*@PASSWORD_DCREDIT@\\b" type : CMD_EXEC description : "Check for ucredit in pam module" cmd : "/usr/sbin/pam-config --query --cracklib --cracklib" expect : "ucredit\\h*=\\h*@PASSWORD_UCREDIT@\\b" type : CMD_EXEC description : "Check for ocredit in pam module" cmd : "/usr/sbin/pam-config --query --cracklib --cracklib" expect : "ocredit\\h*=\\h*@PASSWORD_OCREDIT@\\b" type : CMD_EXEC description : "Check for lcredit in pam module" cmd : "/usr/sbin/pam-config --query --cracklib --cracklib" expect : "lcredit\\h*=\\h*@PASSWORD_LCREDIT@\\b" description : "5.3.2.2.4 Ensure password complexity is configured" info : "Password complexity can be set through: - minclass - The minimum number of classes of characters required in a new password. (digits, uppercase, lowercase, others). e.g. minclass = 4 requires digits, uppercase, lower case, and special characters. - dcredit - The maximum credit for having digits in the new password. If less than 0 it is the minimum number of digits in the new password. e.g. dcredit = -1 requires at least one digit - ucredit - The maximum credit for having uppercase characters in the new password. If less than 0 it is the minimum number of uppercase characters in the new password. e.g. ucredit = -1 requires at least one uppercase character - ocredit - The maximum credit for having other characters in the new password. If less than 0 it is the minimum number of other characters in the new password. e.g. ocredit = -1 requires at least one special character - lcredit - The maximum credit for having lowercase characters in the new password. If less than 0 it is the minimum number of lowercase characters in the new password. e.g. lcredit = -1 requires at least one lowercase character Strong passwords protect systems from being hacked through brute force methods." solution : "Create or modify a file ending inconf in the /etc/security/pwquality.conf.d/ directory or the file /etc/security/pwquality.conf and add or modify the following line to set: - minclass = 4 --AND/OR-- - dcredit = -_N_ - ucredit = -_N_ - ocredit = -_N_ - lcredit = -_N_ Example: # sed -ri 's/^\s*minclass\s*=/# &/' /etc/security/pwquality.conf # printf '\n%s' \"minclass = 4\" >> /etc/security/pwquality.conf.d/50-pwcomplexity.conf --AND/OR-- # sed -ri 's/^\s*[dulo]credit\s*=/# &/' /etc/security/pwquality.conf # printf '%s\n' \"dcredit = -1\" \"ucredit = -1\" \"ocredit = -1\" \"lcredit = -1\" > /etc/security/pwquality.conf.d/50-pwcomplexity.conf - OR/IF - the pam-config tool has been used to configure the global PAM configuration files.Run the following command to add minclass = 4 : # pam-config -a --cracklib-minclass=4 --AND/OR-- Run the following commands to add password complexity that conforms to local site policy: # pam-config -a --cracklib-dcredit= # pam-config -a --cracklib-ucredit= # pam-config -a --cracklib-lcredit= # pam-config -a --cracklib-ocredit=" reference : "800-171|3.5.2,800-171r3|03.05.07,800-53|IA-5(1),800-53r5|IA-5(1),CSCv7|4.4,CSCv8|5.2,CSF|PR.AC-1,CSF2.0|PR.AA-01,CSF2.0|PR.AA-03,GDPR|32.1.b,HIPAA|164.306(a)(1),HIPAA|164.312(a)(2)(i),HIPAA|164.312(d),ISO-27001-2022|A.5.16,ISO-27001-2022|A.5.17,ITSG-33|IA-5(1),LEVEL|1A,NESA|T5.2.3,QCSC-v1|5.2.2,QCSC-v1|13.2,SWIFT-CSCv1|4.1" see_also : "https://workbench.cisecurity.org/benchmarks/20333" show_output : YES type : FILE_CONTENT_CHECK description : "Check for minclass in pwquality" file : "/etc/security/pwquality.conf.d/*.conf /etc/security/pwquality.conf" regex : "(?i)^\\h*minclass\\h*=" expect : "(?i)^\\h*minclass\\h*=" required : NO min_occurrences : "1" type : FILE_CONTENT_CHECK description : "5.3.2.2.4 Ensure password complexity is configured" info : "Password complexity can be set through: - minclass - The minimum number of classes of characters required in a new password. (digits, uppercase, lowercase, others). e.g. minclass = 4 requires digits, uppercase, lower case, and special characters. - dcredit - The maximum credit for having digits in the new password. If less than 0 it is the minimum number of digits in the new password. e.g. dcredit = -1 requires at least one digit - ucredit - The maximum credit for having uppercase characters in the new password. If less than 0 it is the minimum number of uppercase characters in the new password. e.g. ucredit = -1 requires at least one uppercase character - ocredit - The maximum credit for having other characters in the new password. If less than 0 it is the minimum number of other characters in the new password. e.g. ocredit = -1 requires at least one special character - lcredit - The maximum credit for having lowercase characters in the new password. If less than 0 it is the minimum number of lowercase characters in the new password. e.g. lcredit = -1 requires at least one lowercase character Strong passwords protect systems from being hacked through brute force methods." solution : "Create or modify a file ending inconf in the /etc/security/pwquality.conf.d/ directory or the file /etc/security/pwquality.conf and add or modify the following line to set: - minclass = 4 --AND/OR-- - dcredit = -_N_ - ucredit = -_N_ - ocredit = -_N_ - lcredit = -_N_ Example: # sed -ri 's/^\s*minclass\s*=/# &/' /etc/security/pwquality.conf # printf '\n%s' \"minclass = 4\" >> /etc/security/pwquality.conf.d/50-pwcomplexity.conf --AND/OR-- # sed -ri 's/^\s*[dulo]credit\s*=/# &/' /etc/security/pwquality.conf # printf '%s\n' \"dcredit = -1\" \"ucredit = -1\" \"ocredit = -1\" \"lcredit = -1\" > /etc/security/pwquality.conf.d/50-pwcomplexity.conf - OR/IF - the pam-config tool has been used to configure the global PAM configuration files.Run the following command to add minclass = 4 : # pam-config -a --cracklib-minclass=4 --AND/OR-- Run the following commands to add password complexity that conforms to local site policy: # pam-config -a --cracklib-dcredit= # pam-config -a --cracklib-ucredit= # pam-config -a --cracklib-lcredit= # pam-config -a --cracklib-ocredit=" reference : "800-171|3.5.2,800-171r3|03.05.07,800-53|IA-5(1),800-53r5|IA-5(1),CSCv7|4.4,CSCv8|5.2,CSF|PR.AC-1,CSF2.0|PR.AA-01,CSF2.0|PR.AA-03,GDPR|32.1.b,HIPAA|164.306(a)(1),HIPAA|164.312(a)(2)(i),HIPAA|164.312(d),ISO-27001-2022|A.5.16,ISO-27001-2022|A.5.17,ITSG-33|IA-5(1),LEVEL|1A,NESA|T5.2.3,QCSC-v1|5.2.2,QCSC-v1|13.2,SWIFT-CSCv1|4.1" see_also : "https://workbench.cisecurity.org/benchmarks/20333" file : "/etc/security/pwquality.conf.d/*.conf /etc/security/pwquality.conf" regex : "(?i)^\\h*minclass\\h*=" expect : "(?i)^\\h*minclass\\h*=\\h*@PASSWORD_MINCLASS@\\b" file_supersedence : YES type : FILE_CONTENT_CHECK description : "Check for dcredit in pwquality" file : "/etc/security/pwquality.conf.d/*.conf /etc/security/pwquality.conf" regex : "(?i)^\\h*dcredit\\h*=" expect : "(?i)^\\h*dcredit\\h*=\\h*@PASSWORD_DCREDIT@\\b" file_supersedence : YES type : FILE_CONTENT_CHECK description : "Check for ucredit in pwquality" file : "/etc/security/pwquality.conf.d/*.conf /etc/security/pwquality.conf" regex : "(?i)^\\h*ucredit\\h*=" expect : "(?i)^\\h*ucredit\\h*=\\h*@PASSWORD_UCREDIT@\\b" file_supersedence : YES type : FILE_CONTENT_CHECK description : "Check for ocredit in pwquality" file : "/etc/security/pwquality.conf.d/*.conf /etc/security/pwquality.conf" regex : "(?i)^\\h*ocredit\\h*=" expect : "(?i)^\\h*ocredit\\h*=\\h*@PASSWORD_OCREDIT@\\b" file_supersedence : YES type : FILE_CONTENT_CHECK description : "Check for lcredit in pwquality" file : "/etc/security/pwquality.conf.d/*.conf /etc/security/pwquality.conf" regex : "(?i)^\\h*lcredit\\h*=" expect : "(?i)^\\h*lcredit\\h*=\\h*@PASSWORD_LCREDIT@\\b" file_supersedence : YES description : "5.3.2.2.4 Ensure password complexity is configured" info : "Password complexity can be set through: - minclass - The minimum number of classes of characters required in a new password. (digits, uppercase, lowercase, others). e.g. minclass = 4 requires digits, uppercase, lower case, and special characters. - dcredit - The maximum credit for having digits in the new password. If less than 0 it is the minimum number of digits in the new password. e.g. dcredit = -1 requires at least one digit - ucredit - The maximum credit for having uppercase characters in the new password. If less than 0 it is the minimum number of uppercase characters in the new password. e.g. ucredit = -1 requires at least one uppercase character - ocredit - The maximum credit for having other characters in the new password. If less than 0 it is the minimum number of other characters in the new password. e.g. ocredit = -1 requires at least one special character - lcredit - The maximum credit for having lowercase characters in the new password. If less than 0 it is the minimum number of lowercase characters in the new password. e.g. lcredit = -1 requires at least one lowercase character Strong passwords protect systems from being hacked through brute force methods." solution : "Create or modify a file ending inconf in the /etc/security/pwquality.conf.d/ directory or the file /etc/security/pwquality.conf and add or modify the following line to set: - minclass = 4 --AND/OR-- - dcredit = -_N_ - ucredit = -_N_ - ocredit = -_N_ - lcredit = -_N_ Example: # sed -ri 's/^\s*minclass\s*=/# &/' /etc/security/pwquality.conf # printf '\n%s' \"minclass = 4\" >> /etc/security/pwquality.conf.d/50-pwcomplexity.conf --AND/OR-- # sed -ri 's/^\s*[dulo]credit\s*=/# &/' /etc/security/pwquality.conf # printf '%s\n' \"dcredit = -1\" \"ucredit = -1\" \"ocredit = -1\" \"lcredit = -1\" > /etc/security/pwquality.conf.d/50-pwcomplexity.conf - OR/IF - the pam-config tool has been used to configure the global PAM configuration files.Run the following command to add minclass = 4 : # pam-config -a --cracklib-minclass=4 --AND/OR-- Run the following commands to add password complexity that conforms to local site policy: # pam-config -a --cracklib-dcredit= # pam-config -a --cracklib-ucredit= # pam-config -a --cracklib-lcredit= # pam-config -a --cracklib-ocredit=" reference : "800-171|3.5.2,800-171r3|03.05.07,800-53|IA-5(1),800-53r5|IA-5(1),CSCv7|4.4,CSCv8|5.2,CSF|PR.AC-1,CSF2.0|PR.AA-01,CSF2.0|PR.AA-03,GDPR|32.1.b,HIPAA|164.306(a)(1),HIPAA|164.312(a)(2)(i),HIPAA|164.312(d),ISO-27001-2022|A.5.16,ISO-27001-2022|A.5.17,ITSG-33|IA-5(1),LEVEL|1A,NESA|T5.2.3,QCSC-v1|5.2.2,QCSC-v1|13.2,SWIFT-CSCv1|4.1" see_also : "https://workbench.cisecurity.org/benchmarks/20333" show_output : YES type : CMD_EXEC description : "Check for maxrepeat in pam module" cmd : "/usr/sbin/pam-config --query --cracklib --cracklib-maxrepeat" expect : "maxrepeat\\h*=" type : CMD_EXEC description : "5.3.2.2.5 Ensure password same consecutive characters is configured" info : "The pwquality maxrepeat option sets the maximum number of allowed same consecutive characters in a new password. Use of a complex password helps to increase the time and resources required to compromise the password. Password complexity, or strength, is a measure of the effectiveness of a password in resisting attempts at guessing and brute-force attacks. Password complexity is one factor of several that determines how long it takes to crack a password. The more complex the password, the greater the number of possible combinations that need to be tested before the password is compromised." solution : "Create or modify a file ending inconf in the /etc/security/pwquality.conf.d/ directory or the file /etc/security/pwquality.conf and add or modify the following line to set maxrepeat to 3 or less and not 0 Ensure setting conforms to local site policy: Example: # sed -ri 's/^\s*maxrepeat\s*=/# &/' /etc/security/pwquality.conf # printf '\n%s' \"maxrepeat = 3\" >> /etc/security/pwquality.conf.d/50-pwrepeat.conf - OR/IF - the pam-config tool has been used to configure the global PAM configuration files.Run the following command to set maxrepeat to 3 or less and not 0 Ensure setting conforms to local site policy: # pam-config -a --cracklib-maxrepeat=3" reference : "800-171|3.5.2,800-171r3|03.05.07,800-53|IA-5(1),800-53r5|IA-5(1),CSCv7|4.4,CSCv8|5.2,CSF|PR.AC-1,CSF2.0|PR.AA-01,CSF2.0|PR.AA-03,GDPR|32.1.b,HIPAA|164.306(a)(1),HIPAA|164.312(a)(2)(i),HIPAA|164.312(d),ISO-27001-2022|A.5.16,ISO-27001-2022|A.5.17,ITSG-33|IA-5(1),LEVEL|1A,NESA|T5.2.3,QCSC-v1|5.2.2,QCSC-v1|13.2,SWIFT-CSCv1|4.1" see_also : "https://workbench.cisecurity.org/benchmarks/20333" cmd : "/usr/sbin/pam-config --query --cracklib --cracklib-maxrepeat" expect : "maxrepeat\\h*=\\h*@PASSWORD_MAXREPEAT@\\b" type : FILE_CONTENT_CHECK description : "5.3.2.2.5 Ensure password same consecutive characters is configured" info : "The pwquality maxrepeat option sets the maximum number of allowed same consecutive characters in a new password. Use of a complex password helps to increase the time and resources required to compromise the password. Password complexity, or strength, is a measure of the effectiveness of a password in resisting attempts at guessing and brute-force attacks. Password complexity is one factor of several that determines how long it takes to crack a password. The more complex the password, the greater the number of possible combinations that need to be tested before the password is compromised." solution : "Create or modify a file ending inconf in the /etc/security/pwquality.conf.d/ directory or the file /etc/security/pwquality.conf and add or modify the following line to set maxrepeat to 3 or less and not 0 Ensure setting conforms to local site policy: Example: # sed -ri 's/^\s*maxrepeat\s*=/# &/' /etc/security/pwquality.conf # printf '\n%s' \"maxrepeat = 3\" >> /etc/security/pwquality.conf.d/50-pwrepeat.conf - OR/IF - the pam-config tool has been used to configure the global PAM configuration files.Run the following command to set maxrepeat to 3 or less and not 0 Ensure setting conforms to local site policy: # pam-config -a --cracklib-maxrepeat=3" reference : "800-171|3.5.2,800-171r3|03.05.07,800-53|IA-5(1),800-53r5|IA-5(1),CSCv7|4.4,CSCv8|5.2,CSF|PR.AC-1,CSF2.0|PR.AA-01,CSF2.0|PR.AA-03,GDPR|32.1.b,HIPAA|164.306(a)(1),HIPAA|164.312(a)(2)(i),HIPAA|164.312(d),ISO-27001-2022|A.5.16,ISO-27001-2022|A.5.17,ITSG-33|IA-5(1),LEVEL|1A,NESA|T5.2.3,QCSC-v1|5.2.2,QCSC-v1|13.2,SWIFT-CSCv1|4.1" see_also : "https://workbench.cisecurity.org/benchmarks/20333" file : "/etc/security/pwquality.conf.d/*.conf /etc/security/pwquality.conf" regex : "(?i)^\\h*maxrepeat\\h*=" expect : "(?i)^\\h*maxrepeat\\h*=\\h*@PASSWORD_MAXREPEAT@\\b" file_supersedence : YES type : CMD_EXEC description : "Check for maxsequence in pam module" cmd : "/usr/sbin/pam-config --query --cracklib --cracklib-maxsequence" expect : "maxsequence\\h*=" type : CMD_EXEC description : "5.3.2.2.6 Ensure password maximum sequential characters is configured" info : "The pwquality maxsequence option sets the maximum length of monotonic character sequences in the new password. Examples of such sequence are 12345 or fedcb The check is disabled if the value is 0 Note: Most such passwords will not pass the simplicity check unless the sequence is only a minor part of the password. Use of a complex password helps to increase the time and resources required to compromise the password. Password complexity, or strength, is a measure of the effectiveness of a password in resisting attempts at guessing and brute-force attacks. Password complexity is one factor of several that determines how long it takes to crack a password. The more complex the password, the greater the number of possible combinations that need to be tested before the password is compromised." solution : "Create or modify a file ending inconf in the /etc/security/pwquality.conf.d/ directory or the file /etc/security/pwquality.conf and add or modify the following line to set maxsequence to 3 or less and not 0 Ensure setting conforms to local site policy: Example: # sed -ri 's/^\s*maxsequence\s*=/# &/' /etc/security/pwquality.conf # printf '\n%s' \"maxsequence = 3\" >> /etc/security/pwquality.conf.d/50-pwmaxsequence.conf - OR/IF - the pam-config tool has been used to configure the global PAM configuration files.Run the following command to set maxsequence to 3 or less and not 0 Ensure setting conforms to local site policy: Example: # pam-config -a --cracklib-maxsequence=3" reference : "800-171|3.5.2,800-171r3|03.05.07,800-53|IA-5(1),800-53r5|IA-5(1),CSCv7|4.4,CSCv8|5.2,CSF|PR.AC-1,CSF2.0|PR.AA-01,CSF2.0|PR.AA-03,GDPR|32.1.b,HIPAA|164.306(a)(1),HIPAA|164.312(a)(2)(i),HIPAA|164.312(d),ISO-27001-2022|A.5.16,ISO-27001-2022|A.5.17,ITSG-33|IA-5(1),LEVEL|1A,NESA|T5.2.3,QCSC-v1|5.2.2,QCSC-v1|13.2,SWIFT-CSCv1|4.1" see_also : "https://workbench.cisecurity.org/benchmarks/20333" cmd : "/usr/sbin/pam-config --query --cracklib --cracklib-maxsequence" expect : "maxsequence\\h*=\\h*@PASSWORD_MAXSEQUENCE@\\b" type : FILE_CONTENT_CHECK description : "5.3.2.2.6 Ensure password maximum sequential characters is configured" info : "The pwquality maxsequence option sets the maximum length of monotonic character sequences in the new password. Examples of such sequence are 12345 or fedcb The check is disabled if the value is 0 Note: Most such passwords will not pass the simplicity check unless the sequence is only a minor part of the password. Use of a complex password helps to increase the time and resources required to compromise the password. Password complexity, or strength, is a measure of the effectiveness of a password in resisting attempts at guessing and brute-force attacks. Password complexity is one factor of several that determines how long it takes to crack a password. The more complex the password, the greater the number of possible combinations that need to be tested before the password is compromised." solution : "Create or modify a file ending inconf in the /etc/security/pwquality.conf.d/ directory or the file /etc/security/pwquality.conf and add or modify the following line to set maxsequence to 3 or less and not 0 Ensure setting conforms to local site policy: Example: # sed -ri 's/^\s*maxsequence\s*=/# &/' /etc/security/pwquality.conf # printf '\n%s' \"maxsequence = 3\" >> /etc/security/pwquality.conf.d/50-pwmaxsequence.conf - OR/IF - the pam-config tool has been used to configure the global PAM configuration files.Run the following command to set maxsequence to 3 or less and not 0 Ensure setting conforms to local site policy: Example: # pam-config -a --cracklib-maxsequence=3" reference : "800-171|3.5.2,800-171r3|03.05.07,800-53|IA-5(1),800-53r5|IA-5(1),CSCv7|4.4,CSCv8|5.2,CSF|PR.AC-1,CSF2.0|PR.AA-01,CSF2.0|PR.AA-03,GDPR|32.1.b,HIPAA|164.306(a)(1),HIPAA|164.312(a)(2)(i),HIPAA|164.312(d),ISO-27001-2022|A.5.16,ISO-27001-2022|A.5.17,ITSG-33|IA-5(1),LEVEL|1A,NESA|T5.2.3,QCSC-v1|5.2.2,QCSC-v1|13.2,SWIFT-CSCv1|4.1" see_also : "https://workbench.cisecurity.org/benchmarks/20333" file : "/etc/security/pwquality.conf.d/*.conf /etc/security/pwquality.conf" regex : "(?i)^\\h*maxsequence\\h*=" expect : "(?i)^\\h*maxsequence\\h*=\\h*@PASSWORD_MAXSEQUENCE@\\b" file_supersedence : YES type : CMD_EXEC description : "Check for enforce_for_root in pam module" cmd : "/usr/sbin/pam-config --query --cracklib --cracklib-enforce_for_root" expect : "enforce_for_root" type : CMD_EXEC description : "5.3.2.2.7 Ensure password quality is enforced for the root user" info : "If the pwquality enforce_for_root option is enabled, the module will return error on failed check even if the user changing the password is root. This option is off by default which means that just the message about the failed check is printed but root can change the password anyway. Note: The root is not asked for an old password so the checks that compare the old and new password are not performed. Use of a complex password helps to increase the time and resources required to compromise the password. Password complexity, or strength, is a measure of the effectiveness of a password in resisting attempts at guessing and brute-force attacks. Password complexity is one factor of several that determines how long it takes to crack a password. The more complex the password, the greater the number of possible combinations that need to be tested before the password is compromised." solution : "Edit or add the following line in a *.conf file in /etc/security/pwquality.conf.d or in /etc/security/pwquality.conf : Example: printf '\n%s\n' \"enforce_for_root\" >> /etc/security/pwquality.conf.d/50-pwroot.conf - OR/IF - the pam-config tool has been used to configure the global PAM configuration files.Run the following command to set the enforce_for_root option to enabled: # pam-config -a --cracklib-enforce_for_root" reference : "800-171|3.5.2,800-171r3|03.05.07,800-53|IA-5(1),800-53r5|IA-5(1),CSCv7|4.4,CSCv8|5.2,CSF|PR.AC-1,CSF2.0|PR.AA-01,CSF2.0|PR.AA-03,GDPR|32.1.b,HIPAA|164.306(a)(1),HIPAA|164.312(a)(2)(i),HIPAA|164.312(d),ISO-27001-2022|A.5.16,ISO-27001-2022|A.5.17,ITSG-33|IA-5(1),LEVEL|1A,NESA|T5.2.3,QCSC-v1|5.2.2,QCSC-v1|13.2,SWIFT-CSCv1|4.1" see_also : "https://workbench.cisecurity.org/benchmarks/20333" cmd : "/usr/sbin/pam-config --query --cracklib --cracklib-enforce_for_root" expect : "enforce_for_root" type : FILE_CONTENT_CHECK description : "5.3.2.2.7 Ensure password quality is enforced for the root user" info : "If the pwquality enforce_for_root option is enabled, the module will return error on failed check even if the user changing the password is root. This option is off by default which means that just the message about the failed check is printed but root can change the password anyway. Note: The root is not asked for an old password so the checks that compare the old and new password are not performed. Use of a complex password helps to increase the time and resources required to compromise the password. Password complexity, or strength, is a measure of the effectiveness of a password in resisting attempts at guessing and brute-force attacks. Password complexity is one factor of several that determines how long it takes to crack a password. The more complex the password, the greater the number of possible combinations that need to be tested before the password is compromised." solution : "Edit or add the following line in a *.conf file in /etc/security/pwquality.conf.d or in /etc/security/pwquality.conf : Example: printf '\n%s\n' \"enforce_for_root\" >> /etc/security/pwquality.conf.d/50-pwroot.conf - OR/IF - the pam-config tool has been used to configure the global PAM configuration files.Run the following command to set the enforce_for_root option to enabled: # pam-config -a --cracklib-enforce_for_root" reference : "800-171|3.5.2,800-171r3|03.05.07,800-53|IA-5(1),800-53r5|IA-5(1),CSCv7|4.4,CSCv8|5.2,CSF|PR.AC-1,CSF2.0|PR.AA-01,CSF2.0|PR.AA-03,GDPR|32.1.b,HIPAA|164.306(a)(1),HIPAA|164.312(a)(2)(i),HIPAA|164.312(d),ISO-27001-2022|A.5.16,ISO-27001-2022|A.5.17,ITSG-33|IA-5(1),LEVEL|1A,NESA|T5.2.3,QCSC-v1|5.2.2,QCSC-v1|13.2,SWIFT-CSCv1|4.1" see_also : "https://workbench.cisecurity.org/benchmarks/20333" file : "/etc/security/pwquality.conf /etc/security/pwquality.conf.d/*.conf" regex : "(?i)^\\h*enforce_for_root" expect : "(?i)^\\h*enforce_for_root" required : NO min_occurrences : "1" type : CMD_EXEC description : "5.3.2.3.1 Ensure password history remember is configured" info : "The /etc/security/opasswd file stores the users' old passwords and can be checked to ensure that users are not recycling recent passwords. The number of passwords remembered is set via the remember argument value in set for the pam_pwhistory module. - remember= - is the number of old passwords to remember Requiring users not to reuse their passwords make it less likely that an attacker will be able to guess the password or use a compromised password. Note: These change only apply to accounts configured on the local system." solution : "Run the following command to add the remember option to 24 or more and meets local site policy: # pam-config -a --pwhistory --pwhistory-remember=24" reference : "800-171|3.5.2,800-171r3|03.05.07,800-53|IA-5(1),800-53r5|IA-5(1),CSCv7|4.4,CSCv8|5.2,CSF|PR.AC-1,CSF2.0|PR.AA-01,CSF2.0|PR.AA-03,GDPR|32.1.b,HIPAA|164.306(a)(1),HIPAA|164.312(a)(2)(i),HIPAA|164.312(d),ISO-27001-2022|A.5.16,ISO-27001-2022|A.5.17,ITSG-33|IA-5(1),LEVEL|1A,NESA|T5.2.3,QCSC-v1|5.2.2,QCSC-v1|13.2,SWIFT-CSCv1|4.1" see_also : "https://workbench.cisecurity.org/benchmarks/20333" cmd : "/usr/sbin/pam-config --query --pwhistory --pwhistory-remember" expect : "remember\\h*=\\h*@PASSWORD_HISTORY_REMEMBER@" type : CMD_EXEC description : "5.3.2.3.2 Ensure password history is enforced for the root user" info : "If the pwhistory enforce_for_root option is enabled, the module will enforce password history for the root user as well Requiring users not to reuse their passwords make it less likely that an attacker will be able to guess the password or use a compromised password Note: These change only apply to accounts configured on the local system." solution : "Run the following command to add enforce_for_root option: # pam-config -a --pwhistory --pwhistory-enforce_for_root" reference : "800-171|3.5.2,800-171r3|03.05.07,800-53|IA-5(1),800-53r5|IA-5(1),CSCv7|4.4,CSCv8|5.2,CSF|PR.AC-1,CSF2.0|PR.AA-01,CSF2.0|PR.AA-03,GDPR|32.1.b,HIPAA|164.306(a)(1),HIPAA|164.312(a)(2)(i),HIPAA|164.312(d),ISO-27001-2022|A.5.16,ISO-27001-2022|A.5.17,ITSG-33|IA-5(1),LEVEL|1A,NESA|T5.2.3,QCSC-v1|5.2.2,QCSC-v1|13.2,SWIFT-CSCv1|4.1" see_also : "https://workbench.cisecurity.org/benchmarks/20333" cmd : "/usr/sbin/pam-config --query --pwhistory --pwhistory-enforce_for_root" expect : "enforce_for_root" type : FILE_CONTENT_CHECK description : "Ensure at least one file named /etc/pam.d/common-passwordcommon-password exists and matches password pattern" file : "/etc/pam.d/common-password" regex : "(?i)^\\h*password\\h+(requisite|required|sufficient)\\h+pam_pwhistory\\.so(\\h+[^#\\n\\r]+)?\\h+use_authtok\\b" expect : "(?i)^\\h*password\\h+(requisite|required|sufficient)\\h+pam_pwhistory\\.so(\\h+[^#\\n\\r]+)?\\h+use_authtok\\b" type : FILE_CONTENT_CHECK description : "Ensure at least one file named /etc/pam.d/common-password-pc exists and matches password pattern" file : "/etc/pam.d/common-password-pc" regex : "(?i)^\\h*password\\h+(requisite|required|sufficient)\\h+pam_pwhistory\\.so(\\h+[^#\\n\\r]+)?\\h+use_authtok\\b" expect : "(?i)^\\h*password\\h+(requisite|required|sufficient)\\h+pam_pwhistory\\.so(\\h+[^#\\n\\r]+)?\\h+use_authtok\\b" description : "5.3.2.3.3 Ensure pam_pwhistory includes use_authtok" info : "use_authtok - When password changing enforce the module to set the new password to the one provided by a previously stacked password module use_authtok allows multiple pam modules to confirm a new password before it is accepted." solution : "Run the following command to add the use_authtok option to the password stack's pam_pwhistory.so module lines: # pam-config -a --pwhistory --pwhistory-use_authtok" reference : "800-171|3.5.2,800-171|3.13.16,800-171r3|03.05.07,800-171r3|03.13.08,800-53|IA-5(1),800-53|SC-28,800-53|SC-28(1),800-53r5|IA-5(1),800-53r5|SC-28,800-53r5|SC-28(1),CN-L3|8.1.4.7(b),CN-L3|8.1.4.8(b),CSCv7|16.4,CSCv8|3.11,CSF|PR.AC-1,CSF|PR.DS-1,CSF2.0|PR.AA-01,CSF2.0|PR.AA-03,CSF2.0|PR.DS-01,GDPR|32.1.a,GDPR|32.1.b,HIPAA|164.306(a)(1),HIPAA|164.312(a)(2)(i),HIPAA|164.312(a)(2)(iv),HIPAA|164.312(d),HIPAA|164.312(e)(2)(ii),ISO-27001-2022|A.5.10,ISO-27001-2022|A.5.16,ISO-27001-2022|A.5.17,ISO-27001-2022|A.5.33,ITSG-33|IA-5(1),ITSG-33|SC-28,ITSG-33|SC-28a.,ITSG-33|SC-28(1),LEVEL|1A,NESA|T5.2.3,PCI-DSSv3.2.1|3.4,PCI-DSSv4.0|3.3.2,PCI-DSSv4.0|3.5.1,QCSC-v1|5.2.2,QCSC-v1|6.2,QCSC-v1|13.2,SWIFT-CSCv1|4.1,TBA-FIISB|28.1" see_also : "https://workbench.cisecurity.org/benchmarks/20333" show_output : YES type : CMD_EXEC description : "5.3.2.4.1 Ensure pam_unix does not include nullok" info : "The nullok argument overrides the default action of pam_unix.so to not permit the user access to a service if their official password is blank. Using a strong password is essential to helping protect personal and sensitive information from unauthorized access" solution : "Run the following command to delete the nullok argument from the pam_unix.so module: # pam-config -d --unix --unix-nullok" reference : "800-171|3.5.2,800-171r3|03.05.07,800-53|IA-5(1),800-53r5|IA-5(1),CSCv7|4.4,CSCv8|5.2,CSF|PR.AC-1,CSF2.0|PR.AA-01,CSF2.0|PR.AA-03,GDPR|32.1.b,HIPAA|164.306(a)(1),HIPAA|164.312(a)(2)(i),HIPAA|164.312(d),ISO-27001-2022|A.5.16,ISO-27001-2022|A.5.17,ITSG-33|IA-5(1),LEVEL|1A,NESA|T5.2.3,QCSC-v1|5.2.2,QCSC-v1|13.2,SWIFT-CSCv1|4.1" see_also : "https://workbench.cisecurity.org/benchmarks/20333" cmd : "/usr/sbin/pam-config --query --unix --unix-nullok | /bin/grep [n]ullok | /bin/awk '{print} END {if (NR == 0) print \"pass\"; else print \"fail\"}'" expect : "^pass$" type : FILE_CONTENT_CHECK_NOT description : "5.3.2.4.2 Ensure pam_unix does not include remember" info : "The remember=n argument saves the last n passwords for each user in /etc/security/opasswd in order to force password change history and keep the user from alternating between the same password too frequently. The MD5 password hash algorithm is used for storing the old passwords. Instead of this option the pam_pwhistory module should be used. The pam_pwhistory module saves the last n passwords for each user in /etc/security/opasswd using the password hash algorithm set on the pam_unix module. This allows for the sha512 hash algorithm to be used. The remember=n argument should be removed to ensure a strong password hashing algorithm is being used. A stronger hash provides additional protection to the system by increasing the level of effort needed for an attacker to successfully determine local user's old passwords stored in /etc/security/opasswd" solution : "Edit a file in /etc/pam.d/* and remove the remember argument on the pam_unix.so module lines: /etc/pam.d/common-password:password required pam_unix.so use_authtok shadow sha512 /etc/pam.d/common-password-pc:password required pam_unix.so use_authtok shadow sha512" reference : "800-171|3.5.2,800-171r3|03.05.07,800-53|IA-5(1),800-53r5|IA-5(1),CSCv7|4.4,CSCv8|5.2,CSF|PR.AC-1,CSF2.0|PR.AA-01,CSF2.0|PR.AA-03,GDPR|32.1.b,HIPAA|164.306(a)(1),HIPAA|164.312(a)(2)(i),HIPAA|164.312(d),ISO-27001-2022|A.5.16,ISO-27001-2022|A.5.17,ITSG-33|IA-5(1),LEVEL|1A,NESA|T5.2.3,QCSC-v1|5.2.2,QCSC-v1|13.2,SWIFT-CSCv1|4.1" see_also : "https://workbench.cisecurity.org/benchmarks/20333" file : "/etc/pam.d/*" regex : "(?i)^\\h*password\\h+([^#\\n\\r]+\\h+)?pam_unix\\.so\\h+([^#\\n\\r]+\\h+)?remember*\\b" expect : "(?i)^\\h*password\\h+([^#\\n\\r]+\\h+)?pam_unix\\.so\\h+([^#\\n\\r]+\\h+)?remember*\\b" type : FILE_CONTENT_CHECK description : "Ensure at least one file named /etc/pam.d/common-password exists and matches pattern" file : "/etc/pam.d/common-password" regex : "(?i)^\\h*password\\h+([^#\\n\\r]+\\h+)?pam_unix\\.so\\h+([^#\\n\\r]+\\h+)?@PASSWORD_ENCRYPTION_PAM@\\b" expect : "(?i)^\\h*password\\h+([^#\\n\\r]+\\h+)?pam_unix\\.so\\h+([^#\\n\\r]+\\h+)?@PASSWORD_ENCRYPTION_PAM@\\b" type : FILE_CONTENT_CHECK description : "Ensure at least one file named /etc/pam.d/common-password-pc exists and matches pattern" file : "/etc/pam.d/common-password-pc" regex : "(?i)^\\h*password\\h+([^#\\n\\r]+\\h+)?pam_unix\\.so\\h+([^#\\n\\r]+\\h+)?@PASSWORD_ENCRYPTION_PAM@\\b" expect : "(?i)^\\h*password\\h+([^#\\n\\r]+\\h+)?pam_unix\\.so\\h+([^#\\n\\r]+\\h+)?@PASSWORD_ENCRYPTION_PAM@\\b" description : "5.3.2.4.3 Ensure pam_unix includes a strong password hashing algorithm" info : "A cryptographic hash function converts an arbitrary-length input into a fixed length output. Password hashing performs a one-way transformation of a password, turning the password into another string, called the hashed password. The SHA-512 and yescrypt algorithms provide a stronger hash than other algorithms used by Linux for password hash generation. A stronger hash provides additional protection to the system by increasing the level of effort needed for an attacker to successfully determine local user passwords. Note: These changes only apply to the local system." solution : "Notes: - If yescrypt becomes available in a future release, this would also be acceptable. It is highly recommended that the chosen hashing algorithm is consistent across /etc/libuser.conf /etc/login.defs /etc/pam.d/password-auth and /etc/pam.d/system-auth - This only effects local users and passwords created after updating the files to use sha512 or yescrypt If it is determined that the password algorithm being used is not sha512 or yescrypt once it is changed, it is recommended that all user ID's be immediately expired and forced to change their passwords on next login. Run one of the following commands to add a strong password hashing algorithm on the password stack's pam_unix.so module lines: # pam-config -a --unix --unix-sha512 - OR - # pam-config -a --unix --unix-yescrypt" reference : "800-171|3.5.2,800-171|3.13.16,800-171r3|03.05.07,800-171r3|03.13.08,800-53|IA-5(1),800-53|SC-28,800-53|SC-28(1),800-53r5|IA-5(1),800-53r5|SC-28,800-53r5|SC-28(1),CN-L3|8.1.4.7(b),CN-L3|8.1.4.8(b),CSCv7|16.4,CSCv8|3.11,CSF|PR.AC-1,CSF|PR.DS-1,CSF2.0|PR.AA-01,CSF2.0|PR.AA-03,CSF2.0|PR.DS-01,GDPR|32.1.a,GDPR|32.1.b,HIPAA|164.306(a)(1),HIPAA|164.312(a)(2)(i),HIPAA|164.312(a)(2)(iv),HIPAA|164.312(d),HIPAA|164.312(e)(2)(ii),ISO-27001-2022|A.5.10,ISO-27001-2022|A.5.16,ISO-27001-2022|A.5.17,ISO-27001-2022|A.5.33,ITSG-33|IA-5(1),ITSG-33|SC-28,ITSG-33|SC-28a.,ITSG-33|SC-28(1),LEVEL|1A,NESA|T5.2.3,PCI-DSSv3.2.1|3.4,PCI-DSSv4.0|3.3.2,PCI-DSSv4.0|3.5.1,QCSC-v1|5.2.2,QCSC-v1|6.2,QCSC-v1|13.2,SWIFT-CSCv1|4.1,TBA-FIISB|28.1" see_also : "https://workbench.cisecurity.org/benchmarks/20333" show_output : YES type : FILE_CONTENT_CHECK description : "Ensure at least one file named /etc/pam.d/common-password exists and matches pattern" file : "/etc/pam.d/common-password" regex : "(?i)^\\h*password\\h+(requisite|required|sufficient)\\h+pam_unix\\.so(\\h+[^#\\n\\r]+)?\\h+use_authtok\\b" expect : "(?i)^\\h*password\\h+(requisite|required|sufficient)\\h+pam_unix\\.so(\\h+[^#\\n\\r]+)?\\h+use_authtok\\b" type : FILE_CONTENT_CHECK description : "Ensure at least one file named /etc/pam.d/common-password-pc exists and matches pattern" file : "/etc/pam.d/common-password-pc" regex : "(?i)^\\h*password\\h+(requisite|required|sufficient)\\h+pam_unix\\.so(\\h+[^#\\n\\r]+)?\\h+use_authtok\\b" expect : "(?i)^\\h*password\\h+(requisite|required|sufficient)\\h+pam_unix\\.so(\\h+[^#\\n\\r]+)?\\h+use_authtok\\b" description : "5.3.2.4.4 Ensure pam_unix includes use_authtok" info : "use_authtok - When password changing enforce the module to set the new password to the one provided by a previously stacked password module use_authtok allows multiple pam modules to confirm a new password before it is accepted." solution : "Edit or create the line use_authtok on the password stack's pam_unix.so module lines: /etc/pam.d/common-password:password required pam_unix.so use_authtok shadow sha512 /etc/pam.d/common-password-pc:password required pam_unix.so use_authtok shadow sha512" reference : "800-171|3.5.2,800-171|3.13.16,800-171r3|03.05.07,800-171r3|03.13.08,800-53|IA-5(1),800-53|SC-28,800-53|SC-28(1),800-53r5|IA-5(1),800-53r5|SC-28,800-53r5|SC-28(1),CN-L3|8.1.4.7(b),CN-L3|8.1.4.8(b),CSCv7|16.4,CSCv8|3.11,CSF|PR.AC-1,CSF|PR.DS-1,CSF2.0|PR.AA-01,CSF2.0|PR.AA-03,CSF2.0|PR.DS-01,GDPR|32.1.a,GDPR|32.1.b,HIPAA|164.306(a)(1),HIPAA|164.312(a)(2)(i),HIPAA|164.312(a)(2)(iv),HIPAA|164.312(d),HIPAA|164.312(e)(2)(ii),ISO-27001-2022|A.5.10,ISO-27001-2022|A.5.16,ISO-27001-2022|A.5.17,ISO-27001-2022|A.5.33,ITSG-33|IA-5(1),ITSG-33|SC-28,ITSG-33|SC-28a.,ITSG-33|SC-28(1),LEVEL|1A,NESA|T5.2.3,PCI-DSSv3.2.1|3.4,PCI-DSSv4.0|3.3.2,PCI-DSSv4.0|3.5.1,QCSC-v1|5.2.2,QCSC-v1|6.2,QCSC-v1|13.2,SWIFT-CSCv1|4.1,TBA-FIISB|28.1" see_also : "https://workbench.cisecurity.org/benchmarks/20333" show_output : YES type : FILE_CONTENT_CHECK description : "login.defs - PASSWORD_MAX_DAYS" file : "/etc/login.defs" regex : "(?i)^\\h*PASS_MAX_DAYS\\h+\\d+\\b" expect : "(?i)^\\h*PASS_MAX_DAYS\\h+@PASSWORD_MAX_DAYS@\\b" type : CMD_EXEC description : "shadow password max days" cmd : "/bin/awk -F: '($2~/^\\$.+\\$/) {if($5 > @PASSWORD_MAX_DAYS@ || $5 < 1)print \"User: \" $1 \" PASS_MAX_DAYS: \" $5}' /etc/shadow | /bin/awk '{print} END {if (NR == 0) print \"pass\"; else print \"fail\"}'" expect : "^pass$" description : "5.4.1.1 Ensure password expiration is configured" info : "The PASS_MAX_DAYS parameter in /etc/login.defs allows an administrator to force passwords to expire once they reach a defined age. PASS_MAX_DAYS - The maximum number of days a password may be used. If the password is older than this, a password change will be forced. If not specified, -1 will be assumed (which disables the restriction). 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. We recommend a yearly password change. This is primarily because for all their good intentions users will share credentials across accounts. Therefore, even if a breach is publicly identified, the user may not see this notification, or forget they have an account on that site. This could leave a shared credential vulnerable indefinitely. Having an organizational policy of a 1-year (annual) password expiration is a reasonable compromise to mitigate this with minimal user burden." 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 Edit /etc/login.defs and set PASS_MAX_DAYS to a value greater than 0 that follows local site policy: Example: PASS_MAX_DAYS 90 Run the following command to modify user parameters for all users with a password set to a maximum age no greater than 365 or less than 1 that follows local site policy: # chage --maxdays Example: # awk -F: '($2~/^\$.+\$/) {if($5 > 365 || $5 < 1)system (\"chage --maxdays 90 \" $1)}' /etc/shadow Warning: If a password has been set at system install or kickstart, the last change date field is not set, In this case, setting PASS_MAX_DAYS will immediately expire the password. One possible solution is to populate the last change date field through a command like: chage -d \"$(date +%Y-%m-%d)\" root Impact: The password expiration must be greater than the minimum days between password changes or users will be unable to change their password. Excessive password expiration requirements do more harm than good, because these requirements make users select predictable passwords, composed of sequential words and numbers that are closely related to each other. In these cases, the next password can be predicted based on the previous one (incrementing a number used in the password forexample). Also, password expiration requirements offer no containment benefits because attackers will often use credentials as soon as they compromise them. Instead, immediate password changes should be based on key events including, but not limited to: - Indication of compromise - Change of user roles - When a user leaves the organization. Not only does changing passwords every few weeks or months frustrate the user, but it's also been suggested that it does more harm than good, because it could lead to bad practices by the user such as adding a character to the end of their existing password." reference : "800-171|3.5.2,800-171r3|03.05.07,800-53|IA-5(1),800-53r5|IA-5(1),CSCv7|4.4,CSCv8|5.2,CSF|PR.AC-1,CSF2.0|PR.AA-01,CSF2.0|PR.AA-03,GDPR|32.1.b,HIPAA|164.306(a)(1),HIPAA|164.312(a)(2)(i),HIPAA|164.312(d),ISO-27001-2022|A.5.16,ISO-27001-2022|A.5.17,ITSG-33|IA-5(1),LEVEL|1A,NESA|T5.2.3,QCSC-v1|5.2.2,QCSC-v1|13.2,SWIFT-CSCv1|4.1" see_also : "https://workbench.cisecurity.org/benchmarks/20333" show_output : YES type : CMD_EXEC description : "shadow password warn days" cmd : "/bin/awk -F: '($2~/^\\$.+\\$/) {if($6 < @PASSWORD_WARN_AGE@)print \"User: \" $1 \" PASS_WARN_AGE: \" $6}' /etc/shadow | /bin/awk '{print} END {if (NR == 0) print \"pass\"; else print \"fail\"}'" expect : "^pass$" type : FILE_CONTENT_CHECK description : "login.defs - PASS_WARN_AGE" file : "/etc/login.defs" regex : "(?i)^\\h*PASS_WARN_AGE\\h+\\d+\\b" expect : "(?i)^\\h*PASS_WARN_AGE\\h+@PASSWORD_WARN_AGE@\\b" description : "5.4.1.3 Ensure password expiration warning days is configured" 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. PASS_WARN_AGE - The number of days warning given before a password expires. A zero means warning is given only upon the day of expiration, a negative value means no warning is given. If not specified, no warning will be provided. 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 : "Edit /etc/login.defs and set PASS_WARN_AGE to a value of 7 or more that follows local site policy: Example: PASS_WARN_AGE 14 Run the following command to modify user parameters for all users with a password set to a minimum warning to 14 or more days that follows local site policy: # chage --warndays Example: # awk -F: '($2~/^\$.+\$/) {if($6 < 7)system (\"chage --warndays 14 \" $1)}' /etc/shadow" reference : "800-171|3.4.1,800-171|3.4.2,800-171|3.4.6,800-171|3.4.7,800-171|3.13.1,800-171|3.13.2,800-171r3|03.04.01,800-171r3|03.04.02,800-171r3|03.04.06,800-171r3|03.16.01,800-53|CM-2,800-53|CM-6,800-53|CM-7,800-53|CM-7(1),800-53|CM-9,800-53|SA-3,800-53|SA-8,800-53|SA-10,800-53r5|CM-1,800-53r5|CM-2,800-53r5|CM-6,800-53r5|CM-7,800-53r5|CM-7(1),800-53r5|CM-9,800-53r5|SA-3,800-53r5|SA-8,800-53r5|SA-10,CSCv7|4.4,CSCv8|4.1,CSF|DE.AE-1,CSF|PR.DS-7,CSF|PR.IP-1,CSF|PR.IP-2,CSF|PR.IP-3,CSF|PR.PT-3,CSF2.0|DE.CM-09,CSF2.0|ID.AM-08,CSF2.0|ID.IM-01,CSF2.0|ID.IM-02,CSF2.0|ID.IM-03,CSF2.0|ID.RA-09,CSF2.0|PR.DS-10,CSF2.0|PR.IR-03,CSF2.0|PR.PS-01,CSF2.0|PR.PS-06,GDPR|32.1.b,HIPAA|164.306(a)(1),ISO-27001-2022|A.5.2,ISO-27001-2022|A.5.8,ISO-27001-2022|A.8.9,ISO-27001-2022|A.8.25,ISO-27001-2022|A.8.26,ISO-27001-2022|A.8.27,ISO-27001-2022|A.8.28,ISO-27001-2022|A.8.30,ISO-27001-2022|A.8.31,ISO-27001-2022|A.8.32,ITSG-33|CM-2,ITSG-33|CM-6,ITSG-33|CM-7,ITSG-33|CM-7(1),ITSG-33|CM-9,ITSG-33|SA-3,ITSG-33|SA-8,ITSG-33|SA-8a.,ITSG-33|SA-10,LEVEL|1A,NESA|T1.2.1,NESA|T1.2.2,NESA|T3.2.5,NESA|T3.4.1,NESA|T4.5.3,NESA|T4.5.4,NESA|T7.2.1,NESA|T7.5.1,NESA|T7.5.3,NESA|T7.6.1,NESA|T7.6.2,NESA|T7.6.3,NESA|T7.6.5,NIAv2|SS3,NIAv2|SS15a,NIAv2|SS16,NIAv2|VL2,PCI-DSSv3.2.1|2.2.2,QCSC-v1|3.2,QCSC-v1|4.2,QCSC-v1|5.2.1,QCSC-v1|5.2.2,SWIFT-CSCv1|2.3" see_also : "https://workbench.cisecurity.org/benchmarks/20333" show_output : YES type : FILE_CONTENT_CHECK description : "5.4.1.4 Ensure strong password hashing algorithm is configured" info : "A cryptographic hash function converts an arbitrary-length input into a fixed length output. Password hashing performs a one-way transformation of a password, turning the password into another string, called the hashed password. ENCRYPT_METHOD (string) - This defines the system default encryption algorithm for encrypting passwords (if no algorithm are specified on the command line). It can take one of these values: - MD5 - MD5-based algorithm will be used for encrypting password - SHA256 - SHA256-based algorithm will be used for encrypting password - SHA512 - SHA512-based algorithm will be used for encrypting password - BCRYPT - BCRYPT-based algorithm will be used for encrypting password - YESCRYPT - YESCRYPT-based algorithm will be used for encrypting password - DES - DES-based algorithm will be used for encrypting password (default) Note: - This parameter overrides the deprecated MD5_CRYPT_ENAB variable. - This parameter will only affect the generation of group passwords. - The generation of user passwords is done by PAM and subject to the PAM configuration. - It is recommended to set this variable consistently with the PAM configuration. The SHA-512 and yescrypt algorithms provide a stronger hash than other algorithms used by Linux for password hash generation. A stronger hash provides additional protection to the system by increasing the level of effort needed for an attacker to successfully determine local group passwords." solution : "Edit /etc/login.defs and set the ENCRYPT_METHOD to SHA512 or YESCRYPT : ENCRYPT_METHOD Example: ENCRYPT_METHOD SHA512 Note: - This only effects local groups' passwords created after updating the file to use sha512 or yescrypt - If it is determined that the password algorithm being used is not sha512 or yescrypt once it is changed, it is recommended that all group passwords be updated to use the stronger hashing algorithm. - It is recommended that the chosen hashing algorithm is consistent across /etc/login.defs and the PAM configuration" reference : "800-171|3.5.2,800-171|3.13.16,800-171r3|03.05.07,800-171r3|03.13.08,800-53|IA-5(1),800-53|SC-28,800-53|SC-28(1),800-53r5|IA-5(1),800-53r5|SC-28,800-53r5|SC-28(1),CN-L3|8.1.4.7(b),CN-L3|8.1.4.8(b),CSCv7|16.4,CSCv8|3.11,CSF|PR.AC-1,CSF|PR.DS-1,CSF2.0|PR.AA-01,CSF2.0|PR.AA-03,CSF2.0|PR.DS-01,GDPR|32.1.a,GDPR|32.1.b,HIPAA|164.306(a)(1),HIPAA|164.312(a)(2)(i),HIPAA|164.312(a)(2)(iv),HIPAA|164.312(d),HIPAA|164.312(e)(2)(ii),ISO-27001-2022|A.5.10,ISO-27001-2022|A.5.16,ISO-27001-2022|A.5.17,ISO-27001-2022|A.5.33,ITSG-33|IA-5(1),ITSG-33|SC-28,ITSG-33|SC-28a.,ITSG-33|SC-28(1),LEVEL|1A,NESA|T5.2.3,PCI-DSSv3.2.1|3.4,PCI-DSSv4.0|3.3.2,PCI-DSSv4.0|3.5.1,QCSC-v1|5.2.2,QCSC-v1|6.2,QCSC-v1|13.2,SWIFT-CSCv1|4.1,TBA-FIISB|28.1" see_also : "https://workbench.cisecurity.org/benchmarks/20333" file : "/etc/login.defs" regex : "^\\s*ENCRYPT_METHOD\\s+" expect : "^\\s*ENCRYPT_METHOD\\s+(?i)@PASSWORD_ENCRYPTION_LOGIN@(?-i)\\s*$" type : CMD_EXEC description : "useradd - INACTIVE" cmd : "/usr/sbin/useradd -D | /bin/grep INACTIVE" expect : "^[\\s]*INACTIVE[\\s]*=[\\s]*@INACTIVE_PASSWORD_LOCK@[\\s]*$" type : FILE_CONTENT_CHECK description : "shadow inactive password lock" file : "/etc/shadow" regex : "^[^:]+:[^!*]" expect : "^([^:]*:){6}@INACTIVE_PASSWORD_LOCK@:" string_required : NO description : "5.4.1.5 Ensure inactive password lock is configured" info : "User accounts that have been inactive for over a given period of time can be automatically disabled. INACTIVE - Defines the number of days after the password exceeded its maximum age where the user is expected to replace this password. The value is stored in the shadow password file. An input of 0 will disable an expired password with no delay. An input of -1 will blank the respective field in the shadow password file. 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 45 days or less that meets local site policy: # useradd -D -f Example: # useradd -D -f 45 Run the following command to modify user parameters for all users with a password set to a inactive age of 45 days or less that follows local site policy: # chage --inactive Example: # awk -F: '($2~/^\$.+\$/) {if($7 > 45 || $7 < 0)system (\"chage --inactive 45 \" $1)}' /etc/shadow" reference : "800-171|3.5.2,800-171r3|03.05.07,800-53|IA-5(1),800-53r5|IA-5(1),CSCv7|4.4,CSCv8|5.2,CSF|PR.AC-1,CSF2.0|PR.AA-01,CSF2.0|PR.AA-03,GDPR|32.1.b,HIPAA|164.306(a)(1),HIPAA|164.312(a)(2)(i),HIPAA|164.312(d),ISO-27001-2022|A.5.16,ISO-27001-2022|A.5.17,ITSG-33|IA-5(1),LEVEL|1A,NESA|T5.2.3,QCSC-v1|5.2.2,QCSC-v1|13.2,SWIFT-CSCv1|4.1" see_also : "https://workbench.cisecurity.org/benchmarks/20333" show_output : YES type : CMD_EXEC description : "5.4.1.6 Ensure all users last password change date is in the past" info : "All users should have a password change date in the past. If a user's recorded password change date is in the future, then they could bypass any set password expiration." 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.2,800-171r3|03.05.07,800-53|IA-5(1),800-53r5|IA-5(1),CSCv7|4.4,CSCv8|5.2,CSF|PR.AC-1,CSF2.0|PR.AA-01,CSF2.0|PR.AA-03,GDPR|32.1.b,HIPAA|164.306(a)(1),HIPAA|164.312(a)(2)(i),HIPAA|164.312(d),ISO-27001-2022|A.5.16,ISO-27001-2022|A.5.17,ITSG-33|IA-5(1),LEVEL|1A,NESA|T5.2.3,QCSC-v1|5.2.2,QCSC-v1|13.2,SWIFT-CSCv1|4.1" see_also : "https://workbench.cisecurity.org/benchmarks/20333" cmd : "#!/bin/bash { while IFS= read -r l_user; do l_change=$(date -d \"$(chage --list $l_user | grep '^Last password change' | cut -d: -f2 | grep -v 'never$')\" +%s) if [[ \"$l_change\" -gt \"$(date +%s)\" ]]; then echo \"User: \\\"$l_user\\\" last password change was \\\"$(chage --list $l_user | grep '^Last password change' | cut -d: -f2)\\\"\" fi done < <(awk -F: '/^[^:\\r]+:[^!*xX\\r]/{print $1}' /etc/shadow) } | /bin/awk '{print} END {if (NR == 0) print \"Pass\"}'" expect : "(?i)^[\\s]*\\**[\\s]*pass:?[\\s]*\\**$" description : "5.4.2.1 Ensure root is the only UID 0 account" info : "Any account with UID 0 has superuser privileges on the system. 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 the Recommendation \"Ensure access to the su command is restricted\"." solution : "Run the following command to change the root account UID to 0 : # usermod -u 0 root Modify any users other than root with UID 0 and assign them a new UID." reference : "800-171|3.1.5,800-171r3|03.01.06a.,800-53|AC-6(5),800-53r5|AC-6(5),CN-L3|8.1.10.6(a),CSF|PR.AC-4,CSF2.0|PR.AA-05,GDPR|32.1.b,HIPAA|164.306(a)(1),HIPAA|164.312(a)(1),ISO-27001-2022|A.5.15,ISO-27001-2022|A.8.2,ISO-27001-2022|A.8.18,ISO/IEC-27001|A.9.2.3,ITSG-33|AC-6(5),LEVEL|1A,NESA|T5.1.1,NESA|T5.2.2,NESA|T5.6.1,NIAv2|AM32,NIAv2|AM33,NIAv2|VL3a,PCI-DSSv3.2.1|7.1.2,PCI-DSSv4.0|7.2.1,PCI-DSSv4.0|7.2.2,QCSC-v1|5.2.2,QCSC-v1|6.2,SWIFT-CSCv1|1.2,TBA-FIISB|31.4.2,TBA-FIISB|31.4.3" see_also : "https://workbench.cisecurity.org/benchmarks/20333" name : "passwd_zero_uid" type : CMD_EXEC description : "5.4.2.2 Ensure root is the only GID 0 account" info : "The usermod command can be used to specify which group the root account belongs to. This affects permissions of files that are created by the root account. 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's GID to 0 : # usermod -g 0 root Run the following command to set the root group's GID to 0 : # groupmod -g 0 root Remove any users other than the root user with GID 0 or assign them a new GID if appropriate." reference : "800-171|3.1.1,800-171|3.1.4,800-171|3.1.5,800-171|3.8.1,800-171|3.8.2,800-171|3.8.3,800-171r3|03.01.02,800-171r3|03.01.04,800-171r3|03.01.05a.,800-171r3|03.08.02,800-53|AC-3,800-53|AC-5,800-53|AC-6,800-53|MP-2,800-53r5|AC-3,800-53r5|AC-5,800-53r5|AC-6,800-53r5|MP-2,CN-L3|7.1.3.2(b),CN-L3|7.1.3.2(g),CN-L3|8.1.4.2(d),CN-L3|8.1.4.2(f),CN-L3|8.1.4.11(b),CN-L3|8.1.10.2(c),CN-L3|8.1.10.6(a),CN-L3|8.5.3.1,CN-L3|8.5.4.1(a),CSCv7|14.6,CSCv8|3.3,CSF|PR.AC-4,CSF|PR.DS-5,CSF|PR.PT-2,CSF|PR.PT-3,CSF2.0|PR.AA-05,CSF2.0|PR.DS-10,CSF2.0|PR.IR-01,GDPR|32.1.b,HIPAA|164.306(a)(1),HIPAA|164.312(a)(1),ISO-27001-2022|A.5.3,ISO-27001-2022|A.5.10,ISO-27001-2022|A.5.15,ISO-27001-2022|A.5.33,ISO-27001-2022|A.7.7,ISO-27001-2022|A.7.10,ISO-27001-2022|A.8.2,ISO-27001-2022|A.8.3,ISO-27001-2022|A.8.18,ISO-27001-2022|A.8.20,ISO/IEC-27001|A.6.1.2,ISO/IEC-27001|A.9.4.1,ISO/IEC-27001|A.9.4.5,ITSG-33|AC-3,ITSG-33|AC-5,ITSG-33|AC-6,ITSG-33|MP-2,ITSG-33|MP-2a.,LEVEL|1A,NESA|T1.3.2,NESA|T1.3.3,NESA|T1.4.1,NESA|T4.2.1,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.2,NESA|T7.5.3,NIAv2|AM1,NIAv2|AM3,NIAv2|AM23f,NIAv2|SS13c,NIAv2|SS15c,NIAv2|SS29,PCI-DSSv3.2.1|7.1.2,PCI-DSSv4.0|7.2.1,PCI-DSSv4.0|7.2.2,QCSC-v1|3.2,QCSC-v1|5.2.2,QCSC-v1|6.2,QCSC-v1|13.2,SWIFT-CSCv1|5.1,TBA-FIISB|31.1,TBA-FIISB|31.4.2,TBA-FIISB|31.4.3" see_also : "https://workbench.cisecurity.org/benchmarks/20333" cmd : "#!/bin/bash l_output=\"\" l_output2=\"\" l_out2=\"\" while IFS=: read -r l_user l_gid; do while IFS= read -r l_passwd_file_user; do if [ \"$l_passwd_file_user\" != \"$l_user\" ]; then l_out2=\"$l_out2\\n - User \\\"$l_passwd_file_user\\\" GID is: \\\"$l_gid\\\"\" fi done < <(awk -F: '($1 !~ /^(sync|shutdown|halt|operator)/ && $4 == \"'\"$l_gid\"'\"){print $1}' /etc/passwd) if [ -n \"$l_out2\" ]; then l_output2=\"$l_output2\\n$l_out2\" else l_output=\"$l_output\\n - No unauthorized user's GID is: \\\"$l_gid\\\"\" fi l_out2=\"\" while IFS= read -r l_passwd_file_gid; do if [ \"$l_passwd_file_gid\" != \"$l_gid\" ]; then l_out2=\"$l_out2\\n - User \\\"$l_user\\\" GID is: \\\"$l_passwd_file_gid\\\" and should be: \\\"$l_gid\\\"\" fi done < <(awk -F: '$1==\"'\"$l_user\"'\"{print $4}' /etc/passwd) if [ -n \"$l_out2\" ]; then l_output2=\"$l_output2\\n$l_out2\" else l_output=\"$l_output\\n - User \\\"$l_user\\\" GID is correctly set to: \\\"$l_gid\\\"\" fi done <<< \"root:0\" # If the tests produce no failing output, we pass if [ -z \"$l_output2\" ]; then echo -e \"\\n- Audit Result:\\n ** PASS **\\n - * Correctly configured * :$l_output\" else echo -e \"\\n- Audit Result:\\n ** FAIL **\\n - * Reasons for audit failure * :$l_output2\\n\" [ -n \"$l_output\" ] && echo -e \"\\n - * Correctly configured * :\\n$l_output\\n\" fi" expect : "(?i)^[\\s]*\\**[\\s]*pass:?[\\s]*\\**$" description : "5.4.2.3 Ensure group root is the only GID 0 group" info : "The groupmod command can be used to specify which group the root group belongs to. This affects permissions of files that are group owned by the root group. Using GID 0 for the root group helps prevent root group owned files from accidentally becoming accessible to non-privileged users." solution : "Run the following command to set the root group's GID to 0 : # groupmod -g 0 root Remove any groups other than the root group with GID 0 or assign them a new GID if appropriate." reference : "800-171|3.1.1,800-171|3.1.4,800-171|3.1.5,800-171|3.8.1,800-171|3.8.2,800-171|3.8.3,800-171r3|03.01.02,800-171r3|03.01.04,800-171r3|03.01.05a.,800-171r3|03.08.02,800-53|AC-3,800-53|AC-5,800-53|AC-6,800-53|MP-2,800-53r5|AC-3,800-53r5|AC-5,800-53r5|AC-6,800-53r5|MP-2,CN-L3|7.1.3.2(b),CN-L3|7.1.3.2(g),CN-L3|8.1.4.2(d),CN-L3|8.1.4.2(f),CN-L3|8.1.4.11(b),CN-L3|8.1.10.2(c),CN-L3|8.1.10.6(a),CN-L3|8.5.3.1,CN-L3|8.5.4.1(a),CSCv7|14.6,CSCv8|3.3,CSF|PR.AC-4,CSF|PR.DS-5,CSF|PR.PT-2,CSF|PR.PT-3,CSF2.0|PR.AA-05,CSF2.0|PR.DS-10,CSF2.0|PR.IR-01,GDPR|32.1.b,HIPAA|164.306(a)(1),HIPAA|164.312(a)(1),ISO-27001-2022|A.5.3,ISO-27001-2022|A.5.10,ISO-27001-2022|A.5.15,ISO-27001-2022|A.5.33,ISO-27001-2022|A.7.7,ISO-27001-2022|A.7.10,ISO-27001-2022|A.8.2,ISO-27001-2022|A.8.3,ISO-27001-2022|A.8.18,ISO-27001-2022|A.8.20,ISO/IEC-27001|A.6.1.2,ISO/IEC-27001|A.9.4.1,ISO/IEC-27001|A.9.4.5,ITSG-33|AC-3,ITSG-33|AC-5,ITSG-33|AC-6,ITSG-33|MP-2,ITSG-33|MP-2a.,LEVEL|1A,NESA|T1.3.2,NESA|T1.3.3,NESA|T1.4.1,NESA|T4.2.1,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.2,NESA|T7.5.3,NIAv2|AM1,NIAv2|AM3,NIAv2|AM23f,NIAv2|SS13c,NIAv2|SS15c,NIAv2|SS29,PCI-DSSv3.2.1|7.1.2,PCI-DSSv4.0|7.2.1,PCI-DSSv4.0|7.2.2,QCSC-v1|3.2,QCSC-v1|5.2.2,QCSC-v1|6.2,QCSC-v1|13.2,SWIFT-CSCv1|5.1,TBA-FIISB|31.1,TBA-FIISB|31.4.2,TBA-FIISB|31.4.3" see_also : "https://workbench.cisecurity.org/benchmarks/20333" name : "group_zero_gid" type : CMD_EXEC description : "5.4.2.4 Ensure root account access is controlled" info : "There are a number of methods to access the root account directly. Without a password set any user would be able to gain access and thus control over the entire system. Access to root should be secured at all times." solution : "Run the following command to set a password for the root user: # passwd root - OR - Run the following command to lock the root user account: # usermod -L root Impact: If there are any automated processes that relies on access to the root account without authentication, they will fail after remediation." reference : "800-171|3.1.1,800-171|3.1.4,800-171|3.1.5,800-171|3.8.1,800-171|3.8.2,800-171|3.8.3,800-171r3|03.01.02,800-171r3|03.01.04,800-171r3|03.01.05a.,800-171r3|03.08.02,800-53|AC-3,800-53|AC-5,800-53|AC-6,800-53|MP-2,800-53r5|AC-3,800-53r5|AC-5,800-53r5|AC-6,800-53r5|MP-2,CN-L3|7.1.3.2(b),CN-L3|7.1.3.2(g),CN-L3|8.1.4.2(d),CN-L3|8.1.4.2(f),CN-L3|8.1.4.11(b),CN-L3|8.1.10.2(c),CN-L3|8.1.10.6(a),CN-L3|8.5.3.1,CN-L3|8.5.4.1(a),CSCv7|14.6,CSCv8|3.3,CSF|PR.AC-4,CSF|PR.DS-5,CSF|PR.PT-2,CSF|PR.PT-3,CSF2.0|PR.AA-05,CSF2.0|PR.DS-10,CSF2.0|PR.IR-01,GDPR|32.1.b,HIPAA|164.306(a)(1),HIPAA|164.312(a)(1),ISO-27001-2022|A.5.3,ISO-27001-2022|A.5.10,ISO-27001-2022|A.5.15,ISO-27001-2022|A.5.33,ISO-27001-2022|A.7.7,ISO-27001-2022|A.7.10,ISO-27001-2022|A.8.2,ISO-27001-2022|A.8.3,ISO-27001-2022|A.8.18,ISO-27001-2022|A.8.20,ISO/IEC-27001|A.6.1.2,ISO/IEC-27001|A.9.4.1,ISO/IEC-27001|A.9.4.5,ITSG-33|AC-3,ITSG-33|AC-5,ITSG-33|AC-6,ITSG-33|MP-2,ITSG-33|MP-2a.,LEVEL|1A,NESA|T1.3.2,NESA|T1.3.3,NESA|T1.4.1,NESA|T4.2.1,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.2,NESA|T7.5.3,NIAv2|AM1,NIAv2|AM3,NIAv2|AM23f,NIAv2|SS13c,NIAv2|SS15c,NIAv2|SS29,PCI-DSSv3.2.1|7.1.2,PCI-DSSv4.0|7.2.1,PCI-DSSv4.0|7.2.2,QCSC-v1|3.2,QCSC-v1|5.2.2,QCSC-v1|6.2,QCSC-v1|13.2,SWIFT-CSCv1|5.1,TBA-FIISB|31.1,TBA-FIISB|31.4.2,TBA-FIISB|31.4.3" see_also : "https://workbench.cisecurity.org/benchmarks/20333" cmd : "/bin/passwd -S root | /bin/awk '$2 ~ /^(P|L)/ {print \"User: \\\"\" $1 \"\\\" Password is status: \" $2}'" expect : "(?i)^User: \"root\" Password is status: (P|L)$" type : CMD_EXEC description : "5.4.2.5 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. 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: - Locations that are not directories - Empty directories ( :: ) - Trailing ( : ) - Current working directory ( ) - Non root owned directories - Directories that less restrictive than mode 0755" reference : "800-171|3.4.7,800-171r3|03.04.06,800-53|CM-7(2),800-53r5|CM-7(2),CSF|PR.IP-1,CSF|PR.PT-3,CSF2.0|PR.PS-01,GDPR|32.1.b,HIPAA|164.306(a)(1),ITSG-33|CM-7(2),LEVEL|1A,NIAv2|SS15a,PCI-DSSv3.2.1|2.2.2,QCSC-v1|3.2,SWIFT-CSCv1|2.3" see_also : "https://workbench.cisecurity.org/benchmarks/20333" cmd : "#!/bin/bash { l_output2=\"\" l_pmask=\"0022\" l_maxperm=\"$( printf '%o' $(( 0777 & ~$l_pmask )) )\" l_root_path=\"$(sudo -Hiu root env | grep '^PATH' | cut -d= -f2)\" unset a_path_loc && IFS=\":\" read -ra a_path_loc <<< \"$l_root_path\" grep -q \"::\" <<< \"$l_root_path\" && l_output2=\"$l_output2 - root's path contains a empty directory (::)\" grep -Pq \":\\h*$\" <<< \"$l_root_path\" && l_output2=\"$l_output2 - root's path contains a trailing (:)\" grep -Pq '(\\h+|:)\\.(:|\\h*$)' <<< \"$l_root_path\" && l_output2=\"$l_output2 - root's path contains current working directory (.)\" while read -r l_path; do if [ -d \"$l_path\" ]; then while read -r l_fmode l_fown; do [ \"$l_fown\" != \"root\" ] && l_output2=\"$l_output2 - Directory: \\\"$l_path\\\" is owned by: \\\"$l_fown\\\" should be owned by \\\"root\\\"\" [ $(( $l_fmode & $l_pmask )) -gt 0 ] && l_output2=\"$l_output2 - Directory: \\\"$l_path\\\" is mode: \\\"$l_fmode\\\" and should be mode: \\\"$l_maxperm\\\" or more restrictive\" done <<< \"$(stat -Lc '%#a %U' \"$l_path\")\" else l_output2=\"$l_output2 - \\\"$l_path\\\" is not a directory\" fi done <<< \"$(printf \"%s \" \"${a_path_loc[@]}\")\" if [ -z \"$l_output2\" ]; then echo -e \" - Audit Result: *** PASS *** - Root's path is correctly configured \" else echo -e \" - Audit Result: ** FAIL ** - * Reasons for audit failure * : $l_output2 \" fi }" expect : "(?i)^[\\s]*\\**[\\s]*pass:?[\\s]*\\**$" type : FILE_CONTENT_CHECK_NOT description : "5.4.2.6 Ensure root user umask is configured" info : "The user file-creation mode mask ( umask ) is used to determine the file permission for newly created directories and files. In Linux, the default permissions for any newly created directory is 0777 ( rwxrwxrwx ), and for any newly created file it is 0666 ( rw-rw-rw- ). The umask modifies the default Linux permissions by restricting (masking) these permissions. The umask is not simply subtracted, but is processed bitwise. Bits set in the umask are cleared in the resulting file mode. umask can be set with either Octal or Symbolic values: - Octal (Numeric) Value - Represented by either three or four digits. ie umask 0027 or umask 027 If a four digit umask is used, the first digit is ignored. The remaining three digits effect the resulting permissions for user, group, and world/other respectively. - Symbolic Value - Represented by a comma separated list for User u group g and world/other o The permissions listed are not masked by umask ie a umask set by umask u=rwx,g=rx,o= is the Symbolic equivalent of the Octal umask 027 This umask would set a newly created directory with file mode drwxr-x--- and a newly created file with file mode rw-r----- root user Shell Configuration Files: - /root/.bash_profile - Is executed to configure the root users' shell before the initial command prompt. Is only read by login shells. - /root/.bashrc - Is executed for interactive shells. only read by a shell that's both interactive and non-login umask is set by order of precedence. If umask is set in multiple locations, this order of precedence will determine the system's default umask Order of precedence: - /root/.bash_profile - /root/.bashrc - The system default umask Setting a secure value for umask ensures that users make a conscious choice about their file permissions. A permissive umask value could result in directories or files with excessive permissions that can be read and/or written to by unauthorized users." solution : "Edit /root/.bash_profile and /root/.bashrc and remove, comment out, or update any line with umask to be 0027 or more restrictive." reference : "800-171|3.1.1,800-171|3.1.4,800-171|3.1.5,800-171|3.8.1,800-171|3.8.2,800-171|3.8.3,800-171r3|03.01.02,800-171r3|03.01.04,800-171r3|03.01.05a.,800-171r3|03.08.02,800-53|AC-3,800-53|AC-5,800-53|AC-6,800-53|MP-2,800-53r5|AC-3,800-53r5|AC-5,800-53r5|AC-6,800-53r5|MP-2,CN-L3|7.1.3.2(b),CN-L3|7.1.3.2(g),CN-L3|8.1.4.2(d),CN-L3|8.1.4.2(f),CN-L3|8.1.4.11(b),CN-L3|8.1.10.2(c),CN-L3|8.1.10.6(a),CN-L3|8.5.3.1,CN-L3|8.5.4.1(a),CSCv7|14.6,CSCv8|3.3,CSF|PR.AC-4,CSF|PR.DS-5,CSF|PR.PT-2,CSF|PR.PT-3,CSF2.0|PR.AA-05,CSF2.0|PR.DS-10,CSF2.0|PR.IR-01,GDPR|32.1.b,HIPAA|164.306(a)(1),HIPAA|164.312(a)(1),ISO-27001-2022|A.5.3,ISO-27001-2022|A.5.10,ISO-27001-2022|A.5.15,ISO-27001-2022|A.5.33,ISO-27001-2022|A.7.7,ISO-27001-2022|A.7.10,ISO-27001-2022|A.8.2,ISO-27001-2022|A.8.3,ISO-27001-2022|A.8.18,ISO-27001-2022|A.8.20,ISO/IEC-27001|A.6.1.2,ISO/IEC-27001|A.9.4.1,ISO/IEC-27001|A.9.4.5,ITSG-33|AC-3,ITSG-33|AC-5,ITSG-33|AC-6,ITSG-33|MP-2,ITSG-33|MP-2a.,LEVEL|1A,NESA|T1.3.2,NESA|T1.3.3,NESA|T1.4.1,NESA|T4.2.1,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.2,NESA|T7.5.3,NIAv2|AM1,NIAv2|AM3,NIAv2|AM23f,NIAv2|SS13c,NIAv2|SS15c,NIAv2|SS29,PCI-DSSv3.2.1|7.1.2,PCI-DSSv4.0|7.2.1,PCI-DSSv4.0|7.2.2,QCSC-v1|3.2,QCSC-v1|5.2.2,QCSC-v1|6.2,QCSC-v1|13.2,SWIFT-CSCv1|5.1,TBA-FIISB|31.1,TBA-FIISB|31.4.2,TBA-FIISB|31.4.3" see_also : "https://workbench.cisecurity.org/benchmarks/20333" file : "/root/.bash_profile /root/.bashrc" regex : "(?i)^\\h*umask\\h+(([0-7][0-7][01][0-7]\\b|[0-7][0-7][0-7][0-6]\\b)|([0-7][01][0-7]\\b|[0-7][0-7][0-6]\\b)|(u=[rwx]{1,3},)?(((g=[rx]?[rx]?w[rx]?[rx]?\\b)(,o=[rwx]{1,3})?)|((g=[wrx]{1,3},)?o=[wrx]{1,3}\\b)))" expect : "(?i)^\\h*umask\\h+(([0-7][0-7][01][0-7]\\b|[0-7][0-7][0-7][0-6]\\b)|([0-7][01][0-7]\\b|[0-7][0-7][0-6]\\b)|(u=[rwx]{1,3},)?(((g=[rx]?[rx]?w[rx]?[rx]?\\b)(,o=[rwx]{1,3})?)|((g=[wrx]{1,3},)?o=[wrx]{1,3}\\b)))" type : CMD_EXEC description : "5.4.2.7 Ensure system accounts do not have a valid 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. Furthermore, a user may add special accounts that are not intended to provide an interactive shell. 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 password file be set to the nologin shell. This prevents the account from potentially being used to run any commands." solution : "Run the following command to set the shell for any service accounts returned by the audit to nologin : # usermod -s $(command -v nologin) Example script: #!/usr/bin/env bash { l_valid_shells=\"^($( awk -F\/ '$NF != \"nologin\" {print}' /etc/shells | sed -rn '/^\//{s,/,\\\\/,g;p}' | paste -s -d '|' - ))$\" awk -v pat=\"$l_valid_shells\" -F: '($1!~/^(root|halt|sync|shutdown|nfsnobody)$/ && ($3<'\"$(awk '/^\s*UID_MIN/{print $2}' /etc/login.defs)\"' || $3 == 65534) && $(NF) ~ pat) {system (\"usermod -s '\"$(command -v nologin)\"' \" $1)}' /etc/passwd }" reference : "800-171|3.1.1,800-171|3.1.4,800-171|3.1.5,800-171|3.8.1,800-171|3.8.2,800-171|3.8.3,800-171r3|03.01.02,800-171r3|03.01.04,800-171r3|03.01.05a.,800-171r3|03.08.02,800-53|AC-3,800-53|AC-5,800-53|AC-6,800-53|MP-2,800-53r5|AC-3,800-53r5|AC-5,800-53r5|AC-6,800-53r5|MP-2,CN-L3|7.1.3.2(b),CN-L3|7.1.3.2(g),CN-L3|8.1.4.2(d),CN-L3|8.1.4.2(f),CN-L3|8.1.4.11(b),CN-L3|8.1.10.2(c),CN-L3|8.1.10.6(a),CN-L3|8.5.3.1,CN-L3|8.5.4.1(a),CSCv7|14.6,CSCv8|3.3,CSF|PR.AC-4,CSF|PR.DS-5,CSF|PR.PT-2,CSF|PR.PT-3,CSF2.0|PR.AA-05,CSF2.0|PR.DS-10,CSF2.0|PR.IR-01,GDPR|32.1.b,HIPAA|164.306(a)(1),HIPAA|164.312(a)(1),ISO-27001-2022|A.5.3,ISO-27001-2022|A.5.10,ISO-27001-2022|A.5.15,ISO-27001-2022|A.5.33,ISO-27001-2022|A.7.7,ISO-27001-2022|A.7.10,ISO-27001-2022|A.8.2,ISO-27001-2022|A.8.3,ISO-27001-2022|A.8.18,ISO-27001-2022|A.8.20,ISO/IEC-27001|A.6.1.2,ISO/IEC-27001|A.9.4.1,ISO/IEC-27001|A.9.4.5,ITSG-33|AC-3,ITSG-33|AC-5,ITSG-33|AC-6,ITSG-33|MP-2,ITSG-33|MP-2a.,LEVEL|1A,NESA|T1.3.2,NESA|T1.3.3,NESA|T1.4.1,NESA|T4.2.1,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.2,NESA|T7.5.3,NIAv2|AM1,NIAv2|AM3,NIAv2|AM23f,NIAv2|SS13c,NIAv2|SS15c,NIAv2|SS29,PCI-DSSv3.2.1|7.1.2,PCI-DSSv4.0|7.2.1,PCI-DSSv4.0|7.2.2,QCSC-v1|3.2,QCSC-v1|5.2.2,QCSC-v1|6.2,QCSC-v1|13.2,SWIFT-CSCv1|5.1,TBA-FIISB|31.1,TBA-FIISB|31.4.2,TBA-FIISB|31.4.3" see_also : "https://workbench.cisecurity.org/benchmarks/20333" cmd : "#!/bin/bash { l_valid_shells=\"^($(awk -F\\/ '$NF != \"nologin\" {print}' /etc/shells | sed -rn '/^\\//{s,/,\\\\\\\\/,g;p}' | paste -s -d '|' - ))$\" awk -v pat=\"$l_valid_shells\" -F: '($1!~/^(root|halt|sync|shutdown|nfsnobody)$/ && ($3<'\"$(awk '/^\\s*UID_MIN/{print $2}' /etc/login.defs)\"' || $3 == 65534) && $(NF) ~ pat) {print \"Service account: \\\"\" $1 \"\\\" has a valid shell: \" $7}' /etc/passwd } | /bin/awk '{ print } END { if (NR == 0) print \"pass\" }'" expect : "^pass$" type : CMD_EXEC description : "5.4.2.8 Ensure accounts without a valid login shell are locked" info : "There are a number of accounts provided with most distributions that are used to manage applications. Additionally, a administrator may add special accounts that are not intended for interactive use. It is important to make sure that accounts that are not intended for interactive use are prevented from being used interactively. By default, most distributions set the password field for these accounts to an invalid string, but it is also recommended that these accounts are locked. This prevents these accounts from potentially being used to run any commands." solution : "Run the following command to lock any non-root accounts without a valid login shell returned by the audit: # usermod -L Example script: : #!/usr/bin/env bash { l_valid_shells=\"^($(awk -F\/ '$NF != \"nologin\" {print}' /etc/shells | sed -rn '/^\//{s,/,\\\\/,g;p}' | paste -s -d '|' - ))$\" while IFS= read -r l_user; do passwd -S \"$l_user\" | awk '$2 !~ /^L/ {system (\"usermod -L \" $1)}' done < <(awk -v pat=\"$l_valid_shells\" -F: '($1 != \"root\" && $(NF) !~ pat) {print $1}' /etc/passwd) }" reference : "800-171|3.1.1,800-171|3.1.4,800-171|3.1.5,800-171|3.8.1,800-171|3.8.2,800-171|3.8.3,800-171r3|03.01.02,800-171r3|03.01.04,800-171r3|03.01.05a.,800-171r3|03.08.02,800-53|AC-3,800-53|AC-5,800-53|AC-6,800-53|MP-2,800-53r5|AC-3,800-53r5|AC-5,800-53r5|AC-6,800-53r5|MP-2,CN-L3|7.1.3.2(b),CN-L3|7.1.3.2(g),CN-L3|8.1.4.2(d),CN-L3|8.1.4.2(f),CN-L3|8.1.4.11(b),CN-L3|8.1.10.2(c),CN-L3|8.1.10.6(a),CN-L3|8.5.3.1,CN-L3|8.5.4.1(a),CSCv7|14.6,CSCv8|3.3,CSF|PR.AC-4,CSF|PR.DS-5,CSF|PR.PT-2,CSF|PR.PT-3,CSF2.0|PR.AA-05,CSF2.0|PR.DS-10,CSF2.0|PR.IR-01,GDPR|32.1.b,HIPAA|164.306(a)(1),HIPAA|164.312(a)(1),ISO-27001-2022|A.5.3,ISO-27001-2022|A.5.10,ISO-27001-2022|A.5.15,ISO-27001-2022|A.5.33,ISO-27001-2022|A.7.7,ISO-27001-2022|A.7.10,ISO-27001-2022|A.8.2,ISO-27001-2022|A.8.3,ISO-27001-2022|A.8.18,ISO-27001-2022|A.8.20,ISO/IEC-27001|A.6.1.2,ISO/IEC-27001|A.9.4.1,ISO/IEC-27001|A.9.4.5,ITSG-33|AC-3,ITSG-33|AC-5,ITSG-33|AC-6,ITSG-33|MP-2,ITSG-33|MP-2a.,LEVEL|1A,NESA|T1.3.2,NESA|T1.3.3,NESA|T1.4.1,NESA|T4.2.1,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.2,NESA|T7.5.3,NIAv2|AM1,NIAv2|AM3,NIAv2|AM23f,NIAv2|SS13c,NIAv2|SS15c,NIAv2|SS29,PCI-DSSv3.2.1|7.1.2,PCI-DSSv4.0|7.2.1,PCI-DSSv4.0|7.2.2,QCSC-v1|3.2,QCSC-v1|5.2.2,QCSC-v1|6.2,QCSC-v1|13.2,SWIFT-CSCv1|5.1,TBA-FIISB|31.1,TBA-FIISB|31.4.2,TBA-FIISB|31.4.3" see_also : "https://workbench.cisecurity.org/benchmarks/20333" cmd : "#!/bin/bash { l_valid_shells=\"^($(awk -F\\/ '$NF != \"nologin\" {print}' /etc/shells | sed -rn '/^\\//{s,/,\\\\\\\\/,g;p}' | paste -s -d '|' - ))$\" while IFS= read -r l_user; do passwd -S \"$l_user\" | awk '$2 !~ /^L/ {print \"Account: \\\"\" $1 \"\\\" does not have a valid login shell and is not locked\"}' done < <(awk -v pat=\"$l_valid_shells\" -F: '($1 != \"root\" && $(NF) !~ pat) {print $1}' /etc/passwd) } | /bin/awk '{ print } END { if (NR == 0) print \"pass\" }'" expect : "^pass$" type : CMD_EXEC description : "5.4.3.2 Ensure default user shell timeout is configured" info : "TMOUT is an environmental setting that determines the timeout of a shell in seconds. - TMOUT= n - Sets the shell timeout to n seconds. A setting of TMOUT=0 disables timeout. - readonly TMOUT- Sets the TMOUT environmental variable as readonly, preventing unwanted modification during run-time. - export TMOUT - exports the TMOUT variable System Wide Shell Configuration Files: - /etc/profile - used to set system wide environmental variables on users shells. The variables are sometimes the same ones that are in thebash_profile however this file is used to set an initial PATH or PS1 for all shell users of the system. is only executed for interactive login shells, or shells executed with the --login parameter. - /etc/profile.d - /etc/profile will execute the scripts within /etc/profile.d/*.sh It is recommended to place your configuration in a shell script within /etc/profile.d to set your own system wide environmental variables. - /etc/bash.bashrc - System wide version ofbashrc In Fedora derived distributions, /etc/bashrc also invokes /etc/profile.d/*.sh if non-login shell, but redirects output to /dev/null if non-interactive. Is only executed for interactive shells or if BASH_ENV is set to /etc/bash.bashrc Setting a timeout value reduces the window of opportunity for unauthorized user access to another user's shell session that has been left unattended. It also ends the inactive session and releases the resources associated with that session." solution : "Review /etc/bashrc /etc/profile and all files ending in *.sh in the /etc/profile.d/ directory and remove or edit all TMOUT=_n_ entries to follow local site policy. TMOUT should not exceed 900 or be equal to 0 Configure TMOUT in one of the following files: - A file in the /etc/profile.d/ directory ending insh - /etc/profile - /etc/bashrc Example command to set TMOUT to 900 seconds in a file in /etc/profile.d/ : # printf '%s\n' \"# Set TMOUT to 900 seconds\" \"typeset -xr TMOUT=900\" > /etc/profile.d/50-tmout.sh TMOUT configuration examples: typeset -xr TMOUT=900 Deprecated methods: - As multiple lines: TMOUT=900 readonly TMOUT export TMOUT - As a single line: readonly TMOUT=900 ; export TMOUT" reference : "800-171|3.1.1,800-171|3.1.10,800-171|3.1.11,800-171r3|03.01.01h.,800-171r3|03.01.10,800-171r3|03.01.11,800-53|AC-2(5),800-53|AC-11,800-53|AC-11(1),800-53|AC-12,800-53r5|AC-2(5),800-53r5|AC-11,800-53r5|AC-11(1),800-53r5|AC-12,CN-L3|7.1.2.2(d),CN-L3|7.1.3.2(d),CN-L3|7.1.3.7(b),CN-L3|8.1.4.1(b),CSCv7|16.11,CSCv8|4.3,CSF|PR.AC-1,CSF|PR.AC-4,CSF2.0|DE.CM-01,CSF2.0|DE.CM-03,CSF2.0|PR.AA-01,CSF2.0|PR.AA-03,CSF2.0|PR.AA-05,CSF2.0|PR.DS-10,GDPR|32.1.b,HIPAA|164.306(a)(1),HIPAA|164.312(a)(1),HIPAA|164.312(a)(2)(iii),ISO-27001-2022|A.5.16,ISO-27001-2022|A.5.18,ISO-27001-2022|A.7.7,ISO-27001-2022|A.8.1,ISO-27001-2022|A.8.2,ISO/IEC-27001|A.9.2.1,ISO/IEC-27001|A.11.2.8,ITSG-33|AC-2(5),ITSG-33|AC-11,ITSG-33|AC-11(1),ITSG-33|AC-12,LEVEL|1A,NIAv2|AM23c,NIAv2|AM23d,NIAv2|AM28,NIAv2|NS5j,NIAv2|NS49,NIAv2|SS14e,PCI-DSSv3.2.1|8.1.8,PCI-DSSv4.0|8.2.8,QCSC-v1|5.2.2,QCSC-v1|8.2.1,QCSC-v1|13.2,QCSC-v1|15.2,TBA-FIISB|36.2.1,TBA-FIISB|37.1.4" see_also : "https://workbench.cisecurity.org/benchmarks/20333" cmd : "#!/bin/bash { a_output=(); a_output2=(); l_tmout_set=\"900\" f_tmout_read_chk() { a_out=(); a_out2=() l_tmout_readonly=\"$(grep -P -- '^\\h*(typeset\\h\\-xr\\hTMOUT=\\d+|([^#\\n\\r]+)?\\breadonly\\h+TMOUT\\b)' \"$l_file\")\" l_tmout_export=\"$(grep -P -- '^\\h*(typeset\\h\\-xr\\hTMOUT=\\d+|([^#\\n\\r]+)?\\bexport\\b([^#\\n\\r]+\\b)?TMOUT\\b)' \"$l_file\")\" if [ -n \"$l_tmout_readonly\" ]; then a_out+=(\" - Readonly is set as: \\\"$l_tmout_readonly\\\" in: \\\"$l_file\\\"\") else a_out2+=(\" - Readonly is not set in: \\\"$l_file\\\"\") fi if [ -n \"$l_tmout_export\" ]; then a_out+=(\" - Export is set as: \\\"$l_tmout_export\\\" in: \\\"$l_file\\\"\") else a_out2+=(\" - Export is not set in: \\\"$l_file\\\"\") fi } while IFS= read -r l_file; do l_tmout_value=\"$(grep -Po -- '^([^#\\n\\r]+)?\\bTMOUT=\\d+\\b' \"$l_file\" | awk -F= '{print $2}')\" f_tmout_read_chk if [ -n \"$l_tmout_value\" ]; then if [[ \"$l_tmout_value\" -le \"$l_tmout_set\" && \"$l_tmout_value\" -gt \"0\" ]]; then a_output+=(\" - TMOUT is set to: \\\"$l_tmout_value\\\" in: \\\"$l_file\\\"\") [ \"${#a_out[@]}\" -gt 0 ] && a_output+=(\"${a_out[@]}\") [ \"${#a_out2[@]}\" -gt 0 ] && a_output2+=(\"${a_out[@]}\") fi if [[ \"$l_tmout_value\" -gt \"$l_tmout_set\" || \"$l_tmout_value\" -le \"0\" ]]; then a_output2+=(\" - TMOUT is incorrectly set to: \\\"$l_tmout_value\\\" in: \\\"$l_file\\\"\") [ \"${#a_out[@]}\" -gt 0 ] && a_output2+=(\" ** Incorrect TMOUT value **\" \"${a_out[@]}\") [ \"${#a_out2[@]}\" -gt 0 ] && a_output2+=(\"${a_out2[@]}\") fi else [ \"${#a_out[@]}\" -gt 0 ] && a_output2+=(\" - TMOUT is not set\" \"${a_out[@]}\") [ \"${#a_out2[@]}\" -gt 0 ] && a_output2+=(\" - TMOUT is not set\" \"${a_out2[@]}\") fi done < <(grep -Pls -- '^([^#\\n\\r]+)?\\bTMOUT\\b' /etc/*bashrc /etc/profile /etc/profile.d/*.sh) [[ \"${#a_output[@]}\" -le 0 && \"${#a_output2[@]}\" -le 0 ]] && a_output2+=(\" - TMOUT is not configured\") if [ \"${#a_output2[@]}\" -le 0 ]; then printf '%s\\n' \"\" \"- Audit Result:\" \" ** PASS **\" \"${a_output[@]}\" else printf '%s\\n' \"\" \"- Audit Result:\" \" ** FAIL **\" \" * Reasons for audit failure *\" \"${a_output2[@]}\" \"\" [ \"${#a_output[@]}\" -gt 0 ] && printf '%s\\n' \"- Correctly set:\" \"${a_output[@]}\" fi }" expect : "(?i)^[\\s]*\\**[\\s]*pass:?[\\s]*\\**$" type : CMD_EXEC description : "5.4.3.3 Ensure default user umask is configured" info : "The user file-creation mode mask ( umask ) is used to determine the file permission for newly created directories and files. In Linux, the default permissions for any newly created directory is 0777 ( rwxrwxrwx ), and for any newly created file it is 0666 ( rw-rw-rw- ). The umask modifies the default Linux permissions by restricting (masking) these permissions. The umask is not simply subtracted, but is processed bitwise. Bits set in the umask are cleared in the resulting file mode. umask can be set with either Octal or Symbolic values: - Octal (Numeric) Value - Represented by either three or four digits. ie umask 0027 or umask 027 If a four digit umask is used, the first digit is ignored. The remaining three digits effect the resulting permissions for user, group, and world/other respectively. - Symbolic Value - Represented by a comma separated list for User u group g and world/other o The permissions listed are not masked by umask ie a umask set by umask u=rwx,g=rx,o= is the Symbolic equivalent of the Octal umask 027 This umask would set a newly created directory with file mode drwxr-x--- and a newly created file with file mode rw-r----- The default umask can be set to use the pam_umask module or in a System Wide Shell Configuration File The user creating the directories or files has the discretion of changing the permissions via the chmod command, or choosing a different default umask by adding the umask command into a User Shell Configuration File (bash_profile orbashrc ), in their home directory. Setting the default umask: - pam_umask module: - will set the umask according to the system default in /etc/login.defs and user settings, solving the problem of different umask settings with different shells, display managers, remote sessions etc. - umask= value in the /etc/login.defs file is interpreted as Octal - Setting USERGROUPS_ENAB to yes in /etc/login.defs (default): - will enable setting of the umask group bits to be the same as owner bits. (examples: 022 -> 002, 077 -> 007) for non-root users, if the uid is the same as gid and username is the same as the - userdel will remove the user's group if it contains no more members, and useradd will create by default a group with the name of the user - System Wide Shell Configuration File : - /etc/profile - used to set system wide environmental variables on users shells. The variables are sometimes the same ones that are in thebash_profile however this file is used to set an initial PATH or PS1 for all shell users of the system. is only executed for interactive login shells, or shells executed with the --login parameter. - /etc/profile.d - /etc/profile will execute the scripts within /etc/profile.d/*.sh It is recommended to place your configuration in a shell script within /etc/profile.d to set your own system wide environmental variables. - /etc/bashrc - System wide version ofbashrc In Fedora derived distributions, etc/bashrc also invokes /etc/profile.d/*.sh if non-login shell, but redirects output to /dev/null if non-interactive. Is only executed for interactive shells or if BASH_ENV is set to /etc/bashrc User Shell Configuration Files: - ~/.bash_profile - Is executed to configure your shell before the initial command prompt. Is only read by login shells. - ~/.bashrc - Is executed for interactive shells. only read by a shell that's both interactive and non-login umask is set by order of precedence. If umask is set in multiple locations, this order of precedence will determine the system's default umask Order of precedence: - A file in /etc/profile.d/ ending insh - This will override any other system-wide umask setting - In the file /etc/profile - On the pam_umask.so module in /etc/pam.d/postlogin - In the file /etc/login.defs - In the file /etc/default/login Setting a secure default value for umask ensures that users make a conscious choice about their file permissions. A permissive umask value could result in directories or files with excessive permissions that can be read and/or written to by unauthorized users." solution : "Run the following script and perform the instructions in the output to set the default umask to 027 or more restrictive: #!/usr/bin/env bash { l_output=\"\" l_output2=\"\" l_out=\"\" file_umask_chk() { if grep -Psiq -- '^\h*umask\h+(0?[0-7][2-7]7|u(=[rwx]{0,3}),g=([rx]{0,2}),o=)(\h*#.*)?$' \"$l_file\"; then l_out=\"$l_out\n - umask is set correctly in \\\"$l_file\\\"\" elif grep -Psiq -- '^\h*umask\h+(([0-7][0-7][01][0-7]\b|[0-7][0-7][0-7][0-6]\b)|([0-7][01][0-7]\b|[0-7][0-7][0-6]\b)|(u=[rwx]{1,3},)?(((g=[rx]?[rx]?w[rx]?[rx]?\b)(,o=[rwx]{1,3})?)|((g=[wrx]{1,3},)?o=[wrx]{1,3}\b)))' \"$l_file\"; then l_output2=\"$l_output2\n - \\\"$l_file\\\"\" fi } while IFS= read -r -d $'\0' l_file; do file_umask_chk done < <(find /etc/profile.d/ -type f -name '*.sh' -print0) [ -n \"$l_out\" ] && l_output=\"$l_out\" l_file=\"/etc/profile\" && file_umask_chk l_file=\"/etc/bashrc\" && file_umask_chk l_file=\"/etc/bash.bashrc\" && file_umask_chk l_file=\"/etc/pam.d/postlogin\" if grep -Psiq '^\h*session\h+[^#\n\r]+\h+pam_umask\.so\h+([^#\n\r]+\h+)?umask=(([0-7][0-7][01][0-7]\b|[0-7][0-7][0-7][0-6]\b)|([0-7][01][0-7]\b))' \"$l_file\"; then l_output2=\"$l_output2\n - \\\"$l_file\\\"\" fi l_file=\"/etc/login.defs\" && file_umask_chk l_file=\"/etc/default/login\" && file_umask_chk if [ -z \"$l_output2\" ]; then echo -e \" - No files contain a UMASK that is not restrictive enough\n No UMASK updates required to existing files\" else echo -e \"\n - UMASK is not restrictive enough in the following file(s):$l_output2\n\n- Remediation Procedure:\n - Update these files and comment out the UMASK line\n or update umask to be \\\"0027\\\" or more restrictive\" fi if [ -n \"$l_output\" ]; then echo -e \"$l_output\" else echo -e \" - Configure UMASK in a file in the \\\"/etc/profile.d/\\\" directory ending in \\\".sh\\\"\n\n Example Command (Hash to represent being run at a root prompt):\n\n# printf '%s\\\n' \\\"umask 027\\\" > /etc/profile.d/50-systemwide_umask.sh\n\" fi } Notes: - This method only applies to bash and shell. If other shells are supported on the system, it is recommended that their configuration files also are checked - If the pam_umask.so module is going to be used to set umask ensure that it's not being overridden by another setting. Refer to the PAM_UMASK(8) man page for more information" reference : "800-171|3.1.1,800-171|3.1.4,800-171|3.1.5,800-171|3.8.1,800-171|3.8.2,800-171|3.8.3,800-171r3|03.01.02,800-171r3|03.01.04,800-171r3|03.01.05a.,800-171r3|03.08.02,800-53|AC-3,800-53|AC-5,800-53|AC-6,800-53|MP-2,800-53r5|AC-3,800-53r5|AC-5,800-53r5|AC-6,800-53r5|MP-2,CN-L3|7.1.3.2(b),CN-L3|7.1.3.2(g),CN-L3|8.1.4.2(d),CN-L3|8.1.4.2(f),CN-L3|8.1.4.11(b),CN-L3|8.1.10.2(c),CN-L3|8.1.10.6(a),CN-L3|8.5.3.1,CN-L3|8.5.4.1(a),CSCv7|14.6,CSCv8|3.3,CSF|PR.AC-4,CSF|PR.DS-5,CSF|PR.PT-2,CSF|PR.PT-3,CSF2.0|PR.AA-05,CSF2.0|PR.DS-10,CSF2.0|PR.IR-01,GDPR|32.1.b,HIPAA|164.306(a)(1),HIPAA|164.312(a)(1),ISO-27001-2022|A.5.3,ISO-27001-2022|A.5.10,ISO-27001-2022|A.5.15,ISO-27001-2022|A.5.33,ISO-27001-2022|A.7.7,ISO-27001-2022|A.7.10,ISO-27001-2022|A.8.2,ISO-27001-2022|A.8.3,ISO-27001-2022|A.8.18,ISO-27001-2022|A.8.20,ISO/IEC-27001|A.6.1.2,ISO/IEC-27001|A.9.4.1,ISO/IEC-27001|A.9.4.5,ITSG-33|AC-3,ITSG-33|AC-5,ITSG-33|AC-6,ITSG-33|MP-2,ITSG-33|MP-2a.,LEVEL|1A,NESA|T1.3.2,NESA|T1.3.3,NESA|T1.4.1,NESA|T4.2.1,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.2,NESA|T7.5.3,NIAv2|AM1,NIAv2|AM3,NIAv2|AM23f,NIAv2|SS13c,NIAv2|SS15c,NIAv2|SS29,PCI-DSSv3.2.1|7.1.2,PCI-DSSv4.0|7.2.1,PCI-DSSv4.0|7.2.2,QCSC-v1|3.2,QCSC-v1|5.2.2,QCSC-v1|6.2,QCSC-v1|13.2,SWIFT-CSCv1|5.1,TBA-FIISB|31.1,TBA-FIISB|31.4.2,TBA-FIISB|31.4.3" see_also : "https://workbench.cisecurity.org/benchmarks/20333" cmd : "#!/bin/bash { l_output=\"\" l_output2=\"\" file_umask_chk() { if grep -Psiq -- '^\\h*umask\\h+(0?[0-7][2-7]7|u(=[rwx]{0,3}),g=([rx]{0,2}),o=)(\\h*#.*)?$' \"$l_file\"; then l_output=\"$l_output\\n - umask is set correctly in \\\"$l_file\\\"\" elif grep -Psiq -- '^\\h*umask\\h+(([0-7][0-7][01][0-7]\\b|[0-7][0-7][0-7][0-6]\\b)|([0-7][01][0-7]\\b|[0-7][0-7][0-6]\\b)|(u=[rwx]{1,3},)?(((g=[rx]?[rx]?w[rx]?[rx]?\\b)(,o=[rwx]{1,3})?)|((g=[wrx]{1,3},)?o=[wrx]{1,3}\\b)))' \"$l_file\"; then l_output2=\"$l_output2\\n - umask is incorrectly set in \\\"$l_file\\\"\" fi } while IFS= read -r -d $'\\0' l_file; do file_umask_chk done < <(find /etc/profile.d/ -type f -name '*.sh' -print0) [ -z \"$l_output\" ] && l_file=\"/etc/profile\" && file_umask_chk [ -z \"$l_output\" ] && l_file=\"/etc/bashrc\" && file_umask_chk [ -z \"$l_output\" ] && l_file=\"/etc/bash.bashrc\" && file_umask_chk [ -z \"$l_output\" ] && l_file=\"/etc/pam.d/postlogin\" if [ -z \"$l_output\" ]; then if grep -Psiq -- '^\\h*session\\h+[^#\\n\\r]+\\h+pam_umask\\.so\\h+([^#\\n\\r]+\\h+)?umask=(0?[0-7][2-7]7)\\b' \"$l_file\"; then l_output1=\"$l_output1\\n - umask is set correctly in \\\"$l_file\\\"\" elif grep -Psiq '^\\h*session\\h+[^#\\n\\r]+\\h+pam_umask\\.so\\h+([^#\\n\\r]+\\h+)?umask=(([0-7][0-7][01][0-7]\\b|[0-7][0-7][0-7][0-6]\\b)|([0-7][01][0-7]\\b))' \"$l_file\"; then l_output2=\"$l_output2\\n - umask is incorrectly set in \\\"$l_file\\\"\" fi fi [ -z \"$l_output\" ] && l_file=\"/etc/login.defs\" && file_umask_chk [ -z \"$l_output\" ] && l_file=\"/etc/default/login\" && file_umask_chk [[ -z \"$l_output\" && -z \"$l_output2\" ]] && l_output2=\"$l_output2\\n - umask is not set\" if [ -z \"$l_output2\" ]; then echo -e \"\\n- Audit Result:\\n ** PASS **\\n - * Correctly configured * :\\n$l_output\\n\" else echo -e \"\\n- Audit Result:\\n ** FAIL **\\n - * Reasons for audit failure * :\\n$l_output2\" [ -n \"$l_output\" ] && echo -e \"\\n- * Correctly configured * :\\n$l_output\\n\" fi }" expect : "(?i)^[\\s]*\\**[\\s]*pass:?[\\s]*\\**$" type : RPM_CHECK description : "6.1.1 Ensure AIDE is installed" info : "Advanced Intrusion Detection Environment (AIDE) is a intrusion detection tool that uses predefined rules to check the integrity of files and directories in the Linux operating system. AIDE has its own database to check the integrity of files and directories. aide takes a snapshot of files and directories 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. 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 : # zypper install aide Configure aide as appropriate for your environment. Consult the aide documentation for options. Initialize aide : Run the following commands: # aide -i # mv /var/lib/aide/aide.db.new /var/lib/aide/aide.db" reference : "800-171|3.1.7,800-171|3.3.1,800-171|3.3.2,800-171r3|03.01.07b.,800-171r3|03.03.01,800-171r3|03.03.03,800-53|AC-6(9),800-53|AU-2,800-53|AU-12,800-53r5|AC-6(9),800-53r5|AU-2,800-53r5|AU-12,CN-L3|7.1.3.2(b),CN-L3|7.1.3.2(g),CN-L3|8.1.4.2(d),CN-L3|8.1.4.3(a),CN-L3|8.1.10.6(a),CSCv7|14.9,CSCv8|3.14,CSF|DE.CM-1,CSF|DE.CM-3,CSF|DE.CM-7,CSF|PR.AC-4,CSF|PR.PT-1,CSF2.0|DE.CM-01,CSF2.0|DE.CM-03,CSF2.0|DE.CM-09,CSF2.0|PR.AA-05,CSF2.0|PR.PS-04,GDPR|32.1.b,HIPAA|164.306(a)(1),HIPAA|164.312(a)(1),HIPAA|164.312(b),ISO-27001-2022|A.5.15,ISO-27001-2022|A.8.2,ISO-27001-2022|A.8.15,ISO-27001-2022|A.8.18,ISO/IEC-27001|A.12.4.3,ITSG-33|AC-6,ITSG-33|AU-2,ITSG-33|AU-12,LEVEL|1A,NESA|M1.2.2,NESA|M5.5.1,NESA|T5.1.1,NESA|T5.2.2,NESA|T5.5.4,NESA|T7.5.3,NIAv2|AM1,NIAv2|AM7,NIAv2|AM11a,NIAv2|AM11b,NIAv2|AM11c,NIAv2|AM11d,NIAv2|AM11e,NIAv2|AM23f,NIAv2|SS13c,NIAv2|SS15c,NIAv2|SS30,NIAv2|VL8,PCI-DSSv3.2.1|7.1.2,PCI-DSSv3.2.1|10.1,PCI-DSSv4.0|7.2.1,PCI-DSSv4.0|7.2.2,QCSC-v1|3.2,QCSC-v1|5.2.2,QCSC-v1|6.2,QCSC-v1|8.2.1,QCSC-v1|13.2,SWIFT-CSCv1|5.1,SWIFT-CSCv1|6.4,TBA-FIISB|31.4.2,TBA-FIISB|31.4.3" see_also : "https://workbench.cisecurity.org/benchmarks/20333" rpm : "aide-0.0.0-0" operator : "gt" required : YES type : FILE_CONTENT_CHECK description : "Check for crontab aide" file : "/etc/cron.* /etc/cron.d/* /etc/crontab /var/spool/cron/*" regex : "^([^#]+\\s+)?(/usr/s?bin/|^\\s*)aide(\\.wrapper)?\\s(--?\\S+\\s)*(--(check|update)|\\$AIDEARGS)\\b" expect : "^([^#]+\\s+)?(/usr/s?bin/|^\\s*)aide(\\.wrapper)?\\s(--?\\S+\\s)*(--(check|update)|\\$AIDEARGS)\\b" required : NO min_occurrences : "1" description : "6.1.2 Ensure filesystem integrity is regularly checked" info : "Periodic checking of the filesystem integrity is needed to detect changes to the filesystem. Periodic file checking allows the system administrator to determine on a regular basis if critical files have been changed in an unauthorized fashion." solution : "- IF - cron will be used to schedule and run aide check Run the following command: # crontab -u root -e Add the following line to the crontab: 0 5 * * * /usr/bin/aide --check - OR - - IF - aidecheck.service and aidecheck.timer will be used to schedule and run aide check: Create or edit the file /etc/systemd/system/aidecheck.service and add the following lines: [Unit] Description=Aide Check [Service] Type=simple ExecStart=/usr/bin/aide --check [Install] WantedBy=multi-user.target Create or edit the file /etc/systemd/system/aidecheck.timer and add the following lines: [Unit] Description=Aide check every day at 5AM [Timer] OnCalendar=*-*-* 05:00:00 Unit=aidecheck.service [Install] WantedBy=multi-user.target Run the following commands: # chown root:root /etc/systemd/system/aidecheck.* # chmod 0644 /etc/systemd/system/aidecheck.* # systemctl daemon-reload # systemctl enable aidecheck.service # systemctl --now enable aidecheck.timer" reference : "800-171|3.1.7,800-171|3.3.1,800-171|3.3.2,800-171r3|03.01.07b.,800-171r3|03.03.01,800-171r3|03.03.03,800-53|AC-6(9),800-53|AU-2,800-53|AU-12,800-53r5|AC-6(9),800-53r5|AU-2,800-53r5|AU-12,CN-L3|7.1.3.2(b),CN-L3|7.1.3.2(g),CN-L3|8.1.4.2(d),CN-L3|8.1.4.3(a),CN-L3|8.1.10.6(a),CSCv7|14.9,CSCv8|3.14,CSF|DE.CM-1,CSF|DE.CM-3,CSF|DE.CM-7,CSF|PR.AC-4,CSF|PR.PT-1,CSF2.0|DE.CM-01,CSF2.0|DE.CM-03,CSF2.0|DE.CM-09,CSF2.0|PR.AA-05,CSF2.0|PR.PS-04,GDPR|32.1.b,HIPAA|164.306(a)(1),HIPAA|164.312(a)(1),HIPAA|164.312(b),ISO-27001-2022|A.5.15,ISO-27001-2022|A.8.2,ISO-27001-2022|A.8.15,ISO-27001-2022|A.8.18,ISO/IEC-27001|A.12.4.3,ITSG-33|AC-6,ITSG-33|AU-2,ITSG-33|AU-12,LEVEL|1A,NESA|M1.2.2,NESA|M5.5.1,NESA|T5.1.1,NESA|T5.2.2,NESA|T5.5.4,NESA|T7.5.3,NIAv2|AM1,NIAv2|AM7,NIAv2|AM11a,NIAv2|AM11b,NIAv2|AM11c,NIAv2|AM11d,NIAv2|AM11e,NIAv2|AM23f,NIAv2|SS13c,NIAv2|SS15c,NIAv2|SS30,NIAv2|VL8,PCI-DSSv3.2.1|7.1.2,PCI-DSSv3.2.1|10.1,PCI-DSSv4.0|7.2.1,PCI-DSSv4.0|7.2.2,QCSC-v1|3.2,QCSC-v1|5.2.2,QCSC-v1|6.2,QCSC-v1|8.2.1,QCSC-v1|13.2,SWIFT-CSCv1|5.1,SWIFT-CSCv1|6.4,TBA-FIISB|31.4.2,TBA-FIISB|31.4.3" see_also : "https://workbench.cisecurity.org/benchmarks/20333" show_output : YES type : CMD_EXEC description : "systemctl is-enabled aidecheck.timer" cmd : "/usr/bin/systemctl is-enabled aidecheck.timer | /bin/awk '{print} END {if(NR==0) print \"disabled\" }'" expect : "^enabled$" type : CMD_EXEC description : "systemctl status aidecheck.timer" cmd : "/usr/bin/systemctl status aidecheck.timer | /usr/bin/awk '{print} END {if(NR==0) print \"disabled\" }'" expect : "^[\\s]*Active:[\\s]*active[\\s]*\\((running|waiting)\\).*$" type : CMD_EXEC description : "systemctl is-enabled aidecheck.service" cmd : "/usr/bin/systemctl is-enabled aidecheck.service | /bin/awk '{print} END {if(NR==0) print \"disabled\" }'" expect : "^enabled$" description : "6.1.2 Ensure filesystem integrity is regularly checked" info : "Periodic checking of the filesystem integrity is needed to detect changes to the filesystem. Periodic file checking allows the system administrator to determine on a regular basis if critical files have been changed in an unauthorized fashion." solution : "- IF - cron will be used to schedule and run aide check Run the following command: # crontab -u root -e Add the following line to the crontab: 0 5 * * * /usr/bin/aide --check - OR - - IF - aidecheck.service and aidecheck.timer will be used to schedule and run aide check: Create or edit the file /etc/systemd/system/aidecheck.service and add the following lines: [Unit] Description=Aide Check [Service] Type=simple ExecStart=/usr/bin/aide --check [Install] WantedBy=multi-user.target Create or edit the file /etc/systemd/system/aidecheck.timer and add the following lines: [Unit] Description=Aide check every day at 5AM [Timer] OnCalendar=*-*-* 05:00:00 Unit=aidecheck.service [Install] WantedBy=multi-user.target Run the following commands: # chown root:root /etc/systemd/system/aidecheck.* # chmod 0644 /etc/systemd/system/aidecheck.* # systemctl daemon-reload # systemctl enable aidecheck.service # systemctl --now enable aidecheck.timer" reference : "800-171|3.1.7,800-171|3.3.1,800-171|3.3.2,800-171r3|03.01.07b.,800-171r3|03.03.01,800-171r3|03.03.03,800-53|AC-6(9),800-53|AU-2,800-53|AU-12,800-53r5|AC-6(9),800-53r5|AU-2,800-53r5|AU-12,CN-L3|7.1.3.2(b),CN-L3|7.1.3.2(g),CN-L3|8.1.4.2(d),CN-L3|8.1.4.3(a),CN-L3|8.1.10.6(a),CSCv7|14.9,CSCv8|3.14,CSF|DE.CM-1,CSF|DE.CM-3,CSF|DE.CM-7,CSF|PR.AC-4,CSF|PR.PT-1,CSF2.0|DE.CM-01,CSF2.0|DE.CM-03,CSF2.0|DE.CM-09,CSF2.0|PR.AA-05,CSF2.0|PR.PS-04,GDPR|32.1.b,HIPAA|164.306(a)(1),HIPAA|164.312(a)(1),HIPAA|164.312(b),ISO-27001-2022|A.5.15,ISO-27001-2022|A.8.2,ISO-27001-2022|A.8.15,ISO-27001-2022|A.8.18,ISO/IEC-27001|A.12.4.3,ITSG-33|AC-6,ITSG-33|AU-2,ITSG-33|AU-12,LEVEL|1A,NESA|M1.2.2,NESA|M5.5.1,NESA|T5.1.1,NESA|T5.2.2,NESA|T5.5.4,NESA|T7.5.3,NIAv2|AM1,NIAv2|AM7,NIAv2|AM11a,NIAv2|AM11b,NIAv2|AM11c,NIAv2|AM11d,NIAv2|AM11e,NIAv2|AM23f,NIAv2|SS13c,NIAv2|SS15c,NIAv2|SS30,NIAv2|VL8,PCI-DSSv3.2.1|7.1.2,PCI-DSSv3.2.1|10.1,PCI-DSSv4.0|7.2.1,PCI-DSSv4.0|7.2.2,QCSC-v1|3.2,QCSC-v1|5.2.2,QCSC-v1|6.2,QCSC-v1|8.2.1,QCSC-v1|13.2,SWIFT-CSCv1|5.1,SWIFT-CSCv1|6.4,TBA-FIISB|31.4.2,TBA-FIISB|31.4.3" see_also : "https://workbench.cisecurity.org/benchmarks/20333" show_output : YES type : CMD_EXEC description : "6.1.3 Ensure cryptographic mechanisms are used to protect the integrity of audit tools" info : "Audit tools include, but are not limited to, vendor-provided and open source audit tools needed to successfully view and manipulate audit information system activity and records. Audit tools include custom queries and report generators. Protecting the integrity of the tools used for auditing purposes is a critical step toward ensuring the integrity of audit information. Audit information includes all information (e.g., audit records, audit settings, and audit reports) needed to successfully audit information system activity. Attackers may replace the audit tools or inject code into the existing tools with the purpose of providing the capability to hide or erase system activity from the audit logs. Audit tools should be cryptographically signed in order to provide the capability to identify when the audit tools have been modified, manipulated, or replaced. An example is a checksum hash of the file or files." solution : "Run the following command to determine the absolute path to the non-symlinked version of the audit tools: # readlink -f /sbin The output will be either /usr/sbin - OR - /sbin Ensure the correct path is used. Edit /etc/aide.conf and add or update the following selection lines replacing with the correct path returned in the command above: # Audit Tools /auditctl p+i+n+u+g+s+b+acl+xattrs+sha512 /auditd p+i+n+u+g+s+b+acl+xattrs+sha512 /ausearch p+i+n+u+g+s+b+acl+xattrs+sha512 /aureport p+i+n+u+g+s+b+acl+xattrs+sha512 /autrace p+i+n+u+g+s+b+acl+xattrs+sha512 /augenrules p+i+n+u+g+s+b+acl+xattrs+sha512 Example # printf '\n%s' \"# Audit Tools\" \"$(readlink -f /sbin/auditctl) p+i+n+u+g+s+b+acl+xattrs+sha512\" \"$(readlink -f /sbin/auditd) p+i+n+u+g+s+b+acl+xattrs+sha512\" \"$(readlink -f /sbin/ausearch) p+i+n+u+g+s+b+acl+xattrs+sha512\" \"$(readlink -f /sbin/aureport) p+i+n+u+g+s+b+acl+xattrs+sha512\" \"$(readlink -f /sbin/autrace) p+i+n+u+g+s+b+acl+xattrs+sha512\" \"$(readlink -f /sbin/augenrules) p+i+n+u+g+s+b+acl+xattrs+sha512\" >> /etc/aide.conf Note: - IF - /etc/aide.conf includes a @@x_include statement: Example: @@x_include /etc/aide.conf.d ^[a-zA-Z0-9_-]+$ - @@x_include FILE - @@x_include DIRECTORY REGEX - @@x_include is identical to @@include except that if a config file is executable it is run and the output is used as config. - If the executable file exits with status greater than zero or writes to stderr aide stops with an error. - For security reasons DIRECTORY and each executable config file must be owned by the current user and must not be group or world-writable." reference : "800-53|SI-7,800-53r5|SI-7,CSF|PR.DS-6,CSF2.0|DE.CM-09,CSF2.0|ID.RA-09,CSF2.0|PR.DS-01,CSF2.0|PR.DS-02,CSF2.0|PR.DS-10,CSF2.0|PR.PS-02,GDPR|32.1.b,HIPAA|164.306(a)(1),HIPAA|164.312(c)(1),HIPAA|164.312(c)(2),HIPAA|164.312(e)(2)(i),ITSG-33|SI-7,ITSG-33|SI-7a.,LEVEL|1A,NESA|T3.4.1,NESA|T7.3.2,NESA|T7.3.3,PCI-DSSv3.2.1|10.5.5,QCSC-v1|3.2" see_also : "https://workbench.cisecurity.org/benchmarks/20333" cmd : "#!/bin/bash { a_output=();a_output2=();a_output3=();a_parlist=() l_systemd_analyze=\"$(whereis systemd-analyze | awk '{print $2}')\" a_audit_files=(\"auditctl\" \"auditd\" \"ausearch\" \"aureport\" \"autrace\" \"augenrules\") f_parameter_chk() { for l_tool_file in \"${a_parlist[@]}\"; do if grep -Pq -- '\\b'\"$l_tool_file\"'\\b' <<< \"${!A_out[*]}\"; then for l_string in \"${!A_out[@]}\"; do l_check=\"$(grep -Po -- '^\\h*(\\/usr)?\\/sbin\\/'\"$l_tool_file\"'\\b' <<< \"$l_string\")\" if [ -n \"$l_check\" ]; then l_fname=\"$(printf '%s' \"${A_out[$l_string]}\")\" [ \"$l_check\" != \"$(readlink -f \"$l_check\")\" ] && \\ a_output3+=(\" - \\\"$l_check\\\" should be updated to: \\\"$(readlink -f \"$l_check\")\\\"\" \" in: \\\"$l_fname\\\"\") a_missing=() for l_var in \"${a_items[@]}\"; do if ! grep -Pq -- \"\\b$l_var\\b\" <<< \"$l_string\"; then a_missing+=(\"\\\"$l_var\\\"\") fi done if [ \"${#a_missing[@]}\" -gt 0 ]; then a_output2+=(\" - Option(s): ( ${a_missing[*]} ) are missing from: \\\"$l_tool_file\\\" in: \\\"$l_fname\\\"\") else a_output+=(\" - Audit tool file \\\"$l_tool_file\\\" exists as:\" \" \\\"$l_string\\\"\" \" in the configuration file: \\\"$l_fname\\\"\") fi fi done else a_output2+=(\" - Audit tool file \\\"$l_tool_file\\\" doesn't exist in an AIDE configuration file\") fi done } f_aide_conf() { l_config_file=\"$(whereis aide.conf | awk '{print $2}')\" if [ -f \"$l_config_file\" ]; then a_items=(\"p\" \"i\" \"n\" \"u\" \"g\" \"s\" \"b\" \"acl\" \"xattrs\" \"sha512\") declare -A A_out while IFS= read -r l_out; do if grep -Pq -- '^\\h*\\#\\h*\\/[^#\\n\\r]+\\.conf\\b' <<< \"$l_out\"; then l_file=\"${l_out//# /}\" else for i in \"${a_parlist[@]}\"; do grep -Pq -- '^\\h*(\\/usr)?\\/sbin\\/'\"$i\"'\\b' <<< \"$l_out\" && A_out+=([\"$l_out\"]=\"$l_file\") done fi done < <(\"$l_systemd_analyze\" cat-config \"$l_config_file\" | grep -Pio '^\\h*([^#\\n\\r]+|#\\h*\\/[^#\\n\\r\\h]+\\.conf\\b)') if [ \"${#A_out[@]}\" -gt 0 ]; then f_parameter_chk else a_output2+=(\" - No audit tool files are configured in an AIDE configuration file\") fi else a_output2+=(\" - AIDE configuration file not found.\" \" Please verify AIDE is installed on the system\") fi } for l_audit_file in \"${a_audit_files[@]}\"; do if [ -f \"$(readlink -f \"/sbin/$l_audit_file\")\" ]; then a_parlist+=(\"$l_audit_file\") else a_output+=(\" - Audit tool file \\\"$(readlink -f \"/sbin/$l_audit_file\")\\\" doesn't exist\") fi done [ \"${#a_parlist[@]}\" -gt 0 ] && f_aide_conf if [ \"${#a_output2[@]}\" -le 0 ]; then printf '%s\\n' \"\" \"- Audit Result:\" \" ** PASS **\" \"${a_output[@]}\" [ \"${#a_output3[@]}\" -gt 0 ] && printf '%s\\n' \"\" \" ** WARNING **\" \"${a_output3[@]}\" else printf '%s\\n' \"\" \"- Audit Result:\" \" ** FAIL **\" \" * Reasons for audit failure *\" \"${a_output2[@]}\" \"\" [ \"${#a_output3[@]}\" -gt 0 ] && printf '%s\\n' \"\" \" ** WARNING **\" \"${a_output3[@]}\" [ \"${#a_output[@]}\" -gt 0 ] && printf '%s\\n' \"- Correctly set:\" \"${a_output[@]}\" fi }" expect : "(?i)^[\\s]*\\**[\\s]*pass:?" type : CMD_EXEC description : "journald check - active" cmd : "/bin/systemctl is-active systemd-journald.service" expect : "^active$" type : CMD_EXEC description : "journald check - enabled" cmd : "/bin/systemctl is-enabled systemd-journald.service" expect : "^static$" description : "6.2.1.1 Ensure journald service is enabled and active" info : "Ensure that the systemd-journald service is enabled to allow capturing of logging events. If the systemd-journald service is not enabled to start on boot, the system will not capture logging events." solution : "Run the following commands to unmask and start systemd-journald.service # systemctl unmask systemd-journald.service # systemctl start systemd-journald.service" reference : "800-171|3.3.1,800-171|3.3.2,800-171|3.3.6,800-171r3|03.03.01,800-171r3|03.03.03,800-171r3|03.03.06a.,800-53|AU-2,800-53|AU-7,800-53|AU-12,800-53r5|AU-2,800-53r5|AU-7,800-53r5|AU-12,CN-L3|7.1.2.3(c),CN-L3|8.1.4.3(a),CSCv7|6.2,CSCv7|6.3,CSCv8|8.2,CSF|DE.CM-1,CSF|DE.CM-3,CSF|DE.CM-7,CSF|PR.PT-1,CSF|RS.AN-3,CSF2.0|DE.CM-01,CSF2.0|DE.CM-03,CSF2.0|DE.CM-09,CSF2.0|PR.PS-04,CSF2.0|RS.AN-03,CSF2.0|RS.AN-06,CSF2.0|RS.AN-07,GDPR|32.1.b,HIPAA|164.306(a)(1),HIPAA|164.312(b),ISO-27001-2022|A.8.15,ITSG-33|AU-2,ITSG-33|AU-7,ITSG-33|AU-12,LEVEL|1A,NESA|M1.2.2,NESA|M5.5.1,NIAv2|AM7,NIAv2|AM11a,NIAv2|AM11b,NIAv2|AM11c,NIAv2|AM11d,NIAv2|AM11e,NIAv2|SS30,NIAv2|VL8,PCI-DSSv3.2.1|10.1,QCSC-v1|3.2,QCSC-v1|6.2,QCSC-v1|8.2.1,QCSC-v1|10.2.1,QCSC-v1|11.2,QCSC-v1|13.2,SWIFT-CSCv1|6.4" see_also : "https://workbench.cisecurity.org/benchmarks/20333" show_output : YES description : "6.2.1.2 Ensure journald log file access is configured" info : "Journald will create logfiles that do not already exist on the system. This setting controls what permissions will be applied to these newly created files. It is important to ensure that log files have the correct permissions to ensure that sensitive data is archived and protected. NOTE: Nessus has not performed this check. Please review the benchmark to ensure target compliance." solution : "If the default configuration is not appropriate for the site specific requirements, copy /usr/lib/tmpfiles.d/systemd.conf to /etc/tmpfiles.d/systemd.conf and modify as required. Requirements is either 0640 or site policy if that is less restrictive." reference : "800-171|3.1.1,800-171|3.1.4,800-171|3.1.5,800-171|3.8.1,800-171|3.8.2,800-171|3.8.3,800-171r3|03.01.02,800-171r3|03.01.04,800-171r3|03.01.05a.,800-171r3|03.08.02,800-53|AC-3,800-53|AC-5,800-53|AC-6,800-53|MP-2,800-53r5|AC-3,800-53r5|AC-5,800-53r5|AC-6,800-53r5|MP-2,CN-L3|7.1.3.2(b),CN-L3|7.1.3.2(g),CN-L3|8.1.4.2(d),CN-L3|8.1.4.2(f),CN-L3|8.1.4.11(b),CN-L3|8.1.10.2(c),CN-L3|8.1.10.6(a),CN-L3|8.5.3.1,CN-L3|8.5.4.1(a),CSCv7|14.6,CSCv8|3.3,CSF|PR.AC-4,CSF|PR.DS-5,CSF|PR.PT-2,CSF|PR.PT-3,CSF2.0|PR.AA-05,CSF2.0|PR.DS-10,CSF2.0|PR.IR-01,GDPR|32.1.b,HIPAA|164.306(a)(1),HIPAA|164.312(a)(1),ISO-27001-2022|A.5.3,ISO-27001-2022|A.5.10,ISO-27001-2022|A.5.15,ISO-27001-2022|A.5.33,ISO-27001-2022|A.7.7,ISO-27001-2022|A.7.10,ISO-27001-2022|A.8.2,ISO-27001-2022|A.8.3,ISO-27001-2022|A.8.18,ISO-27001-2022|A.8.20,ISO/IEC-27001|A.6.1.2,ISO/IEC-27001|A.9.4.1,ISO/IEC-27001|A.9.4.5,ITSG-33|AC-3,ITSG-33|AC-5,ITSG-33|AC-6,ITSG-33|MP-2,ITSG-33|MP-2a.,LEVEL|1M,NESA|T1.3.2,NESA|T1.3.3,NESA|T1.4.1,NESA|T4.2.1,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.2,NESA|T7.5.3,NIAv2|AM1,NIAv2|AM3,NIAv2|AM23f,NIAv2|SS13c,NIAv2|SS15c,NIAv2|SS29,PCI-DSSv3.2.1|7.1.2,PCI-DSSv4.0|7.2.1,PCI-DSSv4.0|7.2.2,QCSC-v1|3.2,QCSC-v1|5.2.2,QCSC-v1|6.2,QCSC-v1|13.2,SWIFT-CSCv1|5.1,TBA-FIISB|31.1,TBA-FIISB|31.4.2,TBA-FIISB|31.4.3" see_also : "https://workbench.cisecurity.org/benchmarks/20333" type : FILE_CONTENT_CHECK description : "6.2.1.3 Ensure journald log file rotation is configured" info : "Journald 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/systemd/journald.conf is the configuration file used to specify how logs generated by Journald should be rotated. 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 provided the target output to assist in reviewing the benchmark to ensure target compliance." solution : "Edit /etc/systemd/journald.conf or a file ending inconf the /etc/systemd/journald.conf.d/ directory. Set the following parameters in the [Journal] section to ensure logs are rotated according to site policy. The settings should be carefully understood as there are specific edge cases and prioritization of parameters. The specific parameters for log rotation are: SystemMaxUse= SystemKeepFree= RuntimeMaxUse= RuntimeKeepFree= MaxFileSec= Note: If these settings appear in a canonically later file, or later in the same file, the setting will be overwritten" reference : "800-171|3.3.1,800-171|3.3.2,800-171|3.3.6,800-171r3|03.03.01,800-171r3|03.03.03,800-171r3|03.03.06a.,800-53|AU-2,800-53|AU-7,800-53|AU-12,800-53r5|AU-2,800-53r5|AU-7,800-53r5|AU-12,CN-L3|7.1.2.3(c),CN-L3|8.1.4.3(a),CSCv7|6.2,CSCv7|6.3,CSCv8|8.2,CSF|DE.CM-1,CSF|DE.CM-3,CSF|DE.CM-7,CSF|PR.PT-1,CSF|RS.AN-3,CSF2.0|DE.CM-01,CSF2.0|DE.CM-03,CSF2.0|DE.CM-09,CSF2.0|PR.PS-04,CSF2.0|RS.AN-03,CSF2.0|RS.AN-06,CSF2.0|RS.AN-07,GDPR|32.1.b,HIPAA|164.306(a)(1),HIPAA|164.312(b),ISO-27001-2022|A.8.15,ITSG-33|AU-2,ITSG-33|AU-7,ITSG-33|AU-12,LEVEL|1M,NESA|M1.2.2,NESA|M5.5.1,NIAv2|AM7,NIAv2|AM11a,NIAv2|AM11b,NIAv2|AM11c,NIAv2|AM11d,NIAv2|AM11e,NIAv2|SS30,NIAv2|VL8,PCI-DSSv3.2.1|10.1,QCSC-v1|3.2,QCSC-v1|6.2,QCSC-v1|8.2.1,QCSC-v1|10.2.1,QCSC-v1|11.2,QCSC-v1|13.2,SWIFT-CSCv1|6.4" see_also : "https://workbench.cisecurity.org/benchmarks/20333" file : "/etc/systemd/journald.conf /etc/systemd/journald.conf.d/*" regex : "^[\\s]*(SystemMaxUse|SystemKeepFree|RuntimeMaxUse|RuntimeKeepFree|MaxFileSec)[\\s]*=" expect : "^Manual Review Required$" required : NO min_occurrences : "1" severity : MEDIUM type : CMD_EXEC description : "6.2.1.4 Ensure only one logging system is in use" info : "Best practices recommend that a single centralized logging system be used for log management, choose a single service either rsyslog - OR - journald to be used as a single centralized logging system. Configuring only one logging service either rsyslog - OR - journald avoids redundancy, optimizes resources, simplifies configuration and management, and ensures consistency." solution : "- Determine whether to use journald - OR - rsyslog depending on site needs - Configure systemd-jounald.service - Configure only ONE either journald - OR - rsyslog and complete the recommendations in that subsection - Return to this recommendation to ensure only one logging system is in use Impact: Transitioning from one logging service to another can be complex and time consuming, it involves reconfiguration and may result in data loss if not managed and reconfigured correctly." reference : "800-171|3.3.1,800-171|3.3.2,800-171r3|03.03.01,800-53|AU-2,800-53r5|AU-2,CN-L3|8.1.4.3(a),CSF|PR.PT-1,CSF2.0|PR.PS-04,GDPR|32.1.b,HIPAA|164.306(a)(1),HIPAA|164.312(b),ISO-27001-2022|A.8.15,ITSG-33|AU-2,LEVEL|1A,NESA|M1.2.2,NESA|M5.5.1,NIAv2|AM7,NIAv2|AM11a,NIAv2|AM11b,NIAv2|AM11c,NIAv2|AM11d,NIAv2|AM11e,NIAv2|SS30,NIAv2|VL8,QCSC-v1|8.2.1,QCSC-v1|13.2,SWIFT-CSCv1|6.4" see_also : "https://workbench.cisecurity.org/benchmarks/20333" cmd : "#!/bin/bash { l_output=\"\" l_output2=\"\" # Check the status of rsyslog and journald if systemctl is-active --quiet rsyslog; then l_output=\"$l_output\\n - rsyslog is in use\\n- follow the recommendations in Configure rsyslog subsection only\" elif systemctl is-active --quiet systemd-journald; then l_output=\"$l_output\\n - journald is in use\\n- follow the recommendations in Configure journald subsection only\" else echo -e \"unable to determine system logging\" l_output2=\"$l_output2\\n - unable to determine system logging\\n- Configure only ONE system logging: rsyslog OR journald\" fi if [ -z \"$l_output2\" ]; then # Provide audit results echo -e \"\\n- Audit Result:\\n ** PASS **\\n$l_output\\n\" else echo -e \"\\n- Audit Result:\\n ** FAIL **\\n - Reason(s) for audit failure:\\n$l_output2\" fi }" expect : "(?i)^[\\s]*\\**[\\s]*pass:?[\\s]*\\**$" type : CMD_EXEC description : "journald check - active" cmd : "/bin/systemctl is-active systemd-journald" expect : "^active$" type : CMD_EXEC description : "rsyslog check - active" cmd : "/bin/systemctl is-active rsyslog" expect : "^active$" type : CMD_EXEC description : "journald check - active" cmd : "/bin/systemctl is-active systemd-journald" expect : "^active$" type : RPM_CHECK description : "6.2.2.1.1 Ensure systemd-journal-remote is installed" info : "Journald systemd-journal-remote supports the ability to send log events it gathers to a remote log host or to receive messages from remote hosts, thus enabling centralized log management. 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. Note: This recommendation only applies if journald is the chosen method for client side logging Do not apply this recommendation if rsyslog is used." solution : "Run the following command to install systemd-journal-remote : # zypper install systemd-journal-remote" reference : "800-171|3.3.1,800-171|3.3.2,800-171|3.3.6,800-171r3|03.03.01,800-171r3|03.03.03,800-171r3|03.03.06a.,800-53|AU-2,800-53|AU-7,800-53|AU-12,800-53r5|AU-2,800-53r5|AU-7,800-53r5|AU-12,CN-L3|7.1.2.3(c),CN-L3|8.1.4.3(a),CSCv7|6.2,CSCv7|6.3,CSCv8|8.2,CSF|DE.CM-1,CSF|DE.CM-3,CSF|DE.CM-7,CSF|PR.PT-1,CSF|RS.AN-3,CSF2.0|DE.CM-01,CSF2.0|DE.CM-03,CSF2.0|DE.CM-09,CSF2.0|PR.PS-04,CSF2.0|RS.AN-03,CSF2.0|RS.AN-06,CSF2.0|RS.AN-07,GDPR|32.1.b,HIPAA|164.306(a)(1),HIPAA|164.312(b),ISO-27001-2022|A.8.15,ITSG-33|AU-2,ITSG-33|AU-7,ITSG-33|AU-12,LEVEL|1A,NESA|M1.2.2,NESA|M5.5.1,NIAv2|AM7,NIAv2|AM11a,NIAv2|AM11b,NIAv2|AM11c,NIAv2|AM11d,NIAv2|AM11e,NIAv2|SS30,NIAv2|VL8,PCI-DSSv3.2.1|10.1,QCSC-v1|3.2,QCSC-v1|6.2,QCSC-v1|8.2.1,QCSC-v1|10.2.1,QCSC-v1|11.2,QCSC-v1|13.2,SWIFT-CSCv1|6.4" see_also : "https://workbench.cisecurity.org/benchmarks/20333" rpm : "systemd-journal-remote-0.0.0-0" operator : "gt" required : YES description : "6.2.2.1.1 Ensure systemd-journal-remote is installed" info : "Journald systemd-journal-remote supports the ability to send log events it gathers to a remote log host or to receive messages from remote hosts, thus enabling centralized log management. 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. Note: This recommendation only applies if journald is the chosen method for client side logging Do not apply this recommendation if rsyslog is used." solution : "Run the following command to install systemd-journal-remote : # zypper install systemd-journal-remote" reference : "800-171|3.3.1,800-171|3.3.2,800-171|3.3.6,800-171r3|03.03.01,800-171r3|03.03.03,800-171r3|03.03.06a.,800-53|AU-2,800-53|AU-7,800-53|AU-12,800-53r5|AU-2,800-53r5|AU-7,800-53r5|AU-12,CN-L3|7.1.2.3(c),CN-L3|8.1.4.3(a),CSCv7|6.2,CSCv7|6.3,CSCv8|8.2,CSF|DE.CM-1,CSF|DE.CM-3,CSF|DE.CM-7,CSF|PR.PT-1,CSF|RS.AN-3,CSF2.0|DE.CM-01,CSF2.0|DE.CM-03,CSF2.0|DE.CM-09,CSF2.0|PR.PS-04,CSF2.0|RS.AN-03,CSF2.0|RS.AN-06,CSF2.0|RS.AN-07,GDPR|32.1.b,HIPAA|164.306(a)(1),HIPAA|164.312(b),ISO-27001-2022|A.8.15,ITSG-33|AU-2,ITSG-33|AU-7,ITSG-33|AU-12,LEVEL|1A,NESA|M1.2.2,NESA|M5.5.1,NIAv2|AM7,NIAv2|AM11a,NIAv2|AM11b,NIAv2|AM11c,NIAv2|AM11d,NIAv2|AM11e,NIAv2|SS30,NIAv2|VL8,PCI-DSSv3.2.1|10.1,QCSC-v1|3.2,QCSC-v1|6.2,QCSC-v1|8.2.1,QCSC-v1|10.2.1,QCSC-v1|11.2,QCSC-v1|13.2,SWIFT-CSCv1|6.4" see_also : "https://workbench.cisecurity.org/benchmarks/20333" description : "6.2.2.1.1 Ensure systemd-journal-remote is installed" info : "Journald systemd-journal-remote supports the ability to send log events it gathers to a remote log host or to receive messages from remote hosts, thus enabling centralized log management. 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. Note: This recommendation only applies if journald is the chosen method for client side logging Do not apply this recommendation if rsyslog is used. NOTE: Nessus has not performed this check. Please review the benchmark to ensure target compliance." solution : "Run the following command to install systemd-journal-remote : # zypper install systemd-journal-remote" reference : "800-171|3.3.1,800-171|3.3.2,800-171|3.3.6,800-171r3|03.03.01,800-171r3|03.03.03,800-171r3|03.03.06a.,800-53|AU-2,800-53|AU-7,800-53|AU-12,800-53r5|AU-2,800-53r5|AU-7,800-53r5|AU-12,CN-L3|7.1.2.3(c),CN-L3|8.1.4.3(a),CSCv7|6.2,CSCv7|6.3,CSCv8|8.2,CSF|DE.CM-1,CSF|DE.CM-3,CSF|DE.CM-7,CSF|PR.PT-1,CSF|RS.AN-3,CSF2.0|DE.CM-01,CSF2.0|DE.CM-03,CSF2.0|DE.CM-09,CSF2.0|PR.PS-04,CSF2.0|RS.AN-03,CSF2.0|RS.AN-06,CSF2.0|RS.AN-07,GDPR|32.1.b,HIPAA|164.306(a)(1),HIPAA|164.312(b),ISO-27001-2022|A.8.15,ITSG-33|AU-2,ITSG-33|AU-7,ITSG-33|AU-12,LEVEL|1A,NESA|M1.2.2,NESA|M5.5.1,NIAv2|AM7,NIAv2|AM11a,NIAv2|AM11b,NIAv2|AM11c,NIAv2|AM11d,NIAv2|AM11e,NIAv2|SS30,NIAv2|VL8,PCI-DSSv3.2.1|10.1,QCSC-v1|3.2,QCSC-v1|6.2,QCSC-v1|8.2.1,QCSC-v1|10.2.1,QCSC-v1|11.2,QCSC-v1|13.2,SWIFT-CSCv1|6.4" see_also : "https://workbench.cisecurity.org/benchmarks/20333" type : CMD_EXEC description : "journald check - active" cmd : "/bin/systemctl is-active systemd-journald" expect : "^active$" type : CMD_EXEC description : "rsyslog check - active" cmd : "/bin/systemctl is-active rsyslog" expect : "^active$" type : CMD_EXEC description : "journald check - active" cmd : "/bin/systemctl is-active systemd-journald" expect : "^active$" type : FILE_CONTENT_CHECK description : "6.2.2.1.2 Ensure systemd-journal-upload authentication is configured" info : "Journald systemd-journal-upload supports the ability to send log events it gathers to a remote log host. 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. Note: This recommendation only applies if journald is the chosen method for client side logging Do not apply this recommendation if rsyslog is used. NOTE: Nessus has provided the target output to assist in reviewing the benchmark to ensure target compliance." solution : "Edit the /usr/lib/systemd/journal-upload.conf file or a file in /etc/systemd/journal-upload.conf.d ending inconf and ensure the following lines are set in the [Upload] section per your environment: [Upload] URL=192.168.50.42 ServerKeyFile=/etc/ssl/private/journal-upload.pem ServerCertificateFile=/etc/ssl/certs/journal-upload.pem TrustedCertificateFile=/etc/ssl/ca/trusted.pem Restart the service: # systemctl restart systemd-journal-upload" reference : "800-171|3.3.1,800-171|3.3.2,800-171|3.3.6,800-171r3|03.03.01,800-171r3|03.03.03,800-171r3|03.03.06a.,800-53|AU-2,800-53|AU-7,800-53|AU-12,800-53r5|AU-2,800-53r5|AU-7,800-53r5|AU-12,CN-L3|7.1.2.3(c),CN-L3|8.1.4.3(a),CSCv7|6.2,CSCv7|6.3,CSCv8|8.2,CSF|DE.CM-1,CSF|DE.CM-3,CSF|DE.CM-7,CSF|PR.PT-1,CSF|RS.AN-3,CSF2.0|DE.CM-01,CSF2.0|DE.CM-03,CSF2.0|DE.CM-09,CSF2.0|PR.PS-04,CSF2.0|RS.AN-03,CSF2.0|RS.AN-06,CSF2.0|RS.AN-07,GDPR|32.1.b,HIPAA|164.306(a)(1),HIPAA|164.312(b),ISO-27001-2022|A.8.15,ITSG-33|AU-2,ITSG-33|AU-7,ITSG-33|AU-12,LEVEL|1M,NESA|M1.2.2,NESA|M5.5.1,NIAv2|AM7,NIAv2|AM11a,NIAv2|AM11b,NIAv2|AM11c,NIAv2|AM11d,NIAv2|AM11e,NIAv2|SS30,NIAv2|VL8,PCI-DSSv3.2.1|10.1,QCSC-v1|3.2,QCSC-v1|6.2,QCSC-v1|8.2.1,QCSC-v1|10.2.1,QCSC-v1|11.2,QCSC-v1|13.2,SWIFT-CSCv1|6.4" see_also : "https://workbench.cisecurity.org/benchmarks/20333" file : "/etc/systemd/journal-upload.conf /etc/systemd/journal-upload.conf.d/*.conf" regex : "^[\\s]*(URL|ServerKeyFile|ServerCertificateFile|TrustedCertificateFile)[\\s]*=" expect : "^Manual Review Required$" required : NO min_occurrences : "1" severity : MEDIUM description : "6.2.2.1.2 Ensure systemd-journal-upload authentication is configured" info : "Journald systemd-journal-upload supports the ability to send log events it gathers to a remote log host. 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. Note: This recommendation only applies if journald is the chosen method for client side logging Do not apply this recommendation if rsyslog is used." solution : "Edit the /usr/lib/systemd/journal-upload.conf file or a file in /etc/systemd/journal-upload.conf.d ending inconf and ensure the following lines are set in the [Upload] section per your environment: [Upload] URL=192.168.50.42 ServerKeyFile=/etc/ssl/private/journal-upload.pem ServerCertificateFile=/etc/ssl/certs/journal-upload.pem TrustedCertificateFile=/etc/ssl/ca/trusted.pem Restart the service: # systemctl restart systemd-journal-upload" reference : "800-171|3.3.1,800-171|3.3.2,800-171|3.3.6,800-171r3|03.03.01,800-171r3|03.03.03,800-171r3|03.03.06a.,800-53|AU-2,800-53|AU-7,800-53|AU-12,800-53r5|AU-2,800-53r5|AU-7,800-53r5|AU-12,CN-L3|7.1.2.3(c),CN-L3|8.1.4.3(a),CSCv7|6.2,CSCv7|6.3,CSCv8|8.2,CSF|DE.CM-1,CSF|DE.CM-3,CSF|DE.CM-7,CSF|PR.PT-1,CSF|RS.AN-3,CSF2.0|DE.CM-01,CSF2.0|DE.CM-03,CSF2.0|DE.CM-09,CSF2.0|PR.PS-04,CSF2.0|RS.AN-03,CSF2.0|RS.AN-06,CSF2.0|RS.AN-07,GDPR|32.1.b,HIPAA|164.306(a)(1),HIPAA|164.312(b),ISO-27001-2022|A.8.15,ITSG-33|AU-2,ITSG-33|AU-7,ITSG-33|AU-12,LEVEL|1M,NESA|M1.2.2,NESA|M5.5.1,NIAv2|AM7,NIAv2|AM11a,NIAv2|AM11b,NIAv2|AM11c,NIAv2|AM11d,NIAv2|AM11e,NIAv2|SS30,NIAv2|VL8,PCI-DSSv3.2.1|10.1,QCSC-v1|3.2,QCSC-v1|6.2,QCSC-v1|8.2.1,QCSC-v1|10.2.1,QCSC-v1|11.2,QCSC-v1|13.2,SWIFT-CSCv1|6.4" see_also : "https://workbench.cisecurity.org/benchmarks/20333" description : "6.2.2.1.2 Ensure systemd-journal-upload authentication is configured" info : "Journald systemd-journal-upload supports the ability to send log events it gathers to a remote log host. 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. Note: This recommendation only applies if journald is the chosen method for client side logging Do not apply this recommendation if rsyslog is used. NOTE: Nessus has not performed this check. Please review the benchmark to ensure target compliance." solution : "Edit the /usr/lib/systemd/journal-upload.conf file or a file in /etc/systemd/journal-upload.conf.d ending inconf and ensure the following lines are set in the [Upload] section per your environment: [Upload] URL=192.168.50.42 ServerKeyFile=/etc/ssl/private/journal-upload.pem ServerCertificateFile=/etc/ssl/certs/journal-upload.pem TrustedCertificateFile=/etc/ssl/ca/trusted.pem Restart the service: # systemctl restart systemd-journal-upload" reference : "800-171|3.3.1,800-171|3.3.2,800-171|3.3.6,800-171r3|03.03.01,800-171r3|03.03.03,800-171r3|03.03.06a.,800-53|AU-2,800-53|AU-7,800-53|AU-12,800-53r5|AU-2,800-53r5|AU-7,800-53r5|AU-12,CN-L3|7.1.2.3(c),CN-L3|8.1.4.3(a),CSCv7|6.2,CSCv7|6.3,CSCv8|8.2,CSF|DE.CM-1,CSF|DE.CM-3,CSF|DE.CM-7,CSF|PR.PT-1,CSF|RS.AN-3,CSF2.0|DE.CM-01,CSF2.0|DE.CM-03,CSF2.0|DE.CM-09,CSF2.0|PR.PS-04,CSF2.0|RS.AN-03,CSF2.0|RS.AN-06,CSF2.0|RS.AN-07,GDPR|32.1.b,HIPAA|164.306(a)(1),HIPAA|164.312(b),ISO-27001-2022|A.8.15,ITSG-33|AU-2,ITSG-33|AU-7,ITSG-33|AU-12,LEVEL|1M,NESA|M1.2.2,NESA|M5.5.1,NIAv2|AM7,NIAv2|AM11a,NIAv2|AM11b,NIAv2|AM11c,NIAv2|AM11d,NIAv2|AM11e,NIAv2|SS30,NIAv2|VL8,PCI-DSSv3.2.1|10.1,QCSC-v1|3.2,QCSC-v1|6.2,QCSC-v1|8.2.1,QCSC-v1|10.2.1,QCSC-v1|11.2,QCSC-v1|13.2,SWIFT-CSCv1|6.4" see_also : "https://workbench.cisecurity.org/benchmarks/20333" type : CMD_EXEC description : "journald check - active" cmd : "/bin/systemctl is-active systemd-journald" expect : "^active$" type : CMD_EXEC description : "rsyslog check - active" cmd : "/bin/systemctl is-active rsyslog" expect : "^active$" type : CMD_EXEC description : "journald check - active" cmd : "/bin/systemctl is-active systemd-journald" expect : "^active$" type : CMD_EXEC description : "journald enabled" cmd : "/bin/systemctl is-enabled systemd-journal-upload.service" expect : "^enabled$" type : CMD_EXEC description : "journald active" cmd : "/bin/systemctl is-active systemd-journal-upload.service" expect : "^active$" description : "6.2.2.1.3 Ensure systemd-journal-upload is enabled and active" info : "Journald systemd-journal-upload supports the ability to send log events it gathers to a remote log host. 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. Note: This recommendation only applies if journald is the chosen method for client side logging Do not apply this recommendation if rsyslog is used." solution : "Run the following commands to unmask, enable and start systemd-journal-upload : # systemctl unmask systemd-journal-upload.service # systemctl --now enable systemd-journal-upload.service" reference : "800-171|3.3.1,800-171|3.3.2,800-171|3.3.6,800-171r3|03.03.01,800-171r3|03.03.03,800-171r3|03.03.06a.,800-53|AU-2,800-53|AU-7,800-53|AU-12,800-53r5|AU-2,800-53r5|AU-7,800-53r5|AU-12,CN-L3|7.1.2.3(c),CN-L3|8.1.4.3(a),CSCv7|6.2,CSCv7|6.3,CSCv8|8.2,CSF|DE.CM-1,CSF|DE.CM-3,CSF|DE.CM-7,CSF|PR.PT-1,CSF|RS.AN-3,CSF2.0|DE.CM-01,CSF2.0|DE.CM-03,CSF2.0|DE.CM-09,CSF2.0|PR.PS-04,CSF2.0|RS.AN-03,CSF2.0|RS.AN-06,CSF2.0|RS.AN-07,GDPR|32.1.b,HIPAA|164.306(a)(1),HIPAA|164.312(b),ISO-27001-2022|A.8.15,ITSG-33|AU-2,ITSG-33|AU-7,ITSG-33|AU-12,LEVEL|1A,NESA|M1.2.2,NESA|M5.5.1,NIAv2|AM7,NIAv2|AM11a,NIAv2|AM11b,NIAv2|AM11c,NIAv2|AM11d,NIAv2|AM11e,NIAv2|SS30,NIAv2|VL8,PCI-DSSv3.2.1|10.1,QCSC-v1|3.2,QCSC-v1|6.2,QCSC-v1|8.2.1,QCSC-v1|10.2.1,QCSC-v1|11.2,QCSC-v1|13.2,SWIFT-CSCv1|6.4" see_also : "https://workbench.cisecurity.org/benchmarks/20333" show_output : YES description : "6.2.2.1.3 Ensure systemd-journal-upload is enabled and active" info : "Journald systemd-journal-upload supports the ability to send log events it gathers to a remote log host. 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. Note: This recommendation only applies if journald is the chosen method for client side logging Do not apply this recommendation if rsyslog is used." solution : "Run the following commands to unmask, enable and start systemd-journal-upload : # systemctl unmask systemd-journal-upload.service # systemctl --now enable systemd-journal-upload.service" reference : "800-171|3.3.1,800-171|3.3.2,800-171|3.3.6,800-171r3|03.03.01,800-171r3|03.03.03,800-171r3|03.03.06a.,800-53|AU-2,800-53|AU-7,800-53|AU-12,800-53r5|AU-2,800-53r5|AU-7,800-53r5|AU-12,CN-L3|7.1.2.3(c),CN-L3|8.1.4.3(a),CSCv7|6.2,CSCv7|6.3,CSCv8|8.2,CSF|DE.CM-1,CSF|DE.CM-3,CSF|DE.CM-7,CSF|PR.PT-1,CSF|RS.AN-3,CSF2.0|DE.CM-01,CSF2.0|DE.CM-03,CSF2.0|DE.CM-09,CSF2.0|PR.PS-04,CSF2.0|RS.AN-03,CSF2.0|RS.AN-06,CSF2.0|RS.AN-07,GDPR|32.1.b,HIPAA|164.306(a)(1),HIPAA|164.312(b),ISO-27001-2022|A.8.15,ITSG-33|AU-2,ITSG-33|AU-7,ITSG-33|AU-12,LEVEL|1A,NESA|M1.2.2,NESA|M5.5.1,NIAv2|AM7,NIAv2|AM11a,NIAv2|AM11b,NIAv2|AM11c,NIAv2|AM11d,NIAv2|AM11e,NIAv2|SS30,NIAv2|VL8,PCI-DSSv3.2.1|10.1,QCSC-v1|3.2,QCSC-v1|6.2,QCSC-v1|8.2.1,QCSC-v1|10.2.1,QCSC-v1|11.2,QCSC-v1|13.2,SWIFT-CSCv1|6.4" see_also : "https://workbench.cisecurity.org/benchmarks/20333" description : "6.2.2.1.3 Ensure systemd-journal-upload is enabled and active" info : "Journald systemd-journal-upload supports the ability to send log events it gathers to a remote log host. 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. Note: This recommendation only applies if journald is the chosen method for client side logging Do not apply this recommendation if rsyslog is used. NOTE: Nessus has not performed this check. Please review the benchmark to ensure target compliance." solution : "Run the following commands to unmask, enable and start systemd-journal-upload : # systemctl unmask systemd-journal-upload.service # systemctl --now enable systemd-journal-upload.service" reference : "800-171|3.3.1,800-171|3.3.2,800-171|3.3.6,800-171r3|03.03.01,800-171r3|03.03.03,800-171r3|03.03.06a.,800-53|AU-2,800-53|AU-7,800-53|AU-12,800-53r5|AU-2,800-53r5|AU-7,800-53r5|AU-12,CN-L3|7.1.2.3(c),CN-L3|8.1.4.3(a),CSCv7|6.2,CSCv7|6.3,CSCv8|8.2,CSF|DE.CM-1,CSF|DE.CM-3,CSF|DE.CM-7,CSF|PR.PT-1,CSF|RS.AN-3,CSF2.0|DE.CM-01,CSF2.0|DE.CM-03,CSF2.0|DE.CM-09,CSF2.0|PR.PS-04,CSF2.0|RS.AN-03,CSF2.0|RS.AN-06,CSF2.0|RS.AN-07,GDPR|32.1.b,HIPAA|164.306(a)(1),HIPAA|164.312(b),ISO-27001-2022|A.8.15,ITSG-33|AU-2,ITSG-33|AU-7,ITSG-33|AU-12,LEVEL|1A,NESA|M1.2.2,NESA|M5.5.1,NIAv2|AM7,NIAv2|AM11a,NIAv2|AM11b,NIAv2|AM11c,NIAv2|AM11d,NIAv2|AM11e,NIAv2|SS30,NIAv2|VL8,PCI-DSSv3.2.1|10.1,QCSC-v1|3.2,QCSC-v1|6.2,QCSC-v1|8.2.1,QCSC-v1|10.2.1,QCSC-v1|11.2,QCSC-v1|13.2,SWIFT-CSCv1|6.4" see_also : "https://workbench.cisecurity.org/benchmarks/20333" type : CMD_EXEC description : "journald check - active" cmd : "/bin/systemctl is-active systemd-journald" expect : "^active$" type : CMD_EXEC description : "rsyslog check - active" cmd : "/bin/systemctl is-active rsyslog" expect : "^active$" type : CMD_EXEC description : "journald check - active" cmd : "/bin/systemctl is-active systemd-journald" expect : "^active$" type : CMD_EXEC description : "journald remote active" cmd : "/bin/systemctl is-active systemd-journal-remote.socket systemd-journal-remote.service | /bin/grep -P -- '^active' | /bin/awk '{print} END {if(NR==0) print \"pass\"}'" expect : "^pass$" type : CMD_EXEC description : "journald remote enabled" cmd : "/bin/systemctl is-enabled systemd-journal-remote.socket systemd-journal-remote.service | /bin/grep -P -- '^enabled' | /bin/awk '{print} END {if(NR==0) print \"pass\"}'" expect : "^pass$" description : "6.2.2.1.4 Ensure systemd-journal-remote service is not in use" info : "Journald systemd-journal-remote supports the ability to receive messages from remote hosts, thus acting as a log server. Clients should not receive data from other hosts. Note: - The same package, systemd-journal-remote is used for both sending logs to remote hosts and receiving incoming logs. - With regards to receiving logs, there are two services; systemd-journal-remote.socket and systemd-journal-remote.service If a client is configured to also receive data, thus turning it into a server, the client system is acting outside it's operational boundary. Note: This recommendation only applies if journald is the chosen method for client side logging Do not apply this recommendation if rsyslog is used." solution : "Run the following commands to stop and mask systemd-journal-remote.socket and systemd-journal-remote.service: # systemctl stop systemd-journal-remote.socket systemd-journal-remote.service # systemctl mask systemd-journal-remote.socket systemd-journal-remote.service" reference : "800-171|3.4.2,800-171|3.4.6,800-171|3.4.7,800-171r3|03.04.02,800-171r3|03.04.06,800-53|CM-6,800-53|CM-7,800-53r5|CM-6,800-53r5|CM-7,CSCv7|9.2,CSCv8|4.8,CSF|PR.IP-1,CSF|PR.PT-3,CSF2.0|DE.CM-09,CSF2.0|PR.PS-01,GDPR|32.1.b,HIPAA|164.306(a)(1),ISO-27001-2022|A.8.9,ITSG-33|CM-6,ITSG-33|CM-7,LEVEL|1A,NIAv2|SS15a,PCI-DSSv3.2.1|2.2.2,SWIFT-CSCv1|2.3" see_also : "https://workbench.cisecurity.org/benchmarks/20333" show_output : YES description : "6.2.2.1.4 Ensure systemd-journal-remote service is not in use" info : "Journald systemd-journal-remote supports the ability to receive messages from remote hosts, thus acting as a log server. Clients should not receive data from other hosts. Note: - The same package, systemd-journal-remote is used for both sending logs to remote hosts and receiving incoming logs. - With regards to receiving logs, there are two services; systemd-journal-remote.socket and systemd-journal-remote.service If a client is configured to also receive data, thus turning it into a server, the client system is acting outside it's operational boundary. Note: This recommendation only applies if journald is the chosen method for client side logging Do not apply this recommendation if rsyslog is used." solution : "Run the following commands to stop and mask systemd-journal-remote.socket and systemd-journal-remote.service: # systemctl stop systemd-journal-remote.socket systemd-journal-remote.service # systemctl mask systemd-journal-remote.socket systemd-journal-remote.service" reference : "800-171|3.4.2,800-171|3.4.6,800-171|3.4.7,800-171r3|03.04.02,800-171r3|03.04.06,800-53|CM-6,800-53|CM-7,800-53r5|CM-6,800-53r5|CM-7,CSCv7|9.2,CSCv8|4.8,CSF|PR.IP-1,CSF|PR.PT-3,CSF2.0|DE.CM-09,CSF2.0|PR.PS-01,GDPR|32.1.b,HIPAA|164.306(a)(1),ISO-27001-2022|A.8.9,ITSG-33|CM-6,ITSG-33|CM-7,LEVEL|1A,NIAv2|SS15a,PCI-DSSv3.2.1|2.2.2,SWIFT-CSCv1|2.3" see_also : "https://workbench.cisecurity.org/benchmarks/20333" description : "6.2.2.1.4 Ensure systemd-journal-remote service is not in use" info : "Journald systemd-journal-remote supports the ability to receive messages from remote hosts, thus acting as a log server. Clients should not receive data from other hosts. Note: - The same package, systemd-journal-remote is used for both sending logs to remote hosts and receiving incoming logs. - With regards to receiving logs, there are two services; systemd-journal-remote.socket and systemd-journal-remote.service If a client is configured to also receive data, thus turning it into a server, the client system is acting outside it's operational boundary. Note: This recommendation only applies if journald is the chosen method for client side logging Do not apply this recommendation if rsyslog is used. NOTE: Nessus has not performed this check. Please review the benchmark to ensure target compliance." solution : "Run the following commands to stop and mask systemd-journal-remote.socket and systemd-journal-remote.service: # systemctl stop systemd-journal-remote.socket systemd-journal-remote.service # systemctl mask systemd-journal-remote.socket systemd-journal-remote.service" reference : "800-171|3.4.2,800-171|3.4.6,800-171|3.4.7,800-171r3|03.04.02,800-171r3|03.04.06,800-53|CM-6,800-53|CM-7,800-53r5|CM-6,800-53r5|CM-7,CSCv7|9.2,CSCv8|4.8,CSF|PR.IP-1,CSF|PR.PT-3,CSF2.0|DE.CM-09,CSF2.0|PR.PS-01,GDPR|32.1.b,HIPAA|164.306(a)(1),ISO-27001-2022|A.8.9,ITSG-33|CM-6,ITSG-33|CM-7,LEVEL|1A,NIAv2|SS15a,PCI-DSSv3.2.1|2.2.2,SWIFT-CSCv1|2.3" see_also : "https://workbench.cisecurity.org/benchmarks/20333" type : CMD_EXEC description : "journald check - active" cmd : "/bin/systemctl is-active systemd-journald" expect : "^active$" type : CMD_EXEC description : "rsyslog check - active" cmd : "/bin/systemctl is-active rsyslog" expect : "^active$" type : CMD_EXEC description : "journald check - active" cmd : "/bin/systemctl is-active systemd-journald" expect : "^active$" type : CMD_EXEC description : "6.2.2.2 Ensure journald ForwardToSyslog is disabled" info : "Data from journald should be kept in the confines of the service and not forwarded to other services. - IF - journald is the method for capturing logs, all logs of the system should be handled by journald and not forwarded to other logging mechanisms. Note: This recommendation only applies if journald is the chosen method for client side logging Do not apply this recommendation if rsyslog is used." solution : "- IF - rsyslog is the preferred method for capturing logs, this section and Recommendation should be skipped and the \"Configure rsyslog\" section followed. - IF - journald is the preferred method for capturing logs: Set the following parameter in the [Journal] section in /etc/systemd/journald.conf or a file in /etc/systemd/journald.conf.d/ ending inconf : ForwardToSyslog=no Example: #!/usr/bin/env bash { [ ! -d /etc/systemd/journald.conf.d/ ] && mkdir /etc/systemd/journald.conf.d/ if grep -Psq -- '^\h*\[Journal\]' /etc/systemd/journald.conf.d/60-journald.conf; then printf '%s\n' \"ForwardToSyslog=no\" >> /etc/systemd/journald.conf.d/60-journald.conf else printf '%s\n' \"[Journal]\" \"ForwardToSyslog=no\" >> /etc/systemd/journald.conf.d/60-journald.conf fi } Note: If this setting appears in a canonically later file, or later in the same file, the setting will be overwritten Run to following command to update the parameters in the service: # systemctl reload-or-restart systemd-journald" reference : "800-171|3.3.1,800-171|3.3.2,800-171|3.3.6,800-171r3|03.03.01,800-171r3|03.03.03,800-171r3|03.03.06a.,800-53|AU-2,800-53|AU-7,800-53|AU-12,800-53r5|AU-2,800-53r5|AU-7,800-53r5|AU-12,CN-L3|7.1.2.3(c),CN-L3|8.1.4.3(a),CSCv7|6.3,CSCv8|8.2,CSF|DE.CM-1,CSF|DE.CM-3,CSF|DE.CM-7,CSF|PR.PT-1,CSF|RS.AN-3,CSF2.0|DE.CM-01,CSF2.0|DE.CM-03,CSF2.0|DE.CM-09,CSF2.0|PR.PS-04,CSF2.0|RS.AN-03,CSF2.0|RS.AN-06,CSF2.0|RS.AN-07,GDPR|32.1.b,HIPAA|164.306(a)(1),HIPAA|164.312(b),ISO-27001-2022|A.8.15,ITSG-33|AU-2,ITSG-33|AU-7,ITSG-33|AU-12,LEVEL|1A,NESA|M1.2.2,NESA|M5.5.1,NIAv2|AM7,NIAv2|AM11a,NIAv2|AM11b,NIAv2|AM11c,NIAv2|AM11d,NIAv2|AM11e,NIAv2|SS30,NIAv2|VL8,PCI-DSSv3.2.1|10.1,QCSC-v1|3.2,QCSC-v1|6.2,QCSC-v1|8.2.1,QCSC-v1|10.2.1,QCSC-v1|11.2,QCSC-v1|13.2,SWIFT-CSCv1|6.4" see_also : "https://workbench.cisecurity.org/benchmarks/20333" cmd : "/bin/systemd-analyze cat-config systemd/journald.conf systemd/journald.conf.d/* | /bin/grep -E \"^ForwardToSyslog=no\"" expect : "ForwardToSyslog=no" description : "6.2.2.2 Ensure journald ForwardToSyslog is disabled" info : "Data from journald should be kept in the confines of the service and not forwarded to other services. - IF - journald is the method for capturing logs, all logs of the system should be handled by journald and not forwarded to other logging mechanisms. Note: This recommendation only applies if journald is the chosen method for client side logging Do not apply this recommendation if rsyslog is used." solution : "- IF - rsyslog is the preferred method for capturing logs, this section and Recommendation should be skipped and the \"Configure rsyslog\" section followed. - IF - journald is the preferred method for capturing logs: Set the following parameter in the [Journal] section in /etc/systemd/journald.conf or a file in /etc/systemd/journald.conf.d/ ending inconf : ForwardToSyslog=no Example: #!/usr/bin/env bash { [ ! -d /etc/systemd/journald.conf.d/ ] && mkdir /etc/systemd/journald.conf.d/ if grep -Psq -- '^\h*\[Journal\]' /etc/systemd/journald.conf.d/60-journald.conf; then printf '%s\n' \"ForwardToSyslog=no\" >> /etc/systemd/journald.conf.d/60-journald.conf else printf '%s\n' \"[Journal]\" \"ForwardToSyslog=no\" >> /etc/systemd/journald.conf.d/60-journald.conf fi } Note: If this setting appears in a canonically later file, or later in the same file, the setting will be overwritten Run to following command to update the parameters in the service: # systemctl reload-or-restart systemd-journald" reference : "800-171|3.3.1,800-171|3.3.2,800-171|3.3.6,800-171r3|03.03.01,800-171r3|03.03.03,800-171r3|03.03.06a.,800-53|AU-2,800-53|AU-7,800-53|AU-12,800-53r5|AU-2,800-53r5|AU-7,800-53r5|AU-12,CN-L3|7.1.2.3(c),CN-L3|8.1.4.3(a),CSCv7|6.3,CSCv8|8.2,CSF|DE.CM-1,CSF|DE.CM-3,CSF|DE.CM-7,CSF|PR.PT-1,CSF|RS.AN-3,CSF2.0|DE.CM-01,CSF2.0|DE.CM-03,CSF2.0|DE.CM-09,CSF2.0|PR.PS-04,CSF2.0|RS.AN-03,CSF2.0|RS.AN-06,CSF2.0|RS.AN-07,GDPR|32.1.b,HIPAA|164.306(a)(1),HIPAA|164.312(b),ISO-27001-2022|A.8.15,ITSG-33|AU-2,ITSG-33|AU-7,ITSG-33|AU-12,LEVEL|1A,NESA|M1.2.2,NESA|M5.5.1,NIAv2|AM7,NIAv2|AM11a,NIAv2|AM11b,NIAv2|AM11c,NIAv2|AM11d,NIAv2|AM11e,NIAv2|SS30,NIAv2|VL8,PCI-DSSv3.2.1|10.1,QCSC-v1|3.2,QCSC-v1|6.2,QCSC-v1|8.2.1,QCSC-v1|10.2.1,QCSC-v1|11.2,QCSC-v1|13.2,SWIFT-CSCv1|6.4" see_also : "https://workbench.cisecurity.org/benchmarks/20333" description : "6.2.2.2 Ensure journald ForwardToSyslog is disabled" info : "Data from journald should be kept in the confines of the service and not forwarded to other services. - IF - journald is the method for capturing logs, all logs of the system should be handled by journald and not forwarded to other logging mechanisms. Note: This recommendation only applies if journald is the chosen method for client side logging Do not apply this recommendation if rsyslog is used. NOTE: Nessus has not performed this check. Please review the benchmark to ensure target compliance." solution : "- IF - rsyslog is the preferred method for capturing logs, this section and Recommendation should be skipped and the \"Configure rsyslog\" section followed. - IF - journald is the preferred method for capturing logs: Set the following parameter in the [Journal] section in /etc/systemd/journald.conf or a file in /etc/systemd/journald.conf.d/ ending inconf : ForwardToSyslog=no Example: #!/usr/bin/env bash { [ ! -d /etc/systemd/journald.conf.d/ ] && mkdir /etc/systemd/journald.conf.d/ if grep -Psq -- '^\h*\[Journal\]' /etc/systemd/journald.conf.d/60-journald.conf; then printf '%s\n' \"ForwardToSyslog=no\" >> /etc/systemd/journald.conf.d/60-journald.conf else printf '%s\n' \"[Journal]\" \"ForwardToSyslog=no\" >> /etc/systemd/journald.conf.d/60-journald.conf fi } Note: If this setting appears in a canonically later file, or later in the same file, the setting will be overwritten Run to following command to update the parameters in the service: # systemctl reload-or-restart systemd-journald" reference : "800-171|3.3.1,800-171|3.3.2,800-171|3.3.6,800-171r3|03.03.01,800-171r3|03.03.03,800-171r3|03.03.06a.,800-53|AU-2,800-53|AU-7,800-53|AU-12,800-53r5|AU-2,800-53r5|AU-7,800-53r5|AU-12,CN-L3|7.1.2.3(c),CN-L3|8.1.4.3(a),CSCv7|6.3,CSCv8|8.2,CSF|DE.CM-1,CSF|DE.CM-3,CSF|DE.CM-7,CSF|PR.PT-1,CSF|RS.AN-3,CSF2.0|DE.CM-01,CSF2.0|DE.CM-03,CSF2.0|DE.CM-09,CSF2.0|PR.PS-04,CSF2.0|RS.AN-03,CSF2.0|RS.AN-06,CSF2.0|RS.AN-07,GDPR|32.1.b,HIPAA|164.306(a)(1),HIPAA|164.312(b),ISO-27001-2022|A.8.15,ITSG-33|AU-2,ITSG-33|AU-7,ITSG-33|AU-12,LEVEL|1A,NESA|M1.2.2,NESA|M5.5.1,NIAv2|AM7,NIAv2|AM11a,NIAv2|AM11b,NIAv2|AM11c,NIAv2|AM11d,NIAv2|AM11e,NIAv2|SS30,NIAv2|VL8,PCI-DSSv3.2.1|10.1,QCSC-v1|3.2,QCSC-v1|6.2,QCSC-v1|8.2.1,QCSC-v1|10.2.1,QCSC-v1|11.2,QCSC-v1|13.2,SWIFT-CSCv1|6.4" see_also : "https://workbench.cisecurity.org/benchmarks/20333" type : CMD_EXEC description : "journald check - active" cmd : "/bin/systemctl is-active systemd-journald" expect : "^active$" type : CMD_EXEC description : "rsyslog check - active" cmd : "/bin/systemctl is-active rsyslog" expect : "^active$" type : CMD_EXEC description : "journald check - active" cmd : "/bin/systemctl is-active systemd-journald" expect : "^active$" type : CMD_EXEC description : "6.2.2.3 Ensure journald Compress is configured" 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. Uncompressed large files may unexpectedly fill a filesystem leading to resource unavailability. Compressing logs prior to write can prevent sudden, unexpected filesystem impacts. Note: This recommendation only applies if journald is the chosen method for client side logging Do not apply this recommendation if rsyslog is used." solution : "Set the following parameter in the [Journal] section in /etc/systemd/journald.conf or a file in /etc/systemd/journald.conf.d/ ending inconf : Compress=yes Example: #!/usr/bin/env bash { [ ! -d /etc/systemd/journald.conf.d/ ] && mkdir /etc/systemd/journald.conf.d/ if grep -Psq -- '^\h*\[Journal\]' /etc/systemd/journald.conf.d/60-journald.conf; then printf '%s\n' \"Compress=yes\" >> /etc/systemd/journald.conf.d/60-journald.conf else printf '%s\n' \"[Journal]\" \"Compress=yes\" >> /etc/systemd/journald.conf.d/60-journald.conf fi } Note: If this setting appears in a canonically later file, or later in the same file, the setting will be overwritten Run to following command to update the parameters in the service: # systemctl reload-or-restart systemd-journald" reference : "800-171|3.3.1,800-171|3.3.2,800-171|3.3.6,800-171r3|03.03.01,800-171r3|03.03.03,800-171r3|03.03.06a.,800-53|AU-2,800-53|AU-4,800-53|AU-7,800-53|AU-12,800-53r5|AU-2,800-53r5|AU-4,800-53r5|AU-7,800-53r5|AU-12,CN-L3|7.1.2.3(c),CN-L3|8.1.4.3(a),CSCv7|6.2,CSCv7|6.3,CSCv7|6.4,CSCv8|8.2,CSCv8|8.3,CSF|DE.CM-1,CSF|DE.CM-3,CSF|DE.CM-7,CSF|PR.DS-4,CSF|PR.PT-1,CSF|RS.AN-3,CSF2.0|DE.CM-01,CSF2.0|DE.CM-03,CSF2.0|DE.CM-09,CSF2.0|PR.PS-04,CSF2.0|RS.AN-03,CSF2.0|RS.AN-06,CSF2.0|RS.AN-07,GDPR|32.1.b,HIPAA|164.306(a)(1),HIPAA|164.312(b),ISO-27001-2022|A.8.6,ISO-27001-2022|A.8.15,ITSG-33|AU-2,ITSG-33|AU-4,ITSG-33|AU-7,ITSG-33|AU-12,LEVEL|1A,NESA|M1.2.2,NESA|M5.5.1,NESA|T3.3.1,NESA|T3.6.2,NIAv2|AM7,NIAv2|AM11a,NIAv2|AM11b,NIAv2|AM11c,NIAv2|AM11d,NIAv2|AM11e,NIAv2|SS30,NIAv2|VL8,PCI-DSSv3.2.1|10.1,QCSC-v1|3.2,QCSC-v1|6.2,QCSC-v1|8.2.1,QCSC-v1|10.2.1,QCSC-v1|11.2,QCSC-v1|13.2,SWIFT-CSCv1|6.4" see_also : "https://workbench.cisecurity.org/benchmarks/20333" cmd : "/bin/systemd-analyze cat-config systemd/journald.conf systemd/journald.conf.d/* | /bin/grep -E \"^Compress=yes\"" expect : "Compress=yes" description : "6.2.2.3 Ensure journald Compress is configured" 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. Uncompressed large files may unexpectedly fill a filesystem leading to resource unavailability. Compressing logs prior to write can prevent sudden, unexpected filesystem impacts. Note: This recommendation only applies if journald is the chosen method for client side logging Do not apply this recommendation if rsyslog is used." solution : "Set the following parameter in the [Journal] section in /etc/systemd/journald.conf or a file in /etc/systemd/journald.conf.d/ ending inconf : Compress=yes Example: #!/usr/bin/env bash { [ ! -d /etc/systemd/journald.conf.d/ ] && mkdir /etc/systemd/journald.conf.d/ if grep -Psq -- '^\h*\[Journal\]' /etc/systemd/journald.conf.d/60-journald.conf; then printf '%s\n' \"Compress=yes\" >> /etc/systemd/journald.conf.d/60-journald.conf else printf '%s\n' \"[Journal]\" \"Compress=yes\" >> /etc/systemd/journald.conf.d/60-journald.conf fi } Note: If this setting appears in a canonically later file, or later in the same file, the setting will be overwritten Run to following command to update the parameters in the service: # systemctl reload-or-restart systemd-journald" reference : "800-171|3.3.1,800-171|3.3.2,800-171|3.3.6,800-171r3|03.03.01,800-171r3|03.03.03,800-171r3|03.03.06a.,800-53|AU-2,800-53|AU-4,800-53|AU-7,800-53|AU-12,800-53r5|AU-2,800-53r5|AU-4,800-53r5|AU-7,800-53r5|AU-12,CN-L3|7.1.2.3(c),CN-L3|8.1.4.3(a),CSCv7|6.2,CSCv7|6.3,CSCv7|6.4,CSCv8|8.2,CSCv8|8.3,CSF|DE.CM-1,CSF|DE.CM-3,CSF|DE.CM-7,CSF|PR.DS-4,CSF|PR.PT-1,CSF|RS.AN-3,CSF2.0|DE.CM-01,CSF2.0|DE.CM-03,CSF2.0|DE.CM-09,CSF2.0|PR.PS-04,CSF2.0|RS.AN-03,CSF2.0|RS.AN-06,CSF2.0|RS.AN-07,GDPR|32.1.b,HIPAA|164.306(a)(1),HIPAA|164.312(b),ISO-27001-2022|A.8.6,ISO-27001-2022|A.8.15,ITSG-33|AU-2,ITSG-33|AU-4,ITSG-33|AU-7,ITSG-33|AU-12,LEVEL|1A,NESA|M1.2.2,NESA|M5.5.1,NESA|T3.3.1,NESA|T3.6.2,NIAv2|AM7,NIAv2|AM11a,NIAv2|AM11b,NIAv2|AM11c,NIAv2|AM11d,NIAv2|AM11e,NIAv2|SS30,NIAv2|VL8,PCI-DSSv3.2.1|10.1,QCSC-v1|3.2,QCSC-v1|6.2,QCSC-v1|8.2.1,QCSC-v1|10.2.1,QCSC-v1|11.2,QCSC-v1|13.2,SWIFT-CSCv1|6.4" see_also : "https://workbench.cisecurity.org/benchmarks/20333" description : "6.2.2.3 Ensure journald Compress is configured" 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. Uncompressed large files may unexpectedly fill a filesystem leading to resource unavailability. Compressing logs prior to write can prevent sudden, unexpected filesystem impacts. Note: This recommendation only applies if journald is the chosen method for client side logging Do not apply this recommendation if rsyslog is used. NOTE: Nessus has not performed this check. Please review the benchmark to ensure target compliance." solution : "Set the following parameter in the [Journal] section in /etc/systemd/journald.conf or a file in /etc/systemd/journald.conf.d/ ending inconf : Compress=yes Example: #!/usr/bin/env bash { [ ! -d /etc/systemd/journald.conf.d/ ] && mkdir /etc/systemd/journald.conf.d/ if grep -Psq -- '^\h*\[Journal\]' /etc/systemd/journald.conf.d/60-journald.conf; then printf '%s\n' \"Compress=yes\" >> /etc/systemd/journald.conf.d/60-journald.conf else printf '%s\n' \"[Journal]\" \"Compress=yes\" >> /etc/systemd/journald.conf.d/60-journald.conf fi } Note: If this setting appears in a canonically later file, or later in the same file, the setting will be overwritten Run to following command to update the parameters in the service: # systemctl reload-or-restart systemd-journald" reference : "800-171|3.3.1,800-171|3.3.2,800-171|3.3.6,800-171r3|03.03.01,800-171r3|03.03.03,800-171r3|03.03.06a.,800-53|AU-2,800-53|AU-4,800-53|AU-7,800-53|AU-12,800-53r5|AU-2,800-53r5|AU-4,800-53r5|AU-7,800-53r5|AU-12,CN-L3|7.1.2.3(c),CN-L3|8.1.4.3(a),CSCv7|6.2,CSCv7|6.3,CSCv7|6.4,CSCv8|8.2,CSCv8|8.3,CSF|DE.CM-1,CSF|DE.CM-3,CSF|DE.CM-7,CSF|PR.DS-4,CSF|PR.PT-1,CSF|RS.AN-3,CSF2.0|DE.CM-01,CSF2.0|DE.CM-03,CSF2.0|DE.CM-09,CSF2.0|PR.PS-04,CSF2.0|RS.AN-03,CSF2.0|RS.AN-06,CSF2.0|RS.AN-07,GDPR|32.1.b,HIPAA|164.306(a)(1),HIPAA|164.312(b),ISO-27001-2022|A.8.6,ISO-27001-2022|A.8.15,ITSG-33|AU-2,ITSG-33|AU-4,ITSG-33|AU-7,ITSG-33|AU-12,LEVEL|1A,NESA|M1.2.2,NESA|M5.5.1,NESA|T3.3.1,NESA|T3.6.2,NIAv2|AM7,NIAv2|AM11a,NIAv2|AM11b,NIAv2|AM11c,NIAv2|AM11d,NIAv2|AM11e,NIAv2|SS30,NIAv2|VL8,PCI-DSSv3.2.1|10.1,QCSC-v1|3.2,QCSC-v1|6.2,QCSC-v1|8.2.1,QCSC-v1|10.2.1,QCSC-v1|11.2,QCSC-v1|13.2,SWIFT-CSCv1|6.4" see_also : "https://workbench.cisecurity.org/benchmarks/20333" type : CMD_EXEC description : "journald check - active" cmd : "/bin/systemctl is-active systemd-journald" expect : "^active$" type : CMD_EXEC description : "rsyslog check - active" cmd : "/bin/systemctl is-active rsyslog" expect : "^active$" type : CMD_EXEC description : "journald check - active" cmd : "/bin/systemctl is-active systemd-journald" expect : "^active$" type : CMD_EXEC description : "6.2.2.4 Ensure journald Storage is configured" 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 due to a reboot. 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. Note: This recommendation only applies if journald is the chosen method for client side logging Do not apply this recommendation if rsyslog is used." solution : "Set the following parameter in the [Journal] section in /etc/systemd/journald.conf or a file in /etc/systemd/journald.conf.d/ ending inconf : Storage=persistent Example: #!/usr/bin/env bash { [ ! -d /etc/systemd/journald.conf.d/ ] && mkdir /etc/systemd/journald.conf.d/ if grep -Psq -- '^\h*\[Journal\]' /etc/systemd/journald.conf.d/60-journald.conf; then printf '%s\n' \"Storage=persistent\" >> /etc/systemd/journald.conf.d/60-journald.conf else printf '%s\n' \"[Journal]\" \"Storage=persistent\" >> /etc/systemd/journald.conf.d/60-journald.conf fi } Note: If this setting appears in a canonically later file, or later in the same file, the setting will be overwritten Run to following command to update the parameters in the service: # systemctl reload-or-restart systemd-journald" reference : "800-171|3.3.1,800-171|3.3.2,800-171|3.3.6,800-171r3|03.03.01,800-171r3|03.03.03,800-171r3|03.03.06a.,800-53|AU-2,800-53|AU-7,800-53|AU-12,800-53r5|AU-2,800-53r5|AU-7,800-53r5|AU-12,CN-L3|7.1.2.3(c),CN-L3|8.1.4.3(a),CSCv7|6.2,CSCv7|6.3,CSCv8|8.2,CSF|DE.CM-1,CSF|DE.CM-3,CSF|DE.CM-7,CSF|PR.PT-1,CSF|RS.AN-3,CSF2.0|DE.CM-01,CSF2.0|DE.CM-03,CSF2.0|DE.CM-09,CSF2.0|PR.PS-04,CSF2.0|RS.AN-03,CSF2.0|RS.AN-06,CSF2.0|RS.AN-07,GDPR|32.1.b,HIPAA|164.306(a)(1),HIPAA|164.312(b),ISO-27001-2022|A.8.15,ITSG-33|AU-2,ITSG-33|AU-7,ITSG-33|AU-12,LEVEL|1A,NESA|M1.2.2,NESA|M5.5.1,NIAv2|AM7,NIAv2|AM11a,NIAv2|AM11b,NIAv2|AM11c,NIAv2|AM11d,NIAv2|AM11e,NIAv2|SS30,NIAv2|VL8,PCI-DSSv3.2.1|10.1,QCSC-v1|3.2,QCSC-v1|6.2,QCSC-v1|8.2.1,QCSC-v1|10.2.1,QCSC-v1|11.2,QCSC-v1|13.2,SWIFT-CSCv1|6.4" see_also : "https://workbench.cisecurity.org/benchmarks/20333" cmd : "/bin/systemd-analyze cat-config systemd/journald.conf systemd/journald.conf.d/* | /bin/grep -E \"^Storage=persistent\"" expect : "Storage=persistent" description : "6.2.2.4 Ensure journald Storage is configured" 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 due to a reboot. 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. Note: This recommendation only applies if journald is the chosen method for client side logging Do not apply this recommendation if rsyslog is used." solution : "Set the following parameter in the [Journal] section in /etc/systemd/journald.conf or a file in /etc/systemd/journald.conf.d/ ending inconf : Storage=persistent Example: #!/usr/bin/env bash { [ ! -d /etc/systemd/journald.conf.d/ ] && mkdir /etc/systemd/journald.conf.d/ if grep -Psq -- '^\h*\[Journal\]' /etc/systemd/journald.conf.d/60-journald.conf; then printf '%s\n' \"Storage=persistent\" >> /etc/systemd/journald.conf.d/60-journald.conf else printf '%s\n' \"[Journal]\" \"Storage=persistent\" >> /etc/systemd/journald.conf.d/60-journald.conf fi } Note: If this setting appears in a canonically later file, or later in the same file, the setting will be overwritten Run to following command to update the parameters in the service: # systemctl reload-or-restart systemd-journald" reference : "800-171|3.3.1,800-171|3.3.2,800-171|3.3.6,800-171r3|03.03.01,800-171r3|03.03.03,800-171r3|03.03.06a.,800-53|AU-2,800-53|AU-7,800-53|AU-12,800-53r5|AU-2,800-53r5|AU-7,800-53r5|AU-12,CN-L3|7.1.2.3(c),CN-L3|8.1.4.3(a),CSCv7|6.2,CSCv7|6.3,CSCv8|8.2,CSF|DE.CM-1,CSF|DE.CM-3,CSF|DE.CM-7,CSF|PR.PT-1,CSF|RS.AN-3,CSF2.0|DE.CM-01,CSF2.0|DE.CM-03,CSF2.0|DE.CM-09,CSF2.0|PR.PS-04,CSF2.0|RS.AN-03,CSF2.0|RS.AN-06,CSF2.0|RS.AN-07,GDPR|32.1.b,HIPAA|164.306(a)(1),HIPAA|164.312(b),ISO-27001-2022|A.8.15,ITSG-33|AU-2,ITSG-33|AU-7,ITSG-33|AU-12,LEVEL|1A,NESA|M1.2.2,NESA|M5.5.1,NIAv2|AM7,NIAv2|AM11a,NIAv2|AM11b,NIAv2|AM11c,NIAv2|AM11d,NIAv2|AM11e,NIAv2|SS30,NIAv2|VL8,PCI-DSSv3.2.1|10.1,QCSC-v1|3.2,QCSC-v1|6.2,QCSC-v1|8.2.1,QCSC-v1|10.2.1,QCSC-v1|11.2,QCSC-v1|13.2,SWIFT-CSCv1|6.4" see_also : "https://workbench.cisecurity.org/benchmarks/20333" description : "6.2.2.4 Ensure journald Storage is configured" 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 due to a reboot. 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. Note: This recommendation only applies if journald is the chosen method for client side logging Do not apply this recommendation if rsyslog is used. NOTE: Nessus has not performed this check. Please review the benchmark to ensure target compliance." solution : "Set the following parameter in the [Journal] section in /etc/systemd/journald.conf or a file in /etc/systemd/journald.conf.d/ ending inconf : Storage=persistent Example: #!/usr/bin/env bash { [ ! -d /etc/systemd/journald.conf.d/ ] && mkdir /etc/systemd/journald.conf.d/ if grep -Psq -- '^\h*\[Journal\]' /etc/systemd/journald.conf.d/60-journald.conf; then printf '%s\n' \"Storage=persistent\" >> /etc/systemd/journald.conf.d/60-journald.conf else printf '%s\n' \"[Journal]\" \"Storage=persistent\" >> /etc/systemd/journald.conf.d/60-journald.conf fi } Note: If this setting appears in a canonically later file, or later in the same file, the setting will be overwritten Run to following command to update the parameters in the service: # systemctl reload-or-restart systemd-journald" reference : "800-171|3.3.1,800-171|3.3.2,800-171|3.3.6,800-171r3|03.03.01,800-171r3|03.03.03,800-171r3|03.03.06a.,800-53|AU-2,800-53|AU-7,800-53|AU-12,800-53r5|AU-2,800-53r5|AU-7,800-53r5|AU-12,CN-L3|7.1.2.3(c),CN-L3|8.1.4.3(a),CSCv7|6.2,CSCv7|6.3,CSCv8|8.2,CSF|DE.CM-1,CSF|DE.CM-3,CSF|DE.CM-7,CSF|PR.PT-1,CSF|RS.AN-3,CSF2.0|DE.CM-01,CSF2.0|DE.CM-03,CSF2.0|DE.CM-09,CSF2.0|PR.PS-04,CSF2.0|RS.AN-03,CSF2.0|RS.AN-06,CSF2.0|RS.AN-07,GDPR|32.1.b,HIPAA|164.306(a)(1),HIPAA|164.312(b),ISO-27001-2022|A.8.15,ITSG-33|AU-2,ITSG-33|AU-7,ITSG-33|AU-12,LEVEL|1A,NESA|M1.2.2,NESA|M5.5.1,NIAv2|AM7,NIAv2|AM11a,NIAv2|AM11b,NIAv2|AM11c,NIAv2|AM11d,NIAv2|AM11e,NIAv2|SS30,NIAv2|VL8,PCI-DSSv3.2.1|10.1,QCSC-v1|3.2,QCSC-v1|6.2,QCSC-v1|8.2.1,QCSC-v1|10.2.1,QCSC-v1|11.2,QCSC-v1|13.2,SWIFT-CSCv1|6.4" see_also : "https://workbench.cisecurity.org/benchmarks/20333" type : CMD_EXEC description : "journald check - active" cmd : "/bin/systemctl is-active systemd-journald" expect : "^active$" type : CMD_EXEC description : "rsyslog check - active" cmd : "/bin/systemctl is-active rsyslog" expect : "^active$" type : CMD_EXEC description : "rsyslog check - active" cmd : "/bin/systemctl is-active rsyslog" expect : "^active$" type : FILE_CONTENT_CHECK description : "advanced format" file : "/etc/rsyslog.conf /etc/rsyslog.d/*.conf" regex : "^\\s*([^#]+\\s+)?action\\(([^#]+\\s+)?\\b(target|protocol)=\"?(tcp|[^#\"]+\")?\\b" expect : "^\\s*([^#]+\\s+)?action\\(([^#]+\\s+)?\\b(target|protocol)=\"?(tcp|[^#\"]+\")?\\b" required : NO min_occurrences : "1" type : FILE_CONTENT_CHECK description : "basic format" file : "/etc/rsyslog.conf /etc/rsyslog.d/*.conf" regex : "^\\s*[^#]+\\.\\*\\s+@" expect : "^\\s*[^#]+\\.\\*\\s+@" required : NO min_occurrences : "1" description : "6.2.3.1.1 Ensure rsyslog is configured to send logs to a remote log host" info : "rsyslog supports the ability to send log events it gathers to a remote log host or to receive messages from remote hosts, thus enabling centralized log management. 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. Note: This recommendation only applies if rsyslog is the chosen method for client side logging. Do not apply this recommendation if systemd-journald is used." solution : "Edit the /etc/rsyslog.d/remote.conf. file and add the following line (where loghost.example.com is the name of your central log host). The target directive may either be a fully qualified domain name or an IP address. TCP Example: *.* action(type=\"omfwd\" target=\"loghost.example.com\" port=\"514\" protocol=\"tcp\" action.resumeRetryCount=\"100\" queue.type=\"LinkedList\" queue.size=\"1000\") Run the following command to reload rsyslog.service : # systemctl reload-or-restart rsyslog.service Open the respective port in the firewall. For firewalld with TCP on port 514 run: # firewall-cmd --add-port 514/tcp --permanent # firewall-cmd --reload" reference : "800-171|3.3.1,800-171|3.3.2,800-171|3.3.6,800-171r3|03.03.01,800-171r3|03.03.03,800-171r3|03.03.06a.,800-53|AU-2,800-53|AU-7,800-53|AU-12,800-53r5|AU-2,800-53r5|AU-7,800-53r5|AU-12,CN-L3|7.1.2.3(c),CN-L3|8.1.4.3(a),CSCv7|6.2,CSCv7|6.3,CSCv8|8.2,CSF|DE.CM-1,CSF|DE.CM-3,CSF|DE.CM-7,CSF|PR.PT-1,CSF|RS.AN-3,CSF2.0|DE.CM-01,CSF2.0|DE.CM-03,CSF2.0|DE.CM-09,CSF2.0|PR.PS-04,CSF2.0|RS.AN-03,CSF2.0|RS.AN-06,CSF2.0|RS.AN-07,GDPR|32.1.b,HIPAA|164.306(a)(1),HIPAA|164.312(b),ISO-27001-2022|A.8.15,ITSG-33|AU-2,ITSG-33|AU-7,ITSG-33|AU-12,LEVEL|1M,NESA|M1.2.2,NESA|M5.5.1,NIAv2|AM7,NIAv2|AM11a,NIAv2|AM11b,NIAv2|AM11c,NIAv2|AM11d,NIAv2|AM11e,NIAv2|SS30,NIAv2|VL8,PCI-DSSv3.2.1|10.1,QCSC-v1|3.2,QCSC-v1|6.2,QCSC-v1|8.2.1,QCSC-v1|10.2.1,QCSC-v1|11.2,QCSC-v1|13.2,SWIFT-CSCv1|6.4" see_also : "https://workbench.cisecurity.org/benchmarks/20333" show_output : YES description : "6.2.3.1.1 Ensure rsyslog is configured to send logs to a remote log host" info : "rsyslog supports the ability to send log events it gathers to a remote log host or to receive messages from remote hosts, thus enabling centralized log management. 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. Note: This recommendation only applies if rsyslog is the chosen method for client side logging. Do not apply this recommendation if systemd-journald is used." solution : "Edit the /etc/rsyslog.d/remote.conf. file and add the following line (where loghost.example.com is the name of your central log host). The target directive may either be a fully qualified domain name or an IP address. TCP Example: *.* action(type=\"omfwd\" target=\"loghost.example.com\" port=\"514\" protocol=\"tcp\" action.resumeRetryCount=\"100\" queue.type=\"LinkedList\" queue.size=\"1000\") Run the following command to reload rsyslog.service : # systemctl reload-or-restart rsyslog.service Open the respective port in the firewall. For firewalld with TCP on port 514 run: # firewall-cmd --add-port 514/tcp --permanent # firewall-cmd --reload" reference : "800-171|3.3.1,800-171|3.3.2,800-171|3.3.6,800-171r3|03.03.01,800-171r3|03.03.03,800-171r3|03.03.06a.,800-53|AU-2,800-53|AU-7,800-53|AU-12,800-53r5|AU-2,800-53r5|AU-7,800-53r5|AU-12,CN-L3|7.1.2.3(c),CN-L3|8.1.4.3(a),CSCv7|6.2,CSCv7|6.3,CSCv8|8.2,CSF|DE.CM-1,CSF|DE.CM-3,CSF|DE.CM-7,CSF|PR.PT-1,CSF|RS.AN-3,CSF2.0|DE.CM-01,CSF2.0|DE.CM-03,CSF2.0|DE.CM-09,CSF2.0|PR.PS-04,CSF2.0|RS.AN-03,CSF2.0|RS.AN-06,CSF2.0|RS.AN-07,GDPR|32.1.b,HIPAA|164.306(a)(1),HIPAA|164.312(b),ISO-27001-2022|A.8.15,ITSG-33|AU-2,ITSG-33|AU-7,ITSG-33|AU-12,LEVEL|1M,NESA|M1.2.2,NESA|M5.5.1,NIAv2|AM7,NIAv2|AM11a,NIAv2|AM11b,NIAv2|AM11c,NIAv2|AM11d,NIAv2|AM11e,NIAv2|SS30,NIAv2|VL8,PCI-DSSv3.2.1|10.1,QCSC-v1|3.2,QCSC-v1|6.2,QCSC-v1|8.2.1,QCSC-v1|10.2.1,QCSC-v1|11.2,QCSC-v1|13.2,SWIFT-CSCv1|6.4" see_also : "https://workbench.cisecurity.org/benchmarks/20333" description : "6.2.3.1.1 Ensure rsyslog is configured to send logs to a remote log host" info : "rsyslog supports the ability to send log events it gathers to a remote log host or to receive messages from remote hosts, thus enabling centralized log management. 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. Note: This recommendation only applies if rsyslog is the chosen method for client side logging. Do not apply this recommendation if systemd-journald is used. NOTE: Nessus has not performed this check. Please review the benchmark to ensure target compliance." solution : "Edit the /etc/rsyslog.d/remote.conf. file and add the following line (where loghost.example.com is the name of your central log host). The target directive may either be a fully qualified domain name or an IP address. TCP Example: *.* action(type=\"omfwd\" target=\"loghost.example.com\" port=\"514\" protocol=\"tcp\" action.resumeRetryCount=\"100\" queue.type=\"LinkedList\" queue.size=\"1000\") Run the following command to reload rsyslog.service : # systemctl reload-or-restart rsyslog.service Open the respective port in the firewall. For firewalld with TCP on port 514 run: # firewall-cmd --add-port 514/tcp --permanent # firewall-cmd --reload" reference : "800-171|3.3.1,800-171|3.3.2,800-171|3.3.6,800-171r3|03.03.01,800-171r3|03.03.03,800-171r3|03.03.06a.,800-53|AU-2,800-53|AU-7,800-53|AU-12,800-53r5|AU-2,800-53r5|AU-7,800-53r5|AU-12,CN-L3|7.1.2.3(c),CN-L3|8.1.4.3(a),CSCv7|6.2,CSCv7|6.3,CSCv8|8.2,CSF|DE.CM-1,CSF|DE.CM-3,CSF|DE.CM-7,CSF|PR.PT-1,CSF|RS.AN-3,CSF2.0|DE.CM-01,CSF2.0|DE.CM-03,CSF2.0|DE.CM-09,CSF2.0|PR.PS-04,CSF2.0|RS.AN-03,CSF2.0|RS.AN-06,CSF2.0|RS.AN-07,GDPR|32.1.b,HIPAA|164.306(a)(1),HIPAA|164.312(b),ISO-27001-2022|A.8.15,ITSG-33|AU-2,ITSG-33|AU-7,ITSG-33|AU-12,LEVEL|1M,NESA|M1.2.2,NESA|M5.5.1,NIAv2|AM7,NIAv2|AM11a,NIAv2|AM11b,NIAv2|AM11c,NIAv2|AM11d,NIAv2|AM11e,NIAv2|SS30,NIAv2|VL8,PCI-DSSv3.2.1|10.1,QCSC-v1|3.2,QCSC-v1|6.2,QCSC-v1|8.2.1,QCSC-v1|10.2.1,QCSC-v1|11.2,QCSC-v1|13.2,SWIFT-CSCv1|6.4" see_also : "https://workbench.cisecurity.org/benchmarks/20333" type : CMD_EXEC description : "journald check - active" cmd : "/bin/systemctl is-active systemd-journald" expect : "^active$" type : CMD_EXEC description : "rsyslog check - active" cmd : "/bin/systemctl is-active rsyslog" expect : "^active$" type : CMD_EXEC description : "rsyslog check - active" cmd : "/bin/systemctl is-active rsyslog" expect : "^active$" type : FILE_CONTENT_CHECK_NOT description : "input imtcp" file : "/etc/rsyslog.conf /etc/rsyslog.d/*.conf" regex : "^\\h*input\\(type=\"?imtcp\"?\\b" expect : "^\\h*input\\(type=\"?imtcp\"?\\b" type : FILE_CONTENT_CHECK_NOT description : "ModLoad" file : "/etc/rsyslog.conf /etc/rsyslog.d/*.conf" regex : "^\\h*\\$ModLoad\\h+imtcp\\b" expect : "^\\h*\\$ModLoad\\h+imtcp\\b" type : FILE_CONTENT_CHECK_NOT description : "InputTCPServerRun" file : "/etc/rsyslog.conf /etc/rsyslog.d/*.conf" regex : "^\\h*\\$InputTCPServerRun\\b" expect : "^\\h*\\$InputTCPServerRun\\b" type : FILE_CONTENT_CHECK_NOT description : "module imtcp" file : "/etc/rsyslog.conf /etc/rsyslog.d/*.conf" regex : "^\\h*module\\(load=\"?imtcp\"?\\)" expect : "^\\h*module\\(load=\"?imtcp\"?\\)" description : "6.2.3.1.2 Ensure rsyslog is not configured to receive logs from a remote client" info : "rsyslog supports the ability to receive messages from remote hosts, thus acting as a log server. Clients should not receive data from other hosts. If a client is configured to also receive data, thus turning it into a server, the client system is acting outside its operational boundary. Note: This recommendation only applies if rsyslog is the chosen method for client side logging. Do not apply this recommendation if systemd-journald is used." solution : "Should there be any active log server configuration found in the auditing section, modify those files and remove the specific lines highlighted by the audit. Verify none of the following entries are present in any of /etc/rsyslog.conf or /etc/rsyslog.d/*.conf advanced format module(load=\"imtcp\") input(type=\"imtcp\" port=\"514\") deprecated legacy format $ModLoad imtcp $InputTCPServerRun Restart the service: # systemctl restart rsyslog" reference : "800-171|3.4.2,800-171|3.4.6,800-171|3.4.7,800-171r3|03.04.02,800-171r3|03.04.06,800-53|CM-6,800-53|CM-7,800-53r5|CM-6,800-53r5|CM-7,CSCv7|9.2,CSCv8|4.8,CSF|PR.IP-1,CSF|PR.PT-3,CSF2.0|DE.CM-09,CSF2.0|PR.PS-01,GDPR|32.1.b,HIPAA|164.306(a)(1),ISO-27001-2022|A.8.9,ITSG-33|CM-6,ITSG-33|CM-7,LEVEL|1A,NIAv2|SS15a,PCI-DSSv3.2.1|2.2.2,SWIFT-CSCv1|2.3" see_also : "https://workbench.cisecurity.org/benchmarks/20333" show_output : YES description : "6.2.3.1.2 Ensure rsyslog is not configured to receive logs from a remote client" info : "rsyslog supports the ability to receive messages from remote hosts, thus acting as a log server. Clients should not receive data from other hosts. If a client is configured to also receive data, thus turning it into a server, the client system is acting outside its operational boundary. Note: This recommendation only applies if rsyslog is the chosen method for client side logging. Do not apply this recommendation if systemd-journald is used." solution : "Should there be any active log server configuration found in the auditing section, modify those files and remove the specific lines highlighted by the audit. Verify none of the following entries are present in any of /etc/rsyslog.conf or /etc/rsyslog.d/*.conf advanced format module(load=\"imtcp\") input(type=\"imtcp\" port=\"514\") deprecated legacy format $ModLoad imtcp $InputTCPServerRun Restart the service: # systemctl restart rsyslog" reference : "800-171|3.4.2,800-171|3.4.6,800-171|3.4.7,800-171r3|03.04.02,800-171r3|03.04.06,800-53|CM-6,800-53|CM-7,800-53r5|CM-6,800-53r5|CM-7,CSCv7|9.2,CSCv8|4.8,CSF|PR.IP-1,CSF|PR.PT-3,CSF2.0|DE.CM-09,CSF2.0|PR.PS-01,GDPR|32.1.b,HIPAA|164.306(a)(1),ISO-27001-2022|A.8.9,ITSG-33|CM-6,ITSG-33|CM-7,LEVEL|1A,NIAv2|SS15a,PCI-DSSv3.2.1|2.2.2,SWIFT-CSCv1|2.3" see_also : "https://workbench.cisecurity.org/benchmarks/20333" description : "6.2.3.1.2 Ensure rsyslog is not configured to receive logs from a remote client" info : "rsyslog supports the ability to receive messages from remote hosts, thus acting as a log server. Clients should not receive data from other hosts. If a client is configured to also receive data, thus turning it into a server, the client system is acting outside its operational boundary. Note: This recommendation only applies if rsyslog is the chosen method for client side logging. Do not apply this recommendation if systemd-journald is used. NOTE: Nessus has not performed this check. Please review the benchmark to ensure target compliance." solution : "Should there be any active log server configuration found in the auditing section, modify those files and remove the specific lines highlighted by the audit. Verify none of the following entries are present in any of /etc/rsyslog.conf or /etc/rsyslog.d/*.conf advanced format module(load=\"imtcp\") input(type=\"imtcp\" port=\"514\") deprecated legacy format $ModLoad imtcp $InputTCPServerRun Restart the service: # systemctl restart rsyslog" reference : "800-171|3.4.2,800-171|3.4.6,800-171|3.4.7,800-171r3|03.04.02,800-171r3|03.04.06,800-53|CM-6,800-53|CM-7,800-53r5|CM-6,800-53r5|CM-7,CSCv7|9.2,CSCv8|4.8,CSF|PR.IP-1,CSF|PR.PT-3,CSF2.0|DE.CM-09,CSF2.0|PR.PS-01,GDPR|32.1.b,HIPAA|164.306(a)(1),ISO-27001-2022|A.8.9,ITSG-33|CM-6,ITSG-33|CM-7,LEVEL|1A,NIAv2|SS15a,PCI-DSSv3.2.1|2.2.2,SWIFT-CSCv1|2.3" see_also : "https://workbench.cisecurity.org/benchmarks/20333" type : CMD_EXEC description : "journald check - active" cmd : "/bin/systemctl is-active systemd-journald" expect : "^active$" type : CMD_EXEC description : "rsyslog check - active" cmd : "/bin/systemctl is-active rsyslog" expect : "^active$" type : CMD_EXEC description : "rsyslog check - active" cmd : "/bin/systemctl is-active rsyslog" expect : "^active$" type : RPM_CHECK description : "6.2.3.2 Ensure rsyslog is installed" info : "The rsyslog software is recommended in environments where journald does not meet operation requirements. 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. Note: This recommendation only applies if rsyslog is the chosen method for client side logging. Do not apply this recommendation if journald is used." solution : "Run the following command to install rsyslog : # zypper install rsyslog" reference : "800-171|3.3.1,800-171|3.3.2,800-171|3.3.6,800-171r3|03.03.01,800-171r3|03.03.03,800-171r3|03.03.06a.,800-53|AU-2,800-53|AU-7,800-53|AU-12,800-53r5|AU-2,800-53r5|AU-7,800-53r5|AU-12,CN-L3|7.1.2.3(c),CN-L3|8.1.4.3(a),CSCv7|6.2,CSCv7|6.3,CSCv8|8.2,CSF|DE.CM-1,CSF|DE.CM-3,CSF|DE.CM-7,CSF|PR.PT-1,CSF|RS.AN-3,CSF2.0|DE.CM-01,CSF2.0|DE.CM-03,CSF2.0|DE.CM-09,CSF2.0|PR.PS-04,CSF2.0|RS.AN-03,CSF2.0|RS.AN-06,CSF2.0|RS.AN-07,GDPR|32.1.b,HIPAA|164.306(a)(1),HIPAA|164.312(b),ISO-27001-2022|A.8.15,ITSG-33|AU-2,ITSG-33|AU-7,ITSG-33|AU-12,LEVEL|1A,NESA|M1.2.2,NESA|M5.5.1,NIAv2|AM7,NIAv2|AM11a,NIAv2|AM11b,NIAv2|AM11c,NIAv2|AM11d,NIAv2|AM11e,NIAv2|SS30,NIAv2|VL8,PCI-DSSv3.2.1|10.1,QCSC-v1|3.2,QCSC-v1|6.2,QCSC-v1|8.2.1,QCSC-v1|10.2.1,QCSC-v1|11.2,QCSC-v1|13.2,SWIFT-CSCv1|6.4" see_also : "https://workbench.cisecurity.org/benchmarks/20333" rpm : "rsyslog-0.0.0-0" operator : "gt" required : YES description : "6.2.3.2 Ensure rsyslog is installed" info : "The rsyslog software is recommended in environments where journald does not meet operation requirements. 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. Note: This recommendation only applies if rsyslog is the chosen method for client side logging. Do not apply this recommendation if journald is used." solution : "Run the following command to install rsyslog : # zypper install rsyslog" reference : "800-171|3.3.1,800-171|3.3.2,800-171|3.3.6,800-171r3|03.03.01,800-171r3|03.03.03,800-171r3|03.03.06a.,800-53|AU-2,800-53|AU-7,800-53|AU-12,800-53r5|AU-2,800-53r5|AU-7,800-53r5|AU-12,CN-L3|7.1.2.3(c),CN-L3|8.1.4.3(a),CSCv7|6.2,CSCv7|6.3,CSCv8|8.2,CSF|DE.CM-1,CSF|DE.CM-3,CSF|DE.CM-7,CSF|PR.PT-1,CSF|RS.AN-3,CSF2.0|DE.CM-01,CSF2.0|DE.CM-03,CSF2.0|DE.CM-09,CSF2.0|PR.PS-04,CSF2.0|RS.AN-03,CSF2.0|RS.AN-06,CSF2.0|RS.AN-07,GDPR|32.1.b,HIPAA|164.306(a)(1),HIPAA|164.312(b),ISO-27001-2022|A.8.15,ITSG-33|AU-2,ITSG-33|AU-7,ITSG-33|AU-12,LEVEL|1A,NESA|M1.2.2,NESA|M5.5.1,NIAv2|AM7,NIAv2|AM11a,NIAv2|AM11b,NIAv2|AM11c,NIAv2|AM11d,NIAv2|AM11e,NIAv2|SS30,NIAv2|VL8,PCI-DSSv3.2.1|10.1,QCSC-v1|3.2,QCSC-v1|6.2,QCSC-v1|8.2.1,QCSC-v1|10.2.1,QCSC-v1|11.2,QCSC-v1|13.2,SWIFT-CSCv1|6.4" see_also : "https://workbench.cisecurity.org/benchmarks/20333" description : "6.2.3.2 Ensure rsyslog is installed" info : "The rsyslog software is recommended in environments where journald does not meet operation requirements. 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. Note: This recommendation only applies if rsyslog is the chosen method for client side logging. Do not apply this recommendation if journald is used. NOTE: Nessus has not performed this check. Please review the benchmark to ensure target compliance." solution : "Run the following command to install rsyslog : # zypper install rsyslog" reference : "800-171|3.3.1,800-171|3.3.2,800-171|3.3.6,800-171r3|03.03.01,800-171r3|03.03.03,800-171r3|03.03.06a.,800-53|AU-2,800-53|AU-7,800-53|AU-12,800-53r5|AU-2,800-53r5|AU-7,800-53r5|AU-12,CN-L3|7.1.2.3(c),CN-L3|8.1.4.3(a),CSCv7|6.2,CSCv7|6.3,CSCv8|8.2,CSF|DE.CM-1,CSF|DE.CM-3,CSF|DE.CM-7,CSF|PR.PT-1,CSF|RS.AN-3,CSF2.0|DE.CM-01,CSF2.0|DE.CM-03,CSF2.0|DE.CM-09,CSF2.0|PR.PS-04,CSF2.0|RS.AN-03,CSF2.0|RS.AN-06,CSF2.0|RS.AN-07,GDPR|32.1.b,HIPAA|164.306(a)(1),HIPAA|164.312(b),ISO-27001-2022|A.8.15,ITSG-33|AU-2,ITSG-33|AU-7,ITSG-33|AU-12,LEVEL|1A,NESA|M1.2.2,NESA|M5.5.1,NIAv2|AM7,NIAv2|AM11a,NIAv2|AM11b,NIAv2|AM11c,NIAv2|AM11d,NIAv2|AM11e,NIAv2|SS30,NIAv2|VL8,PCI-DSSv3.2.1|10.1,QCSC-v1|3.2,QCSC-v1|6.2,QCSC-v1|8.2.1,QCSC-v1|10.2.1,QCSC-v1|11.2,QCSC-v1|13.2,SWIFT-CSCv1|6.4" see_also : "https://workbench.cisecurity.org/benchmarks/20333" type : CMD_EXEC description : "journald check - active" cmd : "/bin/systemctl is-active systemd-journald" expect : "^active$" type : CMD_EXEC description : "rsyslog check - active" cmd : "/bin/systemctl is-active rsyslog" expect : "^active$" type : CMD_EXEC description : "rsyslog check - active" cmd : "/bin/systemctl is-active rsyslog" expect : "^active$" type : CMD_EXEC description : "rsyslog check - enabled" cmd : "/bin/systemctl is-enabled rsyslog" expect : "^enabled$" type : CMD_EXEC description : "rsyslog check - active" cmd : "/bin/systemctl is-active rsyslog" expect : "^active$" description : "6.2.3.3 Ensure rsyslog service is enabled and active" info : "Once the rsyslog package is installed, ensure that the service is enabled. If the rsyslog service is not enabled to start on boot, the system will not capture logging events. Note: This recommendation only applies if rsyslog is the chosen method for client side logging. Do not apply this recommendation if journald is used." solution : "- IF - rsyslog is being used for logging on the system: Run the following commands to unmask, enable, and start rsyslog.service : # systemctl unmask rsyslog.service # systemctl enable rsyslog.service # systemctl start rsyslog.service" reference : "800-171|3.3.1,800-171|3.3.2,800-171|3.3.6,800-171r3|03.03.01,800-171r3|03.03.03,800-171r3|03.03.06a.,800-53|AU-2,800-53|AU-7,800-53|AU-12,800-53r5|AU-2,800-53r5|AU-7,800-53r5|AU-12,CN-L3|7.1.2.3(c),CN-L3|8.1.4.3(a),CSCv7|6.2,CSCv7|6.3,CSCv8|8.2,CSF|DE.CM-1,CSF|DE.CM-3,CSF|DE.CM-7,CSF|PR.PT-1,CSF|RS.AN-3,CSF2.0|DE.CM-01,CSF2.0|DE.CM-03,CSF2.0|DE.CM-09,CSF2.0|PR.PS-04,CSF2.0|RS.AN-03,CSF2.0|RS.AN-06,CSF2.0|RS.AN-07,GDPR|32.1.b,HIPAA|164.306(a)(1),HIPAA|164.312(b),ISO-27001-2022|A.8.15,ITSG-33|AU-2,ITSG-33|AU-7,ITSG-33|AU-12,LEVEL|1A,NESA|M1.2.2,NESA|M5.5.1,NIAv2|AM7,NIAv2|AM11a,NIAv2|AM11b,NIAv2|AM11c,NIAv2|AM11d,NIAv2|AM11e,NIAv2|SS30,NIAv2|VL8,PCI-DSSv3.2.1|10.1,QCSC-v1|3.2,QCSC-v1|6.2,QCSC-v1|8.2.1,QCSC-v1|10.2.1,QCSC-v1|11.2,QCSC-v1|13.2,SWIFT-CSCv1|6.4" see_also : "https://workbench.cisecurity.org/benchmarks/20333" show_output : YES description : "6.2.3.3 Ensure rsyslog service is enabled and active" info : "Once the rsyslog package is installed, ensure that the service is enabled. If the rsyslog service is not enabled to start on boot, the system will not capture logging events. Note: This recommendation only applies if rsyslog is the chosen method for client side logging. Do not apply this recommendation if journald is used." solution : "- IF - rsyslog is being used for logging on the system: Run the following commands to unmask, enable, and start rsyslog.service : # systemctl unmask rsyslog.service # systemctl enable rsyslog.service # systemctl start rsyslog.service" reference : "800-171|3.3.1,800-171|3.3.2,800-171|3.3.6,800-171r3|03.03.01,800-171r3|03.03.03,800-171r3|03.03.06a.,800-53|AU-2,800-53|AU-7,800-53|AU-12,800-53r5|AU-2,800-53r5|AU-7,800-53r5|AU-12,CN-L3|7.1.2.3(c),CN-L3|8.1.4.3(a),CSCv7|6.2,CSCv7|6.3,CSCv8|8.2,CSF|DE.CM-1,CSF|DE.CM-3,CSF|DE.CM-7,CSF|PR.PT-1,CSF|RS.AN-3,CSF2.0|DE.CM-01,CSF2.0|DE.CM-03,CSF2.0|DE.CM-09,CSF2.0|PR.PS-04,CSF2.0|RS.AN-03,CSF2.0|RS.AN-06,CSF2.0|RS.AN-07,GDPR|32.1.b,HIPAA|164.306(a)(1),HIPAA|164.312(b),ISO-27001-2022|A.8.15,ITSG-33|AU-2,ITSG-33|AU-7,ITSG-33|AU-12,LEVEL|1A,NESA|M1.2.2,NESA|M5.5.1,NIAv2|AM7,NIAv2|AM11a,NIAv2|AM11b,NIAv2|AM11c,NIAv2|AM11d,NIAv2|AM11e,NIAv2|SS30,NIAv2|VL8,PCI-DSSv3.2.1|10.1,QCSC-v1|3.2,QCSC-v1|6.2,QCSC-v1|8.2.1,QCSC-v1|10.2.1,QCSC-v1|11.2,QCSC-v1|13.2,SWIFT-CSCv1|6.4" see_also : "https://workbench.cisecurity.org/benchmarks/20333" description : "6.2.3.3 Ensure rsyslog service is enabled and active" info : "Once the rsyslog package is installed, ensure that the service is enabled. If the rsyslog service is not enabled to start on boot, the system will not capture logging events. Note: This recommendation only applies if rsyslog is the chosen method for client side logging. Do not apply this recommendation if journald is used. NOTE: Nessus has not performed this check. Please review the benchmark to ensure target compliance." solution : "- IF - rsyslog is being used for logging on the system: Run the following commands to unmask, enable, and start rsyslog.service : # systemctl unmask rsyslog.service # systemctl enable rsyslog.service # systemctl start rsyslog.service" reference : "800-171|3.3.1,800-171|3.3.2,800-171|3.3.6,800-171r3|03.03.01,800-171r3|03.03.03,800-171r3|03.03.06a.,800-53|AU-2,800-53|AU-7,800-53|AU-12,800-53r5|AU-2,800-53r5|AU-7,800-53r5|AU-12,CN-L3|7.1.2.3(c),CN-L3|8.1.4.3(a),CSCv7|6.2,CSCv7|6.3,CSCv8|8.2,CSF|DE.CM-1,CSF|DE.CM-3,CSF|DE.CM-7,CSF|PR.PT-1,CSF|RS.AN-3,CSF2.0|DE.CM-01,CSF2.0|DE.CM-03,CSF2.0|DE.CM-09,CSF2.0|PR.PS-04,CSF2.0|RS.AN-03,CSF2.0|RS.AN-06,CSF2.0|RS.AN-07,GDPR|32.1.b,HIPAA|164.306(a)(1),HIPAA|164.312(b),ISO-27001-2022|A.8.15,ITSG-33|AU-2,ITSG-33|AU-7,ITSG-33|AU-12,LEVEL|1A,NESA|M1.2.2,NESA|M5.5.1,NIAv2|AM7,NIAv2|AM11a,NIAv2|AM11b,NIAv2|AM11c,NIAv2|AM11d,NIAv2|AM11e,NIAv2|SS30,NIAv2|VL8,PCI-DSSv3.2.1|10.1,QCSC-v1|3.2,QCSC-v1|6.2,QCSC-v1|8.2.1,QCSC-v1|10.2.1,QCSC-v1|11.2,QCSC-v1|13.2,SWIFT-CSCv1|6.4" see_also : "https://workbench.cisecurity.org/benchmarks/20333" type : CMD_EXEC description : "journald check - active" cmd : "/bin/systemctl is-active systemd-journald" expect : "^active$" type : CMD_EXEC description : "rsyslog check - active" cmd : "/bin/systemctl is-active rsyslog" expect : "^active$" type : CMD_EXEC description : "rsyslog check - active" cmd : "/bin/systemctl is-active rsyslog" expect : "^active$" type : CMD_EXEC description : "6.2.3.4 Ensure journald is configured to send logs to rsyslog" info : "Data from systemd-journald may be stored in volatile memory or persisted locally on the server. Utilities exist to accept remote export of systemd-journald logs, however, use of the rsyslog service provides a consistent means of log collection and export. - IF - rsyslog is the preferred method for capturing logs, all logs of the system should be sent to it for further processing." solution : "- IF - rsyslog is the preferred method for capturing logs: Set the following parameter in the [Journal] section in /etc/systemd/journald.conf or a file in /etc/systemd/journald.conf.d/ ending inconf : ForwardToSyslog=yes Example: #!/usr/bin/env bash { [ ! -d /etc/systemd/journald.conf.d/ ] && mkdir /etc/systemd/journald.conf.d/ if grep -Psq -- '^\h*\[Journal\]' /etc/systemd/journald.conf.d/60-journald.conf; then printf '%s\n' \"ForwardToSyslog=yes\" >> /etc/systemd/journald.conf.d/60-journald.conf else printf '%s\n' \"[Journal]\" \"ForwardToSyslog=yes\" >> /etc/systemd/journald.conf.d/60-journald.conf fi } Note: If this setting appears in a canonically later file, or later in the same file, the setting will be overwritten Run to following command to update the parameters in the service: Restart systemd-journald.service : # systemctl reload-or-restart systemd-journald.service Impact: - IF - Journald is the preferred method for capturing logs, this section and Recommendation should be skipped and the \"Configure Journald\" section followed." reference : "800-171|3.3.1,800-171|3.3.2,800-171|3.3.5,800-171|3.3.6,800-171r3|03.03.01,800-171r3|03.03.03,800-171r3|03.03.05c.,800-171r3|03.03.06a.,800-53|AU-2,800-53|AU-6(3),800-53|AU-7,800-53|AU-12,800-53r5|AU-2,800-53r5|AU-6(3),800-53r5|AU-7,800-53r5|AU-12,CN-L3|7.1.2.3(c),CN-L3|7.1.3.3(d),CN-L3|8.1.4.3(a),CSCv7|6.2,CSCv7|6.3,CSCv7|6.5,CSCv8|8.2,CSCv8|8.9,CSF|DE.AE-2,CSF|DE.AE-3,CSF|DE.CM-1,CSF|DE.CM-3,CSF|DE.CM-7,CSF|DE.DP-4,CSF|PR.PT-1,CSF|RS.AN-1,CSF|RS.AN-3,CSF|RS.CO-2,CSF2.0|DE.AE-02,CSF2.0|DE.AE-03,CSF2.0|DE.CM-01,CSF2.0|DE.CM-03,CSF2.0|DE.CM-09,CSF2.0|PR.PS-04,CSF2.0|RS.AN-03,CSF2.0|RS.AN-06,CSF2.0|RS.AN-07,GDPR|32.1.b,HIPAA|164.306(a)(1),HIPAA|164.312(b),ISO-27001-2022|A.5.25,ISO-27001-2022|A.6.8,ISO-27001-2022|A.8.15,ITSG-33|AU-2,ITSG-33|AU-6(3),ITSG-33|AU-7,ITSG-33|AU-12,LEVEL|1A,NESA|M1.2.2,NESA|M5.2.5,NESA|M5.5.1,NIAv2|AM7,NIAv2|AM11a,NIAv2|AM11b,NIAv2|AM11c,NIAv2|AM11d,NIAv2|AM11e,NIAv2|SS30,NIAv2|VL8,PCI-DSSv3.2.1|10.1,QCSC-v1|3.2,QCSC-v1|5.2.3,QCSC-v1|6.2,QCSC-v1|8.2.1,QCSC-v1|10.2.1,QCSC-v1|11.2,QCSC-v1|13.2,SWIFT-CSCv1|6.4" see_also : "https://workbench.cisecurity.org/benchmarks/20333" cmd : "/bin/systemd-analyze cat-config systemd/journald.conf systemd/journald.conf.d/* | /bin/grep -E \"^ForwardToSyslog=yes\"" expect : "ForwardToSyslog=yes" description : "6.2.3.4 Ensure journald is configured to send logs to rsyslog" info : "Data from systemd-journald may be stored in volatile memory or persisted locally on the server. Utilities exist to accept remote export of systemd-journald logs, however, use of the rsyslog service provides a consistent means of log collection and export. - IF - rsyslog is the preferred method for capturing logs, all logs of the system should be sent to it for further processing." solution : "- IF - rsyslog is the preferred method for capturing logs: Set the following parameter in the [Journal] section in /etc/systemd/journald.conf or a file in /etc/systemd/journald.conf.d/ ending inconf : ForwardToSyslog=yes Example: #!/usr/bin/env bash { [ ! -d /etc/systemd/journald.conf.d/ ] && mkdir /etc/systemd/journald.conf.d/ if grep -Psq -- '^\h*\[Journal\]' /etc/systemd/journald.conf.d/60-journald.conf; then printf '%s\n' \"ForwardToSyslog=yes\" >> /etc/systemd/journald.conf.d/60-journald.conf else printf '%s\n' \"[Journal]\" \"ForwardToSyslog=yes\" >> /etc/systemd/journald.conf.d/60-journald.conf fi } Note: If this setting appears in a canonically later file, or later in the same file, the setting will be overwritten Run to following command to update the parameters in the service: Restart systemd-journald.service : # systemctl reload-or-restart systemd-journald.service Impact: - IF - Journald is the preferred method for capturing logs, this section and Recommendation should be skipped and the \"Configure Journald\" section followed." reference : "800-171|3.3.1,800-171|3.3.2,800-171|3.3.5,800-171|3.3.6,800-171r3|03.03.01,800-171r3|03.03.03,800-171r3|03.03.05c.,800-171r3|03.03.06a.,800-53|AU-2,800-53|AU-6(3),800-53|AU-7,800-53|AU-12,800-53r5|AU-2,800-53r5|AU-6(3),800-53r5|AU-7,800-53r5|AU-12,CN-L3|7.1.2.3(c),CN-L3|7.1.3.3(d),CN-L3|8.1.4.3(a),CSCv7|6.2,CSCv7|6.3,CSCv7|6.5,CSCv8|8.2,CSCv8|8.9,CSF|DE.AE-2,CSF|DE.AE-3,CSF|DE.CM-1,CSF|DE.CM-3,CSF|DE.CM-7,CSF|DE.DP-4,CSF|PR.PT-1,CSF|RS.AN-1,CSF|RS.AN-3,CSF|RS.CO-2,CSF2.0|DE.AE-02,CSF2.0|DE.AE-03,CSF2.0|DE.CM-01,CSF2.0|DE.CM-03,CSF2.0|DE.CM-09,CSF2.0|PR.PS-04,CSF2.0|RS.AN-03,CSF2.0|RS.AN-06,CSF2.0|RS.AN-07,GDPR|32.1.b,HIPAA|164.306(a)(1),HIPAA|164.312(b),ISO-27001-2022|A.5.25,ISO-27001-2022|A.6.8,ISO-27001-2022|A.8.15,ITSG-33|AU-2,ITSG-33|AU-6(3),ITSG-33|AU-7,ITSG-33|AU-12,LEVEL|1A,NESA|M1.2.2,NESA|M5.2.5,NESA|M5.5.1,NIAv2|AM7,NIAv2|AM11a,NIAv2|AM11b,NIAv2|AM11c,NIAv2|AM11d,NIAv2|AM11e,NIAv2|SS30,NIAv2|VL8,PCI-DSSv3.2.1|10.1,QCSC-v1|3.2,QCSC-v1|5.2.3,QCSC-v1|6.2,QCSC-v1|8.2.1,QCSC-v1|10.2.1,QCSC-v1|11.2,QCSC-v1|13.2,SWIFT-CSCv1|6.4" see_also : "https://workbench.cisecurity.org/benchmarks/20333" description : "6.2.3.4 Ensure journald is configured to send logs to rsyslog" info : "Data from systemd-journald may be stored in volatile memory or persisted locally on the server. Utilities exist to accept remote export of systemd-journald logs, however, use of the rsyslog service provides a consistent means of log collection and export. - IF - rsyslog is the preferred method for capturing logs, all logs of the system should be sent to it for further processing. NOTE: Nessus has not performed this check. Please review the benchmark to ensure target compliance." solution : "- IF - rsyslog is the preferred method for capturing logs: Set the following parameter in the [Journal] section in /etc/systemd/journald.conf or a file in /etc/systemd/journald.conf.d/ ending inconf : ForwardToSyslog=yes Example: #!/usr/bin/env bash { [ ! -d /etc/systemd/journald.conf.d/ ] && mkdir /etc/systemd/journald.conf.d/ if grep -Psq -- '^\h*\[Journal\]' /etc/systemd/journald.conf.d/60-journald.conf; then printf '%s\n' \"ForwardToSyslog=yes\" >> /etc/systemd/journald.conf.d/60-journald.conf else printf '%s\n' \"[Journal]\" \"ForwardToSyslog=yes\" >> /etc/systemd/journald.conf.d/60-journald.conf fi } Note: If this setting appears in a canonically later file, or later in the same file, the setting will be overwritten Run to following command to update the parameters in the service: Restart systemd-journald.service : # systemctl reload-or-restart systemd-journald.service Impact: - IF - Journald is the preferred method for capturing logs, this section and Recommendation should be skipped and the \"Configure Journald\" section followed." reference : "800-171|3.3.1,800-171|3.3.2,800-171|3.3.5,800-171|3.3.6,800-171r3|03.03.01,800-171r3|03.03.03,800-171r3|03.03.05c.,800-171r3|03.03.06a.,800-53|AU-2,800-53|AU-6(3),800-53|AU-7,800-53|AU-12,800-53r5|AU-2,800-53r5|AU-6(3),800-53r5|AU-7,800-53r5|AU-12,CN-L3|7.1.2.3(c),CN-L3|7.1.3.3(d),CN-L3|8.1.4.3(a),CSCv7|6.2,CSCv7|6.3,CSCv7|6.5,CSCv8|8.2,CSCv8|8.9,CSF|DE.AE-2,CSF|DE.AE-3,CSF|DE.CM-1,CSF|DE.CM-3,CSF|DE.CM-7,CSF|DE.DP-4,CSF|PR.PT-1,CSF|RS.AN-1,CSF|RS.AN-3,CSF|RS.CO-2,CSF2.0|DE.AE-02,CSF2.0|DE.AE-03,CSF2.0|DE.CM-01,CSF2.0|DE.CM-03,CSF2.0|DE.CM-09,CSF2.0|PR.PS-04,CSF2.0|RS.AN-03,CSF2.0|RS.AN-06,CSF2.0|RS.AN-07,GDPR|32.1.b,HIPAA|164.306(a)(1),HIPAA|164.312(b),ISO-27001-2022|A.5.25,ISO-27001-2022|A.6.8,ISO-27001-2022|A.8.15,ITSG-33|AU-2,ITSG-33|AU-6(3),ITSG-33|AU-7,ITSG-33|AU-12,LEVEL|1A,NESA|M1.2.2,NESA|M5.2.5,NESA|M5.5.1,NIAv2|AM7,NIAv2|AM11a,NIAv2|AM11b,NIAv2|AM11c,NIAv2|AM11d,NIAv2|AM11e,NIAv2|SS30,NIAv2|VL8,PCI-DSSv3.2.1|10.1,QCSC-v1|3.2,QCSC-v1|5.2.3,QCSC-v1|6.2,QCSC-v1|8.2.1,QCSC-v1|10.2.1,QCSC-v1|11.2,QCSC-v1|13.2,SWIFT-CSCv1|6.4" see_also : "https://workbench.cisecurity.org/benchmarks/20333" type : CMD_EXEC description : "journald check - active" cmd : "/bin/systemctl is-active systemd-journald.service" expect : "^active$" type : CMD_EXEC description : "rsyslog check - active" cmd : "/bin/systemctl is-active rsyslog" expect : "^active$" type : CMD_EXEC description : "rsyslog check - enabled" cmd : "/bin/systemctl is-enabled rsyslog" expect : "^enabled$" type : RPM_CHECK description : "Check for rsyslog package" rpm : "rsyslog-0.0.0-0" operator : "gt" required : YES type : CMD_EXEC description : "rsyslog check - active" cmd : "/bin/systemctl is-active rsyslog" expect : "^active$" type : FILE_CONTENT_CHECK description : "6.2.3.5 Ensure rsyslog log file creation mode is configured" info : "rsyslog will create logfiles that do not already exist on the system. The $FileCreateMode parameter allows you to specify the creation mode with which rsyslog creates new files. If not specified, the value 0644 is used (which retains backward-compatibility with earlier releases). The value given must always be a 4-digit octal number, with the initial digit being zero. Please note that the actual permission depend on rsyslogd's process umask. $FileCreateMode may be specified multiple times. If so, it specifies the creation mode for all selector lines that follow until the next $FileCreateMode parameter. Order of lines is vitally important. It is important to ensure that log files have the correct permissions to ensure that sensitive data is archived and protected. Note: This recommendation only applies if rsyslog is the chosen method for client side logging. Do not apply this recommendation if systemd-journald is used." solution : "Edit either /etc/rsyslog.conf or a dedicatedconf file in /etc/rsyslog.d/ and set $FileCreateMode to 0640 or more restrictive: $FileCreateMode 0640 Restart the service: # systemctl restart rsyslog" reference : "800-171|3.1.1,800-171|3.1.4,800-171|3.1.5,800-171|3.3.1,800-171|3.3.2,800-171|3.3.6,800-171|3.8.1,800-171|3.8.2,800-171|3.8.3,800-171r3|03.01.02,800-171r3|03.01.04,800-171r3|03.01.05a.,800-171r3|03.03.01,800-171r3|03.03.03,800-171r3|03.03.06a.,800-171r3|03.08.02,800-53|AC-3,800-53|AC-5,800-53|AC-6,800-53|AU-2,800-53|AU-7,800-53|AU-12,800-53|MP-2,800-53r5|AC-3,800-53r5|AC-5,800-53r5|AC-6,800-53r5|AU-2,800-53r5|AU-7,800-53r5|AU-12,800-53r5|MP-2,CN-L3|7.1.2.3(c),CN-L3|7.1.3.2(b),CN-L3|7.1.3.2(g),CN-L3|8.1.4.2(d),CN-L3|8.1.4.2(f),CN-L3|8.1.4.3(a),CN-L3|8.1.4.11(b),CN-L3|8.1.10.2(c),CN-L3|8.1.10.6(a),CN-L3|8.5.3.1,CN-L3|8.5.4.1(a),CSCv7|5.1,CSCv7|6.2,CSCv7|6.3,CSCv8|3.3,CSCv8|8.2,CSF|DE.CM-1,CSF|DE.CM-3,CSF|DE.CM-7,CSF|PR.AC-4,CSF|PR.DS-5,CSF|PR.PT-1,CSF|PR.PT-2,CSF|PR.PT-3,CSF|RS.AN-3,CSF2.0|DE.CM-01,CSF2.0|DE.CM-03,CSF2.0|DE.CM-09,CSF2.0|PR.AA-05,CSF2.0|PR.DS-10,CSF2.0|PR.IR-01,CSF2.0|PR.PS-04,CSF2.0|RS.AN-03,CSF2.0|RS.AN-06,CSF2.0|RS.AN-07,GDPR|32.1.b,HIPAA|164.306(a)(1),HIPAA|164.312(a)(1),HIPAA|164.312(b),ISO-27001-2022|A.5.3,ISO-27001-2022|A.5.10,ISO-27001-2022|A.5.15,ISO-27001-2022|A.5.33,ISO-27001-2022|A.7.7,ISO-27001-2022|A.7.10,ISO-27001-2022|A.8.2,ISO-27001-2022|A.8.3,ISO-27001-2022|A.8.15,ISO-27001-2022|A.8.18,ISO-27001-2022|A.8.20,ISO/IEC-27001|A.6.1.2,ISO/IEC-27001|A.9.4.1,ISO/IEC-27001|A.9.4.5,ITSG-33|AC-3,ITSG-33|AC-5,ITSG-33|AC-6,ITSG-33|AU-2,ITSG-33|AU-7,ITSG-33|AU-12,ITSG-33|MP-2,ITSG-33|MP-2a.,LEVEL|1A,NESA|M1.2.2,NESA|M5.5.1,NESA|T1.3.2,NESA|T1.3.3,NESA|T1.4.1,NESA|T4.2.1,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.2,NESA|T7.5.3,NIAv2|AM1,NIAv2|AM3,NIAv2|AM7,NIAv2|AM11a,NIAv2|AM11b,NIAv2|AM11c,NIAv2|AM11d,NIAv2|AM11e,NIAv2|AM23f,NIAv2|SS13c,NIAv2|SS15c,NIAv2|SS29,NIAv2|SS30,NIAv2|VL8,PCI-DSSv3.2.1|7.1.2,PCI-DSSv3.2.1|10.1,PCI-DSSv4.0|7.2.1,PCI-DSSv4.0|7.2.2,QCSC-v1|3.2,QCSC-v1|5.2.2,QCSC-v1|6.2,QCSC-v1|8.2.1,QCSC-v1|10.2.1,QCSC-v1|11.2,QCSC-v1|13.2,SWIFT-CSCv1|5.1,SWIFT-CSCv1|6.4,TBA-FIISB|31.1,TBA-FIISB|31.4.2,TBA-FIISB|31.4.3" see_also : "https://workbench.cisecurity.org/benchmarks/20333" file : "/etc/rsyslog.conf /etc/rsyslog.d/*.conf" regex : "^[\\s]*\\$FileCreateMode" expect : "\\$FileCreateMode 0[0246][024]0[\\s]*$" min_occurrences : "1" string_required : NO description : "6.2.3.5 Ensure rsyslog log file creation mode is configured" info : "rsyslog will create logfiles that do not already exist on the system. The $FileCreateMode parameter allows you to specify the creation mode with which rsyslog creates new files. If not specified, the value 0644 is used (which retains backward-compatibility with earlier releases). The value given must always be a 4-digit octal number, with the initial digit being zero. Please note that the actual permission depend on rsyslogd's process umask. $FileCreateMode may be specified multiple times. If so, it specifies the creation mode for all selector lines that follow until the next $FileCreateMode parameter. Order of lines is vitally important. It is important to ensure that log files have the correct permissions to ensure that sensitive data is archived and protected. Note: This recommendation only applies if rsyslog is the chosen method for client side logging. Do not apply this recommendation if systemd-journald is used. NOTE: The identified logging service 'rsyslog' was not found to be active and this check does not apply." solution : "Edit either /etc/rsyslog.conf or a dedicatedconf file in /etc/rsyslog.d/ and set $FileCreateMode to 0640 or more restrictive: $FileCreateMode 0640 Restart the service: # systemctl restart rsyslog" reference : "800-171|3.1.1,800-171|3.1.4,800-171|3.1.5,800-171|3.3.1,800-171|3.3.2,800-171|3.3.6,800-171|3.8.1,800-171|3.8.2,800-171|3.8.3,800-171r3|03.01.02,800-171r3|03.01.04,800-171r3|03.01.05a.,800-171r3|03.03.01,800-171r3|03.03.03,800-171r3|03.03.06a.,800-171r3|03.08.02,800-53|AC-3,800-53|AC-5,800-53|AC-6,800-53|AU-2,800-53|AU-7,800-53|AU-12,800-53|MP-2,800-53r5|AC-3,800-53r5|AC-5,800-53r5|AC-6,800-53r5|AU-2,800-53r5|AU-7,800-53r5|AU-12,800-53r5|MP-2,CN-L3|7.1.2.3(c),CN-L3|7.1.3.2(b),CN-L3|7.1.3.2(g),CN-L3|8.1.4.2(d),CN-L3|8.1.4.2(f),CN-L3|8.1.4.3(a),CN-L3|8.1.4.11(b),CN-L3|8.1.10.2(c),CN-L3|8.1.10.6(a),CN-L3|8.5.3.1,CN-L3|8.5.4.1(a),CSCv7|5.1,CSCv7|6.2,CSCv7|6.3,CSCv8|3.3,CSCv8|8.2,CSF|DE.CM-1,CSF|DE.CM-3,CSF|DE.CM-7,CSF|PR.AC-4,CSF|PR.DS-5,CSF|PR.PT-1,CSF|PR.PT-2,CSF|PR.PT-3,CSF|RS.AN-3,CSF2.0|DE.CM-01,CSF2.0|DE.CM-03,CSF2.0|DE.CM-09,CSF2.0|PR.AA-05,CSF2.0|PR.DS-10,CSF2.0|PR.IR-01,CSF2.0|PR.PS-04,CSF2.0|RS.AN-03,CSF2.0|RS.AN-06,CSF2.0|RS.AN-07,GDPR|32.1.b,HIPAA|164.306(a)(1),HIPAA|164.312(a)(1),HIPAA|164.312(b),ISO-27001-2022|A.5.3,ISO-27001-2022|A.5.10,ISO-27001-2022|A.5.15,ISO-27001-2022|A.5.33,ISO-27001-2022|A.7.7,ISO-27001-2022|A.7.10,ISO-27001-2022|A.8.2,ISO-27001-2022|A.8.3,ISO-27001-2022|A.8.15,ISO-27001-2022|A.8.18,ISO-27001-2022|A.8.20,ISO/IEC-27001|A.6.1.2,ISO/IEC-27001|A.9.4.1,ISO/IEC-27001|A.9.4.5,ITSG-33|AC-3,ITSG-33|AC-5,ITSG-33|AC-6,ITSG-33|AU-2,ITSG-33|AU-7,ITSG-33|AU-12,ITSG-33|MP-2,ITSG-33|MP-2a.,LEVEL|1A,NESA|M1.2.2,NESA|M5.5.1,NESA|T1.3.2,NESA|T1.3.3,NESA|T1.4.1,NESA|T4.2.1,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.2,NESA|T7.5.3,NIAv2|AM1,NIAv2|AM3,NIAv2|AM7,NIAv2|AM11a,NIAv2|AM11b,NIAv2|AM11c,NIAv2|AM11d,NIAv2|AM11e,NIAv2|AM23f,NIAv2|SS13c,NIAv2|SS15c,NIAv2|SS29,NIAv2|SS30,NIAv2|VL8,PCI-DSSv3.2.1|7.1.2,PCI-DSSv3.2.1|10.1,PCI-DSSv4.0|7.2.1,PCI-DSSv4.0|7.2.2,QCSC-v1|3.2,QCSC-v1|5.2.2,QCSC-v1|6.2,QCSC-v1|8.2.1,QCSC-v1|10.2.1,QCSC-v1|11.2,QCSC-v1|13.2,SWIFT-CSCv1|5.1,SWIFT-CSCv1|6.4,TBA-FIISB|31.1,TBA-FIISB|31.4.2,TBA-FIISB|31.4.3" see_also : "https://workbench.cisecurity.org/benchmarks/20333" description : "6.2.3.5 Ensure rsyslog log file creation mode is configured" info : "rsyslog will create logfiles that do not already exist on the system. The $FileCreateMode parameter allows you to specify the creation mode with which rsyslog creates new files. If not specified, the value 0644 is used (which retains backward-compatibility with earlier releases). The value given must always be a 4-digit octal number, with the initial digit being zero. Please note that the actual permission depend on rsyslogd's process umask. $FileCreateMode may be specified multiple times. If so, it specifies the creation mode for all selector lines that follow until the next $FileCreateMode parameter. Order of lines is vitally important. It is important to ensure that log files have the correct permissions to ensure that sensitive data is archived and protected. Note: This recommendation only applies if rsyslog is the chosen method for client side logging. Do not apply this recommendation if systemd-journald is used. NOTE: Nessus has not performed this check. Please review the benchmark to ensure target compliance. NOTE: journald or rsyslog was not found to be active. Review benchmark guidance to ensure local compliance." solution : "Edit either /etc/rsyslog.conf or a dedicatedconf file in /etc/rsyslog.d/ and set $FileCreateMode to 0640 or more restrictive: $FileCreateMode 0640 Restart the service: # systemctl restart rsyslog" reference : "800-171|3.1.1,800-171|3.1.4,800-171|3.1.5,800-171|3.3.1,800-171|3.3.2,800-171|3.3.6,800-171|3.8.1,800-171|3.8.2,800-171|3.8.3,800-171r3|03.01.02,800-171r3|03.01.04,800-171r3|03.01.05a.,800-171r3|03.03.01,800-171r3|03.03.03,800-171r3|03.03.06a.,800-171r3|03.08.02,800-53|AC-3,800-53|AC-5,800-53|AC-6,800-53|AU-2,800-53|AU-7,800-53|AU-12,800-53|MP-2,800-53r5|AC-3,800-53r5|AC-5,800-53r5|AC-6,800-53r5|AU-2,800-53r5|AU-7,800-53r5|AU-12,800-53r5|MP-2,CN-L3|7.1.2.3(c),CN-L3|7.1.3.2(b),CN-L3|7.1.3.2(g),CN-L3|8.1.4.2(d),CN-L3|8.1.4.2(f),CN-L3|8.1.4.3(a),CN-L3|8.1.4.11(b),CN-L3|8.1.10.2(c),CN-L3|8.1.10.6(a),CN-L3|8.5.3.1,CN-L3|8.5.4.1(a),CSCv7|5.1,CSCv7|6.2,CSCv7|6.3,CSCv8|3.3,CSCv8|8.2,CSF|DE.CM-1,CSF|DE.CM-3,CSF|DE.CM-7,CSF|PR.AC-4,CSF|PR.DS-5,CSF|PR.PT-1,CSF|PR.PT-2,CSF|PR.PT-3,CSF|RS.AN-3,CSF2.0|DE.CM-01,CSF2.0|DE.CM-03,CSF2.0|DE.CM-09,CSF2.0|PR.AA-05,CSF2.0|PR.DS-10,CSF2.0|PR.IR-01,CSF2.0|PR.PS-04,CSF2.0|RS.AN-03,CSF2.0|RS.AN-06,CSF2.0|RS.AN-07,GDPR|32.1.b,HIPAA|164.306(a)(1),HIPAA|164.312(a)(1),HIPAA|164.312(b),ISO-27001-2022|A.5.3,ISO-27001-2022|A.5.10,ISO-27001-2022|A.5.15,ISO-27001-2022|A.5.33,ISO-27001-2022|A.7.7,ISO-27001-2022|A.7.10,ISO-27001-2022|A.8.2,ISO-27001-2022|A.8.3,ISO-27001-2022|A.8.15,ISO-27001-2022|A.8.18,ISO-27001-2022|A.8.20,ISO/IEC-27001|A.6.1.2,ISO/IEC-27001|A.9.4.1,ISO/IEC-27001|A.9.4.5,ITSG-33|AC-3,ITSG-33|AC-5,ITSG-33|AC-6,ITSG-33|AU-2,ITSG-33|AU-7,ITSG-33|AU-12,ITSG-33|MP-2,ITSG-33|MP-2a.,LEVEL|1A,NESA|M1.2.2,NESA|M5.5.1,NESA|T1.3.2,NESA|T1.3.3,NESA|T1.4.1,NESA|T4.2.1,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.2,NESA|T7.5.3,NIAv2|AM1,NIAv2|AM3,NIAv2|AM7,NIAv2|AM11a,NIAv2|AM11b,NIAv2|AM11c,NIAv2|AM11d,NIAv2|AM11e,NIAv2|AM23f,NIAv2|SS13c,NIAv2|SS15c,NIAv2|SS29,NIAv2|SS30,NIAv2|VL8,PCI-DSSv3.2.1|7.1.2,PCI-DSSv3.2.1|10.1,PCI-DSSv4.0|7.2.1,PCI-DSSv4.0|7.2.2,QCSC-v1|3.2,QCSC-v1|5.2.2,QCSC-v1|6.2,QCSC-v1|8.2.1,QCSC-v1|10.2.1,QCSC-v1|11.2,QCSC-v1|13.2,SWIFT-CSCv1|5.1,SWIFT-CSCv1|6.4,TBA-FIISB|31.1,TBA-FIISB|31.4.2,TBA-FIISB|31.4.3" see_also : "https://workbench.cisecurity.org/benchmarks/20333" type : CMD_EXEC description : "journald check - active" cmd : "/bin/systemctl is-active systemd-journald" expect : "^active$" type : CMD_EXEC description : "rsyslog check - active" cmd : "/bin/systemctl is-active rsyslog" expect : "^active$" type : CMD_EXEC description : "rsyslog check - enabled" cmd : "/bin/systemctl is-enabled rsyslog" expect : "^enabled$" type : RPM_CHECK description : "Check for rsyslog package" rpm : "rsyslog-0.0.0-0" operator : "gt" required : YES type : CMD_EXEC description : "rsyslog check - active" cmd : "/bin/systemctl is-active rsyslog" expect : "^active$" type : FILE_CONTENT_CHECK description : "mail.err /var/log/mail.err" file : "/etc/rsyslog.conf /etc/rsyslog.d/*.conf" regex : "^[\\s]*mail\\.err" expect : "mail\\.err[\\s]+@LOG_MAIL_ERR@[\\s]*$" min_occurrences : "1" string_required : NO type : FILE_CONTENT_CHECK description : "local6,local7.* -/var/log/localmessages" file : "/etc/rsyslog.conf /etc/rsyslog.d/*.conf" regex : "^[\\s]*local6,local7" expect : "local6,local7\\.\\*[\\s]+-@LOG_LOCALMESSAGES@[\\s]*$" min_occurrences : "1" string_required : NO type : FILE_CONTENT_CHECK description : "auth,authpriv.* /var/log/secure" file : "/etc/rsyslog.conf /etc/rsyslog.d/*.conf" regex : "^[\\s]*auth,authpriv\\.\\*" expect : "auth,authpriv\\.\\*[\\s]+@LOG_SECURE@[\\s]*$" min_occurrences : "1" string_required : NO type : FILE_CONTENT_CHECK description : "local2,local3.* -/var/log/localmessages" file : "/etc/rsyslog.conf /etc/rsyslog.d/*.conf" regex : "^[\\s]*local2,local3" expect : "local2,local3\\.\\*[\\s]+-@LOG_LOCALMESSAGES@[\\s]*$" min_occurrences : "1" string_required : NO type : FILE_CONTENT_CHECK description : "*.=warning;*.=err -/var/log/warn" file : "/etc/rsyslog.conf /etc/rsyslog.d/*.conf" regex : "^[\\s]*\\*\\.=warning;\\*\\.=err" expect : "\\*\\.=warning;\\*\\.=err[\\s]+-@LOG_WARN@[\\s]*$" min_occurrences : "1" string_required : NO type : FILE_CONTENT_CHECK description : "*.emerg :omusrmsg:*" file : "/etc/rsyslog.conf /etc/rsyslog.d/*.conf" regex : "^[\\s]*\\*\\.emerg" expect : "\\*\\.emerg\\s+:omusrmsg:\\*$" min_occurrences : "1" string_required : NO type : FILE_CONTENT_CHECK description : "mail.info -/var/log/mail.info" file : "/etc/rsyslog.conf /etc/rsyslog.d/*.conf" regex : "^[\\s]*mail\\.info" expect : "mail\\.info[\\s]+-@LOG_MAIL_INFO@[\\s]*$" min_occurrences : "1" string_required : NO type : FILE_CONTENT_CHECK description : "mail.* -/var/log/mail" file : "/etc/rsyslog.conf /etc/rsyslog.d/*.conf" regex : "^[\\s]*mail\\.\\*" expect : "mail\\.\\*[\\s]+-@LOG_MAIL@[\\s]*$" min_occurrences : "1" string_required : NO type : FILE_CONTENT_CHECK description : "*.crit /var/log/warn" file : "/etc/rsyslog.conf /etc/rsyslog.d/*.conf" regex : "^[\\s]*\\*\\.crit" expect : "\\*\\.crit[\\s]+@LOG_WARN@[\\s]*$" min_occurrences : "1" string_required : NO type : FILE_CONTENT_CHECK description : "cron.* /var/log/cron" file : "/etc/rsyslog.conf /etc/rsyslog.d/*.conf" regex : "^[\\s]*cron\\.*" expect : "cron\\.\\*[\\s]+@LOG_CRON@[\\s]*$" min_occurrences : "1" string_required : NO type : FILE_CONTENT_CHECK description : "mail.warning -/var/log/mail.warn" file : "/etc/rsyslog.conf /etc/rsyslog.d/*.conf" regex : "^[\\s]*mail\\.warning" expect : "mail\\.warning[\\s]+-@LOG_MAIL_WARN@[\\s]*$" min_occurrences : "1" string_required : NO type : FILE_CONTENT_CHECK description : "*.*;mail.none;news.none -/var/log/messages" file : "/etc/rsyslog.conf /etc/rsyslog.d/*.conf" regex : "^[\\s]*\\*\\.\\*;mail\.none;news\\.none" expect : "\\*\\.\\*;mail\\.none;news\\.none[\\s]+-@LOG_MESSAGES@[\\s]*$" min_occurrences : "1" string_required : NO type : FILE_CONTENT_CHECK description : "local4,local5.* -/var/log/localmessages" file : "/etc/rsyslog.conf /etc/rsyslog.d/*.conf" regex : "^[\\s]*local4,local5" expect : "local4,local5\\.\\*[\\s]+-@LOG_LOCALMESSAGES@[\\s]*$" min_occurrences : "1" string_required : NO type : FILE_CONTENT_CHECK description : "local0,local1.* -/var/log/localmessages" file : "/etc/rsyslog.conf /etc/rsyslog.d/*.conf" regex : "^[\\s]*local0,local1" expect : "local0,local1\\.\\*[\\s]+-@LOG_LOCALMESSAGES@[\\s]*$" min_occurrences : "1" string_required : NO description : "6.2.3.6 Ensure rsyslog 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. 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: This recommendation only applies if rsyslog is the chosen method for client side logging. Do not apply this recommendation if journald is used." solution : "Edit the following lines in the /etc/rsyslog.conf and /etc/rsyslog.d/*.conf files as appropriate for your environment. Note: The below configuration is shown for example purposes only. Due care should be given to how the organization wishes to store log data. *.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 cron.* /var/log/cron *.=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-171|3.3.6,800-171r3|03.03.01,800-171r3|03.03.03,800-171r3|03.03.06a.,800-53|AU-2,800-53|AU-7,800-53|AU-12,800-53r5|AU-2,800-53r5|AU-7,800-53r5|AU-12,CN-L3|7.1.2.3(c),CN-L3|8.1.4.3(a),CSCv7|6.2,CSCv7|6.3,CSCv8|8.2,CSF|DE.CM-1,CSF|DE.CM-3,CSF|DE.CM-7,CSF|PR.PT-1,CSF|RS.AN-3,CSF2.0|DE.CM-01,CSF2.0|DE.CM-03,CSF2.0|DE.CM-09,CSF2.0|PR.PS-04,CSF2.0|RS.AN-03,CSF2.0|RS.AN-06,CSF2.0|RS.AN-07,GDPR|32.1.b,HIPAA|164.306(a)(1),HIPAA|164.312(b),ISO-27001-2022|A.8.15,ITSG-33|AU-2,ITSG-33|AU-7,ITSG-33|AU-12,LEVEL|1M,NESA|M1.2.2,NESA|M5.5.1,NIAv2|AM7,NIAv2|AM11a,NIAv2|AM11b,NIAv2|AM11c,NIAv2|AM11d,NIAv2|AM11e,NIAv2|SS30,NIAv2|VL8,PCI-DSSv3.2.1|10.1,QCSC-v1|3.2,QCSC-v1|6.2,QCSC-v1|8.2.1,QCSC-v1|10.2.1,QCSC-v1|11.2,QCSC-v1|13.2,SWIFT-CSCv1|6.4" see_also : "https://workbench.cisecurity.org/benchmarks/20333" show_output : YES description : "6.2.3.6 Ensure rsyslog 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. 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: This recommendation only applies if rsyslog is the chosen method for client side logging. Do not apply this recommendation if journald is used. NOTE: The identified logging service 'rsyslog' was not found to be active and this check does not apply." solution : "Edit the following lines in the /etc/rsyslog.conf and /etc/rsyslog.d/*.conf files as appropriate for your environment. Note: The below configuration is shown for example purposes only. Due care should be given to how the organization wishes to store log data. *.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 cron.* /var/log/cron *.=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-171|3.3.6,800-171r3|03.03.01,800-171r3|03.03.03,800-171r3|03.03.06a.,800-53|AU-2,800-53|AU-7,800-53|AU-12,800-53r5|AU-2,800-53r5|AU-7,800-53r5|AU-12,CN-L3|7.1.2.3(c),CN-L3|8.1.4.3(a),CSCv7|6.2,CSCv7|6.3,CSCv8|8.2,CSF|DE.CM-1,CSF|DE.CM-3,CSF|DE.CM-7,CSF|PR.PT-1,CSF|RS.AN-3,CSF2.0|DE.CM-01,CSF2.0|DE.CM-03,CSF2.0|DE.CM-09,CSF2.0|PR.PS-04,CSF2.0|RS.AN-03,CSF2.0|RS.AN-06,CSF2.0|RS.AN-07,GDPR|32.1.b,HIPAA|164.306(a)(1),HIPAA|164.312(b),ISO-27001-2022|A.8.15,ITSG-33|AU-2,ITSG-33|AU-7,ITSG-33|AU-12,LEVEL|1M,NESA|M1.2.2,NESA|M5.5.1,NIAv2|AM7,NIAv2|AM11a,NIAv2|AM11b,NIAv2|AM11c,NIAv2|AM11d,NIAv2|AM11e,NIAv2|SS30,NIAv2|VL8,PCI-DSSv3.2.1|10.1,QCSC-v1|3.2,QCSC-v1|6.2,QCSC-v1|8.2.1,QCSC-v1|10.2.1,QCSC-v1|11.2,QCSC-v1|13.2,SWIFT-CSCv1|6.4" see_also : "https://workbench.cisecurity.org/benchmarks/20333" description : "6.2.3.6 Ensure rsyslog 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. 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: This recommendation only applies if rsyslog is the chosen method for client side logging. Do not apply this recommendation if journald is used. NOTE: Nessus has not performed this check. Please review 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. Note: The below configuration is shown for example purposes only. Due care should be given to how the organization wishes to store log data. *.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 cron.* /var/log/cron *.=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-171|3.3.6,800-171r3|03.03.01,800-171r3|03.03.03,800-171r3|03.03.06a.,800-53|AU-2,800-53|AU-7,800-53|AU-12,800-53r5|AU-2,800-53r5|AU-7,800-53r5|AU-12,CN-L3|7.1.2.3(c),CN-L3|8.1.4.3(a),CSCv7|6.2,CSCv7|6.3,CSCv8|8.2,CSF|DE.CM-1,CSF|DE.CM-3,CSF|DE.CM-7,CSF|PR.PT-1,CSF|RS.AN-3,CSF2.0|DE.CM-01,CSF2.0|DE.CM-03,CSF2.0|DE.CM-09,CSF2.0|PR.PS-04,CSF2.0|RS.AN-03,CSF2.0|RS.AN-06,CSF2.0|RS.AN-07,GDPR|32.1.b,HIPAA|164.306(a)(1),HIPAA|164.312(b),ISO-27001-2022|A.8.15,ITSG-33|AU-2,ITSG-33|AU-7,ITSG-33|AU-12,LEVEL|1M,NESA|M1.2.2,NESA|M5.5.1,NIAv2|AM7,NIAv2|AM11a,NIAv2|AM11b,NIAv2|AM11c,NIAv2|AM11d,NIAv2|AM11e,NIAv2|SS30,NIAv2|VL8,PCI-DSSv3.2.1|10.1,QCSC-v1|3.2,QCSC-v1|6.2,QCSC-v1|8.2.1,QCSC-v1|10.2.1,QCSC-v1|11.2,QCSC-v1|13.2,SWIFT-CSCv1|6.4" see_also : "https://workbench.cisecurity.org/benchmarks/20333" type : CMD_EXEC description : "journald check - active" cmd : "/bin/systemctl is-active systemd-journald" expect : "^active$" type : CMD_EXEC description : "rsyslog check - active" cmd : "/bin/systemctl is-active rsyslog" expect : "^active$" type : CMD_EXEC description : "rsyslog check - active" cmd : "/bin/systemctl is-active rsyslog" expect : "^active$" type : CMD_EXEC description : "6.2.3.7 Ensure rsyslog 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/rsyslog is the configuration file used to rotate log files created by rsyslog 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: This recommendation only applies if rsyslog is the chosen method for client side logging. Do not apply this recommendation if systemd-journald is used. NOTE: Nessus has provided the target output to assist in reviewing the benchmark to ensure target compliance." solution : "Edit /etc/logrotate.conf and /etc/logrotate.d/* to ensure logs are rotated according to site policy. Example logrotate configuration that specifies log files be rotated weekly, keep 4 backlogs, compress old log files, ignores missing and empty log files, postrotate to reload rsyslog service after logs are rotated /var/log/rsyslog/*.log { weekly rotate 4 compress missingok notifempty postrotate /usr/bin/systemctl reload rsyslog.service >/dev/null || true endscript }" reference : "800-53|AU-4,800-53r5|AU-4,CSCv7|6.4,CSCv8|8.3,CSF|PR.DS-4,CSF|PR.PT-1,GDPR|32.1.b,HIPAA|164.306(a)(1),HIPAA|164.312(b),ISO-27001-2022|A.8.6,ITSG-33|AU-4,LEVEL|1M,NESA|T3.3.1,NESA|T3.6.2,QCSC-v1|8.2.1,QCSC-v1|13.2" see_also : "https://workbench.cisecurity.org/benchmarks/20333" cmd : "#!/bin/bash { l_output=\"\" l_rotate_conf=\"\" #check for logrotate.conf file if [ -f /etc/logrotate.conf ]; then l_rotate_conf=\"/etc/logrotate.conf\" elif compgen -G \"/etc/logrotate.d/*.conf\" 2>/dev/null; then for file in /etc/logrotate.d/*.conf; do l_rotate_conf=\"$file\" done elif systemctl is-active --quiet systemd-journal-upload.service; then echo -e \"- journald is in use on system\\n - recommendation is NA\" else echo -e \"- logrotate is not configured\" l_output=\"$l_output\\n- rsyslog is in use and logrotate is not configured\" fi if [ -z \"$l_output\" ]; then # Provide output from checks echo -e \"\\n- Audit Result:\\n ** REVIEW **\\n - $l_rotate_conf and verify logs are rotated according to site policy.\" else echo -e \"\\n- Audit Result:\\n ** FAIL **\\n - Reason(s) for audit failure:\\n$l_output\" fi }" expect : "^Manual Review Required$" severity : MEDIUM description : "6.2.3.7 Ensure rsyslog 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/rsyslog is the configuration file used to rotate log files created by rsyslog 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: This recommendation only applies if rsyslog is the chosen method for client side logging. Do not apply this recommendation if systemd-journald is used." solution : "Edit /etc/logrotate.conf and /etc/logrotate.d/* to ensure logs are rotated according to site policy. Example logrotate configuration that specifies log files be rotated weekly, keep 4 backlogs, compress old log files, ignores missing and empty log files, postrotate to reload rsyslog service after logs are rotated /var/log/rsyslog/*.log { weekly rotate 4 compress missingok notifempty postrotate /usr/bin/systemctl reload rsyslog.service >/dev/null || true endscript }" reference : "800-53|AU-4,800-53r5|AU-4,CSCv7|6.4,CSCv8|8.3,CSF|PR.DS-4,CSF|PR.PT-1,GDPR|32.1.b,HIPAA|164.306(a)(1),HIPAA|164.312(b),ISO-27001-2022|A.8.6,ITSG-33|AU-4,LEVEL|1M,NESA|T3.3.1,NESA|T3.6.2,QCSC-v1|8.2.1,QCSC-v1|13.2" see_also : "https://workbench.cisecurity.org/benchmarks/20333" description : "6.2.3.7 Ensure rsyslog 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/rsyslog is the configuration file used to rotate log files created by rsyslog 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: This recommendation only applies if rsyslog is the chosen method for client side logging. Do not apply this recommendation if systemd-journald is used. 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. Example logrotate configuration that specifies log files be rotated weekly, keep 4 backlogs, compress old log files, ignores missing and empty log files, postrotate to reload rsyslog service after logs are rotated /var/log/rsyslog/*.log { weekly rotate 4 compress missingok notifempty postrotate /usr/bin/systemctl reload rsyslog.service >/dev/null || true endscript }" reference : "800-53|AU-4,800-53r5|AU-4,CSCv7|6.4,CSCv8|8.3,CSF|PR.DS-4,CSF|PR.PT-1,GDPR|32.1.b,HIPAA|164.306(a)(1),HIPAA|164.312(b),ISO-27001-2022|A.8.6,ITSG-33|AU-4,LEVEL|1M,NESA|T3.3.1,NESA|T3.6.2,QCSC-v1|8.2.1,QCSC-v1|13.2" see_also : "https://workbench.cisecurity.org/benchmarks/20333" type : CMD_EXEC description : "6.2.4.1 Ensure access to all logfiles has been configured" info : "Log files contain information from many services on the the local system, or in the event of a centralized log server, others systems logs as well. In general log files are found in /var/log/ although application can be configured to store logs elsewhere. Should your application store logs in another, ensure to run the same test on that location. It is important that log files have the correct permissions to ensure that sensitive data is protected and that only the appropriate users / groups have access to them." solution : "Run the following script to update permissions and ownership on files in /var/log Although the script is not destructive, ensure that the output is captured in the event that the remediation causes issues. #!/usr/bin/env bash { a_output2=() f_file_test_fix() { a_out2=() maxperm=\"$( printf '%o' $(( 0777 & ~$perm_mask)) )\" if [ $(( $l_mode & $perm_mask )) -gt 0 ]; then a_out2+=(\" o Mode: \\\"$l_mode\\\" should be \\\"$maxperm\\\" or more restrictive\" \" x Removing excess permissions\") chmod \"$l_rperms\" \"$l_fname\" fi if [[ ! \"$l_user\" =~ $l_auser ]]; then a_out2+=(\" o Owned by: \\\"$l_user\\\" and should be owned by \\\"${l_auser//|/ or }\\\"\" \" x Changing ownership to: \\\"$l_fix_account\\\"\") chown \"$l_fix_account\" \"$l_fname\" fi if [[ ! \"$l_group\" =~ $l_agroup ]]; then a_out2+=(\" o Group owned by: \\\"$l_group\\\" and should be group owned by \\\"${l_agroup//|/ or }\\\"\" \" x Changing group ownership to: \\\"$l_fix_account\\\"\") chgrp \"$l_fix_account\" \"$l_fname\" fi [ \"${#a_out2[@]}\" -gt 0 ] && a_output2+=(\" - File: \\\"$l_fname\\\" is:\" \"${a_out2[@]}\") } l_fix_account='root' while IFS= read -r -d $'\0' l_file; do while IFS=: read -r l_fname l_mode l_user l_group; do if grep -Pq -- '\/(apt)\h*$' <<< \"$(dirname \"$l_fname\")\"; then perm_mask='0133' l_rperms=\"u-x,go-wx\" l_auser=\"root\" l_agroup=\"(root|adm)\"; f_file_test_fix else case \"$(basename \"$l_fname\")\" in lastlog | lastlog.* | wtmp | wtmp.* | wtmp-* | btmp | btmp.* | btmp-* | README) perm_mask='0113' l_rperms=\"ug-x,o-wx\" l_auser=\"root\" l_agroup=\"(root|utmp)\" f_file_test_fix ;; cloud-init.log* | localmessages* | waagent.log*) perm_mask='0133' l_rperms=\"u-x,go-wx\" l_auser=\"(root|syslog)\" l_agroup=\"(root|adm)\" file_test_fix ;; secure | auth.log | syslog | messages) perm_mask='0137' l_rperms=\"u-x,g-wx,o-rwx\" l_auser=\"(root|syslog)\" l_agroup=\"(root|adm)\" f_file_test_fix ;; SSSD | sssd) perm_mask='0117' l_rperms=\"ug-x,o-rwx\" l_auser=\"(root|SSSD)\" l_agroup=\"(root|SSSD)\" f_file_test_fix ;; gdm | gdm3) perm_mask='0117' l_rperms=\"ug-x,o-rwx\" l_auser=\"root\" l_agroup=\"(root|gdm|gdm3)\" f_file_test_fix ;; *.journal | *.journal~) perm_mask='0137' l_rperms=\"u-x,g-wx,o-rwx\" l_auser=\"root\" l_agroup=\"(root|systemd-journal)\" f_file_test_fix ;; *) perm_mask='0137' l_rperms=\"u-x,g-wx,o-rwx\" l_auser=\"(root|syslog)\" l_agroup=\"(root|adm)\" if [ \"$l_user\" = \"root\" ] || ! grep -Pq -- \"^\h*$(awk -F: '$1==\"'\"$l_user\"'\" {print $7}' /etc/passwd)\b\" /etc/shells; then ! grep -Pq -- \"$l_auser\" <<< \"$l_user\" && l_auser=\"(root|syslog|$l_user)\" ! grep -Pq -- \"$l_agroup\" <<< \"$l_group\" && l_agroup=\"(root|adm|$l_group)\" fi f_file_test_fix ;; esac fi done < <(stat -Lc '%n:%#a:%U:%G' \"$l_file\") done < <(find -L /var/log -type f \( -perm /0137 -o ! -user root -o ! -group root \) -print0) if [ \"${#a_output2[@]}\" -le 0 ]; then # If all files passed, then we report no changes a_output+=(\" - All files in \\\"/var/log/\\\" have appropriate permissions and ownership\") printf '\n%s' \"- All files in \\\"/var/log/\\\" have appropriate permissions and ownership\" \" o No changes required\" \"\" else printf '\n%s' \"${a_output2[@]}\" \"\" fi } Note: You may also need to change the configuration for your logging software or services for any logs that had incorrect permissions. If there are services that log to other locations, ensure that those log files have the appropriate access configured." reference : "800-171|3.1.1,800-171|3.1.4,800-171|3.1.5,800-171|3.8.1,800-171|3.8.2,800-171|3.8.3,800-171r3|03.01.02,800-171r3|03.01.04,800-171r3|03.01.05a.,800-171r3|03.08.02,800-53|AC-3,800-53|AC-5,800-53|AC-6,800-53|MP-2,800-53r5|AC-3,800-53r5|AC-5,800-53r5|AC-6,800-53r5|MP-2,CN-L3|7.1.3.2(b),CN-L3|7.1.3.2(g),CN-L3|8.1.4.2(d),CN-L3|8.1.4.2(f),CN-L3|8.1.4.11(b),CN-L3|8.1.10.2(c),CN-L3|8.1.10.6(a),CN-L3|8.5.3.1,CN-L3|8.5.4.1(a),CSCv7|14.6,CSCv8|3.3,CSF|PR.AC-4,CSF|PR.DS-5,CSF|PR.PT-2,CSF|PR.PT-3,CSF2.0|PR.AA-05,CSF2.0|PR.DS-10,CSF2.0|PR.IR-01,GDPR|32.1.b,HIPAA|164.306(a)(1),HIPAA|164.312(a)(1),ISO-27001-2022|A.5.3,ISO-27001-2022|A.5.10,ISO-27001-2022|A.5.15,ISO-27001-2022|A.5.33,ISO-27001-2022|A.7.7,ISO-27001-2022|A.7.10,ISO-27001-2022|A.8.2,ISO-27001-2022|A.8.3,ISO-27001-2022|A.8.18,ISO-27001-2022|A.8.20,ISO/IEC-27001|A.6.1.2,ISO/IEC-27001|A.9.4.1,ISO/IEC-27001|A.9.4.5,ITSG-33|AC-3,ITSG-33|AC-5,ITSG-33|AC-6,ITSG-33|MP-2,ITSG-33|MP-2a.,LEVEL|1A,NESA|T1.3.2,NESA|T1.3.3,NESA|T1.4.1,NESA|T4.2.1,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.2,NESA|T7.5.3,NIAv2|AM1,NIAv2|AM3,NIAv2|AM23f,NIAv2|SS13c,NIAv2|SS15c,NIAv2|SS29,PCI-DSSv3.2.1|7.1.2,PCI-DSSv4.0|7.2.1,PCI-DSSv4.0|7.2.2,QCSC-v1|3.2,QCSC-v1|5.2.2,QCSC-v1|6.2,QCSC-v1|13.2,SWIFT-CSCv1|5.1,TBA-FIISB|31.1,TBA-FIISB|31.4.2,TBA-FIISB|31.4.3" see_also : "https://workbench.cisecurity.org/benchmarks/20333" cmd : "#!/bin/bash { a_output=(); a_output2=() f_file_test_chk() { a_out2=() maxperm=\"$( printf '%o' $(( 0777 & ~$perm_mask)) )\" [ $(( $l_mode & $perm_mask )) -gt 0 ] && \\ a_out2+=(\" o Mode: \\\"$l_mode\\\" should be \\\"$maxperm\\\" or more restrictive\") [[ ! \"$l_user\" =~ $l_auser ]] && \\ a_out2+=(\" o Owned by: \\\"$l_user\\\" and should be owned by \\\"${l_auser//|/ or }\\\"\") [[ ! \"$l_group\" =~ $l_agroup ]] && \\ a_out2+=(\" o Group owned by: \\\"$l_group\\\" and should be group owned by \\\"${l_agroup//|/ or }\\\"\") [ \"${#a_out2[@]}\" -gt 0 ] && a_output2+=(\" - File: \\\"$l_fname\\\" is:\" \"${a_out2[@]}\") } while IFS= read -r -d $'\\0' l_file; do while IFS=: read -r l_fname l_mode l_user l_group; do if grep -Pq -- '\\/(apt)\\h*$' <<< \"$(dirname \"$l_fname\")\"; then perm_mask='0133' l_auser=\"root\" l_agroup=\"(root|adm)\"; f_file_test_chk else case \"$(basename \"$l_fname\")\" in lastlog | lastlog.* | wtmp | wtmp.* | wtmp-* | btmp | btmp.* | btmp-* | README) perm_mask='0113' l_auser=\"root\" l_agroup=\"(root|utmp)\" f_file_test_chk ;; cloud-init.log* | localmessages* | waagent.log*) perm_mask='0133' l_auser=\"(root|syslog)\" l_agroup=\"(root|adm)\" f_file_test_chk ;; secure{,*.*,.*,-*} | auth.log | syslog | messages) perm_mask='0137' l_auser=\"(root|syslog)\" l_agroup=\"(root|adm)\" f_file_test_chk ;; SSSD | sssd) perm_mask='0117' l_auser=\"(root|SSSD)\" l_agroup=\"(root|SSSD)\" f_file_test_chk ;; gdm | gdm3) perm_mask='0117' l_auser=\"root\" l_agroup=\"(root|gdm|gdm3)\" f_file_test_chk ;; *.journal | *.journal~) perm_mask='0137' l_auser=\"root\" l_agroup=\"(root|systemd-journal)\" f_file_test_chk ;; *) perm_mask='0137' l_auser=\"(root|syslog)\" l_agroup=\"(root|adm)\" if [ \"$l_user\" = \"root\" ] || ! grep -Pq -- \"^\\h*$(awk -F: '$1==\"'\"$l_user\"'\" {print $7}' /etc/passwd)\\b\" /etc/shells; then ! grep -Pq -- \"$l_auser\" <<< \"$l_user\" && l_auser=\"(root|syslog|$l_user)\" ! grep -Pq -- \"$l_agroup\" <<< \"$l_group\" && l_agroup=\"(root|adm|$l_group)\" fi f_file_test_chk ;; esac fi done < <(stat -Lc '%n:%#a:%U:%G' \"$l_file\") done < <(find -L /var/log -type f \\( -perm /0137 -o ! -user root -o ! -group root \\) -print0) if [ \"${#a_output2[@]}\" -le 0 ]; then a_output+=(\" - All files in \\\"/var/log/\\\" have appropriate permissions and ownership\") printf '\\n%s' \"- Audit Result:\" \" ** PASS **\" \"${a_output[@]}\" \"\" else printf '\\n%s' \"- Audit Result:\" \" ** FAIL **\" \" - Reason(s) for audit failure:\" \"${a_output2[@]}\" \"\" fi }" expect : "(?i)^[\\s]*\\**[\\s]*pass:?[\\s]*\\**$" timeout : "@FIND_TIMEOUT@" type : FILE_CHECK description : "7.1.1 Ensure access to /etc/passwd is 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. 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 commands to remove excess permissions, set owner, and set group on /etc/passwd : # chmod u-x,go-wx /etc/passwd # chown root:root /etc/passwd" reference : "800-171|3.1.1,800-171|3.1.4,800-171|3.1.5,800-171|3.8.1,800-171|3.8.2,800-171|3.8.3,800-171r3|03.01.02,800-171r3|03.01.04,800-171r3|03.01.05a.,800-171r3|03.08.02,800-53|AC-3,800-53|AC-5,800-53|AC-6,800-53|MP-2,800-53r5|AC-3,800-53r5|AC-5,800-53r5|AC-6,800-53r5|MP-2,CN-L3|7.1.3.2(b),CN-L3|7.1.3.2(g),CN-L3|8.1.4.2(d),CN-L3|8.1.4.2(f),CN-L3|8.1.4.11(b),CN-L3|8.1.10.2(c),CN-L3|8.1.10.6(a),CN-L3|8.5.3.1,CN-L3|8.5.4.1(a),CSCv7|14.6,CSCv8|3.3,CSF|PR.AC-4,CSF|PR.DS-5,CSF|PR.PT-2,CSF|PR.PT-3,CSF2.0|PR.AA-05,CSF2.0|PR.DS-10,CSF2.0|PR.IR-01,GDPR|32.1.b,HIPAA|164.306(a)(1),HIPAA|164.312(a)(1),ISO-27001-2022|A.5.3,ISO-27001-2022|A.5.10,ISO-27001-2022|A.5.15,ISO-27001-2022|A.5.33,ISO-27001-2022|A.7.7,ISO-27001-2022|A.7.10,ISO-27001-2022|A.8.2,ISO-27001-2022|A.8.3,ISO-27001-2022|A.8.18,ISO-27001-2022|A.8.20,ISO/IEC-27001|A.6.1.2,ISO/IEC-27001|A.9.4.1,ISO/IEC-27001|A.9.4.5,ITSG-33|AC-3,ITSG-33|AC-5,ITSG-33|AC-6,ITSG-33|MP-2,ITSG-33|MP-2a.,LEVEL|1A,NESA|T1.3.2,NESA|T1.3.3,NESA|T1.4.1,NESA|T4.2.1,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.2,NESA|T7.5.3,NIAv2|AM1,NIAv2|AM3,NIAv2|AM23f,NIAv2|SS13c,NIAv2|SS15c,NIAv2|SS29,PCI-DSSv3.2.1|7.1.2,PCI-DSSv4.0|7.2.1,PCI-DSSv4.0|7.2.2,QCSC-v1|3.2,QCSC-v1|5.2.2,QCSC-v1|6.2,QCSC-v1|13.2,SWIFT-CSCv1|5.1,TBA-FIISB|31.1,TBA-FIISB|31.4.2,TBA-FIISB|31.4.3" see_also : "https://workbench.cisecurity.org/benchmarks/20333" file : "/etc/passwd" owner : "root" mask : "133" group : "root" type : FILE_CHECK description : "etc/security/opasswd file permissions" file : "/etc/security/opasswd" owner : "root" mask : "177" file_required : NO group : "root" type : FILE_CHECK description : "/etc/security/opasswd.old file permissions" file : "/etc/security/opasswd.old" owner : "root" mask : "177" file_required : NO group : "root" description : "7.1.10 Ensure access to /etc/security/opasswd is configured" info : "/etc/security/opasswd and it's backup /etc/security/opasswd.old hold user's previous passwords if pam_unix or pam_pwhistory is in use on the system It is critical to ensure that /etc/security/opasswd 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 commands to remove excess permissions, set owner, and set group on /etc/security/opasswd and /etc/security/opasswd.old is they exist: # [ -e \"/etc/security/opasswd\" ] && chmod u-x,go-rwx /etc/security/opasswd # [ -e \"/etc/security/opasswd\" ] && chown root:root /etc/security/opasswd # [ -e \"/etc/security/opasswd.old\" ] && chmod u-x,go-rwx /etc/security/opasswd.old # [ -e \"/etc/security/opasswd.old\" ] && chown root:root /etc/security/opasswd.old" reference : "800-171|3.1.1,800-171|3.1.4,800-171|3.1.5,800-171|3.8.1,800-171|3.8.2,800-171|3.8.3,800-171r3|03.01.02,800-171r3|03.01.04,800-171r3|03.01.05a.,800-171r3|03.08.02,800-53|AC-3,800-53|AC-5,800-53|AC-6,800-53|MP-2,800-53r5|AC-3,800-53r5|AC-5,800-53r5|AC-6,800-53r5|MP-2,CN-L3|7.1.3.2(b),CN-L3|7.1.3.2(g),CN-L3|8.1.4.2(d),CN-L3|8.1.4.2(f),CN-L3|8.1.4.11(b),CN-L3|8.1.10.2(c),CN-L3|8.1.10.6(a),CN-L3|8.5.3.1,CN-L3|8.5.4.1(a),CSCv7|14.6,CSCv8|3.3,CSF|PR.AC-4,CSF|PR.DS-5,CSF|PR.PT-2,CSF|PR.PT-3,CSF2.0|PR.AA-05,CSF2.0|PR.DS-10,CSF2.0|PR.IR-01,GDPR|32.1.b,HIPAA|164.306(a)(1),HIPAA|164.312(a)(1),ISO-27001-2022|A.5.3,ISO-27001-2022|A.5.10,ISO-27001-2022|A.5.15,ISO-27001-2022|A.5.33,ISO-27001-2022|A.7.7,ISO-27001-2022|A.7.10,ISO-27001-2022|A.8.2,ISO-27001-2022|A.8.3,ISO-27001-2022|A.8.18,ISO-27001-2022|A.8.20,ISO/IEC-27001|A.6.1.2,ISO/IEC-27001|A.9.4.1,ISO/IEC-27001|A.9.4.5,ITSG-33|AC-3,ITSG-33|AC-5,ITSG-33|AC-6,ITSG-33|MP-2,ITSG-33|MP-2a.,LEVEL|1A,NESA|T1.3.2,NESA|T1.3.3,NESA|T1.4.1,NESA|T4.2.1,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.2,NESA|T7.5.3,NIAv2|AM1,NIAv2|AM3,NIAv2|AM23f,NIAv2|SS13c,NIAv2|SS15c,NIAv2|SS29,PCI-DSSv3.2.1|7.1.2,PCI-DSSv4.0|7.2.1,PCI-DSSv4.0|7.2.2,QCSC-v1|3.2,QCSC-v1|5.2.2,QCSC-v1|6.2,QCSC-v1|13.2,SWIFT-CSCv1|5.1,TBA-FIISB|31.1,TBA-FIISB|31.4.2,TBA-FIISB|31.4.3" see_also : "https://workbench.cisecurity.org/benchmarks/20333" show_output : YES description : "7.1.11 Ensure world writable files and directories are secured" info : "World writable files are the least secure. 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. See the chmod(2) man page for more information. Setting the sticky bit on world writable directories prevents users from deleting or renaming files in that directory that are not owned by them. 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. This feature prevents the ability to delete or rename files in world writable directories (such as /tmp ) that are owned by another user." solution : "- World Writable Files: - It is recommended that write access is removed from other with the command ( chmod o-w ), but always consult relevant vendor documentation to avoid breaking any application dependencies on a given file. - World Writable Directories: - Set the sticky bit on all world writable directories with the command ( chmod a+t ) Run the following script to: - Remove other write permission from any world writable files - Add the sticky bit to all world writable directories #!/usr/bin/env bash { l_smask='01000' a_file=(); a_dir=() # Initialize arrays a_path=(! -path \"/run/user/*\" -a ! -path \"/proc/*\" -a ! -path \"*/containerd/*\" -a ! -path \"*/kubelet/pods/*\" -a ! -path \"*/kubelet/plugins/*\" -a ! -path \"/sys/*\" -a ! -path \"/snap/*\") while IFS= read -r l_mount; do while IFS= read -r -d $'\0' l_file; do if [ -e \"$l_file\" ]; then l_mode=\"$(stat -Lc '%#a' \"$l_file\")\" if [ -f \"$l_file\" ]; then # Remove excess permissions from WW files echo -e \" - File: \\\"$l_file\\\" is mode: \\\"$l_mode\\\"\n - removing write permission on \\\"$l_file\\\" from \\\"other\\\"\" chmod o-w \"$l_file\" fi if [ -d \"$l_file\" ]; then # Add sticky bit if [ ! $(( $l_mode & $l_smask )) -gt 0 ]; then echo -e \" - Directory: \\\"$l_file\\\" is mode: \\\"$l_mode\\\" and doesn't have the sticky bit set\n - Adding the sticky bit\" chmod a+t \"$l_file\" fi fi fi done < <(find \"$l_mount\" -xdev \( \"${a_path[@]}\" \) \( -type f -o -type d \) -perm -0002 -print0 2> /dev/null) done < <(findmnt -Dkerno fstype,target | awk '($1 !~ /^\s*(nfs|proc|smb|vfat|iso9660|efivarfs|selinuxfs)/ && $2 !~ /^(\/run\/user\/|\/tmp|\/var\/tmp)/){print $2}') }" reference : "800-171|3.1.1,800-171|3.1.4,800-171|3.1.5,800-171|3.8.1,800-171|3.8.2,800-171|3.8.3,800-171r3|03.01.02,800-171r3|03.01.04,800-171r3|03.01.05a.,800-171r3|03.08.02,800-53|AC-3,800-53|AC-5,800-53|AC-6,800-53|MP-2,800-53r5|AC-3,800-53r5|AC-5,800-53r5|AC-6,800-53r5|MP-2,CN-L3|7.1.3.2(b),CN-L3|7.1.3.2(g),CN-L3|8.1.4.2(d),CN-L3|8.1.4.2(f),CN-L3|8.1.4.11(b),CN-L3|8.1.10.2(c),CN-L3|8.1.10.6(a),CN-L3|8.5.3.1,CN-L3|8.5.4.1(a),CSCv7|14.6,CSCv8|3.3,CSF|PR.AC-4,CSF|PR.DS-5,CSF|PR.PT-2,CSF|PR.PT-3,CSF2.0|PR.AA-05,CSF2.0|PR.DS-10,CSF2.0|PR.IR-01,GDPR|32.1.b,HIPAA|164.306(a)(1),HIPAA|164.312(a)(1),ISO-27001-2022|A.5.3,ISO-27001-2022|A.5.10,ISO-27001-2022|A.5.15,ISO-27001-2022|A.5.33,ISO-27001-2022|A.7.7,ISO-27001-2022|A.7.10,ISO-27001-2022|A.8.2,ISO-27001-2022|A.8.3,ISO-27001-2022|A.8.18,ISO-27001-2022|A.8.20,ISO/IEC-27001|A.6.1.2,ISO/IEC-27001|A.9.4.1,ISO/IEC-27001|A.9.4.5,ITSG-33|AC-3,ITSG-33|AC-5,ITSG-33|AC-6,ITSG-33|MP-2,ITSG-33|MP-2a.,LEVEL|1A,NESA|T1.3.2,NESA|T1.3.3,NESA|T1.4.1,NESA|T4.2.1,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.2,NESA|T7.5.3,NIAv2|AM1,NIAv2|AM3,NIAv2|AM23f,NIAv2|SS13c,NIAv2|SS15c,NIAv2|SS29,PCI-DSSv3.2.1|7.1.2,PCI-DSSv4.0|7.2.1,PCI-DSSv4.0|7.2.2,QCSC-v1|3.2,QCSC-v1|5.2.2,QCSC-v1|6.2,QCSC-v1|13.2,SWIFT-CSCv1|5.1,TBA-FIISB|31.1,TBA-FIISB|31.4.2,TBA-FIISB|31.4.3" see_also : "https://workbench.cisecurity.org/benchmarks/20333" name : "find_world_writeable_files" description : "7.1.12 Ensure no files or directories without an owner and a group exist" info : "Administrators may delete users or groups from the system and neglect to remove all files and/or directories owned by those users or groups. A new user or group who is assigned a deleted user's user ID or group ID may then end up \"owning\" a deleted user or group's files, and thus have more access on the system than was intended." solution : "Remove or set ownership and group ownership of these files and/or directories to an active user on the system as appropriate." reference : "800-171|3.1.1,800-171|3.1.4,800-171|3.1.5,800-171|3.8.1,800-171|3.8.2,800-171|3.8.3,800-171r3|03.01.02,800-171r3|03.01.04,800-171r3|03.01.05a.,800-171r3|03.08.02,800-53|AC-3,800-53|AC-5,800-53|AC-6,800-53|MP-2,800-53r5|AC-3,800-53r5|AC-5,800-53r5|AC-6,800-53r5|MP-2,CN-L3|7.1.3.2(b),CN-L3|7.1.3.2(g),CN-L3|8.1.4.2(d),CN-L3|8.1.4.2(f),CN-L3|8.1.4.11(b),CN-L3|8.1.10.2(c),CN-L3|8.1.10.6(a),CN-L3|8.5.3.1,CN-L3|8.5.4.1(a),CSCv7|14.6,CSCv8|3.3,CSF|PR.AC-4,CSF|PR.DS-5,CSF|PR.PT-2,CSF|PR.PT-3,CSF2.0|PR.AA-05,CSF2.0|PR.DS-10,CSF2.0|PR.IR-01,GDPR|32.1.b,HIPAA|164.306(a)(1),HIPAA|164.312(a)(1),ISO-27001-2022|A.5.3,ISO-27001-2022|A.5.10,ISO-27001-2022|A.5.15,ISO-27001-2022|A.5.33,ISO-27001-2022|A.7.7,ISO-27001-2022|A.7.10,ISO-27001-2022|A.8.2,ISO-27001-2022|A.8.3,ISO-27001-2022|A.8.18,ISO-27001-2022|A.8.20,ISO/IEC-27001|A.6.1.2,ISO/IEC-27001|A.9.4.1,ISO/IEC-27001|A.9.4.5,ITSG-33|AC-3,ITSG-33|AC-5,ITSG-33|AC-6,ITSG-33|MP-2,ITSG-33|MP-2a.,LEVEL|1A,NESA|T1.3.2,NESA|T1.3.3,NESA|T1.4.1,NESA|T4.2.1,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.2,NESA|T7.5.3,NIAv2|AM1,NIAv2|AM3,NIAv2|AM23f,NIAv2|SS13c,NIAv2|SS15c,NIAv2|SS29,PCI-DSSv3.2.1|7.1.2,PCI-DSSv4.0|7.2.1,PCI-DSSv4.0|7.2.2,QCSC-v1|3.2,QCSC-v1|5.2.2,QCSC-v1|6.2,QCSC-v1|13.2,SWIFT-CSCv1|5.1,TBA-FIISB|31.1,TBA-FIISB|31.4.2,TBA-FIISB|31.4.3" see_also : "https://workbench.cisecurity.org/benchmarks/20333" name : "find_orphan_files" description : "7.1.13 Ensure SUID and SGID files are reviewed" 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 or SGID program is to enable users to perform functions (such as changing their password) that require root privileges. There are valid reasons for SUID and 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 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 SUID or 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-171|3.1.1,800-171|3.1.4,800-171|3.1.5,800-171|3.8.1,800-171|3.8.2,800-171|3.8.3,800-171r3|03.01.02,800-171r3|03.01.04,800-171r3|03.01.05a.,800-171r3|03.08.02,800-53|AC-3,800-53|AC-5,800-53|AC-6,800-53|MP-2,800-53r5|AC-3,800-53r5|AC-5,800-53r5|AC-6,800-53r5|MP-2,CN-L3|7.1.3.2(b),CN-L3|7.1.3.2(g),CN-L3|8.1.4.2(d),CN-L3|8.1.4.2(f),CN-L3|8.1.4.11(b),CN-L3|8.1.10.2(c),CN-L3|8.1.10.6(a),CN-L3|8.5.3.1,CN-L3|8.5.4.1(a),CSCv7|14.6,CSCv8|3.3,CSF|PR.AC-4,CSF|PR.DS-5,CSF|PR.PT-2,CSF|PR.PT-3,CSF2.0|PR.AA-05,CSF2.0|PR.DS-10,CSF2.0|PR.IR-01,GDPR|32.1.b,HIPAA|164.306(a)(1),HIPAA|164.312(a)(1),ISO-27001-2022|A.5.3,ISO-27001-2022|A.5.10,ISO-27001-2022|A.5.15,ISO-27001-2022|A.5.33,ISO-27001-2022|A.7.7,ISO-27001-2022|A.7.10,ISO-27001-2022|A.8.2,ISO-27001-2022|A.8.3,ISO-27001-2022|A.8.18,ISO-27001-2022|A.8.20,ISO/IEC-27001|A.6.1.2,ISO/IEC-27001|A.9.4.1,ISO/IEC-27001|A.9.4.5,ITSG-33|AC-3,ITSG-33|AC-5,ITSG-33|AC-6,ITSG-33|MP-2,ITSG-33|MP-2a.,LEVEL|1M,NESA|T1.3.2,NESA|T1.3.3,NESA|T1.4.1,NESA|T4.2.1,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.2,NESA|T7.5.3,NIAv2|AM1,NIAv2|AM3,NIAv2|AM23f,NIAv2|SS13c,NIAv2|SS15c,NIAv2|SS29,PCI-DSSv3.2.1|7.1.2,PCI-DSSv4.0|7.2.1,PCI-DSSv4.0|7.2.2,QCSC-v1|3.2,QCSC-v1|5.2.2,QCSC-v1|6.2,QCSC-v1|13.2,SWIFT-CSCv1|5.1,TBA-FIISB|31.1,TBA-FIISB|31.4.2,TBA-FIISB|31.4.3" see_also : "https://workbench.cisecurity.org/benchmarks/20333" name : "find_suid_sgid_files" severity : MEDIUM type : FILE_CHECK description : "7.1.2 Ensure access to /etc/passwd- is configured" info : "The /etc/passwd- file contains backup user account information. 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 commands to remove excess permissions, set owner, and set group on /etc/passwd- : # chmod u-x,go-wx /etc/passwd- # chown root:root /etc/passwd-" reference : "800-171|3.1.1,800-171|3.1.4,800-171|3.1.5,800-171|3.8.1,800-171|3.8.2,800-171|3.8.3,800-171r3|03.01.02,800-171r3|03.01.04,800-171r3|03.01.05a.,800-171r3|03.08.02,800-53|AC-3,800-53|AC-5,800-53|AC-6,800-53|MP-2,800-53r5|AC-3,800-53r5|AC-5,800-53r5|AC-6,800-53r5|MP-2,CN-L3|7.1.3.2(b),CN-L3|7.1.3.2(g),CN-L3|8.1.4.2(d),CN-L3|8.1.4.2(f),CN-L3|8.1.4.11(b),CN-L3|8.1.10.2(c),CN-L3|8.1.10.6(a),CN-L3|8.5.3.1,CN-L3|8.5.4.1(a),CSCv7|14.6,CSCv8|3.3,CSF|PR.AC-4,CSF|PR.DS-5,CSF|PR.PT-2,CSF|PR.PT-3,CSF2.0|PR.AA-05,CSF2.0|PR.DS-10,CSF2.0|PR.IR-01,GDPR|32.1.b,HIPAA|164.306(a)(1),HIPAA|164.312(a)(1),ISO-27001-2022|A.5.3,ISO-27001-2022|A.5.10,ISO-27001-2022|A.5.15,ISO-27001-2022|A.5.33,ISO-27001-2022|A.7.7,ISO-27001-2022|A.7.10,ISO-27001-2022|A.8.2,ISO-27001-2022|A.8.3,ISO-27001-2022|A.8.18,ISO-27001-2022|A.8.20,ISO/IEC-27001|A.6.1.2,ISO/IEC-27001|A.9.4.1,ISO/IEC-27001|A.9.4.5,ITSG-33|AC-3,ITSG-33|AC-5,ITSG-33|AC-6,ITSG-33|MP-2,ITSG-33|MP-2a.,LEVEL|1A,NESA|T1.3.2,NESA|T1.3.3,NESA|T1.4.1,NESA|T4.2.1,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.2,NESA|T7.5.3,NIAv2|AM1,NIAv2|AM3,NIAv2|AM23f,NIAv2|SS13c,NIAv2|SS15c,NIAv2|SS29,PCI-DSSv3.2.1|7.1.2,PCI-DSSv4.0|7.2.1,PCI-DSSv4.0|7.2.2,QCSC-v1|3.2,QCSC-v1|5.2.2,QCSC-v1|6.2,QCSC-v1|13.2,SWIFT-CSCv1|5.1,TBA-FIISB|31.1,TBA-FIISB|31.4.2,TBA-FIISB|31.4.3" see_also : "https://workbench.cisecurity.org/benchmarks/20333" file : "/etc/passwd-" owner : "root" mask : "133" group : "root" type : FILE_CHECK description : "7.1.3 Ensure access to /etc/group is 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. 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 commands to remove excess permissions, set owner, and set group on /etc/group : # chmod u-x,go-wx /etc/group # chown root:root /etc/group" reference : "800-171|3.1.1,800-171|3.1.4,800-171|3.1.5,800-171|3.8.1,800-171|3.8.2,800-171|3.8.3,800-171r3|03.01.02,800-171r3|03.01.04,800-171r3|03.01.05a.,800-171r3|03.08.02,800-53|AC-3,800-53|AC-5,800-53|AC-6,800-53|MP-2,800-53r5|AC-3,800-53r5|AC-5,800-53r5|AC-6,800-53r5|MP-2,CN-L3|7.1.3.2(b),CN-L3|7.1.3.2(g),CN-L3|8.1.4.2(d),CN-L3|8.1.4.2(f),CN-L3|8.1.4.11(b),CN-L3|8.1.10.2(c),CN-L3|8.1.10.6(a),CN-L3|8.5.3.1,CN-L3|8.5.4.1(a),CSCv7|14.6,CSCv8|3.3,CSF|PR.AC-4,CSF|PR.DS-5,CSF|PR.PT-2,CSF|PR.PT-3,CSF2.0|PR.AA-05,CSF2.0|PR.DS-10,CSF2.0|PR.IR-01,GDPR|32.1.b,HIPAA|164.306(a)(1),HIPAA|164.312(a)(1),ISO-27001-2022|A.5.3,ISO-27001-2022|A.5.10,ISO-27001-2022|A.5.15,ISO-27001-2022|A.5.33,ISO-27001-2022|A.7.7,ISO-27001-2022|A.7.10,ISO-27001-2022|A.8.2,ISO-27001-2022|A.8.3,ISO-27001-2022|A.8.18,ISO-27001-2022|A.8.20,ISO/IEC-27001|A.6.1.2,ISO/IEC-27001|A.9.4.1,ISO/IEC-27001|A.9.4.5,ITSG-33|AC-3,ITSG-33|AC-5,ITSG-33|AC-6,ITSG-33|MP-2,ITSG-33|MP-2a.,LEVEL|1A,NESA|T1.3.2,NESA|T1.3.3,NESA|T1.4.1,NESA|T4.2.1,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.2,NESA|T7.5.3,NIAv2|AM1,NIAv2|AM3,NIAv2|AM23f,NIAv2|SS13c,NIAv2|SS15c,NIAv2|SS29,PCI-DSSv3.2.1|7.1.2,PCI-DSSv4.0|7.2.1,PCI-DSSv4.0|7.2.2,QCSC-v1|3.2,QCSC-v1|5.2.2,QCSC-v1|6.2,QCSC-v1|13.2,SWIFT-CSCv1|5.1,TBA-FIISB|31.1,TBA-FIISB|31.4.2,TBA-FIISB|31.4.3" see_also : "https://workbench.cisecurity.org/benchmarks/20333" file : "/etc/group" owner : "root" mask : "133" group : "root" type : FILE_CHECK description : "7.1.4 Ensure access to /etc/group- is configured" info : "The /etc/group- file contains a backup list of all the valid groups defined in the system. 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 commands to remove excess permissions, set owner, and set group on /etc/group- : # chmod u-x,go-wx /etc/group- # chown root:root /etc/group-" reference : "800-171|3.1.1,800-171|3.1.4,800-171|3.1.5,800-171|3.8.1,800-171|3.8.2,800-171|3.8.3,800-171r3|03.01.02,800-171r3|03.01.04,800-171r3|03.01.05a.,800-171r3|03.08.02,800-53|AC-3,800-53|AC-5,800-53|AC-6,800-53|MP-2,800-53r5|AC-3,800-53r5|AC-5,800-53r5|AC-6,800-53r5|MP-2,CN-L3|7.1.3.2(b),CN-L3|7.1.3.2(g),CN-L3|8.1.4.2(d),CN-L3|8.1.4.2(f),CN-L3|8.1.4.11(b),CN-L3|8.1.10.2(c),CN-L3|8.1.10.6(a),CN-L3|8.5.3.1,CN-L3|8.5.4.1(a),CSCv7|14.6,CSCv8|3.3,CSF|PR.AC-4,CSF|PR.DS-5,CSF|PR.PT-2,CSF|PR.PT-3,CSF2.0|PR.AA-05,CSF2.0|PR.DS-10,CSF2.0|PR.IR-01,GDPR|32.1.b,HIPAA|164.306(a)(1),HIPAA|164.312(a)(1),ISO-27001-2022|A.5.3,ISO-27001-2022|A.5.10,ISO-27001-2022|A.5.15,ISO-27001-2022|A.5.33,ISO-27001-2022|A.7.7,ISO-27001-2022|A.7.10,ISO-27001-2022|A.8.2,ISO-27001-2022|A.8.3,ISO-27001-2022|A.8.18,ISO-27001-2022|A.8.20,ISO/IEC-27001|A.6.1.2,ISO/IEC-27001|A.9.4.1,ISO/IEC-27001|A.9.4.5,ITSG-33|AC-3,ITSG-33|AC-5,ITSG-33|AC-6,ITSG-33|MP-2,ITSG-33|MP-2a.,LEVEL|1A,NESA|T1.3.2,NESA|T1.3.3,NESA|T1.4.1,NESA|T4.2.1,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.2,NESA|T7.5.3,NIAv2|AM1,NIAv2|AM3,NIAv2|AM23f,NIAv2|SS13c,NIAv2|SS15c,NIAv2|SS29,PCI-DSSv3.2.1|7.1.2,PCI-DSSv4.0|7.2.1,PCI-DSSv4.0|7.2.2,QCSC-v1|3.2,QCSC-v1|5.2.2,QCSC-v1|6.2,QCSC-v1|13.2,SWIFT-CSCv1|5.1,TBA-FIISB|31.1,TBA-FIISB|31.4.2,TBA-FIISB|31.4.3" see_also : "https://workbench.cisecurity.org/benchmarks/20333" file : "/etc/group-" owner : "root" mask : "133" group : "root" type : FILE_CHECK description : "7.1.5 Ensure access to /etc/shadow is 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. 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 following commands to set mode, owner, and group on /etc/shadow : # chown root:root /etc/shadow # chmod 0000 /etc/shadow" reference : "800-171|3.1.1,800-171|3.1.4,800-171|3.1.5,800-171|3.8.1,800-171|3.8.2,800-171|3.8.3,800-171r3|03.01.02,800-171r3|03.01.04,800-171r3|03.01.05a.,800-171r3|03.08.02,800-53|AC-3,800-53|AC-5,800-53|AC-6,800-53|MP-2,800-53r5|AC-3,800-53r5|AC-5,800-53r5|AC-6,800-53r5|MP-2,CN-L3|7.1.3.2(b),CN-L3|7.1.3.2(g),CN-L3|8.1.4.2(d),CN-L3|8.1.4.2(f),CN-L3|8.1.4.11(b),CN-L3|8.1.10.2(c),CN-L3|8.1.10.6(a),CN-L3|8.5.3.1,CN-L3|8.5.4.1(a),CSCv7|14.6,CSCv8|3.3,CSF|PR.AC-4,CSF|PR.DS-5,CSF|PR.PT-2,CSF|PR.PT-3,CSF2.0|PR.AA-05,CSF2.0|PR.DS-10,CSF2.0|PR.IR-01,GDPR|32.1.b,HIPAA|164.306(a)(1),HIPAA|164.312(a)(1),ISO-27001-2022|A.5.3,ISO-27001-2022|A.5.10,ISO-27001-2022|A.5.15,ISO-27001-2022|A.5.33,ISO-27001-2022|A.7.7,ISO-27001-2022|A.7.10,ISO-27001-2022|A.8.2,ISO-27001-2022|A.8.3,ISO-27001-2022|A.8.18,ISO-27001-2022|A.8.20,ISO/IEC-27001|A.6.1.2,ISO/IEC-27001|A.9.4.1,ISO/IEC-27001|A.9.4.5,ITSG-33|AC-3,ITSG-33|AC-5,ITSG-33|AC-6,ITSG-33|MP-2,ITSG-33|MP-2a.,LEVEL|1A,NESA|T1.3.2,NESA|T1.3.3,NESA|T1.4.1,NESA|T4.2.1,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.2,NESA|T7.5.3,NIAv2|AM1,NIAv2|AM3,NIAv2|AM23f,NIAv2|SS13c,NIAv2|SS15c,NIAv2|SS29,PCI-DSSv3.2.1|7.1.2,PCI-DSSv4.0|7.2.1,PCI-DSSv4.0|7.2.2,QCSC-v1|3.2,QCSC-v1|5.2.2,QCSC-v1|6.2,QCSC-v1|13.2,SWIFT-CSCv1|5.1,TBA-FIISB|31.1,TBA-FIISB|31.4.2,TBA-FIISB|31.4.3" see_also : "https://workbench.cisecurity.org/benchmarks/20333" file : "/etc/shadow" owner : "root" mask : "777" group : "root" type : FILE_CHECK description : "7.1.6 Ensure access to /etc/shadow- is 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. 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 following commands to set mode, owner, and group on /etc/shadow- : # chown root:root /etc/shadow- # chmod 0000 /etc/shadow-" reference : "800-171|3.1.1,800-171|3.1.4,800-171|3.1.5,800-171|3.8.1,800-171|3.8.2,800-171|3.8.3,800-171r3|03.01.02,800-171r3|03.01.04,800-171r3|03.01.05a.,800-171r3|03.08.02,800-53|AC-3,800-53|AC-5,800-53|AC-6,800-53|MP-2,800-53r5|AC-3,800-53r5|AC-5,800-53r5|AC-6,800-53r5|MP-2,CN-L3|7.1.3.2(b),CN-L3|7.1.3.2(g),CN-L3|8.1.4.2(d),CN-L3|8.1.4.2(f),CN-L3|8.1.4.11(b),CN-L3|8.1.10.2(c),CN-L3|8.1.10.6(a),CN-L3|8.5.3.1,CN-L3|8.5.4.1(a),CSCv7|14.6,CSCv8|3.3,CSF|PR.AC-4,CSF|PR.DS-5,CSF|PR.PT-2,CSF|PR.PT-3,CSF2.0|PR.AA-05,CSF2.0|PR.DS-10,CSF2.0|PR.IR-01,GDPR|32.1.b,HIPAA|164.306(a)(1),HIPAA|164.312(a)(1),ISO-27001-2022|A.5.3,ISO-27001-2022|A.5.10,ISO-27001-2022|A.5.15,ISO-27001-2022|A.5.33,ISO-27001-2022|A.7.7,ISO-27001-2022|A.7.10,ISO-27001-2022|A.8.2,ISO-27001-2022|A.8.3,ISO-27001-2022|A.8.18,ISO-27001-2022|A.8.20,ISO/IEC-27001|A.6.1.2,ISO/IEC-27001|A.9.4.1,ISO/IEC-27001|A.9.4.5,ITSG-33|AC-3,ITSG-33|AC-5,ITSG-33|AC-6,ITSG-33|MP-2,ITSG-33|MP-2a.,LEVEL|1A,NESA|T1.3.2,NESA|T1.3.3,NESA|T1.4.1,NESA|T4.2.1,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.2,NESA|T7.5.3,NIAv2|AM1,NIAv2|AM3,NIAv2|AM23f,NIAv2|SS13c,NIAv2|SS15c,NIAv2|SS29,PCI-DSSv3.2.1|7.1.2,PCI-DSSv4.0|7.2.1,PCI-DSSv4.0|7.2.2,QCSC-v1|3.2,QCSC-v1|5.2.2,QCSC-v1|6.2,QCSC-v1|13.2,SWIFT-CSCv1|5.1,TBA-FIISB|31.1,TBA-FIISB|31.4.2,TBA-FIISB|31.4.3" see_also : "https://workbench.cisecurity.org/benchmarks/20333" file : "/etc/shadow-" owner : "root" mask : "777" group : "root" type : FILE_CHECK description : "7.1.7 Ensure access to /etc/gshadow is 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. 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 following commands to set mode, owner, and group on /etc/gshadow : # chown root:root /etc/gshadow # chmod 0000 /etc/gshadow" reference : "800-171|3.1.1,800-171|3.1.4,800-171|3.1.5,800-171|3.8.1,800-171|3.8.2,800-171|3.8.3,800-171r3|03.01.02,800-171r3|03.01.04,800-171r3|03.01.05a.,800-171r3|03.08.02,800-53|AC-3,800-53|AC-5,800-53|AC-6,800-53|MP-2,800-53r5|AC-3,800-53r5|AC-5,800-53r5|AC-6,800-53r5|MP-2,CN-L3|7.1.3.2(b),CN-L3|7.1.3.2(g),CN-L3|8.1.4.2(d),CN-L3|8.1.4.2(f),CN-L3|8.1.4.11(b),CN-L3|8.1.10.2(c),CN-L3|8.1.10.6(a),CN-L3|8.5.3.1,CN-L3|8.5.4.1(a),CSCv7|16.4,CSCv8|3.3,CSF|PR.AC-4,CSF|PR.DS-5,CSF|PR.PT-2,CSF|PR.PT-3,CSF2.0|PR.AA-05,CSF2.0|PR.DS-10,CSF2.0|PR.IR-01,GDPR|32.1.b,HIPAA|164.306(a)(1),HIPAA|164.312(a)(1),ISO-27001-2022|A.5.3,ISO-27001-2022|A.5.10,ISO-27001-2022|A.5.15,ISO-27001-2022|A.5.33,ISO-27001-2022|A.7.7,ISO-27001-2022|A.7.10,ISO-27001-2022|A.8.2,ISO-27001-2022|A.8.3,ISO-27001-2022|A.8.18,ISO-27001-2022|A.8.20,ISO/IEC-27001|A.6.1.2,ISO/IEC-27001|A.9.4.1,ISO/IEC-27001|A.9.4.5,ITSG-33|AC-3,ITSG-33|AC-5,ITSG-33|AC-6,ITSG-33|MP-2,ITSG-33|MP-2a.,LEVEL|1A,NESA|T1.3.2,NESA|T1.3.3,NESA|T1.4.1,NESA|T4.2.1,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.2,NESA|T7.5.3,NIAv2|AM1,NIAv2|AM3,NIAv2|AM23f,NIAv2|SS13c,NIAv2|SS15c,NIAv2|SS29,PCI-DSSv3.2.1|7.1.2,PCI-DSSv4.0|7.2.1,PCI-DSSv4.0|7.2.2,QCSC-v1|3.2,QCSC-v1|5.2.2,QCSC-v1|6.2,QCSC-v1|13.2,SWIFT-CSCv1|5.1,TBA-FIISB|31.1,TBA-FIISB|31.4.2,TBA-FIISB|31.4.3" see_also : "https://workbench.cisecurity.org/benchmarks/20333" file : "/etc/gshadow" owner : "root" mask : "777" group : "root" type : FILE_CHECK description : "7.1.8 Ensure access to /etc/gshadow- is 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. 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 following commands to set mode, owner, and group on /etc/gshadow- : # chown root:root /etc/gshadow- # chmod 0000 /etc/gshadow-" reference : "800-171|3.1.1,800-171|3.1.4,800-171|3.1.5,800-171|3.8.1,800-171|3.8.2,800-171|3.8.3,800-171r3|03.01.02,800-171r3|03.01.04,800-171r3|03.01.05a.,800-171r3|03.08.02,800-53|AC-3,800-53|AC-5,800-53|AC-6,800-53|MP-2,800-53r5|AC-3,800-53r5|AC-5,800-53r5|AC-6,800-53r5|MP-2,CN-L3|7.1.3.2(b),CN-L3|7.1.3.2(g),CN-L3|8.1.4.2(d),CN-L3|8.1.4.2(f),CN-L3|8.1.4.11(b),CN-L3|8.1.10.2(c),CN-L3|8.1.10.6(a),CN-L3|8.5.3.1,CN-L3|8.5.4.1(a),CSCv7|16.4,CSCv8|3.3,CSF|PR.AC-4,CSF|PR.DS-5,CSF|PR.PT-2,CSF|PR.PT-3,CSF2.0|PR.AA-05,CSF2.0|PR.DS-10,CSF2.0|PR.IR-01,GDPR|32.1.b,HIPAA|164.306(a)(1),HIPAA|164.312(a)(1),ISO-27001-2022|A.5.3,ISO-27001-2022|A.5.10,ISO-27001-2022|A.5.15,ISO-27001-2022|A.5.33,ISO-27001-2022|A.7.7,ISO-27001-2022|A.7.10,ISO-27001-2022|A.8.2,ISO-27001-2022|A.8.3,ISO-27001-2022|A.8.18,ISO-27001-2022|A.8.20,ISO/IEC-27001|A.6.1.2,ISO/IEC-27001|A.9.4.1,ISO/IEC-27001|A.9.4.5,ITSG-33|AC-3,ITSG-33|AC-5,ITSG-33|AC-6,ITSG-33|MP-2,ITSG-33|MP-2a.,LEVEL|1A,NESA|T1.3.2,NESA|T1.3.3,NESA|T1.4.1,NESA|T4.2.1,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.2,NESA|T7.5.3,NIAv2|AM1,NIAv2|AM3,NIAv2|AM23f,NIAv2|SS13c,NIAv2|SS15c,NIAv2|SS29,PCI-DSSv3.2.1|7.1.2,PCI-DSSv4.0|7.2.1,PCI-DSSv4.0|7.2.2,QCSC-v1|3.2,QCSC-v1|5.2.2,QCSC-v1|6.2,QCSC-v1|13.2,SWIFT-CSCv1|5.1,TBA-FIISB|31.1,TBA-FIISB|31.4.2,TBA-FIISB|31.4.3" see_also : "https://workbench.cisecurity.org/benchmarks/20333" file : "/etc/gshadow-" owner : "root" mask : "777" group : "root" type : FILE_CHECK description : "7.1.9 Ensure access to /etc/shells is configured" info : "/etc/shells is a text file which contains the full pathnames of valid login shells. This file is consulted by chsh and available to be queried by other programs. It is critical to ensure that the /etc/shells 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 commands to remove excess permissions, set owner, and set group on /etc/shells : # chmod u-x,go-wx /etc/shells # chown root:root /etc/shells" reference : "800-171|3.1.1,800-171|3.1.4,800-171|3.1.5,800-171|3.8.1,800-171|3.8.2,800-171|3.8.3,800-171r3|03.01.02,800-171r3|03.01.04,800-171r3|03.01.05a.,800-171r3|03.08.02,800-53|AC-3,800-53|AC-5,800-53|AC-6,800-53|MP-2,800-53r5|AC-3,800-53r5|AC-5,800-53r5|AC-6,800-53r5|MP-2,CN-L3|7.1.3.2(b),CN-L3|7.1.3.2(g),CN-L3|8.1.4.2(d),CN-L3|8.1.4.2(f),CN-L3|8.1.4.11(b),CN-L3|8.1.10.2(c),CN-L3|8.1.10.6(a),CN-L3|8.5.3.1,CN-L3|8.5.4.1(a),CSCv7|14.6,CSCv8|3.3,CSF|PR.AC-4,CSF|PR.DS-5,CSF|PR.PT-2,CSF|PR.PT-3,CSF2.0|PR.AA-05,CSF2.0|PR.DS-10,CSF2.0|PR.IR-01,GDPR|32.1.b,HIPAA|164.306(a)(1),HIPAA|164.312(a)(1),ISO-27001-2022|A.5.3,ISO-27001-2022|A.5.10,ISO-27001-2022|A.5.15,ISO-27001-2022|A.5.33,ISO-27001-2022|A.7.7,ISO-27001-2022|A.7.10,ISO-27001-2022|A.8.2,ISO-27001-2022|A.8.3,ISO-27001-2022|A.8.18,ISO-27001-2022|A.8.20,ISO/IEC-27001|A.6.1.2,ISO/IEC-27001|A.9.4.1,ISO/IEC-27001|A.9.4.5,ITSG-33|AC-3,ITSG-33|AC-5,ITSG-33|AC-6,ITSG-33|MP-2,ITSG-33|MP-2a.,LEVEL|1A,NESA|T1.3.2,NESA|T1.3.3,NESA|T1.4.1,NESA|T4.2.1,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.2,NESA|T7.5.3,NIAv2|AM1,NIAv2|AM3,NIAv2|AM23f,NIAv2|SS13c,NIAv2|SS15c,NIAv2|SS29,PCI-DSSv3.2.1|7.1.2,PCI-DSSv4.0|7.2.1,PCI-DSSv4.0|7.2.2,QCSC-v1|3.2,QCSC-v1|5.2.2,QCSC-v1|6.2,QCSC-v1|13.2,SWIFT-CSCv1|5.1,TBA-FIISB|31.1,TBA-FIISB|31.4.2,TBA-FIISB|31.4.3" see_also : "https://workbench.cisecurity.org/benchmarks/20333" file : "/etc/shells" owner : "root" mask : "133" group : "root" type : CMD_EXEC description : "7.2.1 Ensure accounts in /etc/passwd use shadowed passwords" info : "Local accounts can uses shadowed passwords. With shadowed passwords, The passwords are saved in shadow password file, /etc/shadow encrypted by a salted one-way hash. Accounts with a shadowed password have an x in the second field in /etc/passwd The /etc/passwd file also contains information like user ID's and group ID's that are used by many system programs. Therefore, the /etc/passwd file must remain world readable. In spite of encoding the password with a randomly-generated one-way hash function, an attacker could still break the system if they got access to the /etc/passwd file. This can be mitigated by using shadowed passwords, thus moving the passwords in the /etc/passwd file to /etc/shadow The /etc/shadow file is set so only root will be able to read and write. This helps mitigate the risk of an attacker gaining access to the encoded passwords with which to perform a dictionary attack. Note: - All accounts must have passwords or be locked to prevent the account from being used by an unauthorized user. - A user account with an empty second field in /etc/passwd allows the account to be logged into by providing only the username." solution : "Run the following command to set accounts to use shadowed passwords and migrate passwords in /etc/passwd to /etc/shadow : # pwconv Investigate to determine if the account is logged in and what it is being used for, to determine if it needs to be forced off." reference : "800-171|3.5.2,800-171|3.13.16,800-171r3|03.05.07,800-171r3|03.13.08,800-53|IA-5(1),800-53|SC-28,800-53|SC-28(1),800-53r5|IA-5(1),800-53r5|SC-28,800-53r5|SC-28(1),CN-L3|8.1.4.7(b),CN-L3|8.1.4.8(b),CSCv7|16.4,CSCv8|3.11,CSF|PR.AC-1,CSF|PR.DS-1,CSF2.0|PR.AA-01,CSF2.0|PR.AA-03,CSF2.0|PR.DS-01,GDPR|32.1.a,GDPR|32.1.b,HIPAA|164.306(a)(1),HIPAA|164.312(a)(2)(i),HIPAA|164.312(a)(2)(iv),HIPAA|164.312(d),HIPAA|164.312(e)(2)(ii),ISO-27001-2022|A.5.10,ISO-27001-2022|A.5.16,ISO-27001-2022|A.5.17,ISO-27001-2022|A.5.33,ITSG-33|IA-5(1),ITSG-33|SC-28,ITSG-33|SC-28a.,ITSG-33|SC-28(1),LEVEL|1A,NESA|T5.2.3,PCI-DSSv3.2.1|3.4,PCI-DSSv4.0|3.3.2,PCI-DSSv4.0|3.5.1,QCSC-v1|5.2.2,QCSC-v1|6.2,QCSC-v1|13.2,SWIFT-CSCv1|4.1,TBA-FIISB|28.1" see_also : "https://workbench.cisecurity.org/benchmarks/20333" cmd : "/bin/awk -F: '($2 != \"x\" ) { print $1 \" is not set to shadowed passwords \"}' /etc/passwd | /bin/awk '{print} END {if (NR == 0) print \"none\"}'" expect : "^none$" type : CMD_EXEC description : "7.2.2 Ensure /etc/shadow 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. 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.2,800-171r3|03.05.07,800-53|IA-5(1),800-53r5|IA-5(1),CSCv7|4.4,CSCv8|5.2,CSF|PR.AC-1,CSF2.0|PR.AA-01,CSF2.0|PR.AA-03,GDPR|32.1.b,HIPAA|164.306(a)(1),HIPAA|164.312(a)(2)(i),HIPAA|164.312(d),ISO-27001-2022|A.5.16,ISO-27001-2022|A.5.17,ITSG-33|IA-5(1),LEVEL|1A,NESA|T5.2.3,QCSC-v1|5.2.2,QCSC-v1|13.2,SWIFT-CSCv1|4.1" see_also : "https://workbench.cisecurity.org/benchmarks/20333" cmd : "/bin/awk -F : \'($2 == \"\") { print $1 \" does not have a password.\"}\' /etc/shadow | /bin/awk '{print} END {if (NR == 0) print \"none\"}'" expect : "^none$" description : "7.2.3 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 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-171|3.1.4,800-171|3.1.5,800-171|3.8.1,800-171|3.8.2,800-171|3.8.3,800-171r3|03.01.01,800-171r3|03.01.02,800-171r3|03.01.04,800-171r3|03.01.05a.,800-171r3|03.08.02,800-53|AC-2,800-53|AC-3,800-53|AC-5,800-53|AC-6,800-53|MP-2,800-53r5|AC-3,800-53r5|AC-5,800-53r5|AC-6,800-53r5|AT-2,800-53r5|MP-2,CN-L3|7.1.3.2(b),CN-L3|7.1.3.2(d),CN-L3|7.1.3.2(g),CN-L3|8.1.4.2(d),CN-L3|8.1.4.2(f),CN-L3|8.1.4.11(b),CN-L3|8.1.10.2(c),CN-L3|8.1.10.6(a),CN-L3|8.5.3.1,CN-L3|8.5.4.1(a),CSCv8|3.3,CSCv8|14.6,CSF|DE.CM-1,CSF|DE.CM-3,CSF|PR.AC-1,CSF|PR.AC-4,CSF|PR.DS-5,CSF|PR.PT-2,CSF|PR.PT-3,CSF2.0|DE.CM-01,CSF2.0|DE.CM-03,CSF2.0|PR.AA-01,CSF2.0|PR.AA-05,CSF2.0|PR.DS-10,CSF2.0|PR.IR-01,GDPR|32.1.b,HIPAA|164.306(a)(1),HIPAA|164.312(a)(1),ISO-27001-2022|A.5.3,ISO-27001-2022|A.5.10,ISO-27001-2022|A.5.15,ISO-27001-2022|A.5.16,ISO-27001-2022|A.5.18,ISO-27001-2022|A.5.33,ISO-27001-2022|A.7.7,ISO-27001-2022|A.7.10,ISO-27001-2022|A.8.2,ISO-27001-2022|A.8.3,ISO-27001-2022|A.8.18,ISO-27001-2022|A.8.20,ISO/IEC-27001|A.6.1.2,ISO/IEC-27001|A.9.2.1,ISO/IEC-27001|A.9.4.1,ISO/IEC-27001|A.9.4.5,ITSG-33|AC-2,ITSG-33|AC-3,ITSG-33|AC-5,ITSG-33|AC-6,ITSG-33|MP-2,ITSG-33|MP-2a.,LEVEL|1A,NESA|T1.3.2,NESA|T1.3.3,NESA|T1.4.1,NESA|T4.2.1,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.2,NESA|T7.5.3,NIAv2|AM1,NIAv2|AM3,NIAv2|AM23f,NIAv2|AM28,NIAv2|NS5j,NIAv2|SS13c,NIAv2|SS14e,NIAv2|SS15c,NIAv2|SS29,PCI-DSSv3.2.1|7.1.2,PCI-DSSv4.0|7.2.1,PCI-DSSv4.0|7.2.2,QCSC-v1|3.2,QCSC-v1|5.2.2,QCSC-v1|6.2,QCSC-v1|8.2.1,QCSC-v1|13.2,QCSC-v1|15.2,SWIFT-CSCv1|5.1,TBA-FIISB|31.1,TBA-FIISB|31.4.2,TBA-FIISB|31.4.3" see_also : "https://workbench.cisecurity.org/benchmarks/20333" name : "passwd_invalid_gid" description : "7.2.4 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. 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-171r3|03.05.05c.,800-53|IA-4d.,800-53r5|IA-4d.,CN-L3|8.1.4.1(a),CSF|PR.AC-1,CSF2.0|PR.AA-01,GDPR|32.1.b,HIPAA|164.306(a)(1),HIPAA|164.312(a)(2)(i),HIPAA|164.312(d),ISO-27001-2022|A.5.16,ITSG-33|IA-4d.,LEVEL|1A,NESA|T5.5.2,NIAv2|AM14a,QCSC-v1|5.2.2,QCSC-v1|13.2,SWIFT-CSCv1|5" see_also : "https://workbench.cisecurity.org/benchmarks/20333" name : "passwd_duplicate_uid" description : "7.2.5 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. 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." reference : "800-171|3.5.5,800-171|3.5.6,800-171r3|03.05.05c.,800-53|IA-4d.,800-53r5|IA-4d.,CN-L3|8.1.4.1(a),CSF|PR.AC-1,CSF2.0|PR.AA-01,GDPR|32.1.b,HIPAA|164.306(a)(1),HIPAA|164.312(a)(2)(i),HIPAA|164.312(d),ISO-27001-2022|A.5.16,ITSG-33|IA-4d.,LEVEL|1A,NESA|T5.5.2,NIAv2|AM14a,QCSC-v1|5.2.2,QCSC-v1|13.2,SWIFT-CSCv1|5" see_also : "https://workbench.cisecurity.org/benchmarks/20333" name : "group_duplicate_gid" description : "7.2.6 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. 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-171r3|03.05.05c.,800-53|IA-4d.,800-53r5|IA-4d.,CN-L3|8.1.4.1(a),CSF|PR.AC-1,CSF2.0|PR.AA-01,GDPR|32.1.b,HIPAA|164.306(a)(1),HIPAA|164.312(a)(2)(i),HIPAA|164.312(d),ISO-27001-2022|A.5.16,ITSG-33|IA-4d.,LEVEL|1A,NESA|T5.5.2,NIAv2|AM14a,QCSC-v1|5.2.2,QCSC-v1|13.2,SWIFT-CSCv1|5" see_also : "https://workbench.cisecurity.org/benchmarks/20333" name : "passwd_duplicate_username" description : "7.2.7 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. 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-171r3|03.05.05c.,800-53|IA-4d.,800-53r5|IA-4d.,CN-L3|8.1.4.1(a),CSF|PR.AC-1,CSF2.0|PR.AA-01,GDPR|32.1.b,HIPAA|164.306(a)(1),HIPAA|164.312(a)(2)(i),HIPAA|164.312(d),ISO-27001-2022|A.5.16,ITSG-33|IA-4d.,LEVEL|1A,NESA|T5.5.2,NIAv2|AM14a,QCSC-v1|5.2.2,QCSC-v1|13.2,SWIFT-CSCv1|5" see_also : "https://workbench.cisecurity.org/benchmarks/20333" name : "group_duplicate_name" type : CMD_EXEC description : "7.2.8 Ensure local interactive user home directories are configured" info : "The user home directory is space defined for the particular user to set local environment variables and to store personal files. While the system administrator can establish secure permissions for users' home directories, the users can easily override these. Users can be defined in /etc/passwd without a home directory or with a home directory that does not actually exist. Since the user is accountable for files stored in the user home directory, the user must be the owner of the directory. 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. 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 a local interactive users' home directory is undefined and/or doesn't exist, follow local site policy and perform one of the following: - Lock the user account - Remove the user from the system - create a directory for the user. If undefined, edit /etc/passwd and add the absolute path to the directory to the last field of the user. Run the following script to: - Remove excessive permissions from local interactive users home directories - Update the home directory's owner #!/usr/bin/env bash { l_output2=\"\" l_valid_shells=\"^($( awk -F\/ '$NF != \"nologin\" {print}' /etc/shells | sed -rn '/^\//{s,/,\\\\/,g;p}' | paste -s -d '|' - ))$\" unset a_uarr && a_uarr=() # Clear and initialize array while read -r l_epu l_eph; do # Populate array with users and user home location a_uarr+=(\"$l_epu $l_eph\") done <<< \"$(awk -v pat=\"$l_valid_shells\" -F: '$(NF) ~ pat { print $1 \" \" $(NF-1) }' /etc/passwd)\" l_asize=\"${#a_uarr[@]}\" # Here if we want to look at number of users before proceeding [ \"$l_asize \" -gt \"10000\" ] && echo -e \"\n ** INFO **\n - \\\"$l_asize\\\" Local interactive users found on the system\n - This may be a long running process\n\" while read -r l_user l_home; do if [ -d \"$l_home\" ]; then l_mask='0027' l_max=\"$( printf '%o' $(( 0777 & ~$l_mask)) )\" while read -r l_own l_mode; do if [ \"$l_user\" != \"$l_own\" ]; then l_output2=\"$l_output2\n - User: \\\"$l_user\\\" Home \\\"$l_home\\\" is owned by: \\\"$l_own\\\"\n - changing ownership to: \\\"$l_user\\\"\n\" chown \"$l_user\" \"$l_home\" fi if [ $(( $l_mode & $l_mask )) -gt 0 ]; then l_output2=\"$l_output2\n - User: \\\"$l_user\\\" Home \\\"$l_home\\\" is mode: \\\"$l_mode\\\" should be mode: \\\"$l_max\\\" or more restrictive\n - removing excess permissions\n\" chmod g-w,o-rwx \"$l_home\" fi done <<< \"$(stat -Lc '%U %#a' \"$l_home\")\" else l_output2=\"$l_output2\n - User: \\\"$l_user\\\" Home \\\"$l_home\\\" Doesn't exist\n - Please create a home in accordance with local site policy\" fi done <<< \"$(printf '%s\n' \"${a_uarr[@]}\")\" if [ -z \"$l_output2\" ]; then # If l_output2 is empty, we pass echo -e \" - No modification needed to local interactive users home directories\" else echo -e \"\n$l_output2\" fi }" reference : "800-171|3.1.1,800-171|3.1.4,800-171|3.1.5,800-171|3.8.1,800-171|3.8.2,800-171|3.8.3,800-171r3|03.01.02,800-171r3|03.01.04,800-171r3|03.01.05a.,800-171r3|03.08.02,800-53|AC-3,800-53|AC-5,800-53|AC-6,800-53|MP-2,800-53r5|AC-3,800-53r5|AC-5,800-53r5|AC-6,800-53r5|MP-2,CN-L3|7.1.3.2(b),CN-L3|7.1.3.2(g),CN-L3|8.1.4.2(d),CN-L3|8.1.4.2(f),CN-L3|8.1.4.11(b),CN-L3|8.1.10.2(c),CN-L3|8.1.10.6(a),CN-L3|8.5.3.1,CN-L3|8.5.4.1(a),CSCv7|14.6,CSCv8|3.3,CSF|PR.AC-4,CSF|PR.DS-5,CSF|PR.PT-2,CSF|PR.PT-3,CSF2.0|PR.AA-05,CSF2.0|PR.DS-10,CSF2.0|PR.IR-01,GDPR|32.1.b,HIPAA|164.306(a)(1),HIPAA|164.312(a)(1),ISO-27001-2022|A.5.3,ISO-27001-2022|A.5.10,ISO-27001-2022|A.5.15,ISO-27001-2022|A.5.33,ISO-27001-2022|A.7.7,ISO-27001-2022|A.7.10,ISO-27001-2022|A.8.2,ISO-27001-2022|A.8.3,ISO-27001-2022|A.8.18,ISO-27001-2022|A.8.20,ISO/IEC-27001|A.6.1.2,ISO/IEC-27001|A.9.4.1,ISO/IEC-27001|A.9.4.5,ITSG-33|AC-3,ITSG-33|AC-5,ITSG-33|AC-6,ITSG-33|MP-2,ITSG-33|MP-2a.,LEVEL|1A,NESA|T1.3.2,NESA|T1.3.3,NESA|T1.4.1,NESA|T4.2.1,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.2,NESA|T7.5.3,NIAv2|AM1,NIAv2|AM3,NIAv2|AM23f,NIAv2|SS13c,NIAv2|SS15c,NIAv2|SS29,PCI-DSSv3.2.1|7.1.2,PCI-DSSv4.0|7.2.1,PCI-DSSv4.0|7.2.2,QCSC-v1|3.2,QCSC-v1|5.2.2,QCSC-v1|6.2,QCSC-v1|13.2,SWIFT-CSCv1|5.1,TBA-FIISB|31.1,TBA-FIISB|31.4.2,TBA-FIISB|31.4.3" see_also : "https://workbench.cisecurity.org/benchmarks/20333" cmd : "#!/bin/bash { l_output=\"\" l_output2=\"\" l_heout2=\"\" l_hoout2=\"\" l_haout2=\"\" l_valid_shells=\"^($( awk -F\\/ '$NF != \"nologin\" {print}' /etc/shells | sed -rn '/^\\//{s,/,\\\\\\\\/,g;p}' | paste -s -d '|' - ))$\" unset a_uarr && a_uarr=() # Clear and initialize array while read -r l_epu l_eph; do # Populate array with users and user home location a_uarr+=(\"$l_epu $l_eph\") done <<< \"$(awk -v pat=\"$l_valid_shells\" -F: '$(NF) ~ pat { print $1 \" \" $(NF-1) }' /etc/passwd)\" l_asize=\"${#a_uarr[@]}\" # Here if we want to look at number of users before proceeding [ \"$l_asize \" -gt \"10000\" ] && echo -e \" ** INFO ** - \\\"$l_asize\\\" Local interactive users found on the system - This may be a long running check \" while read -r l_user l_home; do if [ -d \"$l_home\" ]; then l_mask='0027' l_max=\"$( printf '%o' $(( 0777 & ~$l_mask)) )\" while read -r l_own l_mode; do [ \"$l_user\" != \"$l_own\" ] && l_hoout2=\"$l_hoout2 - User: \\\"$l_user\\\" Home \\\"$l_home\\\" is owned by: \\\"$l_own\\\"\" if [ $(( $l_mode & $l_mask )) -gt 0 ]; then l_haout2=\"$l_haout2 - User: \\\"$l_user\\\" Home \\\"$l_home\\\" is mode: \\\"$l_mode\\\" should be mode: \\\"$l_max\\\" or more restrictive\" fi done <<< \"$(stat -Lc '%U %#a' \"$l_home\")\" else l_heout2=\"$l_heout2 - User: \\\"$l_user\\\" Home \\\"$l_home\\\" Doesn't exist\" fi done <<< \"$(printf '%s ' \"${a_uarr[@]}\")\" [ -z \"$l_heout2\" ] && l_output=\"$l_output - home directories exist\" || l_output2=\"$l_output2$l_heout2\" [ -z \"$l_hoout2\" ] && l_output=\"$l_output - own their home directory\" || l_output2=\"$l_output2$l_hoout2\" [ -z \"$l_haout2\" ] && l_output=\"$l_output - home directories are mode: \\\"$l_max\\\" or more restrictive\" || l_output2=\"$l_output2$l_haout2\" [ -n \"$l_output\" ] && l_output=\" - All local interactive users:$l_output\" if [ -z \"$l_output2\" ]; then # If l_output2 is empty, we pass echo -e \" - Audit Result: ** PASS ** - * Correctly configured * : $l_output\" else echo -e \" - Audit Result: ** FAIL ** - * Reasons for audit failure * : $l_output2\" [ -n \"$l_output\" ] && echo -e \" - * Correctly configured * : $l_output\" fi }" expect : "(?i)^[\\s]*\\**[\\s]*pass:?[\\s]*\\**$" type : CMD_EXEC description : "7.2.9 Ensure local interactive user dot files access is configured" info : "While the system administrator can establish secure permissions for users' \"dot\" files, the users can easily override these. - forward file specifies an email address to forward the user's mail to. - rhost file provides the \"remote authentication\" database for the rcp, rlogin, and rsh commands and the rcmd() function. These files bypass the standard password-based user authentication mechanism. They specify remote hosts and users that are considered trusted (i.e. are allowed to access the local system without supplying a password) - netrc file contains data for logging into a remote host or passing authentication to an API. - bash_history file keeps track of the user's commands. User configuration files with excessive or incorrect access 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. The following script will: - remove excessive permissions on dot files within interactive users' home directories - change ownership of dot files within interactive users' home directories to the user - change group ownership of dot files within interactive users' home directories to the user's primary group - listforward andrhost files to be investigated and manually deleted #!/usr/bin/env bash { a_output2=(); a_output3=() l_maxsize=\"1000\" # Maximum number of local interactive users before warning (Default 1,000) l_valid_shells=\"^($( awk -F\/ '$NF != \"nologin\" {print}' /etc/shells | sed -rn '/^\//{s,/,\\\\/,g;p}' | paste -s -d '|' - ))$\" a_user_and_home=() # Create array with local users and their home directories while read -r l_local_user l_local_user_home; do # Populate array with users and user home location [[ -n \"$l_local_user\" && -n \"$l_local_user_home\" ]] && a_user_and_home+=(\"$l_local_user:$l_local_user_home\") done <<< \"$(awk -v pat=\"$l_valid_shells\" -F: '$(NF) ~ pat { print $1 \" \" $(NF-1) }' /etc/passwd)\" l_asize=\"${#a_user_and_home[@]}\" # Here if we want to look at number of users before proceeding [ \"${#a_user_and_home[@]}\" -gt \"$l_maxsize\" ] && printf '%s\n' \"\" \" ** INFO **\" \ \" - \\\"$l_asize\\\" Local interactive users found on the system\" \ \" - This may be a long running check\" \"\" file_access_fix() { a_access_out=() l_max=\"$( printf '%o' $(( 0777 & ~$l_mask)) )\" if [ $(( $l_mode & $l_mask )) -gt 0 ]; then printf '%s\n' \"\" \" - File: \\\"$l_hdfile\\\" is mode: \\\"$l_mode\\\" and should be mode: \\\"$l_max\\\" or more restrictive\" \ \" Updating file: \\\"$l_hdfile\\\" to be mode: \\\"$l_max\\\" or more restrictive\" chmod \"$l_change\" \"$l_hdfile\" fi if [[ ! \"$l_owner\" =~ ($l_user) ]]; then printf '%s\n' \"\" \" - File: \\\"$l_hdfile\\\" owned by: \\\"$l_owner\\\" and should be owned by \\\"${l_user//|/ or }\\\"\" \ \" Updating file: \\\"$l_hdfile\\\" to be owned by \\\"${l_user//|/ or }\\\"\" chown \"$l_user\" \"$l_hdfile\" fi if [[ ! \"$l_gowner\" =~ ($l_group) ]]; then printf '%s\n' \"\" \" - File: \\\"$l_hdfile\\\" group owned by: \\\"$l_gowner\\\" and should be group owned by \\\"${l_group//|/ or }\\\"\" \ \" Updating file: \\\"$l_hdfile\\\" to be group owned by \\\"${l_group//|/ or }\\\"\" chgrp \"$l_group\" \"$l_hdfile\" fi } while IFS=: read -r l_user l_home; do a_dot_file=(); a_netrc=(); a_netrc_warn=(); a_bhout=(); a_hdirout=() if [ -d \"$l_home\" ]; then l_group=\"$(id -gn \"$l_user\" | xargs)\";l_group=\"${l_group// /|}\" while IFS= read -r -d $'\0' l_hdfile; do while read -r l_mode l_owner l_gowner; do case \"$(basename \"$l_hdfile\")\" in .forward | .rhost ) a_dot_file+=(\" - File: \\\"$l_hdfile\\\" exists\" \" Please review and manually delete this file\") ;; .netrc ) l_mask='0177'; l_change=\"u-x,go-rwx\"; file_access_fix a_netrc_warn+=(\" - File: \\\"$l_hdfile\\\" exists\") ;; .bash_history ) l_mask='0177'; l_change=\"u-x,go-rwx\"; file_access_fix ;; * ) l_mask='0133'; l_change=\"u-x,go-wx\"; file_access_fix ;; esac done < <(stat -Lc '%#a %U %G' \"$l_hdfile\") done < <(find \"$l_home\" -xdev -type f -name '.*' -print0) fi [ \"${#a_dot_file[@]}\" -gt 0 ] && a_output2+=(\" - User: \\\"$l_user\\\" Home Directory: \\\"$l_home\\\"\" \"${a_dot_file[@]}\") [ \"${#a_netrc_warn[@]}\" -gt 0 ] && a_output3+=(\" - User: \\\"$l_user\\\" Home Directory: \\\"$l_home\\\"\" \"${a_netrc_warn[@]}\") done <<< \"$(printf '%s\n' \"${a_user_and_home[@]}\")\" [ \"${#a_output3[@]}\" -gt 0 ] && printf '%s\n' \"\" \" ** WARNING **\" \"${a_output3[@]}\" \"\" [ \"${#a_output2[@]}\" -gt 0 ] && printf '%s\n' \"\" \"${a_output2[@]}\" }" reference : "800-171|3.1.1,800-171|3.1.4,800-171|3.1.5,800-171|3.8.1,800-171|3.8.2,800-171|3.8.3,800-171r3|03.01.02,800-171r3|03.01.04,800-171r3|03.01.05a.,800-171r3|03.08.02,800-53|AC-3,800-53|AC-5,800-53|AC-6,800-53|MP-2,800-53r5|AC-3,800-53r5|AC-5,800-53r5|AC-6,800-53r5|MP-2,CN-L3|7.1.3.2(b),CN-L3|7.1.3.2(g),CN-L3|8.1.4.2(d),CN-L3|8.1.4.2(f),CN-L3|8.1.4.11(b),CN-L3|8.1.10.2(c),CN-L3|8.1.10.6(a),CN-L3|8.5.3.1,CN-L3|8.5.4.1(a),CSCv7|14.6,CSCv8|3.3,CSF|PR.AC-4,CSF|PR.DS-5,CSF|PR.PT-2,CSF|PR.PT-3,CSF2.0|PR.AA-05,CSF2.0|PR.DS-10,CSF2.0|PR.IR-01,GDPR|32.1.b,HIPAA|164.306(a)(1),HIPAA|164.312(a)(1),ISO-27001-2022|A.5.3,ISO-27001-2022|A.5.10,ISO-27001-2022|A.5.15,ISO-27001-2022|A.5.33,ISO-27001-2022|A.7.7,ISO-27001-2022|A.7.10,ISO-27001-2022|A.8.2,ISO-27001-2022|A.8.3,ISO-27001-2022|A.8.18,ISO-27001-2022|A.8.20,ISO/IEC-27001|A.6.1.2,ISO/IEC-27001|A.9.4.1,ISO/IEC-27001|A.9.4.5,ITSG-33|AC-3,ITSG-33|AC-5,ITSG-33|AC-6,ITSG-33|MP-2,ITSG-33|MP-2a.,LEVEL|1A,NESA|T1.3.2,NESA|T1.3.3,NESA|T1.4.1,NESA|T4.2.1,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.2,NESA|T7.5.3,NIAv2|AM1,NIAv2|AM3,NIAv2|AM23f,NIAv2|SS13c,NIAv2|SS15c,NIAv2|SS29,PCI-DSSv3.2.1|7.1.2,PCI-DSSv4.0|7.2.1,PCI-DSSv4.0|7.2.2,QCSC-v1|3.2,QCSC-v1|5.2.2,QCSC-v1|6.2,QCSC-v1|13.2,SWIFT-CSCv1|5.1,TBA-FIISB|31.1,TBA-FIISB|31.4.2,TBA-FIISB|31.4.3" see_also : "https://workbench.cisecurity.org/benchmarks/20333" cmd : "#!/bin/bash { l_output=\"\" l_output2=\"\" l_output3=\"\" l_bf=\"\" l_df=\"\" l_nf=\"\" l_hf=\"\" l_valid_shells=\"^($( awk -F\\/ '$NF != \"nologin\" {print}' /etc/shells | sed -rn '/^\\//{s,/,\\\\\\\\/,g;p}' | paste -s -d '|' - ))$\" unset a_uarr && a_uarr=() # Clear and initialize array while read -r l_epu l_eph; do # Populate array with users and user home location [[ -n \"$l_epu\" && -n \"$l_eph\" ]] && a_uarr+=(\"$l_epu $l_eph\") done <<< \"$(awk -v pat=\"$l_valid_shells\" -F: '$(NF) ~ pat { print $1 \" \" $(NF-1) }' /etc/passwd)\" l_asize=\"${#a_uarr[@]}\" # Here if we want to look at number of users before proceeding l_maxsize=\"1000\" # Maximun number of local interactive users before warning (Default 1,000) [ \"$l_asize \" -gt \"$l_maxsize\" ] && echo -e \" ** INFO ** - \\\"$l_asize\\\" Local interactive users found on the system - This may be a long running check \" file_access_chk() { l_facout2=\"\" l_max=\"$( printf '%o' $(( 0777 & ~$l_mask)) )\" if [ $(( $l_mode & $l_mask )) -gt 0 ]; then l_facout2=\"$l_facout2 - File: \\\"$l_hdfile\\\" is mode: \\\"$l_mode\\\" and should be mode: \\\"$l_max\\\" or more restrictive\" fi if [[ ! \"$l_owner\" =~ ($l_user) ]]; then l_facout2=\"$l_facout2 - File: \\\"$l_hdfile\\\" owned by: \\\"$l_owner\\\" and should be owned by \\\"${l_user//|/ or }\\\"\" fi if [[ ! \"$l_gowner\" =~ ($l_group) ]]; then l_facout2=\"$l_facout2 - File: \\\"$l_hdfile\\\" group owned by: \\\"$l_gowner\\\" and should be group owned by \\\"${l_group//|/ or }\\\"\" fi } while read -r l_user l_home; do l_fe=\"\" l_nout2=\"\" l_nout3=\"\" l_dfout2=\"\" l_hdout2=\"\" l_bhout2=\"\" if [ -d \"$l_home\" ]; then l_group=\"$(id -gn \"$l_user\" | xargs)\" l_group=\"${l_group// /|}\" while IFS= read -r -d $'\\0' l_hdfile; do while read -r l_mode l_owner l_gowner; do case \"$(basename \"$l_hdfile\")\" in .forward | .rhost ) l_fe=\"Y\" && l_bf=\"Y\" l_dfout2=\"$l_dfout2 - File: \\\"$l_hdfile\\\" exists\" ;; .netrc ) l_mask='0177' file_access_chk if [ -n \"$l_facout2\" ]; then l_fe=\"Y\" && l_nf=\"Y\" l_nout2=\"$l_facout2\" else l_nout3=\" - File: \\\"$l_hdfile\\\" exists\" fi ;; .bash_history ) l_mask='0177' file_access_chk if [ -n \"$l_facout2\" ]; then l_fe=\"Y\" && l_hf=\"Y\" l_bhout2=\"$l_facout2\" fi ;; * ) l_mask='0133' file_access_chk if [ -n \"$l_facout2\" ]; then l_fe=\"Y\" && l_df=\"Y\" l_hdout2=\"$l_facout2\" fi ;; esac done <<< \"$(stat -Lc '%#a %U %G' \"$l_hdfile\")\" done < <(find \"$l_home\" -xdev -type f -name '.*' -print0) fi if [ \"$l_fe\" = \"Y\" ]; then l_output2=\"$l_output2 - User: \\\"$l_user\\\" Home Directory: \\\"$l_home\\\"\" [ -n \"$l_dfout2\" ] && l_output2=\"$l_output2$l_dfout2\" [ -n \"$l_nout2\" ] && l_output2=\"$l_output2$l_nout2\" [ -n \"$l_bhout2\" ] && l_output2=\"$l_output2$l_bhout2\" [ -n \"$l_hdout2\" ] && l_output2=\"$l_output2$l_hdout2\" fi [ -n \"$l_nout3\" ] && l_output3=\"$l_output3 - User: \\\"$l_user\\\" Home Directory: \\\"$l_home\\\" $l_nout3\" done <<< \"$(printf '%s ' \"${a_uarr[@]}\")\" unset a_uarr # Remove array [ -n \"$l_output3\" ] && l_output3=\" - ** Warning ** - \\\".netrc\\\" files should be removed unless deemed necessary and in accordance with local site policy:$l_output3\" [ -z \"$l_bf\" ] && l_output=\"$l_output - \\\".forward\\\" or \\\".rhost\\\" files\" [ -z \"$l_nf\" ] && l_output=\"$l_output - \\\".netrc\\\" files with incorrect access configured\" [ -z \"$l_hf\" ] && l_output=\"$l_output - \\\".bash_history\\\" files with incorrect access configured\" [ -z \"$l_df\" ] && l_output=\"$l_output - \\\"dot\\\" files with incorrect access configured\" [ -n \"$l_output\" ] && l_output=\" - No local interactive users home directories contain:$l_output\" if [ -z \"$l_output2\" ]; then # If l_output2 is empty, we pass echo -e \" - Audit Result: ** PASS ** - * Correctly configured * : $l_output \" echo -e \"$l_output3 \" else echo -e \" - Audit Result: ** FAIL ** - * Reasons for audit failure * : $l_output2 \" echo -e \"$l_output3 \" [ -n \"$l_output\" ] && echo -e \"- * Correctly configured * : $l_output \" fi }" expect : "(?i)^[\\s]*\\**[\\s]*pass:?[\\s]*\\**$" timeout : "@FIND_TIMEOUT@" description : "CIS_SUSE_Linux_Enterprise_15_v2.0.0_L1_Server.audit from CIS SUSE Linux Enterprise 15 Benchmark v2.0.0" info : "NOTE: Nessus has not identified that the chosen audit applies to the target device." see_also : "https://workbench.cisecurity.org/benchmarks/20333"