Skip to content

fix(reconcile): repair a CA:TRUE certificate, which a pin check cannot see - #19

Merged
ralyodio merged 1 commit into
mainfrom
fix/reconcile-repairs-ca-certs
Aug 9, 2026
Merged

fix(reconcile): repair a CA:TRUE certificate, which a pin check cannot see#19
ralyodio merged 1 commit into
mainfrom
fix/reconcile-repairs-ca-certs

Conversation

@ralyodio

@ralyodio ralyodio commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

Follow-up to #18. Without this, #18 ships and nothing happens.

The gap

moshpit-reconcile.sh re-runs setup-origin.sh when a name's nginx block is missing or the served key is not the published one. Neither fires for the case that left every stock client refusing these names: a certificate marked CA:TRUE.

It is the right key — the pin matches exactly — and it is unusable. An anchor marked CA:TRUE may issue for any name rather than the one printed on it, so nothing can safely trust it directly. A stock client gets self-signed certificate and has no way forward.

And the repair reuses the key, so the pin does not move. That is what makes it free of any registry change, and it is precisely why the existing checks stay silent about it: serving and published agree. So a box pulls #18 and then reconciles "already served" forever without applying it — the fix ships and the symptom never changes.

Verified on the live origin: chovy.hacker serves CA:TRUE today, and reconcile reports it as already served.

The fix

A third trigger, checked last because it is the expensive one and anything failing an earlier check is being re-issued anyway:

elif served_is_ca "$name"; then
  need="the certificate it serves is marked CA:TRUE, which no client can safely trust"

It converges in one pass. After the repair the certificate is CA:FALSE and the pin is unchanged, so the next pass finds nothing to do — no nginx reload once a minute forever, which is the failure the script's own header warns about. There is a test for that direction specifically.

Also parameterises the origin probe address (MOSHPIT_ORIGIN_ADDR, still defaulting to 127.0.0.1:443) so the certificate checks can run against a fixture server instead of needing port 443 and root.

Tests

5 new. The probe is lifted out of the script and run against real TLS servers rather than restated in the test — a restated pipeline would pass while the script probed something else. Two of them guard the ways this regresses silently: the helper being defined but never called, and the address being hardcoded back. Full suite 74/74.

🤖 Generated with Claude Code

…t see

Reconcile re-runs setup-origin.sh when a name's nginx block is missing or the
served key is not the published one. Neither fires for the case that left every
stock client refusing these names: a certificate marked CA:TRUE.

It is the right key -- the pin matches exactly -- and it is unusable. An anchor
marked CA:TRUE may issue for any name rather than the one printed on it, so
nothing can safely trust it directly, and a stock client is left with
"self-signed certificate" and no way forward.

The repair reuses the key, so the pin does not move. That is what makes it free
of any registry change, and it is precisely why the existing checks stay silent
about it: serving and published agree. Without this trigger a box pulls the fix
and then reconciles contentedly forever without ever applying it -- the fix
ships and nothing happens, which is the worst of both.

Converges in one pass rather than reloading nginx forever: after the repair the
certificate is CA:FALSE and the pin is unchanged, so the next pass finds nothing
to do.

Also parameterises the origin probe address (MOSHPIT_ORIGIN_ADDR, still
127.0.0.1:443) so the certificate checks can be exercised against a fixture
server rather than needing port 443 and root.

Verified against the live origin: chovy.hacker serves CA:TRUE today, so the
trigger fires on the next pass.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@github-actions

github-actions Bot commented Aug 9, 2026

Copy link
Copy Markdown

vu1nz Security Review

0 finding(s) in PR #?

No security issues found.

@ralyodio
ralyodio merged commit 03354da into main Aug 9, 2026
3 checks passed
@ralyodio
ralyodio deleted the fix/reconcile-repairs-ca-certs branch August 9, 2026 17:36
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.

1 participant