Skip to content

feat(apt): the signed apt repository for dashmate - #100

Merged
dcg-infraclaw[bot] merged 8 commits into
masterfrom
feat/apt-repository
Nov 26, 2026
Merged

dcg-infraclaw[bot] merged 8 commits into
masterfrom
feat/apt-repository

Conversation

@dcg-infraclaw

@dcg-infraclaw dcg-infraclaw Bot commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

The infra half of dashpay/platform#4246: a signed apt repository for dashmate at https://apt.services.dash.org/dashmate. Prepared by Claude at latte's request.

The new files are stacks/apt/ and one row in the root README. It uses the stacks/ layout and modules/github-oidc-role from #93, which is merged.

What it builds

  • Hosting: a private, versioned bucket behind CloudFront, with an ACM certificate, HSTS, and A/AAAA records in services.dash.org.
  • Publisher: a CodeBuild project that runs stacks/apt/publisher/. It is the only thing that writes the bucket and the only thing that reads the signing key.
  • Trigger: a state machine that starts the publisher, a daily schedule, and the role dashmate-apt-release for dashpay/platform's release workflow.

How it behaves

  • Suites: stable takes final releases whose SHA256SUMS a maintainer signed. testing takes betas, release candidates and finals. dev takes dev builds as well. All three are signed from the first run, empty or not, as asked in the issue.
  • A request names its SHA256SUMS (728af96, ee104eb, a843ba5, asked for in this comment). The input is {"tag": "v5.1.0", "sha256sums_sha256": "<64 lowercase hex digits>"}: the sha256 of the SHA256SUMS the release run checked and attached. The publisher downloads the release's SHA256SUMS and refuses it unless it is that file. A tag without the digest ends in the state machine with Publisher.RequestRefused and no build starts. {} is the daily refresh and is unchanged.
  • Gate: a deb is published only if it is what that SHA256SUMS lists and its version is the one the tag stands for. Both debs, everything else the run reads and the signing key are checked before anything is written to the pool. A final release without a maintainer's signature waits in testing; a later run moves it once the signature is attached. The digest does not stand in for the signature.
  • What a run reports: exit 0 and PUBLISHED: <tag> is in <suites> as <version>; exit 1 and NEEDS A PERSON: when another release needs a person (the requested one is published all the same); exit 2 and REFUSED:; exit 3 and SKIPPED: for a kind of prerelease the repository leaves out (alpha, pr, hotfix). The table is in stacks/apt/README.md.
  • Freshness: Valid-Until is ten days ahead and a daily run signs every suite again.
  • The key never reaches GitHub. The release role can start the state machine and read how it ended. It cannot start the CodeBuild project, because StartBuild lets the caller replace the build's commands.
  • No aptly. The publisher is standard-library Python. The signed index in the bucket is its only state, and it refuses to build on a published suite that does not verify.

The key

Made on 2026-11-25 (04fe5c2). Primary A5F90926475EF25346DCE26836EF5BF853D100FE, signing subkeys 94E1AA9232F710AF51400D2242D07EC597C92A74 (online) and 51C0AF253270F3DACE9F40078A30392F222E0ACC (standby), all expiring 2027-11-25. The public keyring is stacks/apt/publisher/keyring/dashmate-archive-keyring.gpg. The online subkey's secret part is the value of the secret dashmate-apt/signing-key; the primary and the standby are held by latte. stacks/apt/README.md, "The key", is the rotation runbook.

Maintainer keys

A final release reaches stable when its SHA256SUMS is signed by one of the keys in stacks/apt/publisher/maintainers/. There are two, the same two as ALLOWED_SIGNERS in dashpay/platform: Ivan Shumkov's 19E460D55429A91B40E9E7C5EDBC0AA6BC1AA13C and QuantumExplorer's 556CBC89DA31CAD4928F0926D59CAD3E1BEAFEF0 (ae9abf2, after dashpay/platform#6274 merged). QuantumExplorer's key file is the one published on his GitHub account; he has been asked to confirm the fingerprint himself and has not answered yet.

Paths on a host

They belong to dashpay/platform#6267 (merged), which ships the source file, the keyring at /etc/apt/keyrings/dashmate-archive-keyring.gpg and a pin file in the deb. The keyring on v5.1-dev is the one in this PR, byte for byte.

Not in this PR

  • What tells a person the daily run failed. That is a timer on infraclaw's operations host, running since 2026-11-25: it reads every suite's InRelease from outside each 15 minutes and says in Slack when one is stale, close to expiry, expired, unreachable or not signed by this key.

State

Applied to dashdev from this branch at a843ba5 on 2026-11-26 09:43 UTC (three resources changed: the state machine, the publisher's code and the version the project runs; a plan afterwards shows no changes). The repository is live and the daily run is on: its first scheduled run, 2026-11-26 05:17 UTC, succeeded. testing and dev carry 5.1.0~rc.1-1 for amd64 and arm64; stable is signed and empty.

Tested

At a843ba5:

  • python3 -m unittest discover -s stacks/apt/publisher/tests: 40 tests, 13 of which run publish.py itself with throwaway keys.
  • stacks/apt/publisher/tests/integration.sh in Ubuntu 24.04 and Ubuntu 22.04 containers, with throwaway keys and a real apt client: empty signed suites accepted by apt-get update; install, upgrade, rollback and install by version; a host on testing reaches the final release; Release accepted nine days on and refused after eleven; the standby subkey takes over with no change on the host; every refusal above, with the repository unchanged after it.
  • terraform plan on the real state before the apply: 0 to add, 0 to destroy; the three resources named under "State" change.
  • Live, after the apply (2026-11-26 09:44 to 09:48 UTC), one execution each:
    • v5.1.0-rc.1 with the sha256 of its SHA256SUMS: SUCCEEDED, PUBLISHED: v5.1.0-rc.1 is in testing, dev as 5.1.0~rc.1-1. Both debs are already published, so no package was written.
    • The same tag with another sha256: FAILED, exit status 2, REFUSED: v5.1.0-rc.1: the release's SHA256SUMS has sha256 74acd72a…8d4e, and the request was made for 0000…0000.
    • A tag without a sha256: FAILED with Publisher.RequestRefused; no build started.
    • v5.1.0-alpha.1: exit status 3, SKIPPED: … prereleases named 'alpha' are not published.
    • {}: SUCCEEDED, the suites left as they are (signed under 12 hours before).
    • Every object version of the repository bucket was listed before and after the three runs that did not succeed: the two lists are identical.
    • The exit status is in each failed execution's cause as Error while executing command: python3 publish.py. Reason: exit status <n>, the form the job in dashpay/platform reads.
    • Afterwards each suite's InRelease and Release.gpg verify with gpgv against the committed keyring.

Earlier, at ae9abf2:

  • Each suite's InRelease and Release.gpg verify with gpgv against the committed keyring; a real apt client (Ubuntu 24.04) runs apt-get update cleanly against each suite and refuses the repository when given another keyring.
  • The publisher took v5.1.0-rc.1 from the GitHub release into testing and dev. In fresh containers of Ubuntu 24.04, Ubuntu 22.04 and Debian 12, the by-hand procedure from Host a signed APT repository for dashmate packages platform#4246 runs apt-get update cleanly and installs it through the CDN, and dashmate --version answers 5.1.0-rc.1. The arm64 deb, fetched directly, is what Packages lists.

Not tested: the release role used from GitHub Actions (the first run of the job from dashpay/platform#6289 will be that; it is off until the variable DASHMATE_APT_PUBLISH is set), an install on an arm64 machine, and a final release moving into stable in the live repository (no final release has a maintainer's signature yet).

🤖 Generated with Claude Code

dcg-infraclaw Bot and others added 2 commits November 25, 2026 13:55
A new stack, stacks/apt, for dashpay/platform#4246: a private bucket behind
CloudFront at apt.services.dash.org/dashmate, and the job that signs and
publishes it.

The publisher is a CodeBuild project that runs publisher/ from this
directory. It takes a release's debs from GitHub, checks them against the
release's SHA256SUMS and against the tag, and writes three suites: stable
(final releases a maintainer signed), testing (beta, rc and final) and dev
(dev builds as well). Every suite is signed from the first run, empty or
not. Release carries Valid-Until ten days ahead and a daily schedule signs
it again.

Only a state machine may start the publisher, and it passes one value, the
tag. The role for dashpay/platform's release workflow can start that state
machine and read how it ended, nothing else.

There is no key yet: the keyring is not committed, the secret is empty and
the schedule is off, so every run is refused.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
An input without a tag failed the Choice state: IsString on a field that is not there is a runtime error. Test IsPresent first. Found by starting the machine with {} after the first apply.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
@coderabbitai

coderabbitai Bot commented Nov 25, 2026 •

Copy link
Copy Markdown

Important

Review skipped

Bot user detected.

To trigger a single review, invoke the @coderabbitai review command.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 8395732e-5ed9-4c12-9d11-34872731c20e

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

The repository has its key: primary A5F90926475EF25346DCE26836EF5BF853D100FE,
signing subkeys 94E1AA9232F710AF51400D2242D07EC597C92A74 (online) and
51C0AF253270F3DACE9F40078A30392F222E0ACC (standby), all expiring 2027-11-25.

The keyring is the public key only. The online subkey's secret part is the
value of the secret dashmate-apt/signing-key, put there by hand; the primary
and the standby are held by the head of infrastructure.

Applied. The first run published stable, testing and dev, empty and signed.
The daily run is on by default from here; schedule_enabled = false is for a
repository without a key.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
dcg-infraclaw Bot and others added 5 commits November 25, 2026 20:16
A final release reaches stable when its SHA256SUMS is signed by a key in
publisher/maintainers/. dashpay/platform#6274 added a second signer there,
QuantumExplorer, 556CBC89DA31CAD4928F0926D59CAD3E1BEAFEF0; this adds the
same key here. The key file is the one published on the GitHub account
QuantumExplorer (github.com/QuantumExplorer.gpg), exported minimal; its
fingerprint is the one in ALLOWED_SIGNERS on v5.1-dev and in the issue.

dashpay/platform#6267 ships the keyring at
/etc/apt/keyrings/dashmate-archive-keyring.gpg, not under /usr/share, and a
pin file. The README, the keyring's README and the integration test say so
now. Nothing in the publisher depends on the path.

Tested: 19 unit tests; tests/integration.sh in Ubuntu 24.04 and 22.04
containers, all passed.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
The README said nothing tells a person when the daily run fails. Since
2026-11-25 a timer on infraclaw's operations host reads every suite's
InRelease each 15 minutes and reports in Slack. No change to the stack.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
dashpay/platform#6289 starts the state machine with
{"tag": "v5.1.0-rc.2", "sha256sums_sha256": "<64 lowercase hex>"}: the
sha256 of the SHA256SUMS its checksums job checked and attached. A
release's assets can be replaced after that check, so the tag alone does
not say which packages were meant (dashpay/platform#4246, Ivan's comment
of 2026-11-25).

- The state machine passes sha256sums_sha256 to the build as
  SHA256SUMS_SHA256, beside RELEASE_TAG. An input that names a tag
  without it, or with either value not a string, ends in a Fail state,
  Publisher.RequestRefused, and no build starts. An input without a tag
  is the refresh, as before.
- The publisher refuses a tag without the sha256, and a sha256 that is
  not 64 lowercase hex digits, before it reads anything. It refuses the
  release's SHA256SUMS unless it hashes to that value, before it fetches
  a deb or writes a file. A release's SHA256SUMS is read once in a run.
- stable is as it was: a final release gets there only with a
  maintainer's SHA256SUMS.asc. The daily run sends {} and needs no
  sha256: it adds no release, and what it moves into stable is already
  in testing and listed in a SHA256SUMS a maintainer signed.
- A release published by hand now needs the sha256 too; the README says
  how.

Not applied. Until terraform apply, the live state machine passes only
the tag and ignores the new field.

Tested: 31 unit tests, six of them new ones that run publish.py itself
with throwaway keys and local releases (a replaced SHA256SUMS, a tag
without the sha256, the refresh, stable); terraform fmt and validate;
the rendered definition against the ASL schema. tests/integration.sh
was run with the apt client stubbed, on a machine without root: its
publisher steps pass, its apt steps still need a container.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
… left out

Asked for as optional in dashpay/platform#4246 (Ivan, 2026-11-25): tell
the requested release's outcome apart from problems with other releases,
and answer "skipped" for a prerelease kind the repository does not take.

- A run with a tag ends its log with `PUBLISHED: <tag> is in <suites> as
  <version>`, once every suite is written.
- Exit status 1 now has one meaning: the run is done, and a release other
  than the requested one needs a person. The requested release cannot be
  the subject: its SHA256SUMS is read once in a run, and a fault in it is
  a refusal.
- A release tag of a kind that is left out (alpha, pr, hotfix) ends
  `SKIPPED:` with exit status 3, before anything is read. It was
  `REFUSED:` with 2. A request that is not well-formed is still refused,
  whatever its kind.

What is published does not change. The state machine does not interpret
the exit status: 1 and 3 still end the execution FAILED, with the status
in the cause. Turning them into a result of a successful execution needs
the build to hand a value to the state machine, which was not done here:
it cannot be tried without AWS.

Tested: 35 unit tests; tests/integration.sh with the apt client stubbed,
including REAL=1 against v5.1.0-rc.1 of dashpay/platform.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
… a request

From a review of the two commits before this one.

- A release refused at its second deb left the first one in the pool,
  for good: the pool is write-once. Both debs are now downloaded and
  checked first, and they go into the pool only once the signing key has
  been read and checked too. A refusal of the request, the release, what
  is published or the signing key leaves the repository as it was. (The
  write-once pool file was there before these commits; the claim that
  nothing is written was new.)
- RELEASE_TAG and SHA256SUMS_SHA256 are taken as they come. A variable
  that is set and empty is a request, and refused: {"tag": "",
  "sha256sums_sha256": ""} went to the build and ran as a refresh that
  ended green. Nothing is trimmed any more, so the sha256 is 64 lowercase
  hex digits exactly, as the messages say. The daily run sets neither
  variable and is the refresh, as before.
- "Read once in a run" was true only of a read that succeeded; the
  docstring says so.
- The by-hand recipe hashed a second download, not the file that was
  looked at.
- Each run left an empty gpg socket directory under /run/user.

Tested: 40 unit tests, 13 of them running publish.py itself. New ones
count the downloads (SHA256SUMS of the requested release: one), break
the second deb, hand over a signing key that is refused, and ask for a
skipped kind with no keyring at all. Ten deliberate breakages of the
publisher were each caught by at least one test. tests/integration.sh
with the apt client stubbed, including REAL=1; terraform validate; the
rendered definition against the ASL schema.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
@dcg-infraclaw
dcg-infraclaw Bot merged commit baa322a into master Nov 26, 2026
1 check passed
@dcg-infraclaw
dcg-infraclaw Bot deleted the feat/apt-repository branch November 26, 2026 09:50
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.

0 participants