Skip to content

Commit fb555fa

Browse files
committed
Fix no_empty_passwords remediation for RHCOS 9
On RHCOS 9, /usr/bin/authselect exists but PAM files are not managed by authselect. Using authselect rewrites the PAM stack with RHEL 8 era templates (including pam_fprintd.so and a 2018 authselect header) that don't match the actual RHCOS 9 PAM configuration. After applying the authselect-based remediation, the compliance scan still reports FAIL because the OVAL check doesn't recognize the RHEL 8 PAM template as a valid remediated state. Fix: Add an rhcos-specific branch that uses direct sed (via bash_remove_pam_module_option) to surgically remove nullok from the existing PAM files, preserving the RHCOS 9 PAM stack. Verified on OCP 4.22 (RHCOS 9.8): no_empty_passwords flips from FAIL to PASS with the direct sed approach.
1 parent 181f937 commit fb555fa

1 file changed

Lines changed: 12 additions & 1 deletion

File tree

  • linux_os/guide/system/accounts/accounts-restrictions/password_storage/no_empty_passwords/bash

linux_os/guide/system/accounts/accounts-restrictions/password_storage/no_empty_passwords/bash/shared.sh

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# platform = multi_platform_rhel,multi_platform_fedora,multi_platform_ol,multi_platform_rhv,multi_platform_sle,multi_platform_slmicro,multi_platform_ubuntu,multi_platform_almalinux
1+
# platform = multi_platform_rhel,multi_platform_fedora,multi_platform_ol,multi_platform_rhv,multi_platform_sle,multi_platform_slmicro,multi_platform_ubuntu,multi_platform_almalinux,multi_platform_rhcos
22
# reboot = false
33
# strategy = configure
44
# complexity = low
@@ -38,6 +38,17 @@ sed -i -E '/^Auth-Initial:/,/^[^[:space:]]/ {
3838
}' "$config_file"
3939

4040
DEBIAN_FRONTEND=noninteractive pam-auth-update
41+
{{% elif 'rhcos' in product %}}
42+
# RHCOS uses static PAM files not managed by authselect.
43+
# Although /usr/bin/authselect exists on RHCOS 9, using it rewrites
44+
# the PAM stack with RHEL 8 era templates (pam_fprintd.so, etc.)
45+
# that don't match the actual RHCOS 9 PAM configuration, causing
46+
# the compliance scan to still report FAIL after remediation.
47+
# Use direct sed to surgically remove nullok instead.
48+
{{{ bash_remove_pam_module_option('/etc/pam.d/system-auth', 'auth', 'sufficient', 'pam_unix.so', 'nullok') }}}
49+
{{{ bash_remove_pam_module_option('/etc/pam.d/system-auth', 'password', 'sufficient', 'pam_unix.so', 'nullok') }}}
50+
{{{ bash_remove_pam_module_option('/etc/pam.d/password-auth', 'auth', 'sufficient', 'pam_unix.so', 'nullok') }}}
51+
{{{ bash_remove_pam_module_option('/etc/pam.d/password-auth', 'password', 'sufficient', 'pam_unix.so', 'nullok') }}}
4152
{{% else %}}
4253
if [ -f /usr/bin/authselect ]; then
4354
{{{ bash_enable_authselect_feature('without-nullok') }}}

0 commit comments

Comments
 (0)