Skip to content

Add PGP key rotation PoC for RPM repositories#12276

Open
babakks wants to merge 2 commits intotrunkfrom
babakks/rpm-pgp-key-poc
Open

Add PGP key rotation PoC for RPM repositories#12276
babakks wants to merge 2 commits intotrunkfrom
babakks/rpm-pgp-key-poc

Conversation

@babakks
Copy link
Member

@babakks babakks commented Dec 8, 2025

This PR adds the PGP key rotations spike for RPM repositories.

@babakks babakks requested a review from a team as a code owner December 8, 2025 16:28
@babakks babakks requested review from BagToad and Copilot and removed request for Copilot December 8, 2025 16:28
@babakks babakks requested a review from andyfeller December 8, 2025 16:38
@babakks babakks changed the title babakks/rpm pgp key poc Add PGP key rotation PoC for RPM repositories Dec 8, 2025
@luciaglez877-a11y

This comment was marked as spam.

Signed-off-by: Babak K. Shandiz <babakks@github.com>
Signed-off-by: Babak K. Shandiz <babakks@github.com>
@babakks babakks force-pushed the babakks/rpm-pgp-key-poc branch from 71a532c to 8180ced Compare January 12, 2026 15:52
Copilot AI review requested due to automatic review settings January 12, 2026 15:52
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds a proof-of-concept (PoC) script for demonstrating PGP key rotation in RPM repositories. It also includes a minor fix to the existing Debian development script.

Changes:

  • Introduces a new comprehensive bash script rpm-devel to simulate the RPM repository PGP key rotation workflow
  • Adds sudo to pkill commands in the debian-devel script for consistency with other privileged operations

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.

File Description
script/rpm-devel New 582-line bash script that provides a Docker-based development environment for testing RPM repository PGP key rotation, including setup, key generation, signing, and deprecation workflows
script/debian-devel Fixed teardown function to use sudo for pkill commands, ensuring consistency with other privileged operations in the function
Comments suppressed due to low confidence (6)

script/rpm-devel:340

  • Missing quotes around variable in conditional. For consistency and safety, change to if [ "$CLIENT" == "dnf4" ].
  if [ $CLIENT == "dnf4" ]; then

script/rpm-devel:433

  • Missing quotes around variable in conditional. For consistency and safety, change to if [ "$CLIENT" == "dnf4" ].
  if [ $CLIENT == "dnf4" ]; then

script/rpm-devel:389

  • Spelling error: "PRMs" should be "RPMs".
  header "Step 3: Releasing new version of PRMs, signed with single key (the new key)."

script/rpm-devel:93

  • The condition check is incorrect. This checks if CLIENT equals the string "dnf4", but on line 89 the comparison uses == without quotes around the variable. This should use quotes for consistency and to handle empty values properly. Change to if [ "$CLIENT" == "dnf4" ].
  if [ $CLIENT == "dnf4" ]; then

script/rpm-devel:89

  • The condition check is missing quotes around the variable. This should use quotes for consistency and to handle empty values properly. Change to if [ "$CLIENT" == "dnf4" ].
  if [ $CLIENT == "dnf4" ] && ! command -v dnf4 &> /dev/null; then 

script/rpm-devel:203

  • Missing quotes around variable in conditional. For consistency and safety, change to if [ "$CLIENT" == "dnf4" ].
  if [ $CLIENT == "dnf4" ]; then

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

echo "! Note that the hosted PGP keyring is now updated (includes both keys): http://127.0.0.1:8000/pgp-key.gpg"

prompt_continue
header "Step 3: Releasing new version of PRMs, signed with single key (old key is still valid)."
Copy link

Copilot AI Jan 12, 2026

Choose a reason for hiding this comment

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

Spelling error: "PRMs" should be "RPMs".

This issue also appears in the following locations of the same file:

  • line 389

Copilot uses AI. Check for mistakes.
header "Step 7: installing the packages via dnf"

echo "! Note that you're going to confirm the PGP key import prompt (fingerprint: $KEY1_FINGERPRINT)"
if [ $CLIENT == "dnf4" ]; then
Copy link

Copilot AI Jan 12, 2026

Choose a reason for hiding this comment

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

Missing quotes around variable in conditional. For consistency and safety, change to if [ "$CLIENT" == "dnf4" ].

This issue also appears in the following locations of the same file:

  • line 340
  • line 433
  • line 93
  • line 89
  • line 203

Copilot uses AI. Check for mistakes.
Comment on lines +54 to +74
docker exec rpm-gpg-playground bash -c "cat >> /root/.bashrc << EOF

# Display MOTD
cat << "MOTD"
================================================================================
RPM Repository PGP Key Rotation Development Environment
================================================================================

Welcome to the rpm-gpg-playground container!

Available commands:
$SCRIPT setup - Create initial RPM repository and packages
$SCRIPT newkey - Generate new signing key
$SCRIPT deprecate - Deprecate old signing key
$SCRIPT teardown - Clean up repository and configuration

Run $SCRIPT without arguments for full help.

================================================================================
MOTD
EOF"
Copy link

Copilot AI Jan 12, 2026

Choose a reason for hiding this comment

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

The variable SCRIPT is used in the MOTD at lines 65-70 but won't be expanded within the heredoc that's being written to .bashrc because it's quoted with "EOF". This will result in the literal string "$SCRIPT" being displayed instead of the actual script name. Either use unquoted EOF to allow variable expansion, or replace $SCRIPT with the literal script name "rpm-devel".

Copilot uses AI. Check for mistakes.
License: MIT
Packager: Example Team
Requires: bash
BuildRoot: "$PACKAGE_DIR"
Copy link

Copilot AI Jan 12, 2026

Choose a reason for hiding this comment

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

The BuildRoot directive value should be quoted to avoid potential issues with spaces in paths. Change to BuildRoot: "%{_tmppath}/%{name}-%{version}-%{release}-root" or similar standard format, instead of using a custom path.

Suggested change
BuildRoot: "$PACKAGE_DIR"
BuildRoot: \"%{_tmppath}/%{name}-%{version}-%{release}-root\"

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants