Skip to content

Fix GPG keyring location for systemd-sysupdate#155

Merged
noahwhite merged 2 commits intodevelopfrom
feature/gho-59-fix-gpg-keyring-location
Feb 16, 2026
Merged

Fix GPG keyring location for systemd-sysupdate#155
noahwhite merged 2 commits intodevelopfrom
feature/gho-59-fix-gpg-keyring-location

Conversation

@noahwhite
Copy link
Copy Markdown
Owner

@noahwhite noahwhite commented Feb 16, 2026

Summary

  • Implement dynamic GPG keyring merge for systemd-sysupdate
  • Store Alloy signing key at /etc/systemd/alloy-sysext.gpg.pub
  • Add merge script and systemd service to combine system keyring with Alloy key
  • Update CLAUDE.md references to the new location

Context

systemd-sysupdate checks global keyrings for GPG signature verification:

  • /usr/lib/systemd/import-pubring.gpg (system - read-only)
  • /etc/systemd/import-pubring.gpg (admin override)

The /etc/systemd/ path overrides (not merges with) /usr/lib/systemd/. The base image already has keys in /usr/lib/systemd/import-pubring.gpg (Fedora/Ubuntu legacy keys). Simply placing our key at /etc/systemd/import-pubring.gpg would lose those system keys.

Implementation

  1. Store Alloy key separately: /etc/systemd/alloy-sysext.gpg.pub
  2. Merge script (/usr/local/bin/sysupdate-merge-keyring.sh):
    • Checks for .pgp first (newer systemd), falls back to .gpg (legacy)
    • Copies system keyring from /usr/lib/systemd/ to /etc/systemd/
    • Uses gpg to import both keyrings and export merged result
    • Cleans up temporary GPG home directory with trap ... EXIT
  3. Systemd service (sysupdate-import-pubring.service):
    • Runs before systemd-sysupdate.service
    • Executes the merge script at boot

This ensures Alloy signing key is always appended to whatever keys come with the base image, even if the base image is updated with different keys.

Test plan

  • Deploy to dev instance
  • Verify sysupdate-import-pubring.service runs successfully
  • Check merged keyring at /etc/systemd/import-pubring.gpg contains both system and Alloy keys
  • Verify systemd-sysupdate -C alloy list shows available versions
  • Verify SHA256SUMS signature verification works

Related

  • Implements: GHO-59
  • Related: alloy-sysext-build SHA256SUMS manifest changes

systemd-sysupdate only checks global keyrings for signature verification:
- /usr/lib/systemd/import-pubring.gpg (system)
- /etc/systemd/import-pubring.gpg (admin)

The previous location (/etc/sysupdate.alloy.d/alloy.gpg) was not used by
systemd-sysupdate. This change moves the key to the correct location so
SHA256SUMS.gpg signature verification works.

Implements: GHO-59
@linear
Copy link
Copy Markdown

linear Bot commented Feb 16, 2026

Instead of statically placing the GPG key at /etc/systemd/import-pubring.gpg
(which would override the system keyring), implement a dynamic merge approach:

- Store Alloy signing key at /etc/systemd/alloy-sysext.gpg.pub
- Add merge script at /usr/local/bin/sysupdate-merge-keyring.sh that:
  - Checks for .pgp (newer systemd) before .gpg (legacy)
  - Copies system keyring from /usr/lib/systemd/ to /etc/systemd/
  - Imports Alloy key using gpg to merge keyrings
  - Cleans up temporary GPG home directory
- Add sysupdate-import-pubring.service that runs before systemd-sysupdate

This ensures the Alloy signing key is always appended to whatever keys
come with the base image (e.g., Fedora/Ubuntu legacy keys), even if
the base image is updated with different keys.
@noahwhite noahwhite merged commit dc913ec into develop Feb 16, 2026
6 checks passed
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.

1 participant