mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-16 07:13:29 +00:00
feat(ops): alarm on a TLS leaf SPKI change for pinned native clients
The native client SPKI-pins the server's TLS leaf certificate. When the leaf auto-renews (GTS re-issues it roughly every 90 days) the leaf keypair — and so the SPKI pin — changes, and a client shipped only the old pin refuses to connect on the next renewal: a silent outage. Nothing server-side signalled that a client pins the served leaf. Add a pg-boss monitor that probes the served leaf every 6 hours, computes its iOS SPKI pin (base64(sha256(DER subjectPublicKeyInfo)) via a raw TLS socket + X509Certificate), and compares it against the operator's known-good set in TLS_LEAF_SPKI_PINS (comma-separated for the dual-pin renewal window). On a served pin outside the set it fails loud: a tls.pin.leaf_changed wide-event annotation, a system.tls.pin_changed audit row, and a high-priority SYSTEM_ALERT fanned out to admins through the existing dispatcher idiom. Transient TLS/network failures annotate tls.pin.probe_failed and never alarm. The baseline is an env var, not a persisted last-seen row — a self-learning baseline would silently adopt the first rotation and suppress the alarm the pinned client needs; an unset baseline logs the served pin and warns rather than auto-adopting. The runbook documents extraction, the re-pin + dual-pin procedure (≥11 days before expiry, ship to TestFlight), and the assumption that the probed host is the host the client connects to. Wires the queue into the worker (allQueues + cron + worker), adds the optional env to the manifest, compose whitelist, and .env example, and covers the SPKI computation + change detection with a fixture-cert unit test plus a queue-registration guard. (cherry picked from commit cdb88cd77b88aec71ad2f21caf2b15c185dfc01e)
This commit is contained in:
1 parent
a199fac20e
commit
540abebf09
15 files changed
+839
-6
No files matched your search
@@ -67,6 +67,17 @@ API_TOKEN_HMAC_KEY="<openssl rand -hex 32>"
|
||||
# DEPLOY_WEBHOOK_SECRET=""
|
||||
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# TLS leaf pin monitor -- alarm when the pinned leaf certificate rotates
|
||||
# -----------------------------------------------------------------------------
|
||||
# The native client SPKI-pins the served TLS leaf. Set this to the
|
||||
# known-good leaf pin(s) so the monitor can alarm on a rotation. The value
|
||||
# is base64(sha256(DER subjectPublicKeyInfo)); comma-separate to hold both
|
||||
# the current and the next pin during a dual-pin renewal window. See
|
||||
# docs/ops/tls-cert-pin.md for extraction + the re-pin runbook.
|
||||
# TLS_LEAF_SPKI_PINS=""
|
||||
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# Off-host backups -- all-or-none
|
||||
# -----------------------------------------------------------------------------
|
||||
|
||||
Reference in new issue
Block a user