fix(pki): drain old connections after retiring the CA trust

This commit is contained in:
2026-11-20 20:39:38 +03:00
parent f3fd46b064
commit 8326754831
+5 -2
View File
@@ -393,8 +393,6 @@ def rollover():
"Not all active services renewed into new issuer" "Not all active services renewed into new issuer"
) )
fixture_check("retired-ca-lb") 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 # Keep the native Bao listener and LB well within their TTL across
# the explicit listener restarts needed to retire client CA trust. # the explicit listener restarts needed to retire client CA trust.
repair(operator, "openbao") repair(operator, "openbao")
@@ -413,17 +411,22 @@ def rollover():
write_private(OPERATOR / "ca.pem", public(new_root)) write_private(OPERATOR / "ca.pem", public(new_root))
write_private(TRUST / "ca.pem", public(new_root), mode=0o644) write_private(TRUST / "ca.pem", public(new_root), mode=0o644)
journal["phase"] = "old_trust_retired" journal["phase"] = "old_trust_retired"
journal["old_trust_removed_at"] = time.time()
write_private(directory / "state.json", json.dumps(journal) + "\n") write_private(directory / "state.json", json.dumps(journal) + "\n")
finally: finally:
operator.close() operator.close()
reload_lb() reload_lb()
reload_bao() 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(), ( assert fixture.not_valid_after_utc.timestamp() > time.time(), (
"CA retirement must be proved with an unexpired old-CA certificate" "CA retirement must be proved with an unexpired old-CA certificate"
) )
fixture_check("retired-ca-lb", reject=True) fixture_check("retired-ca-lb", reject=True)
fixture_check("lb") fixture_check("lb")
journal["phase"] = "complete" journal["phase"] = "complete"
journal["retirement_completed_at"] = time.time()
write_private(directory / "state.json", json.dumps(journal) + "\n") write_private(directory / "state.json", json.dumps(journal) + "\n")
return { return {
**journal, **journal,