Extend product-in sed to cover shared/, not-in, and single quotes #2

Merged
alukoshko merged 1 commits from swoutersup/scap-security-guide:fix/product-in-sed-coverage-a9 into a9 2026-07-16 13:31:54 +00:00

View File

@ -37,8 +37,11 @@ find ./shared -type f -exec sed -i \
# silently falls through to the generic `else` branch of those rules (e.g.
# configure_custom_crypto_policy_cis drops NO-SSHWEAKCIPHERS/NO-SSHWEAKMACS/
# NO-WEAKMAC/NO-RPMSHA1, weakening the CIS crypto remediation vs the rhel9 base).
find ./linux_os -type d -name ensure_redhat_gpgkey_installed -prune -o -type f -exec sed -i \
-e '/if product in/ s/"rhel9"/"rhel9", "almalinux9"/g' {} \;
find ./linux_os ./shared -type d -name ensure_redhat_gpgkey_installed -prune -o -type f -exec sed -i \
-e '/if product in/ s/"rhel9"/"rhel9", "almalinux9"/g' \
-e "/if product in/ s/'rhel9'/'rhel9', 'almalinux9'/g" \
-e '/if product not in/ s/"rhel9"/"rhel9", "almalinux9"/g' \
-e "/if product not in/ s/'rhel9'/'rhel9', 'almalinux9'/g" {} \;
find ./linux_os ./shared -type d -name ensure_redhat_gpgkey_installed -prune -o -type f -exec sed -i -E \
-e 's/product == (["'\''])rhel9\1/(product == \1rhel9\1 or product == \1almalinux9\1)/g' {} \;