Stand up cache.idss.nz: the Spaces bucket, the rail's access key, the cache.idss.nz-1 signing key in matou-infra, and the sign-and-publish step (ADR 0275) #1801
Labels
No labels
agent-blocked
agent-working
autopilot
bug
deferred
deploy-pending
enhancement
landing-pr
model-haiku
model-opus
model-sonnet
needs-design
needs-info
needs-triage
no-triage
out-of-scope
priority
ready-for-agent
ready-for-human
ready-for-session
rehearsal-183
snapshot-pending
standing-drive
wayfinder:grilling
wayfinder:map
wayfinder:prototype
wayfinder:research
wayfinder:task
wontfix
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Matou/idss#1801
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
ADR 0275 (Ben's ruling on #1767, 2026-09-23) decided where Mātou's binary cache lives and who signs it. This ticket makes it exist. #1768 (the installer base substitutes from the cache instead of riding the installer) cannot start until this is live.
Hand steps — Mātou credentials, so these stop on a human (Ben, or me with the DO token and the
matou-infraage key)syd1(the rented gateways' region), name e.g.idss-cache, public read, CDN off for now (ADR 0275 leaves a CDN as a later two-way change). Record the endpoint (idss-cache.syd1.digitaloceanspaces.com).cache.idss.nzCNAME → that endpoint, in theidss.nzzone (ADR 0128, the Cloudflare API the rail already uses).nix key generate-secret --key-name cache.idss.nz-1 > cache-secret;nix key convert-secret-to-public < cache-secretgives the public half. Sealcache-secretas a sops secret inmatou-infrareadable by the release rail's age recipient only. Commit the public half in this repo (see step 6). Never paste the secret into a ticket, a log or a chat.matou-infranext to the signing key; the rail exports it asAWS_ACCESS_KEY_ID/AWS_SECRET_ACCESS_KEYfornix copy.nix-cache-infoobject at the bucket root:StoreDir: /nix/store,WantMassQuery: 1,Priority: 40(lower priority than cache.nixos.org's 30 so the public cache is asked first).Agent steps — once 1–5 are done and the public key + endpoint are in this repo
https://cache.idss.nzafterhttps://cache.nixos.orginsubstituters, andcache.idss.nz-1:<pubkey>aftercache.nixos.org-1:…intrusted-public-keys, in BOTH the installer-base (kexec) configuration and the gateway's NixOS configuration. Order matters (ADR 0275 consequences).scripts/build-installer-base-warm.shsigns the built installer-base closure with the cache key (nix store sign --key-file … -r <toplevel>) andnix copy --to 's3://idss-cache?region=syd1&endpoint=syd1.digitaloceanspaces.com' <toplevel>. It runs at the release revision only (ADR 0272 §6 — exact revision, never latest) and refuses to run with a dirty tree.nix path-info --store https://cache.idss.nz <installer-base toplevel>answers, andnix build --dry-runof.#kexec-installer-baseon a store trusting both keys reports 0 derivations to build. Record the numbers on this ticket.Not in this ticket
installer-base-cache/from the installer — that is #1768, which this unblocks.Relates to: ADR 0275, ADR 0272, ADR 0248, #1767, #1768, #1769, #1770.
Blocked — human hand steps (Mātou credentials) not yet done
The agent steps (6–9) are explicitly gated: "once 1–5 are done and the public key + endpoint are in this repo." Neither is true yet:
cache.idss.nz-1public key is committed anywhere in the repo (grepforcache.idss.nz-1/idss-cache.syd1returns nothing), and the only comment on this issue is the swarm-claim — so a human has not posted it.syd1, Spaces access key) and thematou-infraage key (to seal the signing secret + access key as sops secrets). The ticket itself states these "stop on a human (Ben, or me with the DO token and thematou-infraage key)."Why this is a human residue, not an agent two-way-door ruling:
cache.idss.nz-1) and seals it inmatou-infra— a credential creation.cache.idss.nz-1:<pubkey>totrusted-public-keys— a security-posture widening (trusting a new signer). It cannot even be written without the real public-key value that only step 3 produces; a placeholder would be a wrong/absent signature, which per step 9 silently drops the gateway into the 46-minute static-CPython rebuild.These are on the one-way-door list, and none of steps 6–8 are provable by a test I can run until the bucket, keys and public key exist.
Why human
A human with the DO token +
matou-infraage key (Ben, or an interactive session with those) must complete hand steps 1–5 — create thesyd1idss-cachebucket (public read), thecache.idss.nzCNAME, generatecache.idss.nz-1and seal the secret + a scoped Spaces access key inmatou-infra, and drop thenix-cache-infoobject — then commit thecache.idss.nz-1public half + the confirmed bucket endpoint into this repo (or post them here). Once that lands, re-addready-for-agent; the next agent iteration can then do steps 6–9 (pin the trust in the installer-base + gateway configs, add the sign-and-publish step toscripts/build-installer-base-warm.sh, prove substitution from a clean syd1 droplet, add the GOTCHAS entry).Note: ADR 0275 is referenced but is not yet committed in
docs/adr/— worth landing alongside the public key.vm-guest.tarrather than being handed 263 MB of it at founding (ADR 0272) #1770Three corrections to the hand steps (2026-09-24, checked before the walk-through)
Step 5 priority.
https://cache.nixos.org/nix-cache-infosaysPriority: 40, not 30. Lower number wins, so ours must be 50. Easiest: let the firstnix copywrite the header by passingpriority=50in the store URL (s3://idss-cache?region=syd1&endpoint=syd1.digitaloceanspaces.com&priority=50) — Nix writesnix-cache-infoitself when the bucket has none.Step 1/2 TLS. A bare CNAME
cache.idss.nz → idss-cache.syd1.digitaloceanspaces.comserves Spaces' own certificate (*.syd1.digitaloceanspaces.com), sohttps://cache.idss.nzfails TLS and Nix will not substitute. The DO-supported way to put a custom hostname on a bucket is the Spaces CDN with a custom subdomain (DO issues the Let's Encrypt cert; the CNAME then targets the CDN endpoint). So "CDN off" is withdrawn: enable it, addcache.idss.nzas the custom subdomain, and make the Cloudflare record DNS-only (grey cloud) so DO's validation and TLS reach DO. ADR 0275's decision is unchanged (Spaces, CNAME indirection); this is the mechanism the CNAME needs.Where the secrets live. ADR 0275 says "sealed in
matou-infra" — there is no such repo on git.matou.nz (Matou/matou-infrastructureis KERI/any-sync, no sops layout). The rail (release-publish.yml, runnerelitebook-03) already reads itstestingfeed key as the Forgejo Actions secretRELEASE_TESTING_SEED. The cache key and the Spaces key pair go in the same place: repo secrets onMatou/idss—CACHE_SIGNING_KEY(thenix key generate-secretoutput),CACHE_S3_ACCESS_KEY_ID,CACHE_S3_SECRET_ACCESS_KEY. Same custody set as the testing key (ADR 0248 amendment). ADR 0275 gets a one-line amendment when the publish step lands.Also checked:
doctlon Ben's laptop is authenticated as the account owner,doctl spaces keys listis empty (no key exists yet), and the laptop's Nix (Determinate 3.22.5) speakss3://…?endpoint=with the DO endpoint, so step 8's proof can run from here as well as from a syd1 droplet.Progress 2026-09-24 — DO path chosen; what is done and what is verified
idss-cache-rail(fullaccess) exists on the account (Ben, 13:35Z). Full access is whatPutBucketPolicyneeds (DO docs: limited-access keys cannot set a policy); the rail can move to a bucket-scopedreadwritekey after the policy is set.{"Effect":"Allow","Principal":"*","Action":"s3:GetObject","Resource":"arn:aws:s3:::idss-cache/*"}makes every object public (DO docs, supported on standard Spaces). This is step 5's missing half.~/idss-app/cache/bootstrap-bucket.shon Ben's laptop — creates the bucket in syd1, sets that policy, writesnix-cache-infowithPriority: 50, and proves an anonymous GET of it. Runs with the key exported in the shell; prints nothing secret.cache.idss.nz(corrects yesterday's step 1/2 again): DO issues a Let's Encrypt cert for a CDN custom subdomain only if the name is in DigitalOcean DNS; otherwise you upload your own cert and renew it by hand. Withidss.nzon Cloudflare (ADR 0128) the clean route is to delegate justcache.idss.nzto DO: addcache.idss.nzas a domain in DO Networking, and in Cloudflare add NS records forcache→ns1/ns2/ns3.digitalocean.com(DNS-only). DO then owns the CNAME and the cert. ADR 0275's indirection holds (the name still moves with us), one NS record replaces the CNAME in the Cloudflare zone;reservedSlugsstill gainscache.s3://…?endpoint=syd1.digitaloceanspaces.com&scheme=httpsand has theprioritystore setting; awscli2 obtainable vianix shell.Step 1, 2 and 5 DONE 2026-09-24 (Ben ran
bootstrap-bucket.sh)idss-cachecreated in syd1; endpointhttps://idss-cache.syd1.digitaloceanspaces.com.s3:GetObjectonidss-cache/*— set.nix-cache-infowritten:StoreDir: /nix/store,WantMassQuery: 1,Priority: 50. Anonymouscurl→ HTTP 200.nix store info --store https://idss-cache.syd1.digitaloceanspaces.comon a stock Determinate Nix answers — the bucket is a readable binary cache as-is (empty).idss-cache-rail(fullaccess) is the rail's write key; goes into Forgejo secrets at step 5b.Remaining hand steps: DNS delegation of
cache.idss.nzto DO + CDN custom subdomain (cert),nix key generate-secretforcache.idss.nz-1, the threeMatou/idssActions secrets. Then agent steps 6–9.Agent steps 6, 7, 9 LANDED on main
7018fb3f(2026-09-24)nix/matou-cache.nix—extra-substituters = [ https://cache.idss.nz ],extra-trusted-public-keys = [ cache.idss.nz-1:jryaAm0uulUbamaQ5/9Shb9SkpMW3rVv49FkzRNOf7E= ]— imported by the kexec installer base (flake.nixkexecInstallerBaseConfig), the rented gateway image and the VM guest image;internal/clan/matoucache.gopins the same intorenderGatewayGuestfor standing nodes.TestMatouCache_PinnedEverywhereholds all four to one value and toextra-*only. Proven by building each image'snix.conf:substituters = https://cache.nixos.org/thenextra-substituters = https://cache.idss.nz(the kexec base also lists/after ours — nixos-images' own entry, harmless).scripts/release-rail/publish-cache.sh+scripts/tests/cache-publish-test.sh(9 checks green) +.forgejo/workflows/cache-publish.ymlonmatou-workstation(syd1, beside the bucket — elitebook-03's home line would outrun any timeout). Signs on the way out (secret-key=on the s3 URL), refuses a dirty tree, short-circuits on an already-signed marker, verifies every path + the marker's signature through the read URL.build-installer-base-warm.shnow writesinstaller-base.paths.cache.idss.nzto DO DNS; priority 50). Architecture view 11 updated. BrokerreservedSlugsgainscache.First publish dispatched with
read_url=https://idss-cache.syd1.digitaloceanspaces.com(the CNAME has no cert yet). Step 8's proof follows on this ticket once it lands.Still on Ben: delegate
cache.idss.nz— add it as a domain in DO Networking, NS records forcache→ ns1/ns2/ns3.digitalocean.com in the Cloudflare zone (DNS-only), then the bucket's CDN custom subdomain with a Let's Encrypt cert. Until then gateways built from7018fb3flist a substituter that fails TLS — Nix warns and falls back, not fatal, but the cache does nothing for them.Step 8 PROVEN 2026-09-24 — the cache serves the installer base
First
cache-publishrun (Forgejo run 31841, matou-workstation, 31 min):nix copylanded all 1,359 paths signed bycache.idss.nz-1. Proof from the laptop on a fresh chroot store:nix build --dry-run .#kexec-installer-basehttps://idss-cache.syd1.digitaloceanspaces.comtrustingcache.idss.nz-1The 3 are
squashfs.img,initrd,kexec-tarball— exactly the assembled artifacts the narrowing drops on purpose (#1048; the compose rebuilds them anyway). The laptop's evaluated toplevel equals the published marker/nix/store/6rwrc1w5…-nixos-system-nixos-installer-kexec-26.05pre-git; 40/40 sampled narinfos carrySig: cache.idss.nz-1:.Why the run itself went red, and the fix (
GOTCHAS #332, landed on main): the verify read the marker 5 s after its PUT and got 403 — Spaces is eventually consistent on the anonymous read side (403, not 404: GetObject without ListBucket), and it stayed 403 for ~20 min. Worse, a Nix client that probes in that window pins "absent" for an hour (narinfo-cache-negative-ttl3600 s), which is why the first laptop proof read nothing whilecurlread everything.publish-cache.shstep 4 is now a wait with a 30-min ceiling and every read probe bypasses the negative cache; the test fakes the lag.Read the job log via Forgejo's web route
/Matou/idss/actions/runs/31841/jobs/0/attempt/1/logs(repo is public) — the runs API 504s.Left: Ben's NS delegation of
cache.idss.nz(DO Networking domain + Cloudflare NS records + the bucket's CDN custom subdomain with a Let's Encrypt cert); until then the workflow verifies through the raw endpoint. #1768 is unblocked.Second run GREEN — idempotence proven (run 31883,
ae34f60c, 2026-09-24 15:19Z)[publish-cache] already published: this revision's installer base (/nix/store/6rwrc1w5…-nixos-system-nixos-installer-kexec-26.05pre-git) is in the cache and signed by cache.idss.nz-1 — nothing to build or copy— 13 seconds from checkout to success (one flake eval + one signed narinfo read, landed inae34f60c). The 6-hourly schedule now costs seconds while the installer base is unchanged and ~35 minutes only when a nixos-images bump changes it.Steps 1–9 are all done except the name: the NS delegation of
cache.idss.nzis the one hand step left (DO Networking domaincache.idss.nz→ Cloudflare NS records forcache→ the bucket's CDN custom subdomain + Let's Encrypt). Until it is in, gateways built from main list a substituter that fails TLS (Nix warns, falls back to cache.nixos.org and the packed copy — not fatal), and the workflow verifies through the raw endpoint. Once the cert answers, dispatch once with noread_urland the default verify runs throughhttps://cache.idss.nz.Leaving
ready-for-humanon for that step. #1768 can start now against the raw endpoint's proof.The name, 2026-09-24 16:00–16:20Z — delegated, certificate issued, CDN bound; hostname still provisioning
cache → ns1/ns2/ns3.digitalocean.comwritten with the broker's own zone token from the mail droplet (Ben, viasudoreading/etc/ourcloud/broker.env— theidss-brokertoken of ADR 0128).dig NS cache.idss.nzanswers DO's nameservers from 1.1.1.1 and 8.8.8.8.cache.idss.nzcreated (doctl). DO wrote its_acme-challengeTXT there and the Let's Encrypt certificatecache-idss-nz(e0ea1357-…) went pending → verified in ~30 s; CN=cache.idss.nz, valid to 2026-12-23, DO renews it through this zone — the delegation must stay.1ecedf3f-…: originidss-cache.syd1.digitaloceanspaces.com, endpointidss-cache.syd1.cdn.digitaloceanspaces.com, custom domaincache.idss.nz, that certificate. The endpoint hostname servesnix-cache-info(HTTP 200) already.CNAME records cannot share a name with other records) and wrote nothing when the custom domain was bound. DO's CDN is fronted by Cloudflare (the endpoint resolves to 104.18.42.227 / 172.64.145.29 + two 2606:4700 AAAA), so the apex carries A/AAAA records pinned to those four edge addresses (TTL 300). Public resolvers now return them forcache.idss.nz. Hazard: if DO's edge addresses ever change, the pin rots — thecache-publishverify throughhttps://cache.idss.nzevery 6 h is the alarm, and the fix is four records in the DO zone.ssl_verify 0, cert CN=cache.idss.nz) but the edge answers HTTP 530 / Cloudflare error 1016 forcache.idss.nzwhile the CDN's own hostname answers 200 — DO's custom-hostname provisioning on its edge is still catching up (bound at 16:07Z). Re-testing.The name is LIVE:
https://nix.cache.idss.nz(2026-09-24, mainb5488eea)cache.idss.nz, and the four Cloudflare edge addresses pinned as apex A/AAAA, the edge answered 1016 for 20+ minutes; DO's CDN routes a custom hostname only as a CNAME, and a delegated zone's apex cannot be one. Ben chose option 1.nixCNAME →idss-cache.syd1.cdn.digitaloceanspaces.comin the DO zone, DO certificatenix-cache-idss-nz(e03ddf17-…, CN=nix.cache.idss.nz, to 2026-12-23, renewed by DO through the delegation — keep the NS records), CDN endpoint1ecedf3f-…custom domain updated. HTTP 200 with ourcache.idss.nz-1signature within 15 s;nix path-info --store https://nix.cache.idss.nzreads the signed marker. Apex pin + apex certificate removed.b5488eea):nix/matou-cache.nix,internal/clan/matoucache.go(key name unchanged — a key name is a label),publish-cache.shdefault read URL, its test, the workflow, GOTCHAS #331/#332, architecture view 11, ADR 0275 amendment 2 rewritten as proven, STATUS.md. Built guestnix.conf:extra-substituters = https://nix.cache.idss.nz.All nine steps of this ticket are done once 31935 lands green. #1768 next.
CLOSED — run 31935 GREEN through the real name (2026-09-24 16:46Z)
[publish-cache] verifying through https://nix.cache.idss.nz→published: 1359 paths at b5488eea, marker /nix/store/6xzkyvq8…-nixos-system-nixos-installer-kexec-26.05pre-git signed by cache.idss.nz-1in 23 s (the module change moved the toplevel; only the changed leaves were uploaded, the rest were already in the bucket).Steps 1–9 done: bucket + policy + header (1, 2, 5), the name via delegation + DO certificate + CDN (3), the
cache.idss.nz-1key (4), the three Forgejo secrets (5b), trust pinned in every image and the rendered baseline (6), the sign-and-publish rail (7), the proof — 3 derivations to build against 67 on a cold store (8), GOTCHAS #331/#332 (9). ADR 0275 amended as built. #1768 is unblocked.