test(pki): measure phase errors and verify revocation before expiry

This commit is contained in:
2026-11-20 20:24:57 +03:00
parent 82f02a020f
commit 33b8de003b
2 changed files with 76 additions and 4 deletions
+14
View File
@@ -197,6 +197,9 @@ def revoke(operator, leaf):
TRUST / "revoked.json", json.dumps(revoked) + "\n", mode=0o644
)
fixture_check("revoked-lb", reject=True)
assert leaf["expires_at"] > time.time(), (
"Revocation proof must precede natural expiry"
)
old_token = json.loads(
(SECRET / "probe/revoked-lb/secrets.json").read_text()
)["token"]
@@ -217,6 +220,9 @@ def revoke(operator, leaf):
assert issue.status_code in {401, 403}, (
"Old service token could issue a replacement certificate"
)
assert leaf["expires_at"] > time.time(), (
"Revocation checks must finish before natural expiry"
)
return {
"revoked_serial": leaf["serial"],
"still_unexpired_at_check": leaf["expires_at"] > time.time(),
@@ -389,6 +395,10 @@ def rollover():
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")
repair(operator, "lb")
for role in [*ROLES, "operator"]:
operator.authorized("DELETE", "auth/cert/certs/" + role + "-v1")
client_key, client_cert = sign_leaf(
@@ -408,6 +418,9 @@ def rollover():
operator.close()
reload_lb()
reload_bao()
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"
@@ -419,6 +432,7 @@ def rollover():
"old_l4_connections_waited_seconds": 46,
"old_ca_fixture_valid_during_dual_trust": True,
"old_ca_new_connection_denied_after_retirement": True,
"old_ca_fixture_unexpired_at_retirement_check": True,
"services": metadata(),
"image_rebuilt": False,
}