Skip to content

Bind repository definitions to publisher signing keys

Scope APT trust to each publisher, enable native RPM verification, and distribute reviewed certificates with PIG.

Decision date: 2026-12-02
Status: Released in v1.12.0.
Current reference: Repository signing keys
Scope: Online catalog repositories, their keys, and migration of existing definitions.

Decision

Each signed catalog entry names a publisher key group. PIG resolves it for the host, installs the selected certificates, and writes the package manager’s verification settings. A missing key for a selected repository or a conflict with an active APT source stops configuration before repository files are moved. The user still runs pig repo add pgsql -u.

Context

The previous design prepared one Pigsty key and allowed setup to continue if that key could not be installed. The APT reconciliation in v1.11.0 also preserved the existing policy for a shared URI and suite. This could carry trusted=yes into a new definition. Released implementation

A module can contain several publishers. A mirror can serve several upstreams. PGDG even publishes separate RPM certificates for EL 7 and for different architectures. Binding trust to a module, hostname, or short key ID loses those distinctions. PGDG RPM keys

Alternatives

Fetching a key from each mirror at setup time would let the mirror supply both the packages and their trust anchor. Importing every publisher into APT’s global trust store would let a key authenticate unrelated archives. Bundling the public certificates keeps key acquisition offline and makes changes to the trust anchors reviewable in Git. The OS archive keyring remains maintained by the distribution. APT source options

Contract

  • A repository in cli/repo/assets/repo.yml selects a key. The registry in cli/repo/assets/keys.json records the certificate ID, source URL and full primary fingerprints. Release and architecture selectors distinguish signing variants. One group can supply more than one certificate.
  • APT uses signed-by with the distribution keyring or an armored file under /etc/apt/keyrings/pig/. EL uses local gpgkey references under /etc/pki/rpm-gpg/pig/ and package verification by default. RPM’s package trust database is shared. Metadata verification uses a separate native keyring for each repository. For explicit gpgkey references, the package manager decides when and where to import the key. DNF configuration
  • TimescaleDB on EL authenticates metadata and the package digests it carries. GitLab publishes separate metadata and package keys, and PIG enables both checks. An initial DNF/Yum refresh may approve metadata key imports for matching generated stanzas with verified local key bytes. The host-wide refresh follows the administrator’s native confirmation policy. TimescaleDB configuration, GitLab signing keys
  • Re-adding a module replaces its old trust options. On APT, active definitions for a shared URI and suite must agree across selected modules and retained files. Disabled Deb822 stanzas are skipped. For the same built-in distribution archive, additive setup follows a retained source’s equivalent system keyring spelling or its legacy default keyring. Other publishers keep their scoped keys. A conflict reports the retained file. Replacement backs up the active definitions and restores them if the package manager exits with an error. PIG runs apt-get update using the host’s configured error mode.
  • The local bundle stays an explicit unsigned source. Older catalogs inherit published bindings by repository name and canonical upstream unless they explicitly disable verification, including retired PGDG entries retained in a cached catalog. A selected entry that combines a bundled signer with a verification bypass is rejected. A private publisher can supply native key references, including 40-hex OpenPGP fingerprints and ! subkey qualifiers in APT signed-by. Selecting a repository with an unrecognized key on the current platform raises an error before key installation or repository file changes. Other modules remain usable.

Impact

The binary carries 37 armored certificate files. The two system keyring references add no certificate payload. A user can configure any built-in online entry without fetching a signing key. The two pigsty-local definitions cover offline or intranet use.

Run python3 bin/repo-keys.py to check the release inputs offline. Maintainers can use python3 bin/repo-keys.py --refresh pgdg-apt to refresh a single certificate from its registered source. A changed primary fingerprint set requires independent publisher verification and a reviewed registry edit. A same-key renewal can change the bytes while preserving the fingerprint. The checker reports upcoming primary and signing subkey expirations 45 days in advance. It reports retired signing subkeys and requires a usable signer on each certificate. Re-adding the repository installs the new file atomically. When the Pigsty certificate itself changes, update the installation guide’s shared pigsty_key_sha256 parameter for first-time installations.

repo reload distributes repository definitions. New trust anchors ship in a PIG release, and the release workflow runs python3 bin/repo-keys.py. During a rotation, a group may carry both authorized keys for the overlap period. Removing a key reference from the catalog does not revoke keys previously imported into RPM’s databases. Revocation requires the publisher’s native key removal procedure as well.

Verification

Source revision 9e97e89d4928aa5eba51af4eb2504286f39858dc contains the registry and executable tests. Run python3 bin/repo-keys.py, go test ./... and go vet ./... at that revision. The catalog test covers ten OS releases on both architectures. It checks the resolved verification policy for each available entry.

For keys retrieved by fingerprint from a keyserver, the publisher supplies the identity. CentOS lists the CentOS 7 and SCLo fingerprints. Launchpad exposes the signing fingerprint on each PPA, and the Groonga release RPM ships its signing certificate. CentOS fingerprints, Groonga PPA, HAProxy PPA, Groonga release RPM

The public repo.yml retrieved on 2026-12-02 matched all 77 canonical definitions. An offline Debian 12 run of pig repo add pgsql -m with that catalog replaced old trusted=yes entries with two scoped key references. On the same date, gpgv verified 20 upstream APT Release signatures with their individual keyrings, including both Ubuntu PPAs.

The Linux acceptance binary was built with CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -trimpath. In disposable Debian 12, Debian 13 and Ubuntu 24 containers, pig repo add pgsql -u --region default refreshed both Pigsty and PGDG indexes. In Rocky 9, DNF refreshed ClickHouse metadata and installed a signed Pigsty RPM. An isolated RPM database verified six Pigsty and PGDG packages. In Debian 12, changing a previously authenticated InRelease produced BADSIG. With the prototype’s strict APT error mode, pig repo set restored the old source file. Catalog-wide checks cover configuration for the other platform and mirror combinations.

At revision 77eadd0ea709ad3a7bc4963b03c32d08724b5d87, run go test ./cli/repo -run 'Test(APTTrust|UnknownSigningKey|NewManagerUsesNativeAPTUpdate)'. In Debian 13, native apt-get update returned 0 with a warning for an unreachable loopback repository. With APT::Update::Error-Mode set to any on the host, the same command returned 100. PIG honored both outcomes and restored the source on the failed replacement. With an unknown key in a second module, adding local succeeded and selecting that module failed before key installation or backup. An overlapping Deb822 source caused a conflict with Enabled: yes and was skipped with no, false, 0, or off.

Build revision e268d573123af62d4f3d8661505c0e925b5d3765 with CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -mod=readonly -trimpath. With the vendor sources present, pig repo add --region default followed by apt-get indextargets succeeded on Debian 11–13 and Ubuntu 22.04, 24.04 and 26.04. The Debian 12 check covered both one-line and Deb822 sources. On AlmaLinux 9, a custom metadata-only key authenticated ClickHouse repodata without entering the RPM package key database. An unavailable replacement restored the old definitions and left the package key database intact.

On 2026-12-04, the certificate check covered 37 embedded files. A local repository signed its InRelease with a signing subkey. With both PIG-generated and handwritten sources, apt-get update accepted the primary family fingerprint and rejected an unrelated fingerprint on Debian 12 (APT 2.6.2) and Debian 13 (APT 3.0.4). An exact subkey fingerprint ending in ! succeeded on Debian 12 and was rejected on Debian 13 with both source files in this fixture. A separate apt-get indextargets check parsed the preview. A different signing-reference order on a retained entry for the same URI and suite stopped PIG before it wrote the new file. 317b541

Status

For the signing-key rollout and upgrade steps, see the v1.12.0 release notes.