#TRUSTED 4a8c185b3b48492609a6d7111f1d1110226aac5b9ceba374f0839f7a54548e002719721aeb302888fe5f552858c6e686ea93cdadce6dc8d22d802854823d551943b53f91c323ebe5b809f9eb5bf6d6bf40a3b28313a40cf8a497cec02117ac9dd4fed083764e761efc1833c6bbb0692d3a185010153ae33a07eaa7d4d8825a792964ef873ea2446b2d310552a6673d1b14542e674ed7e27de67a083967382f8d26625998c65dd4d467d9dc00f06d92134483f601ac9679fc09a88d712abbe058d087ac5b2e4931c6f70f99e1f4fabc94ecee23b0c42aed3e0f61b48830062f4c7727ed76671c149296ece76f87544f41a1e4f6ad2f70bce658035bd87bf8e794ff02c8f96ae70c43c9c5f2ffa0457715b47a2c6ebfe0d5df90d3bcc6a4aacaa20e9d85759b68fdcd55547886e13aa9f451171735171c59301b5ee113928d71dce2e90f736880517aa32d420574c7ddc3c3b521674616697274e7672a5c24c72e49ddbee1c2b5339dade74aca84df12bfad39d3cdc996b8a685428921e1b5f7a550f45b53d7d8b18add0a4b6004b20af7201f285ee7708c4f32507dd387eebbb5542debaaa76aae9126c92048e1347b7b62448af4ce8f906dd25853545bb0b870f0d57471dac5db182bb1b65b5a7472c91401d7f834859e44a068423a58ddaa6401afb841b45135cbf0b2958abf1b63a6f0ed254586f6c0c869a6f3e6a5a3ae40 #TRUST-RSA-SHA256 59ced09404df9808dedb6864fd6efd32564940143cc5020c8e3b8cfa54cc933be4a695fd184d7dc1bb0d1d560c75e1f941510e8c40113eda34453d742a48a9135fc1832c8a18560ec9f18d9edf538d1d2287d06b41aa99a69186e43faef6f356a2bcc6e3255ae4e4aa15a7ebe2306c0de4eb05b60695431cc679a849842fcd72e45d0242f5cc77e33123bbaba28e7130bb546ba40a16a196098dc94ab6c6ab2a985d59fefab6f0580caa277a7954d5e176fab13ccf785206909abe6c7a274e6cc6c209b09ed630a49534b4583bbc754517bc7f998453d246d46db46a1674424a4c5487b30c443fdf6dea932652964c87401e302197713aa0e7f9f6c8e8e7a8a946e98b56e17781c1401c11bf6f9ff85af260de4c761e3a708157ef806e8f60f2e2d78349d785bd9d4539f51bcdc6fc92b491fe0f65bdc7a517c54960ceda50bc0d17cb21b57b3d17fdab5f2487c9b28a4a8eadbe7fd86505d5ade09f60be03e7b4a902335deb58443b6ac78447e2fd01237c3ccd469cf97e2d8e1332c000142ce38b939e1ba44e64f96fe2aef53befa4bbad7b71cf0c96a618756786ee51dbd37d6495e702df461a0156f41e7dc49953df3f5a335f5e9d0203c187c4dcc1a93f67f3375219ca860f7f25540530bdf5a0034c3a729a897907efd073e8087affdf979727aac5fdc4a0ff0e055ba9fa5f1cc21ba60927598224dc7f332c388f5a54 # # This script is Copyright (C) 2004-2024 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.10 $ # $Date: 2024/11/06 $ # # Description : This document implements the security configuration as recommended by the CIS Oracle Linux 8 Benchmark v3.0.0 # # https://workbench.cisecurity.org/benchmarks/15289 # # #Safeguards Oracle Linux 8 v3.0.0 # # CIS # Oracle Linux 8 # L1 Server # 3.0.0 # https://workbench.cisecurity.org/benchmarks/15289 # #cis,oracle_server_linux_8,agent,unix #CSCv6,CSCv7,CSCv8,LEVEL # # # PLATFORM_VERSION # 8 # Linux Distribution Version # Linux Distribution Version # STRING # # # 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 # Host address of the NTP server for the target. # STRING # # # PASSWORD_MINCLASS # 4 # Password Complexity Value # Password complexity value found in /etc/security/pwquality.conf # STRING # # # PASSWORD_MAX_DAYS # ([1-9]|[1-9][0-9]|[0-8][0-9]|90) # Password expiration # Password expiration parameter found in /etc/login.defs # STRING # # # PASSWORD_WARN_AGE # ([1][4-9]|[2-9][0-9]+) # Password expiration warning # Password expiration warning parameter found in /etc/login.defs # STRING # # # PASSWORD_ENCRYPTION # SHA512 # Password encryption method # Password encryption method found in /etc/login.defs # STRING # # # INACTIVE_PASSWORD_LOCK # ([0-9]|[0-9][0-9]|1[1-9]|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 # # # JOURNALD_SERVER # 192.168.50.42 # Journald Remote Server # Host address of the journald log server for the target to send logs to. # HOSTNAME_IP_ADDRESS # # # JOURNALD_SERVER_KEY # /etc/ssl/private/journal-upload.pem # Journald Remote Server SSL Key # SSL Key for the journald log server for the target to send logs to. # UNIX_FILE_PATH # # # JOURNALD_SERVER_CERT # /etc/ssl/certs/journal-upload.pem # Journald Remote Server SSL Cert # SSL Cert for the journald log server for the target to send logs to. # UNIX_FILE_PATH # # # JOURNALD_TRUSTED_CERT # /etc/ssl/ca/trusted.pem # Journald Remote Trusted SSL Cert # Trusted SSL Cert for the journald log server for the target to send logs to. # UNIX_FILE_PATH # # # FIND_TIMEOUT # 7200 # Timeout for checks that search for files # Timeout, in seconds, for checks that search for files. Range of 1-7200. # INTEGER # # # PASSWORD_DCREDIT # -[1-9] # Password digits required # Password digits 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_OCREDIT # -[1-9] # Password symbols required # Password symbols value 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_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_LOCKOUT # [1-3] # Password Failed Login Attempts Lockout # Number of failed logon attempts before the account is locked found in faillock.conf # 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_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 # # # type : FILE_CONTENT_CHECK description : "Oracle Linux 8 is installed" file : "/etc/system-release" regex : "^[\\s]*Oracle Linux Server release" expect : "^[\\s]*Oracle Linux Server release @PLATFORM_VERSION@" description : "Safeguards Oracle Linux 8 v3.0.0" see_also : "https://workbench.cisecurity.org/benchmarks/15289" 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 disable the cramfs module: -IF- the module is available in the running 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 - Unload cramfs from the kernel -IF- available in ANY installed kernel: - Create a file ending inconf with blacklist cramfs in the /etc/modprobe.d/ directory -IF- the kernel module is not available on the system or pre-compiled into the kernel: - No remediation is necessary #!/usr/bin/env bash { l_mname=\"cramfs\" # set module name l_mtype=\"fs\" # set module type l_mpath=\"/lib/modules/**/kernel/$l_mtype\" l_mpname=\"$(tr '-' '_' <<< \"$l_mname\")\" l_mndir=\"$(tr '-' '/' <<< \"$l_mname\")\" module_loadable_fix() { # If the module is currently loadable, add \"install {MODULE_NAME} /bin/false\" to a file in \"/etc/modprobe.d\" l_loadable=\"$(modprobe -n -v \"$l_mname\")\" [ \"$(wc -l <<< \"$l_loadable\")\" -gt \"1\" ] && l_loadable=\"$(grep -P -- \"(^\h*install|\b$l_mname)\b\" <<< \"$l_loadable\")\" if ! grep -Pq -- '^\h*install \/bin\/(true|false)' <<< \"$l_loadable\"; then echo -e \"\n - setting module: \\\"$l_mname\\\" to be not loadable\" echo -e \"install $l_mname /bin/false\" >> /etc/modprobe.d/\"$l_mpname\".conf fi } module_loaded_fix() { # If the module is currently loaded, unload the module if lsmod | grep \"$l_mname\" > /dev/null 2>&1; then echo -e \"\n - unloading module \\\"$l_mname\\\"\" modprobe -r \"$l_mname\" fi } module_deny_fix() { # If the module isn't deny listed, denylist the module if ! modprobe --showconfig | grep -Pq -- \"^\h*blacklist\h+$l_mpname\b\"; then echo -e \"\n - deny listing \\\"$l_mname\\\"\" echo -e \"blacklist $l_mname\" >> /etc/modprobe.d/\"$l_mpname\".conf fi } # Check if the module exists on the system for l_mdir in $l_mpath; do if [ -d \"$l_mdir/$l_mndir\" ] && [ -n \"$(ls -A $l_mdir/$l_mndir)\" ]; then echo -e \"\n - module: \\\"$l_mname\\\" exists in \\\"$l_mdir\\\"\n - checking if disabled...\" module_deny_fix if [ \"$l_mdir\" = \"/lib/modules/$(uname -r)/kernel/$l_mtype\" ]; then module_loadable_fix module_loaded_fix fi else echo -e \"\n - module: \\\"$l_mname\\\" doesn't exist in \\\"$l_mdir\\\"\n\" fi done echo -e \"\n - remediation of module: \\\"$l_mname\\\" complete\n\" }" reference : "800-171|3.4.2,800-171|3.4.6,800-171|3.4.7,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),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/15289" cmd : "#!/bin/bash { l_output=\"\" l_output2=\"\" l_output3=\"\" l_dl=\"\" # Unset output variables l_mname=\"cramfs\" # set module name l_mtype=\"fs\" # set module type l_searchloc=\"/lib/modprobe.d/*.conf /usr/local/lib/modprobe.d/*.conf /run/modprobe.d/*.conf /etc/modprobe.d/*.conf\" l_mpath=\"/lib/modules/**/kernel/$l_mtype\" l_mpname=\"$(tr '-' '_' <<< \"$l_mname\")\" l_mndir=\"$(tr '-' '/' <<< \"$l_mname\")\" module_loadable_chk() { # Check if the module is currently loadable l_loadable=\"$(modprobe -n -v \"$l_mname\")\" [ \"$(wc -l <<< \"$l_loadable\")\" -gt \"1\" ] && l_loadable=\"$(grep -P -- \"(^\\h*install|\\b$l_mname)\\b\" <<< \"$l_loadable\")\" 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 } module_loaded_chk() { # Check if the module is 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 } module_deny_chk() { # Check if the module is deny listed l_dl=\"y\" if modprobe --showconfig | grep -Pq -- '^\\h*blacklist\\h+'\"$l_mpname\"'\\b'; then l_output=\"$l_output - module: \\\"$l_mname\\\" is deny listed in: \\\"$(grep -Pls -- \"^\\h*blacklist\\h+$l_mname\\b\" $l_searchloc)\\\"\" else l_output2=\"$l_output2 - module: \\\"$l_mname\\\" is not deny listed\" fi } # Check if the module exists on the system for l_mdir in $l_mpath; do if [ -d \"$l_mdir/$l_mndir\" ] && [ -n \"$(ls -A $l_mdir/$l_mndir)\" ]; then l_output3=\"$l_output3 - \\\"$l_mdir\\\"\" [ \"$l_dl\" != \"y\" ] && module_deny_chk if [ \"$l_mdir\" = \"/lib/modules/$(uname -r)/kernel/$l_mtype\" ]; then module_loadable_chk module_loaded_chk fi else l_output=\"$l_output - module: \\\"$l_mname\\\" doesn't exist in \\\"$l_mdir\\\"\" fi done # Report results. If no failures output in l_output2, we pass [ -n \"$l_output3\" ] && echo -e \" -- INFO -- - module: \\\"$l_mname\\\" exists in:$l_output3\" 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 : "(?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 disable the freevxfs module: -IF- the module is available in the running 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 - Unload freevxfs from the kernel -IF- available in ANY installed kernel: - Create a file ending inconf with blacklist freevxfs in the /etc/modprobe.d/ directory -IF- the kernel module is not available on the system or pre-compiled into the kernel: - No remediation is necessary #!/usr/bin/env bash { l_mname=\"freevxfs\" # set module name l_mtype=\"fs\" # set module type l_mpath=\"/lib/modules/**/kernel/$l_mtype\" l_mpname=\"$(tr '-' '_' <<< \"$l_mname\")\" l_mndir=\"$(tr '-' '/' <<< \"$l_mname\")\" module_loadable_fix() { # If the module is currently loadable, add \"install {MODULE_NAME} /bin/false\" to a file in \"/etc/modprobe.d\" l_loadable=\"$(modprobe -n -v \"$l_mname\")\" [ \"$(wc -l <<< \"$l_loadable\")\" -gt \"1\" ] && l_loadable=\"$(grep -P -- \"(^\h*install|\b$l_mname)\b\" <<< \"$l_loadable\")\" if ! grep -Pq -- '^\h*install \/bin\/(true|false)' <<< \"$l_loadable\"; then echo -e \"\n - setting module: \\\"$l_mname\\\" to be not loadable\" echo -e \"install $l_mname /bin/false\" >> /etc/modprobe.d/\"$l_mpname\".conf fi } module_loaded_fix() { # If the module is currently loaded, unload the module if lsmod | grep \"$l_mname\" > /dev/null 2>&1; then echo -e \"\n - unloading module \\\"$l_mname\\\"\" modprobe -r \"$l_mname\" fi } module_deny_fix() { # If the module isn't deny listed, denylist the module if ! modprobe --showconfig | grep -Pq -- \"^\h*blacklist\h+$l_mpname\b\"; then echo -e \"\n - deny listing \\\"$l_mname\\\"\" echo -e \"blacklist $l_mname\" >> /etc/modprobe.d/\"$l_mpname\".conf fi } # Check if the module exists on the system for l_mdir in $l_mpath; do if [ -d \"$l_mdir/$l_mndir\" ] && [ -n \"$(ls -A $l_mdir/$l_mndir)\" ]; then echo -e \"\n - module: \\\"$l_mname\\\" exists in \\\"$l_mdir\\\"\n - checking if disabled...\" module_deny_fix if [ \"$l_mdir\" = \"/lib/modules/$(uname -r)/kernel/$l_mtype\" ]; then module_loadable_fix module_loaded_fix fi else echo -e \"\n - module: \\\"$l_mname\\\" doesn't exist in \\\"$l_mdir\\\"\n\" fi done echo -e \"\n - remediation of module: \\\"$l_mname\\\" complete\n\" }" reference : "800-171|3.4.2,800-171|3.4.6,800-171|3.4.7,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),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/15289" cmd : "#!/bin/bash { l_output=\"\" l_output2=\"\" l_output3=\"\" l_dl=\"\" # Unset output variables l_mname=\"freevxfs\" # set module name l_mtype=\"fs\" # set module type l_searchloc=\"/lib/modprobe.d/*.conf /usr/local/lib/modprobe.d/*.conf /run/modprobe.d/*.conf /etc/modprobe.d/*.conf\" l_mpath=\"/lib/modules/**/kernel/$l_mtype\" l_mpname=\"$(tr '-' '_' <<< \"$l_mname\")\" l_mndir=\"$(tr '-' '/' <<< \"$l_mname\")\" module_loadable_chk() { # Check if the module is currently loadable l_loadable=\"$(modprobe -n -v \"$l_mname\")\" [ \"$(wc -l <<< \"$l_loadable\")\" -gt \"1\" ] && l_loadable=\"$(grep -P -- \"(^\\h*install|\\b$l_mname)\\b\" <<< \"$l_loadable\")\" 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 } module_loaded_chk() { # Check if the module is 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 } module_deny_chk() { # Check if the module is deny listed l_dl=\"y\" if modprobe --showconfig | grep -Pq -- '^\\h*blacklist\\h+'\"$l_mpname\"'\\b'; then l_output=\"$l_output - module: \\\"$l_mname\\\" is deny listed in: \\\"$(grep -Pls -- \"^\\h*blacklist\\h+$l_mname\\b\" $l_searchloc)\\\"\" else l_output2=\"$l_output2 - module: \\\"$l_mname\\\" is not deny listed\" fi } # Check if the module exists on the system for l_mdir in $l_mpath; do if [ -d \"$l_mdir/$l_mndir\" ] && [ -n \"$(ls -A $l_mdir/$l_mndir)\" ]; then l_output3=\"$l_output3 - \\\"$l_mdir\\\"\" [ \"$l_dl\" != \"y\" ] && module_deny_chk if [ \"$l_mdir\" = \"/lib/modules/$(uname -r)/kernel/$l_mtype\" ]; then module_loadable_chk module_loaded_chk fi else l_output=\"$l_output - module: \\\"$l_mname\\\" doesn't exist in \\\"$l_mdir\\\"\" fi done # Report results. If no failures output in l_output2, we pass [ -n \"$l_output3\" ] && echo -e \" -- INFO -- - module: \\\"$l_mname\\\" exists in:$l_output3\" 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 : "(?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 disable the hfs module: -IF- the module is available in the running 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 - Unload hfs from the kernel -IF- available in ANY installed kernel: - Create a file ending inconf with blacklist hfs in the /etc/modprobe.d/ directory -IF- the kernel module is not available on the system or pre-compiled into the kernel: - No remediation is necessary #!/usr/bin/env bash { l_mname=\"hfs\" # set module name l_mtype=\"fs\" # set module type l_mpath=\"/lib/modules/**/kernel/$l_mtype\" l_mpname=\"$(tr '-' '_' <<< \"$l_mname\")\" l_mndir=\"$(tr '-' '/' <<< \"$l_mname\")\" module_loadable_fix() { # If the module is currently loadable, add \"install {MODULE_NAME} /bin/false\" to a file in \"/etc/modprobe.d\" l_loadable=\"$(modprobe -n -v \"$l_mname\")\" [ \"$(wc -l <<< \"$l_loadable\")\" -gt \"1\" ] && l_loadable=\"$(grep -P -- \"(^\h*install|\b$l_mname)\b\" <<< \"$l_loadable\")\" if ! grep -Pq -- '^\h*install \/bin\/(true|false)' <<< \"$l_loadable\"; then echo -e \"\n - setting module: \\\"$l_mname\\\" to be not loadable\" echo -e \"install $l_mname /bin/false\" >> /etc/modprobe.d/\"$l_mpname\".conf fi } module_loaded_fix() { # If the module is currently loaded, unload the module if lsmod | grep \"$l_mname\" > /dev/null 2>&1; then echo -e \"\n - unloading module \\\"$l_mname\\\"\" modprobe -r \"$l_mname\" fi } module_deny_fix() { # If the module isn't deny listed, denylist the module if ! modprobe --showconfig | grep -Pq -- \"^\h*blacklist\h+$l_mpname\b\"; then echo -e \"\n - deny listing \\\"$l_mname\\\"\" echo -e \"blacklist $l_mname\" >> /etc/modprobe.d/\"$l_mpname\".conf fi } # Check if the module exists on the system for l_mdir in $l_mpath; do if [ -d \"$l_mdir/$l_mndir\" ] && [ -n \"$(ls -A $l_mdir/$l_mndir)\" ]; then echo -e \"\n - module: \\\"$l_mname\\\" exists in \\\"$l_mdir\\\"\n - checking if disabled...\" module_deny_fix if [ \"$l_mdir\" = \"/lib/modules/$(uname -r)/kernel/$l_mtype\" ]; then module_loadable_fix module_loaded_fix fi else echo -e \"\n - module: \\\"$l_mname\\\" doesn't exist in \\\"$l_mdir\\\"\n\" fi done echo -e \"\n - remediation of module: \\\"$l_mname\\\" complete\n\" }" reference : "800-171|3.4.2,800-171|3.4.6,800-171|3.4.7,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),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/15289" cmd : "#!/bin/bash { l_output=\"\" l_output2=\"\" l_output3=\"\" l_dl=\"\" # Unset output variables l_mname=\"hfs\" # set module name l_mtype=\"fs\" # set module type l_searchloc=\"/lib/modprobe.d/*.conf /usr/local/lib/modprobe.d/*.conf /run/modprobe.d/*.conf /etc/modprobe.d/*.conf\" l_mpath=\"/lib/modules/**/kernel/$l_mtype\" l_mpname=\"$(tr '-' '_' <<< \"$l_mname\")\" l_mndir=\"$(tr '-' '/' <<< \"$l_mname\")\" module_loadable_chk() { # Check if the module is currently loadable l_loadable=\"$(modprobe -n -v \"$l_mname\")\" [ \"$(wc -l <<< \"$l_loadable\")\" -gt \"1\" ] && l_loadable=\"$(grep -P -- \"(^\\h*install|\\b$l_mname)\\b\" <<< \"$l_loadable\")\" if grep -Pq -- '^\\h*install \\/bin\\/(true|false)' <<< \"$l_loadable\"; then l_output=\"$l_output\\n - module: \\\"$l_mname\\\" is not loadable: \\\"$l_loadable\\\"\" else l_output2=\"$l_output2\\n - module: \\\"$l_mname\\\" is loadable: \\\"$l_loadable\\\"\" fi } module_loaded_chk() { # Check if the module is currently loaded if ! lsmod | grep \"$l_mname\" > /dev/null 2>&1; then l_output=\"$l_output\\n - module: \\\"$l_mname\\\" is not loaded\" else l_output2=\"$l_output2\\n - module: \\\"$l_mname\\\" is loaded\" fi } module_deny_chk() { # Check if the module is deny listed l_dl=\"y\" if modprobe --showconfig | grep -Pq -- '^\\h*blacklist\\h+'\"$l_mpname\"'\\b'; then l_output=\"$l_output\\n - module: \\\"$l_mname\\\" is deny listed in: \\\"$(grep -Pls -- \"^\\h*blacklist\\h+$l_mname\\b\" $l_searchloc)\\\"\" else l_output2=\"$l_output2\\n - module: \\\"$l_mname\\\" is not deny listed\" fi } # Check if the module exists on the system for l_mdir in $l_mpath; do if [ -d \"$l_mdir/$l_mndir\" ] && [ -n \"$(ls -A $l_mdir/$l_mndir)\" ]; then l_output3=\"$l_output3\\n - \\\"$l_mdir\\\"\" [ \"$l_dl\" != \"y\" ] && module_deny_chk if [ \"$l_mdir\" = \"/lib/modules/$(uname -r)/kernel/$l_mtype\" ]; then module_loadable_chk module_loaded_chk fi else l_output=\"$l_output\\n - module: \\\"$l_mname\\\" doesn't exist in \\\"$l_mdir\\\"\" fi done # Report results. If no failures output in l_output2, we pass [ -n \"$l_output3\" ] && echo -e \"\\n\\n -- INFO --\\n - module: \\\"$l_mname\\\" exists in:$l_output3\" 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.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 disable the hfsplus module: -IF- the module is available in the running 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 - Unload hfsplus from the kernel -IF- available in ANY installed kernel: - Create a file ending inconf with blacklist hfsplus in the /etc/modprobe.d/ directory -IF- the kernel module is not available on the system or pre-compiled into the kernel: - No remediation is necessary #!/usr/bin/env bash { l_mname=\"hfsplus\" # set module name l_mtype=\"fs\" # set module type l_mpath=\"/lib/modules/**/kernel/$l_mtype\" l_mpname=\"$(tr '-' '_' <<< \"$l_mname\")\" l_mndir=\"$(tr '-' '/' <<< \"$l_mname\")\" module_loadable_fix() { # If the module is currently loadable, add \"install {MODULE_NAME} /bin/false\" to a file in \"/etc/modprobe.d\" l_loadable=\"$(modprobe -n -v \"$l_mname\")\" [ \"$(wc -l <<< \"$l_loadable\")\" -gt \"1\" ] && l_loadable=\"$(grep -P -- \"(^\h*install|\b$l_mname)\b\" <<< \"$l_loadable\")\" if ! grep -Pq -- '^\h*install \/bin\/(true|false)' <<< \"$l_loadable\"; then echo -e \"\n - setting module: \\\"$l_mname\\\" to be not loadable\" echo -e \"install $l_mname /bin/false\" >> /etc/modprobe.d/\"$l_mpname\".conf fi } module_loaded_fix() { # If the module is currently loaded, unload the module if lsmod | grep \"$l_mname\" > /dev/null 2>&1; then echo -e \"\n - unloading module \\\"$l_mname\\\"\" modprobe -r \"$l_mname\" fi } module_deny_fix() { # If the module isn't deny listed, denylist the module if ! modprobe --showconfig | grep -Pq -- \"^\h*blacklist\h+$l_mpname\b\"; then echo -e \"\n - deny listing \\\"$l_mname\\\"\" echo -e \"blacklist $l_mname\" >> /etc/modprobe.d/\"$l_mpname\".conf fi } # Check if the module exists on the system for l_mdir in $l_mpath; do if [ -d \"$l_mdir/$l_mndir\" ] && [ -n \"$(ls -A $l_mdir/$l_mndir)\" ]; then echo -e \"\n - module: \\\"$l_mname\\\" exists in \\\"$l_mdir\\\"\n - checking if disabled...\" module_deny_fix if [ \"$l_mdir\" = \"/lib/modules/$(uname -r)/kernel/$l_mtype\" ]; then module_loadable_fix module_loaded_fix fi else echo -e \"\n - module: \\\"$l_mname\\\" doesn't exist in \\\"$l_mdir\\\"\n\" fi done echo -e \"\n - remediation of module: \\\"$l_mname\\\" complete\n\" }" reference : "800-171|3.4.2,800-171|3.4.6,800-171|3.4.7,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),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/15289" cmd : "#!/bin/bash { l_output=\"\" l_output2=\"\" l_output3=\"\" l_dl=\"\" # Unset output variables l_mname=\"hfsplus\" # set module name l_mtype=\"fs\" # set module type l_searchloc=\"/lib/modprobe.d/*.conf /usr/local/lib/modprobe.d/*.conf /run/modprobe.d/*.conf /etc/modprobe.d/*.conf\" l_mpath=\"/lib/modules/**/kernel/$l_mtype\" l_mpname=\"$(tr '-' '_' <<< \"$l_mname\")\" l_mndir=\"$(tr '-' '/' <<< \"$l_mname\")\" module_loadable_chk() { # Check if the module is currently loadable l_loadable=\"$(modprobe -n -v \"$l_mname\")\" [ \"$(wc -l <<< \"$l_loadable\")\" -gt \"1\" ] && l_loadable=\"$(grep -P -- \"(^\\h*install|\\b$l_mname)\\b\" <<< \"$l_loadable\")\" if grep -Pq -- '^\\h*install \\/bin\\/(true|false)' <<< \"$l_loadable\"; then l_output=\"$l_output\\n - module: \\\"$l_mname\\\" is not loadable: \\\"$l_loadable\\\"\" else l_output2=\"$l_output2\\n - module: \\\"$l_mname\\\" is loadable: \\\"$l_loadable\\\"\" fi } module_loaded_chk() { # Check if the module is currently loaded if ! lsmod | grep \"$l_mname\" > /dev/null 2>&1; then l_output=\"$l_output\\n - module: \\\"$l_mname\\\" is not loaded\" else l_output2=\"$l_output2\\n - module: \\\"$l_mname\\\" is loaded\" fi } module_deny_chk() { # Check if the module is deny listed l_dl=\"y\" if modprobe --showconfig | grep -Pq -- '^\\h*blacklist\\h+'\"$l_mpname\"'\\b'; then l_output=\"$l_output\\n - module: \\\"$l_mname\\\" is deny listed in: \\\"$(grep -Pls -- \"^\\h*blacklist\\h+$l_mname\\b\" $l_searchloc)\\\"\" else l_output2=\"$l_output2\\n - module: \\\"$l_mname\\\" is not deny listed\" fi } # Check if the module exists on the system for l_mdir in $l_mpath; do if [ -d \"$l_mdir/$l_mndir\" ] && [ -n \"$(ls -A $l_mdir/$l_mndir)\" ]; then l_output3=\"$l_output3\\n - \\\"$l_mdir\\\"\" [ \"$l_dl\" != \"y\" ] && module_deny_chk if [ \"$l_mdir\" = \"/lib/modules/$(uname -r)/kernel/$l_mtype\" ]; then module_loadable_chk module_loaded_chk fi else l_output=\"$l_output\\n - module: \\\"$l_mname\\\" doesn't exist in \\\"$l_mdir\\\"\" fi done # Report results. If no failures output in l_output2, we pass [ -n \"$l_output3\" ] && echo -e \"\\n\\n -- INFO --\\n - module: \\\"$l_mname\\\" exists in:$l_output3\" 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.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 disable the jffs2 module: -IF- the module is available in the running 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 - Unload jffs2 from the kernel -IF- available in ANY installed kernel: - Create a file ending inconf with blacklist jffs2 in the /etc/modprobe.d/ directory -IF- the kernel module is not available on the system or pre-compiled into the kernel: - No remediation is necessary #!/usr/bin/env bash { l_mname=\"jffs2\" # set module name l_mtype=\"fs\" # set module type l_mpath=\"/lib/modules/**/kernel/$l_mtype\" l_mpname=\"$(tr '-' '_' <<< \"$l_mname\")\" l_mndir=\"$(tr '-' '/' <<< \"$l_mname\")\" module_loadable_fix() { # If the module is currently loadable, add \"install {MODULE_NAME} /bin/false\" to a file in \"/etc/modprobe.d\" l_loadable=\"$(modprobe -n -v \"$l_mname\")\" [ \"$(wc -l <<< \"$l_loadable\")\" -gt \"1\" ] && l_loadable=\"$(grep -P -- \"(^\h*install|\b$l_mname)\b\" <<< \"$l_loadable\")\" if ! grep -Pq -- '^\h*install \/bin\/(true|false)' <<< \"$l_loadable\"; then echo -e \"\n - setting module: \\\"$l_mname\\\" to be not loadable\" echo -e \"install $l_mname /bin/false\" >> /etc/modprobe.d/\"$l_mpname\".conf fi } module_loaded_fix() { # If the module is currently loaded, unload the module if lsmod | grep \"$l_mname\" > /dev/null 2>&1; then echo -e \"\n - unloading module \\\"$l_mname\\\"\" modprobe -r \"$l_mname\" fi } module_deny_fix() { # If the module isn't deny listed, denylist the module if ! modprobe --showconfig | grep -Pq -- \"^\h*blacklist\h+$l_mpname\b\"; then echo -e \"\n - deny listing \\\"$l_mname\\\"\" echo -e \"blacklist $l_mname\" >> /etc/modprobe.d/\"$l_mpname\".conf fi } # Check if the module exists on the system for l_mdir in $l_mpath; do if [ -d \"$l_mdir/$l_mndir\" ] && [ -n \"$(ls -A $l_mdir/$l_mndir)\" ]; then echo -e \"\n - module: \\\"$l_mname\\\" exists in \\\"$l_mdir\\\"\n - checking if disabled...\" module_deny_fix if [ \"$l_mdir\" = \"/lib/modules/$(uname -r)/kernel/$l_mtype\" ]; then module_loadable_fix module_loaded_fix fi else echo -e \"\n - module: \\\"$l_mname\\\" doesn't exist in \\\"$l_mdir\\\"\n\" fi done echo -e \"\n - remediation of module: \\\"$l_mname\\\" complete\n\" }" reference : "800-171|3.4.2,800-171|3.4.6,800-171|3.4.7,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),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/15289" cmd : "#!/bin/bash { l_output=\"\" l_output2=\"\" l_output3=\"\" l_dl=\"\" # Unset output variables l_mname=\"jffs2\" # set module name l_mtype=\"fs\" # set module type l_searchloc=\"/lib/modprobe.d/*.conf /usr/local/lib/modprobe.d/*.conf /run/modprobe.d/*.conf /etc/modprobe.d/*.conf\" l_mpath=\"/lib/modules/**/kernel/$l_mtype\" l_mpname=\"$(tr '-' '_' <<< \"$l_mname\")\" l_mndir=\"$(tr '-' '/' <<< \"$l_mname\")\" module_loadable_chk() { # Check if the module is currently loadable l_loadable=\"$(modprobe -n -v \"$l_mname\")\" [ \"$(wc -l <<< \"$l_loadable\")\" -gt \"1\" ] && l_loadable=\"$(grep -P -- \"(^\\h*install|\\b$l_mname)\\b\" <<< \"$l_loadable\")\" if grep -Pq -- '^\\h*install \\/bin\\/(true|false)' <<< \"$l_loadable\"; then l_output=\"$l_output\\n - module: \\\"$l_mname\\\" is not loadable: \\\"$l_loadable\\\"\" else l_output2=\"$l_output2\\n - module: \\\"$l_mname\\\" is loadable: \\\"$l_loadable\\\"\" fi } module_loaded_chk() { # Check if the module is currently loaded if ! lsmod | grep \"$l_mname\" > /dev/null 2>&1; then l_output=\"$l_output\\n - module: \\\"$l_mname\\\" is not loaded\" else l_output2=\"$l_output2\\n - module: \\\"$l_mname\\\" is loaded\" fi } module_deny_chk() { # Check if the module is deny listed l_dl=\"y\" if modprobe --showconfig | grep -Pq -- '^\\h*blacklist\\h+'\"$l_mpname\"'\\b'; then l_output=\"$l_output\\n - module: \\\"$l_mname\\\" is deny listed in: \\\"$(grep -Pls -- \"^\\h*blacklist\\h+$l_mname\\b\" $l_searchloc)\\\"\" else l_output2=\"$l_output2\\n - module: \\\"$l_mname\\\" is not deny listed\" fi } # Check if the module exists on the system for l_mdir in $l_mpath; do if [ -d \"$l_mdir/$l_mndir\" ] && [ -n \"$(ls -A $l_mdir/$l_mndir)\" ]; then l_output3=\"$l_output3\\n - \\\"$l_mdir\\\"\" [ \"$l_dl\" != \"y\" ] && module_deny_chk if [ \"$l_mdir\" = \"/lib/modules/$(uname -r)/kernel/$l_mtype\" ]; then module_loadable_chk module_loaded_chk fi else l_output=\"$l_output\\n - module: \\\"$l_mname\\\" doesn't exist in \\\"$l_mdir\\\"\" fi done # Report results. If no failures output in l_output2, we pass [ -n \"$l_output3\" ] && echo -e \"\\n\\n -- INFO --\\n - module: \\\"$l_mname\\\" exists in:$l_output3\" 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.1.1.8 Ensure usb-storage kernel module is not available" info : "USB storage provides a means to transfer and store files ensuring persistence and availability of the files independent of network connection status. Its popularity and utility has led to USB-based malware being a simple and common means for network infiltration and a first step to establishing a persistent threat within a networked environment. Restricting USB access on the system will decrease the physical attack surface for a device and diminish the possible vectors to introduce malware." solution : "Run the following script to disable the usb-storage module: -IF- the module is available in the running kernel: - Create a file ending inconf with install usb-storage /bin/false in the /etc/modprobe.d/ directory - Create a file ending inconf with blacklist usb-storage in the /etc/modprobe.d/ directory - Unload usb-storage from the kernel -IF- available in ANY installed kernel: - Create a file ending inconf with blacklist usb-storage in the /etc/modprobe.d/ directory -IF- the kernel module is not available on the system or pre-compiled into the kernel: - No remediation is necessary #!/usr/bin/env bash { l_mname=\"usb-storage\" # set module name l_mtype=\"drivers\" # set module type l_mpath=\"/lib/modules/**/kernel/$l_mtype\" l_mpname=\"$(tr '-' '_' <<< \"$l_mname\")\" l_mndir=\"$(tr '-' '/' <<< \"$l_mname\")\" module_loadable_fix() { # If the module is currently loadable, add \"install {MODULE_NAME} /bin/false\" to a file in \"/etc/modprobe.d\" l_loadable=\"$(modprobe -n -v \"$l_mname\")\" [ \"$(wc -l <<< \"$l_loadable\")\" -gt \"1\" ] && l_loadable=\"$(grep -P -- \"(^\h*install|\b$l_mname)\b\" <<< \"$l_loadable\")\" if ! grep -Pq -- '^\h*install \/bin\/(true|false)' <<< \"$l_loadable\"; then echo -e \"\n - setting module: \\\"$l_mname\\\" to be not loadable\" echo -e \"install $l_mname /bin/false\" >> /etc/modprobe.d/\"$l_mpname\".conf fi } module_loaded_fix() { # If the module is currently loaded, unload the module if lsmod | grep \"$l_mname\" > /dev/null 2>&1; then echo -e \"\n - unloading module \\\"$l_mname\\\"\" modprobe -r \"$l_mname\" fi } module_deny_fix() { # If the module isn't deny listed, denylist the module if ! modprobe --showconfig | grep -Pq -- \"^\h*blacklist\h+$l_mpname\b\"; then echo -e \"\n - deny listing \\\"$l_mname\\\"\" echo -e \"blacklist $l_mname\" >> /etc/modprobe.d/\"$l_mpname\".conf fi } # Check if the module exists on the system for l_mdir in $l_mpath; do if [ -d \"$l_mdir/$l_mndir\" ] && [ -n \"$(ls -A $l_mdir/$l_mndir)\" ]; then echo -e \"\n - module: \\\"$l_mname\\\" exists in \\\"$l_mdir\\\"\n - checking if disabled...\" module_deny_fix if [ \"$l_mdir\" = \"/lib/modules/$(uname -r)/kernel/$l_mtype\" ]; then module_loadable_fix module_loaded_fix fi else echo -e \"\n - module: \\\"$l_mname\\\" doesn't exist in \\\"$l_mdir\\\"\n\" fi done echo -e \"\n - remediation of module: \\\"$l_mname\\\" complete\n\" } Impact: Disabling the usb-storage module will disable any usage of USB storage devices. If requirements and local site policy allow the use of such devices, other solutions should be configured accordingly instead. One example of a commonly used solution is USBGuard" reference : "800-171|3.8.7,800-53|MP-7,800-53r5|MP-7,CN-L3|8.5.4.1(c),CSCv7|13.7,CSCv8|10.3,CSF|PR.PT-2,GDPR|32.1.b,HIPAA|164.306(a)(1),HIPAA|164.312(a)(1),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/15289" cmd : "#!/bin/bash { l_output=\"\" l_output2=\"\" l_output3=\"\" l_dl=\"\" # Unset output variables l_mname=\"usb-storage\" # set module name l_mtype=\"drivers\" # set module type l_searchloc=\"/lib/modprobe.d/*.conf /usr/local/lib/modprobe.d/*.conf /run/modprobe.d/*.conf /etc/modprobe.d/*.conf\" l_mpath=\"/lib/modules/**/kernel/$l_mtype\" l_mpname=\"$(tr '-' '_' <<< \"$l_mname\")\" l_mndir=\"$(tr '-' '/' <<< \"$l_mname\")\" module_loadable_chk() { # Check if the module is currently loadable l_loadable=\"$(modprobe -n -v \"$l_mname\")\" [ \"$(wc -l <<< \"$l_loadable\")\" -gt \"1\" ] && l_loadable=\"$(grep -P -- \"(^\\h*install|\\b$l_mname)\\b\" <<< \"$l_loadable\")\" if grep -Pq -- '^\\h*install \\/bin\\/(true|false)' <<< \"$l_loadable\"; then l_output=\"$l_output\\n - module: \\\"$l_mname\\\" is not loadable: \\\"$l_loadable\\\"\" else l_output2=\"$l_output2\\n - module: \\\"$l_mname\\\" is loadable: \\\"$l_loadable\\\"\" fi } module_loaded_chk() { # Check if the module is currently loaded if ! lsmod | grep \"$l_mname\" > /dev/null 2>&1; then l_output=\"$l_output\\n - module: \\\"$l_mname\\\" is not loaded\" else l_output2=\"$l_output2\\n - module: \\\"$l_mname\\\" is loaded\" fi } module_deny_chk() { # Check if the module is deny listed l_dl=\"y\" if modprobe --showconfig | grep -Pq -- '^\\h*blacklist\\h+'\"$l_mpname\"'\\b'; then l_output=\"$l_output\\n - module: \\\"$l_mname\\\" is deny listed in: \\\"$(grep -Pls -- \"^\\h*blacklist\\h+$l_mname\\b\" $l_searchloc)\\\"\" else l_output2=\"$l_output2\\n - module: \\\"$l_mname\\\" is not deny listed\" fi } # Check if the module exists on the system for l_mdir in $l_mpath; do if [ -d \"$l_mdir/$l_mndir\" ] && [ -n \"$(ls -A $l_mdir/$l_mndir)\" ]; then l_output3=\"$l_output3\\n - \\\"$l_mdir\\\"\" [ \"$l_dl\" != \"y\" ] && module_deny_chk if [ \"$l_mdir\" = \"/lib/modules/$(uname -r)/kernel/$l_mtype\" ]; then module_loadable_chk module_loaded_chk fi else l_output=\"$l_output\\n - module: \\\"$l_mname\\\" doesn't exist in \\\"$l_mdir\\\"\" fi done # Report results. If no failures output in l_output2, we pass [ -n \"$l_output3\" ] && echo -e \"\\n\\n -- INFO --\\n - module: \\\"$l_mname\\\" exists in:$l_output3\" 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.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. -IF- an entry for /tmp exists in /etc/fstab it will take precedence over entries in systemd default unit file. Note: In an environment where the main system is diskless and connected to iSCSI, entries in /etc/fstab may not take precedence. /tmp can be configured to use tmpfs tmpfs puts everything into the kernel internal caches and grows and shrinks to accommodate the files it contains and is able to swap unneeded pages out to swap space. It has maximum size limits which can be adjusted on the fly via mount -o remount Since tmpfs lives completely in the page cache and on swap, all tmpfs pages will be shown as \"Shmem\" in /proc/meminfo and \"Shared\" in free Notice that these counters also include shared memory. The most reliable way to get the count is using df and du tmpfs has three mount options for sizing: - size : The limit of allocated bytes for this tmpfs instance. The default is half of your physical RAM without swap. If you oversize your tmpfs instances the machine will deadlock since the OOM handler will not be able to free that memory. - nr_blocks : The same as size, but in blocks of PAGE_SIZE. - nr_inodes : The maximum number of inodes for this instance. The default is half of the number of your physical RAM pages, or (on a machine with highmem) the number of lowmem RAM pages, whichever is the lower. These parameters accept a suffix k, m or g and can be changed on remount. The size parameter also accepts a suffix %to limit this tmpfs instance to that percentage of your physical RAM. The default, when neither size nor nr_blocks is specified, is size=50% 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.4.2,800-171|3.4.6,800-171|3.4.7,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),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/15289" 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-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),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/15289" 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-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/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/15289" 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-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/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/15289" 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-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),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/15289" 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-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/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/15289" 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-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/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/15289" 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-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/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/15289" 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,noexec,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-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/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/15289" 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,noexec,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-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/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/15289" 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,noexec,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-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/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/15289" 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,noexec,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-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/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/15289" 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-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/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/15289" 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-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/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/15289" 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-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/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/15289" 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-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/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/15289" 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-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/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/15289" 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-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/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/15289" 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-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/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/15289" 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-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/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/15289" 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-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/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/15289" file : "/proc/self/mountinfo" regex : "[\\s]+/var/log/audit[\\s]+" expect : "noexec" required : NO type : CMD_EXEC description : "1.2.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-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/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/15289" cmd : "rpm -q gpg-pubkey --queryformat '%{name}-%{version}-%{release} --> %{summary}\\n'" expect : "^Manual Review Required$" severity : MEDIUM type : FILE_CONTENT_CHECK description : "Global configuration is set correctly" file : "/etc/dnf/dnf.conf" regex : "^[\\s]*gpgcheck[\\s]*=" expect : "^[\\s]*gpgcheck[\\s]*=[\\s]*1[\\s]*$" type : FILE_CONTENT_CHECK_NOT description : "yum.repos.d configuration is set correctly" file : "/etc/yum.repos.d/*" regex : "^[\\s]*gpgcheck[\\s]*=" expect : "^[\\s]*gpgcheck[\\s]*=[\\s]*(0|[2-9]|[1-9][0-9]+|[a-zA-Z_]+)\\b" description : "1.2.2 Ensure gpgcheck is globally activated" info : "The gpgcheck option, found in the main section of the /etc/dnf/dnf.conf and individual /etc/yum.repos.d/* 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/dnf/dnf.conf and set gpgcheck=1 in the [main] section. Example: # sed -i 's/^gpgcheck\s*=\s*.*/gpgcheck=1/' /etc/dnf/dnf.conf Edit any failing files in /etc/yum.repos.d/* and set all instances starting with gpgcheck to 1 Example: # find /etc/yum.repos.d/ -name \"*.repo\" -exec echo \"Checking:\" {} \; -exec sed -i 's/^gpgcheck\s*=\s*.*/gpgcheck=1/' {} \;" reference : "800-171|3.11.2,800-171|3.11.3,800-171|3.14.1,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/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/15289" show_output : YES type : CMD_EXEC description : "1.2.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-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/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/15289" cmd : "/bin/dnf repolist" expect : "^Manual Review Required$" severity : MEDIUM type : CMD_EXEC description : "Check to make sure no system reboot is required" cmd : "/bin/dnf needs-restarting -r" expect : "Reboot should not be necessary." type : CMD_EXEC description : "Ensure updates, patches, and additional security software are installed" cmd : "/bin/dnf check-update | /bin/awk '{print} END {if (NR == 1) print \"pass\"; else print}'" expect : "(?i)^[\\s]*\\**[\\s]*pass:?[\\s]*\\**$" description : "1.2.5 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: # dnf update Once the update process is complete, verify if reboot is required to load changes. dnf needs-restarting -r" reference : "800-171|3.11.2,800-171|3.11.3,800-171|3.14.1,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,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/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/15289" show_output : YES type : CMD_EXEC description : "1.3.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 SELinux at boot time)." solution : "Create an encrypted password with grub2-setpassword : # grub2-setpassword Enter password: Confirm password: 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-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/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/15289" cmd : "#/bin/bash { l_grub_password_file=\"$(find /boot -type f -name 'user.cfg' ! -empty)\" if [ -f \"$l_grub_password_file\" ]; then awk -F. '/^\\s*GRUB2_PASSWORD=\\S+/ {print $1\".\"$2\".\"$3}' \"$l_grub_password_file\" fi }" expect : "GRUB2_PASSWORD=grub.pbkdf2.sha512" timeout : "@FIND_TIMEOUT@" type : CMD_EXEC description : "1.3.2 Ensure permissions on bootloader config are configured" info : "The grub files contain information on boot settings and passwords for unlocking boot options. 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 to update the mode, ownership, and group ownership of the grub configuration files: -IF- the system uses UEFI (Files located in /boot/efi/EFI/* ) Edit /etc/fstab and add the fmask=0077 uid=0 and gid=0 options: Example: /boot/efi vfat defaults,umask=0027,fmask=0077,uid=0,gid=0 0 0 Note: This may require a re-boot to enable the change -OR- -IF- the system uses BIOS (Files located in /boot/grub2/* ) Run the following commands to set ownership and permissions on your grub configuration file(s): # [ -f /boot/grub2/grub.cfg ] && chown root:root /boot/grub2/grub.cfg # [ -f /boot/grub2/grub.cfg ] && chmod u-x,go-rwx /boot/grub2/grub.cfg # [ -f /boot/grub2/grubenv ] && chown root:root /boot/grub2/grubenv # [ -f /boot/grub2/grubenv ] && chmod u-x,go-rwx /boot/grub2/grubenv # [ -f /boot/grub2/user.cfg ] && chown root:root /boot/grub2/user.cfg # [ -f /boot/grub2/user.cfg ] && chmod u-x,go-rwx /boot/grub2/user.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-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/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/15289" cmd : "#!/bin/bash { l_output=\"\" l_output2=\"\" file_mug_chk() { l_out=\"\" l_out2=\"\" [[ \"$(dirname \"$l_file\")\" =~ ^\\/boot\\/efi\\/EFI ]] && l_pmask=\"0077\" || l_pmask=\"0177\" l_maxperm=\"$( printf '%o' $(( 0777 & ~$l_pmask )) )\" if [ $(( $l_mode & $l_pmask )) -gt 0 ]; then l_out2=\"$l_out2\\n - Is mode \\\"$l_mode\\\" and should be mode: \\\"$l_maxperm\\\" or more restrictive\" else l_out=\"$l_out\\n - Is correctly mode: \\\"$l_mode\\\" which is mode: \\\"$l_maxperm\\\" or more restrictive\" fi if [ \"$l_user\" = \"root\" ]; then l_out=\"$l_out\\n - Is correctly owned by user: \\\"$l_user\\\"\" else l_out2=\"$l_out2\\n - Is owned by user: \\\"$l_user\\\" and should be owned by user: \\\"root\\\"\" fi if [ \"$l_group\" = \"root\" ]; then l_out=\"$l_out\\n - Is correctly group-owned by group: \\\"$l_user\\\"\" else l_out2=\"$l_out2\\n - Is group-owned by group: \\\"$l_user\\\" and should be group-owned by group: \\\"root\\\"\" fi [ -n \"$l_out\" ] && l_output=\"$l_output\\n - File: \\\"$l_file\\\"$l_out\\n\" [ -n \"$l_out2\" ] && l_output2=\"$l_output2\\n - File: \\\"$l_file\\\"$l_out2\\n\" } while IFS= read -r -d $'\\0' l_gfile; do while read -r l_file l_mode l_user l_group; do file_mug_chk done <<< \"$(stat -Lc '%n %#a %U %G' \"$l_gfile\")\" done < <(find /boot -type f \\( -name 'grub*' -o -name 'user.cfg' \\) -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]*\\**$" timeout : "@FIND_TIMEOUT@" type : CMD_EXEC description : "1.4.1 Ensure address space layout randomization (ASLR) 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 \" 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/15289" cmd : "#!/bin/bash { l_output=\"\" l_output2=\"\" a_parlist=(\"kernel.randomize_va_space=2\") l_ufwscf=\"$([ -f /etc/default/ufw ] && awk -F= '/^\\s*IPT_SYSCTL=/ {print $2}' /etc/default/ufw)\" kernel_parameter_chk() { l_krp=\"$(sysctl \"$l_kpname\" | awk -F= '{print $2}' | xargs)\" # Check running configuration if [ \"$l_krp\" = \"$l_kpvalue\" ]; then l_output=\"$l_output\\n - \\\"$l_kpname\\\" is correctly set to \\\"$l_krp\\\" in the running configuration\" else l_output2=\"$l_output2\\n - \\\"$l_kpname\\\" is incorrectly set to \\\"$l_krp\\\" in the running configuration and should have a value of: \\\"$l_kpvalue\\\"\" 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_kpname\" ] && A_out+=([\"$l_kpar\"]=\"$l_file\") fi fi done < <(/usr/lib/systemd/systemd-sysctl --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_kpname\\b\" \"$l_ufwscf\" | xargs)\" l_kpar=\"${l_kpar//\\//.}\" [ \"$l_kpar\" = \"$l_kpname\" ] && 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_fkpvalue; do l_fkpname=\"${l_fkpname// /}\"; l_fkpvalue=\"${l_fkpvalue// /}\" if [ \"$l_fkpvalue\" = \"$l_kpvalue\" ]; then l_output=\"$l_output\\n - \\\"$l_kpname\\\" is correctly set to \\\"$l_krp\\\" in \\\"$(printf '%s' \"${A_out[@]}\")\\\"\\n\" else l_output2=\"$l_output2\\n - \\\"$l_kpname\\\" is incorrectly set to \\\"$l_fkpvalue\\\" in \\\"$(printf '%s' \"${A_out[@]}\")\\\" and should have a value of: \\\"$l_kpvalue\\\"\\n\" fi done < <(grep -Po -- \"^\\h*$l_kpname\\h*=\\h*\\H+\" \"${A_out[@]}\") else l_output2=\"$l_output2\\n - \\\"$l_kpname\\\" is not set in an included file\\n ** Note: \\\"$l_kpname\\\" May be set in a file that's ignored by load procedure **\\n\" fi } while IFS=\"=\" read -r l_kpname l_kpvalue; do # Assess and check parameters l_kpname=\"${l_kpname// /}\"; l_kpvalue=\"${l_kpvalue// /}\" if ! grep -Pqs '^\\h*0\\b' /sys/module/ipv6/parameters/disable && grep -q '^net.ipv6.' <<< \"$l_kpname\"; then l_output=\"$l_output\\n - IPv6 is disabled on the system, \\\"$l_kpname\\\" is not applicable\" else kernel_parameter_chk fi 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\" [ -n \"$l_output\" ] && echo -e \"\\n- Correctly set:\\n$l_output\\n\" fi }" expect : "(?i)^[\\s]*\\**[\\s]*pass:?[\\s]*\\**$" type : CMD_EXEC description : "1.4.2 Ensure ptrace_scope is restricted" info : "The ptrace() system call provides a means by which one process (the \"tracer\") may observe and control the execution of another process (the \"tracee\"), and examine and change the tracee's memory and registers. If one application is compromised, it would be possible for an attacker to attach to other running processes (e.g. Bash, Firefox, SSH sessions, GPG agent, etc) to extract additional credentials and continue to expand the scope of their attack. Enabling restricted mode will limit the ability of a compromised process to PTRACE_ATTACH on other processes running under the same user. With restricted mode, ptrace will continue to work with root user." solution : "Set the following parameter in /etc/sysctl.conf or a file in /etc/sysctl.d/ ending inconf : - kernel.yama.ptrace_scope = 1 Example: # printf \" kernel.yama.ptrace_scope = 1 \" >> /etc/sysctl.d/60-kernel_sysctl.conf Run the following command to set the active kernel parameter: # sysctl -w kernel.yama.ptrace_scope=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-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),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/15289" cmd : "#!/bin/bash { l_output=\"\" l_output2=\"\" a_parlist=(\"kernel.yama.ptrace_scope=1\") l_ufwscf=\"$([ -f /etc/default/ufw ] && awk -F= '/^\\s*IPT_SYSCTL=/ {print $2}' /etc/default/ufw)\" kernel_parameter_chk() { l_krp=\"$(sysctl \"$l_kpname\" | awk -F= '{print $2}' | xargs)\" # Check running configuration if [ \"$l_krp\" = \"$l_kpvalue\" ]; then l_output=\"$l_output\\n - \\\"$l_kpname\\\" is correctly set to \\\"$l_krp\\\" in the running configuration\" else l_output2=\"$l_output2\\n - \\\"$l_kpname\\\" is incorrectly set to \\\"$l_krp\\\" in the running configuration and should have a value of: \\\"$l_kpvalue\\\"\" 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_kpname\" ] && A_out+=([\"$l_kpar\"]=\"$l_file\") fi fi done < <(/usr/lib/systemd/systemd-sysctl --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_kpname\\b\" \"$l_ufwscf\" | xargs)\" l_kpar=\"${l_kpar//\\//.}\" [ \"$l_kpar\" = \"$l_kpname\" ] && 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_fkpvalue; do l_fkpname=\"${l_fkpname// /}\"; l_fkpvalue=\"${l_fkpvalue// /}\" if [ \"$l_fkpvalue\" = \"$l_kpvalue\" ]; then l_output=\"$l_output\\n - \\\"$l_kpname\\\" is correctly set to \\\"$l_krp\\\" in \\\"$(printf '%s' \"${A_out[@]}\")\\\"\\n\" else l_output2=\"$l_output2\\n - \\\"$l_kpname\\\" is incorrectly set to \\\"$l_fkpvalue\\\" in \\\"$(printf '%s' \"${A_out[@]}\")\\\" and should have a value of: \\\"$l_kpvalue\\\"\\n\" fi done < <(grep -Po -- \"^\\h*$l_kpname\\h*=\\h*\\H+\" \"${A_out[@]}\") else l_output2=\"$l_output2\\n - \\\"$l_kpname\\\" is not set in an included file\\n ** Note: \\\"$l_kpname\\\" May be set in a file that's ignored by load procedure **\\n\" fi } while IFS=\"=\" read -r l_kpname l_kpvalue; do # Assess and check parameters l_kpname=\"${l_kpname// /}\"; l_kpvalue=\"${l_kpvalue// /}\" if ! grep -Pqs '^\\h*0\\b' /sys/module/ipv6/parameters/disable && grep -q '^net.ipv6.' <<< \"$l_kpname\"; then l_output=\"$l_output\\n - IPv6 is disabled on the system, \\\"$l_kpname\\\" is not applicable\" else kernel_parameter_chk fi 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\" [ -n \"$l_output\" ] && echo -e \"\\n- Correctly set:\\n$l_output\\n\" fi }" expect : "(?i)^[\\s]*\\**[\\s]*pass:?[\\s]*\\**$" type : CMD_EXEC description : "1.4.3 Ensure core dump backtraces are disabled" 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. A core dump includes a memory image taken at the time the operating system terminates an application. The memory image could contain sensitive data and is generally useful only for developers trying to debug problems, increasing the risk to the system." solution : "Create or edit the file /etc/systemd/coredump.conf or a file in the /etc/systemd/coredump.conf.d directory ending inconf Edit or add the following line: ProcessSizeMax=0" reference : "800-171|3.4.6,800-171|3.4.7,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/15289" cmd : "#!/bin/bash { l_output=\"\" l_output2=\"\" a_parlist=(\"ProcessSizeMax=0\") l_systemd_config_file=\"/etc/systemd/coredump.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)\" [ \"${l_systemd_parameter^^}\" = \"${l_systemd_parameter_name^^}\" ] && A_out+=([\"$l_systemd_parameter\"]=\"$l_file\") fi fi done < <(/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 [ \"${l_systemd_file_parameter_value^^}\" = \"${l_systemd_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 of: \\\"$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\" [ -n \"$l_output\" ] && echo -e \"\\n- Correctly set:\\n$l_output\\n\" fi }" expect : "(?i)^[\\s]*\\**[\\s]*pass[\\s]*\\**$" type : CMD_EXEC description : "1.4.4 Ensure core dump storage is disabled" 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. A core dump includes a memory image taken at the time the operating system terminates an application. The memory image could contain sensitive data and is generally useful only for developers trying to debug problems." solution : "Create or edit the file /etc/systemd/coredump.conf or a file in the /etc/systemd/coredump.conf.d directory ending inconf Edit or add the following line: Storage=none" reference : "800-171|3.4.6,800-171|3.4.7,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/15289" cmd : "#!/bin/bash { l_output=\"\" l_output2=\"\" a_parlist=(\"Storage=none\") l_systemd_config_file=\"/etc/systemd/coredump.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)\" [ \"${l_systemd_parameter^^}\" = \"${l_systemd_parameter_name^^}\" ] && A_out+=([\"$l_systemd_parameter\"]=\"$l_file\") fi fi done < <(/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 [ \"${l_systemd_file_parameter_value^^}\" = \"${l_systemd_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 of: \\\"$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\" [ -n \"$l_output\" ] && echo -e \"\\n- Correctly set:\\n$l_output\\n\" fi }" expect : "(?i)^[\\s]*\\**[\\s]*pass:?[\\s]*\\**$" type : RPM_CHECK description : "1.5.1.1 Ensure SELinux is installed" info : "SELinux provides Mandatory Access Control. Without a Mandatory Access Control system installed only the default Discretionary Access Control system will be available." solution : "Run the following command to install SELinux : # dnf install libselinux" 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-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/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/15289" rpm : "libselinux-0.0.0-0" operator : "gt" required : YES type : CMD_EXEC description : "1.5.1.2 Ensure SELinux is not disabled in bootloader configuration" info : "Configure SELINUX to be enabled at boot time and verify that it has not been overwritten by the grub boot parameters. SELinux must be enabled at boot time in your grub configuration to ensure that the controls it provides are not overridden." solution : "Run the following command to remove the selinux=0 and enforcing=0 parameters: grubby --update-kernel ALL --remove-args \"selinux=0 enforcing=0\" Run the following command to remove the selinux=0 and enforcing=0 parameters if they were created by the deprecated grub2-mkconfig command: # grep -Prsq -- '\h*([^#\n\r]+\h+)?kernelopts=([^#\n\r]+\h+)?(selinux|enforcing)=0\b' /boot/grub2 /boot/efi && grub2-mkconfig -o \"$(grep -Prl -- '\h*([^#\n\r]+\h+)?kernelopts=([^#\n\r]+\h+)?(selinux|enforcing)=0\b' /boot/grub2 /boot/efi)\" Impact: Files created while SELinux is disabled are not labeled at all. This behavior causes problems when changing to enforcing mode because files are labeled incorrectly or are not labeled at all. To prevent incorrectly labeled and unlabeled files from causing problems, file systems are automatically relabeled when changing from the disabled state to permissive or enforcing mode. This can be a long running process that should be accounted for as it may extend downtime during initial re-boot." 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-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/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/15289" cmd : "/sbin/grubby --info=ALL | /bin/grep -Po '(selinux|enforcing)=0' | /bin/awk '{print} END {if (NR == 0) print \"pass\" ; else print \"fail\"}'" expect : "(?i)^[\\s]*\\**[\\s]*pass:?[\\s]*\\**$" type : CMD_EXEC description : "sestatus" cmd : "/sbin/sestatus" expect : "(?i)^[\\s]*Loaded policy name:[\\s]+(targeted|mls)$" type : FILE_CONTENT_CHECK description : "/etc/selinux/config" file : "/etc/selinux/config" regex : "(?i)^[\\s]*SELINUXTYPE[\\s]*=" expect : "(?i)^[\\s]*SELINUXTYPE[\\s]*=[\\s]*(targeted|mls)[\\s]*$" description : "1.5.1.3 Ensure SELinux policy is configured" info : "Configure SELinux to meet or exceed the default targeted policy, which constrains daemons and system software only. 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 at least the default recommendations are met." solution : "Edit the /etc/selinux/config file to set the SELINUXTYPE parameter: SELINUXTYPE=targeted" 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-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/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/15289" show_output : YES type : FILE_CONTENT_CHECK description : "/etc/selinux/config" file : "/etc/selinux/config" regex : "(?i)^[\\s]*SeLinux[\\s]*=" expect : "(?i)^[\\s]*SeLinux[\\s]*=[\\s]*(Enforcing|Permissive)[\\s]*$" type : CMD_EXEC description : "getenforce" cmd : "/sbin/getenforce" expect : "(?i)(Enforcing|Permissive)" description : "1.5.1.4 Ensure the SELinux mode is not disabled" info : "SELinux can run in one of three modes: disabled, permissive, or enforcing: - Enforcing - Is the default, and recommended, mode of operation; in enforcing mode SELinux operates normally, enforcing the loaded security policy on the entire system. - Permissive - The system acts as if SELinux is enforcing the loaded security policy, including labeling objects and emitting access denial entries in the logs, but it does not actually deny any operations. While not recommended for production systems, permissive mode can be helpful for SELinux policy development. - Disabled - Is strongly discouraged; not only does the system avoid enforcing the SELinux policy, it also avoids labeling any persistent objects such as files, making it difficult to enable SELinux in the future Note: You can set individual domains to permissive mode while the system runs in enforcing mode. For example, to make the httpd_t domain permissive: # semanage permissive -a httpd_t Running SELinux in disabled mode is strongly discouraged; not only does the system avoid enforcing the SELinux policy, it also avoids labeling any persistent objects such as files, making it difficult to enable SELinux in the future." solution : "Run one of the following commands to set SELinux's running mode: To set SELinux mode to Enforcing : # setenforce 1 -OR- To set SELinux mode to Permissive : # setenforce 0 Edit the /etc/selinux/config file to set the SELINUX parameter: For Enforcing mode: SELINUX=enforcing -OR- For Permissive mode: SELINUX=permissive" 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-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/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/15289" show_output : YES type : CMD_EXEC description : "1.5.1.6 Ensure no unconfined services exist" info : "Unconfined processes run in unconfined domains For unconfined processes, SELinux policy rules are applied, but policy rules exist that allow processes running in unconfined domains almost all access. Processes running in unconfined domains fall back to using DAC rules exclusively. If an unconfined process is compromised, SELinux does not prevent an attacker from gaining access to system resources and data, but of course, DAC rules are still used. SELinux is a security enhancement on top of DAC rules - it does not replace them" solution : "Investigate any unconfined processes found during the audit action. They may need to have an existing security context assigned to them or a policy built for them." 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-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|9.2,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/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/15289" cmd : "/bin/ps -eZ | /bin/grep unconfined_service_t | /bin/awk -F: '{ print $NF } END {if (NR == 0) print \"none\"}'" expect : "^none$" type : RPM_CHECK description : "1.5.1.7 Ensure the MCS Translation Service (mcstrans) is not installed" info : "The mcstransd daemon provides category label information to client processes requesting information. The label translations are defined in /etc/selinux/targeted/setrans.conf Since this service is not used very often, remove it to reduce the amount of potentially vulnerable code running on the system." solution : "Run the following command to uninstall mcstrans : # dnf remove mcstrans" reference : "800-171|3.4.2,800-171|3.4.6,800-171|3.4.7,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),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/15289" rpm : "mcstrans-0.0.0-0" operator : "lt" type : RPM_CHECK description : "1.5.1.8 Ensure SETroubleshoot is not installed" info : "The SETroubleshoot service notifies desktop users of SELinux denials through a user-friendly interface. The service provides important information around configuration errors, unauthorized intrusions, and other potential errors. The SETroubleshoot service is an unnecessary daemon to have running on a server, especially if X Windows is disabled." solution : "Run the following command to uninstall setroubleshoot : # dnf remove setroubleshoot" reference : "800-171|3.4.2,800-171|3.4.6,800-171|3.4.7,800-53|CM-6,800-53|CM-7,800-53r5|CM-6,800-53r5|CM-7,CSCv7|14.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),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/15289" rpm : "setroubleshoot-0.0.0-0" operator : "lt" type : FILE_CONTENT_CHECK_NOT description : "1.6.1 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 ensures maximum compatibility with version 5 of the operating system and earlier; it 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-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/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/15289" file : "/etc/crypto-policies/config" regex : "(?i)^[\\s]*LEGACY[\\s]*([\\s]+#.*)?$" expect : "(?i)^[\\s]*LEGACY[\\s]*([\\s]+#.*)?$" type : CMD_EXEC description : "sha1_in_certs policy value" cmd : "/bin/grep -Pi -- '^\\h*sha1_in_certs\\h*=\\h*' /etc/crypto-policies/state/CURRENT.pol" expect : "^[\\s]*sha1_in_certs[\\s]*=[\\s]*0[\\s]*$" type : CMD_EXEC description : "Crypto policy settings for hash and sign" cmd : "/bin/grep -Pi -- '^\\h*(hash|sign)\\h*=\\h*([^\\r#]+)?-sha1\\b' /etc/crypto-policies/state/CURRENT.pol | /bin/awk -F: '{ print $NF } END {if (NR == 0) print \"none\"}'" expect : "none" description : "1.6.2 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 - The module for disabling SHA-1 is available from release 8.3 in /usr/share/crypto-policies/policies/modules/NO-SHA1.pmod This may be copied to /etc/crypto-policies/policies/modules/NO-SHA1.pmod verified, and used instead of creating a file ending inpmod in the /etc/crypto-policies/policies/modules/ directory. - Any subpolicy not included in the update-crypto-policies --set command will not be applied to the system wide crypto policy. - Subpolicies must exist before they can be applied to the system wide crypto policy. 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: # echo -e \"# This is a subpolicy dropping the SHA1 hash and signature support\nhash = -SHA1\nsign = -*-SHA1\nsha1_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-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/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/15289" show_output : YES type : CMD_EXEC description : "1.6.3 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. - Multiple subpolicies may be assigned to a policy as a colon separated list. e.g. DEFAULT:NO-SHA1:NO-SSHCBC - Any subpolicy not included in the update-crypto-policies --set command will not be applied to the system wide crypto policy. - Subpolicies must exist before they can be applied to the system wide crypto policy. 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 -OR- cipher = -*-CBC # Disables the CBC cipher Example: # echo -e \"# This is a subpolicy to disable all CBC mode ciphers\n# for the SSH protocol (libssh and OpenSSH)\ncipher@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-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-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/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/15289" 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 : FILE_CONTENT_CHECK_NOT description : "1.6.4 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:NO-WEAKMAC - Any subpolicy not included in the update-crypto-policies --set command will not be applied to the system wide crypto policy. - Subpolicies must exist before they can be applied to the system wide crypto policy. Create or edit a file in /etc/crypto-policies/policies/modules/ ending inpmod and add or modify one of the following lines: mac = -*-64* # Disables weak macs Example: # echo -e \"# This is a subpolicy to disable weak macs\nmac = -*-64\" > /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-SSHCBC: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-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/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/15289" file : "/etc/crypto-policies/state/CURRENT.pol" regex : "^\\h*mac\\h*=\\h*([^#\\n\\r]+)?-64\\b" expect : "^\\h*mac\\h*=\\h*([^#\\n\\r]+)?-64\\b" type : FILE_CHECK description : "/etc/motd exist" file : "/etc/motd" type : FILE_CONTENT_CHECK_NOT description : "mrsv not included in /etc/motd" file : "/etc/motd" regex : "\\\\[mrsv]" expect : "\\\\[mrsv]" type : BANNER_CHECK description : "banner text" file : "/etc/motd" content : "@BANNER_TEXT@" description : "1.7.1 Ensure message of the day is configured properly" 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 /etc/motd file with the appropriate contents according to your site policy, remove any instances of \m \r \s \v or references to the OS platform -OR- -IF- the motd is not used, this file can be removed. Run the following command to remove the motd file: # rm /etc/motd" reference : "800-171|3.1.9,800-53|AC-8a.,800-53r5|AC-8a.,GDPR|32.1.b,HIPAA|164.306(a)(1),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/15289" show_output : YES description : "1.7.1 Ensure message of the day is configured properly" 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 /etc/motd file with the appropriate contents according to your site policy, remove any instances of \m \r \s \v or references to the OS platform -OR- -IF- the motd is not used, this file can be removed. Run the following command to remove the motd file: # rm /etc/motd" reference : "800-171|3.1.9,800-53|AC-8a.,800-53r5|AC-8a.,GDPR|32.1.b,HIPAA|164.306(a)(1),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/15289" type : FILE_CHECK description : "/etc/issue exist" file : "/etc/issue" type : BANNER_CHECK description : "banner text" 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-53|AC-8,800-53r5|AC-8,GDPR|32.1.b,HIPAA|164.306(a)(1),ITSG-33|AC-8,LEVEL|1A,NESA|M1.3.6,TBA-FIISB|45.2.4" see_also : "https://workbench.cisecurity.org/benchmarks/15289" 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-53|AC-8,800-53r5|AC-8,GDPR|32.1.b,HIPAA|164.306(a)(1),ITSG-33|AC-8,LEVEL|1A,NESA|M1.3.6,TBA-FIISB|45.2.4" see_also : "https://workbench.cisecurity.org/benchmarks/15289" 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-53|AC-8,800-53r5|AC-8,GDPR|32.1.b,HIPAA|164.306(a)(1),ITSG-33|AC-8,LEVEL|1A,NESA|M1.3.6,TBA-FIISB|45.2.4" see_also : "https://workbench.cisecurity.org/benchmarks/15289" 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-53|AC-8,800-53r5|AC-8,GDPR|32.1.b,HIPAA|164.306(a)(1),ITSG-33|AC-8,LEVEL|1A,NESA|M1.3.6,TBA-FIISB|45.2.4" see_also : "https://workbench.cisecurity.org/benchmarks/15289" 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-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/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/15289" 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-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/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/15289" 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-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/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/15289" 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-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),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/15289" 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-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),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/15289" 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 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 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: # dnf remove gdm" reference : "800-171|3.1.9,800-53|AC-8,800-53r5|AC-8,GDPR|32.1.b,HIPAA|164.306(a)(1),ITSG-33|AC-8,LEVEL|1A,NESA|M1.3.6,TBA-FIISB|45.2.4" see_also : "https://workbench.cisecurity.org/benchmarks/15289" 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: # dnf remove gdm" reference : "800-171|3.5.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),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/15289" 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-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/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/15289" 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 seporated 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-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/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/15289" 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 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\")\" 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: # dnf 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-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/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/15289" 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 seporated 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-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/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/15289" 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-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/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/15289" 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-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/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/15289" 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 : "2.1.1 Ensure time synchronization is in use" info : "System time should be synchronized between all systems in an environment. This is typically done by establishing an authoritative time server or set of servers and having all systems synchronize their clocks to them. Note: If another method for time synchronization is being used, this section may be skipped. Time synchronization is important to support time sensitive security mechanisms like Kerberos and also ensures log files have consistent time records across the enterprise, which aids in forensic investigations." solution : "Run the following command to install chrony : # dnf install chrony" reference : "800-171|3.3.6,800-171|3.3.7,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),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/15289" rpm : "chrony-0.0.0-0" operator : "gt" required : YES type : FILE_CONTENT_CHECK description : "2.1.2 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." solution : "Add or edit server or pool lines to /etc/chrony.conf or a file in the /etc/chrony.d directory as appropriate: Example: server " reference : "800-171|3.3.6,800-171|3.3.7,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),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/15289" file : "/etc/chrony.conf /etc/chrony.d/*" regex : "^[\\s]*(server|pool)[\\s]+@NTP_SERVER@" expect : "^[\\s]*(server|pool)[\\s]+@NTP_SERVER@" min_occurrences : "1" string_required : NO type : CMD_EXEC description : "2.1.3 Ensure chrony is not run as the root user" info : "The file /etc/sysconfig/chronyd allows configuration of options for chrony to include the user chrony is run as. By default this is set to the user chrony Services should not be set to run as the root user" solution : "Edit the file /etc/sysconfig/chronyd and add or modify the following line: OPTIONS=\"-u chrony\" Run the following command to reload the chronyd.service configuration: # systemctl try-reload-or-restart chronyd.service" reference : "800-171|3.1.5,800-53|AC-6,800-53r5|AC-6,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),CSF|PR.AC-4,CSF|PR.DS-5,CSF2.0|PR.AA-05,GDPR|32.1.b,HIPAA|164.306(a)(1),HIPAA|164.312(a)(1),ITSG-33|AC-6,LEVEL|1A,NESA|T5.1.1,NESA|T5.2.2,NESA|T5.4.1,NESA|T5.4.4,NESA|T5.4.5,NESA|T5.5.4,NESA|T5.6.1,NESA|T7.5.3,NIAv2|AM1,NIAv2|AM23f,NIAv2|SS13c,NIAv2|SS15c,PCI-DSSv3.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,QCSC-v1|13.2,SWIFT-CSCv1|5.1,TBA-FIISB|31.4.2,TBA-FIISB|31.4.3" see_also : "https://workbench.cisecurity.org/benchmarks/15289" cmd : "/bin/grep -Psi -- '^\\h*OPTIONS=\\\"?.*-u\\h+root\\b' /etc/sysconfig/chronyd | /bin/awk '{print} END {if (NR == 0) print \"pass\" ; else print \"fail\"}'" expect : "(?i)^[\\s]*\\**[\\s]*pass:?[\\s]*\\**$" type : RPM_CHECK description : "autofs" rpm : "autofs-0.0.0-0" operator : "lte" type : RPM_CHECK description : "2.2.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 # dnf 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-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/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/15289" 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.2.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 # dnf 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-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/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/15289" show_output : YES 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.2.10 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 # dnf 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-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),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/15289" show_output : YES type : RPM_CHECK description : "2.2.10 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 # dnf 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-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),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/15289" 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.2.11 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 # dnf 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-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),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/15289" show_output : YES type : RPM_CHECK description : "2.2.11 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 # dnf 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-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),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/15289" 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.2.12 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 # dnf 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-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),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/15289" show_output : YES type : RPM_CHECK description : "2.2.12 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 # dnf 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-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),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/15289" 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.2.13 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-daemon 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-daemon package: # systemctl stop rsyncd.socket rsyncd.service # dnf remove rsync-daemon -OR- -IF- the rsync-daemon 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-daemon package. If the rsync-daemon package is removed, these dependent packages will be removed as well. Before removing the rsync-daemon 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-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),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/15289" show_output : YES type : RPM_CHECK description : "2.2.13 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-daemon 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-daemon package: # systemctl stop rsyncd.socket rsyncd.service # dnf remove rsync-daemon -OR- -IF- the rsync-daemon 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-daemon package. If the rsync-daemon package is removed, these dependent packages will be removed as well. Before removing the rsync-daemon 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-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),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/15289" 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.2.14 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 # dnf 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-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),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/15289" show_output : YES type : RPM_CHECK description : "2.2.14 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 # dnf 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-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),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/15289" 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.2.15 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 # dnf 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-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),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/15289" show_output : YES type : RPM_CHECK description : "2.2.15 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 # dnf 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-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),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/15289" 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.2.16 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 # dnf 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-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),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/15289" show_output : YES type : RPM_CHECK description : "2.2.16 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 # dnf 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-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),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/15289" 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.2.17 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 # dnf 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-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),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/15289" show_output : YES type : RPM_CHECK description : "2.2.17 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 # dnf 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-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),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/15289" rpm : "squid-0.0.0-0" operator : "lte" type : RPM_CHECK description : "httpd services exist on the system" rpm : "httpd-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 : "httpd.socket httpd.service nginx.service active" cmd : "/bin/systemctl is-active httpd.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 : "httpd.socket httpd.service nginx.service enabled" cmd : "/bin/systemctl is-enabled httpd.socket httpd.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.2.18 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 httpd.socket httpd.service and nginx.service and remove httpd and nginx packages: # systemctl stop httpd.socket httpd.service nginx.service # dnf remove httpd nginx -OR- -IF- a package is installed and is required for dependencies: Run the following commands to stop and mask httpd.socket httpd.service and nginx.service : # systemctl stop httpd.socket httpd.service nginx.service # systemctl mask httpd.socket httpd.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-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),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/15289" 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 : "httpd services exist on the system" rpm : "httpd-0.0.0-0" operator : "lte" description : "2.2.18 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 httpd.socket httpd.service and nginx.service and remove httpd and nginx packages: # systemctl stop httpd.socket httpd.service nginx.service # dnf remove httpd nginx -OR- -IF- a package is installed and is required for dependencies: Run the following commands to stop and mask httpd.socket httpd.service and nginx.service : # systemctl stop httpd.socket httpd.service nginx.service # systemctl mask httpd.socket httpd.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-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),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/15289" 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.2.19 Ensure xinetd services are not in use" info : "The X Window System provides a Graphical User Interface (GUI) where users can have multiple windows in which to run programs and various add on. The X Windows system is typically used on workstations where users login, but not on servers where users typically do not login. Unless your organization specifically requires graphical login access via X Windows, remove it to reduce the potential attack surface." solution : "Run the following commands to stop xinetd.service and remove the xinetd package: # systemctl stop xinetd.service # dnf 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 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-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),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/15289" show_output : YES type : RPM_CHECK description : "2.2.19 Ensure xinetd services are not in use" info : "The X Window System provides a Graphical User Interface (GUI) where users can have multiple windows in which to run programs and various add on. The X Windows system is typically used on workstations where users login, but not on servers where users typically do not login. Unless your organization specifically requires graphical login access via X Windows, remove it to reduce the potential attack surface." solution : "Run the following commands to stop xinetd.service and remove the xinetd package: # systemctl stop xinetd.service # dnf 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 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-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),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/15289" rpm : "xinetd-0.0.0-0" operator : "lte" type : RPM_CHECK description : "avahi" rpm : "avahi-0.0.0-0" operator : "lte" type : RPM_CHECK description : "2.2.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 # dnf 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-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),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/15289" 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.2.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 # dnf 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-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),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/15289" show_output : YES type : CMD_EXEC description : "Loopback on Port 25" cmd : "/sbin/ss -plntu | /bin/grep -P -- ':25\\b' | /bin/grep -Pv -- '\\h*(127\\.0\\.0\\.1|\\[?::1\\]?):25\\b' | /bin/awk -F: '{ print $NF } END {if (NR == 0) print \"none\"}'" expect : "^none$" type : CMD_EXEC description : "Loopback on Port 587" cmd : "/sbin/ss -plntu | /bin/grep -P -- ':587\\b' | /bin/grep -Pv -- '\\h*(127\\.0\\.0\\.1|\\[?::1\\]?):587\\b' | /bin/awk -F: '{ print $NF } END {if (NR == 0) print \"none\"}'" expect : "^none$" type : CMD_EXEC description : "Loopback on Port 465" cmd : "/sbin/ss -plntu | /bin/grep -P -- ':465\\b' | /bin/grep -Pv -- '\\h*(127\\.0\\.0\\.1|\\[?::1\\]?):465\\b' | /bin/awk -F: '{ print $NF } END {if (NR == 0) print \"none\"}'" expect : "^none$" description : "2.2.21 Ensure mail transfer agents are configured for local-only mode" info : "Mail Transfer Agents (MTA), such as sendmail and Postfix, are used to listen for incoming mail and transfer the messages to the appropriate user or mail server. If the system is not intended to be a mail server, it is recommended that the MTA be configured to only process local mail. 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 remediation is designed around the postfix mail server. - Depending on your environment you may have an alternative MTA installed such as sendmail. If this is the case consult the documentation for your installed MTA to configure the recommended state." reference : "800-171|3.4.2,800-171|3.4.6,800-171|3.4.7,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),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/15289" show_output : YES type : CMD_EXEC description : "2.2.22 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 # dnf 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-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),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/15289" cmd : "/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.2.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 # dnf 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-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),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/15289" show_output : YES type : RPM_CHECK description : "2.2.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 # dnf 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-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),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/15289" 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.2.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 # dnf 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-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),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/15289" show_output : YES type : RPM_CHECK description : "2.2.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 # dnf 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-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),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/15289" 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.2.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 # dnf 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-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),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/15289" show_output : YES type : RPM_CHECK description : "2.2.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 # dnf 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-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),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/15289" 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.2.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 # dnf 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-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),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/15289" show_output : YES type : RPM_CHECK description : "2.2.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 # dnf 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-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),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/15289" rpm : "samba-0.0.0-0" operator : "lte" 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.2.7 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 # dnf 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-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),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/15289" show_output : YES type : RPM_CHECK description : "2.2.7 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 # dnf 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-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),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/15289" 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.2.8 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 # dnf 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-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),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/15289" 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.2.8 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 # dnf 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-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),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/15289" show_output : YES type : RPM_CHECK description : "nfs-utils exist" rpm : "nfs-utils-0.0.0-0" operator : "gt" required : YES type : CMD_EXEC description : "nfs-server.service 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 : "(?i)^[\\s]*\\**[\\s]*pass:?[\\s]*\\**$" type : CMD_EXEC description : "nfs-server.service 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 : "(?i)^[\\s]*\\**[\\s]*pass:?[\\s]*\\**$" description : "2.2.9 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-utils package be removed to reduce the attack surface of the system." solution : "Run the following command to stop nfs-server.service and remove nfs-utils package: # systemctl stop nfs-server.service # dnf remove nfs-utils -OR- -IF- the nfs-utils 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-utils package. If the nfs-utils package is removed, these dependent packages will be removed as well. Before removing the nfs-utils 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-utils package installed." reference : "800-171|3.4.2,800-171|3.4.6,800-171|3.4.7,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),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/15289" show_output : YES type : RPM_CHECK description : "2.2.9 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-utils package be removed to reduce the attack surface of the system." solution : "Run the following command to stop nfs-server.service and remove nfs-utils package: # systemctl stop nfs-server.service # dnf remove nfs-utils -OR- -IF- the nfs-utils 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-utils package. If the nfs-utils package is removed, these dependent packages will be removed as well. Before removing the nfs-utils 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-utils package installed." reference : "800-171|3.4.2,800-171|3.4.6,800-171|3.4.7,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),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/15289" rpm : "nfs-utils-0.0.0-0" operator : "lte" type : RPM_CHECK description : "2.3.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 : # dnf remove ftp" reference : "800-171|3.4.2,800-171|3.4.6,800-171|3.4.7,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),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/15289" rpm : "ftp-0.0.0-0" operator : "lte" type : RPM_CHECK description : "2.3.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: # dnf remove ypbind Impact: Many insecure service clients are used as troubleshooting tools and in testing environments. Uninstalling them can inhibit capability to test and troubleshoot. If they are required it is advisable to remove the clients after use to prevent accidental or intentional misuse." reference : "800-171|3.4.2,800-171|3.4.6,800-171|3.4.7,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),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/15289" rpm : "ypbind-0.0.0-0" operator : "lte" type : RPM_CHECK description : "2.3.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: # dnf remove telnet Impact: Many insecure service clients are used as troubleshooting tools and in testing environments. Uninstalling them can inhibit capability to test and troubleshoot. If they are required it is advisable to remove the clients after use to prevent accidental or intentional misuse." reference : "800-171|3.4.2,800-171|3.4.6,800-171|3.4.7,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),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/15289" rpm : "telnet-0.0.0-0" operator : "lte" type : RPM_CHECK description : "2.3.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 : # dnf remove tftp" reference : "800-171|3.4.2,800-171|3.4.6,800-171|3.4.7,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),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/15289" rpm : "tftp-0.0.0-0" operator : "lte" 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 trillion3 addresses. Features of IPv6 - Hierarchical addressing and routing infrastructure - Stateful 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-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),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/15289" 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-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),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/15289" 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 # dnf 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-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),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/15289" 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 # dnf 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-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),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/15289" 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 \" net.ipv4.ip_forward = 0 \" >> /etc/sysctl.d/60-netipv4_sysctl.conf Run the following command to set the active kernel parameters: # { 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 \" net.ipv6.conf.all.forwarding = 0 \" >> /etc/sysctl.d/60-netipv6_sysctl.conf Run the following command to set the active kernel parameters: # { 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-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),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/15289" cmd : "#!/bin/bash { l_output=\"\" l_output2=\"\" 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)\" kernel_parameter_chk() { l_krp=\"$(sysctl \"$l_kpname\" | awk -F= '{print $2}' | xargs)\" # Check running configuration if [ \"$l_krp\" = \"$l_kpvalue\" ]; then l_output=\"$l_output - \\\"$l_kpname\\\" is correctly set to \\\"$l_krp\\\" in the running configuration\" else l_output2=\"$l_output2 - \\\"$l_kpname\\\" is incorrectly set to \\\"$l_krp\\\" in the running configuration and should have a value of: \\\"$l_kpvalue\\\"\" 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_kpname\" ] && A_out+=([\"$l_kpar\"]=\"$l_file\") fi fi done < <(/usr/lib/systemd/systemd-sysctl --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_kpname\\b\" \"$l_ufwscf\" | xargs)\" l_kpar=\"${l_kpar//\\//.}\" [ \"$l_kpar\" = \"$l_kpname\" ] && 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_fkpvalue; do l_fkpname=\"${l_fkpname// /}\"; l_fkpvalue=\"${l_fkpvalue// /}\" if [ \"$l_fkpvalue\" = \"$l_kpvalue\" ]; then l_output=\"$l_output - \\\"$l_kpname\\\" is correctly set to \\\"$l_fkpvalue\\\" in \\\"$(printf '%s' \"${A_out[@]}\")\\\" \" else l_output2=\"$l_output2 - \\\"$l_kpname\\\" is incorrectly set to \\\"$l_fkpvalue\\\" in \\\"$(printf '%s' \"${A_out[@]}\")\\\" and should have a value of: \\\"$l_kpvalue\\\" \" fi done < <(grep -Po -- \"^\\h*$l_kpname\\h*=\\h*\\H+\" \"${A_out[@]}\") else l_output2=\"$l_output2 - \\\"$l_kpname\\\" is not set in an included file ** Note: \\\"$l_kpname\\\" May be set in a file that's ignored by load procedure ** \" fi } while IFS=\"=\" read -r l_kpname l_kpvalue; do # Assess and check parameters l_kpname=\"${l_kpname// /}\"; l_kpvalue=\"${l_kpvalue// /}\" if ! grep -Pqs '^\\h*0\\b' /sys/module/ipv6/parameters/disable && grep -q '^net.ipv6.' <<< \"$l_kpname\"; then l_output=\"$l_output - IPv6 is disabled on the system, \\\"$l_kpname\\\" is not applicable\" else kernel_parameter_chk fi done < <(printf '%s ' \"${a_parlist[@]}\") if [ -z \"$l_output2\" ]; then # Provide output from checks 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 : "(?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 \" net.ipv4.tcp_syncookies = 1 \" >> /etc/sysctl.d/60-netipv4_sysctl.conf Run the following command to set the active kernel parameters: # { 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-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),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/15289" cmd : "#!/bin/bash { l_output=\"\" l_output2=\"\" a_parlist=(\"net.ipv4.tcp_syncookies=1\") l_ufwscf=\"$([ -f /etc/default/ufw ] && awk -F= '/^\\s*IPT_SYSCTL=/ {print $2}' /etc/default/ufw)\" kernel_parameter_chk() { l_krp=\"$(sysctl \"$l_kpname\" | awk -F= '{print $2}' | xargs)\" # Check running configuration if [ \"$l_krp\" = \"$l_kpvalue\" ]; then l_output=\"$l_output\\n - \\\"$l_kpname\\\" is correctly set to \\\"$l_krp\\\" in the running configuration\" else l_output2=\"$l_output2\\n - \\\"$l_kpname\\\" is incorrectly set to \\\"$l_krp\\\" in the running configuration and should have a value of: \\\"$l_kpvalue\\\"\" 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_kpname\" ] && A_out+=([\"$l_kpar\"]=\"$l_file\") fi fi done < <(/usr/lib/systemd/systemd-sysctl --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_kpname\\b\" \"$l_ufwscf\" | xargs)\" l_kpar=\"${l_kpar//\\//.}\" [ \"$l_kpar\" = \"$l_kpname\" ] && 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_fkpvalue; do l_fkpname=\"${l_fkpname// /}\"; l_fkpvalue=\"${l_fkpvalue// /}\" if [ \"$l_fkpvalue\" = \"$l_kpvalue\" ]; then l_output=\"$l_output\\n - \\\"$l_kpname\\\" is correctly set to \\\"$l_fkpvalue\\\" in \\\"$(printf '%s' \"${A_out[@]}\")\\\"\\n\" else l_output2=\"$l_output2\\n - \\\"$l_kpname\\\" is incorrectly set to \\\"$l_fkpvalue\\\" in \\\"$(printf '%s' \"${A_out[@]}\")\\\" and should have a value of: \\\"$l_kpvalue\\\"\\n\" fi done < <(grep -Po -- \"^\\h*$l_kpname\\h*=\\h*\\H+\" \"${A_out[@]}\") else l_output2=\"$l_output2\\n - \\\"$l_kpname\\\" is not set in an included file\\n ** Note: \\\"$l_kpname\\\" May be set in a file that's ignored by load procedure **\\n\" fi } while IFS=\"=\" read -r l_kpname l_kpvalue; do # Assess and check parameters l_kpname=\"${l_kpname// /}\"; l_kpvalue=\"${l_kpvalue// /}\" if ! grep -Pqs '^\\h*0\\b' /sys/module/ipv6/parameters/disable && grep -q '^net.ipv6.' <<< \"$l_kpname\"; then l_output=\"$l_output\\n - IPv6 is disabled on the system, \\\"$l_kpname\\\" is not applicable\" else kernel_parameter_chk fi 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\" [ -n \"$l_output\" ] && echo -e \"\\n- Correctly set:\\n$l_output\\n\" fi }" expect : "(?i)^[\\s]*\\**[\\s]*pass:?[\\s]*\\**$" type : CMD_EXEC description : "3.3.11 Ensure ipv6 router advertisements are not accepted" info : "This setting disables the system's ability to accept IPv6 router 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 \" net.ipv6.conf.all.accept_ra = 0 net.ipv6.conf.default.accept_ra = 0 \" >> /etc/sysctl.d/60-netipv6_sysctl.conf Run the following command to set the active kernel parameters: # { sysctl -w net.ipv6.conf.all.accept_ra=0 sysctl -w net.ipv6.conf.default.accept_ra=0 sysctl -w net.ipv6.route.flush=1 } 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-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),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/15289" cmd : "#!/bin/bash { l_output=\"\" l_output2=\"\" 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)\" kernel_parameter_chk() { l_krp=\"$(sysctl \"$l_kpname\" | awk -F= '{print $2}' | xargs)\" # Check running configuration if [ \"$l_krp\" = \"$l_kpvalue\" ]; then l_output=\"$l_output\\n - \\\"$l_kpname\\\" is correctly set to \\\"$l_krp\\\" in the running configuration\" else l_output2=\"$l_output2\\n - \\\"$l_kpname\\\" is incorrectly set to \\\"$l_krp\\\" in the running configuration and should have a value of: \\\"$l_kpvalue\\\"\" 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_kpname\" ] && A_out+=([\"$l_kpar\"]=\"$l_file\") fi fi done < <(/usr/lib/systemd/systemd-sysctl --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_kpname\\b\" \"$l_ufwscf\" | xargs)\" l_kpar=\"${l_kpar//\\//.}\" [ \"$l_kpar\" = \"$l_kpname\" ] && 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_fkpvalue; do l_fkpname=\"${l_fkpname// /}\"; l_fkpvalue=\"${l_fkpvalue// /}\" if [ \"$l_fkpvalue\" = \"$l_kpvalue\" ]; then l_output=\"$l_output\\n - \\\"$l_kpname\\\" is correctly set to \\\"$l_fkpvalue\\\" in \\\"$(printf '%s' \"${A_out[@]}\")\\\"\\n\" else l_output2=\"$l_output2\\n - \\\"$l_kpname\\\" is incorrectly set to \\\"$l_fkpvalue\\\" in \\\"$(printf '%s' \"${A_out[@]}\")\\\" and should have a value of: \\\"$l_kpvalue\\\"\\n\" fi done < <(grep -Po -- \"^\\h*$l_kpname\\h*=\\h*\\H+\" \"${A_out[@]}\") else l_output2=\"$l_output2\\n - \\\"$l_kpname\\\" is not set in an included file\\n ** Note: \\\"$l_kpname\\\" May be set in a file that's ignored by load procedure **\\n\" fi } while IFS=\"=\" read -r l_kpname l_kpvalue; do # Assess and check parameters l_kpname=\"${l_kpname// /}\"; l_kpvalue=\"${l_kpvalue// /}\" if ! grep -Pqs '^\\h*0\\b' /sys/module/ipv6/parameters/disable && grep -q '^net.ipv6.' <<< \"$l_kpname\"; then l_output=\"$l_output\\n - IPv6 is disabled on the system, \\\"$l_kpname\\\" is not applicable\" else kernel_parameter_chk fi 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\" [ -n \"$l_output\" ] && echo -e \"\\n- Correctly set:\\n$l_output\\n\" 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 \" net.ipv4.conf.all.send_redirects = 0 net.ipv4.conf.default.send_redirects = 0 \" >> /etc/sysctl.d/60-netipv4_sysctl.conf Run the following command to set the active kernel parameters: # { sysctl -w net.ipv4.conf.all.send_redirects=0 sysctl -w net.ipv4.conf.default.send_redirects=0 sysctl -w net.ipv4.route.flush=1 } 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-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),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/15289" cmd : "#!/bin/bash { l_output=\"\" l_output2=\"\" 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)\" kernel_parameter_chk() { l_krp=\"$(sysctl \"$l_kpname\" | awk -F= '{print $2}' | xargs)\" # Check running configuration if [ \"$l_krp\" = \"$l_kpvalue\" ]; then l_output=\"$l_output - \\\"$l_kpname\\\" is correctly set to \\\"$l_krp\\\" in the running configuration\" else l_output2=\"$l_output2 - \\\"$l_kpname\\\" is incorrectly set to \\\"$l_krp\\\" in the running configuration and should have a value of: \\\"$l_kpvalue\\\"\" 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_kpname\" ] && A_out+=([\"$l_kpar\"]=\"$l_file\") fi fi done < <(/usr/lib/systemd/systemd-sysctl --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_kpname\\b\" \"$l_ufwscf\" | xargs)\" l_kpar=\"${l_kpar//\\//.}\" [ \"$l_kpar\" = \"$l_kpname\" ] && 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_fkpvalue; do l_fkpname=\"${l_fkpname// /}\"; l_fkpvalue=\"${l_fkpvalue// /}\" if [ \"$l_fkpvalue\" = \"$l_kpvalue\" ]; then l_output=\"$l_output - \\\"$l_kpname\\\" is correctly set to \\\"$l_fkpvalue\\\" in \\\"$(printf '%s' \"${A_out[@]}\")\\\" \" else l_output2=\"$l_output2 - \\\"$l_kpname\\\" is incorrectly set to \\\"$l_fkpvalue\\\" in \\\"$(printf '%s' \"${A_out[@]}\")\\\" and should have a value of: \\\"$l_kpvalue\\\" \" fi done < <(grep -Po -- \"^\\h*$l_kpname\\h*=\\h*\\H+\" \"${A_out[@]}\") else l_output2=\"$l_output2 - \\\"$l_kpname\\\" is not set in an included file ** Note: \\\"$l_kpname\\\" May be set in a file that's ignored by load procedure ** \" fi } while IFS=\"=\" read -r l_kpname l_kpvalue; do # Assess and check parameters l_kpname=\"${l_kpname// /}\"; l_kpvalue=\"${l_kpvalue// /}\" if ! grep -Pqs '^\\h*0\\b' /sys/module/ipv6/parameters/disable && grep -q '^net.ipv6.' <<< \"$l_kpname\"; then l_output=\"$l_output - IPv6 is disabled on the system, \\\"$l_kpname\\\" is not applicable\" else kernel_parameter_chk fi done < <(printf '%s ' \"${a_parlist[@]}\") if [ -z \"$l_output2\" ]; then # Provide output from checks 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 : "(?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 \" net.ipv4.icmp_ignore_bogus_error_responses = 1 \" >> /etc/sysctl.d/60-netipv4_sysctl.conf Run the following command to set the active kernel parameters: # { 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-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),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/15289" cmd : "#!/bin/bash { l_output=\"\" l_output2=\"\" 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)\" kernel_parameter_chk() { l_krp=\"$(sysctl \"$l_kpname\" | awk -F= '{print $2}' | xargs)\" # Check running configuration if [ \"$l_krp\" = \"$l_kpvalue\" ]; then l_output=\"$l_output - \\\"$l_kpname\\\" is correctly set to \\\"$l_krp\\\" in the running configuration\" else l_output2=\"$l_output2 - \\\"$l_kpname\\\" is incorrectly set to \\\"$l_krp\\\" in the running configuration and should have a value of: \\\"$l_kpvalue\\\"\" 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_kpname\" ] && A_out+=([\"$l_kpar\"]=\"$l_file\") fi fi done < <(/usr/lib/systemd/systemd-sysctl --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_kpname\\b\" \"$l_ufwscf\" | xargs)\" l_kpar=\"${l_kpar//\\//.}\" [ \"$l_kpar\" = \"$l_kpname\" ] && 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_fkpvalue; do l_fkpname=\"${l_fkpname// /}\"; l_fkpvalue=\"${l_fkpvalue// /}\" if [ \"$l_fkpvalue\" = \"$l_kpvalue\" ]; then l_output=\"$l_output - \\\"$l_kpname\\\" is correctly set to \\\"$l_fkpvalue\\\" in \\\"$(printf '%s' \"${A_out[@]}\")\\\" \" else l_output2=\"$l_output2 - \\\"$l_kpname\\\" is incorrectly set to \\\"$l_fkpvalue\\\" in \\\"$(printf '%s' \"${A_out[@]}\")\\\" and should have a value of: \\\"$l_kpvalue\\\" \" fi done < <(grep -Po -- \"^\\h*$l_kpname\\h*=\\h*\\H+\" \"${A_out[@]}\") else l_output2=\"$l_output2 - \\\"$l_kpname\\\" is not set in an included file ** Note: \\\"$l_kpname\\\" May be set in a file that's ignored by load procedure ** \" fi } while IFS=\"=\" read -r l_kpname l_kpvalue; do # Assess and check parameters l_kpname=\"${l_kpname// /}\"; l_kpvalue=\"${l_kpvalue// /}\" if ! grep -Pqs '^\\h*0\\b' /sys/module/ipv6/parameters/disable && grep -q '^net.ipv6.' <<< \"$l_kpname\"; then l_output=\"$l_output - IPv6 is disabled on the system, \\\"$l_kpname\\\" is not applicable\" else kernel_parameter_chk fi done < <(printf '%s ' \"${a_parlist[@]}\") if [ -z \"$l_output2\" ]; then # Provide output from checks 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 : "(?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 \" net.ipv4.icmp_echo_ignore_broadcasts = 1 \" >> /etc/sysctl.d/60-netipv4_sysctl.conf Run the following command to set the active kernel parameters: # { 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-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),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/15289" cmd : "#!/bin/bash { l_output=\"\" l_output2=\"\" 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)\" kernel_parameter_chk() { l_krp=\"$(sysctl \"$l_kpname\" | awk -F= '{print $2}' | xargs)\" # Check running configuration if [ \"$l_krp\" = \"$l_kpvalue\" ]; then l_output=\"$l_output - \\\"$l_kpname\\\" is correctly set to \\\"$l_krp\\\" in the running configuration\" else l_output2=\"$l_output2 - \\\"$l_kpname\\\" is incorrectly set to \\\"$l_krp\\\" in the running configuration and should have a value of: \\\"$l_kpvalue\\\"\" 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_kpname\" ] && A_out+=([\"$l_kpar\"]=\"$l_file\") fi fi done < <(/usr/lib/systemd/systemd-sysctl --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_kpname\\b\" \"$l_ufwscf\" | xargs)\" l_kpar=\"${l_kpar//\\//.}\" [ \"$l_kpar\" = \"$l_kpname\" ] && 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_fkpvalue; do l_fkpname=\"${l_fkpname// /}\"; l_fkpvalue=\"${l_fkpvalue// /}\" if [ \"$l_fkpvalue\" = \"$l_kpvalue\" ]; then l_output=\"$l_output - \\\"$l_kpname\\\" is correctly set to \\\"$l_fkpvalue\\\" in \\\"$(printf '%s' \"${A_out[@]}\")\\\" \" else l_output2=\"$l_output2 - \\\"$l_kpname\\\" is incorrectly set to \\\"$l_fkpvalue\\\" in \\\"$(printf '%s' \"${A_out[@]}\")\\\" and should have a value of: \\\"$l_kpvalue\\\" \" fi done < <(grep -Po -- \"^\\h*$l_kpname\\h*=\\h*\\H+\" \"${A_out[@]}\") else l_output2=\"$l_output2 - \\\"$l_kpname\\\" is not set in an included file ** Note: \\\"$l_kpname\\\" May be set in a file that's ignored by load procedure ** \" fi } while IFS=\"=\" read -r l_kpname l_kpvalue; do # Assess and check parameters l_kpname=\"${l_kpname// /}\"; l_kpvalue=\"${l_kpvalue// /}\" if ! grep -Pqs '^\\h*0\\b' /sys/module/ipv6/parameters/disable && grep -q '^net.ipv6.' <<< \"$l_kpname\"; then l_output=\"$l_output - IPv6 is disabled on the system, \\\"$l_kpname\\\" is not applicable\" else kernel_parameter_chk fi done < <(printf '%s ' \"${a_parlist[@]}\") if [ -z \"$l_output2\" ]; then # Provide output from checks 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 : "(?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 \" net.ipv4.conf.all.accept_redirects = 0 net.ipv4.conf.default.accept_redirects = 0 \" >> /etc/sysctl.d/60-netipv4_sysctl.conf Run the following command to set the active kernel parameters: # { sysctl -w net.ipv4.conf.all.accept_redirects=0 sysctl -w net.ipv4.conf.default.accept_redirects=0 sysctl -w net.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 \" net.ipv6.conf.all.accept_redirects = 0 net.ipv6.conf.default.accept_redirects = 0 \" >> /etc/sysctl.d/60-netipv6_sysctl.conf Run the following command to set the active kernel parameters: # { 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-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),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/15289" cmd : "#!/bin/bash { l_output=\"\" l_output2=\"\" 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)\" kernel_parameter_chk() { l_krp=\"$(sysctl \"$l_kpname\" | awk -F= '{print $2}' | xargs)\" # Check running configuration if [ \"$l_krp\" = \"$l_kpvalue\" ]; then l_output=\"$l_output - \\\"$l_kpname\\\" is correctly set to \\\"$l_krp\\\" in the running configuration\" else l_output2=\"$l_output2 - \\\"$l_kpname\\\" is incorrectly set to \\\"$l_krp\\\" in the running configuration and should have a value of: \\\"$l_kpvalue\\\"\" 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_kpname\" ] && A_out+=([\"$l_kpar\"]=\"$l_file\") fi fi done < <(/usr/lib/systemd/systemd-sysctl --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_kpname\\b\" \"$l_ufwscf\" | xargs)\" l_kpar=\"${l_kpar//\\//.}\" [ \"$l_kpar\" = \"$l_kpname\" ] && 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_fkpvalue; do l_fkpname=\"${l_fkpname// /}\"; l_fkpvalue=\"${l_fkpvalue// /}\" if [ \"$l_fkpvalue\" = \"$l_kpvalue\" ]; then l_output=\"$l_output - \\\"$l_kpname\\\" is correctly set to \\\"$l_fkpvalue\\\" in \\\"$(printf '%s' \"${A_out[@]}\")\\\" \" else l_output2=\"$l_output2 - \\\"$l_kpname\\\" is incorrectly set to \\\"$l_fkpvalue\\\" in \\\"$(printf '%s' \"${A_out[@]}\")\\\" and should have a value of: \\\"$l_kpvalue\\\" \" fi done < <(grep -Po -- \"^\\h*$l_kpname\\h*=\\h*\\H+\" \"${A_out[@]}\") else l_output2=\"$l_output2 - \\\"$l_kpname\\\" is not set in an included file ** Note: \\\"$l_kpname\\\" May be set in a file that's ignored by load procedure ** \" fi } while IFS=\"=\" read -r l_kpname l_kpvalue; do # Assess and check parameters l_kpname=\"${l_kpname// /}\"; l_kpvalue=\"${l_kpvalue// /}\" if ! grep -Pqs '^\\h*0\\b' /sys/module/ipv6/parameters/disable && grep -q '^net.ipv6.' <<< \"$l_kpname\"; then l_output=\"$l_output - IPv6 is disabled on the system, \\\"$l_kpname\\\" is not applicable\" else kernel_parameter_chk fi done < <(printf '%s ' \"${a_parlist[@]}\") if [ -z \"$l_output2\" ]; then # Provide output from checks 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 : "(?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 \" net.ipv4.conf.all.secure_redirects = 0 net.ipv4.conf.default.secure_redirects = 0 \" >> /etc/sysctl.d/60-netipv4_sysctl.conf Run the following commands to set the active kernel parameters: # { sysctl -w net.ipv4.conf.all.secure_redirects=0 sysctl -w net.ipv4.conf.default.secure_redirects=0 sysctl -w net.ipv4.route.flush=1 } 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-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),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/15289" cmd : "#!/bin/bash { l_output=\"\" l_output2=\"\" 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)\" kernel_parameter_chk() { l_krp=\"$(sysctl \"$l_kpname\" | awk -F= '{print $2}' | xargs)\" # Check running configuration if [ \"$l_krp\" = \"$l_kpvalue\" ]; then l_output=\"$l_output\\n - \\\"$l_kpname\\\" is correctly set to \\\"$l_krp\\\" in the running configuration\" else l_output2=\"$l_output2\\n - \\\"$l_kpname\\\" is incorrectly set to \\\"$l_krp\\\" in the running configuration and should have a value of: \\\"$l_kpvalue\\\"\" 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_kpname\" ] && A_out+=([\"$l_kpar\"]=\"$l_file\") fi fi done < <(/usr/lib/systemd/systemd-sysctl --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_kpname\\b\" \"$l_ufwscf\" | xargs)\" l_kpar=\"${l_kpar//\\//.}\" [ \"$l_kpar\" = \"$l_kpname\" ] && 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_fkpvalue; do l_fkpname=\"${l_fkpname// /}\"; l_fkpvalue=\"${l_fkpvalue// /}\" if [ \"$l_fkpvalue\" = \"$l_kpvalue\" ]; then l_output=\"$l_output\\n - \\\"$l_kpname\\\" is correctly set to \\\"$l_fkpvalue\\\" in \\\"$(printf '%s' \"${A_out[@]}\")\\\"\\n\" else l_output2=\"$l_output2\\n - \\\"$l_kpname\\\" is incorrectly set to \\\"$l_fkpvalue\\\" in \\\"$(printf '%s' \"${A_out[@]}\")\\\" and should have a value of: \\\"$l_kpvalue\\\"\\n\" fi done < <(grep -Po -- \"^\\h*$l_kpname\\h*=\\h*\\H+\" \"${A_out[@]}\") else l_output2=\"$l_output2\\n - \\\"$l_kpname\\\" is not set in an included file\\n ** Note: \\\"$l_kpname\\\" May be set in a file that's ignored by load procedure **\\n\" fi } while IFS=\"=\" read -r l_kpname l_kpvalue; do # Assess and check parameters l_kpname=\"${l_kpname// /}\"; l_kpvalue=\"${l_kpvalue// /}\" if ! grep -Pqs '^\\h*0\\b' /sys/module/ipv6/parameters/disable && grep -q '^net.ipv6.' <<< \"$l_kpname\"; then l_output=\"$l_output\\n - IPv6 is disabled on the system, \\\"$l_kpname\\\" is not applicable\" else kernel_parameter_chk fi 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\" [ -n \"$l_output\" ] && echo -e \"\\n- Correctly set:\\n$l_output\\n\" 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 \" net.ipv4.conf.all.rp_filter = 1 net.ipv4.conf.default.rp_filter = 1 \" >> /etc/sysctl.d/60-netipv4_sysctl.conf Run the following commands to set the active kernel parameters: # { 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-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),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/15289" cmd : "#!/bin/bash { l_output=\"\" l_output2=\"\" 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)\" kernel_parameter_chk() { l_krp=\"$(sysctl \"$l_kpname\" | awk -F= '{print $2}' | xargs)\" # Check running configuration if [ \"$l_krp\" = \"$l_kpvalue\" ]; then l_output=\"$l_output\\n - \\\"$l_kpname\\\" is correctly set to \\\"$l_krp\\\" in the running configuration\" else l_output2=\"$l_output2\\n - \\\"$l_kpname\\\" is incorrectly set to \\\"$l_krp\\\" in the running configuration and should have a value of: \\\"$l_kpvalue\\\"\" 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_kpname\" ] && A_out+=([\"$l_kpar\"]=\"$l_file\") fi fi done < <(/usr/lib/systemd/systemd-sysctl --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_kpname\\b\" \"$l_ufwscf\" | xargs)\" l_kpar=\"${l_kpar//\\//.}\" [ \"$l_kpar\" = \"$l_kpname\" ] && 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_fkpvalue; do l_fkpname=\"${l_fkpname// /}\"; l_fkpvalue=\"${l_fkpvalue// /}\" if [ \"$l_fkpvalue\" = \"$l_kpvalue\" ]; then l_output=\"$l_output\\n - \\\"$l_kpname\\\" is correctly set to \\\"$l_fkpvalue\\\" in \\\"$(printf '%s' \"${A_out[@]}\")\\\"\\n\" else l_output2=\"$l_output2\\n - \\\"$l_kpname\\\" is incorrectly set to \\\"$l_fkpvalue\\\" in \\\"$(printf '%s' \"${A_out[@]}\")\\\" and should have a value of: \\\"$l_kpvalue\\\"\\n\" fi done < <(grep -Po -- \"^\\h*$l_kpname\\h*=\\h*\\H+\" \"${A_out[@]}\") else l_output2=\"$l_output2\\n - \\\"$l_kpname\\\" is not set in an included file\\n ** Note: \\\"$l_kpname\\\" May be set in a file that's ignored by load procedure **\\n\" fi } while IFS=\"=\" read -r l_kpname l_kpvalue; do # Assess and check parameters l_kpname=\"${l_kpname// /}\"; l_kpvalue=\"${l_kpvalue// /}\" if ! grep -Pqs '^\\h*0\\b' /sys/module/ipv6/parameters/disable && grep -q '^net.ipv6.' <<< \"$l_kpname\"; then l_output=\"$l_output\\n - IPv6 is disabled on the system, \\\"$l_kpname\\\" is not applicable\" else kernel_parameter_chk fi 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\" [ -n \"$l_output\" ] && echo -e \"\\n- Correctly set:\\n$l_output\\n\" 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 \" 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 command to set the active kernel parameters: # { sysctl -w net.ipv4.conf.all.accept_source_route=0 sysctl -w net.ipv4.conf.default.accept_source_route=0 sysctl -w net.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 \" 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: # { 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-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),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/15289" cmd : "#!/bin/bash { l_output=\"\" l_output2=\"\" 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)\" kernel_parameter_chk() { l_krp=\"$(sysctl \"$l_kpname\" | awk -F= '{print $2}' | xargs)\" # Check running configuration if [ \"$l_krp\" = \"$l_kpvalue\" ]; then l_output=\"$l_output\\n - \\\"$l_kpname\\\" is correctly set to \\\"$l_krp\\\" in the running configuration\" else l_output2=\"$l_output2\\n - \\\"$l_kpname\\\" is incorrectly set to \\\"$l_krp\\\" in the running configuration and should have a value of: \\\"$l_kpvalue\\\"\" 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_kpname\" ] && A_out+=([\"$l_kpar\"]=\"$l_file\") fi fi done < <(/usr/lib/systemd/systemd-sysctl --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_kpname\\b\" \"$l_ufwscf\" | xargs)\" l_kpar=\"${l_kpar//\\//.}\" [ \"$l_kpar\" = \"$l_kpname\" ] && 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_fkpvalue; do l_fkpname=\"${l_fkpname// /}\"; l_fkpvalue=\"${l_fkpvalue// /}\" if [ \"$l_fkpvalue\" = \"$l_kpvalue\" ]; then l_output=\"$l_output\\n - \\\"$l_kpname\\\" is correctly set to \\\"$l_fkpvalue\\\" in \\\"$(printf '%s' \"${A_out[@]}\")\\\"\\n\" else l_output2=\"$l_output2\\n - \\\"$l_kpname\\\" is incorrectly set to \\\"$l_fkpvalue\\\" in \\\"$(printf '%s' \"${A_out[@]}\")\\\" and should have a value of: \\\"$l_kpvalue\\\"\\n\" fi done < <(grep -Po -- \"^\\h*$l_kpname\\h*=\\h*\\H+\" \"${A_out[@]}\") else l_output2=\"$l_output2\\n - \\\"$l_kpname\\\" is not set in an included file\\n ** Note: \\\"$l_kpname\\\" May be set in a file that's ignored by load procedure **\\n\" fi } while IFS=\"=\" read -r l_kpname l_kpvalue; do # Assess and check parameters l_kpname=\"${l_kpname// /}\"; l_kpvalue=\"${l_kpvalue// /}\" if ! grep -Pqs '^\\h*0\\b' /sys/module/ipv6/parameters/disable && grep -q '^net.ipv6.' <<< \"$l_kpname\"; then l_output=\"$l_output\\n - IPv6 is disabled on the system, \\\"$l_kpname\\\" is not applicable\" else kernel_parameter_chk fi 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\" [ -n \"$l_output\" ] && echo -e \"\\n- Correctly set:\\n$l_output\\n\" 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 \" net.ipv4.conf.all.log_martians = 1 net.ipv4.conf.default.log_martians = 1 \" >> /etc/sysctl.d/60-netipv4_sysctl.conf Run the following command to set the active kernel parameters: # { sysctl -w net.ipv4.conf.all.log_martians=1 sysctl -w net.ipv4.conf.default.log_martians=1 sysctl -w net.ipv4.route.flush=1 } 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-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),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/15289" cmd : "#!/bin/bash { l_output=\"\" l_output2=\"\" 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)\" kernel_parameter_chk() { l_krp=\"$(sysctl \"$l_kpname\" | awk -F= '{print $2}' | xargs)\" # Check running configuration if [ \"$l_krp\" = \"$l_kpvalue\" ]; then l_output=\"$l_output\\n - \\\"$l_kpname\\\" is correctly set to \\\"$l_krp\\\" in the running configuration\" else l_output2=\"$l_output2\\n - \\\"$l_kpname\\\" is incorrectly set to \\\"$l_krp\\\" in the running configuration and should have a value of: \\\"$l_kpvalue\\\"\" 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_kpname\" ] && A_out+=([\"$l_kpar\"]=\"$l_file\") fi fi done < <(/usr/lib/systemd/systemd-sysctl --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_kpname\\b\" \"$l_ufwscf\" | xargs)\" l_kpar=\"${l_kpar//\\//.}\" [ \"$l_kpar\" = \"$l_kpname\" ] && 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_fkpvalue; do l_fkpname=\"${l_fkpname// /}\"; l_fkpvalue=\"${l_fkpvalue// /}\" if [ \"$l_fkpvalue\" = \"$l_kpvalue\" ]; then l_output=\"$l_output\\n - \\\"$l_kpname\\\" is correctly set to \\\"$l_fkpvalue\\\" in \\\"$(printf '%s' \"${A_out[@]}\")\\\"\\n\" else l_output2=\"$l_output2\\n - \\\"$l_kpname\\\" is incorrectly set to \\\"$l_fkpvalue\\\" in \\\"$(printf '%s' \"${A_out[@]}\")\\\" and should have a value of: \\\"$l_kpvalue\\\"\\n\" fi done < <(grep -Po -- \"^\\h*$l_kpname\\h*=\\h*\\H+\" \"${A_out[@]}\") else l_output2=\"$l_output2\\n - \\\"$l_kpname\\\" is not set in an included file\\n ** Note: \\\"$l_kpname\\\" May be set in a file that's ignored by load procedure **\\n\" fi } while IFS=\"=\" read -r l_kpname l_kpvalue; do # Assess and check parameters l_kpname=\"${l_kpname// /}\"; l_kpvalue=\"${l_kpvalue// /}\" if ! grep -Pqs '^\\h*0\\b' /sys/module/ipv6/parameters/disable && grep -q '^net.ipv6.' <<< \"$l_kpname\"; then l_output=\"$l_output\\n - IPv6 is disabled on the system, \\\"$l_kpname\\\" is not applicable\" else kernel_parameter_chk fi 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\" [ -n \"$l_output\" ] && echo -e \"\\n- Correctly set:\\n$l_output\\n\" fi }" expect : "(?i)^[\\s]*\\**[\\s]*pass:?[\\s]*\\**$" type : RPM_CHECK description : "3.4.1.1 Ensure nftables is installed" info : "nftables provides a new in-kernel packet classification framework that is based on a network-specific Virtual Machine (VM) and a new nft userspace command line tool. nftables reuses the existing Netfilter subsystems such as the existing hook infrastructure, the connection tracking system, NAT, userspace queuing and logging subsystem. nftables is a subsystem of the Linux kernel that 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 nftables # dnf install nftables Impact: Changing firewall settings while connected over the 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-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/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/15289" rpm : "nftables-0.0.0-0" operator : "gt" required : YES type : CMD_EXEC description : "3.4.1.2 Ensure a single firewall configuration utility is in use" info : "FirewallD - Is a firewall service daemon that provides a dynamic customizable host-based firewall with a D-Bus interface. Being dynamic, it enables creating, changing, and deleting the rules without the necessity to restart the firewall daemon each time the rules are changed NFTables - Includes the nft utility for configuration of the nftables subsystem of the Linux kernel Note: firewalld with nftables backend does not support passing custom nftables rules to firewalld, using the --direct option. In order to configure firewall rules for nftables, a firewall utility needs to be installed and active of the system. The use of more than one firewall utility may produce unexpected results." solution : "Run the following script to ensure that a single firewall utility is in use on the system: #!/usr/bin/env bash { l_output=\"\" l_output2=\"\" l_fwd_status=\"\" l_nft_status=\"\" l_fwutil_status=\"\" # Determine FirewallD utility Status rpm -q firewalld > /dev/null 2>&1 && l_fwd_status=\"$(systemctl is-enabled firewalld.service):$(systemctl is-active firewalld.service)\" # Determine NFTables utility Status rpm -q nftables > /dev/null 2>&1 && l_nft_status=\"$(systemctl is-enabled nftables.service):$(systemctl is-active nftables.service)\" l_fwutil_status=\"$l_fwd_status:$l_nft_status\" case $l_fwutil_status in enabled:active:masked:inactive|enabled:active:disabled:inactive) echo -e \"\n - FirewallD utility is in use, enabled and active\n - NFTables utility is correctly disabled or masked and inactive\n - no remediation required\" ;; masked:inactive:enabled:active|disabled:inactive:enabled:active) echo -e \"\n - NFTables utility is in use, enabled and active\n - FirewallD utility is correctly disabled or masked and inactive\n - no remediation required\" ;; enabled:active:enabled:active) echo -e \"\n - Both FirewallD and NFTables utilities are enabled and active\n - stopping and masking NFTables utility\" systemctl stop nftables && systemctl --now mask nftables ;; enabled:*:enabled:*) echo -e \"\n - Both FirewallD and NFTables utilities are enabled\n - remediating\" if [ \"$(awk -F: '{print $2}' <<< \"$l_fwutil_status\")\" = \"active\" ] && [ \"$(awk -F: '{print $4}' <<< \"$l_fwutil_status\")\" = \"inactive\" ]; then echo \" - masking NFTables utility\" systemctl stop nftables && systemctl --now mask nftables elif [ \"$(awk -F: '{print $4}' <<< \"$l_fwutil_status\")\" = \"active\" ] && [ \"$(awk -F: '{print $2}' <<< \"$l_fwutil_status\")\" = \"inactive\" ]; then echo \" - masking FirewallD utility\" systemctl stop firewalld && systemctl --now mask firewalld fi ;; *:active:*:active) echo -e \"\n - Both FirewallD and NFTables utilities are active\n - remediating\" if [ \"$(awk -F: '{print $1}' <<< \"$l_fwutil_status\")\" = \"enabled\" ] && [ \"$(awk -F: '{print $3}' <<< \"$l_fwutil_status\")\" != \"enabled\" ]; then echo \" - stopping and masking NFTables utility\" systemctl stop nftables && systemctl --now mask nftables elif [ \"$(awk -F: '{print $3}' <<< \"$l_fwutil_status\")\" = \"enabled\" ] && [ \"$(awk -F: '{print $1}' <<< \"$l_fwutil_status\")\" != \"enabled\" ]; then echo \" - stopping and masking FirewallD utility\" systemctl stop firewalld && systemctl --now mask firewalld fi ;; :enabled:active) echo -e \"\n - NFTables utility is in use, enabled, and active\n - FirewallD package is not installed\n - no remediation required\" ;; :) echo -e \"\n - Neither FirewallD or NFTables is installed.\n - remediating\n - installing NFTables\" dnf -q install nftables ;; *:*:) echo -e \"\n - NFTables package is not installed on the system\n - remediating\n - installing NFTables\" dnf -q install nftables ;; *) echo -e \"\n - Unable to determine firewall state\" ;; esac }" reference : "800-171|3.13.1,800-171|3.13.5,800-171|3.13.6,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/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/15289" cmd : "#!/bin/bash { l_output=\"\" l_output2=\"\" l_fwd_status=\"\" l_nft_status=\"\" l_fwutil_status=\"\" # Determine FirewallD utility Status rpm -q firewalld > /dev/null 2>&1 && l_fwd_status=\"$(systemctl is-enabled firewalld.service):$(systemctl is-active firewalld.service)\" # Determine NFTables utility Status rpm -q nftables > /dev/null 2>&1 && l_nft_status=\"$(systemctl is-enabled nftables.service):$(systemctl is-active nftables.service)\" l_fwutil_status=\"$l_fwd_status:$l_nft_status\" case $l_fwutil_status in enabled:active:masked:inactive|enabled:active:disabled:inactive) l_output=\"\\n - FirewallD utility is in use, enabled and active\\n - NFTables utility is correctly disabled or masked and inactive\" ;; masked:inactive:enabled:active|disabled:inactive:enabled:active) l_output=\"\\n - NFTables utility is in use, enabled and active\\n - FirewallD utility is correctly disabled or masked and inactive\" ;; enabled:active:enabled:active) l_output2=\"\\n - Both FirewallD and NFTables utilities are enabled and active\" ;; enabled:*:enabled:*) l_output2=\"\\n - Both FirewallD and NFTables utilities are enabled\" ;; *:active:*:active) l_output2=\"\\n - Both FirewallD and NFTables utilities are enabled\" ;; :enabled:active) l_output=\"\\n - NFTables utility is in use, enabled, and active\\n - FirewallD package is not installed\" ;; :) l_output2=\"\\n - Neither FirewallD or NFTables is installed.\" ;; *:*:) l_output2=\"\\n - NFTables package is not installed on the system\" ;; *) l_output2=\"\\n - Unable to determine firewall state\" ;; esac if [ -z \"$l_output2\" ]; then echo -e \"\\n- Audit Results:\\n ** Pass **\\n$l_output\\n\" else echo -e \"\\n- Audit Results:\\n ** Fail **\\n$l_output2\\n\" fi }" expect : "(?i)^[\\s]*\\**[\\s]*pass:?[\\s]*\\**$" type : CMD_EXEC description : "hook output" cmd : "/sbin/nft -n list ruleset | /bin/grep 'hook output'" expect : "type[\\s]+filter[\\s]+hook[\\s]+output[\\s]*" type : CMD_EXEC description : "hook input" cmd : "/sbin/nft -n list ruleset | /bin/grep 'hook input'" expect : "type[\\s]+filter[\\s]+hook[\\s]+input[\\s]*" type : CMD_EXEC description : "hook forward" cmd : "/sbin/nft -n list ruleset | /bin/grep 'hook forward'" expect : "type[\\s]+filter[\\s]+hook[\\s]+forward[\\s]*" description : "3.4.2.1 Ensure nftables base chains exist" info : "Chains are containers for rules. They exist in two kinds, base chains and regular chains. A base chain is an entry point for packets from the networking stack, a regular chain may be used as jump target and is used for better rule organization. If a base chain doesn't exist with a hook for input, forward, and delete, packets that would flow through those chains will not be touched by nftables." solution : "- IF not using FirewallD - Run the following command to create the base chains: # nft create chain inet { type filter hook <(input|forward|output)> priority 0 \; } Example: # nft create chain inet filter input { type filter hook input priority 0 \; } # nft create chain inet filter forward { type filter hook forward priority 0 \; } # nft create chain inet filter output { type filter hook output priority 0 \; } Impact: If configuring over ssh, creating a base chain with a policy of drop will cause loss of connectivity. Ensure that a rule allowing ssh has been added to the base chain prior to setting the base chain's policy to drop" reference : "800-171|3.13.1,800-171|3.13.5,800-171|3.13.6,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/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/15289" show_output : YES type : CMD_EXEC description : "3.4.2.2 Ensure host based firewall 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' && systemctl is-enabled nftables.service | grep -q 'enabled'; then echo -e \"\n - Error - Both FirewallD and NFTables are enabled\n - Please follow recommendation: \\\"Ensure a single firewall configuration utility is in use\\\"\" elif ! systemctl is-enabled firewalld.service | grep -q 'enabled' && ! systemctl is-enabled nftables.service | grep -q 'enabled'; then echo -e \"\n - Error - Neither FirewallD or NFTables is enabled\n - Please follow recommendation: \\\"Ensure a single firewall configuration utility is in use\\\"\" else if systemctl is-enabled firewalld.service | grep -q 'enabled' && ! systemctl is-enabled nftables.service | grep -q 'enabled'; then echo -e \"\n - FirewallD is in use on the system\" && l_hbfw=\"fwd\" elif ! systemctl is-enabled firewalld.service | grep -q 'enabled' && systemctl is-enabled nftables.service | grep -q 'enabled'; then echo -e \"\n - NFTables is in use on the system\" && l_hbfw=\"nft\" fi 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\" if [ \"$l_hbfw\" = \"fwd\" ]; then firewall-cmd --permanent --zone=trusted --add-interface=lo firewall-cmd --reload elif [ \"$l_hbfw\" = \"nft\" ]; then nft add rule inet filter input iif lo accept fi fi 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\" if [ \"$l_hbfw\" = \"fwd\" ]; then 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 elif [ \"$l_hbfw\" = \"nft\" ]; then nft create rule inet filter input ip saddr 127.0.0.0/8 counter drop fi 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\" if [ \"$l_hbfw\" = \"fwd\" ]; then 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 elif [ \"$l_hbfw\" = \"nft\" ]; then nft add rule inet filter input ip6 saddr ::1 counter drop fi fi fi fi }" reference : "800-171|3.13.1,800-171|3.13.5,800-171|3.13.6,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/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/15289" cmd : "#!/bin/bash { l_output=\"\" l_output2=\"\" if nft list ruleset | awk '/hook\\s+input\\s+/,/\\}\\s*(#.*)?$/' | grep -Pq -- '\\H+\\h+\"lo\"\\h+accept'; then l_output=\"$l_output - Network traffic to the loopback address is correctly set to accept\" else l_output2=\"$l_output2 - 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 - IPv4 network traffic from loopback address correctly set to drop\" else l_output2=\"$l_output2 - 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 - IPv6 network traffic from loopback address correctly set to drop\" else l_output2=\"$l_output2 - IPv6 network traffic from loopback address not set to drop\" fi fi if [ -z \"$l_output2\" ]; then echo -e \" - Audit Result: *** PASS *** $l_output\" else echo -e \" - Audit Result: *** FAIL *** $l_output2 - Correctly set: $l_output\" fi }" expect : "(?i)^[\\s]*\\**[\\s]*pass:?[\\s]*\\**$" type : CMD_EXEC description : "firewalld check - active" cmd : "/bin/systemctl is-active firewalld" expect : "^active$" type : CMD_EXEC description : "3.4.2.3 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. 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-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/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/15289" cmd : "/bin/firewall-cmd --list-all --zone=\"$(/bin/firewall-cmd --list-all | /bin/awk '/\\(active\\)/ { print $1 }')\" | /bin/grep -P -- '^\\h*(services:|ports:)'" expect : "^Manual Review Required$" severity : MEDIUM description : "3.4.2.3 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. To reduce the attack surface of a system, all services and ports should be blocked unless required NOTE: The identified firewall 'firewalld' was not found to be active and this check does not apply." 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-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/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/15289" type : CMD_EXEC description : "check if nftables.service is active" cmd : "/bin/systemctl is-active nftables.service" expect : "^active$" type : CMD_EXEC description : "nft list ruleset hook input icmp ct state" cmd : "/sbin/nft list ruleset | /bin/awk '/hook input/,/}/' | grep 'ct state'" expect : "^[\\s]*ip[\\s]+protocol[\\s]+icmp[\\s]+ct[\\s]+state[\\s]+established[\\s]+accept[\\s]*$" type : CMD_EXEC description : "nft list ruleset hook input tcp ct state" cmd : "/sbin/nft list ruleset | /bin/awk '/hook input/,/}/' | grep 'ct state'" expect : "^[\\s]*ip[\\s]+protocol[\\s]+tcp[\\s]+ct[\\s]+state[\\s]+established[\\s]+accept[\\s]*$" type : CMD_EXEC description : "nft list ruleset hook input udp ct state" cmd : "/sbin/nft list ruleset | /bin/awk '/hook input/,/}/' | grep 'ct state'" expect : "^[\\s]*ip[\\s]+protocol[\\s]+udp[\\s]+ct[\\s]+state[\\s]+established[\\s]+accept[\\s]*$" description : "3.4.2.4 Ensure nftables established connections are configured" info : "Configure the firewall rules for new outbound and established connections If rules are not in place for established connections, all packets will be dropped by the default policy preventing network usage." solution : "If NFTables utility is in use on your system: Configure nftables in accordance with site policy. The following commands will implement a policy to allow all established connections: # systemctl is-enabled nftables.service | grep -q 'enabled' && nft add rule inet filter input ip protocol tcp ct state established accept # systemctl is-enabled nftables.service | grep -q 'enabled' && nft add rule inet filter input ip protocol udp ct state established accept # systemctl is-enabled nftables.service | grep -q 'enabled' && nft add rule inet filter input ip protocol icmp ct state established accept" reference : "800-171|3.13.1,800-171|3.13.5,800-171|3.13.6,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/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/15289" show_output : YES description : "3.4.2.4 Ensure nftables established connections are configured" info : "Configure the firewall rules for new outbound and established connections If rules are not in place for established connections, all packets will be dropped by the default policy preventing network usage. NOTE: The identified firewall 'nftables' was not found to be active and this check does not apply." solution : "If NFTables utility is in use on your system: Configure nftables in accordance with site policy. The following commands will implement a policy to allow all established connections: # systemctl is-enabled nftables.service | grep -q 'enabled' && nft add rule inet filter input ip protocol tcp ct state established accept # systemctl is-enabled nftables.service | grep -q 'enabled' && nft add rule inet filter input ip protocol udp ct state established accept # systemctl is-enabled nftables.service | grep -q 'enabled' && nft add rule inet filter input ip protocol icmp ct state established accept" reference : "800-171|3.13.1,800-171|3.13.5,800-171|3.13.6,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/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/15289" type : CMD_EXEC description : "check if nftables.service is active" cmd : "/bin/systemctl is-active nftables.service" expect : "^active$" type : CMD_EXEC description : "nft list ruleset hook forward drop" cmd : "/sbin/nft list ruleset | /bin/grep 'hook forward'" expect : "policy[\\s]*drop" type : CMD_EXEC description : "nft list ruleset hook input drop" cmd : "/sbin/nft list ruleset | /bin/grep 'hook input'" expect : "policy[\\s]*drop" description : "3.4.2.5 Ensure nftables default deny firewall policy" info : "Base chain policy is the default verdict that will be applied to packets reaching the end of the chain. There are two policies: accept (Default) and drop. If the policy is set to accept the firewall will accept any packet that is not configured to be denied and the packet will continue traversing the network stack. It is easier to explicitly permit acceptable usage than to deny unacceptable usage. Note: Changing firewall settings while connected over the network can result in being locked out of the system." solution : "If NFTables utility is in use on your system: Run the following command for the base chains with the input, forward, and output hooks to implement a default DROP policy: # nft chain
{ policy drop \; } Example: # nft chain inet filter input { policy drop \; } # nft chain inet filter forward { policy drop \; } Impact: If configuring nftables over ssh, creating a base chain with a policy of drop will cause loss of connectivity. Ensure that a rule allowing ssh has been added to the base chain prior to setting the base chain's policy to drop" reference : "800-171|3.13.1,800-171|3.13.5,800-171|3.13.6,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/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/15289" show_output : YES description : "3.4.2.5 Ensure nftables default deny firewall policy" info : "Base chain policy is the default verdict that will be applied to packets reaching the end of the chain. There are two policies: accept (Default) and drop. If the policy is set to accept the firewall will accept any packet that is not configured to be denied and the packet will continue traversing the network stack. It is easier to explicitly permit acceptable usage than to deny unacceptable usage. Note: Changing firewall settings while connected over the network can result in being locked out of the system. NOTE: The identified firewall 'nftables' was not found to be active and this check does not apply." solution : "If NFTables utility is in use on your system: Run the following command for the base chains with the input, forward, and output hooks to implement a default DROP policy: # nft chain
{ policy drop \; } Example: # nft chain inet filter input { policy drop \; } # nft chain inet filter forward { policy drop \; } Impact: If configuring nftables over ssh, creating a base chain with a policy of drop will cause loss of connectivity. Ensure that a rule allowing ssh has been added to the base chain prior to setting the base chain's policy to drop" reference : "800-171|3.13.1,800-171|3.13.5,800-171|3.13.6,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/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/15289" type : RPM_CHECK description : "Check if cron is installed" rpm : "cron-0.0.0-0" operator : "gt" required : YES type : RPM_CHECK description : "Check if cronie is installed" rpm : "cronie-0.0.0-0" operator : "gt" required : YES type : CMD_EXEC description : "cron daemon is enabled" cmd : "/bin/systemctl is-enabled crond" expect : "^enabled$" type : CMD_EXEC description : "cron daemon is active" cmd : "/bin/systemctl is-active crond" expect : "^active$" description : "4.1.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 crond : # systemctl unmask crond # systemctl --now enable crond" reference : "800-171|3.4.2,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),ITSG-33|CM-6b.,LEVEL|1A,NESA|T3.2.1,SWIFT-CSCv1|2.3" see_also : "https://workbench.cisecurity.org/benchmarks/15289" show_output : YES description : "4.1.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 crond : # systemctl unmask crond # systemctl --now enable crond" reference : "800-171|3.4.2,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),ITSG-33|CM-6b.,LEVEL|1A,NESA|T3.2.1,SWIFT-CSCv1|2.3" see_also : "https://workbench.cisecurity.org/benchmarks/15289" type : RPM_CHECK description : "Check if cron is installed" rpm : "cron-0.0.0-0" operator : "gt" required : YES type : RPM_CHECK description : "Check if cronie is installed" rpm : "cronie-0.0.0-0" operator : "gt" required : YES type : FILE_CHECK description : "4.1.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 : "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-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/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/15289" file : "/etc/crontab" owner : "root" mask : "177" group : "root" description : "4.1.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 : "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-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/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/15289" type : RPM_CHECK description : "Check if cron is installed" rpm : "cron-0.0.0-0" operator : "gt" required : YES type : RPM_CHECK description : "Check if cronie is installed" rpm : "cronie-0.0.0-0" operator : "gt" required : YES type : FILE_CHECK description : "4.1.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 : "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-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/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/15289" file : "/etc/cron.hourly" owner : "root" mask : "077" group : "root" description : "4.1.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 : "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-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/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/15289" type : RPM_CHECK description : "Check if cron is installed" rpm : "cron-0.0.0-0" operator : "gt" required : YES type : RPM_CHECK description : "Check if cronie is installed" rpm : "cronie-0.0.0-0" operator : "gt" required : YES type : FILE_CHECK description : "4.1.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 : "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-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/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/15289" file : "/etc/cron.daily" owner : "root" mask : "077" group : "root" description : "4.1.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 : "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-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/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/15289" type : RPM_CHECK description : "Check if cron is installed" rpm : "cron-0.0.0-0" operator : "gt" required : YES type : RPM_CHECK description : "Check if cronie is installed" rpm : "cronie-0.0.0-0" operator : "gt" required : YES type : FILE_CHECK description : "4.1.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 : "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-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/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/15289" file : "/etc/cron.weekly" owner : "root" mask : "077" group : "root" description : "4.1.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 : "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-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/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/15289" type : RPM_CHECK description : "Check if cron is installed" rpm : "cron-0.0.0-0" operator : "gt" required : YES type : RPM_CHECK description : "Check if cronie is installed" rpm : "cronie-0.0.0-0" operator : "gt" required : YES type : FILE_CHECK description : "4.1.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 : "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-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/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/15289" file : "/etc/cron.monthly" owner : "root" mask : "077" group : "root" description : "4.1.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 : "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-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/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/15289" type : RPM_CHECK description : "Check if cron is installed" rpm : "cron-0.0.0-0" operator : "gt" required : YES type : RPM_CHECK description : "Check if cronie is installed" rpm : "cronie-0.0.0-0" operator : "gt" required : YES type : FILE_CHECK description : "4.1.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 : "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-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/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/15289" file : "/etc/cron.d" owner : "root" mask : "077" group : "root" description : "4.1.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 : "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-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/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/15289" type : RPM_CHECK description : "Check if cron is installed" rpm : "cron-0.0.0-0" operator : "gt" required : YES type : RPM_CHECK description : "Check if cronie is installed" rpm : "cronie-0.0.0-0" operator : "gt" required : YES type : FILE_CHECK description : "/etc/cron.deny file permissions" file : "/etc/cron.deny" owner : "root" mask : "7137" file_required : NO group : "root" type : FILE_CHECK description : "/etc/cron.allow file permissions" file : "/etc/cron.allow" owner : "root" mask : "7137" group : "root" description : "4.1.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 these are files in /var/spool/cron/crontabs 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 under the /var/spool/cron/crontabs directory. Users are not allowed to edit the files under that directory 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 there. 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 commands to: - Create /etc/cron.allow if it doesn't exist - Change owner or user root - Change group owner to group root - Change mode to 640 or more restrictive # [ ! -e \"/etc/cron.allow\" ] && touch /etc/cron.allow # chown root:root /etc/cron.allow # chmod u-x,g-wx,o-rwx /etc/cron.allow Run the following commands to: -IF- /etc/cron.deny exists: - Change owner or user root - Change group owner to group root - Change mode to 640 or more restrictive # [ -e \"/etc/cron.deny\" ] && chown root:root /etc/cron.deny # [ -e \"/etc/cron.deny\" ] && chmod u-x,g-wx,o-rwx /etc/cron.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-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/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/15289" show_output : YES description : "4.1.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 these are files in /var/spool/cron/crontabs 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 under the /var/spool/cron/crontabs directory. Users are not allowed to edit the files under that directory 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 there. 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 commands to: - Create /etc/cron.allow if it doesn't exist - Change owner or user root - Change group owner to group root - Change mode to 640 or more restrictive # [ ! -e \"/etc/cron.allow\" ] && touch /etc/cron.allow # chown root:root /etc/cron.allow # chmod u-x,g-wx,o-rwx /etc/cron.allow Run the following commands to: -IF- /etc/cron.deny exists: - Change owner or user root - Change group owner to group root - Change mode to 640 or more restrictive # [ -e \"/etc/cron.deny\" ] && chown root:root /etc/cron.deny # [ -e \"/etc/cron.deny\" ] && chmod u-x,g-wx,o-rwx /etc/cron.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-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/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/15289" 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 : "4.1.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-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/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/15289" show_output : YES description : "4.1.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-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/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/15289" type : RPM_CHECK description : "openssh-server is installed" rpm : "openssh-server-0.0.0-0" operator : "gt" required : YES type : CMD_EXEC description : "4.2.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) }" 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-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/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/15289" cmd : "#!/bin/bash { l_output=\"\" l_output2=\"\" unset a_sshdfiles && a_sshdfiles=() [ -e \"/etc/ssh/sshd_config\" ] && a_sshdfiles+=(\"$(stat -Lc '%n^%#a^%U^%G' \"/etc/ssh/sshd_config\")\") while IFS= read -r -d $'\\0' l_file; do [ -e \"$l_file\" ] && a_sshdfiles+=(\"$(stat -Lc '%n^%#a^%U^%G' \"$l_file\")\") done < <(find /etc/ssh/sshd_config.d -type f \\( -perm /077 -o ! -user root -o ! -group root \\) -print0) if (( ${#a_sshdfiles[@]} != 0 )); then perm_mask='0177' maxperm=\"$( printf '%o' $(( 0777 & ~$perm_mask)) )\" while IFS=\"^\" read -r l_file 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 <<< \"$(printf '%s\\n' \"${a_sshdfiles[@]}\")\" fi unset a_sshdfiles # If l_output2 is empty, we pass 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]*\\**$" timeout : "@FIND_TIMEOUT@" description : "4.2.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) }" 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-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/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/15289" type : RPM_CHECK description : "openssh-server is installed" rpm : "openssh-server-0.0.0-0" operator : "gt" required : YES type : FILE_CONTENT_CHECK_NOT description : "config file IgnoreRhosts setting" file : "/etc/ssh/sshd_config /etc/ssh/sshd_config.d/*.conf" regex : "^[\\s]*(?i)IgnoreRhosts(?-i)[\\s]" expect : "^[\\s]*(?i)IgnoreRhosts(?-i)[\\s]+\"?no\"?[\\s]*$" type : CMD_EXEC description : "sshd ignorerhosts 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 ^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 : "4.2.10 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 parameter above any Include 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-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),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/15289" show_output : YES description : "4.2.10 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 parameter above any Include 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-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),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/15289" type : RPM_CHECK description : "openssh-server is installed" rpm : "openssh-server-0.0.0-0" operator : "gt" required : YES type : CMD_EXEC description : "4.2.11 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-2 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-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/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/15289" 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 : "4.2.11 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-2 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-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/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/15289" type : RPM_CHECK description : "openssh-server is installed" rpm : "openssh-server-0.0.0-0" operator : "gt" required : YES type : FILE_CONTENT_CHECK_NOT description : "ssh config files - LoginGraceTime" file : "/etc/ssh/sshd_config /etc/ssh/sshd_config.d/*.conf" regex : "(?i)^\\h*LoginGraceTime\\h+" expect : "(?i)^\\h*LoginGraceTime\\h+\"?(0|6[1-9]|[7-9][0-9]|[1-9][0-9][0-9]+|[^1]m)\"?\\b" type : CMD_EXEC description : "sshd -T - LoginGraceTime" cmd : "/usr/sbin/sshd -T -C user=root -C host=\"$(hostname)\" -C addr=\"$(grep $(hostname) /etc/hosts | awk '{print $1}')\" | grep -i LoginGraceTime | /usr/bin/awk \'{print} END {if (NR == 0) print \"Configuration not found\"}\'" expect : "(?i)^logingracetime\\h+\"?([1-9]|[1-5][0-9]|60|1m)\"?\\b" description : "4.2.12 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 parameter above any Include entries as follows: LoginGraceTime 60 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-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/15289" show_output : YES description : "4.2.12 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 parameter above any Include entries as follows: LoginGraceTime 60 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-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/15289" type : RPM_CHECK description : "openssh-server is installed" rpm : "openssh-server-0.0.0-0" operator : "gt" required : YES type : CMD_EXEC description : "sshd loglevel 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 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$" type : FILE_CONTENT_CHECK description : "config file loglevel setting" file : "/etc/ssh/sshd_config /etc/ssh/sshd_config.d/*.conf" regex : "^[\\s]*(?i)LogLevel(?-i)[\\s]" expect : "^[\\s]*(?i)LogLevel(?-i)[\\s]+\"?(INFO|VERBOSE)\"?[\\s]*$" string_required : NO description : "4.2.13 Ensure sshd LogLevel is configured" info : "LogLevel gives the verbosity level that is used when logging messages from sshd. The possible values are: QUIET FATAL ERROR INFO VERBOSE DEBUG DEBUG1 DEBUG2 and DEBUG3 The default is INFO. DEBUG and DEBUG1 are equivalent. DEBUG2 and DEBUG3 each specify higher levels of debugging output. Note: Logging with a DEBUG level violates the privacy of users and is not recommended. 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 parameter above any Include entries as follows: LogLevel VERBOSE -OR- LogLevel INFO 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.3.1,800-171|3.3.2,800-171|3.3.6,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),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/15289" show_output : YES description : "4.2.13 Ensure sshd LogLevel is configured" info : "LogLevel gives the verbosity level that is used when logging messages from sshd. The possible values are: QUIET FATAL ERROR INFO VERBOSE DEBUG DEBUG1 DEBUG2 and DEBUG3 The default is INFO. DEBUG and DEBUG1 are equivalent. DEBUG2 and DEBUG3 each specify higher levels of debugging output. Note: Logging with a DEBUG level violates the privacy of users and is not recommended. 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 parameter above any Include entries as follows: LogLevel VERBOSE -OR- LogLevel INFO 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.3.1,800-171|3.3.2,800-171|3.3.6,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),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/15289" type : RPM_CHECK description : "openssh-server is installed" rpm : "openssh-server-0.0.0-0" operator : "gt" required : YES type : CMD_EXEC description : "4.2.14 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-2 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 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. - The default is handled system-wide by crypto-policies(7). Information about defaults, how to modify the defaults and how to customize existing policies with sub-policies are present in manual page update-crypto-policies(8)" reference : "800-171|3.1.13,800-171|3.5.2,800-171|3.13.8,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/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/15289" 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)\") f++; print $0} END {if (NR == 0) print \"Fail: no results returned\"; else if (f > 0) print \"Fail\"; else print \"Pass\" }' }" expect : "^Pass$" description : "4.2.14 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-2 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 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. - The default is handled system-wide by crypto-policies(7). Information about defaults, how to modify the defaults and how to customize existing policies with sub-policies are present in manual page update-crypto-policies(8)" reference : "800-171|3.1.13,800-171|3.5.2,800-171|3.13.8,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/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/15289" type : RPM_CHECK description : "openssh-server is installed" rpm : "openssh-server-0.0.0-0" operator : "gt" required : YES type : CMD_EXEC description : "sshd maxauthtries 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 ^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$" type : FILE_CONTENT_CHECK_NOT description : "config file maxauthtries setting" file : "/etc/ssh/sshd_config /etc/ssh/sshd_config.d/*.conf" regex : "^[\\s]*(?i)MaxAuthTries(?-i)[\\s]" expect : "^[\\s]*(?i)MaxAuthTries(?-i)[\\s]+\"?([5-9]|[1-9][0-9]+)\"?[\\s]*$" description : "4.2.15 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 parameter above any Include entries as follows: MaxAuthTries 4 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.3.1,800-171|3.3.2,800-171|3.3.6,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),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/15289" show_output : YES description : "4.2.15 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 parameter above any Include entries as follows: MaxAuthTries 4 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.3.1,800-171|3.3.2,800-171|3.3.6,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),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/15289" type : RPM_CHECK description : "openssh-server is installed" rpm : "openssh-server-0.0.0-0" operator : "gt" required : YES 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 : "4.2.16 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 parameter above any Include entries as follows: MaxSessions 10 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-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/15289" show_output : YES description : "4.2.16 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 parameter above any Include entries as follows: MaxSessions 10 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-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/15289" type : RPM_CHECK description : "openssh-server is installed" rpm : "openssh-server-0.0.0-0" operator : "gt" required : YES type : CMD_EXEC description : "sshd maxstartups 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 ^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$" type : FILE_CONTENT_CHECK_NOT description : "config file maxstartups setting" file : "/etc/ssh/sshd_config /etc/ssh/sshd_config.d/*.conf" regex : "^[\\s]*(?i)MaxStartups(?-i)[\\s]" expect : "^[\\s]*(?i)MaxStartups(?-i)[\\s]+\"?(((1[1-9]|[1-9][0-9][0-9]+):([0-9]+):([0-9]+))|(([0-9]+):(3[1-9]|[4-9][0-9]|[1-9][0-9][0-9]+):([0-9]+))|(([0-9]+):([0-9]+):(6[1-9]|[7-9][0-9]|[1-9][0-9][0-9]+)))\"?[\\s]*$" description : "4.2.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 parameter 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-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-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|5.1,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),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/15289" show_output : YES description : "4.2.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 parameter 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-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-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|5.1,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),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/15289" type : RPM_CHECK description : "openssh-server is installed" rpm : "openssh-server-0.0.0-0" operator : "gt" required : YES type : FILE_CONTENT_CHECK_NOT description : "config file permitemptypasswords setting" file : "/etc/ssh/sshd_config /etc/ssh/sshd_config.d/*.conf" regex : "^[\\s]*(?i)PermitEmptyPasswords(?-i)[\\s]" expect : "^[\\s]*(?i)PermitEmptyPasswords(?-i)[\\s]+\"?yes\"?[\\s]*$" type : CMD_EXEC description : "sshd permitemptypasswords 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 ^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 : "4.2.18 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 the /etc/ssh/sshd_config file to set the parameter above any Include entries as follows: PermitEmptyPasswords 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.5.2,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),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/15289" show_output : YES description : "4.2.18 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 the /etc/ssh/sshd_config file to set the parameter above any Include entries as follows: PermitEmptyPasswords 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.5.2,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),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/15289" type : RPM_CHECK description : "openssh-server is installed" rpm : "openssh-server-0.0.0-0" operator : "gt" required : YES type : CMD_EXEC description : "sshd permitrootlogin 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 ^permitrootlogin)\"; done | /bin/awk 'BEGIN {f=0} /permitrootlogin/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$" type : FILE_CONTENT_CHECK description : "config file permitrootlogin setting" file : "/etc/ssh/sshd_config /etc/ssh/sshd_config.d/*.conf" regex : "^[\\s]*(?i)PermitRootLogin(?-i)[\\s]" expect : "^[\\s]*(?i)PermitRootLogin(?-i)[\\s]+\"?no\"?[\\s]*$" min_occurrences : "1" string_required : NO description : "4.2.19 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 parameter above any Include entries as follows: PermitRootLogin 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.1.5,800-171|3.1.6,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/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/15289" show_output : YES description : "4.2.19 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 parameter above any Include entries as follows: PermitRootLogin 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.1.5,800-171|3.1.6,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/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/15289" type : RPM_CHECK description : "openssh-server is installed" rpm : "openssh-server-0.0.0-0" operator : "gt" required : YES type : CMD_EXEC description : "4.2.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 { l_output=\"\" l_output2=\"\" l_skgn=\"$(grep -Po -- '^(ssh_keys|_?ssh)\b' /etc/group)\" # Group designated to own openSSH keys l_skgid=\"$(awk -F: '($1 == \"'\"$l_skgn\"'\"){print $3}' /etc/group)\" # Get gid of group if [ -n \"$l_skgid\" ]; then l_agroup=\"(root|$l_skgn)\" && l_sgroup=\"$l_skgn\" && l_mfix=\"u-x,g-wx,o-rwx\" else l_agroup=\"root\" && l_sgroup=\"root\" && l_mfix=\"u-x,go-rwx\" fi unset a_skarr && a_skarr=() # Clear and initialize array if [ -d /etc/ssh ]; then while IFS= read -r -d $'\0' l_file; do # Loop to populate array if grep -Pq ':\h+OpenSSH\h+private\h+key\b' <<< \"$(file \"$l_file\")\"; then a_skarr+=(\"$(stat -Lc '%n^%#a^%U^%G^%g' \"$l_file\")\") fi done < <(find -L /etc/ssh -xdev -type f -print0) while IFS=\"^\" read -r l_file l_mode l_owner l_group l_gid; do l_out2=\"\" [ \"$l_gid\" = \"$l_skgid\" ] && l_pmask=\"0137\" || l_pmask=\"0177\" l_maxperm=\"$( printf '%o' $(( 0777 & ~$l_pmask )) )\" if [ $(( $l_mode & $l_pmask )) -gt 0 ]; then l_out2=\"$l_out2\n - Mode: \\\"$l_mode\\\" should be mode: \\\"$l_maxperm\\\" or more restrictive\n - Revoking excess permissions\" chmod \"$l_mfix\" \"$l_file\" fi if [ \"$l_owner\" != \"root\" ]; then l_out2=\"$l_out2\n - Owned by: \\\"$l_owner\\\" should be owned by \\\"root\\\"\n - Changing ownership to \\\"root\\\"\" chown root \"$l_file\" fi if [[ ! \"$l_group\" =~ $l_agroup ]]; then l_out2=\"$l_out2\n - Owned by group \\\"$l_group\\\" should be group owned by: \\\"${l_agroup//|/ or }\\\"\n - Changing group ownership to \\\"$l_sgroup\\\"\" chgrp \"$l_sgroup\" \"$l_file\" fi [ -n \"$l_out2\" ] && l_output2=\"$l_output2\n - File: \\\"$l_file\\\"$l_out2\" done <<< \"$(printf '%s\n' \"${a_skarr[@]}\")\" else l_output=\" - openSSH keys not found on the system\" fi unset a_skarr if [ -z \"$l_output2\" ]; then echo -e \"\n- No access changes required\n\" else echo -e \"\n- Remediation results:\n$l_output2\n\" 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-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/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/15289" cmd : "#!/bin/bash { l_output=\"\" l_output2=\"\" l_skgn=\"$(grep -Po -- '^(ssh_keys|_?ssh)\\b' /etc/group)\" # Group designated to own openSSH keys l_skgid=\"$(awk -F: '($1 == \"'\"$l_skgn\"'\"){print $3}' /etc/group)\" # Get gid of group [ -n \"$l_skgid\" ] && l_agroup=\"(root|$l_skgn)\" || l_agroup=\"root\" unset a_skarr && a_skarr=() # Clear and initialize array if [ -d /etc/ssh ]; then while IFS= read -r -d $'\\0' l_file; do # Loop to populate array if grep -Pq ':\\h+OpenSSH\\h+private\\h+key\\b' <<< \"$(file \"$l_file\")\"; then a_skarr+=(\"$(stat -Lc '%n^%#a^%U^%G^%g' \"$l_file\")\") fi done < <(find -L /etc/ssh -xdev -type f -print0) while IFS=\"^\" read -r l_file l_mode l_owner l_group l_gid; do l_out2=\"\" [ \"$l_gid\" = \"$l_skgid\" ] && l_pmask=\"0137\" || l_pmask=\"0177\" l_maxperm=\"$( printf '%o' $(( 0777 & ~$l_pmask )) )\" if [ $(( $l_mode & $l_pmask )) -gt 0 ]; then l_out2=\"$l_out2\\n - Mode: \\\"$l_mode\\\" should be mode: \\\"$l_maxperm\\\" or more restrictive\" fi if [ \"$l_owner\" != \"root\" ]; then l_out2=\"$l_out2\\n - Owned by: \\\"$l_owner\\\" should be owned by \\\"root\\\"\" fi if [[ ! \"$l_group\" =~ $l_agroup ]]; then l_out2=\"$l_out2\\n - Owned by group \\\"$l_group\\\" should be group owned by: \\\"${l_agroup//|/ or }\\\"\" fi 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_owner), and group owner ($l_group) configured\" fi done <<< \"$(printf '%s\\n' \"${a_skarr[@]}\")\" else l_output=\" - openSSH keys not found on the system\" fi unset a_skarr 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]*\\**$" timeout : "@FIND_TIMEOUT@" description : "4.2.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 { l_output=\"\" l_output2=\"\" l_skgn=\"$(grep -Po -- '^(ssh_keys|_?ssh)\b' /etc/group)\" # Group designated to own openSSH keys l_skgid=\"$(awk -F: '($1 == \"'\"$l_skgn\"'\"){print $3}' /etc/group)\" # Get gid of group if [ -n \"$l_skgid\" ]; then l_agroup=\"(root|$l_skgn)\" && l_sgroup=\"$l_skgn\" && l_mfix=\"u-x,g-wx,o-rwx\" else l_agroup=\"root\" && l_sgroup=\"root\" && l_mfix=\"u-x,go-rwx\" fi unset a_skarr && a_skarr=() # Clear and initialize array if [ -d /etc/ssh ]; then while IFS= read -r -d $'\0' l_file; do # Loop to populate array if grep -Pq ':\h+OpenSSH\h+private\h+key\b' <<< \"$(file \"$l_file\")\"; then a_skarr+=(\"$(stat -Lc '%n^%#a^%U^%G^%g' \"$l_file\")\") fi done < <(find -L /etc/ssh -xdev -type f -print0) while IFS=\"^\" read -r l_file l_mode l_owner l_group l_gid; do l_out2=\"\" [ \"$l_gid\" = \"$l_skgid\" ] && l_pmask=\"0137\" || l_pmask=\"0177\" l_maxperm=\"$( printf '%o' $(( 0777 & ~$l_pmask )) )\" if [ $(( $l_mode & $l_pmask )) -gt 0 ]; then l_out2=\"$l_out2\n - Mode: \\\"$l_mode\\\" should be mode: \\\"$l_maxperm\\\" or more restrictive\n - Revoking excess permissions\" chmod \"$l_mfix\" \"$l_file\" fi if [ \"$l_owner\" != \"root\" ]; then l_out2=\"$l_out2\n - Owned by: \\\"$l_owner\\\" should be owned by \\\"root\\\"\n - Changing ownership to \\\"root\\\"\" chown root \"$l_file\" fi if [[ ! \"$l_group\" =~ $l_agroup ]]; then l_out2=\"$l_out2\n - Owned by group \\\"$l_group\\\" should be group owned by: \\\"${l_agroup//|/ or }\\\"\n - Changing group ownership to \\\"$l_sgroup\\\"\" chgrp \"$l_sgroup\" \"$l_file\" fi [ -n \"$l_out2\" ] && l_output2=\"$l_output2\n - File: \\\"$l_file\\\"$l_out2\" done <<< \"$(printf '%s\n' \"${a_skarr[@]}\")\" else l_output=\" - openSSH keys not found on the system\" fi unset a_skarr if [ -z \"$l_output2\" ]; then echo -e \"\n- No access changes required\n\" else echo -e \"\n- Remediation results:\n$l_output2\n\" 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-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/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/15289" type : RPM_CHECK description : "openssh-server is installed" rpm : "openssh-server-0.0.0-0" operator : "gt" required : YES type : FILE_CONTENT_CHECK_NOT description : "config file permitemptypasswords setting" file : "/etc/ssh/sshd_config /etc/ssh/sshd_config.d/*.conf" regex : "^[\\s]*(?i)PermitEmptyPasswords(?-i)[\\s]" expect : "^[\\s]*(?i)PermitEmptyPasswords(?-i)[\\s]+\"?yes\"?[\\s]*$" type : CMD_EXEC description : "sshd permitemptypasswords 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 ^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 : "4.2.20 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 parameter above any Include entries as follows: PermitUserEnvironment no 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.4.6,800-171|3.4.7,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/15289" show_output : YES description : "4.2.20 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 parameter above any Include entries as follows: PermitUserEnvironment no 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.4.6,800-171|3.4.7,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/15289" type : RPM_CHECK description : "openssh-server is installed" rpm : "openssh-server-0.0.0-0" operator : "gt" required : YES type : FILE_CONTENT_CHECK_NOT description : "config file UsePAM setting" file : "/etc/ssh/sshd_config /etc/ssh/sshd_config.d/*.conf" regex : "^[\\s]*(?i)UsePAM(?-i)[\\s]" expect : "^[\\s]*(?i)UsePAM(?-i)[\\s]+\"?no\"?[\\s]*$" type : CMD_EXEC description : "sshd usepam 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 ^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 : "4.2.21 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 parameter above any Include entries as follows: UsePAM yes 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.5.2,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),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/15289" show_output : YES description : "4.2.21 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 parameter above any Include entries as follows: UsePAM yes 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.5.2,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),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/15289" type : RPM_CHECK description : "openssh-server is installed" rpm : "openssh-server-0.0.0-0" operator : "gt" required : YES type : FILE_CONTENT_CHECK_NOT description : "4.2.22 Ensure sshd crypto_policy is not set" 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/sshd # systemctl reload sshd" reference : "800-171|3.1.13,800-171|3.5.2,800-171|3.13.8,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/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/15289" file : "/etc/sysconfig/sshd" regex : "(?i)^[\\s]*CRYPTO_POLICY[\\s]*=" expect : "(?i)^[\\s]*CRYPTO_POLICY[\\s]*=[\\s]*.+$" description : "4.2.22 Ensure sshd crypto_policy is not set" 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/sshd # systemctl reload sshd" reference : "800-171|3.1.13,800-171|3.5.2,800-171|3.13.8,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/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/15289" type : RPM_CHECK description : "openssh-server is installed" rpm : "openssh-server-0.0.0-0" operator : "gt" required : YES type : CMD_EXEC description : "4.2.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 { l_output=\"\" l_output2=\"\" l_skgn=\"$(grep -Po -- '^(ssh_keys|_?ssh)\b' /etc/group)\" # Group designated to own openSSH keys l_skgid=\"$(awk -F: '($1 == \"'\"$l_skgn\"'\"){print $3}' /etc/group)\" # Get gid of group l_mfix=\"u-x,go-wx\" unset a_skarr && a_skarr=() # Clear and initialize array if [ -d /etc/ssh ]; then while IFS= read -r -d $'\0' l_file; do # Loop to populate array if grep -Pq ':\h+OpenSSH\h+(\H+\h+)public\h+key\b' <<< \"$(file \"$l_file\")\"; then a_skarr+=(\"$(stat -Lc '%n^%#a^%U^%G^%g' \"$l_file\")\") fi done < <(find -L /etc/ssh -xdev -type f -print0) while IFS=\"^\" read -r l_file l_mode l_owner l_group l_gid; do l_out2=\"\" l_pmask=\"0133\" l_maxperm=\"$( printf '%o' $(( 0777 & ~$l_pmask )) )\" if [ $(( $l_mode & $l_pmask )) -gt 0 ]; then l_out2=\"$l_out2\n - Mode: \\\"$l_mode\\\" should be mode: \\\"$l_maxperm\\\" or more restrictive\n - Revoking excess permissions\" chmod \"$l_mfix\" \"$l_file\" fi if [ \"$l_owner\" != \"root\" ]; then l_out2=\"$l_out2\n - Owned by: \\\"$l_owner\\\" should be owned by \\\"root\\\"\n - Changing ownership to \\\"root\\\"\" chown root \"$l_file\" fi if [[ ! \"$l_group\" =~ $l_agroup ]]; then l_out2=\"$l_out2\n - Owned by group \\\"$l_group\\\" should be group owned by: \\\"${l_agroup//|/ or }\\\"\n - Changing group ownership to \\\"$l_sgroup\\\"\" chgrp \"$l_sgroup\" \"$l_file\" fi [ -n \"$l_out2\" ] && l_output2=\"$l_output2\n - File: \\\"$l_file\\\"$l_out2\" done <<< \"$(printf '%s\n' \"${a_skarr[@]}\")\" else l_output=\" - openSSH keys not found on the system\" fi unset a_skarr if [ -z \"$l_output2\" ]; then echo -e \"\n- No access changes required\n\" else echo -e \"\n- Remediation results:\n$l_output2\n\" 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-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/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/15289" cmd : "#!/bin/bash { l_output=\"\" l_output2=\"\" l_skgn=\"$(grep -Po -- '^(ssh_keys|_?ssh)\\b' /etc/group)\" # Group designated to own openSSH public keys l_skgid=\"$(awk -F: '($1 == \"'\"$l_skgn\"'\"){print $3}' /etc/group)\" # Get gid of group [ -n \"$l_skgid\" ] && l_agroup=\"(root|$l_skgn)\" || l_agroup=\"root\" unset a_skarr && a_skarr=() # Clear and initialize array if [ -d /etc/ssh ]; then while IFS= read -r -d $'\\0' l_file; do # Loop to populate array if grep -Pq ':\\h+OpenSSH\\h+(\\H+\\h+)public\\h+key\\b' <<< \"$(file \"$l_file\")\"; then a_skarr+=(\"$(stat -Lc '%n^%#a^%U^%G^%g' \"$l_file\")\") fi done < <(find -L /etc/ssh -xdev -type f -print0) while IFS=\"^\" read -r l_file l_mode l_owner l_group l_gid; do echo \"File: \\\"$l_file\\\" Mode: \\\"$l_mode\\\" Owner: \\\"$l_owner\\\" Group: \\\"$l_group\\\" GID: \\\"$l_gid\\\"\" l_out2=\"\" l_pmask=\"0133\" l_maxperm=\"$( printf '%o' $(( 0777 & ~$l_pmask )) )\" if [ $(( $l_mode & $l_pmask )) -gt 0 ]; then l_out2=\"$l_out2 - Mode: \\\"$l_mode\\\" should be mode: \\\"$l_maxperm\\\" or more restrictive\" fi if [ \"$l_owner\" != \"root\" ]; then l_out2=\"$l_out2 - Owned by: \\\"$l_owner\\\" should be owned by \\\"root\\\"\" fi if [[ ! \"$l_group\" =~ $l_agroup ]]; then l_out2=\"$l_out2 - Owned by group \\\"$l_group\\\" should be group owned by: \\\"${l_agroup//|/ or }\\\"\" fi if [ -n \"$l_out2\" ]; then l_output2=\"$l_output2 - File: \\\"$l_file\\\"$l_out2\" else l_output=\"$l_output - File: \\\"$l_file\\\" - Correct: mode ($l_mode), owner ($l_owner), and group owner ($l_group) configured\" fi done <<< \"$(printf '%s ' \"${a_skarr[@]}\")\" else l_output=\" - openSSH keys not found on the system\" fi unset a_skarr if [ -z \"$l_output2\" ]; then echo -e \" - Audit Result: *** PASS *** - * Correctly set * : $l_output \" else echo -e \" - Audit Result: ** FAIL ** - * Reasons for audit failure * : $l_output2 \" [ -n \"$l_output\" ] && echo -e \" - * Correctly set * : $l_output \" fi }" expect : "(?i)^[\\s]*\\**[\\s]*pass:?[\\s]*\\**$" timeout : "@FIND_TIMEOUT@" description : "4.2.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 { l_output=\"\" l_output2=\"\" l_skgn=\"$(grep -Po -- '^(ssh_keys|_?ssh)\b' /etc/group)\" # Group designated to own openSSH keys l_skgid=\"$(awk -F: '($1 == \"'\"$l_skgn\"'\"){print $3}' /etc/group)\" # Get gid of group l_mfix=\"u-x,go-wx\" unset a_skarr && a_skarr=() # Clear and initialize array if [ -d /etc/ssh ]; then while IFS= read -r -d $'\0' l_file; do # Loop to populate array if grep -Pq ':\h+OpenSSH\h+(\H+\h+)public\h+key\b' <<< \"$(file \"$l_file\")\"; then a_skarr+=(\"$(stat -Lc '%n^%#a^%U^%G^%g' \"$l_file\")\") fi done < <(find -L /etc/ssh -xdev -type f -print0) while IFS=\"^\" read -r l_file l_mode l_owner l_group l_gid; do l_out2=\"\" l_pmask=\"0133\" l_maxperm=\"$( printf '%o' $(( 0777 & ~$l_pmask )) )\" if [ $(( $l_mode & $l_pmask )) -gt 0 ]; then l_out2=\"$l_out2\n - Mode: \\\"$l_mode\\\" should be mode: \\\"$l_maxperm\\\" or more restrictive\n - Revoking excess permissions\" chmod \"$l_mfix\" \"$l_file\" fi if [ \"$l_owner\" != \"root\" ]; then l_out2=\"$l_out2\n - Owned by: \\\"$l_owner\\\" should be owned by \\\"root\\\"\n - Changing ownership to \\\"root\\\"\" chown root \"$l_file\" fi if [[ ! \"$l_group\" =~ $l_agroup ]]; then l_out2=\"$l_out2\n - Owned by group \\\"$l_group\\\" should be group owned by: \\\"${l_agroup//|/ or }\\\"\n - Changing group ownership to \\\"$l_sgroup\\\"\" chgrp \"$l_sgroup\" \"$l_file\" fi [ -n \"$l_out2\" ] && l_output2=\"$l_output2\n - File: \\\"$l_file\\\"$l_out2\" done <<< \"$(printf '%s\n' \"${a_skarr[@]}\")\" else l_output=\" - openSSH keys not found on the system\" fi unset a_skarr if [ -z \"$l_output2\" ]; then echo -e \"\n- No access changes required\n\" else echo -e \"\n- Remediation results:\n$l_output2\n\" 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-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/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/15289" type : RPM_CHECK description : "openssh-server is installed" rpm : "openssh-server-0.0.0-0" operator : "gt" required : YES type : FILE_CONTENT_CHECK description : "Config file exist and is configured correctly" file : "/etc/ssh/sshd_config /etc/ssh/sshd_config.d/*.conf" regex : "^[\\s]*(?i)(Allow|Deny)(Users|Groups)(?-i)[\\s]" expect : "^[\\s]*(?i)(Allow|Deny)(Users|Groups)(?-i)[\\s]" min_occurrences : "1" string_required : NO type : CMD_EXEC description : "sshd access is configured" 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 : "4.2.4 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 parameter above any Include entries as follows: AllowUsers -OR- AllowGroups -OR- DenyUsers -OR- DenyGroups 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. If the Include location is not the default, /etc/ssh/sshd_config.d/*.conf the audit will need to be modified to account for the Include location used." 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-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/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/15289" show_output : YES description : "4.2.4 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 parameter above any Include entries as follows: AllowUsers -OR- AllowGroups -OR- DenyUsers -OR- DenyGroups 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. If the Include location is not the default, /etc/ssh/sshd_config.d/*.conf the audit will need to be modified to account for the Include location used." 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-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/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/15289" type : RPM_CHECK description : "openssh-server is installed" rpm : "openssh-server-0.0.0-0" operator : "gt" required : YES type : CMD_EXEC description : "4.2.5 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 parameter above any Include 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." reference : "800-171|3.1.9,800-53|AC-8,800-53r5|AC-8,GDPR|32.1.b,HIPAA|164.306(a)(1),ITSG-33|AC-8,LEVEL|1A,NESA|M1.3.6,TBA-FIISB|45.2.4" see_also : "https://workbench.cisecurity.org/benchmarks/15289" 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\"}' | 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 != \"/etc/issue.net\") f++; print $0} END {if (NR == 0) print \"Fail: no results returned\"; else if (f > 0) print \"Fail\"; else print \"Pass\" }' }" expect : "^Pass$" description : "4.2.5 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 parameter above any Include 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." reference : "800-171|3.1.9,800-53|AC-8,800-53r5|AC-8,GDPR|32.1.b,HIPAA|164.306(a)(1),ITSG-33|AC-8,LEVEL|1A,NESA|M1.3.6,TBA-FIISB|45.2.4" see_also : "https://workbench.cisecurity.org/benchmarks/15289" type : RPM_CHECK description : "openssh-server is installed" rpm : "openssh-server-0.0.0-0" operator : "gt" required : YES type : CMD_EXEC description : "4.2.6 Ensure sshd Ciphers are configured" info : "This variable limits the ciphers that SSH can use during communication. Note: - 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-2 compliant are: - 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,rijndael-cbc@lysator.liu.se 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-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/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/15289" 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 /usr/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-cbc|aes128-cbc|aes192-cbc|aes256-cbc|rijndael-cbc@lysator.liu.se)\") f++; print $0} END {if (NR == 0) print \"Fail: no results returned\"; else if (f > 0) print \"Fail\"; else print \"Pass\" }' }" expect : "^Pass$" description : "4.2.6 Ensure sshd Ciphers are configured" info : "This variable limits the ciphers that SSH can use during communication. Note: - 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-2 compliant are: - 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,rijndael-cbc@lysator.liu.se 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-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/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/15289" type : RPM_CHECK description : "openssh-server is installed" rpm : "openssh-server-0.0.0-0" operator : "gt" required : YES 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$" type : FILE_CONTENT_CHECK_NOT description : "ClientAliveCountMax configuration does not equal 0" file : "/etc/ssh/sshd_config /etc/ssh/sshd_config.d/*.conf" regex : "^\\h*ClientAliveCountMax\\h+\"?0\\b" expect : "^\\h*ClientAliveCountMax\\h+\"?0\\b" description : "4.2.7 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 parameters above any Include 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-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/15289" show_output : YES description : "4.2.7 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 parameters above any Include 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-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/15289" type : RPM_CHECK description : "openssh-server is installed" rpm : "openssh-server-0.0.0-0" operator : "gt" required : YES type : CMD_EXEC description : "sshd hostbasedauthentication 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 ^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$" type : FILE_CONTENT_CHECK_NOT description : "config file HostbasedAuthentication setting" file : "/etc/ssh/sshd_config /etc/ssh/sshd_config.d/*.conf" regex : "^[\\s]*(?i)HostbasedAuthentication(?-i)[\\s]" expect : "^[\\s]*(?i)HostbasedAuthentication(?-i)[\\s]+\"?yes\"?[\\s]*$" description : "4.2.9 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 parameter above any Include 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-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/15289" show_output : YES description : "4.2.9 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 parameter above any Include 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-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/15289" type : RPM_CHECK description : "4.3.1 Ensure sudo is installed" info : "sudo allows a permitted user to execute a command as the superuser or another user, as specified by the security policy. The invoking user's real (not effective) user ID is used to determine the user name with which to query the security policy. 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 # dnf install sudo" reference : "800-171|3.1.5,800-171|3.1.6,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/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/15289" rpm : "sudo-0.0.0-0" operator : "gt" required : YES type : CMD_EXEC description : "4.3.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 < PATH_TO_FILE > and add the following line: Defaults 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-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/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/15289" cmd : "/bin/grep -s -P '^[\\s]*Defaults[\\s]+(\[^#]+,[\\s]*)?use_pty' /etc/sudoers /etc/sudoers.d/* | /bin/awk '{print} END {if (NR != 0) print \"pass\" ; else print \"fail\"}'" expect : "^pass$" type : FILE_CONTENT_CHECK description : "4.3.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 or visudo -f and add the following line: Defaults logfile=\"\" Example Defaults logfile=\"/var/log/sudo.log\" 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. 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-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),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/15289" 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 : "4.3.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-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/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/15289" 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 : "4.3.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-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/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/15289" show_output : YES type : CMD_EXEC description : "4.3.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 the /etc/pam.d/su file, specifying the empty group: auth required pam_wheel.so use_uid group=sugroup" 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-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/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/15289" 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 : "4.4.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, pam-1.3.1-25 or latter is required" solution : "- IF - the version of PAM on the system is less that version pam-1.3.1-25 : Run the following command to update to the latest version of PAM : # dnf upgrade pam" reference : "800-171|3.5.1,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),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/15289" rpm : "pam-1.3.1-25" operator : "gte" type : RPM_CHECK description : "4.4.1.2 Ensure latest version of authselect is installed" info : "Authselect is a utility that simplifies the configuration of user authentication. Authselect offers ready-made profiles that can be universally used with all modern identity management systems You can create and deploy a custom profile by customizing one of the default profiles, the sssd, winbind, or the nis profile. This is particularly useful if Modifying a ready-made authselect profile is not enough for your needs. When you deploy a custom profile, the profile is applied to every user logging into the given host. This would be the recommended method, so that the existing profiles can remain unmodified. Updated versions of authselect include additional functionality Authselect makes testing and troubleshooting easy because it only modifies files in these directories: - /etc/nsswitch.conf - /etc/pam.d/* - /etc/dconf/db/distro.d/* To ensure the system has full functionality and access to the options covered by this Benchmark, authselect-1.2.6-1 or latter is required" solution : "Run the following command to install authselect : # dnf install authselect - IF - the version of authselect on the system is less that version authselect-1.2.6-1 : Run the following command to update to the latest version of authselect : # dnf upgrade authselect Impact: If local site customizations have been made to an authselect default or custom profile created with the --symlink-pam option, these customizations may be over-written by updating authselect. WARNING: Do not use authselect if: - your host is part of Linux Identity Management. Joining your host to an IdM domain with the ipa-client-install command automatically configures SSSD authentication on your host. - Your host is part of Active Directory via SSSD. Calling the realm join command to join your host to an Active Directory domain automatically configures SSSD authentication on your host. It is not recommended to change the authselect profiles configured by ipa-client-install or realm join. If you need to modify them, display the current settings before making any modifications, so you can revert back to them if necessary" reference : "800-171|3.1.8,800-53|AC-7a.,800-53r5|AC-7a.,CN-L3|8.1.4.1(b),CSF2.0|PR.AA-03,GDPR|32.1.b,HIPAA|164.306(a)(1),ITSG-33|AC-7a.,LEVEL|1A,NESA|T5.5.1,NIAv2|AM24,PCI-DSSv3.2.1|8.1.6,PCI-DSSv4.0|8.3.4,TBA-FIISB|45.1.2,TBA-FIISB|45.2.1,TBA-FIISB|45.2.2" see_also : "https://workbench.cisecurity.org/benchmarks/15289" rpm : "authselect-1.2.6-1" operator : "gte" type : CMD_EXEC description : "4.4.2.1 Ensure active authselect profile includes pam modules" info : "A custom profile can be created by copying and customizing one of the default profiles. The default profiles include: sssd, winbind, or the nis. This profile can then be customized to follow site specific requirements. You can select a profile for the authselect utility for a specific host. The profile will be applied to every user logging into the host. A custom profile is required to customize many of the pam options. Modifications made to a default profile may be overwritten during an update. When you deploy a profile, the profile is applied to every user logging into the given host" solution : "Perform the following to create a custom authselect profile, with the modules covered in this Benchmark correctly included in the custom profile template files Run the following command to create a custom authselect profile: # authselect create-profile Example: # authselect create-profile custom-profile -b sssd Run the following command to select a custom authselect profile: # authselect select custom/ {with-} {--force} Example: # authselect select custom/custom-profile --backup=PAM_CONFIG_BACKUP --force Note: - The PAM and authselect packages must be versions pam-1.3.1-25 and authselect-1.2.6-1 or newer - The example is based on a custom profile built (copied) from the the SSSD default authselect profile. - The example does not include the symlink option for the PAM or Metadata files. This is due to the fact that by linking the PAM files future updates to authselect may overwrite local site customizations to the custom profile - The --backup=PAM_CONFIG_BACKUP option will create a backup of the current config. The backup will be stored at /var/lib/authselect/backups/PAM_CONFIG_BACKUP - The --force option will force the overwrite of the existing files and automatically backup system files before writing any change unless the --nobackup option is set. - On a new system where authselect has not been configured. In this case, the --force option will force the selected authselect profile to be active and overwrite the existing files with files generated from the selected authselect profile's templates - On an existing system with a custom configuration. The --force option may be used, but ensure that you note the backup location included as your custom files will be overwritten. This will allow you to review the changes and add any necessary customizations to the template files for the authselect profile. After updating the templates, run the command authselect apply-changes to add these custom entries to the files in /etc/pam.d/ - IF - you receive an error ending with a message similar to: [error] Refusing to activate profile unless those changes are removed or overwrite is requested. Some unexpected changes to the configuration were detected. Use 'select' command instead. This error is caused when the previous configuration was not created by authselect but by other tool or by manual changes and the --force option will be required to enable the authselect profile. Impact: If local site customizations have been made to the authselect template or files in /etc/pam.d these custom entries should be added to the newly created custom profile before it's applied to the system. Please note that the order within the pam stacks is important when adding these entries. Specifically for the password stack, the use_authtok option is important, and should appear on all modules except for the first entry. Example: password requisite pam_pwquality.so local_users_only #<-- Top of password stack, doesn't include use_authtok password required pam_pwhistory.so use_authtok #<-- subsequent entry in password stack, includes use_authtok" reference : "800-171|3.11.2,800-171|3.11.3,800-171|3.12.2,800-53|CA-5,800-53|RA-1,800-53|RA-5,800-53r5|CA-5,800-53r5|RA-1,800-53r5|RA-5,800-53r5|RA-7,CSCv7|16.7,CSCv8|16.2,CSF|DE.CM-8,CSF|DE.DP-4,CSF|DE.DP-5,CSF|ID.GV-1,CSF|ID.GV-3,CSF|ID.RA-1,CSF|PR.IP-12,CSF|RS.CO-3,CSF|RS.MI-3,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|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,GDPR|32.1.b,GDPR|32.1.d,GDPR|32.2,HIPAA|164.306(a)(1),ISO/IEC-27001|A.12.6.1,ITSG-33|CA-5,ITSG-33|RA-1,ITSG-33|RA-5,LEVEL|1A,NESA|M1.2.2,NESA|M5.4.1,NESA|T7.7.1,NIAv2|NS9,PCI-DSSv3.2.1|6.1,PCI-DSSv4.0|6.3,PCI-DSSv4.0|6.3.1,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.7" see_also : "https://workbench.cisecurity.org/benchmarks/15289" cmd : "#!/bin/bash { l_output=\"\" l_output2=\"\" l_pam_profile=\"$(head -1 /etc/authselect/authselect.conf)\" if grep -Pq -- '^custom\\/' <<< \"$l_pam_profile\"; then l_pam_profile_path=\"/etc/authselect/$l_pam_profile\" else l_pam_profile_path=\"/usr/share/authselect/default/$l_pam_profile\" fi pam_faillock_chk() { l_out2=\"\" if ! grep -Pq -- '^\\h*auth\\h+(required|requisite)\\h+pam_faillock\\.so\\h+([^#\\n\\r]+\\h+)?preauth\\b' \"$l_authselect_file\"; then l_out2=\"$l_out2\\n - auth stack \\\"pam_faillock.so with preauth\\\" line missing in: \\\"$l_authselect_file\\\"\" fi if ! grep -Pq -- '^\\h*auth\\h+(required|requisite)\\h+pam_faillock\\.so\\h+([^#\\n\\r]+\\h+)?authfail\\b' \"$l_authselect_file\"; then l_out2=\"$l_out2\\n - auth stack \\\"pam_faillock.so with authfail\\\" line missing in: \\\"$l_authselect_file\\\"\" fi if ! grep -Pq -- '^\\h*account\\h+(required|requisite)\\h+pam_faillock\\.so\\b' \"$l_authselect_file\"; then l_out2=\"$l_out2\\n - account stack \\\"pam_faillock.so\\\" line missing in: \\\"$l_authselect_file\\\"\" fi if [ -z \"$l_out2\" ]; then l_output=\"$l_output\\n - \\\"pam_faillock\\\" is correctly listed in: \\\"$l_authselect_file\\\"\" else l_output2=\"$l_output2\\n$l_out2\" fi } pam_unix_chk() { l_out2=\"\" if ! grep -Pq -- '^\\h*auth\\h+(required|requisite|sufficient)\\h+pam_unix\\.so\\b' \"$l_authselect_file\"; then l_out2=\"$l_out2\\n - auth stack \\\"pam_unix.so\\\" line missing in: \\\"$l_authselect_file\\\"\" fi if ! grep -Pq -- '^\\h*account\\h+(required|requisite)\\h+pam_unix\\.so\\b' \"$l_authselect_file\"; then l_out2=\"$l_out2\\n - account stack \\\"pam_unix.so\\\" line missing in: \\\"$l_authselect_file\\\"\" fi if ! grep -Pq -- '^\\h*password\\h+(required|requisite|sufficient)\\h+pam_unix\\.so\\b' \"$l_authselect_file\"; then l_out2=\"$l_out2\\n - password stack \\\"pam_unix.so\\\" line missing in: \\\"$l_authselect_file\\\"\" fi if ! grep -Pq -- '^\\h*session\\h+(required|requisite)\\h+pam_unix\\.so\\b' \"$l_authselect_file\"; then l_out2=\"$l_out2\\n - session stack \\\"pam_unix.so\\\" line missing in: \\\"$l_authselect_file\\\"\" fi if [ -z \"$l_out2\" ]; then l_output=\"$l_output\\n - \\\"pam_unix\\\" is correctly listed in: \\\"$l_authselect_file\\\"\" else l_output2=\"$l_output2\\n$l_out2\" fi } pam_module_chk() { l_out2=\"\" if ! grep -Pq -- \"^\\h*password\\h+(required|requisite)\\h+$l_pam_module\\.so\\b\" \"$l_authselect_file\"; then l_out2=\"$l_out2\\n - password stack \\\"$l_pam_module.so\\\" line missing in: \\\"$l_authselect_file\\\"\" fi if [ -z \"$l_out2\" ]; then l_output=\"$l_output\\n - \\\"$l_pam_module\\\" is correctly listed in: \\\"$l_authselect_file\\\"\" else l_output2=\"$l_output2\\n$l_out2\" fi } for l_authselect_file in \"$l_pam_profile_path/password-auth\" \"$l_pam_profile_path/system-auth\"; do pam_faillock_chk pam_unix_chk l_pam_module=\"pam_pwquality\" pam_module_chk l_pam_module=\"pam_pwhistory\" pam_module_chk done #<<< \"$l_pam_profile_path/{password,system}-auth\" # Output results 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 : FILE_CONTENT_CHECK description : "Ensure at least one file named /etc/pam.d/system-auth exists and matches pattern ^\h*auth\h+(required|requisite)\h+([^#" file : "/etc/pam.d/system-auth" regex : "^\\h*auth\\h+(required|requisite)\\h+([^#\\r\\n]+\\h+)?pam_faillock\\.so\\h+([^#\\r\\n]+\\h+)?preauth\\b" expect : "^\\h*auth\\h+(required|requisite)\\h+([^#\\r\\n]+\\h+)?pam_faillock\\.so\\h+([^#\\r\\n]+\\h+)?preauth\\b" type : FILE_CONTENT_CHECK description : "Ensure at least one file named /etc/pam.d/system-auth exists and matches pattern ^\h*auth\h+(required|requisite)\h+([^#" file : "/etc/pam.d/system-auth" regex : "^\\h*auth\\h+(required|requisite)\\h+([^#\\r\\n]+\\h+)?pam_faillock\\.so\\h+([^#\\r\\n]+\\h+)?authfail\\b" expect : "^\\h*auth\\h+(required|requisite)\\h+([^#\\r\\n]+\\h+)?pam_faillock\\.so\\h+([^#\\r\\n]+\\h+)?authfail\\b" type : FILE_CONTENT_CHECK description : "Ensure at least one file named /etc/pam.d/password-auth exists and matches pattern ^\h*auth\h+(required|requisite)\h+([^#" file : "/etc/pam.d/password-auth" regex : "^\\h*auth\\h+(required|requisite)\\h+([^#\\r\\n]+\\h+)?pam_faillock\\.so\\h+([^#\\r\\n]+\\h+)?preauth\\b" expect : "^\\h*auth\\h+(required|requisite)\\h+([^#\\r\\n]+\\h+)?pam_faillock\\.so\\h+([^#\\r\\n]+\\h+)?preauth\\b" type : FILE_CONTENT_CHECK description : "Ensure at least one file named /etc/pam.d/password-auth exists and matches pattern ^\h*auth\h+(required|requisite)\h+([^#" file : "/etc/pam.d/password-auth" regex : "^\\h*auth\\h+(required|requisite)\\h+([^#\\r\\n]+\\h+)?pam_faillock\\.so\\h+([^#\\r\\n]+\\h+)?authfail\\b" expect : "^\\h*auth\\h+(required|requisite)\\h+([^#\\r\\n]+\\h+)?pam_faillock\\.so\\h+([^#\\r\\n]+\\h+)?authfail\\b" type : FILE_CONTENT_CHECK description : "Ensure at least one file named /etc/pam.d/system-auth exists and matches pattern ^\h*auth\h+(required|requisite)\h+([^#" file : "/etc/pam.d/system-auth" regex : "^\\h*account\\h+(required|requisite)\\h+([^#\\r\\n]+\\h+)?pam_faillock\\.so\\b" expect : "^\\h*account\\h+(required|requisite)\\h+([^#\\r\\n]+\\h+)?pam_faillock\\.so\\b" type : FILE_CONTENT_CHECK description : "D: Ensure at least one file named /etc/pam.d/password-auth exists and matches pattern ^\h*account\h+(required|requisite)\h+([^#\r\n]+\h+)?pam_faillock\.so\b" file : "/etc/pam.d/password-auth" regex : "^\\h*account\\h+(required|requisite)\\h+([^#\\r\\n]+\\h+)?pam_faillock\\.so\\b" expect : "^\\h*account\\h+(required|requisite)\\h+([^#\\r\\n]+\\h+)?pam_faillock\\.so\\b" description : "4.4.2.2 Ensure pam_faillock module is enabled" info : "The pam_faillock.so module maintains a list of failed authentication attempts per user during a specified interval and locks the account in case there were more than the configured number of consecutive failed authentications (this is defined by the deny parameter in the faillock configuration). It stores the failure records into per-user files in the tally directory. Locking out user IDs after n unsuccessful consecutive login attempts mitigates brute force password attacks against your systems." solution : "Run the following script to verify the pam_faillock.so lines exist in the profile templates: #!/usr/bin/env bash { l_module_name=\"faillock\" l_pam_profile=\"$(head -1 /etc/authselect/authselect.conf)\" if grep -Pq -- '^custom\/' <<< \"$l_pam_profile\"; then l_pam_profile_path=\"/etc/authselect/$l_pam_profile\" else l_pam_profile_path=\"/usr/share/authselect/default/$l_pam_profile\" fi grep -P -- \"\bpam_$l_module_name\.so\b\" \"$l_pam_profile_path\"/{password,system}-auth } Example Output with a custom profile named \"custom-profile\": /etc/authselect/custom/custom-profile/password-auth:auth required pam_faillock.so preauth silent {include if \"with-faillock\"} /etc/authselect/custom/custom-profile/password-auth:auth required pam_faillock.so authfail {include if \"with-faillock\"} /etc/authselect/custom/custom-profile/password-auth:account required pam_faillock.so {include if \"with-faillock\"} /etc/authselect/custom/custom-profile/system-auth:auth required pam_faillock.so preauth silent {include if \"with-faillock\"} /etc/authselect/custom/custom-profile/system-auth:auth required pam_faillock.so authfail {include if \"with-faillock\"} /etc/authselect/custom/custom-profile/system-auth:account required pam_faillock.so {include if \"with-faillock\"} Note: The lines may not include {include if \"with-faillock\"} - IF - the lines shown above are not returned, refer to the Recommendation \"Ensure active authselect profile includes pam modules\" to update the authselect profile template files to include the pam_faillock entries before continuing this remediation. - IF - the lines include {include if \"with-faillock\"} run the following command to enable the authselect with-faillock feature and update the files in /etc/pam.d to include pam_faillock.so : # authselect enable-feature with-faillock - IF - any of the pam_faillock lines exist without {include if \"with-faillock\"} run the following command to update the files in /etc/pam.d to include pam_faillock.so : # authselect apply-changes" 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-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|16.7,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),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/15289" show_output : YES type : FILE_CONTENT_CHECK description : "Ensure at least one file named /etc/pam.d/system-auth exists and matches pattern ^\h*auth\h+(required|requisite)\h+([^#" file : "/etc/pam.d/system-auth" regex : "(?i)^\\h*password\\h+(requisite|required)\\h+pam_pwquality\\.so\\b" expect : "(?i)^\\h*password\\h+(requisite|required)\\h+pam_pwquality\\.so\\b" type : FILE_CONTENT_CHECK description : "Ensure at least one file named /etc/pam.d/password-auth exists and matches pattern (?i)^\h*password\h+(requisite|required)\h+pam_pwquality\.so" file : "/etc/pam.d/password-auth" regex : "(?i)^\\h*password\\h+(requisite|required)\\h+pam_pwquality\\.so\\b" expect : "(?i)^\\h*password\\h+(requisite|required)\\h+pam_pwquality\\.so\\b" description : "4.4.2.3 Ensure pam_pwquality module is enabled" info : "The pam_pwquality.so module performs password quality checking. This module can be plugged into the password stack of a given service to provide strength-checking for passwords. The code was originally based on pam_cracklib module and the module is backwards compatible with its options. The action of this module is to prompt the user for a password and check its strength against a system dictionary and a set of rules for identifying poor choices. The first action is to prompt for a single password, check its strength and then, if it is considered strong, prompt for the password a second time (to verify that it was typed correctly on the first occasion). All being well, the password is passed on to subsequent modules to be installed as the new authentication token. Use of a unique, complex passwords helps to increase the time and resources required to compromise the password." solution : "Review the authselect profile templates: Run the following script to verify the pam_pwquality.so lines exist in the active profile templates: #!/usr/bin/env bash { l_module_name=\"pwquality\" l_pam_profile=\"$(head -1 /etc/authselect/authselect.conf)\" if grep -Pq -- '^custom\/' <<< \"$l_pam_profile\"; then l_pam_profile_path=\"/etc/authselect/$l_pam_profile\" else l_pam_profile_path=\"/usr/share/authselect/default/$l_pam_profile\" fi grep -P -- \"\bpam_$l_module_name\.so\b\" \"$l_pam_profile_path\"/{password,system}-auth } Example Output with a custom profile named \"custom-profile\": /etc/authselect/custom/custom-profile/password-auth:password requisite pam_pwquality.so local_users_only {include if \"with-pwquality\"} /etc/authselect/custom/custom-profile/system-auth:password requisite pam_pwquality.so local_users_only {include if \"with-pwquality\"} Note: The lines may not include {include if \"with-pwquality\"} - IF - the lines shown above are not returned, refer to the Recommendation \"Ensure active authselect profile includes pam modules\" to update the authselect profile template files to include the pam_pwquality entries before continuing this remediation. - IF - any of the pam_pwquality lines include {include if \"with-pwquality\"} run the following command to enable the authselect with-pwquality feature and update the files in /etc/pam.d to include `pam_pwquality: # authselect enable-feature with-pwquality - IF - any of the pam_pwquality lines exist without {include if \"with-pwquality\"} run the following command to update the files in /etc/pam.d to include pam_pwquality.so : # authselect apply-changes" reference : "800-171|3.5.2,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),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/15289" show_output : YES type : FILE_CONTENT_CHECK description : "Ensure at least one file named /etc/pam.d/password-auth exists and matches pattern (?i)^\h*password\h+(requisite|required)\h+pam_pwhistory\.so" file : "/etc/pam.d/password-auth" regex : "(?i)^\\h*password\\h+(requisite|required)\\h+pam_pwhistory\\.so\\b" expect : "(?i)^\\h*password\\h+(requisite|required)\\h+pam_pwhistory\\.so\\b" type : FILE_CONTENT_CHECK description : "Ensure at least one file named /etc/pam.d/system-auth exists and matches pattern (?i)^\h*password\h+(requisite|required)\h+pam_pwhistory\.so" file : "/etc/pam.d/system-auth" regex : "(?i)^\\h*password\\h+(requisite|required)\\h+pam_pwhistory\\.so\\b" expect : "(?i)^\\h*password\\h+(requisite|required)\\h+pam_pwhistory\\.so\\b" description : "4.4.2.4 Ensure pam_pwhistory module is enabled" info : "The pam_history.so module saves the last passwords for each user in order to force password change history and keep the user from alternating between the same password too frequently. 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." solution : "Run the following script to verify the pam_pwhistory.so lines exist in the profile templates: #!/usr/bin/env bash { l_module_name=\"pwhistory\" l_pam_profile=\"$(head -1 /etc/authselect/authselect.conf)\" if grep -Pq -- '^custom\/' <<< \"$l_pam_profile\"; then l_pam_profile_path=\"/etc/authselect/$l_pam_profile\" else l_pam_profile_path=\"/usr/share/authselect/default/$l_pam_profile\" fi grep -P -- \"\bpam_$l_module_name\.so\b\" \"$l_pam_profile_path\"/{password,system}-auth } Example Output with a custom profile named \"custom-profile\": /etc/authselect/custom/custom-profile/password-auth:password required pam_pwhistory.so use_authtok {include if \"with-pwhistory\"} /etc/authselect/custom/custom-profile/system-auth:password required pam_pwhistory.so use_authtok {include if \"with-pwhistory\"} Note: The lines may not include {include if \"with-pwhistory\"} - IF - the lines shown above are not returned, refer to the Recommendation \"Ensure active authselect profile includes pam modules\" to update the authselect profile template files to include the pam_pwhistory entries before continuing this remediation. - IF - the lines include {include if \"with-pwhistory\"} run the following command to enable the authselect with-pwhistory feature and update the files in /etc/pam.d to include pam_faillock.so : # authselect enable-feature with-pwhistory - IF - any of the pam_pwhistory lines exist without {include if \"with-pwhistory\"} run the following command to update the files in /etc/pam.d to include pam_pwhistory.so : # authselect apply-changes" reference : "800-171|3.5.2,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),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/15289" show_output : YES type : FILE_CONTENT_CHECK description : "Ensure at least one file named /etc/pam.d/system-auth exists and matches auth pattern" file : "/etc/pam.d/system-auth" regex : "^\\h*auth\\h+(required|requisite|sufficient)\\h+pam_unix\\.so\\b" expect : "^\\h*auth\\h+(required|requisite|sufficient)\\h+pam_unix\\.so\\b" type : FILE_CONTENT_CHECK description : "Ensure at least one file named /etc/pam.d/system-auth exists and matches account pattern" file : "/etc/pam.d/system-auth" regex : "^\\h*password\\h+(required|requisite|sufficient)\\h+pam_unix\\.so\\b" expect : "^\\h*password\\h+(required|requisite|sufficient)\\h+pam_unix\\.so\\b" type : FILE_CONTENT_CHECK description : "Ensure at least one file named /etc/pam.d/password-auth exists and matches account pattern" file : "/etc/pam.d/password-auth" regex : "^\\h*account\\h+(required|requisite)\\h+pam_unix\\.so\\b" expect : "^\\h*account\\h+(required|requisite)\\h+pam_unix\\.so\\b" type : FILE_CONTENT_CHECK description : "Ensure at least one file named /etc/pam.d/system-auth exists and matches account pattern" file : "/etc/pam.d/system-auth" regex : "^\\h*account\\h+(required|requisite)\\h+pam_unix\\.so\\b" expect : "^\\h*account\\h+(required|requisite)\\h+pam_unix\\.so\\b" type : FILE_CONTENT_CHECK description : "Ensure at least one file named /etc/pam.d/password-auth exists and matches session pattern" file : "/etc/pam.d/password-auth" regex : "^\\h*session\\h+(required|requisite)\\h+pam_unix\\.so\\b" expect : "^\\h*session\\h+(required|requisite)\\h+pam_unix\\.so\\b" type : FILE_CONTENT_CHECK description : "Ensure at least one file named /etc/pam.d/system-auth exists and matches session pattern" file : "/etc/pam.d/system-auth" regex : "^\\h*session\\h+(required|requisite)\\h+pam_unix\\.so\\b" expect : "^\\h*session\\h+(required|requisite)\\h+pam_unix\\.so\\b" type : FILE_CONTENT_CHECK description : "Ensure at least one file named /etc/pam.d/password-auth exists and matches auth pattern" file : "/etc/pam.d/password-auth" regex : "^\\h*auth\\h+(required|requisite|sufficient)\\h+pam_unix\\.so\\b" expect : "^\\h*auth\\h+(required|requisite|sufficient)\\h+pam_unix\\.so\\b" type : FILE_CONTENT_CHECK description : "Ensure at least one file named /etc/pam.d/password-auth exists and matches password pattern" file : "/etc/pam.d/password-auth" regex : "^\\h*password\\h+(required|requisite|sufficient)\\h+pam_unix\\.so\\b" expect : "^\\h*password\\h+(required|requisite|sufficient)\\h+pam_unix\\.so\\b" description : "4.4.2.5 Ensure pam_unix module is enabled" info : "The pam_unix.so module is the standard Unix authentication module. It uses standard calls from the system's libraries to retrieve and set account information as well as authentication. Usually this is obtained from the /etc/passwd and the /etc/shadow file as well if shadow is enabled. Requiring users to use authentication make it less likely that an attacker will be able to access the system." solution : "Run the following script to verify the pam_unix.so lines exist in the profile templates: #!/usr/bin/env bash { l_module_name=\"unix\" l_pam_profile=\"$(head -1 /etc/authselect/authselect.conf)\" if grep -Pq -- '^custom\/' <<< \"$l_pam_profile\"; then l_pam_profile_path=\"/etc/authselect/$l_pam_profile\" else l_pam_profile_path=\"/usr/share/authselect/default/$l_pam_profile\" fi grep -P -- \"\bpam_$l_module_name\.so\b\" \"$l_pam_profile_path\"/{password,system}-auth } Example Output with a custom profile named \"custom-profile\": /etc/authselect/custom/custom-profile/password-auth:auth sufficient pam_unix.so {if not \"without-nullok\":nullok} /etc/authselect/custom/custom-profile/password-auth:account required pam_unix.so /etc/authselect/custom/custom-profile/password-auth:password sufficient pam_unix.so sha512 shadow {if not \"without-nullok\":nullok} use_authtok remember=5 /etc/authselect/custom/custom-profile/password-auth:session required pam_unix.so /etc/authselect/custom/custom-profile/system-auth:auth sufficient pam_unix.so {if not \"without-nullok\":nullok} /etc/authselect/custom/custom-profile/system-auth:account required pam_unix.so /etc/authselect/custom/custom-profile/system-auth:password sufficient pam_unix.so sha512 shadow {if not \"without-nullok\":nullok} use_authtok /etc/authselect/custom/custom-profile/system-auth:session required pam_unix.so - IF - the lines shown above are not returned, refer to the Recommendation \"Ensure active authselect profile includes pam modules\" to update the authselect profile template files to include the pam_unix entries before continuing this remediation. Note: Arguments following pam_unix.so may be different than the example output" reference : "800-171|3.5.1,800-53|IA-2,800-53r5|IA-2,CN-L3|7.1.3.1(a),CN-L3|7.1.3.1(e),CN-L3|8.1.4.1(a),CN-L3|8.1.4.2(a),CN-L3|8.5.4.1(a),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),ITSG-33|IA-2,ITSG-33|IA-2a.,LEVEL|1A,NESA|T2.3.8,NESA|T5.3.1,NESA|T5.4.2,NESA|T5.5.1,NESA|T5.5.2,NESA|T5.5.3,NIAv2|AM2,NIAv2|AM8,NIAv2|AM14b,QCSC-v1|5.2.2,QCSC-v1|13.2,TBA-FIISB|35.1,TBA-FIISB|36.1" see_also : "https://workbench.cisecurity.org/benchmarks/15289" show_output : YES type : FILE_CONTENT_CHECK description : "faillock.conf - deny" file : "/etc/security/faillock.conf" regex : "(?i)^\\h*deny\\h*=\\h*@PASSWORD_LOCKOUT@\\b" expect : "(?i)^\\h*deny\\h*=\\h*@PASSWORD_LOCKOUT@\\b" type : FILE_CONTENT_CHECK description : "system-auth / password-auth - deny" file : "/etc/pam.d/system-auth /etc/pam.d/password-auth" regex : "^\\h*auth\\h+(requisite|required|sufficient)\\h+pam_faillock\\.so\\h+([^#\\r]+\\h+)?deny\\h*=" expect : "^\\h*auth\\h+(requisite|required|sufficient)\\h+pam_faillock\\.so\\h+([^#\\r]+\\h+)?deny\\h*=\\h*@PASSWORD_LOCKOUT@\\b" string_required : NO description : "4.4.3.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 Run the following script to remove the deny argument from the pam_faillock.so module in the PAM files: #!/usr/bin/env bash { for l_pam_file in system-auth password-auth; do l_authselect_file=\"/etc/authselect/$(head -1 /etc/authselect/authselect.conf | grep 'custom/')/$l_pam_file\" sed -ri 's/(^\s*auth\s+(requisite|required|sufficient)\s+pam_faillock\.so.*)(\s+deny\s*=\s*\S+)(.*$)/\1\4/' \"$l_authselect_file\" done authselect apply-changes }" reference : "800-171|3.1.1,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/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/15289" show_output : YES type : FILE_CONTENT_CHECK description : "faillock.conf - unlock time" 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 : "system-auth / password-auth - unlock time" file : "/etc/pam.d/system-auth /etc/pam.d/password-auth" regex : "^\\h*auth\\h+(requisite|required|sufficient)\\h+pam_faillock\\.so\\h+([^#\\r]+\\h+)?unlock_time\\h*=" expect : "^\\h*auth\\h+(requisite|required|sufficient)\\h+pam_faillock\\.so\\h+([^#\\r]+\\h+)?unlock_time\\h*=\\h*@PASSWORD_UNLOCK_TIME@\\b" string_required : NO description : "4.4.3.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. Note: - The default directory that pam_faillock uses is usually cleared on system boot so the access will be also re-enabled after system reboot. If that is undesirable a different tally directory must be set with the dir option. - 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 and update or add the following line: unlock_time = 900 Run the following script to remove the unlock_time argument from the pam_faillock.so module in the PAM files: #!/usr/bin/env bash { for l_pam_file in system-auth password-auth; do l_authselect_file=\"/etc/authselect/$(head -1 /etc/authselect/authselect.conf | grep 'custom/')/$l_pam_file\" sed -ri 's/(^\s*auth\s+(requisite|required|sufficient)\s+pam_faillock\.so.*)(\s+unlock_time\s*=\s*\S+)(.*$)/\1\4/' \"$l_authselect_file\" done authselect apply-changes } `` 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-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/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/15289" show_output : YES type : FILE_CONTENT_CHECK description : "pam.d" file : "/etc/pam.d/system-auth /etc/pam.d/password-auth" regex : "^\\h*password\\h+(requisite|required|sufficient)\\h+pam_pwquality\\.so\\h+([^#\\r]+\\h+)?difok\\h*=" expect : "^\\h*password\\h+(requisite|required|sufficient)\\h+pam_pwquality\\.so\\h+([^#\\r]+\\h+)?difok\\h*=\\h*@PASSWORD_DIFOK@\\b" string_required : NO type : FILE_CONTENT_CHECK description : "pwquality - difok" file : "/etc/security/pwquality.conf /etc/security/pwquality.conf.d/*.conf" regex : "(?i)^\\h*difok\\h*=" expect : "(?i)^\\h*difok\\h*=\\h*@PASSWORD_DIFOK@\\b" min_occurrences : "1" string_required : NO description : "4.4.3.2.1 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 : "Edit or add the following line in /etc/security/pwquality.conf to a value of 2 or more and meets local site policy: difok = 2 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: Example: # sed -ri 's/^\s*difok\s*=/# &/' /etc/security/pwquality.conf # printf '\n%s' \"difok = 2\" >> /etc/security/pwquality.conf.d/50-pwdifok.conf Run the following script to remove setting difok on the pam_pwquality.so module in the PAM files: #!/usr/bin/env bash { for l_pam_file in system-auth password-auth; do l_authselect_file=\"/etc/authselect/$(head -1 /etc/authselect/authselect.conf | grep 'custom/')/$l_pam_file\" sed -ri 's/(^\s*password\s+(requisite|required|sufficient)\s+pam_pwquality\.so.*)(\s+difok\s*=\s*\S+)(.*$)/\1\4/' \"$l_authselect_file\" done authselect apply-changes }" reference : "800-171|3.5.2,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),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/15289" show_output : YES type : FILE_CONTENT_CHECK description : "pwquality - minlen" file : "/etc/security/pwquality.conf /etc/security/pwquality.conf.d/*.conf" regex : "(?i)^\\h*minlen\\h*=" expect : "(?i)^\\h*minlen\\h*=\\h*@PASSWORD_MINIMUM_LENGTH@\\b" min_occurrences : "1" string_required : NO type : FILE_CONTENT_CHECK description : "pam.d" file : "/etc/pam.d/system-auth /etc/pam.d/password-auth" regex : "^\\h*password\\h+(requisite|required|sufficient)\\h+pam_pwquality\\.so\\h+([^#\\r]+\\h+)?minlen\\h*=" expect : "^\\h*password\\h+(requisite|required|sufficient)\\h+pam_pwquality\\.so\\h+([^#\\r]+\\h+)?minlen\\h*=\\h*@PASSWORD_MINIMUM_LENGTH@\\b" string_required : NO description : "4.4.3.2.2 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 password length of 14 or more characters. Ensure that password length conforms to local site policy: Example: # sed -ri 's/^\s*minlen\s*=/# &/' /etc/security/pwquality.conf # printf '\n%s' \"minlen = 14\" >> /etc/security/pwquality.conf.d/50-pwlength.conf Run the following script to remove setting minlen on the pam_pwquality.so module in the PAM files: #!/usr/bin/env bash { for l_pam_file in system-auth password-auth; do l_authselect_file=\"/etc/authselect/$(head -1 /etc/authselect/authselect.conf | grep 'custom/')/$l_pam_file\" sed -ri 's/(^\s*password\s+(requisite|required|sufficient)\s+pam_pwquality\.so.*)(\s+minlen\s*=\s*[0-9]+)(.*$)/\1\4/' \"$l_authselect_file\" done authselect apply-changes }" reference : "800-171|3.5.2,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),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/15289" show_output : YES type : FILE_CONTENT_CHECK description : "minclass" file : "/etc/security/pwquality.conf /etc/security/pwquality.conf.d/*.conf" regex : "^[\\s]*minclass[\\s]*=" expect : "^[\\s]*minclass[\\s]*=[\\s]*@PASSWORD_MINCLASS@[\\s]*$" min_occurrences : "1" string_required : NO type : FILE_CONTENT_CHECK description : "4.4.3.2.3 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 Run the following script to remove setting minclass dcredit ucredit lcredit and ocredit on the pam_pwquality.so module in the PAM files #!/usr/bin/env bash { for l_pam_file in system-auth password-auth; do l_authselect_file=\"/etc/authselect/$(head -1 /etc/authselect/authselect.conf | grep 'custom/')/$l_pam_file\" sed -ri 's/(^\s*password\s+(requisite|required|sufficient)\s+pam_pwquality\.so.*)(\s+minclass\s*=\s*\S+)(.*$)/\1\4/' \"$l_authselect_file\" sed -ri 's/(^\s*password\s+(requisite|required|sufficient)\s+pam_pwquality\.so.*)(\s+dcredit\s*=\s*\S+)(.*$)/\1\4/' \"$l_authselect_file\" sed -ri 's/(^\s*password\s+(requisite|required|sufficient)\s+pam_pwquality\.so.*)(\s+ucredit\s*=\s*\S+)(.*$)/\1\4/' \"$l_authselect_file\" sed -ri 's/(^\s*password\s+(requisite|required|sufficient)\s+pam_pwquality\.so.*)(\s+lcredit\s*=\s*\S+)(.*$)/\1\4/' \"$l_authselect_file\" sed -ri 's/(^\s*password\s+(requisite|required|sufficient)\s+pam_pwquality\.so.*)(\s+ocredit\s*=\s*\S+)(.*$)/\1\4/' \"$l_authselect_file\" done authselect apply-changes }" reference : "800-171|3.5.2,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),ITSG-33|IA-5(1),LEVEL|1M,NESA|T5.2.3,QCSC-v1|5.2.2,QCSC-v1|13.2,SWIFT-CSCv1|4.1" see_also : "https://workbench.cisecurity.org/benchmarks/15289" file : "/etc/security/pwquality.conf /etc/security/pwquality.conf.d/*.conf" regex : "^[\\s]*minclass[\\s]*=" expect : "^[\\s]*minclass[\\s]*=[\\s]*@PASSWORD_MINCLASS@[\\s]*$" min_occurrences : "1" string_required : NO type : FILE_CONTENT_CHECK description : "ocredit" file : "/etc/security/pwquality.conf /etc/security/pwquality.conf.d/*.conf" regex : "^[\\s]*ocredit[\\s]*=" expect : "^[\\s]*ocredit[\\s]*=[\\s]*@PASSWORD_OCREDIT@[\\s]*$" min_occurrences : "1" string_required : NO type : FILE_CONTENT_CHECK description : "ucredit" file : "/etc/security/pwquality.conf /etc/security/pwquality.conf.d/*.conf" regex : "^[\\s]*ucredit[\\s]*=" expect : "^[\\s]*ucredit[\\s]*=[\\s]*@PASSWORD_UCREDIT@[\\s]*$" min_occurrences : "1" string_required : NO type : FILE_CONTENT_CHECK description : "lcredit" file : "/etc/security/pwquality.conf /etc/security/pwquality.conf.d/*.conf" regex : "^[\\s]*lcredit[\\s]*=" expect : "^[\\s]*lcredit[\\s]*=[\\s]*@PASSWORD_LCREDIT@[\\s]*$" min_occurrences : "1" string_required : NO type : FILE_CONTENT_CHECK description : "dcredit" file : "/etc/security/pwquality.conf /etc/security/pwquality.conf.d/*.conf" regex : "^[\\s]*dcredit[\\s]*=" expect : "^[\\s]*dcredit[\\s]*=[\\s]*@PASSWORD_DCREDIT@[\\s]*$" min_occurrences : "1" string_required : NO description : "4.4.3.2.3 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 Run the following script to remove setting minclass dcredit ucredit lcredit and ocredit on the pam_pwquality.so module in the PAM files #!/usr/bin/env bash { for l_pam_file in system-auth password-auth; do l_authselect_file=\"/etc/authselect/$(head -1 /etc/authselect/authselect.conf | grep 'custom/')/$l_pam_file\" sed -ri 's/(^\s*password\s+(requisite|required|sufficient)\s+pam_pwquality\.so.*)(\s+minclass\s*=\s*\S+)(.*$)/\1\4/' \"$l_authselect_file\" sed -ri 's/(^\s*password\s+(requisite|required|sufficient)\s+pam_pwquality\.so.*)(\s+dcredit\s*=\s*\S+)(.*$)/\1\4/' \"$l_authselect_file\" sed -ri 's/(^\s*password\s+(requisite|required|sufficient)\s+pam_pwquality\.so.*)(\s+ucredit\s*=\s*\S+)(.*$)/\1\4/' \"$l_authselect_file\" sed -ri 's/(^\s*password\s+(requisite|required|sufficient)\s+pam_pwquality\.so.*)(\s+lcredit\s*=\s*\S+)(.*$)/\1\4/' \"$l_authselect_file\" sed -ri 's/(^\s*password\s+(requisite|required|sufficient)\s+pam_pwquality\.so.*)(\s+ocredit\s*=\s*\S+)(.*$)/\1\4/' \"$l_authselect_file\" done authselect apply-changes }" reference : "800-171|3.5.2,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),ITSG-33|IA-5(1),LEVEL|1M,NESA|T5.2.3,QCSC-v1|5.2.2,QCSC-v1|13.2,SWIFT-CSCv1|4.1" see_also : "https://workbench.cisecurity.org/benchmarks/15289" show_output : YES type : FILE_CONTENT_CHECK description : "pwquality - maxrepeat" file : "/etc/security/pwquality.conf /etc/security/pwquality.conf.d/*.conf" regex : "(?i)^\\h*maxrepeat\\h*=" expect : "(?i)^\\h*maxrepeat\\h*=\\h*@PASSWORD_MAXREPEAT@\\b" min_occurrences : "1" string_required : NO type : FILE_CONTENT_CHECK description : "pam.d" file : "/etc/pam.d/system-auth /etc/pam.d/password-auth" regex : "(?i)^\\h*password\\h+(requisite|required|sufficient)\\h+pam_pwquality\\.so\\h+([^#\\r]+\\h+)?maxrepeat\\h*=" expect : "(?i)^\\h*password\\h+(requisite|required|sufficient)\\h+pam_pwquality\\.so\\h+([^#\\r]+\\h+)?maxrepeat\\h*=\\h*@PASSWORD_MAXREPEAT@\\b" string_required : NO description : "4.4.3.2.4 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 Run the following script to remove setting maxrepeat on the pam_pwquality.so module in the PAM files: #!/usr/bin/env bash { for l_pam_file in system-auth password-auth; do l_authselect_file=\"/etc/authselect/$(head -1 /etc/authselect/authselect.conf | grep 'custom/')/$l_pam_file\" sed -ri 's/(^\s*password\s+(requisite|required|sufficient)\s+pam_pwquality\.so.*)(\s+maxrepeat\s*=\s*\S+)(.*$)/\1\4/' \"$l_authselect_file\" done authselect apply-changes }" reference : "800-171|3.5.2,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),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/15289" show_output : YES type : FILE_CONTENT_CHECK description : "pwquality - maxsequence" file : "/etc/security/pwquality.conf /etc/security/pwquality.conf.d/*.conf" regex : "(?i)^\\h*maxsequence\\h*=" expect : "(?i)^\\h*maxsequence\\h*=\\h*@PASSWORD_MAXSEQUENCE@\\b" min_occurrences : "1" string_required : NO type : FILE_CONTENT_CHECK description : "pam.d" file : "/etc/pam.d/system-auth /etc/pam.d/password-auth" regex : "(?i)^\\h*password\\h+(requisite|required|sufficient)\\h+pam_pwquality\\.so\\h+([^#\\r]+\\h+)?maxsequence\\h*=" expect : "(?i)^\\h*password\\h+(requisite|required|sufficient)\\h+pam_pwquality\\.so\\h+([^#\\r]+\\h+)?maxsequence\\h*=\\h*@PASSWORD_MAXSEQUENCE@\\b" string_required : NO description : "4.4.3.2.5 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 Run the following script to remove setting maxsequence on the pam_pwquality.so module in the PAM files: #!/usr/bin/env bash { for l_pam_file in system-auth password-auth; do l_authselect_file=\"/etc/authselect/$(head -1 /etc/authselect/authselect.conf | grep 'custom/')/$l_pam_file\" sed -ri 's/(^\s*password\s+(requisite|required|sufficient)\s+pam_pwquality\.so.*)(\s+maxsequence\s*=\s*\S+)(.*$)/\1\4/' \"$l_authselect_file\" done authselect apply-changes }" reference : "800-171|3.5.2,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),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/15289" show_output : YES type : FILE_CONTENT_CHECK_NOT description : "Verify that the dictcheck option is not set to 0 (disabled) in a pwquality configuration file" file : "/etc/security/pwquality.conf /etc/security/pwquality.conf.d/*.conf" regex : "(?i)^\\h*dictcheck\\h*=\\h*0\\b" expect : "(?i)^\\h*dictcheck\\h*=\\h*0\\b" type : FILE_CONTENT_CHECK_NOT description : "Verify that the dictcheck option is not set to 0 (disabled) as a module argument in a PAM file" file : "/etc/pam.d/system-auth /etc/pam.d/password-auth" regex : "(?i)^\\h*password\\h+(requisite|required|sufficient)\\h+pam_pwquality\\.so\\h+([^#\\r]+\\h+)?dictcheck\\h*=\\h*0\\b" expect : "(?i)^\\h*password\\h+(requisite|required|sufficient)\\h+pam_pwquality\\.so\\h+([^#\\r]+\\h+)?dictcheck\\h*=\\h*0\\b" description : "4.4.3.2.6 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 Run the following script to remove setting dictcheck on the pam_pwquality.so module in the PAM files: #!/usr/bin/env bash { for l_pam_file in system-auth password-auth; do l_authselect_file=\"/etc/authselect/$(head -1 /etc/authselect/authselect.conf | grep 'custom/')/$l_pam_file\" sed -ri 's/(^\s*password\s+(requisite|required|sufficient)\s+pam_pwquality\.so.*)(\s+dictcheck\s*=\s*\S+)(.*$)/\1\4/' \"$l_authselect_file\" done authselect apply-changes }" reference : "800-171|3.5.2,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),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/15289" show_output : YES type : FILE_CONTENT_CHECK description : "4.4.3.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" reference : "800-171|3.5.2,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),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/15289" file : "/etc/security/pwquality.conf /etc/security/pwquality.conf.d/*.conf" regex : "(?i)^\\h*enforce_for_root\\b" expect : "(?i)^\\h*enforce_for_root\\b" min_occurrences : "1" string_required : NO type : FILE_CONTENT_CHECK description : "system-auth / password-auth - remember" file : "/etc/pam.d/system-auth /etc/pam.d/password-auth" regex : "(?i)^\\h*password\\h+(requisite|required|sufficient)\\h+pam_pwhistory\\.so\\h+([^#\\r]+\\h+)?remember=" expect : "(?i)^\\h*password\\h+(requisite|required|sufficient)\\h+pam_pwhistory\\.so\\h+([^#\\r]+\\h+)?remember=@PASSWORD_HISTORY_REMEMBER@\\b" string_required : NO type : FILE_CONTENT_CHECK description : "pwhistory - remember" file : "/etc/security/pwhistory.conf" regex : "(?i)^\\h*remember\\h*=" expect : "(?i)^\\h*remember\\h*=\\h*@PASSWORD_HISTORY_REMEMBER@\\b" description : "4.4.3.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. - 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 : "Edit or add the following line in /etc/security/pwhistory.conf : remember = 24 Run the following script to remove the remember argument from the pam_pwhistory.so module in /etc/pam.d/system-auth and /etc/pam.d/password-auth : #!/usr/bin/env bash { for l_pam_file in system-auth password-auth; do l_authselect_file=\"/etc/authselect/$(head -1 /etc/authselect/authselect.conf | grep 'custom/')/$l_pam_file\" sed -ri 's/(^\s*password\s+(requisite|required|sufficient)\s+pam_pwhistory\.so.*)(\s+remember\s*=\s*\S+)(.*$)/\1\4/' \"$l_authselect_file\" done authselect apply-changes }" reference : "800-171|3.5.2,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),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/15289" show_output : YES type : FILE_CONTENT_CHECK description : "4.4.3.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 : "Edit or add the following line in /etc/security/pwhistory.conf : enforce_for_root" reference : "800-171|3.5.2,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),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/15289" file : "/etc/security/pwhistory.conf" regex : "(?i)^\\h*enforce_for_root\\b" expect : "(?i)^\\h*enforce_for_root\\b" type : FILE_CONTENT_CHECK description : "Ensure at least one file named /etc/pam.d/system-auth exists and matches password pattern" file : "/etc/pam.d/system-auth" 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/password-auth exists and matches password pattern" file : "/etc/pam.d/password-auth" 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 : "4.4.3.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 script to verify the active authselect profile includes use_authtok on the password stack's pam_pwhistory.so module lines: #!/usr/bin/env bash { l_pam_profile=\"$(head -1 /etc/authselect/authselect.conf)\" if grep -Pq -- '^custom\/' <<< \"$l_pam_profile\"; then l_pam_profile_path=\"/etc/authselect/$l_pam_profile\" else l_pam_profile_path=\"/usr/share/authselect/default/$l_pam_profile\" fi grep -P -- '^\h*password\h+(requisite|required|sufficient)\h+pam_pwhistory\.so\h+([^#\n\r]+\h+)?use_authtok\b' \"$l_pam_profile_path\"/{password,system}-auth } Example output: /etc/authselect/custom/custom-profile/password-auth:password required pam_pwhistory.so use_authtok /etc/authselect/custom/custom-profile/system-auth:password required pam_pwhistory.so use_authtok - IF - the output does not include use_authtok run the following script: #!/usr/bin/env bash { l_pam_profile=\"$(head -1 /etc/authselect/authselect.conf)\" if grep -Pq -- '^custom\/' <<< \"$l_pam_profile\"; then l_pam_profile_path=\"/etc/authselect/$l_pam_profile\" else l_pam_profile_path=\"/usr/share/authselect/default/$l_pam_profile\" fi for l_authselect_file in \"$l_pam_profile_path\"/password-auth \"$l_pam_profile_path\"/system-auth; do if grep -Pq '^\h*password\h+([^#\n\r]+)\h+pam_pwhistory\.so\h+([^#\n\r]+\h+)?use_authtok\b' \"$l_authselect_file\"; then echo \"- \\\"use_authtok\\\" is already set\" else echo \"- \\\"use_authtok\\\" is not set. Updating template\" sed -ri 's/(^\s*password\s+(requisite|required|sufficient)\s+pam_pwhistory\.so\s+.*)$/& use_authtok/g' \"$l_authselect_file\" fi done } Run the following command to update the password-auth and system-auth files in /etc/pam.d to include the use_authtok argument on the password stack's pam_pwhistory.so lines: # authselect apply-changes" reference : "800-171|3.5.2,800-171|3.13.16,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),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/15289" show_output : YES type : FILE_CONTENT_CHECK_NOT description : "Ensure no file named /etc/pam.d/password-auth exists and matches pattern" file : "/etc/pam.d/password-auth" regex : "(?i)^\\h*(auth|account|password|session)\\h+(requisite|required|sufficient)\\h+pam_unix\\.so\\h+([^#\\n\\r]+\\h+)?nullok\\b" expect : "(?i)^\\h*(auth|account|password|session)\\h+(requisite|required|sufficient)\\h+pam_unix\\.so\\h+([^#\\n\\r]+\\h+)?nullok\\b" type : FILE_CONTENT_CHECK_NOT description : "Ensure no file named /etc/pam.d/system-auth exists and matches pattern" file : "/etc/pam.d/system-auth" regex : "(?i)^\\h*(auth|account|password|session)\\h+(requisite|required|sufficient)\\h+pam_unix\\.so\\h+([^#\\n\\r]+\\h+)?nullok\\b" expect : "(?i)^\\h*(auth|account|password|session)\\h+(requisite|required|sufficient)\\h+pam_unix\\.so\\h+([^#\\n\\r]+\\h+)?nullok\\b" description : "4.4.3.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 script to verify that the active authselect profile's system-auth and password-auth files include {if not \"without-nullok\":nullok} - OR - don't include the nullok option on the pam_unix.so module: { l_module_name=\"unix\" l_profile_name=\"$(head -1 /etc/authselect/authselect.conf)\" if [[ ! \"$l_profile_name\" =~ ^custom\/ ]]; then echo \" - Follow Recommendation \\\"Ensure custom authselect profile is used\\\" and then return to this Recommendation\" else grep -P -- \"\bpam_$l_module_name\.so\b\" /etc/authselect/$l_profile_name/{password,system}-auth fi } Example output with a custom profile named \"custom-profile\": /etc/authselect/custom/custom-profile/password-auth:auth sufficient pam_unix.so {if not \"without-nullok\":nullok} /etc/authselect/custom/custom-profile/password-auth:account required pam_unix.so /etc/authselect/custom/custom-profile/password-auth:password sufficient pam_unix.so sha512 shadow {if not \"without-nullok\":nullok} use_authtok /etc/authselect/custom/custom-profile/password-auth:session required pam_unix.so /etc/authselect/custom/custom-profile/system-auth:auth sufficient pam_unix.so {if not \"without-nullok\":nullok} /etc/authselect/custom/custom-profile/system-auth:account required pam_unix.so /etc/authselect/custom/custom-profile/system-auth:password sufficient pam_unix.so sha512 shadow {if not \"without-nullok\":nullok} use_authtok /etc/authselect/custom/custom-profile/system-auth:session required pam_unix.so - IF - any line is returned with nullok that doesn't also include {if not \"without-nullok\":nullok} run the following script: #!/usr/bin/env bash { for l_pam_file in system-auth password-auth; do l_file=\"/etc/authselect/$(head -1 /etc/authselect/authselect.conf | grep 'custom/')/$l_pam_file\" sed -ri 's/(^\s*password\s+(requisite|required|sufficient)\s+pam_unix\.so\s+.*)(nullok)(\s*.*)$/\1\2\4/g' $l_file done } - IF - any line is returned with {if not \"without-nullok\":nullok} run the following command to enable the authselect without-nullok feature: # authselect enable-feature without-nullok Run the following command to update the files in /etc/pam.d to include pam_unix.so without the nullok argument: # authselect apply-changes" reference : "800-171|3.5.2,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),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/15289" show_output : YES type : FILE_CONTENT_CHECK_NOT description : "Ensure no file named /etc/pam.d/password-auth pam_unix.so contains remember" file : "/etc/pam.d/password-auth" 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_NOT description : "Ensure no file named /etc/pam.d/system-auth pam_unix.so contains remember" file : "/etc/pam.d/system-auth" 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" description : "4.4.3.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 : "Run the following script to verify the active authselect profile doesn't include the remember argument on the pam_unix.so module lines: #!/usr/bin/env bash { l_pam_profile=\"$(head -1 /etc/authselect/authselect.conf)\" if grep -Pq -- '^custom\/' <<< \"$l_pam_profile\"; then l_pam_profile_path=\"/etc/authselect/$l_pam_profile\" else l_pam_profile_path=\"/usr/share/authselect/default/$l_pam_profile\" fi grep -P -- '^\h*password\h+([^#\n\r]+\h+)pam_unix\.so\b' \"$l_pam_profile_path\"/{password,system}-auth } Output should be similar to: /etc/authselect/custom/custom-profile/password-auth:password sufficient pam_unix.so sha512 shadow {if not \"without-nullok\":nullok} use_authtok /etc/authselect/custom/custom-profile/system-auth:password sufficient pam_unix.so sha512 shadow {if not \"without-nullok\":nullok} use_authtok - IF - any line includes remember= run the following script to remove the remember= from the pam_unix.so lines in the active authselect profile password-auth and system-auth` templates: #!/usr/bin/env bash { l_pam_profile=\"$(head -1 /etc/authselect/authselect.conf)\" if grep -Pq -- '^custom\/' <<< \"$l_pam_profile\"; then l_pam_profile_path=\"/etc/authselect/$l_pam_profile\" else l_pam_profile_path=\"/usr/share/authselect/default/$l_pam_profile\" fi for l_authselect_file in \"$l_pam_profile_path\"/password-auth \"$l_pam_profile_path\"/system-auth; do sed -ri 's/(^\s*password\s+(requisite|required|sufficient)\s+pam_unix\.so\s+.*)(remember=[1-9][0-9]*)(\s*.*)$/\1\4/g' \"$l_authselect_file\" done } Run the following command to update the password-auth and system-auth files in /etc/pam.d to include pam_unix.so without the remember argument: # authselect apply-changes" reference : "800-171|3.5.2,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),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/15289" show_output : YES type : FILE_CONTENT_CHECK description : "Ensure at least one file named /etc/pam.d/system-auth exists and matches pattern" file : "/etc/pam.d/system-auth" regex : "(?i)^\\h*password\\h+(requisite|required|sufficient)\\h+pam_unix\\.so(\\h+[^#\\n\\r]+)?\\h+(sha512)\\b" expect : "(?i)^\\h*password\\h+(requisite|required|sufficient)\\h+pam_unix\\.so(\\h+[^#\\n\\r]+)?\\h+(sha512)\\b" type : FILE_CONTENT_CHECK description : "Ensure at least one file named /etc/pam.d/password-auth exists and matches pattern" file : "/etc/pam.d/password-auth" regex : "(?i)^\\h*password\\h+(requisite|required|sufficient)\\h+pam_unix\\.so(\\h+[^#\\n\\r]+)?\\h+(sha512)\\b" expect : "(?i)^\\h*password\\h+(requisite|required|sufficient)\\h+pam_unix\\.so(\\h+[^#\\n\\r]+)?\\h+(sha512)\\b" description : "4.4.3.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 : "Note: - 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 the following script to verify the active authselect profile includes a strong password hashing algorithm on the password stack's pam_unix.so module lines: #!/usr/bin/env bash { l_pam_profile=\"$(head -1 /etc/authselect/authselect.conf)\" if grep -Pq -- '^custom\/' <<< \"$l_pam_profile\"; then l_pam_profile_path=\"/etc/authselect/$l_pam_profile\" else l_pam_profile_path=\"/usr/share/authselect/default/$l_pam_profile\" fi grep -P -- '^\h*password\h+(requisite|required|sufficient)\h+pam_unix\.so\h+([^#\n\r]+\h+)?(sha512)\b' \"$l_pam_profile_path\"/{password,system}-auth } Example output: /etc/authselect/custom/custom-profile/password-auth:password sufficient pam_unix.so sha512 shadow {if not \"without-nullok\":nullok} use_authtok /etc/authselect/custom/custom-profile/system-auth:password sufficient pam_unix.so sha512 shadow {if not \"without-nullok\":nullok} use_authtok - IF - the output does not include either sha512 - OR - yescrypt or includes a different hashing algorithm, run the following script: #!/usr/bin/env bash { l_pam_profile=\"$(head -1 /etc/authselect/authselect.conf)\" if grep -Pq -- '^custom\/' <<< \"$l_pam_profile\"; then l_pam_profile_path=\"/etc/authselect/$l_pam_profile\" else l_pam_profile_path=\"/usr/share/authselect/default/$l_pam_profile\" fi for l_authselect_file in \"$l_pam_profile_path\"/password-auth \"$l_pam_profile_path\"/system-auth; do if grep -Pq '^\h*password\h+()\h+pam_unix\.so\h+([^#\n\r]+\h+)?(sha512)\b' \"$l_authselect_file\"; then echo \"- A strong password hashing algorithm is correctly set\" elif grep -Pq '^\h*password\h+()\h+pam_unix\.so\h+([^#\n\r]+\h+)?(md5|bigcrypt|sha256|blowfish)\b' \"$l_authselect_file\"; then echo \"- A weak password hashing algorithm is set, updating to \\\"sha512\\\"\" sed -ri 's/(^\s*password\s+(requisite|required|sufficient)\s+pam_unix\.so\s+.*)(md5|bigcrypt|sha256|blowfish)(\s*.*)$/\1\4 sha512/g' \"$l_authselect_file\" else echo \"No password hashing algorithm is set, updating to \\\"sha512\\\"\" sed -ri 's/(^\s*password\s+(requisite|required|sufficient)\s+pam_unix\.so\s+.*)$/& sha512/g' \"$l_authselect_file\" fi done } Run the following command to update the password-auth and system-auth files in /etc/pam.d to include pam_unix.so with a strong password hashing algorithm argument: # authselect apply-changes" reference : "800-171|3.5.2,800-171|3.13.16,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),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/15289" show_output : YES type : FILE_CONTENT_CHECK description : "Ensure at least one file named /etc/pam.d/system-auth exists and matches pattern" file : "/etc/pam.d/system-auth" 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/password-auth exists and matches pattern" file : "/etc/pam.d/password-auth" 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 : "4.4.3.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 : "Run the following script to verify the active authselect profile includes use_authtok on the password stack's pam_unix.so module lines: #!/usr/bin/env bash { l_pam_profile=\"$(head -1 /etc/authselect/authselect.conf)\" if grep -Pq -- '^custom\/' <<< \"$l_pam_profile\"; then l_pam_profile_path=\"/etc/authselect/$l_pam_profile\" else l_pam_profile_path=\"/usr/share/authselect/default/$l_pam_profile\" fi grep -P -- '^\h*password\h+(requisite|required|sufficient)\h+pam_unix\.so\h+([^#\n\r]+\h+)?use_authtok\b' \"$l_pam_profile_path\"/{password,system}-auth } Example output: /etc/authselect/custom/custom-profile/password-auth:password sufficient pam_unix.so sha512 shadow {if not \"without-nullok\":nullok} use_authtok /etc/authselect/custom/custom-profile/system-auth:password sufficient pam_unix.so sha512 shadow {if not \"without-nullok\":nullok} use_authtok - IF - the output does not include use_authtok run the following script: #!/usr/bin/env bash { l_pam_profile=\"$(head -1 /etc/authselect/authselect.conf)\" if grep -Pq -- '^custom\/' <<< \"$l_pam_profile\"; then l_pam_profile_path=\"/etc/authselect/$l_pam_profile\" else l_pam_profile_path=\"/usr/share/authselect/default/$l_pam_profile\" fi for l_authselect_file in \"$l_pam_profile_path\"/password-auth \"$l_pam_profile_path\"/system-auth; do if grep -Pq '^\h*password\h+([^#\n\r]+)\h+pam_unix\.so\h+([^#\n\r]+\h+)?use_authtok\b' \"$l_authselect_file\"; then echo \"- \\\"use_authtok\\\" is already set\" else echo \"- \\\"use_authtok\\\" is not set. Updating template\" sed -ri 's/(^\s*password\s+(requisite|required|sufficient)\s+pam_unix\.so\s+.*)$/& use_authtok/g' \"$l_authselect_file\" fi done } Run the following command to update the password-auth and system-auth files in /etc/pam.d to include the use_authtok argument on the password stack's pam_unix.so lines: # authselect apply-changes" reference : "800-171|3.5.2,800-171|3.13.16,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),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/15289" show_output : YES type : FILE_CONTENT_CHECK description : "Ensure at least one file named /etc/login.defs exists and matches pattern" file : "/etc/login.defs" regex : "(?i)^\\h*ENCRYPT_METHOD\\h+@PASSWORD_ENCRYPTION@\\b" expect : "(?i)^\\h*ENCRYPT_METHOD\\h+@PASSWORD_ENCRYPTION@\\b" type : FILE_CONTENT_CHECK description : "Ensure at least one file named /etc/libuser.conf exists and matches pattern" file : "/etc/libuser.conf" regex : "(?i)^\\h*crypt_style\\h*=\\h*(sha512)\\b" expect : "(?i)^\\h*crypt_style\\h*=\\h*(sha512)\\b" description : "4.5.1.1 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. 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 : "Note: 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 Set password hashing algorithm to sha512. Edit /etc/libuser.conf and edit or add the following line: crypt_style = sha512 Edit /etc/login.defs and edit or add the following line: ENCRYPT_METHOD SHA512 Note: 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 group passwords be updated to use the stronger hashing algorithm." reference : "800-171|3.5.2,800-171|3.13.16,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),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/15289" show_output : YES type : FILE_CONTENT_CHECK description : "shadow password max days" file : "/etc/shadow" regex : "^[^:]+:[^!*]" expect : "^([^:]*:){4}@PASSWORD_MAX_DAYS@:" string_required : NO type : FILE_CONTENT_CHECK description : "login.defs" file : "/etc/login.defs" regex : "(?i)^[\\s]*PASS_MAX_DAYS[\\s]" expect : "(?i)^[\\s]*PASS_MAX_DAYS[\\s]+@PASSWORD_MAX_DAYS@[\\s]*$" description : "4.5.1.2 Ensure password expiration is 90 days or less" info : "The PASS_MAX_DAYS parameter in /etc/login.defs allows an administrator to force passwords to expire once they reach a defined age. It is recommended that the PASS_MAX_DAYS parameter be set to less than or equal to 365 days. The window of opportunity for an attacker to leverage compromised credentials or successfully compromise credentials via an online brute force attack is limited by the age of the password. Therefore, reducing the maximum age of a password also reduces an attacker's window of opportunity." solution : "Set the PASS_MAX_DAYS parameter to conform to site policy in /etc/login.defs : PASS_MAX_DAYS 90 Modify user parameters for all users with a password set to match: # chage --maxdays 90 Impact: The password expiration must be greater than the minimum days between password changes or users will be unable to change their password" 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-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),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/15289" show_output : YES type : FILE_CONTENT_CHECK description : "login.defs" file : "/etc/login.defs" regex : "(?i)^[\\s]*PASS_WARN_AGE[\\s]+" expect : "(?i)^[\\s]*PASS_WARN_AGE[\\s]+@PASSWORD_WARN_AGE@[\\s]*$" type : FILE_CONTENT_CHECK description : "shadow password warn age" file : "/etc/shadow" regex : "^[^:]+:[^!*]" expect : "^([^:]*:){5}@PASSWORD_WARN_AGE@:" string_required : NO description : "4.5.1.3 Ensure password expiration warning days is 14 or more" info : "The PASS_WARN_AGE parameter in /etc/login.defs allows an administrator to notify users that their password will expire in a defined number of days. It is recommended that the PASS_WARN_AGE parameter be set to 14 or more days. Providing an advance warning that a password will be expiring gives users time to think of a secure password. Users caught unaware may choose a simple password or write it down where it may be discovered." solution : "Set the PASS_WARN_AGE parameter to 14 in /etc/login.defs : PASS_WARN_AGE 14 Modify user parameters for all users with a password set to match: # chage --warndays 7 " 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-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),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/15289" show_output : YES type : CMD_EXEC description : "useradd" cmd : "/sbin/useradd -D | /bin/grep 'INACTIVE'" expect : "(?i)^[\\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 : "4.5.1.4 Ensure inactive password lock is 30 days or less" info : "User accounts that have been inactive for over a given period of time can be automatically disabled. It is recommended that accounts that are inactive for 30 days after password expiration be disabled. Inactive accounts pose a threat to system security since the users are not logging in to notice failed login attempts or other anomalies." solution : "Run the following command to set the default password inactivity period to 30 days: # useradd -D -f 30 Modify user parameters for all users with a password set to match: # chage --inactive 30 " reference : "800-171|3.5.2,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),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/15289" show_output : YES type : CMD_EXEC description : "4.5.1.5 Ensure all users last password change date is in the past" info : "All users should have a password change date in the past. 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-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),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/15289" 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]*\\**$" type : CMD_EXEC description : "4.5.2.1 Ensure default group for the root account is GID 0" 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 default group ID to 0 : # usermod -g 0 root" 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-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|5.1,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),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/15289" 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]*\\**$" type : FILE_CONTENT_CHECK_NOT description : "4.5.2.2 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-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/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/15289" 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 : "nologin" cmd : "awk -F: '$1!=\"root\" && $1!=\"sync\" && $1!=\"shutdown\" && $1!=\"halt\" && $1!~/^\\+/ && $3<'\"$(awk '/^\\s*UID_MIN/{print $2}' /etc/login.defs)\"' && $7!=\"/usr/sbin/nologin\" && $7!=\"/sbin/nologin\" && $7!=\"/bin/false\" && $7!=\"/usr/bin/false\" {print}' /etc/passwd | awk '{print} END {if (NR == 0) print \"pass\" ; else print \"fail\"}'" expect : "^pass$" type : CMD_EXEC description : "Disabled accounts" cmd : "awk -F: '$1!=\"root\" && $1!~/^\\+/ && $3<'\"$(awk '/^\\s*UID_MIN/{print $2}' /etc/login.defs)\"' {print $1}' /etc/passwd | xargs -I '{}' passwd -S '{}' | awk '$2!=\"L\" && $2!=\"LK\" {print $1}' | awk '{print} END {if (NR == 0) print \"pass\" ; else print \"fail\"}'" expect : "^pass$" description : "4.5.2.3 Ensure system accounts are secured" 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 : "System accounts Set the shell for any accounts returned by the audit to nologin : # usermod -s $(command -v nologin) Disabled accounts Lock any non root accounts returned by the audit: # usermod -L Large scale changes The following command will set all system accounts to nologin : # awk -F: '($1!~/^(root|halt|sync|shutdown|nfsnobody)$/ && ($3<'\"$(awk '/^\s*UID_MIN/{print $2}' /etc/login.defs)\"' || $3 == 65534)) { print $1 }' /etc/passwd | while read user; do usermod -s $(command -v nologin) $user >/dev/null; done The following command will automatically lock all accounts that have their shell set to nologin : # awk -F: '/nologin/ {print $1}' /etc/passwd | while read user; do usermod -L $user; done" 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-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/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/15289" show_output : YES type : CMD_EXEC description : "4.5.2.4 Ensure root password is set" 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 : "Set the root password with: # passwd 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-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/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/15289" cmd : "/bin/grep -Eq '^root:\\$(y|[0-9]|g)' /etc/shadow && echo 'root password is set' || echo 'root password is not set'" expect : "^root password is set$" type : CMD_EXEC description : "4.5.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/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 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 TMOUT configuration examples: - 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-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/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/15289" cmd : "#!/bin/bash { output1=\"\" output2=\"\" [ -f /etc/bashrc ] && BRC=\"/etc/bashrc\" for f in \"$BRC\" /etc/profile /etc/profile.d/*.sh ; do grep -Pq '^\\s*([^#]+\\s+)?TMOUT=(900|[1-8][0-9][0-9]|[1-9][0-9]|[1-9])\\b' \"$f\" && grep -Pq '^\\s*([^#]+;\\s*)?readonly\\s+TMOUT(\\s+|\\s*;|\\s*$|=(900|[1-8][0-9][0-9]|[1-9][0-9]|[1-9]))\\b' \"$f\" && grep -Pq '^\\s*([^#]+;\\s*)?export\\s+TMOUT(\\s+|\\s*;|\\s*$|=(900|[1-8][0-9][0-9]|[1-9][0-9]|[1-9]))\\b' \"$f\" && output1=\"$f\" done grep -Pq '^\\s*([^#]+\\s+)?TMOUT=(9[0-9][1-9]|9[1-9][0-9]|0+|[1-9]\\d{3,})\\b' /etc/profile /etc/profile.d/*.sh \"$BRC\" && output2=$(grep -Ps '^\\s*([^#]+\\s+)?TMOUT=(9[0-9][1-9]|9[1-9][0-9]|0+|[1-9]\\d{3,})\\b' /etc/profile /etc/profile.d/*.sh $BRC) if [ -n \"$output1\" ] && [ -z \"$output2\" ]; then echo -e \" PASSED TMOUT is configured in: \\\"$output1\\\" \" else [ -z \"$output1\" ] && echo -e \" FAILED TMOUT is not configured \" [ -n \"$output2\" ] && echo -e \" FAILED TMOUT is incorrectly configured in: \\\"$output2\\\" \" fi }" expect : "(?i)^[\\s]*\\**[\\s]*passed:?[\\s]*\\**$" type : CMD_EXEC description : "4.5.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: #!/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 } Note: - 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-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/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/15289" 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) 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?[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 l_file=\"/etc/login.defs\" && file_umask_chk 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]*\\**$" timeout : "@FIND_TIMEOUT@" 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 : "rsyslog check - installed" 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 : RPM_CHECK description : "5.1.1.1 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." solution : "Run the following command to install rsyslog : # dnf install rsyslog" reference : "800-171|3.3.1,800-171|3.3.2,800-171|3.3.6,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),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/15289" rpm : "rsyslog-0.0.0-0" operator : "gt" required : YES description : "5.1.1.1 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: The identified logging service 'rsyslog' was not found to be active and this check does not apply." solution : "Run the following command to install rsyslog : # dnf install rsyslog" reference : "800-171|3.3.1,800-171|3.3.2,800-171|3.3.6,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),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/15289" description : "5.1.1.1 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: 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 : "Run the following command to install rsyslog : # dnf install rsyslog" reference : "800-171|3.3.1,800-171|3.3.2,800-171|3.3.6,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),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/15289" 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 : "rsyslog check - installed" 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 : CMD_EXEC description : "5.1.1.2 Ensure rsyslog service is enabled" 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." solution : "Run the following command to enable rsyslog : # systemctl --now enable rsyslog" reference : "800-171|3.3.1,800-171|3.3.2,800-171|3.3.6,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),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/15289" cmd : "/bin/systemctl is-enabled rsyslog | /bin/awk '{print} END {if(NR==0) print \"disabled\" }'" expect : "^enabled$" description : "5.1.1.2 Ensure rsyslog service is enabled" 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: The identified logging service 'rsyslog' was not found to be active and this check does not apply." solution : "Run the following command to enable rsyslog : # systemctl --now enable rsyslog" reference : "800-171|3.3.1,800-171|3.3.2,800-171|3.3.6,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),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/15289" description : "5.1.1.2 Ensure rsyslog service is enabled" 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: 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 : "Run the following command to enable rsyslog : # systemctl --now enable rsyslog" reference : "800-171|3.3.1,800-171|3.3.2,800-171|3.3.6,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),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/15289" 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 : "rsyslog check - installed" 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 : CMD_EXEC description : "systemd-journald.service" cmd : "/bin/systemctl list-units --type service | grep -P -- '(journald|rsyslog)'" expect : "^[\\s]*systemd-journald.service[\\s]+loaded[\\s]+active[\\s]+running[\\s]+Journal[\\s]+Service[\\s]*$" type : CMD_EXEC description : "ForwardToSyslog" cmd : "#!/bin/bash { l_output=\"\" l_output2=\"\" a_parlist=(\"ForwardToSyslog=yes\") l_systemd_config_file=\"/etc/systemd/journald.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)\" [ \"${l_systemd_parameter^^}\" = \"${l_systemd_parameter_name^^}\" ] && A_out+=([\"$l_systemd_parameter\"]=\"$l_file\") fi fi done < <(/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 [ \"${l_systemd_file_parameter_value^^}\" = \"${l_systemd_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 of: \\\"$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\" [ -n \"$l_output\" ] && echo -e \"\\n- Correctly set:\\n$l_output\\n\" fi }" expect : "(?i)^[\\s]*\\**[\\s]*pass:?[\\s]*\\**$" type : CMD_EXEC description : "rsyslog.service" cmd : "/bin/systemctl list-units --type service | grep -P -- '(journald|rsyslog)'" expect : "^[\\s]*rsyslog.service[\\s]+loaded[\\s]+active[\\s]+running[\\s]+System[\\s]+Logging[\\s]+Service[\\s]*$" description : "5.1.1.3 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: 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 : "Create or edit the file /etc/systemd/journald.conf or a file in the /etc/systemd/journald.conf.d/ directory ending inconf and add or edit the line ForwardToSyslog=yes : Example: # printf '%s\n' \"ForwardToSyslog=yes\" > /etc/systemd/journald.conf.d/50-journald_forward.conf Restart the systemd-journald service: # systemctl restart systemd-journald.service" reference : "800-171|3.3.1,800-171|3.3.2,800-171|3.3.5,800-171|3.3.6,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),ITSG-33|AU-2,ITSG-33|AU-6(3),ITSG-33|AU-7,ITSG-33|AU-12,LEVEL|1M,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/15289" show_output : YES description : "5.1.1.3 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: 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 : "Create or edit the file /etc/systemd/journald.conf or a file in the /etc/systemd/journald.conf.d/ directory ending inconf and add or edit the line ForwardToSyslog=yes : Example: # printf '%s\n' \"ForwardToSyslog=yes\" > /etc/systemd/journald.conf.d/50-journald_forward.conf Restart the systemd-journald service: # systemctl restart systemd-journald.service" reference : "800-171|3.3.1,800-171|3.3.2,800-171|3.3.5,800-171|3.3.6,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),ITSG-33|AU-2,ITSG-33|AU-6(3),ITSG-33|AU-7,ITSG-33|AU-12,LEVEL|1M,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/15289" description : "5.1.1.3 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: 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 : "Create or edit the file /etc/systemd/journald.conf or a file in the /etc/systemd/journald.conf.d/ directory ending inconf and add or edit the line ForwardToSyslog=yes : Example: # printf '%s\n' \"ForwardToSyslog=yes\" > /etc/systemd/journald.conf.d/50-journald_forward.conf Restart the systemd-journald service: # systemctl restart systemd-journald.service" reference : "800-171|3.3.1,800-171|3.3.2,800-171|3.3.5,800-171|3.3.6,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),ITSG-33|AU-2,ITSG-33|AU-6(3),ITSG-33|AU-7,ITSG-33|AU-12,LEVEL|1M,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/15289" 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 : "rsyslog check - installed" 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 : "5.1.1.4 Ensure rsyslog default file permissions are configured" info : "RSyslog will create logfiles that do not already exist on the system. This setting controls what permissions will be applied to these newly created files. It is important to ensure that log files have the correct permissions to ensure that sensitive data is archived and protected." 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 Impact: The systems global umask could override, but only making the file permissions stricter, what is configured in RSyslog with the FileCreateMode directive. RSyslog also has its own $umask directive that can alter the intended file creation mode. In addition, consideration should be given to how FileCreateMode is used. Thus it is critical to ensure that the intended file creation mode is not overridden with less restrictive settings in /etc/rsyslog.conf /etc/rsyslog.d/*conf files and that FileCreateMode is set before any file is created." 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-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/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/15289" 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 : "5.1.1.4 Ensure rsyslog default file permissions are configured" info : "RSyslog will create logfiles that do not already exist on the system. This setting controls what permissions will be applied to these newly created files. It is important to ensure that log files have the correct permissions to ensure that sensitive data is archived and protected. 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 Impact: The systems global umask could override, but only making the file permissions stricter, what is configured in RSyslog with the FileCreateMode directive. RSyslog also has its own $umask directive that can alter the intended file creation mode. In addition, consideration should be given to how FileCreateMode is used. Thus it is critical to ensure that the intended file creation mode is not overridden with less restrictive settings in /etc/rsyslog.conf /etc/rsyslog.d/*conf files and that FileCreateMode is set before any file is created." 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-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/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/15289" description : "5.1.1.4 Ensure rsyslog default file permissions are configured" info : "RSyslog will create logfiles that do not already exist on the system. This setting controls what permissions will be applied to these newly created files. 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. 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 Impact: The systems global umask could override, but only making the file permissions stricter, what is configured in RSyslog with the FileCreateMode directive. RSyslog also has its own $umask directive that can alter the intended file creation mode. In addition, consideration should be given to how FileCreateMode is used. Thus it is critical to ensure that the intended file creation mode is not overridden with less restrictive settings in /etc/rsyslog.conf /etc/rsyslog.d/*conf files and that FileCreateMode is set before any file is created." 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-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/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/15289" 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 : "rsyslog check - installed" 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 : "5.1.1.5 Ensure logging is configured" info : "The /etc/rsyslog.conf and /etc/rsyslog.d/*.conf files specifies rules for logging and which files are to be used to log certain classes of messages. 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.)." 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 wish 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-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),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/15289" show_output : YES description : "5.1.1.5 Ensure logging is configured" info : "The /etc/rsyslog.conf and /etc/rsyslog.d/*.conf files specifies rules for logging and which files are to be used to log certain classes of messages. 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: 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 wish 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-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),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/15289" description : "5.1.1.5 Ensure logging is configured" info : "The /etc/rsyslog.conf and /etc/rsyslog.d/*.conf files specifies rules for logging and which files are to be used to log certain classes of messages. A great deal of important security-related information is sent via rsyslog (e.g., successful and failed su attempts, failed login attempts, root login attempts, etc.). NOTE: Nessus has 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 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 wish 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-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),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/15289" 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 : "rsyslog check - installed" 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 : "rsyslog new format" file : "/etc/rsyslog.conf /etc/rsyslog.d/*.conf" regex : "^\\s*([^#]+\\s+)?action\\(([^#]+\\s+)?\\btarget=\\\"?[^#\"]+\\\"?\\b" expect : "^\\s*([^#]+\\s+)?action\\(([^#]+\\s+)?\\btarget=\\\"?[^#\"]+\\\"?\\b" required : NO min_occurrences : "1" type : FILE_CONTENT_CHECK description : "rsyslog old format" file : "/etc/rsyslog.conf /etc/rsyslog.d/*.conf" regex : "^\\s*[^#]+\\.\\*\\s+@" expect : "^\\s*[^#]+\\.\\*\\s+@" required : NO min_occurrences : "1" description : "5.1.1.6 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." solution : "Edit the /etc/rsyslog.conf and /etc/rsyslog.d/*.conf files and add the following line (where loghost.example.com is the name of your central log host). The target directive may either be a fully qualified domain name or an IP address. *.* action(type=\"omfwd\" target=\"192.168.2.100\" port=\"514\" protocol=\"tcp\" action.resumeRetryCount=\"100\" queue.type=\"LinkedList\" queue.size=\"1000\") 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-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),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/15289" show_output : YES description : "5.1.1.6 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: The identified logging service 'rsyslog' was not found to be active and this check does not apply." solution : "Edit the /etc/rsyslog.conf and /etc/rsyslog.d/*.conf files and add the following line (where loghost.example.com is the name of your central log host). The target directive may either be a fully qualified domain name or an IP address. *.* action(type=\"omfwd\" target=\"192.168.2.100\" port=\"514\" protocol=\"tcp\" action.resumeRetryCount=\"100\" queue.type=\"LinkedList\" queue.size=\"1000\") 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-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),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/15289" show_output : YES description : "5.1.1.6 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: 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 the /etc/rsyslog.conf and /etc/rsyslog.d/*.conf files and add the following line (where loghost.example.com is the name of your central log host). The target directive may either be a fully qualified domain name or an IP address. *.* action(type=\"omfwd\" target=\"192.168.2.100\" port=\"514\" protocol=\"tcp\" action.resumeRetryCount=\"100\" queue.type=\"LinkedList\" queue.size=\"1000\") 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-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),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/15289" 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 : "rsyslog check - installed" 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 : "Old format ModLoad imtcp" file : "/etc/rsyslog.conf /etc/rsyslog.d/*.conf" regex : "^[\\s]*\\$ModLoad imtcp" expect : "^Manual Review Required$" required : NO severity : MEDIUM type : FILE_CONTENT_CHECK description : "Old format InputTCPServerRun" file : "/etc/rsyslog.conf /etc/rsyslog.d/*.conf" regex : "^[\\s]*\\$InputTCPServerRun" expect : "^Manual Review Required$" required : NO severity : MEDIUM type : FILE_CONTENT_CHECK description : "New format input imtcp" file : "/etc/rsyslog.conf /etc/rsyslog.d/*.conf" regex : "^\\h*input\\(type=\"imtcp\" port=\"514\"\\)" expect : "^Manual Review Required$" required : NO severity : MEDIUM type : FILE_CONTENT_CHECK description : "New format module load imtcp" file : "/etc/rsyslog.conf /etc/rsyslog.d/*.conf" regex : "^\\h*module\\(load=\"imtcp\"\\)" expect : "^Manual Review Required$" required : NO severity : MEDIUM description : "5.1.1.7 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: Nessus has provided the target output to assist in reviewing 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. Ensure none of the following entries are present in any of /etc/rsyslog.conf or /etc/rsyslog.d/*.conf New format module(load=\"imtcp\") input(type=\"imtcp\" port=\"514\") - OR - Old format $ModLoad imtcp $InputTCPServerRun Restart the service: # systemctl restart rsyslog" reference : "800-171|3.3.1,800-171|3.3.2,800-171|3.3.6,800-171|3.4.2,800-171|3.4.6,800-171|3.4.7,800-53|AU-2,800-53|AU-7,800-53|AU-12,800-53|CM-6,800-53|CM-7,800-53r5|AU-2,800-53r5|AU-7,800-53r5|AU-12,800-53r5|CM-6,800-53r5|CM-7,CN-L3|7.1.2.3(c),CN-L3|8.1.4.3(a),CSCv7|6.2,CSCv7|6.3,CSCv7|9.2,CSCv8|4.8,CSCv8|8.2,CSF|DE.CM-1,CSF|DE.CM-3,CSF|DE.CM-7,CSF|PR.IP-1,CSF|PR.PT-1,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.PS-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(b),ITSG-33|AU-2,ITSG-33|AU-7,ITSG-33|AU-12,ITSG-33|CM-6,ITSG-33|CM-7,LEVEL|1A,NESA|M1.2.2,NESA|M5.5.1,NIAv2|AM7,NIAv2|AM11a,NIAv2|AM11b,NIAv2|AM11c,NIAv2|AM11d,NIAv2|AM11e,NIAv2|SS15a,NIAv2|SS30,NIAv2|VL8,PCI-DSSv3.2.1|2.2.2,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|2.3,SWIFT-CSCv1|6.4" see_also : "https://workbench.cisecurity.org/benchmarks/15289" show_output : YES description : "5.1.1.7 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: The identified logging service 'rsyslog' was not found to be active and this check does not apply." 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. Ensure none of the following entries are present in any of /etc/rsyslog.conf or /etc/rsyslog.d/*.conf New format module(load=\"imtcp\") input(type=\"imtcp\" port=\"514\") - OR - Old format $ModLoad imtcp $InputTCPServerRun Restart the service: # systemctl restart rsyslog" reference : "800-171|3.3.1,800-171|3.3.2,800-171|3.3.6,800-171|3.4.2,800-171|3.4.6,800-171|3.4.7,800-53|AU-2,800-53|AU-7,800-53|AU-12,800-53|CM-6,800-53|CM-7,800-53r5|AU-2,800-53r5|AU-7,800-53r5|AU-12,800-53r5|CM-6,800-53r5|CM-7,CN-L3|7.1.2.3(c),CN-L3|8.1.4.3(a),CSCv7|6.2,CSCv7|6.3,CSCv7|9.2,CSCv8|4.8,CSCv8|8.2,CSF|DE.CM-1,CSF|DE.CM-3,CSF|DE.CM-7,CSF|PR.IP-1,CSF|PR.PT-1,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.PS-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(b),ITSG-33|AU-2,ITSG-33|AU-7,ITSG-33|AU-12,ITSG-33|CM-6,ITSG-33|CM-7,LEVEL|1A,NESA|M1.2.2,NESA|M5.5.1,NIAv2|AM7,NIAv2|AM11a,NIAv2|AM11b,NIAv2|AM11c,NIAv2|AM11d,NIAv2|AM11e,NIAv2|SS15a,NIAv2|SS30,NIAv2|VL8,PCI-DSSv3.2.1|2.2.2,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|2.3,SWIFT-CSCv1|6.4" see_also : "https://workbench.cisecurity.org/benchmarks/15289" description : "5.1.1.7 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: 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 : "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. Ensure none of the following entries are present in any of /etc/rsyslog.conf or /etc/rsyslog.d/*.conf New format module(load=\"imtcp\") input(type=\"imtcp\" port=\"514\") - OR - Old format $ModLoad imtcp $InputTCPServerRun Restart the service: # systemctl restart rsyslog" reference : "800-171|3.3.1,800-171|3.3.2,800-171|3.3.6,800-171|3.4.2,800-171|3.4.6,800-171|3.4.7,800-53|AU-2,800-53|AU-7,800-53|AU-12,800-53|CM-6,800-53|CM-7,800-53r5|AU-2,800-53r5|AU-7,800-53r5|AU-12,800-53r5|CM-6,800-53r5|CM-7,CN-L3|7.1.2.3(c),CN-L3|8.1.4.3(a),CSCv7|6.2,CSCv7|6.3,CSCv7|9.2,CSCv8|4.8,CSCv8|8.2,CSF|DE.CM-1,CSF|DE.CM-3,CSF|DE.CM-7,CSF|PR.IP-1,CSF|PR.PT-1,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.PS-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(b),ITSG-33|AU-2,ITSG-33|AU-7,ITSG-33|AU-12,ITSG-33|CM-6,ITSG-33|CM-7,LEVEL|1A,NESA|M1.2.2,NESA|M5.5.1,NIAv2|AM7,NIAv2|AM11a,NIAv2|AM11b,NIAv2|AM11c,NIAv2|AM11d,NIAv2|AM11e,NIAv2|SS15a,NIAv2|SS30,NIAv2|VL8,PCI-DSSv3.2.1|2.2.2,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|2.3,SWIFT-CSCv1|6.4" see_also : "https://workbench.cisecurity.org/benchmarks/15289" 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 : RPM_CHECK description : "Check for systemd-journal-remote package" rpm : "systemd-journal-remote-0.0.0-0" operator : "gt" required : YES type : CMD_EXEC description : "journald check - enabled" cmd : "/bin/systemctl is-enabled systemd-journald.service" expect : "^static$" type : RPM_CHECK description : "5.1.2.1.1 Ensure systemd-journal-remote is installed" info : "Journald (via 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." solution : "Run the following command to install systemd-journal-remote : # dnf install systemd-journal-remote" reference : "800-171|3.3.1,800-171|3.3.2,800-171|3.3.6,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),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/15289" rpm : "systemd-journal-remote-0.0.0-0" operator : "gt" required : YES description : "5.1.2.1.1 Ensure systemd-journal-remote is installed" info : "Journald (via 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: The identified logging service 'journald' was not found to be active and this check does not apply." solution : "Run the following command to install systemd-journal-remote : # dnf install systemd-journal-remote" reference : "800-171|3.3.1,800-171|3.3.2,800-171|3.3.6,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),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/15289" description : "5.1.2.1.1 Ensure systemd-journal-remote is installed" info : "Journald (via 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: 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 : "Run the following command to install systemd-journal-remote : # dnf install systemd-journal-remote" reference : "800-171|3.3.1,800-171|3.3.2,800-171|3.3.6,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),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/15289" 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 : RPM_CHECK description : "Check for systemd-journal-remote package" rpm : "systemd-journal-remote-0.0.0-0" operator : "gt" required : YES type : CMD_EXEC description : "journald check - enabled" cmd : "/bin/systemctl is-enabled systemd-journald.service" expect : "^static$" type : FILE_CONTENT_CHECK description : "Trusted Cert" file : "/etc/systemd/journal-upload.conf" regex : "^[\\s]*TrustedCertificateFile[\\s]*=[\\s]*" expect : "^[\\s]*TrustedCertificateFile[\\s]*=[\\s]*@JOURNALD_TRUSTED_CERT@[\\s]*$" type : FILE_CONTENT_CHECK description : "Cert" file : "/etc/systemd/journal-upload.conf" regex : "^[\\s]*ServerCertificateFile[\\s]*=[\\s]*" expect : "^[\\s]*ServerCertificateFile[\\s]*=[\\s]*@JOURNALD_SERVER_CERT@[\\s]*$" type : FILE_CONTENT_CHECK description : "URL" file : "/etc/systemd/journal-upload.conf" regex : "^[\\s]*URL[\\s]*=[\\s]*" expect : "^[\\s]*URL[\\s]*=[\\s]*@JOURNALD_SERVER@[\\s]*$" type : FILE_CONTENT_CHECK description : "Key" file : "/etc/systemd/journal-upload.conf" regex : "^[\\s]*ServerKeyFile[\\s]*=[\\s]*" expect : "^[\\s]*ServerKeyFile[\\s]*=[\\s]*@JOURNALD_SERVER_KEY@[\\s]*$" description : "5.1.2.1.2 Ensure systemd-journal-remote is configured" info : "Journald (via 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." solution : "Edit the /etc/systemd/journal-upload.conf file and ensure the following lines are set per your environment: 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-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),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/15289" show_output : YES description : "5.1.2.1.2 Ensure systemd-journal-remote is configured" info : "Journald (via 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: The identified logging service 'journald' was not found to be active and this check does not apply." solution : "Edit the /etc/systemd/journal-upload.conf file and ensure the following lines are set per your environment: 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-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),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/15289" description : "5.1.2.1.2 Ensure systemd-journal-remote is configured" info : "Journald (via 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: 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 the /etc/systemd/journal-upload.conf file and ensure the following lines are set per your environment: 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-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),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/15289" 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 : RPM_CHECK description : "Check for systemd-journal-remote package" rpm : "systemd-journal-remote-0.0.0-0" operator : "gt" required : YES type : CMD_EXEC description : "journald check - enabled" cmd : "/bin/systemctl is-enabled systemd-journald.service" expect : "^static$" type : CMD_EXEC description : "5.1.2.1.3 Ensure systemd-journal-remote is enabled" info : "Journald (via 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." solution : "Run the following command to enable systemd-journal-remote : # systemctl --now enable systemd-journal-upload.service" reference : "800-171|3.3.1,800-171|3.3.2,800-171|3.3.6,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),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/15289" cmd : "/bin/systemctl is-enabled systemd-journal-upload.service" expect : "^enabled$" description : "5.1.2.1.3 Ensure systemd-journal-remote is enabled" info : "Journald (via 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: The identified logging service 'journald' was not found to be active and this check does not apply." solution : "Run the following command to enable systemd-journal-remote : # systemctl --now enable systemd-journal-upload.service" reference : "800-171|3.3.1,800-171|3.3.2,800-171|3.3.6,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),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/15289" description : "5.1.2.1.3 Ensure systemd-journal-remote is enabled" info : "Journald (via 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: 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 : "Run the following command to enable systemd-journal-remote : # systemctl --now enable systemd-journal-upload.service" reference : "800-171|3.3.1,800-171|3.3.2,800-171|3.3.6,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),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/15289" 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 : RPM_CHECK description : "Check for systemd-journal-remote package" rpm : "systemd-journal-remote-0.0.0-0" operator : "gt" required : YES type : CMD_EXEC description : "journald check - enabled" cmd : "/bin/systemctl is-enabled systemd-journald.service" expect : "^static$" type : CMD_EXEC description : "5.1.2.1.4 Ensure journald is not configured to receive logs from a remote client" info : "Journald 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." solution : "Run the following command to disable systemd-journal-remote.socket : # systemctl --now mask systemd-journal-remote.socket" reference : "800-171|3.3.1,800-171|3.3.2,800-171|3.3.6,800-171|3.4.2,800-171|3.4.6,800-171|3.4.7,800-53|AU-2,800-53|AU-7,800-53|AU-12,800-53|CM-6,800-53|CM-7,800-53r5|AU-2,800-53r5|AU-7,800-53r5|AU-12,800-53r5|CM-6,800-53r5|CM-7,CN-L3|7.1.2.3(c),CN-L3|8.1.4.3(a),CSCv7|6.2,CSCv7|6.3,CSCv7|9.2,CSCv8|4.8,CSCv8|8.2,CSF|DE.CM-1,CSF|DE.CM-3,CSF|DE.CM-7,CSF|PR.IP-1,CSF|PR.PT-1,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.PS-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(b),ITSG-33|AU-2,ITSG-33|AU-7,ITSG-33|AU-12,ITSG-33|CM-6,ITSG-33|CM-7,LEVEL|1A,NESA|M1.2.2,NESA|M5.5.1,NIAv2|AM7,NIAv2|AM11a,NIAv2|AM11b,NIAv2|AM11c,NIAv2|AM11d,NIAv2|AM11e,NIAv2|SS15a,NIAv2|SS30,NIAv2|VL8,PCI-DSSv3.2.1|2.2.2,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|2.3,SWIFT-CSCv1|6.4" see_also : "https://workbench.cisecurity.org/benchmarks/15289" cmd : "/bin/systemctl is-enabled systemd-journal-remote.socket | /bin/awk '{print} END {if(NR==0) print \"disabled\" }'" expect : "(disabled|masked|static)" description : "5.1.2.1.4 Ensure journald is not configured to receive logs from a remote client" info : "Journald 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: The identified logging service 'journald' was not found to be active and this check does not apply." solution : "Run the following command to disable systemd-journal-remote.socket : # systemctl --now mask systemd-journal-remote.socket" reference : "800-171|3.3.1,800-171|3.3.2,800-171|3.3.6,800-171|3.4.2,800-171|3.4.6,800-171|3.4.7,800-53|AU-2,800-53|AU-7,800-53|AU-12,800-53|CM-6,800-53|CM-7,800-53r5|AU-2,800-53r5|AU-7,800-53r5|AU-12,800-53r5|CM-6,800-53r5|CM-7,CN-L3|7.1.2.3(c),CN-L3|8.1.4.3(a),CSCv7|6.2,CSCv7|6.3,CSCv7|9.2,CSCv8|4.8,CSCv8|8.2,CSF|DE.CM-1,CSF|DE.CM-3,CSF|DE.CM-7,CSF|PR.IP-1,CSF|PR.PT-1,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.PS-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(b),ITSG-33|AU-2,ITSG-33|AU-7,ITSG-33|AU-12,ITSG-33|CM-6,ITSG-33|CM-7,LEVEL|1A,NESA|M1.2.2,NESA|M5.5.1,NIAv2|AM7,NIAv2|AM11a,NIAv2|AM11b,NIAv2|AM11c,NIAv2|AM11d,NIAv2|AM11e,NIAv2|SS15a,NIAv2|SS30,NIAv2|VL8,PCI-DSSv3.2.1|2.2.2,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|2.3,SWIFT-CSCv1|6.4" see_also : "https://workbench.cisecurity.org/benchmarks/15289" description : "5.1.2.1.4 Ensure journald is not configured to receive logs from a remote client" info : "Journald 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: 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 : "Run the following command to disable systemd-journal-remote.socket : # systemctl --now mask systemd-journal-remote.socket" reference : "800-171|3.3.1,800-171|3.3.2,800-171|3.3.6,800-171|3.4.2,800-171|3.4.6,800-171|3.4.7,800-53|AU-2,800-53|AU-7,800-53|AU-12,800-53|CM-6,800-53|CM-7,800-53r5|AU-2,800-53r5|AU-7,800-53r5|AU-12,800-53r5|CM-6,800-53r5|CM-7,CN-L3|7.1.2.3(c),CN-L3|8.1.4.3(a),CSCv7|6.2,CSCv7|6.3,CSCv7|9.2,CSCv8|4.8,CSCv8|8.2,CSF|DE.CM-1,CSF|DE.CM-3,CSF|DE.CM-7,CSF|PR.IP-1,CSF|PR.PT-1,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.PS-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(b),ITSG-33|AU-2,ITSG-33|AU-7,ITSG-33|AU-12,ITSG-33|CM-6,ITSG-33|CM-7,LEVEL|1A,NESA|M1.2.2,NESA|M5.5.1,NIAv2|AM7,NIAv2|AM11a,NIAv2|AM11b,NIAv2|AM11c,NIAv2|AM11d,NIAv2|AM11e,NIAv2|SS15a,NIAv2|SS30,NIAv2|VL8,PCI-DSSv3.2.1|2.2.2,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|2.3,SWIFT-CSCv1|6.4" see_also : "https://workbench.cisecurity.org/benchmarks/15289" 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 : RPM_CHECK description : "Check for systemd-journal-remote package" rpm : "systemd-journal-remote-0.0.0-0" operator : "gt" required : YES type : CMD_EXEC description : "journald check - enabled" cmd : "/bin/systemctl is-enabled systemd-journald.service" expect : "^static$" type : CMD_EXEC description : "5.1.2.2 Ensure journald service is enabled" 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 : "By default the systemd-journald service does not have an [Install] section and thus cannot be enabled / disabled. It is meant to be referenced as Requires or Wants by other unit files. As such, if the status of systemd-journald is not static investigate why." reference : "800-171|3.3.1,800-171|3.3.2,800-171|3.3.6,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),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/15289" cmd : "/bin/systemctl is-enabled systemd-journald.service" expect : "^static$" description : "5.1.2.2 Ensure journald service is enabled" 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. NOTE: The identified logging service 'journald' was not found to be active and this check does not apply." solution : "By default the systemd-journald service does not have an [Install] section and thus cannot be enabled / disabled. It is meant to be referenced as Requires or Wants by other unit files. As such, if the status of systemd-journald is not static investigate why." reference : "800-171|3.3.1,800-171|3.3.2,800-171|3.3.6,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),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/15289" description : "5.1.2.2 Ensure journald service is enabled" 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. 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 : "By default the systemd-journald service does not have an [Install] section and thus cannot be enabled / disabled. It is meant to be referenced as Requires or Wants by other unit files. As such, if the status of systemd-journald is not static investigate why." reference : "800-171|3.3.1,800-171|3.3.2,800-171|3.3.6,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),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/15289" 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 : RPM_CHECK description : "Check for systemd-journal-remote package" rpm : "systemd-journal-remote-0.0.0-0" operator : "gt" required : YES type : CMD_EXEC description : "journald check - enabled" cmd : "/bin/systemctl is-enabled systemd-journald.service" expect : "^static$" type : FILE_CONTENT_CHECK description : "5.1.2.3 Ensure journald is configured to compress large log files" info : "The journald system includes the capability of compressing overly large files to avoid filling up the system with logs or making the logs unmanageably large. Uncompressed large files may unexpectedly fill a filesystem leading to resource unavailability. Compressing logs prior to write can prevent sudden, unexpected filesystem impacts." solution : "Edit the /etc/systemd/journald.conf file and add the following line: Compress=yes Restart the service: # systemctl restart systemd-journald.service" reference : "800-171|3.3.1,800-171|3.3.2,800-171|3.3.6,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),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/15289" file : "/etc/systemd/journald.conf /etc/systemd/journald.conf.d/*" regex : "^[\\s]*Compress[\\s]*=" expect : "^[\\s]*Compress[\\s]*=[\\s]*['\"]?yes[\"']?[\\s]*$" required : NO min_occurrences : "1" description : "5.1.2.3 Ensure journald is configured to compress large log files" info : "The journald system includes the capability of compressing overly large files to avoid filling up the system with logs or making the logs unmanageably large. Uncompressed large files may unexpectedly fill a filesystem leading to resource unavailability. Compressing logs prior to write can prevent sudden, unexpected filesystem impacts. NOTE: The identified logging service 'journald' was not found to be active and this check does not apply." solution : "Edit the /etc/systemd/journald.conf file and add the following line: Compress=yes Restart the service: # systemctl restart systemd-journald.service" reference : "800-171|3.3.1,800-171|3.3.2,800-171|3.3.6,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),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/15289" description : "5.1.2.3 Ensure journald is configured to compress large log files" info : "The journald system includes the capability of compressing overly large files to avoid filling up the system with logs or making the logs unmanageably large. Uncompressed large files may unexpectedly fill a filesystem leading to resource unavailability. Compressing logs prior to write can prevent sudden, unexpected filesystem impacts. 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 the /etc/systemd/journald.conf file and add the following line: Compress=yes Restart the service: # systemctl restart systemd-journald.service" reference : "800-171|3.3.1,800-171|3.3.2,800-171|3.3.6,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),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/15289" 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 : RPM_CHECK description : "Check for systemd-journal-remote package" rpm : "systemd-journal-remote-0.0.0-0" operator : "gt" required : YES type : CMD_EXEC description : "journald check - enabled" cmd : "/bin/systemctl is-enabled systemd-journald.service" expect : "^static$" type : FILE_CONTENT_CHECK description : "5.1.2.4 Ensure journald is configured to write logfiles to persistent disk" info : "Data from journald may be stored in volatile memory or persisted locally on the server. Logs in memory will be lost upon a system reboot. By persisting logs to local disk on the server they are protected from loss 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." solution : "Edit the /etc/systemd/journald.conf file and add the following line: Storage=persistent Restart the service: # systemctl restart systemd-journald.service" reference : "800-171|3.3.1,800-171|3.3.2,800-171|3.3.6,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),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/15289" file : "/etc/systemd/journald.conf /etc/systemd/journald.conf.d/*" regex : "^[\\s]*Storage[\\s]*=" expect : "^[\\s]*Storage[\\s]*=[\\s]*['\"]?persistent[\"']?[\\s]*$" required : NO min_occurrences : "1" description : "5.1.2.4 Ensure journald is configured to write logfiles to persistent disk" info : "Data from journald may be stored in volatile memory or persisted locally on the server. Logs in memory will be lost upon a system reboot. By persisting logs to local disk on the server they are protected from loss 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: The identified logging service 'journald' was not found to be active and this check does not apply." solution : "Edit the /etc/systemd/journald.conf file and add the following line: Storage=persistent Restart the service: # systemctl restart systemd-journald.service" reference : "800-171|3.3.1,800-171|3.3.2,800-171|3.3.6,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),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/15289" description : "5.1.2.4 Ensure journald is configured to write logfiles to persistent disk" info : "Data from journald may be stored in volatile memory or persisted locally on the server. Logs in memory will be lost upon a system reboot. By persisting logs to local disk on the server they are protected from loss 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: 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 the /etc/systemd/journald.conf file and add the following line: Storage=persistent Restart the service: # systemctl restart systemd-journald.service" reference : "800-171|3.3.1,800-171|3.3.2,800-171|3.3.6,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),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/15289" 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 : RPM_CHECK description : "Check for systemd-journal-remote package" rpm : "systemd-journal-remote-0.0.0-0" operator : "gt" required : YES type : CMD_EXEC description : "journald check - enabled" cmd : "/bin/systemctl is-enabled systemd-journald.service" expect : "^static$" type : FILE_CONTENT_CHECK_NOT description : "5.1.2.5 Ensure journald is not configured to send logs to rsyslog" info : "Data from journald should be kept in the confines of the service and not forwarded on 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 : "Edit the /etc/systemd/journald.conf file and ensure that ForwardToSyslog=yes is removed. Restart the service: # systemctl restart systemd-journald.service" reference : "800-171|3.3.1,800-171|3.3.2,800-171|3.3.5,800-171|3.3.6,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),ITSG-33|AU-2,ITSG-33|AU-6(3),ITSG-33|AU-7,ITSG-33|AU-12,LEVEL|1M,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/15289" file : "/etc/systemd/journald.conf /etc/systemd/journald.conf.d/*" regex : "^[\\s]*ForwardToSyslog[\\s]*=" expect : "^[\\s]*ForwardToSyslog[\\s]*=[\\s]*['\"]?yes[\"']?[\\s]*$" description : "5.1.2.5 Ensure journald is not configured to send logs to rsyslog" info : "Data from journald should be kept in the confines of the service and not forwarded on 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: The identified logging service 'journald' was not found to be active and this check does not apply." solution : "Edit the /etc/systemd/journald.conf file and ensure that ForwardToSyslog=yes is removed. Restart the service: # systemctl restart systemd-journald.service" reference : "800-171|3.3.1,800-171|3.3.2,800-171|3.3.5,800-171|3.3.6,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),ITSG-33|AU-2,ITSG-33|AU-6(3),ITSG-33|AU-7,ITSG-33|AU-12,LEVEL|1M,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/15289" description : "5.1.2.5 Ensure journald is not configured to send logs to rsyslog" info : "Data from journald should be kept in the confines of the service and not forwarded on 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. NOTE: journald or rsyslog was not found to be active. Review benchmark guidance to ensure local compliance." solution : "Edit the /etc/systemd/journald.conf file and ensure that ForwardToSyslog=yes is removed. Restart the service: # systemctl restart systemd-journald.service" reference : "800-171|3.3.1,800-171|3.3.2,800-171|3.3.5,800-171|3.3.6,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),ITSG-33|AU-2,ITSG-33|AU-6(3),ITSG-33|AU-7,ITSG-33|AU-12,LEVEL|1M,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/15289" 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 : RPM_CHECK description : "Check for systemd-journal-remote package" rpm : "systemd-journal-remote-0.0.0-0" operator : "gt" required : YES type : CMD_EXEC description : "journald check - enabled" cmd : "/bin/systemctl is-enabled systemd-journald.service" expect : "^static$" type : FILE_CONTENT_CHECK description : "5.1.2.6 Ensure journald log rotation is configured per site policy" 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 : "Review /etc/systemd/journald.conf and verify 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=" reference : "800-171|3.3.1,800-171|3.3.2,800-171|3.3.6,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),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/15289" 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 description : "5.1.2.6 Ensure journald log rotation is configured per site policy" 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: The identified logging service 'journald' was not found to be active and this check does not apply." solution : "Review /etc/systemd/journald.conf and verify 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=" reference : "800-171|3.3.1,800-171|3.3.2,800-171|3.3.6,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),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/15289" description : "5.1.2.6 Ensure journald log rotation is configured per site policy" 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 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 : "Review /etc/systemd/journald.conf and verify 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=" reference : "800-171|3.3.1,800-171|3.3.2,800-171|3.3.6,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),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/15289" description : "5.1.3 Ensure logrotate is configured" info : "The system includes the capability of rotating log files regularly to avoid filling up the system with logs or making the logs unmanageably large. The file /etc/logrotate.d/syslog is the configuration file used to rotate log files created by syslog or rsyslog By keeping the log files smaller and more manageable, a system administrator can easily archive these files to another system and spend less time looking through inordinately large log files. NOTE: Nessus has not performed this check. Please review the benchmark to ensure target compliance." solution : "Edit /etc/logrotate.conf and /etc/logrotate.d/* to ensure logs are rotated according to site policy." 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),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/15289" type : CMD_EXEC description : "5.1.4 Ensure all logfiles have appropriate access configured" info : "Log files stored in /var/log/ contain logged information from many services on the system and potentially from other logged hosts as well. 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 { l_op2=\"\" l_output2=\"\" l_uidmin=\"$(awk '/^\s*UID_MIN/{print $2}' /etc/login.defs)\" file_test_fix() { l_op2=\"\" l_fuser=\"root\" l_fgroup=\"root\" if [ $(( $l_mode & $perm_mask )) -gt 0 ]; then l_op2=\"$l_op2\n - Mode: \\\"$l_mode\\\" should be \\\"$maxperm\\\" or more restrictive\n - Removing excess permissions\" chmod \"$l_rperms\" \"$l_fname\" fi if [[ ! \"$l_user\" =~ $l_auser ]]; then l_op2=\"$l_op2\n - Owned by: \\\"$l_user\\\" and should be owned by \\\"${l_auser//|/ or }\\\"\n - Changing ownership to: \\\"$l_fuser\\\"\" chown \"$l_fuser\" \"$l_fname\" fi if [[ ! \"$l_group\" =~ $l_agroup ]]; then l_op2=\"$l_op2\n - Group owned by: \\\"$l_group\\\" and should be group owned by \\\"${l_agroup//|/ or }\\\"\n - Changing group ownership to: \\\"$l_fgroup\\\"\" chgrp \"$l_fgroup\" \"$l_fname\" fi [ -n \"$l_op2\" ] && l_output2=\"$l_output2\n - File: \\\"$l_fname\\\" is:$l_op2\n\" } unset a_file && a_file=() # clear and initialize array # Loop to create array with stat of files that could possibly fail one of the audits while IFS= read -r -d $'\0' l_file; do [ -e \"$l_file\" ] && a_file+=(\"$(stat -Lc '%n^%#a^%U^%u^%G^%g' \"$l_file\")\") done < <(find -L /var/log -type f \( -perm /0137 -o ! -user root -o ! -group root \) -print0) while IFS=\"^\" read -r l_fname l_mode l_user l_uid l_group l_gid; do l_bname=\"$(basename \"$l_fname\")\" case \"$l_bname\" in lastlog | lastlog.* | wtmp | wtmp.* | wtmp-* | btmp | btmp.* | btmp-* | README) perm_mask='0113' maxperm=\"$( printf '%o' $(( 0777 & ~$perm_mask)) )\" l_rperms=\"ug-x,o-wx\" l_auser=\"root\" l_agroup=\"(root|utmp)\" file_test_fix ;; secure | auth.log | syslog | messages) perm_mask='0137' maxperm=\"$( printf '%o' $(( 0777 & ~$perm_mask)) )\" l_rperms=\"u-x,g-wx,o-rwx\" l_auser=\"(root|syslog)\" l_agroup=\"(root|adm)\" file_test_fix ;; SSSD | sssd) perm_mask='0117' maxperm=\"$( printf '%o' $(( 0777 & ~$perm_mask)) )\" l_rperms=\"ug-x,o-rwx\" l_auser=\"(root|SSSD)\" l_agroup=\"(root|SSSD)\" file_test_fix ;; gdm | gdm3) perm_mask='0117' l_rperms=\"ug-x,o-rwx\" maxperm=\"$( printf '%o' $(( 0777 & ~$perm_mask)) )\" l_auser=\"root\" l_agroup=\"(root|gdm|gdm3)\" file_test_fix ;; *.journal | *.journal~) perm_mask='0137' maxperm=\"$( printf '%o' $(( 0777 & ~$perm_mask)) )\" l_rperms=\"u-x,g-wx,o-rwx\" l_auser=\"root\" l_agroup=\"(root|systemd-journal)\" file_test_fix ;; *) perm_mask='0137' maxperm=\"$( printf '%o' $(( 0777 & ~$perm_mask)) )\" l_rperms=\"u-x,g-wx,o-rwx\" l_auser=\"(root|syslog)\" l_agroup=\"(root|adm)\" if [ \"$l_uid\" -lt \"$l_uidmin\" ] && [ -z \"$(awk -v grp=\"$l_group\" -F: '$1==grp {print $4}' /etc/group)\" ]; then if [[ ! \"$l_user\" =~ $l_auser ]]; then l_auser=\"(root|syslog|$l_user)\" fi if [[ ! \"$l_group\" =~ $l_agroup ]]; then l_tst=\"\" while l_out3=\"\" read -r l_duid; do [ \"$l_duid\" -ge \"$l_uidmin\" ] && l_tst=failed done <<< \"$(awk -F: '$4=='\"$l_gid\"' {print $3}' /etc/passwd)\" [ \"$l_tst\" != \"failed\" ] && l_agroup=\"(root|adm|$l_group)\" fi fi file_test_fix ;; esac done <<< \"$(printf '%s\n' \"${a_file[@]}\")\" unset a_file # Clear array # If all files passed, then we report no changes if [ -z \"$l_output2\" ]; then echo -e \"- All files in \\\"/var/log/\\\" have appropriate permissions and ownership\n - No changes required\n\" else # print report of changes echo -e \"\n$l_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-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/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/15289" cmd : "#!/bin/bash { l_op2=\"\" l_output2=\"\" l_uidmin=\"$(awk '/^\\s*UID_MIN/{print $2}' /etc/login.defs)\" file_test_chk() { l_op2=\"\" if [ $(( $l_mode & $perm_mask )) -gt 0 ]; then l_op2=\"$l_op2 - Mode: \\\"$l_mode\\\" should be \\\"$maxperm\\\" or more restrictive\" fi if [[ ! \"$l_user\" =~ $l_auser ]]; then l_op2=\"$l_op2 - Owned by: \\\"$l_user\\\" and should be owned by \\\"${l_auser//|/ or }\\\"\" fi if [[ ! \"$l_group\" =~ $l_agroup ]]; then l_op2=\"$l_op2 - Group owned by: \\\"$l_group\\\" and should be group owned by \\\"${l_agroup//|/ or }\\\"\" fi [ -n \"$l_op2\" ] && l_output2=\"$l_output2 - File: \\\"$l_fname\\\" is:$l_op2 \" } unset a_file && a_file=() # clear and initialize array # Loop to create array with stat of files that could possibly fail one of the audits while IFS= read -r -d $'\\0' l_file; do [ -e \"$l_file\" ] && a_file+=(\"$(stat -Lc '%n^%#a^%U^%u^%G^%g' \"$l_file\")\") done < <(find -L /var/log -type f \\( -perm /0137 -o ! -user root -o ! -group root \\) -print0) while IFS=\"^\" read -r l_fname l_mode l_user l_uid l_group l_gid; do l_bname=\"$(basename \"$l_fname\")\" case \"$l_bname\" in lastlog | lastlog.* | wtmp | wtmp.* | wtmp-* | btmp | btmp.* | btmp-* | README) perm_mask='0113' maxperm=\"$( printf '%o' $(( 0777 & ~$perm_mask)) )\" l_auser=\"root\" l_agroup=\"(root|utmp)\" file_test_chk ;; secure | auth.log | syslog | messages) perm_mask='0137' maxperm=\"$( printf '%o' $(( 0777 & ~$perm_mask)) )\" l_auser=\"(root|syslog)\" l_agroup=\"(root|adm)\" file_test_chk ;; SSSD | sssd) perm_mask='0117' maxperm=\"$( printf '%o' $(( 0777 & ~$perm_mask)) )\" l_auser=\"(root|SSSD)\" l_agroup=\"(root|SSSD)\" file_test_chk ;; gdm | gdm3) perm_mask='0117' maxperm=\"$( printf '%o' $(( 0777 & ~$perm_mask)) )\" l_auser=\"root\" l_agroup=\"(root|gdm|gdm3)\" file_test_chk ;; *.journal | *.journal~) perm_mask='0137' maxperm=\"$( printf '%o' $(( 0777 & ~$perm_mask)) )\" l_auser=\"root\" l_agroup=\"(root|systemd-journal)\" file_test_chk ;; *) perm_mask='0137' maxperm=\"$( printf '%o' $(( 0777 & ~$perm_mask)) )\" l_auser=\"(root|syslog)\" l_agroup=\"(root|adm)\" if [ \"$l_uid\" -lt \"$l_uidmin\" ] && [ -z \"$(awk -v grp=\"$l_group\" -F: '$1==grp {print $4}' /etc/group)\" ]; then if [[ ! \"$l_user\" =~ $l_auser ]]; then l_auser=\"(root|syslog|$l_user)\" fi if [[ ! \"$l_group\" =~ $l_agroup ]]; then l_tst=\"\" while l_out3=\"\" read -r l_duid; do [ \"$l_duid\" -ge \"$l_uidmin\" ] && l_tst=failed done <<< \"$(awk -F: '$4=='\"$l_gid\"' {print $3}' /etc/passwd)\" [ \"$l_tst\" != \"failed\" ] && l_agroup=\"(root|adm|$l_group)\" fi fi file_test_chk ;; esac done <<< \"$(printf '%s ' \"${a_file[@]}\")\" unset a_file # Clear array # If all files passed, then we pass if [ -z \"$l_output2\" ]; then echo -e \" - Audit Results: ** Pass ** - All files in \\\"/var/log/\\\" have appropriate permissions and ownership \" else # print the reason why we are failing echo -e \" - Audit Results: ** Fail ** $l_output2\" fi }" expect : "(?i)^[\\s]*\\**[\\s]*pass:?[\\s]*\\**$" timeout : "@FIND_TIMEOUT@" type : RPM_CHECK description : "5.3.1 Ensure AIDE is installed" info : "Advanced Intrusion Detection Environment (AIDE) is an 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 : # dnf install aide Configure aide as appropriate for your environment. Consult the aide documentation for options. Initialize aide : Run the following commands: # aide --init # mv /var/lib/aide/aide.db.new.gz /var/lib/aide/aide.db.gz" reference : "800-171|3.1.7,800-171|3.3.1,800-171|3.3.2,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/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/15289" 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" type : FILE_CONTENT_CHECK description : "5.3.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/sbin/aide --check - OR - - IF - aidecheck.service and aidecheck.timer will be used to schedule and run aide check: Create or edit the file /etc/systemd/system/aidecheck.service and add the following lines: [Unit] Description=Aide Check [Service] Type=simple ExecStart=/usr/sbin/aide --check [Install] WantedBy=multi-user.target Create or edit the file /etc/systemd/system/aidecheck.timer and add the following lines: [Unit] Description=Aide check every day at 5AM [Timer] OnCalendar=*-*-* 05:00:00 Unit=aidecheck.service [Install] WantedBy=multi-user.target Run the following commands: # chown root:root /etc/systemd/system/aidecheck.* # chmod 0644 /etc/systemd/system/aidecheck.* # systemctl daemon-reload # systemctl enable aidecheck.service # systemctl --now enable aidecheck.timer" reference : "800-171|3.1.7,800-171|3.3.1,800-171|3.3.2,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/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/15289" 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" type : CMD_EXEC description : "aidecheck.timer is enabled" cmd : "/bin/systemctl is-enabled aidecheck.timer | /bin/awk '{print} END {if(NR==0) print \"disabled\" }'" expect : "^enabled$" type : CMD_EXEC description : "aidecheck.service is enabled" cmd : "/bin/systemctl is-enabled aidecheck.service | /bin/awk '{print} END {if(NR==0) print \"disabled\" }'" expect : "^enabled$" type : CMD_EXEC description : "systemctl status aidecheck.timer" cmd : "/bin/systemctl status aidecheck.timer" expect : "^[\\s]*Active:[\\s]*active[\\s]*\\(running|waiting\\)" description : "5.3.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/sbin/aide --check - OR - - IF - aidecheck.service and aidecheck.timer will be used to schedule and run aide check: Create or edit the file /etc/systemd/system/aidecheck.service and add the following lines: [Unit] Description=Aide Check [Service] Type=simple ExecStart=/usr/sbin/aide --check [Install] WantedBy=multi-user.target Create or edit the file /etc/systemd/system/aidecheck.timer and add the following lines: [Unit] Description=Aide check every day at 5AM [Timer] OnCalendar=*-*-* 05:00:00 Unit=aidecheck.service [Install] WantedBy=multi-user.target Run the following commands: # chown root:root /etc/systemd/system/aidecheck.* # chmod 0644 /etc/systemd/system/aidecheck.* # systemctl daemon-reload # systemctl enable aidecheck.service # systemctl --now enable aidecheck.timer" reference : "800-171|3.1.7,800-171|3.3.1,800-171|3.3.2,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/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/15289" show_output : YES type : FILE_CONTENT_CHECK description : "autrace" file : "/etc/aide.conf /etc/aide/aide.conf /etc/aide.conf.d/*" regex : "^[\\s]*/sbin/autrace[\\s]+" expect : "^[\\s]*/sbin/autrace[\\s]+p\\+i\\+n\\+u\\+g\\+s\\+b\\+acl\\+xattrs\\+sha512[\\s]*$" required : NO min_occurrences : "1" type : FILE_CONTENT_CHECK description : "augenrules" file : "/etc/aide.conf /etc/aide/aide.conf /etc/aide.conf.d/*" regex : "^[\\s]*/sbin/augenrules[\\s]+" expect : "^[\\s]*/sbin/augenrules[\\s]+p\\+i\\+n\\+u\\+g\\+s\\+b\\+acl\\+xattrs\\+sha512[\\s]*$" required : NO min_occurrences : "1" type : FILE_CONTENT_CHECK description : "auditd" file : "/etc/aide.conf /etc/aide/aide.conf /etc/aide.conf.d/*" regex : "^[\\s]*/sbin/auditd[\\s]+" expect : "^[\\s]*/sbin/auditd[\\s]+p\\+i\\+n\\+u\\+g\\+s\\+b\\+acl\\+xattrs\\+sha512[\\s]*$" required : NO min_occurrences : "1" type : FILE_CONTENT_CHECK description : "ausearch" file : "/etc/aide.conf /etc/aide/aide.conf /etc/aide.conf.d/*" regex : "^[\\s]*/sbin/ausearch[\\s]+" expect : "^[\\s]*/sbin/ausearch[\\s]+p\\+i\\+n\\+u\\+g\\+s\\+b\\+acl\\+xattrs\\+sha512[\\s]*$" required : NO min_occurrences : "1" type : FILE_CONTENT_CHECK description : "auditctl" file : "/etc/aide.conf /etc/aide/aide.conf /etc/aide.conf.d/*" regex : "^[\\s]*/sbin/auditctl[\\s]+" expect : "^[\\s]*/sbin/auditctl[\\s]+p\\+i\\+n\\+u\\+g\\+s\\+b\\+acl\\+xattrs\\+sha512[\\s]*$" required : NO min_occurrences : "1" type : FILE_CONTENT_CHECK description : "aureport" file : "/etc/aide.conf /etc/aide/aide.conf /etc/aide.conf.d/*" regex : "^[\\s]*/sbin/aureport[\\s]+" expect : "^[\\s]*/sbin/aureport[\\s]+p\\+i\\+n\\+u\\+g\\+s\\+b\\+acl\\+xattrs\\+sha512[\\s]*$" required : NO min_occurrences : "1" description : "5.3.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 : "Add or update the following selection lines for to a file ending inconf in the /etc/aide.conf.d/ directory or to /etc/aide.conf to protect the integrity of the audit tools: # Audit Tools /sbin/auditctl p+i+n+u+g+s+b+acl+xattrs+sha512 /sbin/auditd p+i+n+u+g+s+b+acl+xattrs+sha512 /sbin/ausearch p+i+n+u+g+s+b+acl+xattrs+sha512 /sbin/aureport p+i+n+u+g+s+b+acl+xattrs+sha512 /sbin/autrace p+i+n+u+g+s+b+acl+xattrs+sha512 /sbin/augenrules p+i+n+u+g+s+b+acl+xattrs+sha512" 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/15289" show_output : YES type : FILE_CHECK description : "6.1.1 Ensure permissions on /etc/passwd are configured" info : "The /etc/passwd file contains user account information that is used by many system utilities and therefore must be readable for these utilities to operate. 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-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/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/15289" file : "/etc/passwd" owner : "root" mask : "133" group : "root" type : FILE_CHECK description : "6.1.10 Ensure permissions on /etc/shells are 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-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/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/15289" file : "/etc/shells" owner : "root" mask : "133" group : "root" description : "6.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_path=(); a_arr=() # Initialize array a_path=(! -path \"/run/user/*\" -a ! -path \"/proc/*\" -a ! -path \"*/containerd/*\" -a ! -path \"*/kubelet/pods/*\" -a ! -path \"/sys/kernel/security/apparmor/*\" -a ! -path \"/snap/*\" -a ! -path \"/sys/fs/cgroup/memory/*\" -a ! -path \"/sys/fs/selinux/*\") while read -r l_bfs; do a_path+=( -a ! -path \"\"$l_bfs\"/*\") done < <(findmnt -Dkerno fstype,target | awk '$1 ~ /^\s*(nfs|proc|smb)/ {print $2}') # Populate array with files while IFS= read -r -d $'\0' l_file; do [ -e \"$l_file\" ] && a_arr+=(\"$(stat -Lc '%n^%#a' \"$l_file\")\") done < <(find / \( \"${a_path[@]}\" \) \( -type f -o -type d \) -perm -0002 -print0 2>/dev/null) while IFS=\"^\" read -r l_fname l_mode; do # Test files in the array if [ -f \"$l_fname\" ]; then # Remove excess permissions from WW files echo -e \" - File: \\\"$l_fname\\\" is mode: \\\"$l_mode\\\"\n - removing write permission on \\\"$l_fname\\\" from \\\"other\\\"\" chmod o-w \"$l_fname\" fi if [ -d \"$l_fname\" ]; then if [ ! $(( $l_mode & $l_smask )) -gt 0 ]; then # Add sticky bit echo -e \" - Directory: \\\"$l_fname\\\" is mode: \\\"$l_mode\\\" and doesn't have the sticky bit set\n - Adding the sticky bit\" chmod a+t \"$l_fname\" fi fi done < <(printf '%s\n' \"${a_arr[@]}\") unset a_path; unset a_arr # Remove array }" 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-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/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/15289" name : "find_world_writeable_files" description : "6.1.12 Ensure no unowned or ungrouped files or directories 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-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/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/15289" name : "find_orphan_files" description : "6.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-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/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/15289" name : "find_suid_sgid_files" severity : MEDIUM type : FILE_CHECK description : "6.1.2 Ensure permissions on /etc/passwd- are 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-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/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/15289" 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 : "6.1.3 Ensure permissions on /etc/opasswd are 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-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/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/15289" show_output : YES type : FILE_CHECK description : "6.1.4 Ensure permissions on /etc/group are configured" info : "The /etc/group file contains a list of all the valid groups defined in the system. The command below allows read/write access for root and read access for everyone else. 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-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/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/15289" file : "/etc/group" owner : "root" mask : "133" group : "root" type : FILE_CHECK description : "6.1.5 Ensure permissions on /etc/group- are configured" info : "The /etc/group- file contains a backup list of all the valid groups defined in the system. 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-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/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/15289" file : "/etc/group-" owner : "root" mask : "133" group : "root" type : FILE_CHECK description : "6.1.6 Ensure permissions on /etc/shadow are configured" info : "The /etc/shadow file is used to store the information about user accounts that is critical to the security of those accounts, such as the hashed password and other security information. 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-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/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/15289" file : "/etc/shadow" owner : "root" mask : "777" group : "root" type : FILE_CHECK description : "6.1.7 Ensure permissions on /etc/shadow- are configured" info : "The /etc/shadow- file is used to store backup information about user accounts that is critical to the security of those accounts, such as the hashed password and other security information. 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-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/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/15289" file : "/etc/shadow-" owner : "root" mask : "777" group : "root" type : FILE_CHECK description : "6.1.8 Ensure permissions on /etc/gshadow are configured" info : "The /etc/gshadow file is used to store the information about groups that is critical to the security of those accounts, such as the hashed password and other security information. 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-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/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/15289" file : "/etc/gshadow" owner : "root" mask : "777" group : "root" type : FILE_CHECK description : "6.1.9 Ensure permissions on /etc/gshadow- are configured" info : "The /etc/gshadow- file is used to store backup information about groups that is critical to the security of those accounts, such as the hashed password and other security information. 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-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/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/15289" file : "/etc/gshadow-" owner : "root" mask : "777" group : "root" type : CMD_EXEC description : "6.2.1 Ensure accounts in /etc/passwd use shadowed passwords" info : "Local accounts can use 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: # sed -e 's/^\([a-zA-Z0-9_]*\):[^:]*:/\1:x:/' -i /etc/passwd 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-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),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/15289" 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 : "6.2.10 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-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/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/15289" 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 : "6.2.11 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 last 500 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 { 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\" # Maximum number of local interactive users before warning (Default 1,000) [ \"$l_asize \" -gt \"$l_maxsize\" ] && echo -e \"\n ** INFO **\n - \\\"$l_asize\\\" Local interactive users found on the system\n - This may be a long running check\n\" file_access_fix() { l_facout2=\"\" l_max=\"$( printf '%o' $(( 0777 & ~$l_mask)) )\" if [ $(( $l_mode & $l_mask )) -gt 0 ]; then echo -e \" - File: \\\"$l_hdfile\\\" is mode: \\\"$l_mode\\\" and should be mode: \\\"$l_max\\\" or more restrictive\n - Changing to mode \\\"$l_max\\\"\" chmod \"$l_chp\" \"$l_hdfile\" fi if [[ ! \"$l_owner\" =~ ($l_user) ]]; then echo -e \" - File: \\\"$l_hdfile\\\" owned by: \\\"$l_owner\\\" and should be owned by \\\"${l_user//|/ or }\\\"\n - Changing ownership to \\\"$l_user\\\"\" chown \"$l_user\" \"$l_hdfile\" fi if [[ ! \"$l_gowner\" =~ ($l_group) ]]; then echo -e \" - File: \\\"$l_hdfile\\\" group owned by: \\\"$l_gowner\\\" and should be group owned by \\\"${l_group//|/ or }\\\"\n - Changing group ownership to \\\"$l_group\\\"\" chgrp \"$l_group\" \"$l_hdfile\" fi } while read -r l_user l_home; do if [ -d \"$l_home\" ]; then echo -e \"\n - Checking user: \\\"$l_user\\\" home directory: \\\"$l_home\\\"\" 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 ) echo -e \" - File: \\\"$l_hdfile\\\" exists\n - Please investigate and manually delete \\\"$l_hdfile\\\"\" ;; .netrc ) l_mask='0177' l_chp=\"u-x,go-rwx\" file_access_fix ;; .bash_history ) l_mask='0177' l_chp=\"u-x,go-rwx\" file_access_fix ;; * ) l_mask='0133' l_chp=\"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 done <<< \"$(printf '%s\n' \"${a_uarr[@]}\")\" unset a_uarr # Remove array }" 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-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/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/15289" 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@" type : CMD_EXEC description : "6.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-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),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/15289" 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 : "6.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-53|AC-2c.,800-53r5|AC-2c.,CN-L3|7.1.3.2(d),CSF|DE.CM-1,CSF|DE.CM-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-05,CSF2.0|PR.DS-10,GDPR|32.1.b,HIPAA|164.306(a)(1),HIPAA|164.312(a)(1),ISO/IEC-27001|A.9.2.1,ITSG-33|AC-2c.,LEVEL|1A,NESA|T5.2.1,NESA|T5.2.2,NIAv2|AM28,NIAv2|NS5j,NIAv2|SS14e,PCI-DSSv3.2.1|1.1.5,PCI-DSSv3.2.1|7.1.1,PCI-DSSv3.2.1|7.1.3,PCI-DSSv4.0|7.2.1,PCI-DSSv4.0|7.2.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/15289" name : "passwd_invalid_gid" description : "6.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-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),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/15289" name : "passwd_duplicate_uid" description : "6.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-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),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/15289" name : "group_duplicate_gid" description : "6.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 username. If a user is assigned a duplicate user name, it will create and have access to files with the first UID for that username in /etc/passwd For example, if \"test4\" has a UID of 1000 and a subsequent \"test4\" entry has a UID of 2000, logging in as \"test4\" will use UID 1000. Effectively, the UID is shared, which is a security problem." solution : "Based on the results of the audit script, establish unique user names for the users. File ownerships will automatically reflect the change as long as the users have unique UIDs." reference : "800-171|3.5.5,800-171|3.5.6,800-53|IA-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),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/15289" name : "passwd_duplicate_username" description : "6.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-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),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/15289" name : "group_duplicate_name" type : CMD_EXEC description : "6.2.8 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-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/15289" 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]*\\**$" description : "6.2.9 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 Item 5.6 Ensure access to the su command is restricted." solution : "Remove any users other than root with UID 0 or assign them a new UID if appropriate." reference : "800-171|3.1.5,800-53|AC-6(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/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/15289" name : "passwd_zero_uid" description : "Safeguards Oracle Linux 8 v3.0.0" info : "NOTE: Nessus has not identified that the chosen audit applies to the target device." see_also : "https://workbench.cisecurity.org/benchmarks/15289"