Skip to content

DNF usage of packages with untrusted or missing GPG signatures allowed

Description

This policy detects whether the Ansible `dnf`` module is used to install packages without GPG signature verification. GPG signatures provide assurance that the packages have not been tampered with, and originate from trusted sources.

Code Example

yaml
- name: Example
  ansible.builtin.dnf:
    name: nginx
    state: latest
    disable_gpg_check: false

Remediation

Ansible

  • Module: dnf
  • Attribute: disable_gpg_check

To mitigate this risk, ensure that the disable_gpg_check attribute in your DNF tasks is either set to 'false' or not specified (defaulting to false). This ensures that GPG signature checks are performed, preventing the installation of potentially compromised or untrusted packages.

Secure Code Example:

Rule Details

FieldValue
IDIAC-0051
SeverityMEDIUM
IaC TypeAnsible
FrameworksAnsible
Checkov IDCKV2_ANSIBLE_4

References