diff --git a/linux_os/guide/system/accounts/accounts-pam/accounts_password_pam_unix_enabled/bash/shared.sh b/linux_os/guide/system/accounts/accounts-pam/accounts_password_pam_unix_enabled/bash/shared.sh index d3ed274a302a..c3d13462234b 100644 --- a/linux_os/guide/system/accounts/accounts-pam/accounts_password_pam_unix_enabled/bash/shared.sh +++ b/linux_os/guide/system/accounts/accounts-pam/accounts_password_pam_unix_enabled/bash/shared.sh @@ -1,4 +1,4 @@ -# platform = multi_platform_ubuntu +# platform = multi_platform_ubuntu,multi_platform_debian {{% if 'ubuntu' in product or 'debian' in product %}} {{{ bash_pam_unix_enable() }}} diff --git a/linux_os/guide/system/accounts/accounts-pam/locking_out_password_attempts/accounts_password_pam_pwhistory_enabled/bash/shared.sh b/linux_os/guide/system/accounts/accounts-pam/locking_out_password_attempts/accounts_password_pam_pwhistory_enabled/bash/shared.sh index bd7ef67ddd77..eddf0d6281bb 100644 --- a/linux_os/guide/system/accounts/accounts-pam/locking_out_password_attempts/accounts_password_pam_pwhistory_enabled/bash/shared.sh +++ b/linux_os/guide/system/accounts/accounts-pam/locking_out_password_attempts/accounts_password_pam_pwhistory_enabled/bash/shared.sh @@ -1,3 +1,3 @@ -# platform = multi_platform_ubuntu +# platform = multi_platform_ubuntu,multi_platform_debian {{{ bash_pam_pwhistory_enable('cac_pwhistory','requisite') }}} diff --git a/linux_os/guide/system/accounts/accounts-pam/locking_out_password_attempts/accounts_password_pam_pwhistory_remember/bash/debian.sh b/linux_os/guide/system/accounts/accounts-pam/locking_out_password_attempts/accounts_password_pam_pwhistory_remember/bash/debian.sh new file mode 100644 index 000000000000..519e94d8077b --- /dev/null +++ b/linux_os/guide/system/accounts/accounts-pam/locking_out_password_attempts/accounts_password_pam_pwhistory_remember/bash/debian.sh @@ -0,0 +1,21 @@ +# platform = multi_platform_debian + +{{{ bash_pam_pwhistory_enable('cac_pwhistory','requisite') }}} + +{{{ bash_instantiate_variables("var_password_pam_remember") }}} + +sed -i -E '/^Password:/,/^[^[:space:]]/ { + /pam_pwhistory\.so/ { + s/\s*remember=[^[:space:]]*//g + s/$/ remember='"$var_password_pam_remember"'/g + } +}' /usr/share/pam-configs/cac_pwhistory + +sed -i -E '/^Password-Initial:/,/^[^[:space:]]/ { + /pam_pwhistory\.so/ { + s/\s*remember=[^[:space:]]*//g + s/$/ remember='"$var_password_pam_remember"'/g + } +}' /usr/share/pam-configs/cac_pwhistory + +DEBIAN_FRONTEND=noninteractive pam-auth-update --enable cac_pwhistory diff --git a/linux_os/guide/system/accounts/accounts-pam/locking_out_password_attempts/accounts_password_pam_pwhistory_remember/oval/debian.xml b/linux_os/guide/system/accounts/accounts-pam/locking_out_password_attempts/accounts_password_pam_pwhistory_remember/oval/debian.xml new file mode 100644 index 000000000000..739ade74c36e --- /dev/null +++ b/linux_os/guide/system/accounts/accounts-pam/locking_out_password_attempts/accounts_password_pam_pwhistory_remember/oval/debian.xml @@ -0,0 +1,58 @@ +{{% if "debian" in product %}} +{{%- set accounts_password_pam_file = '/etc/pam.d/common-password' -%}} +{{% endif %}} + + + + {{{ oval_metadata("The passwords to remember of pam_pwhistory should be set correctly.", rule_title=rule_title) }}} + + + + + + + + + + + + + + + {{{ accounts_password_pam_file }}} + + 1 + + + + + ^[ \t]*password[ \t]+(?:(?:sufficient)|(?:required)|(?:requisite)|(?:\[.*\]))[ \t]+pam_pwhistory\.so.*$ + + + + + + + + + + + + + + {{{ accounts_password_pam_file }}} + ^[ \t]*password[ \t]+(?:(?:sufficient)|(?:required)|(?:requisite)|(?:\[.*\]))[ \t]+pam_pwhistory\.so[ \t]+[^#\n\r]*\bremember=([0-9]*)\b.*$ + 1 + + + diff --git a/linux_os/guide/system/accounts/accounts-pam/locking_out_password_attempts/accounts_password_pam_pwhistory_use_authtok/bash/debian.sh b/linux_os/guide/system/accounts/accounts-pam/locking_out_password_attempts/accounts_password_pam_pwhistory_use_authtok/bash/debian.sh new file mode 100644 index 000000000000..6696cccfdb36 --- /dev/null +++ b/linux_os/guide/system/accounts/accounts-pam/locking_out_password_attempts/accounts_password_pam_pwhistory_use_authtok/bash/debian.sh @@ -0,0 +1,13 @@ +# platform = multi_platform_debian + +{{{ bash_pam_pwhistory_enable('cac_pwhistory','requisite') }}} +conf_file=/usr/share/pam-configs/cac_pwhistory +if ! grep -qE 'pam_pwhistory\.so\s+[^#]*\buse_authtok\b' "$conf_file"; then + sed -i -E '/^Password:/,/^[^[:space:]]/ { + /pam_pwhistory\.so/ { + s/$/ use_authtok/g + } + }' "$conf_file" +fi + +DEBIAN_FRONTEND=noninteractive pam-auth-update --enable cac_pwhistory diff --git a/linux_os/guide/system/accounts/accounts-pam/locking_out_password_attempts/accounts_password_pam_unix_authtok/bash/debian.sh b/linux_os/guide/system/accounts/accounts-pam/locking_out_password_attempts/accounts_password_pam_unix_authtok/bash/debian.sh new file mode 100644 index 000000000000..bb9b98b0a059 --- /dev/null +++ b/linux_os/guide/system/accounts/accounts-pam/locking_out_password_attempts/accounts_password_pam_unix_authtok/bash/debian.sh @@ -0,0 +1,12 @@ +# platform = multi_platform_debian + +config_file="/usr/share/pam-configs/cac_unix" +{{{ bash_pam_unix_enable() }}} +sed -i -E '/^Password:/,/^[^[:space:]]/ { + /pam_unix\.so/ { + /use_authtok/! s/$/ use_authtok/g + } +}' "$config_file" + + +DEBIAN_FRONTEND=noninteractive pam-auth-update --remove unix --enable cac_unix diff --git a/linux_os/guide/system/accounts/accounts-pam/locking_out_password_attempts/accounts_passwords_pam_faillock_enabled/bash/shared.sh b/linux_os/guide/system/accounts/accounts-pam/locking_out_password_attempts/accounts_passwords_pam_faillock_enabled/bash/shared.sh index 43feff6ed1e8..d3d6d6c575b0 100644 --- a/linux_os/guide/system/accounts/accounts-pam/locking_out_password_attempts/accounts_passwords_pam_faillock_enabled/bash/shared.sh +++ b/linux_os/guide/system/accounts/accounts-pam/locking_out_password_attempts/accounts_passwords_pam_faillock_enabled/bash/shared.sh @@ -1,3 +1,3 @@ -# platform = multi_platform_ubuntu +# platform = multi_platform_ubuntu,multi_platform_debian {{{ bash_pam_faillock_enable() }}} diff --git a/linux_os/guide/system/accounts/accounts-pam/password_quality/password_quality_pwquality/accounts_password_pam_pwquality_enabled/oval/debian.xml b/linux_os/guide/system/accounts/accounts-pam/password_quality/password_quality_pwquality/accounts_password_pam_pwquality_enabled/oval/debian.xml new file mode 100644 index 000000000000..860c199a4ca7 --- /dev/null +++ b/linux_os/guide/system/accounts/accounts-pam/password_quality/password_quality_pwquality/accounts_password_pam_pwquality_enabled/oval/debian.xml @@ -0,0 +1,37 @@ +{{% if 'debian' in product %}} +{{% set configuration_files = ["common-password"] %}} +{{% endif %}} + + + {{{ oval_metadata("Check pam_pwquality module is enabled", rule_title=rule_title) }}} + + {{% for file in configuration_files %}} + + {{% endfor %}} + + + + {{% macro test_pwquality_enabled(path, test_ref) %}} + + + + {{% endmacro %}} + + {{% macro object_pwquality_enabled(path, test_ref) %}} + + {{{ path }}} + ^\s*password\s+(?:(?:required)|(?:requisite))\s+pam_pwquality\.so.*$ + 1 + + {{% endmacro %}} + + {{% for file in configuration_files %}} + {{{ test_pwquality_enabled( path="/etc/pam.d/" ~ file , + test_ref="password_pam_pwquality_enabled_" ~ (file | escape_id)) }}} + {{{ object_pwquality_enabled( path="/etc/pam.d/" ~ file , + test_ref="password_pam_pwquality_enabled_" ~ (file | escape_id)) }}} + {{% endfor %}} + diff --git a/linux_os/guide/system/accounts/accounts-pam/var_password_hashing_algorithm.var b/linux_os/guide/system/accounts/accounts-pam/var_password_hashing_algorithm.var index d955dbe9c17d..2238e4df257e 100644 --- a/linux_os/guide/system/accounts/accounts-pam/var_password_hashing_algorithm.var +++ b/linux_os/guide/system/accounts/accounts-pam/var_password_hashing_algorithm.var @@ -22,3 +22,4 @@ options: cis_rhel8: YESCRYPT|SHA512 cis_rhel10: YESCRYPT|SHA512 cis_fedora: YESCRYPT|SHA512 + cis_debian13: YESCRYPT|SHA512 diff --git a/linux_os/guide/system/accounts/accounts-pam/var_password_hashing_algorithm_pam.var b/linux_os/guide/system/accounts/accounts-pam/var_password_hashing_algorithm_pam.var index b6e46765560f..52a076c46313 100644 --- a/linux_os/guide/system/accounts/accounts-pam/var_password_hashing_algorithm_pam.var +++ b/linux_os/guide/system/accounts/accounts-pam/var_password_hashing_algorithm_pam.var @@ -18,3 +18,4 @@ options: yescrypt: yescrypt cis_rhel8: yescrypt|sha512 cis_rhel10: yescrypt|sha512 + cis_debian13: yescrypt|sha512 diff --git a/linux_os/guide/system/accounts/accounts-restrictions/password_storage/accounts_password_pam_unix_no_remember/bash/shared.sh b/linux_os/guide/system/accounts/accounts-restrictions/password_storage/accounts_password_pam_unix_no_remember/bash/shared.sh index 03336f17073a..0b60e18bc2d9 100644 --- a/linux_os/guide/system/accounts/accounts-restrictions/password_storage/accounts_password_pam_unix_no_remember/bash/shared.sh +++ b/linux_os/guide/system/accounts/accounts-restrictions/password_storage/accounts_password_pam_unix_no_remember/bash/shared.sh @@ -1,4 +1,4 @@ -# platform = multi_platform_rhel,multi_platform_fedora,multi_platform_ol,multi_platform_rhv,multi_platform_almalinux,multi_platform_ubuntu +# platform = multi_platform_rhel,multi_platform_fedora,multi_platform_ol,multi_platform_rhv,multi_platform_almalinux,multi_platform_ubuntu,multi_platform_debian # reboot = false # strategy = configure # complexity = low diff --git a/linux_os/guide/system/accounts/accounts-restrictions/password_storage/no_empty_passwords_unix/bash/shared.sh b/linux_os/guide/system/accounts/accounts-restrictions/password_storage/no_empty_passwords_unix/bash/shared.sh index 39767a05643b..d85a76cd1567 100644 --- a/linux_os/guide/system/accounts/accounts-restrictions/password_storage/no_empty_passwords_unix/bash/shared.sh +++ b/linux_os/guide/system/accounts/accounts-restrictions/password_storage/no_empty_passwords_unix/bash/shared.sh @@ -9,3 +9,11 @@ config_file="/usr/share/pam-configs/cac_unix" sed -i '/pam_unix\.so/s/nullok//g' "$config_file" DEBIAN_FRONTEND=noninteractive pam-auth-update + +# Fallback: remove nullok directly in case pam-auth-update was blocked +# by local modifications to /etc/pam.d/common-* +for pam_file in /etc/pam.d/common-password /etc/pam.d/common-auth \ + /etc/pam.d/common-account /etc/pam.d/common-session \ + /etc/pam.d/common-session-noninteractive; do + [ -f "$pam_file" ] && sed -i '/pam_unix\.so/s/\bnullok\b//g' "$pam_file" +done