Close certificate auth before revoking worker tokens and rotating its secret

This commit is contained in:
2026-11-16 12:03:49 +03:00
parent d8455d9417
commit 040fa8d4da
6 changed files with 156 additions and 5 deletions
+13
View File
@@ -2,6 +2,7 @@
import json
import ssl
import time
import urllib.error
import urllib.request
from pathlib import Path
@@ -51,6 +52,18 @@ def main():
checks[name] = exc.code in {400, 403}
except (OSError, urllib.error.URLError):
checks[name] = True
try:
request = urllib.request.Request(
"https://openbao:8200/v1/secret/data/services/worker",
headers={"X-Vault-Token": old["REVOKED_BAO_TOKEN"]},
)
with urllib.request.urlopen(request, context=ctx, timeout=3):
checks["previously_issued_bao_token_denied"] = False
except urllib.error.HTTPError as exc:
checks["previously_issued_bao_token_denied"] = exc.code == 403
checks["old_bao_token_rejected_before_original_lease_expiry"] = (
time.time() < old["REVOKED_BAO_TOKEN_EXPIRES_AT"]
)
print(json.dumps({"checks": checks, "passed": all(checks.values())}))
if not all(checks.values()):
raise SystemExit(1)