Skip to content

Retry the origin verification, which raced its own nginx reload - #7

Merged
ralyodio merged 1 commit into
mainfrom
fix-reload-race
Aug 1, 2026
Merged

Retry the origin verification, which raced its own nginx reload#7
ralyodio merged 1 commit into
mainfrom
fix-reload-race

Conversation

@ralyodio

@ralyodio ralyodio commented Aug 1, 2026

Copy link
Copy Markdown
Contributor

Found by running #6 on a real droplet for the first time.

The symptom

==> checking what the server now presents for chovy.hacker
warning: the server answered 'chovy.hacker' with: subject=CN=dev.profullstack.com
warning: another server block is matching first — check for a default_server

The configuration was already correct. nginx -T showed the block loaded, the certificate files were in place, and connecting a moment later returned subject=CN=chovy.hacker.

The cause

nginx -s reload returns as soon as the signal is sent, not when the new workers are serving. Old workers keep handling connections until they drain, so the verification was answered by the configuration from before the reload.

This is the worst possible false positive for this particular check: it is indistinguishable from the real default-vhost fallthrough the check exists to catch, so it tells an operator their working site is broken.

The fix

Retry five times at one-second intervals; warn only if the name still does not match.

Verified on the box it was found on

==> generating a key and certificate for chovy.hacker
  key already exists — reusing it so the published pin stays valid
==> writing the nginx server block
nginx: configuration file /etc/nginx/nginx.conf test is successful
==> checking what the server now presents for chovy.hacker
  subject=CN=chovy.hacker
==> the pin to publish
  chovy.hacker
  v6k99jmaVZC/RqHH5nBEXcCFgqKErHQTsn2umcBHPzQ=

Key reuse confirmed across runs — same pin, so republishing is never needed after a re-run.

chovy.hacker is now live and correct from the public internet:

$ openssl s_client -connect [2604:a880:400:d1:0:4:c3fe:1]:443 -servername chovy.hacker
subject=CN=chovy.hacker
issuer=CN=chovy.hacker
Negotiated TLS1.3 group: X25519MLKEM768

Post-quantum hybrid key exchange, end to end, on a self-signed key the registry will vouch for. The existing dev.profullstack.com vhost on the same box is unaffected (200, chain still valid).

🤖 Generated with Claude Code

The first live run of setup-origin.sh reported:

  warning: the server answered 'chovy.hacker' with: subject=CN=dev.profullstack.com
  warning: another server block is matching first — check for a default_server

The configuration was already correct. `nginx -s reload` returns when the
signal is sent, not when the new workers are serving — old workers keep
handling connections until they drain — so the check was answered by the
config from before the reload.

Which is the worst possible false positive here: it is indistinguishable from
the real default-vhost fallthrough this check exists to catch, and it tells an
operator their working site is broken.

Retries five times at one-second intervals and only warns if the name still
does not match. Verified on the box it was found on: the re-run reports
`subject=CN=chovy.hacker` cleanly, reuses the existing key, and prints the
same pin.

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

github-actions Bot commented Aug 1, 2026

Copy link
Copy Markdown

vu1nz Security Review

0 finding(s) in PR #?

No security issues found.

@ralyodio
ralyodio marked this pull request as ready for review August 1, 2026 18:13
@ralyodio
ralyodio merged commit 72aa39d into main Aug 1, 2026
3 checks passed
@ralyodio
ralyodio deleted the fix-reload-race branch August 1, 2026 18:13
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