Skip to content

Support gpgv for Release signature verification in install-debs.py (GnuPG 2.4/keyboxd hosts) #17023

@richlander

Description

@richlander

Summary

eng/common/cross/install-debs.py verifies the APT Release signature by invoking gpg --keyring <keyring> --verify. On hosts running GnuPG 2.4+ with keyboxd (e.g. Azure Linux 4.0), this pattern is fragile: gpg --keyring routes through the agent/keyboxd machinery rather than doing a simple, self-contained verification against the supplied keyring. Consumers building cross rootfs images on these distros have to patch the cloned arcade script to make it work.

The purpose-built tool for this job is gpgv, which verifies a detached signature against a fixed keyring with no agent, no keyboxd, and no mutation of any user keyring.

Where it lives today

https://github.com/dotnet/arcade/blob/main/eng/common/cross/install-debs.py

verify_command = ["gpg"]
if keyring:
    verify_command += ["--keyring", keyring]
verify_command += ["--verify", release_gpg_file.name, release_file.name]
result = subprocess.run(verify_command, ...)

Real-world workaround

dotnet/dotnet-buildtools-prereqs-docker PR #1674 (Azure Linux 4.0 .NET 11 image graph) clones arcade and sed-patches this script after the fact:

RUN git clone --depth 1 --single-branch https://github.com/dotnet/arcade /scripts && \
    sed -i \
        -e 's/verify_command = \["gpg"\]/verify_command = ["gpgv"]/' \
        -e 's/verify_command += \["--verify", release_gpg_file.name, release_file.name\]/verify_command += [release_gpg_file.name, release_file.name]/' \
        /scripts/eng/common/cross/install-debs.py

This is brittle: the sed expressions are tightly coupled to the exact source text and will silently no-op (falling back to the broken gpg path) the moment these lines are reformatted or refactored in arcade.

Ask

Support this verification pattern natively in install-debs.py so downstream consumers don't have to patch the cloned script. gpgv's invocation is essentially the same minus the --verify flag:

gpgv [--keyring <keyring>] <sigfile> <datafile>

Options to consider:

  • Switch the verification to gpgv outright (it is available wherever gpg is and is the canonical tool for verify-against-keyring).
  • Or auto-detect / add an opt-in flag (e.g. --use-gpgv) so newer-GnuPG hosts get correct behavior without a script patch.

Either approach removes the need for the sed workaround and makes rootfs builds robust on GnuPG 2.4+/keyboxd distros like Azure Linux 4.0.

Note

This issue was drafted with the assistance of GitHub Copilot.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions