1.2.1.2 Ensure gpgcheck is configured

Information

The gpgcheck option controls verifying package signatures after download. This option is configurable as a global option in the main section of /etc/dnf/dnf.conf and a per repository option in individual files in the /etc/yum.repos.d/* directory.

The option is enabled if gpgcheck is set to 1 true or yes The option is disabled if gpgcheck is set to 0 false or no If an invalid option is set, e.g. gpgcheck=2 the global option will be used.

Settings in files in the /etc/yum.repos.d/ directory take precedence over the global configuration.

It is important to ensure that an RPM's package signature is always checked prior to installation to ensure that the software is obtained from a trusted source.

Solution

Edit /etc/dnf/dnf.conf and set gpgcheck=1 in the [main] section. Example

[main]
gpgcheck=1

Edit any failing files in /etc/yum.repos.d/* and set all instances starting with gpgcheck to 1

Example:

# find /etc/yum.repos.d/ -name "*.repo" -exec echo "Checking:" {} \; -exec sed -i 's/^gpgcheck\s*=\s*.*/gpgcheck=1/' {} \;

See Also

https://workbench.cisecurity.org/benchmarks/23598

Item Details

Category: RISK ASSESSMENT, SYSTEM AND INFORMATION INTEGRITY

References: 800-53|RA-5, 800-53|SI-2, 800-53|SI-2(2), CSCv7|3.4

Plugin: Unix

Control ID: a5ff5386fa79eab6bc1917c6dec6be19d20cf71a5421bc425bdb421031567841