Skip to content

Signing Model

Sign repository metadata so clients catch a tampered mirror, sign RPM files so each package carries its own proof, and rotate keys safely.

A package client can check two different things. With DNF repo_gpgcheck=1 or an APT Signed-By keyring, it verifies the repository metadata: the signed index lists every package with its checksum, so a mirror, proxy, or CDN that alters an index or a package is caught before anything is installed. With DNF gpgcheck=1, it verifies the signature inside each RPM file, which stays with the package wherever the file is copied. The two checks use different mechanisms and tools and can use different keys, so SOW configures them separately for each standard repository.

What gets signed

Setting Signed content Output Client setting
signing.rpm.metadata RPM index manifest repodata/repomd.xml.asc DNF repo_gpgcheck=1
signing.deb.metadata APT release manifest InRelease, Release.gpg APT Signed-By
signing.rpm.packages RPM package Embedded OpenPGP signature DNF gpgcheck=1

SOW signs metadata each time it builds indexes, and metadata signing leaves package bytes untouched. An RPM package signature is written into the file, which changes its bytes and SHA-256, so SOW applies it once, when the package enters the pool. SOW does not sign DEB files: APT trusts a .deb because its checksum appears in the signed index.

Configure metadata signing

repos:
  demo:
    signing:
      rpm:
        metadata:
          key: file:///secure/repo-signing.asc
      deb:
        metadata:
          key: file:///secure/repo-signing.asc
    dists:
      el9:
        format: rpm
      trixie:
        format: deb

This repository has two Dists, or package sets: el9 for RPM and trixie for DEB. They can share one key or use different keys. If the private key is protected, add passfile: /run/secrets/gpg-password next to key; see Key references for other password sources. Then validate, build, and verify:

sow config check
sow build -r demo
sow check -r demo

config check unlocks each metadata key and confirms it can sign, so a wrong password or an unsuitable key fails here instead of in the middle of a build. check verifies every signature in the built tree. Without a configured key, SOW writes unsigned indexes. To set up clients, see Sign your repository.

Key references

A key setting takes one of four reference forms. The form decides where the private key lives and which program signs with it:

Reference Private key Metadata signed by Typical use
keys/repo.asc OpenPGP key file, relative to the workspace root SOW, in process A dedicated repository key kept with the workspace
file:///secure/repo.asc OpenPGP key file at an absolute path SOW, in process A key mounted as a secret outside the workspace
env://SOW_METADATA_KEY Variable holding armored key material, a file path, or a GPG key identifier Depends on the value A key injected by CI
agent://KEY_ID_OR_FINGERPRINT Local GPG keyring or agent External gpg A key that must not leave GPG, such as one on a hardware token

A key file needs no GPG installation for metadata signing. Any reference that resolves to a GPG key identifier (a 16-hex-digit key ID or a 40- or 64-hex-digit fingerprint) runs the external gpg.

For a protected key, SOW reads the password from a file, not from a command-line argument. It uses the first source that is set: --passfile PATH on the command line, then the key’s own passfile, then the SOW_GPG_PASSFILE environment variable. The file holds the password on one line. If the selected file is missing or malformed, the command fails; SOW does not fall back to another source or a prompt. See Password files for the exact format, path rules, and the commands that accept --passfile.

Configure RPM package signing

A package signature lets a client verify an RPM on its own, for example after the file has been copied out of the repository. SOW signs RPMs with the host rpm tool, so install rpm and gpg and make the private key available in the GPG environment that rpm uses. The key reference names the signer; it does not import a private key into that environment.

signing:
  rpm:
    packages:
      mode: fill
      key: agent://7F721C4AD40F4A9D8CA578BFAC7E4690B50CCF3B
      trusted_keys: [keys/upstream.asc]

The mode decides what happens to each incoming RPM:

Mode Incoming RPM Choose it when
never Stored with its input bytes unchanged You ship packages exactly as built, or clients do not use gpgcheck
fill Kept as is if its signature verifies with key or a trusted_keys entry; otherwise signed with key You mix trusted upstream packages with your own builds; clients import your key and each trusted upstream key
always Kept as is if already signed by key; otherwise re-signed with key Every package must verify with your one key

Without a key the default mode is never; with a key it is fill. Both fill and always require a key. sow repo new writes mode: never into sow.yml, so when you add a key, also set mode or delete that line.

Signing happens when a package enters the pool, during add. SOW signs a private copy, so your input file stays unchanged, and accepts the result only if it carries a valid signature from key and the package identity and contents, apart from the signature, are unchanged. From then on the pool object is immutable. A build checks stored RPMs against the current policy but never re-signs them, because a published package URL must keep serving the same bytes: clients and caches that hold the previous index expect the previous checksum. So configure package signing before you import RPMs; enabling it later requires every RPM already in a Dist to satisfy the new policy.

Change keys

Changing a key reference, or the key it resolves to, marks the affected Dists dirty, so the next build re-signs their metadata. Changing only a passfile path does not.

For a metadata key, clients reject metadata signed by a key they do not trust, so the order matters: distribute the new public key to clients, change key in sow.yml, then run sow build, sow check, and sow publish TARGET.

Package signatures cannot be updated in place, because stored packages are immutable. Rotate a package key in stages:

  1. Set the new key as key and use mode: fill.
  2. Keep the old public key in trusted_keys while packages signed by it remain members.
  3. Add new package releases; fill signs the unsigned ones with the new key.
  4. Remove the old key from trusted_keys after you withdraw or replace the old packages.

Switching straight to always with a new key works only if every RPM already in a Dist verifies with that key; otherwise the build is rejected. If a new signature would put different bytes behind an existing package URL, publish a new release with a new filename.

Renewing a certificate does not invalidate old package signatures. RPM verification checks certificate and subkey validity at each package’s signature time, so keep the historical self-signatures and subkey bindings when you export the renewed public key.

Sign a simple repository

sow create can sign the RPM files of a simple repository, but it does not sign metadata. KEY_ID is a 16-, 40-, or 64-hex-digit key ID or fingerprint, with an optional 0x prefix:

sow create /srv/offline --sign-with KEY_ID --passfile /run/secrets/gpg-password

By default SOW signs only RPMs with no parseable signature. --overwrite re-signs every retained RPM. See sow create for the full rules.

Details

Key material. Key files can be ASCII-armored, with human-readable comment lines outside the armor tolerated, or binary OpenPGP data. Metadata signing accepts RSA, EdDSA (Ed25519 and Ed448), ECDSA, and DSA keys. A key reference must resolve to exactly one primary key. A trusted_keys file can hold several complete public keys, including consecutive armored blocks; SOW reads the whole bundle and rejects malformed or truncated input instead of using only the first key.

Passwords. All three signing settings accept passfile, including agent:// keys. With an explicit password file, external GPG unlocks the key non-interactively in loopback mode. Legacy metadata passphrase references still work at the same priority as passfile, but one key cannot set both. A password file may be a regular file, a symlink, or a named pipe whose writer has two seconds to supply the line; SOW removes an optional UTF-8 BOM and one final LF or CRLF and keeps spaces and tabs. SOW never stores password values in journals, so recovery selects the source again from the current command and configuration.

What the checks prove. config show displays references and resolved public identities, never private keys or passwords. config check unlocks metadata key files and checks that they can sign; external GPG metadata keys also run a signing probe. For RPM package signing it checks the password file format, the tools, and secret-key availability, but it does not sign a package or prove the password correct; the first add that signs does. See config check.

Metadata signatures. New metadata signatures use SHA-256, and the signing key must be valid both at the publication time and at the current time; historical verification uses the retained certificate. A new publication requires SHA-256, SHA-384, or SHA-512 in InRelease, Release.gpg, and repomd.xml.asc, so a workspace upgraded with SHA-1 metadata signatures needs a build before its next publication; an existing publication attempt resumes with its recorded files. Signed empty Dists receive the same signature files as populated ones, and the signed body of InRelease matches Release.

Package reuse. When an import matches an existing package object in coordinate and in the digest of its contents without the signature, and that object satisfies the current policy, SOW reuses the stored signed bytes. In never mode, reuse requires an exact byte match.

RPM signature formats. SOW signs with rpm --addsign, or rpm --resign for a package that already has a signature, and passes --define "_gpg_path $GNUPGHOME" when GNUPGHOME is set. It verifies RPM v4 and v6 signatures: native v6 RPMSIGTAG_OPENPGP tag 278 (OpenPGP v4 and v6 signature arrays, including dual- and multi-signed RPMs), RSA, DSA, ECDSA, and EdDSA signatures in tag 267 (RPMSIGTAG_DSA), and legacy PGP tags, including historical CentOS OpenPGP v3 and v4 signatures. When tag 278 is present, it is authoritative. See RPM signatures.

See Sign your repository for an end-to-end setup and Configuration for every signing field.

Table reader