Fix OpenBao storage and validate mTLS

This commit is contained in:
Yuliiiaaaa
2026-12-05 13:00:53 +03:00
parent c00d245263
commit 35068e6d79
7 changed files with 211 additions and 59 deletions
+16 -3
View File
@@ -28,13 +28,26 @@ def request(cert: tuple[Path, Path] | None) -> str:
return data.split(b"\r\n", 1)[0].decode("ascii", errors="replace")
def expect_handshake_rejected(label: str, cert: tuple[Path, Path] | None) -> None:
def expect_handshake_rejected(
label: str,
cert: tuple[Path, Path] | None,
) -> None:
try:
status = request(cert)
except (ssl.SSLError, OSError, TimeoutError):
print(f"PASS: {label}: TLS handshake rejected")
print(f"PASS: {label}: TLS connection rejected")
return
raise SystemExit(f"FAIL: {label}: unexpected TLS/application response: {status}")
if status.startswith("HTTP/1.1 400"):
print(
f"PASS: {label}: rejected by Nginx "
f"(HTTP 400, client certificate required)"
)
return
raise SystemExit(
f"FAIL: {label}: unexpected TLS/application response: {status}"
)
def expect_status(label: str, cert: tuple[Path, Path], expected: str) -> None: