lab7: TLS ко всем зависимостям и телеметрии; раздельные роли PostgreSQL (GRANT по коду), ACL Valkey, AMQPS, HTTPS S3, mTLS Collector/Prometheus/Loki/Tempo/Grafana

This commit is contained in:
Alexey Bodanyuk
2026-11-27 16:29:09 +03:00
parent f36da97951
commit 93f4ed1013
28 changed files with 621 additions and 201 deletions
+3 -3
View File
@@ -1,7 +1,7 @@
#!/usr/bin/env python3
"""Controlled request -> its trace and logs (defense scenario, steps 2-3; evidence/trace-demo.txt).
python scripts/trace_demo.py [--base-url http://localhost:8080] [--output evidence/trace-demo.txt]
python scripts/trace_demo.py [--base-url https://localhost:8443] [--output evidence/trace-demo.txt]
1. creates a synthetic user and chat, uploads tests/fixtures/sample.png with OUR OWN W3C
`traceparent` header (trace id chosen here) and X-Request-Id;
@@ -36,13 +36,13 @@ def call(base: str, method: str, path: str, body=None, headers=None, raw: bytes
data = json.dumps(body).encode()
h["Content-Type"] = "application/json"
request = urllib.request.Request(base + path, data=data, method=method, headers=h)
with urllib.request.urlopen(request, timeout=30) as response:
with urllib.request.urlopen(request, timeout=30, context=obs.TLS) as response:
return response.status, response.headers, json.loads(response.read() or b"null")
def main() -> int:
parser = argparse.ArgumentParser()
parser.add_argument("--base-url", default="http://localhost:8080")
parser.add_argument("--base-url", default="https://localhost:8443")
parser.add_argument("--output")
args = parser.parse_args()
base = args.base_url.rstrip("/") + "/api/v1"