Skip to content

Add ensure_redhat_gpgkey_installed to RHEL CIS#14531

Open
jan-cerny wants to merge 3 commits intoComplianceAsCode:masterfrom
jan-cerny:ensure_redhat
Open

Add ensure_redhat_gpgkey_installed to RHEL CIS#14531
jan-cerny wants to merge 3 commits intoComplianceAsCode:masterfrom
jan-cerny:ensure_redhat

Conversation

@jan-cerny
Copy link
Collaborator

@jan-cerny jan-cerny commented Mar 5, 2026

We have discovered that after hardening a RHEL 9 system with CIS profile people can't install any RPM packages using dnf.

Originally, we thought that the problem was caused by the recent PR #14316 but it isn't caused by that because the problem is reproducible also with the latest released version 0.1.79. 

The actual reason is that the profile requires GPG checks everywhere but the GPG key isn't installed because the CIS profile doesn't contain rule ensure_redhat_gpgkey_installed that would install the GPG key. This is a bad user experience.

The rule ensure_redhat_gpgkey_installed is listed in the CIS control files but the control is manual so the rule isn't include to the profile. In the CIS Benchmark, the requirement is manual, because of GPG keys for 3rd party repositories. But, we can automate the part for Red Hat GPG key.

This PR changes RHEL 8, 9 and 10 CIS profiles.

We have discovered that after hardening a RHEL 9 system with CIS profile
people can't install any RPM packages using dnf. Originally, we thought
that the problem was caused by the recent PR
ComplianceAsCode#14316 but it isn't
caused by that because the problem is reproducible also with the latest
released version 0.1.79.  The actual reason is that the profile requires
GPG checks everywhere but the GPG key isn't installed because the CIS
profile doesn't contain rule `ensure_redhat_gpgkey_installed` that would
install the GPG key. The rule is listed in the CIS RHEL9 control file
but the requirement is manual. This is a bad user experience. In CIS
Benchmark, the requirement is manual, because of GPG keys for 3rd party
repositories.  But, add the rule `ensure_redhat_gpgkey_installed` to the
profile because the requirement 1.2.1.2 adds
`ensure_gpgcheck_never_disabled` which requires GPG key checking. If the
Red Hat GPG key wouldn't be installed, people won't be able to install
any RPM package using dnf.  Therefore, we will add the rule
`ensure_redhat_gpgkey_installed` to RHEL 9 CIS.
@jan-cerny jan-cerny added this to the 0.1.81 milestone Mar 5, 2026
@jan-cerny jan-cerny added the CIS CIS Benchmark related. label Mar 5, 2026
@openshift-ci
Copy link

openshift-ci bot commented Mar 5, 2026

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@openshift-ci openshift-ci bot added the do-not-merge/work-in-progress Used by openshift-ci bot. label Mar 5, 2026
Add rule ensure_redhat_gpgkey_installed to RHEL 8 CIS and RHEL 10 CIS profiles.
Similar to previous commit
@jan-cerny jan-cerny changed the title Add ensure_redhat_gpgkey_installed to RHEL 9 CIS Add ensure_redhat_gpgkey_installed to RHEL CIS Mar 5, 2026
@jan-cerny jan-cerny marked this pull request as ready for review March 6, 2026 10:07
@jan-cerny jan-cerny requested review from a team, Mab879 and vojtapolasek as code owners March 6, 2026 10:07
@openshift-ci openshift-ci bot removed the do-not-merge/work-in-progress Used by openshift-ci bot. label Mar 6, 2026
@Mab879 Mab879 self-assigned this Mar 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CIS CIS Benchmark related.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants