Add rule crypto_policy_not_overridden for RHEL-09-672020#14709
Conversation
|
Skipping CI for Draft Pull Request. |
384f26d to
98de910
Compare
| @@ -0,0 +1,23 @@ | |||
| # platform = multi_platform_rhel,multi_platform_fedora,Oracle Linux 8,Oracle Linux 9 | |||
There was a problem hiding this comment.
I think it should be either multi_platform_all because that would apply for all products that the rule is part of or Red Hat Enterprise Linux if we assume that it won't be reused.
98de910 to
4b9a449
Compare
|
Test results: |
|
|
||
| {{{ bash_instantiate_variables("var_system_crypto_policy") }}} | ||
|
|
||
| dnf -y reinstall crypto-policies |
There was a problem hiding this comment.
Is it necessary to always reinstall?
There was a problem hiding this comment.
probably not, but it might make sense to check if the package is installed and then install it, also using the right package manager variable
There was a problem hiding this comment.
I have rebased the PR and unified all the changes into a single commit.
37f9868 to
3347eb4
Compare
| name: crypto-policies-scripts | ||
| state: present | ||
| become: true | ||
| when: crypto_policy_check.rc != 0 |
There was a problem hiding this comment.
This CI fail in /hardening/host-os/ansible/stig (https://artifacts.dev.testing-farm.io/dae2d564-eda7-418c-87d5-7e3676bd1bbc/#work-stig2qxd149s_plans-upstream-parallel-ansible-stig_1_default-0) looks serious
2026-05-26 11:09:49 test.py:36: lib.results.report_plain:205: FAIL playbook: Ensure System Cryptographic Policy Is Not Overridden - Ensure crypto-policies-scripts package is installed ({"msg": "The conditional check 'crypto_policy_check.rc != 0' failed. The error was: error while evaluating conditional (crypto_policy_check.rc != 0): 'crypto_policy_check' is undefined. 'crypto_policy_check' is undefined\n\nThe error appears to be in '/usr/share/scap-security-guide/ansible/cs9-playbook-stig.yml': line 265, column 5, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n\n - name: Ensure System Cryptographic Policy Is Not Overridden - Ensure crypto-policies-scripts\n ^ here\n"})
It might be related to the optimization that we do in our profile playbooks which is that we move all packages to the beginning.
| name: crypto-policies-scripts | ||
| state: present | ||
| become: true | ||
| when: crypto_policy_check.rc != 0 |
There was a problem hiding this comment.
The CI fails also in Check mode on CS 9
/scanning/host-os/ansible-check/check-mode/stig
2026-05-26 10:38:46 test.py:25: lib.results.report_plain:205: FAIL playbook: Ensure System Cryptographic Policy Is Not Overridden - Ensure crypto-policies-scripts package is installed ({"msg": "The conditional check 'crypto_policy_check.rc != 0' failed. The error was: error while evaluating conditional (crypto_policy_check.rc != 0): 'crypto_policy_check' is undefined. 'crypto_policy_check' is undefined\n\nThe error appears to be in '/usr/share/scap-security-guide/ansible/cs9-playbook-stig.yml': line 265, column 5, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n\n - name: Ensure System Cryptographic Policy Is Not Overridden - Ensure crypto-policies-scripts\n ^ here\n"})
There was a problem hiding this comment.
ok, I have rebased, let's see if it works. But basically I removed the when clause because it was not necessary.
3347eb4 to
28e4367
Compare
|
@ggbecker: The following tests failed, say
Full PR test history. Your PR dashboard. DetailsInstructions 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. I understand the commands that are listed here. |
Description:
crypto_policy_not_overriddento address RHEL-09-672020 ("RHEL 9 cryptographic policymust not be overridden"). The rule includes an SCE check using
update-crypto-policies --check, a Bashremediation, an Ansible remediation, and Automatus test scenarios. The RHEL 9 STIG control entry is
updated from
pendingtoautomated.Rationale:
The DISA STIG requires verifying that the system-wide cryptographic policy has not been overridden by
individual applications. The
update-crypto-policies --checkcommand authoritatively verifies this byregenerating the policy from the current config and byte-comparing the result against the live
/etc/crypto-policies/back-ends/andstate/directories. An SCE check is the most appropriateimplementation because this logic would be tedious and fragile to replicate in OVAL.
Fixes https://redhat.atlassian.net/browse/RHEL-104411
Review Hints:
To test the SCE check, SCE support must be enabled in OpenSCAP and the
openscap-engine-scepackagemust be installed on the target system. Without it, the SCE check will be skipped. Example scan command
with SCE enabled:
oscap xccdf eval --rule xccdf_org.ssgproject.content_rule_crypto_policy_not_overridden --profile xccdf_org.ssgproject.content_profile_stig build/ssg-rhel9-ds.xmlThe two fail scenarios cover the two ways
update-crypto-policies --checkcan detect an override: abackend config file whose content has been replaced (
backend_file_overridden.fail.sh), and a configfile changed without re-running
update-crypto-policies(config_changed_not_applied.fail.sh).The previous
pendingstatus and its explanatory notes instig_rhel9.ymlare intentionally removedas the control is now automated via the new rule.