Skip to content

Conversation

@deeplow
Copy link

@deeplow deeplow commented Jan 23, 2026

This includes two relevant fixes:

  • Improves key add/remove time accuracy, removing the need to wait 15 seconds for key import before running qubes-dom0-update. This is based on some of Marek's feedback on for Qubes Contrib's own keyring
  • Adds the dnf substitution $releasever in repo file to support inplace upgrades — Even thought we had previously noticed the possible need to do this, at the time it was not clear the dark magic behind inplace upgrade and following the pattern Qubes Contrb's own keyring would suffice (to have the builder replace @DIST@ with the OS version). It turned out this wouldn't work for our case, and so we need the $releasever.

It also includes some other changes (.github/CODEOWNERS, scripts/build-rpm.sh and sd-qubes-builder/*) which are not relevant really relevant, but they are more artifacts of some internal development we've done (to keep both repos in sync). If they cause any trouble, please let me know.

At Freedom of the Press Foundation, we have tested this with an in-place upgrade successfully from Qubes 4.2 to 4.3.

After this gets merged, this package is ready for release for both Qubes 4.2 and 4.3 (CC @fepitre)

deeplow and others added 19 commits December 4, 2025 17:38
Bump developer key (Cory) to make FPF's CI happy
Replace baseurl: use Qubes release instead of fedora
Necessary due to the following Qubes Builder error:

    13:58:50 [qb.fetch.securedrop-workstation-keyring.fetch] --> Verifying tags or commits...
    13:58:50 [qb.fetch.securedrop-workstation-keyring.fetch] ---> No tag pointing at b9e0e3a
    13:58:50 [qb.fetch.securedrop-workstation-keyring.fetch] ERROR: CalledProcessError(1, ['git', '-c', 'gpg.program=/usr/bin/gpg', '-c', 'gpg.minTrustLevel=fully', 'verify-commit', '--raw', '--', 'b9e0e3a5cbbee22ab85ad1aa8e5a3f9461534321']); stderr: error: gpg.ssh.allowedSignersFile needs to be configured and exist for ssh signature verification
    13:58:50 [qb.fetch.securedrop-workstation-keyring.fetch]
    13:58:50 [qb.fetch.securedrop-workstation-keyring.fetch] ---> Invalid commit b9e0e3a.
    [...]

Fixes #49
Initialize empty git SSH signers file
Reduce the need to duplicate code that manages package RPM keys that
otherwise could lead to the introduction of bugs.
According to systemd.timer man page the default timer accuracy is 1
minute. This needed to be overridden to a value closer to our set delay
for it to more accurately trigger at the previously set --on-action=5s.

Refs #36
Makes all systemd timers through 'sh -c' both for consistency but also
to make sure all logic falls within system timers and not regular
post-inst execution. This also removes '||:' at the end, in order to
flag any problems.
Previously the systemd-timers triggered by the RPM scriptlets would only
run once. If unsuccessful (i.e. the RPM transaction is still occurring,
and the RPM key DB is locked) they would never have an effect. A timeout
was also added to ensure there is a time limit.

By allowing multiple retries until successful we further guarantee
successful execution. Fixes #36
Especially under testing conditions (where packages are installed and
uninstalled), it was possible that some timers would be hanging and
interfering with future tests. This commit solves this issue by making
checking keys before removing them.

The only exception is importing a key in case of upgrade - this is
because when a key is modified (e.g. expiration bump) it keeps the same
key ID, but still needs to be imported, in order for the RPM to be aware
of the updated version. Therefore, in these cases, the key is imported
unconditionally.
Previously it was unclear which key IDs one was supposed to replace upon
key rotation. This separates out the logic pertaining to old keys and
the one related to new keys.

This separation also makes it clear what is expected to happen during
a package upgrade that replaces the key with a new one versus one where
it simply updates a key (e.g. new signatures / new expiration date).

NOTES:

1. Since the workstation has never had to rotate the old key ID is just
   a placeholder (gpg-pubkey-000000-000000). This should still work as
   it is simply trying to removing something that never existed.

2. This does not address situations where the user is upgrading from one
   key directly to another, but skipping a key rotation. This is an
   unlikely scenario as keys are only rarely expected to be rotated and
   such an outdated system would need a reinstall to be safe to use.
Some of the macros were duplicated, which leads to potentially
forgetting to change something. This uses parameterized macros to follow
the DRY principle.
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.

5 participants