feat: complete lab 7 grade 4 security controls and report

This commit is contained in:
Dmitrii Grishko
2026-11-15 21:58:27 +03:00
parent c5e3ac3aff
commit c69d735692
52 changed files with 1124 additions and 129 deletions
+5 -5
View File
@@ -7,7 +7,7 @@ import subprocess
from pathlib import Path
ROOT = Path(__file__).resolve().parents[1]
CA = "secrets/tls/lab7-ca.crt"
CA = "secrets/tls/lab7-ingress-ca.crt"
OUTPUT = ROOT / "evidence"
VALIDATION = {"CA_FILE": str(ROOT / CA)}
CHECKS = {
@@ -64,10 +64,10 @@ CHECKS = {
}
def main():
def main(checks=CHECKS):
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument("--only", nargs="+", choices=CHECKS)
selected = parser.parse_args().only or CHECKS
parser.add_argument("--only", nargs="+", choices=checks)
selected = parser.parse_args().only or checks
OUTPUT.mkdir(exist_ok=True)
if "grade3-resilience" in selected:
for name in ("restart", "failover"):
@@ -77,7 +77,7 @@ def main():
VALIDATION[f"{name.upper()}_EVIDENCE_FILE"] = str(path)
passed = True
for slug in selected:
title, commands = CHECKS[slug]
title, commands = checks[slug]
report = [f"# {title}", "", "Предпосылки: подготовленный, разблокированный учебный стенд; Docker Compose, Python и локальный CA.", ""]
for command in commands:
result = subprocess.run(command, cwd=ROOT, env=os.environ | VALIDATION,