Files
mtusi2026lab7/scripts/rotate-certificates.py

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.')