Skip to content

GPG signing keys: check, add, activate and distribute

Repod signs the metadata it publishes, and client machines trust the repository because they hold the matching public key. This guide shows how to see which key is in use, what the Générer une nouvelle clé button does, how to make a new key the signing key with Activer, and how to give the public key to your clients.

Generating a key does not change which key signs

Generating a new key adds it to the keyring and to the public key file, but the repository keeps signing with the active key. Until you activate a key explicitly, that is the first key of the keyring, the oldest one. A switch is a separate, deliberate step (section 4), and it breaks every client that has not imported the new key first.


1. How signing works

  • The keyring lives in /repos/gnupg, shared by the backend-api and depot-apt containers.
  • The active key. The key chosen with Activer signs the repository. If you never chose one, it is the first key listed by GnuPG, which is the oldest, exactly as in earlier versions. An update of Repod never changes the signing key by itself.
  • APT. reprepro signs each distribution's Release file with the key named by the SignWith: line of /repos/conf/distributions. Repod writes that file from the active key when the distributions are initialised.
  • RPM. repomd.xml is signed with the same active key.
  • The public key file. /repos/dists/depot.gpg, served by the APT repository, contains the public part of every key of the keyring. A client that imports it trusts all of them.

2. See your keys and the one that signs

In the interface

Open Administration → Paramètres, section Clé GPG du dépôt. It shows the Key ID, the Algorithme, the UID, the expiry date (Expire le) and the Fingerprint of the active key, the one that signs. The other keys of the keyring are listed below it under Autres clés du trousseau, each with an Activer button. The link Afficher la clé publique (PEM) reveals the public key block, with a Copier button.

With commands

List the keys of the keyring, with their creation and expiry dates:

docker compose exec -u appuser backend gpg --homedir /repos/gnupg --list-keys --keyid-format long
pub   rsa4096/XXXXXXXXXXXXXXXX 2026-05-16 [SCEAR] [expires: 2028-05-15]
      0123456789ABCDEF0123456789ABCDEFXXXXXXXXXXXXXXXX
uid                 [ultimate] Repod APT Repository <repod@localhost>

Read which key the APT distributions sign with:

docker compose exec -u appuser backend grep SignWith /repos/conf/distributions

Each SignWith: line holds a key ID. Compare it with the pub lines above. Every key carries the same name, so the ID and the creation date are the only way to tell them apart.

With the API

GET /api/v1/settings/gpg (admin only) returns the list of keys, each flagged active or not, the signing_key_id, and the armored public key block.


3. Add a key

Générer une nouvelle clé, in the same section, asks for a confirmation and then creates a key:

  • RSA 4096 bits, named Repod APT Repository <repod@localhost>;
  • valid for two years;
  • with no passphrase.

The previous keys are kept. Repod then exports the public keys of the whole keyring to /repos/dists/depot.gpg and re-initialises the distributions. The signing key does not change until you activate the new one (next section).

The API equivalent is POST /api/v1/settings/gpg/generate (admin only). If depot.gpg is missing or out of date, POST /api/v1/settings/gpg/export writes it again.


4. Switch the signing key

Do this in order, or clients will fail with NO_PUBKEY:

  1. Generate the new key (section 3). It now appears under Autres clés du trousseau and is already in depot.gpg.
  2. Import depot.gpg again on every client (section 5). The file holds both keys, so clients trust the old and the new one and nothing breaks yet.
  3. Click Activer next to the new key and confirm. Repod rewrites the APT distributions, exports them again and re-signs every RPM repomd.xml.
  4. Check with grep SignWith /repos/conf/distributions (section 2), then run apt update on one client.

The API equivalent is POST /api/v1/settings/gpg/activate with {"key_id": "..."} (admin only). It refuses a key that is missing, revoked, expired or has no private part, and does nothing if the key is already active. If the answer says partial, some RPM distributions could not be re-signed; check the backend logs.

The old key stays in the keyring and in depot.gpg. Repod has no button to remove or revoke a key.


5. Give the public key to your clients

The key is served at /repos/dists/depot.gpg on the APT repository port (80 by default).

curl -fsSL http://YOUR_HOST:80/repos/dists/depot.gpg \
  | sudo gpg --dearmor -o /etc/apt/trusted.gpg.d/repod.gpg
sudo rpm --import http://YOUR_HOST:80/repos/dists/depot.gpg

Before you trust it, compare the fingerprint of what you downloaded with the one shown in Clé GPG du dépôt:

curl -fsSL http://YOUR_HOST:80/repos/dists/depot.gpg | gpg --show-keys --fingerprint

A client that imported depot.gpg earlier holds only the keys that existed at that moment. Before you activate a new key, import the file again on every machine. See Client setup for the full source configuration.


6. Plan around expiry

Keys expire after two years. The date is in Expire le. The expiry that matters is the one of the active key. When the signing key expires, apt update refuses the repository's metadata on every client at once (EXPKEYSIG). Note the date in your calendar, and do the switch of section 4 well before it.

What this version cannot do: retire or revoke a key from the interface.

If you suspect that the private key has been exposed, treat it as a security incident: restrict access to /repos/gnupg, activate a new key as described above, and contact the Repod maintainers. Do not remove the old key from your clients before the new one is active everywhere, or apt update will fail.

Back up the keyring

/repos/gnupg is part of the Repod backup. Losing it means losing the signing key and re-trusting a new one on every client. See Back up and restore.


Troubleshooting

The key URL answers 404

The key is at /repos/dists/depot.gpg. Older instructions used /repos/gpg.key, which does not exist.

NO_PUBKEY on a client

The client does not hold the key that signed the metadata. Import depot.gpg again (section 5).

EXPKEYSIG on a client

The signing key has expired (section 6). Generate a new key and activate it.

Activer answers that the key has no private part

Only keys whose private half is in /repos/gnupg can sign. A key imported without its secret half can be trusted by clients but cannot be activated.

The generation takes a long time or fails

The generation can take several seconds and times out after two minutes if the system lacks entropy. Only an administrator can run it.


What's next