8000 Introduce rule enable_gpgcheck_for_all_repositories by jan-cerny · Pull Request #13156 · ComplianceAsCode/content · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Introduce rule enable_gpgcheck_for_all_repositories #13156

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

jan-cerny
Copy link
Collaborator
@jan-cerny jan-cerny commented Mar 10, 2025

This commit introduces new rule enable_gpgcheck_for_all_repositories which is better aligned with DISA rule SV-230264r1017377_rule than currently existing rules ensure_gpgcheck_globally_activated and co-existing ensure_gpgcheck_never_disabled. The rule ensure_gpgcheck_globally_activated checks for gpgcheck=1 in /etc/yum.conf ie. in global configuration. The rule ensure_gpgcheck_never_disabled checks that no .repo file in /etc/yum.repos.d contains gpgcheck=0. DISA's rule SV-230264r1017377_rule checks for gpgcheck settings in all .repo files in /etc/yum.repos.d ie. per-repo configuration. We need to realize that per-repo settings take precendence over global configuration. The new rule enable_gpgcheck_for_all_repositories will check for gpgcheck settings in all .repo files in /etc/yum.repos.d. The commit will add the new rule to RHEL 8 STIG profile.

Fixes: #13110

@jan-cerny jan-cerny added New Rule Issues or pull requests related to new Rules. RHEL8 Red Hat Enterprise Linux 8 product related. STIG STIG Benchmark related. labels Mar 10, 2025
@jan-cerny jan-cerny added this to the 0.1.77 milestone Mar 10, 2025
@jan-cerny jan-cerny requested a review from a team as a code owner March 10, 2025 10:39
Copy link

This datastream diff is auto generated by the check Compare DS/Generate Diff

Click here to see the full diff
New content has different text for rule 'xccdf_org.ssgproject.content_rule_ensure_gpgcheck_never_disabled'.
--- xccdf_org.ssgproject.content_rule_ensure_gpgcheck_never_disabled
+++ xccdf_org.ssgproject.content_rule_ensure_gpgcheck_never_disabled
@@ -170,9 +170,6 @@
 SRG-OS-000366-GPOS-00153
 
 [reference]:
-RHEL-08-010370
-
-[reference]:
 R59
 
 [reference]:
@@ -184,9 +181,6 @@
 [reference]:
 6.3
 
-[reference]:
-SV-230264r1017377_rule
-
 [rationale]:
 Verifying the authenticity of the software prior to installation validates
 the integrity of the patch or upgrade received from a vendor. This ensures

ansible remediation for rule 'xccdf_org.ssgproject.content_rule_ensure_gpgcheck_never_disabled' differs.
--- xccdf_org.ssgproject.content_rule_ensure_gpgcheck_never_disabled
+++ xccdf_org.ssgproject.content_rule_ensure_gpgcheck_never_disabled
@@ -8,7 +8,6 @@
   tags:
   - CCE-80792-5
   - CJIS-5.10.4.1
-  - DISA-STIG-RHEL-08-010370
   - NIST-800-171-3.4.8
   - NIST-800-53-CM-11(a)
   - NIST-800-53-CM-11(b)
@@ -42,7 +41,6 @@
   tags:
   - CCE-80792-5
   - CJIS-5.10.4.1
-  - DISA-STIG-RHEL-08-010370
   - NIST-800-171-3.4.8
   - NIST-800-53-CM-11(a)
   - NIST-800-53-CM-11(b)

This commit introduces new rule `enable_gpgcheck_for_all_repositories`
which is better aligned with DISA rule `SV-230264r1017377_rule` than
currently existing rules `ensure_gpgcheck_globally_activated` and
co-existing `ensure_gpgcheck_never_disabled`.  The rule
`ensure_gpgcheck_globally_activated` checks for `gpgcheck=1` in
`/etc/yum.conf` ie. in global configuration.  The rule
`ensure_gpgcheck_never_disabled` checks that no `.repo file in
`/etc/yum.repos.d` contains `gpgcheck=0`. DISA's rule
`SV-230264r1017377_rule` checks for `gpgcheck` settings in all `.repo`
files in `/etc/yum.repos.d` ie. per-repo configuration. We need to
realize that per-repo settings take precendence over global
configuration.  The new rule `enable_gpgcheck_for_all_repositories` will
check for `gpgcheck` settings in all `.repo` files in
`/etc/yum.repos.d`.  The commit will add the new rule to RHEL 8 STIG
profile.

Fixes: ComplianceAsCode#13110
@jan-cerny
8000
jan-cerny force-pushed the enable_gpgcheck_for_all_repositories branch from 9acf000 to 5f9f27d Compare March 10, 2025 11:55
@Mab879 Mab879 self-assigned this Mar 10, 2025
checktext: |-
Verify the operating system prevents the installation of patches, service packs, device drivers, or operating system components from a repository without verification that they have been digitally signed using a certificate that is recognized and approved by the organization.

Check that YUM verifies the signature of packages from a repository prior to install with the following command:
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
Check that YUM verifies the signature of packages from a repository prior to install with the following command:
Check that DNF verifies the signature of packages from a repository prior to install with the following command:

YUM has been dead since RHEL 8 has been released.

or use {{{ pkg_manager }}}.

gpgcheck=1

checktext: |-
Verify the operating system prevents the installation of patches, service packs, device drivers, or operating system components from a repository without verification that they have been digitally signed using a certificate that is recognized and approved by the organization.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
Verify the operating system prevents the installation of patches, service packs, device drivers, or operating system components from a repository without verification that they have been digitally signed using a certificate that is recognized and approved by the organization.
Verify {{{ full_name }}} prevents the installation of patches, service packs, device drivers, or operating system components from a repository without verification that they have been digitally signed using a certificate that is recognized and approved by the organization.

A value of <tt>0</tt> indicates that <tt>gpgcheck</tt> has been disabled for that repo.

fixtext: |-
Configure the operating system to verify the signature of packages from a repository prior to install by setting the following option in the "/etc/yum.repos.d/[your_repo_name].repo" file:
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
Configure the operating system to verify the signature of packages from a repository prior to install by setting the following option in the "/etc/yum.repos.d/[your_repo_name].repo" file:
Configure {{{ full_name }}} to verify the signature of packages from a repository prior to install by setting the following option in the "/etc/yum.repos.d/[your_repo_name].repo" file:

cat > /etc/yum.repos.d/fedora.repo <<EOF
[fedora]
name=Fedora 41 - x86_64
#baseurl=http://download.example/pub/fedora/linux/releases/41/Everything/x86_64/os/
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
#baseurl=http://download.example/pub/fedora/linux/releases/41/Everything/x86_64/os/
#baseurl=http://download.example.com/pub/fedora/linux/releases/41/Everything/x86_64/os/

Please replace this everywhere in your examples. Just to be safe.

- encrypt_partitions
- ensure_gpgcheck_globally_activated
Copy link
Member

Choose a reason for hiding this comment

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

Do these need to go into the default.profile?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

They don't, they are part of many other RHEL 8 profiles (CIS, ANSSI, ...).

@jan-cerny
Copy link
Collaborator Author

/packit build

2 similar comments
@Mab879
Copy link
Member
Mab879 commented Mar 11, 2025

/packit build

@jan-cerny
Copy link
Collaborator Author

/packit build

Copy link
codeclimate bot commented Mar 12, 2025

Code Climate has analyzed commit 586ed5d and detected 0 issues on this pull request.

The test coverage on the diff in this pull request is 100.0% (50% is the threshold).

This pull request will bring the total coverage in the repository to 62.0% (0.0% change).

View more on Code Climate.

@Mab879
Copy link
Member
Mab879 commented Mar 12, 2025

Automatus tests pass locally, waving.

@Mab879 Mab879 merged commit 5e68e26 into ComplianceAsCode:master Mar 12, 2025
106 of 111 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
New Rule Issues or pull requests related to new Rules. RHEL8 Red Hat Enterprise Linux 8 product related. STIG STIG Benchmark related.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ensure_gpgcheck_globally_activated is misaligned with DISA
2 participants
0