From 8326754831d180550b1c8c5a35a46285035eb0b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B0=D1=81=D0=BB=D0=BE=D0=B2?= Date: Fri, 20 Nov 2026 20:39:38 +0300 Subject: [PATCH] fix(pki): drain old connections after retiring the CA trust --- scripts/pki.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/scripts/pki.py b/scripts/pki.py index b466fd7..5c88630 100644 --- a/scripts/pki.py +++ b/scripts/pki.py @@ -393,8 +393,6 @@ def rollover(): "Not all active services renewed into new issuer" ) fixture_check("retired-ca-lb") - # Allow old L4 connections to expire, then remove old trust everywhere. - time.sleep(46) # Keep the native Bao listener and LB well within their TTL across # the explicit listener restarts needed to retire client CA trust. repair(operator, "openbao") @@ -413,17 +411,22 @@ def rollover(): write_private(OPERATOR / "ca.pem", public(new_root)) write_private(TRUST / "ca.pem", public(new_root), mode=0o644) journal["phase"] = "old_trust_retired" + journal["old_trust_removed_at"] = time.time() write_private(directory / "state.json", json.dumps(journal) + "\n") finally: operator.close() reload_lb() reload_bao() + # Once old trust is removed, no new old-CA connections can enter. + # Wait out the absolute 45-second lifetime of any established L4 hop. + time.sleep(46) assert fixture.not_valid_after_utc.timestamp() > time.time(), ( "CA retirement must be proved with an unexpired old-CA certificate" ) fixture_check("retired-ca-lb", reject=True) fixture_check("lb") journal["phase"] = "complete" + journal["retirement_completed_at"] = time.time() write_private(directory / "state.json", json.dumps(journal) + "\n") return { **journal,