From 63e12cce39f73d2b86e7cd8cae8553c90f1a28b0 Mon Sep 17 00:00:00 2001 From: Watson Yuuma Sato Date: Fri, 4 Sep 2026 17:00:11 +0200 Subject: [PATCH] Fix crypto policy check/remediation on RHCOS 10 (CMP-4632) On RHEL 10 the DEFAULT crypto policy already disables SHA-1, and the NO-SHA1 subpolicy module no longer exists. On RHCOS 10 nodes the e8 profile pins var_system_crypto_policy=DEFAULT:NO-SHA1, so: - the MachineConfig remediation runs "update-crypto-policies --set DEFAULT:NO-SHA1", which fails with "Unknown policy NO-SHA1", and - the OVAL check exact-matches DEFAULT:NO-SHA1 against the on-disk policy, which is DEFAULT, leaving configure_crypto_policy stuck at FAIL after remediation. The rhcos4 product spans RHEL8/9 and RHEL10 nodes under one profile, so the expected value cannot be set per-node via the profile variable. Fix it scan-time, scoped to rhcos4: - kubernetes/shared.yml: the MachineConfig ExecStart now detects the RHEL base from /etc/os-release and strips a trailing :NO-SHA1 on VERSION_ID >= 10 before applying the policy. No-op on RHEL8/9 and on rhel/fedora datastreams (their profiles never request :NO-SHA1). - oval/rhcos4.xml (new): product-specific OVAL override that keeps the exact DEFAULT:NO-SHA1 match on RHEL8/9-based nodes and, on RHEL10-based nodes (gated by installed_OS_is_rhcos4_rhel10), compares the on-disk policy against the :NO-SHA1-stripped effective value. The shared OVAL is untouched, so rhel9/rhel10 datastreams are unchanged. bash and ansible remediations are left as-is (RHCOS applies only the MachineConfig remediation). Co-Authored-By: Claude Opus 4.8 --- .../kubernetes/shared.yml | 2 +- .../configure_crypto_policy/oval/rhcos4.xml | 135 ++++++++++++++++++ 2 files changed, 136 insertions(+), 1 deletion(-) create mode 100644 linux_os/guide/system/software/integrity/crypto/configure_crypto_policy/oval/rhcos4.xml diff --git a/linux_os/guide/system/software/integrity/crypto/configure_crypto_policy/kubernetes/shared.yml b/linux_os/guide/system/software/integrity/crypto/configure_crypto_policy/kubernetes/shared.yml index dd096ab419a0..35c3d1e9e6f3 100644 --- a/linux_os/guide/system/software/integrity/crypto/configure_crypto_policy/kubernetes/shared.yml +++ b/linux_os/guide/system/software/integrity/crypto/configure_crypto_policy/kubernetes/shared.yml @@ -19,7 +19,7 @@ spec: Before=kubelet.service [Service] Type=oneshot - ExecStart=update-crypto-policies --set {{.var_system_crypto_policy}} + ExecStart=/bin/bash -c 'source /etc/os-release; policy="{{.var_system_crypto_policy}}"; if [ "${VERSION_ID%%.*}" -ge 10 ]; then policy="${policy%%:NO-SHA1}"; fi; update-crypto-policies --set "$policy"' RemainAfterExit=yes [Install] WantedBy=multi-user.target diff --git a/linux_os/guide/system/software/integrity/crypto/configure_crypto_policy/oval/rhcos4.xml b/linux_os/guide/system/software/integrity/crypto/configure_crypto_policy/oval/rhcos4.xml new file mode 100644 index 000000000000..0257ac5fdd52 --- /dev/null +++ b/linux_os/guide/system/software/integrity/crypto/configure_crypto_policy/oval/rhcos4.xml @@ -0,0 +1,135 @@ + + + {{{ oval_metadata("Ensure crypto policy is correctly configured in /etc/crypto-policies/config, and the policy is current. On RHEL10-based RHCOS the :NO-SHA1 subpolicy no longer exists and is dropped, so the base policy is expected instead.", rule_title=rule_title) }}} + + + + + + + + + + + + + + + + + + + + /etc/crypto-policies/state/current + + + + /etc/crypto-policies/config + + + + + + + + + + + + + + + + + variable_crypto_policies_config_file_timestamp + + + + + + + + + + + + + /etc/crypto-policies/config + ^(?!#)(\S+)$ + 1 + + + + + + + + + + + + + /etc/crypto-policies/state/current + ^(?!#)(\S+)$ + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + /etc/crypto-policies/back-ends/nss.config + + + + +