Remove product-level controls copy to avoid overriding upstream CIS file

Upstream CaC ships a maintained controls/cis_almalinux9.yml with
AlmaLinux-specific adjustments (correct source URL, SSH crypto policy
marked not applicable, almalinux NTP variable, etc.). The product-level
copy mechanically renamed from rhel9 is loaded after the top-level file
and silently overrides it, losing all those adjustments.

Drop products/almalinux9/controls/ entirely so the correct top-level
file is used.
This commit is contained in:
Sam Wouters 2026-07-17 17:07:10 +02:00
parent 44c5def542
commit 715f134d90

View File

@ -84,18 +84,10 @@ if [ -d products/almalinux9/overlays ]; then
products/almalinux9/overlays/*
fi
if [ -d products/almalinux9/controls ]; then
for ctl in $(find products/almalinux9/controls/ -type f -name '*rhel9*'); do
mv "$ctl" "$(echo "$ctl" | sed 's/rhel9/almalinux9/g')"
done
find products/almalinux9/controls -type f -exec sed -i \
-e 's/Red Hat Enterprise Linux/AlmaLinux OS/g' \
-e 's/RHEL9/ALMALINUX9/g' \
-e 's/RHEL-9/ALMALINUX-9/g' \
-e '/^id:/s/rhel9/almalinux9/g' \
-e '/^product:/s/rhel9/almalinux9/g' \
-e 's/ensure_redhat_gpgkey_installed/ensure_almalinux_gpgkey_installed/g' {} \;
fi
# Upstream CaC ships a maintained controls/cis_almalinux9.yml at the top level.
# The product-level copy (mechanically renamed from rhel9) would override it and
# lose AlmaLinux-specific adjustments, so remove it.
rm -fr products/almalinux9/controls
sed -i \
-e 's/rhel9/almalinux9/' \