Реализовать лабораторную 7: mTLS, OpenBao и защита worker

This commit is contained in:
wpyatzy
2026-12-04 20:35:40 +03:00
parent 20afc2c790
commit 1b865eac83
146 changed files with 9552 additions and 87 deletions
+10
View File
@@ -0,0 +1,10 @@
"""Negative fixtures keep the allowed CN, isolating CA/expiry from role checks."""
from pki import PRIVATE,issue
import subprocess,os
os.umask(0o077)
for role in ['api','worker','prometheus','grafana','collector','lb']:
issue(role,expired=True,destination='expired-'+role)
p=PRIVATE/'roles'/('foreign-'+role);p.mkdir(exist_ok=True)
subprocess.run(['openssl','req','-x509','-newkey','rsa:2048','-nodes','-days','2','-keyout',str(p/'service.key'),'-out',str(p/'service.crt'),'-subj','/CN='+role,'-addext','extendedKeyUsage=clientAuth'],check=True,stdout=subprocess.DEVNULL,stderr=subprocess.DEVNULL)
(p/'service.pem').write_bytes((p/'service.crt').read_bytes()+(p/'service.key').read_bytes())
print('Foreign/expired fixtures use the otherwise allowed identity')