Fix STIG playbook: PAM faillock guard, FIPS module config, IMA hash#1643
Open
dcasota wants to merge 1 commit intovmware:5.0from
Open
Fix STIG playbook: PAM faillock guard, FIPS module config, IMA hash#1643dcasota wants to merge 1 commit intovmware:5.0from
dcasota wants to merge 1 commit intovmware:5.0from
Conversation
Category A fixes for the STIG hardening playbook (backward-compatible
with Ansible 2.14+ and audit 3.x/4.x):
1. Add '| default("")' to PHTN-50-000192 pam_faillock when: conditions
to prevent PAM stack corruption when regex_search() returns None
2. Add ima_hash=sha256 kernel parameter when fips=1 is active
3. Generate /etc/ssl/fipsmodule.cnf when FIPS provider is present but
config is missing
Change-Id: If2b2c4ac079d6ef41ac521acb59d010200a95003
Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
4a9c6a5 to
24cffc3
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Upstream commit
85c56e7(Patch2, Release 2.1-6) fixed the STIG hardening playbook for Ansible 2.20 boolean conditionals and audit 4.x tool renames, but left three gaps:PHTN-50-000192 PAM stack corruption: The
regex_search()in the PAM faillock cleanupset_factstill returnsNoneunder Ansible 2.20. The comparisonpreauthsearch == ""evaluates toFalsewhenpreauthsearchisNone, causing the cleanup step to be skipped while the add step still runs, producing duplicatepam_faillock.soentries in/etc/pam.d/system-auth.Missing
ima_hash=sha256: IMA defaults to SHA1 which is disabled under FIPS, causingima: Can not allocate sha1 (reason: -2)during boot.Missing
fipsmodule.cnf: When the FIPS provider is installed but/etc/ssl/fipsmodule.cnfis absent, OpenSSL cannot initialize FIPS mode andpam_unix.sofails to verify passwords.Fix
Patch:
fix-stig-playbook-fips-pam.patch(Patch3, Release 2.1-7) -- all changes are backward-compatible with Ansible 2.14+:| default('')to PHTN-50-000192when:conditions (no-op when value is already a string on older Ansible)ima_hash=sha256kernel parameter whenfips=1is active/etc/ssl/fipsmodule.cnfviaopenssl fipsinstallwhen the FIPS provider is present but config is missingCompatibility
| default('')Nonecomparison errorima_hash=sha256fipsmodule.cnfgenerationTesting
Tested on VMware Workstation (UEFI, TPM 2.0, VM encryption):
Known Issue: IMA SHA1 allocation under FIPS
The
ima_hash=sha256parameter redirects IMA file measurements to SHA256, but the kernel still attempts SHA1 for the PCR bank (ima: Can not allocate sha1 (reason: -2)). This is non-fatal. A full fix requiresCONFIG_IMA_DEFAULT_HASH_SHA256in the kernel, as tracked in Ubuntu Bug #2041735.