Skip to content

Fix no_empty_passwords remediation for RHCOS 9#14602

Open
sebrandon1 wants to merge 1 commit intoComplianceAsCode:masterfrom
sebrandon1:fix-rhcos9-pam-nullok
Open

Fix no_empty_passwords remediation for RHCOS 9#14602
sebrandon1 wants to merge 1 commit intoComplianceAsCode:masterfrom
sebrandon1:fix-rhcos9-pam-nullok

Conversation

@sebrandon1
Copy link

Problem

On RHCOS 9, the no_empty_passwords bash remediation uses authselect to remove nullok from PAM files. Although /usr/bin/authselect exists on RHCOS 9, the PAM files are not managed by authselect. Running authselect rewrites the PAM stack with RHEL 8 era templates that include pam_fprintd.so and a 2018 authselect header — these 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 in the Jinja template that uses direct bash_remove_pam_module_option (sed-based) to surgically remove nullok from the existing PAM files, preserving the native RHCOS 9 PAM stack.

Verification

Tested on OCP 4.22 (RHCOS 9.8, 3 masters + 2 workers):

  • Before fix: no_empty_passwords = FAIL (even after applying remediation)
  • After fix (direct sed): no_empty_passwords = PASS

Root Cause Detail

RHCOS 9 /etc/pam.d/system-auth uses pam_usertype.so and pam_sss.so — not pam_fprintd.so or the RHEL 8 authselect template. The authselect remediation replaces the entire file with content that doesn't match what the OVAL check expects on 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.
@openshift-ci
Copy link

openshift-ci bot commented Mar 26, 2026

Hi @sebrandon1. Thanks for your PR.

I'm waiting for a ComplianceAsCode member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work.

Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@openshift-ci openshift-ci bot added the needs-ok-to-test Used by openshift-ci bot. label Mar 26, 2026
@jan-cerny jan-cerny added the CoreOS CoreOS product related. label Mar 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CoreOS CoreOS product related. needs-ok-to-test Used by openshift-ci bot.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants