infra: HSTS on coa-infra.matou.nz breaks desktop org setup — raw-port KERIA fetches get upgraded to https (Setup Failed: Failed to fetch) #141
Labels
No labels
agent-blocked
agent-working
bug
deferred
enhancement
model-haiku
model-opus
model-sonnet
needs-info
needs-triage
no-triage
priority
product-decision
ready-for-agent
ready-for-human
ready-for-session
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Matou/coa#141
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?
Summary
Every COA desktop app built against the shared backend fails at Set up → Launch App with
Setup Failed — Failed to fetch. Reproduced 2026-09-07 with the freshngati-examplebuild 2 (ngati-example-0.6.8-linux.AppImage, coa-builds run 34072026536, matou-app v0.6.8) on Linux, tenanthttps://coa-infra.matou.nz/ngati-example(configured: false).Root cause (proven)
coa-infra.matou.nzis served by Caddy with the mdssecurity_headerssnippet, which sendsStrict-Transport-Security: max-age=3600; includeSubDomains; preload. The app's first request ishttps://coa-infra.matou.nz/ngati-example/api/client-config, so Chromium records HSTS for the host. The client config then points KERIA/boot/CESR/schema at plain-HTTP raw ports on the same host name (http://coa-infra.matou.nz:5901,:5903,:5902,:9723, witnesses:7642–7647). HSTS upgrades those fetches tohttps://coa-infra.matou.nz:5901; the listener speaks plain HTTP, the TLS handshake fails and the fetch dies (net::ERR_CONNECTION_CLOSED).Evidence from the running app (Electron main log):
Probe from inside the renderer (same session):
curlfrom the laptop reaches every raw port fine (401/405/200), and KERIA answers CORS preflight withAccess-Control-Allow-Origin: *— this is not a firewall or CORS problem.matou.nzis not on the HSTS preload list (hstspreload.orgstatusunknown), so the header is the only source. The mds template isroles/coa_shared/templates/coa-infra.caddy.j2(import security_headers); the snippet is inroles/caddy/templates/Caddyfile.j2.This masked nothing in phase 3: the ngati-example proof never ran
/setup(tenant dir is still empty), and mobile uses the loopback proxy (matou-app#368), so only desktop hits KERIA by host name from Chromium.Fix options (Ben rules — shared-infra change)
coa-infrasite block only (asecurity_headers_no_hstssnippet, orheader -Strict-Transport-Securityafter the import). Clients recover once the cached entry expires (max-age is 1 h) or userData is cleared. Keeps the phase-3 raw-port design as is.https://URLs in coa mode (matou-infrastructure config server + witness location records). Then HSTS can stay.Either way
docs/GOTCHAS.mdneeds the entry with the fix commit.Acceptance
Fresh
~/.config/Ngati Example, launchngati-example-0.6.8-linux.AppImage, fill admin name, Launch App → progresses past "Connecting to KERIA…" to the recovery-phrase screen;GET https://coa-infra.matou.nz/ngati-example/api/healthreportsconfigured: true.Related
node-1on coa-shared is crash-looping (separate ticket) — will bite the next step of setup (community space creation) once this is fixed.Ben ruled option 2 (the proper fix). Built as three PRs, ready for merge + deploy in this order:
config-server.pyPUBLIC_BASE_URLmints the proxied layout (/keria/admin,/keria/boot,/keria/cesr,/schema,/witness/<name>, config server at the root);keri/docker-compose.coa.ymlbinds every HTTP service to loopback in coa mode (Docker-published ports bypass ufw — 5904 answers from the internet today);generate-env.sh coadefaults the base toCONFIG_PUBLIC_URL. 18 new + 55 existing config-server checks green. Branch also pushed to GitLab asinfra/coa-tls-frontso the host can fetch the pin before the mirror.coa-infra.caddy.j2handle_pathladder (prefix stripped: signify-ts signs the KERIA-relative path),PUBLIC_BASE_URL+EXTERNAL_SCHEME=httpsinto the env generator, pincoa_shared_infra_ref=d59951a0f6cb…(PR #18 head), ufw allow rules for 5901–5903/7642–7647/9723 deleted, post-reload https probes of the ladder.registrationResolvestops using.origin;getKeriaUrls()strips trailing slashes. Desktop needs nothing from this PR.Deploy (needs your seat — the session's harness blocks PR merges and host changes):
Expected on the host: keri containers recreated with
127.0.0.1:bindings, four https probes green,GET https://coa-infra.matou.nz/ngati-example/api/client-configshowinghttps://coa-infra.matou.nz/keria/adminetc. Then I re-run the ngati-example 0.6.8 AppImage setup drive (no rebuild needed: the app reads the URLs at runtime).Fixed and proven 2026-09-07. Ben merged matou-infrastructure PR #18 (8b70975, mirrored to GitLab) and mds PR #16 (c93c9f0) and ran the
coa_sharedrole onmatou: 18 ok / 7 changed / 0 failed — pin moved, keri containers recreated on loopback bindings, ten raw-port ufw rules deleted, Caddy ladder rendered, all four https probes green. Live now:GET https://coa-infra.matou.nz/ngati-example/api/client-config→keri.admin_urlhttps://coa-infra.matou.nz/keria/admin,/keria/boot,/keria/cesr,schema_server_url/schema,witnesses.urls[0]/witness/wan(+ matching oobis)./keria/cesr/spec.yaml,/schema/,/witness/wan/oobi,/api/health→ 200; raw:5901,:5904,:9723,:7642→ connection refused from the internet.ngati-example-0.6.8-linux.AppImage(fresh data dir, driven over CDP): Launch App → Connecting to KERIA → admin identity → org identity → registry → credential → community space → recovery phrase (12 words) → verification → welcome overlay → dashboard as Founding MemberTest Admin, 57 s. Nav shows the kit's feature order; maramataka widget renders. The tenant's first real org exists; the admin identity lives in the laptop's~/.config/Ngati Example(recovery phrase kept by the session, not posted).Observations (not regressions, tracked separately): (1) the tenant still reports
configured: false— the app's backend logsMATOU_CONFIG_SERVER_TOKEN is not set - org config will not mirror to the config server; that is the ADR 0008 bootstrap-token chain (coa #130/#131, infra #12/#13, matou-app #371/#372), stream B. (2) Post-setup credential polling times out twice resolving the org's agent OOBI through the new https path: KERIA fetches it fine (hairpin 200) but logsUnverified loc scheme replyfor its own agent's location record — filed on matou-app. (3) Backend sign-incould not resolve key state→ continues unauthenticated (packaged backend has no KERIA URL; pre-existing).matou-app PR #448 (mobile loopback proxy keeps the prefix) is CI-green and awaits merge; desktop needed nothing from it. Closing.