From Fedora Project Wiki
(Upgrade/compatibility impact)
(How to test)
Line 74: Line 74:
No compatibility or upgrade issues expected.
No compatibility or upgrade issues expected.


== Early Testing (Optional) ==
== How To Test ==
<!-- This is an optional step for system-wide changes to avail of. If you would like to build an initial proof of concept of your change and have a member of Fedora QA help you write and/or run some initial basic tests on your code, please email tests@fedoraproject.org and include the link to your change proposal. This step is *optional*. -->
A good reproducer is already described in [https://github.com/rpm-software-management/dnf5/issues/1192#issuecomment-2018483474 this comment] within the upstream issue.
 
Repository PGP keys are stored as virtual RPM packages with names like `gpg-pubkey-*`. Not all keys have an end of validity date defined.
 
You can list all the key packages with:
 
`rpm -q gpg-pubkey-*`


Do you require 'QA Blueprint' support? Y/N <!-- Optional Step for System-Wide Changes only -->
To query information about a key, use:


== How To Test ==
`rpm -q --qf "%{DESCRIPTION}" gpg-pubkey-3e0c55c2-62bacc45 | gpg --show-keys --with-colon`
<!-- This does not need to be a full-fledged document. Describe the dimensions of tests that this change implementation is expected to pass when it is done.  This can be based off of the above section if early testing has been completed. If it needs to be tested with different hardware or software configurations, indicate them.  The more specific you can be, the better the community testing can be.
 
To get the end date in a human-readable format, run:


Remember that you are writing this how to for interested testers to use to check out your change implementation - documenting what you do for testing is OK, but it's much better to document what *I* can do to test your change.
`rpm -q --qf "%{DESCRIPTION}" gpg-pubkey-3e0c55c2-62bacc45 | gpg --show-keys --with-colon | cut -d':' -f7 | xargs -I{} date -d @{}
`


A good "how to test" should answer these four questions:
You can also try running a transaction using a COPR repository with the `faketime` command from `libfaketime`:


0. What special hardware / data / etc. is needed (if any)?
`faketime '+10years' dnf install <pkg_name_from_copr>`
1. How do I prepare my system to test this change? What packages
need to be installed, config files edited, etc.?
2. What specific actions do I perform to check that the change is
working like it's supposed to?
3. What are the expected results of those actions?
-->


<!-- REQUIRED FOR SYSTEM WIDE CHANGES -->
The above should fail without the functionality introduced by this proposal. After deploying the new plugin, it should prompt the user about the expired PGP key and ask for removal.


== User Experience ==
== User Experience ==

Revision as of 14:50, 26 November 2024

Managing expired PGP keys in DNF5

This is a proposed Change for Fedora Linux.
This document represents a proposed Change. As part of the Changes process, proposals are publicly announced in order to receive community feedback. This proposal will only be implemented if approved by the Fedora Engineering Steering Committee.

Summary

Implementing new logic in DNF5 to remove expired and obsolete PGP keys from the system.

Owner

Current status

  • Targeted release: Fedora Linux 42
  • Last updated: 2024-11-26
  • [Announced]
  • [<will be assigned by the Wrangler> Discussion thread]
  • FESCo issue: <will be assigned by the Wrangler>
  • Tracker bug: <will be assigned by the Wrangler>
  • Release notes tracker: <will be assigned by the Wrangler>

Detailed Description

We aim to address customer issues when installing RPM packages from repositories while outdated repository keys are present on the system. These issues include expired keys, obsolete signing algorithms (e.g., SHA1), or other problems that could be easily detected by tools like an RPM PGP linter. Currently, GPG checks fail, and users must manually remove expired keys using commands like rpm -e gpg-pubkey-....

The proposed solution is a new LIBDNF5 plugin. This plugin will act as a hook, checking for invalid repository PGP keys on the system before executing a DNF transaction.

  • Interactive mode: The plugin will prompt the user to confirm the removal of each invalid key.
  • Non-interactive mode (e.g., with -y or --assumeno): The plugin will proceed automatically based on the specified user action, either removing the keys or retaining them.

By default, this behavior will be enabled in DNF5, with the option to disable it through configuration.

This enhancement stems from a request in upstream issue and builds upon the existing solution in DNF4. Unlike DNF4's implementation, which is not enabled by default, this change will be integral to the default DNF5 functionality, aligning with its role as the primary package manager in Fedora.

Feedback

The proposed solution has been discussed with affected users, including the Mock and Copr teams, as part of the discussions around the existing solution in DNF4.

Additionally, a report from the Kubernetes release team highlights a similar issue, which should also be addressed under the defined behavior.

Benefit to Fedora

This change enables the automatic management of repository keys during software installation or upgrades.

Scope

  • Proposal owners:
    • Implement a new LIBDNF5 plugin to manage repository PGP keys automatically.
  • Other developers:
    • No additional work identified at this time.
  • Policies and guidelines: N/A (not needed for this Change)
  • Trademark approval: N/A (not needed for this Change)

Upgrade/compatibility impact

No compatibility or upgrade issues expected.

How To Test

A good reproducer is already described in this comment within the upstream issue.

Repository PGP keys are stored as virtual RPM packages with names like gpg-pubkey-*. Not all keys have an end of validity date defined.

You can list all the key packages with:

rpm -q gpg-pubkey-*

To query information about a key, use:

rpm -q --qf "%{DESCRIPTION}" gpg-pubkey-3e0c55c2-62bacc45 | gpg --show-keys --with-colon

To get the end date in a human-readable format, run:

rpm -q --qf "%{DESCRIPTION}" gpg-pubkey-3e0c55c2-62bacc45 | gpg --show-keys --with-colon | cut -d':' -f7 | xargs -I{} date -d @{}

You can also try running a transaction using a COPR repository with the faketime command from libfaketime:

faketime '+10years' dnf install <pkg_name_from_copr>

The above should fail without the functionality introduced by this proposal. After deploying the new plugin, it should prompt the user about the expired PGP key and ask for removal.

User Experience

Dependencies

Contingency Plan

  • Contingency mechanism: (What to do? Who will do it?) N/A (not a System Wide Change)
  • Contingency deadline: N/A (not a System Wide Change)
  • Blocks release? N/A (not a System Wide Change), Yes/No


Documentation

N/A (not a System Wide Change)

Release Notes