Skip to content

Fix crypto policy settings in RHEL CIS profiles#14120

Merged
vojtapolasek merged 6 commits into
ComplianceAsCode:masterfrom
jan-cerny:cis_crypto
Nov 14, 2025
Merged

Fix crypto policy settings in RHEL CIS profiles#14120
vojtapolasek merged 6 commits into
ComplianceAsCode:masterfrom
jan-cerny:cis_crypto

Conversation

@jan-cerny
Copy link
Copy Markdown
Collaborator

@jan-cerny jan-cerny commented Nov 12, 2025

Add a new rule configure_custom_crypto_policy_cis that configures multiple custom crypto sub policy modules for RHEL CIS. The new rule is very similar to fips_custom_stig_sub_policy. It configures new modules for system wide crypto policies that reduces the set of usable ciphers in sshd, MACs, and others.

The rule is templated by a new template crypto_sub_policies that is also introduced in this commit so that the code can be reused in other similar rules.

This change aligns the RHEL CIS profiles in CaC with:

  • CIS RHEL 8 Benchmark v4.0.0
  • CIS RHEL 9 Benchmark v2.0.0
  • CIS RHEL 10 Benchmark v1.0.1

All crypto requirements of the CIS profiles are now covered by this single rule.

This PR replaces the previous PR #14066 - see the discussion there for context!

Resolves: https://issues.redhat.com/browse/RHEL-111896
Also, it resolves crypto-related items from https://issues.redhat.com/browse/RHEL-76009.

@jan-cerny jan-cerny added this to the 0.1.79 milestone Nov 12, 2025
@jan-cerny jan-cerny added bugfix Fixes to reported bugs. Highlight This PR/Issue should make it to the featured changelog. New Rule Issues or pull requests related to new Rules. RHEL9 Red Hat Enterprise Linux 9 product related. Update Profile Issues or pull requests related to Profiles updates. RHEL8 Red Hat Enterprise Linux 8 product related. CIS CIS Benchmark related. RHEL10 Red Hat Enterprise Linux 10 product related. labels Nov 12, 2025
Add a new rule `configure_custom_crypto_policy_cis` that configures multiple
custom crypto sub policy modules for RHEL CIS. The new rule is very
similar to `fips_custom_stig_sub_policy`. It configures new modules for
system wide crypto policies that reduces the set of usable ciphers in
sshd, MACs, and others.

The rule is templated by a new template `crypto_sub_policies` that is
also introduced in this commit so that the code can be reused in other
similar rules.

This change aligns the RHEL CIS profiles in CaC with:
- CIS RHEL 8 Benchmark v4.0.0
- CIS RHEL 9 Benchmark v2.0.0
- CIS RHEL 10 Benchmark v1.0.1

All crypto requirements of the CIS profiles are now covered by this single rule.

Resolves: https://issues.redhat.com/browse/RHEL-111896
Comment on lines +267 to +268
- **sub_policies** - A list of dictionaries. Each dictionary represents one custom crypto sub policy module. The dictionary has the following members:

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please consider adding a simple example.

Copy link
Copy Markdown
Collaborator

@vojtapolasek vojtapolasek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for this rule. I verified it works with Automatus tests.
I have few remarks, please see below.

Comment on lines +10 to +11

update-crypto-policies --set {{{ BASE_POLICY }}}:{{{ CONFIGURE_CRYPTO_POLICY_MODULES }}}
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you think it would make sense to make this command conditional in the same way as in the Ansible remediation?

{{{ oval_metadata("Ensure that the custom crypto policy module is configured", rule_title=rule_title) }}}
<criteria operator="AND" comment="Ensure that all of the correct lines are in the file.">
{{% for sub_policy in SUB_POLICIES %}}
<criterion comment="Check that {{{ sub_policy.key }}} is configured in {{{ sub_policy.name }}}"
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<criterion comment="Check that {{{ sub_policy.key }}} is configured in {{{ sub_policy.name }}}"
<criterion comment="Check that {{{ sub_policy.key }}} is configured in {{{ sub_policy.module_name }}}"

{
"module_name": "NO-SSHWEAKCIPHERS",
"key": "cipher@SSH",
"value": "-3DES-CBC -AES-128-CBC -AES-192-CBC -AES-256-CBC"
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that in RHEL 9 there is the chacha cipher, here it is not. In the original CIS policy, I think there is the chacha mentioned, but at the same time it is marked as manual... maybe this should be checked later.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have created this value based on the RHEL 10 CIS requirement 5.1.6 which has exactly this list of ciphers. There are some mentions of the chacha cipher, but it doesn't say that we should add it to the NO-SSHWEAKCIPHERS.module.

I noticed that the RHEL 9 CIS benchmark contains requirement 1.6.6 "Ensure system wide crypto policy disables chacha20-poly1305 for ssh". But, RHEL 10 CIS benchmark doesn't contain this requirement.

The RHEL 9 requirement 1.6.6 says that the chacha cipher should be disabled only if the system is affected by CVE-2023-48795. It says: if CVE-2023-48795 has been addressed, and it meets local site policy, this
recommendation may be skipped. The Red Hat page https://access.redhat.com/security/cve/cve-2023-48795 doesn't list RHEL 10 as affected by this CVE. Based on that I think the reason the requirement isn't here is because RHEL 10 doesn't suffer from this CVE and therefore it's fine to use the chacha20-poly1305 cipher on RHEL 10.

@jan-cerny
Copy link
Copy Markdown
Collaborator Author

I have added an example to the documentation, I have improved idempotency of the Bash remediation and I have fixed comment in an OVAL criterion element.

{
"module_name": "NO-WEAKMAC",
"key": "mac",
"value": "-*-64*"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we have 64 here and not 128 the same as RHEL8 and RHEL10?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in RHEL9 CIS 2.0.0 we have
1.6.4 Ensure system wide crypto policy disables macs less than
128 bits (Automated)

and then in the code it actually disables 64. Maybe it's an issue in the benchmark.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have created https://workbench.cisecurity.org/benchmarks/18210/tickets/26578 to check if that is a real issue.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So, checking the ticket again, it seems it was a mistake indeed. So your code remains the same as changed in a77ffb1

@ggbecker ggbecker self-assigned this Nov 13, 2025
In RHEL9 CIS 2.0.0 we have 1.6.4 Ensure system wide crypto policy
disables macs less than 128 bits, but the prose says 64. This is an
issue in CIS Benchmark, see
https://workbench.cisecurity.org/benchmarks/18210/tickets/26578
@openshift-ci
Copy link
Copy Markdown

openshift-ci Bot commented Nov 13, 2025

@jan-cerny: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
ci/prow/e2e-aws-openshift-node-compliance a77ffb1 link true /test e2e-aws-openshift-node-compliance

Full PR test history. Your PR dashboard.

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. I understand the commands that are listed here.

@jan-cerny
Copy link
Copy Markdown
Collaborator Author

/test e2e-aws-openshift-node-compliance

Copy link
Copy Markdown
Collaborator

@vojtapolasek vojtapolasek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM now, thank you.

@vojtapolasek vojtapolasek merged commit 43e69b1 into ComplianceAsCode:master Nov 14, 2025
138 of 140 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bugfix Fixes to reported bugs. CIS CIS Benchmark related. Highlight This PR/Issue should make it to the featured changelog. New Rule Issues or pull requests related to new Rules. RHEL8 Red Hat Enterprise Linux 8 product related. RHEL9 Red Hat Enterprise Linux 9 product related. RHEL10 Red Hat Enterprise Linux 10 product related. Update Profile Issues or pull requests related to Profiles updates.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants