Files
mtusi2026lab7/scripts/rotate-certificates.py
T
Mirariel 1b10180092
Skeleton contracts / contracts (pull_request) Canceled after 0s
Implement lab 7 mTLS OpenBao and certificate rotation
2026-11-20 20:39:14 +03:00

14 lines
530 B
Python

"""Rotate leaf certificates while preserving the local trust anchor."""
from pathlib import Path
import subprocess
root = Path(__file__).resolve().parents[1]
certs = root / 'certs'
for name in ('server', 'lb-client', 'api1', 'api2'):
for suffix in ('.crt', '.key', '.pem'):
path = certs / (name + suffix)
if path.exists():
path.unlink()
subprocess.run(['python', str(root / 'scripts' / 'bootstrap.py')], check=True)
print('Leaf certificates rotated; CA and application images were not replaced.')