ЛР 7 — БВТ2301 — Курлова — на 4

Перенесён минимум lab6 (API без изменений), добавлена защита на границах доверия:
- внешний HTTPS; обязательный mTLS LB -> API с allowlist identity и отзывом по serial;
- TLS на всех связях: PostgreSQL verify-full, MinIO HTTPS, RabbitMQ AMQPS mTLS (EXTERNAL),
  Valkey TLS + ACL, Collector и хранилища телеметрии через mTLS с отдельными CA;
- OpenBao в server mode: cert auth, токены 15 мин, политики только на свой путь;
- роли БД, S3-политики и права брокера по принципу минимальных прав;
- Argon2id с замером, rehash, общий лимит входа, бюджет защиты от login DoS;
- hardening всех контейнеров, scan образов с разбором, модель угроз, матрица доверия;
- отрицательные тесты: TLS-аудит (135 проверок), ACL, ротации, sealed OpenBao.
This commit is contained in:
alenchha
2026-11-16 10:49:13 +03:00
parent 20afc2c790
commit 861e7722b5
116 changed files with 14522 additions and 63 deletions
+11
View File
@@ -0,0 +1,11 @@
10:06:50 PASS acl_outsider eve: 404 on chat/history/metadata/content/variant/post, cannot attach a foreign file
10:06:50 PASS identity_spoofing forged X-User-Id ignored; without Bearer 401; Basic on business endpoint 401
10:06:50 PASS logout revoked token: 401 on ['api-1', 'api-2']
10:06:50 session expires_at moved to the past in PostgreSQL; the Valkey cache entry lives at most 30 s
10:07:22 PASS expiry expired session: 401 on ['api-1', 'api-2'] after the 30 s cache bound
10:07:23 PASS rehash stored m=8192,t=1,p=1 -> m=19456,t=2,p=1 after a successful login
10:07:23 PASS size_limits JSON 70 kB -> 413 (payload_too_large), upload > 10 MiB -> 413
10:07:23 PASS rate_limit_user 5 failures on ['api-1', 'api-2'] -> 429 Retry-After=60s even with the right password
10:07:24 PASS rate_limit_ip per-IP limit: 429 after 107 attempts from one address
10:07:24 waiting for the rate-limit window to expire so that later tests are not affected
PASS: acl_outsider, identity_spoofing, logout, expiry, rehash, size_limits, rate_limit_user, rate_limit_ip
+8
View File
@@ -0,0 +1,8 @@
11:08:38 openbao: sealed
11:08:40 sealed: running services keep working -> PASS: lab7 public API scenario; infrastructure and grading evidence remain separate.
11:09:00 refresher: openbao_unavailable ... keeping cached secret version (seen in API/worker logs)
11:09:35 worker-2 restarted while sealed: health=starting, waiting for OpenBao=True
11:09:36 upload during the seal processed by the remaining worker: ready
11:09:37 openbao: unsealed with 2 of 3 operator shares
11:09:52 worker-2 healthy 16 s after unseal (sealed for 58 s in total)
PASS: sealed OpenBao -> running services continue, new process waits, recovery after unseal
+11
View File
@@ -0,0 +1,11 @@
10:12:23 current lb-client serial 0E30F0061EA3866362334D7C34B7F93B9BD61418
10:12:24 issued lb-client (lb.client.messenger) serial=0E30F0061EA3866362334D7C34B7F93B9BD6142A valid 90d
10:12:25 nginx reloaded with the new client certificate (1.4 s after issue)
10:12:25 before revocation: old=HTTP/1.1 200 OK new=HTTP/1.1 200 OK
10:12:25 revoked serial=0E30F0061EA3866362334D7C34B7F93B9BD61418
10:12:28 api-1 after revocation: old -> closed without response | new -> HTTP/1.1 200 OK | expired -> closed without response
10:12:29 api-2 after revocation: old -> closed without response | new -> HTTP/1.1 200 OK | expired -> closed without response
10:12:29 API log: mtls_client_rejected reason=revoked serial=0E30F0061EA3866362334D7C34B7F93B9BD61418
10:12:34 traffic during rotation: 161 requests, 161 ok, unexpected errors 0
10:12:35 PASS: lab7 public API scenario; infrastructure and grading evidence remain separate.
PASS: lb-client rotated (0E30F0061EA3866362334D7C34B7F93B9BD61418 -> 0E30F0061EA3866362334D7C34B7F93B9BD6142A) without image rebuild, old serial revoked, expired cert refused
+92
View File
@@ -0,0 +1,92 @@
ok 1 series Доступность (SLO 99%) Доступность (SLO 99%)
ok 1 series Латентность ≤500 ms (SLO 95%) Латентность ≤500 ms (SLO 95%)
ok 1 series Error ratio 5xx (2m) Error ratio 5xx (2m)
ok 1 series Старейшее задание Старейшее задание
ok 1 series RPS API RPS API
ok 1 series p95 API (5m) p95 API (5m)
ok 1 series Загрузка worker Загрузка worker
ok 1 series Ожидают пул БД Ожидают пул БД
ok 12 series RPS по маршруту и методу {{http_request_method}} {{http_route}}
ok 3 series RPS по классу статуса {{status_class}}
ok 1 series Латентность API p50/p95/p99 (из histogram bucket p50
ok 1 series Латентность API p50/p95/p99 (из histogram bucket p95
ok 1 series Латентность API p50/p95/p99 (из histogram bucket p99
ok 1 series Доля ошибок 5xx 5xx / все
ok 10 series p95 по маршруту {{http_route}}
ok 2 series Запросы в обработке {{instance}}
ok 6 series Jobs по исходу (в сек.) {{outcome}}
ok 1 series Длительность job (succeeded) p50/p95/p99 p50
ok 1 series Длительность job (succeeded) p50/p95/p99 p95
ok 1 series Длительность job (succeeded) p50/p95/p99 p99
ok 3 series Глубина очереди (из PostgreSQL) {{queue}} {{state}}
ok 1 series Возраст старейшей job oldest age
ok 1 series Время до ready p50/p95/p99 p50
ok 1 series Время до ready p50/p95/p99 p95
ok 1 series Время до ready p50/p95/p99 p99
ok 1 series Насыщение worker: занято / ёмкость busy
ok 1 series Насыщение worker: занято / ёмкость capacity
ok 1 series Насыщение worker: занято / ёмкость saturation
ok 4 series Пул БД: used / idle / waiting {{service_name}} {{db_client_connection_state}}
ok 2 series Пул БД: used / idle / waiting {{service_name}} waiting
ok 2 series Пул БД: used / idle / waiting {{service_name}} max
ok 4 series CPU процессов (ядра) {{service_name}} {{instance}}
ok 1 series CPU процессов (ядра) otel-collector
ok 4 series RSS процессов {{service_name}} {{instance}}
ok 1 series RSS процессов otel-collector
ok 1 series Telemetry pipeline: принято / отправлено / ошибк accepted spans
ok 1 series Telemetry pipeline: принято / отправлено / ошибк accepted log records
ok 1 series Telemetry pipeline: принято / отправлено / ошибк accepted metric points
ok 3 series Telemetry pipeline: принято / отправлено / ошибк sent {{exporter}}
ok 1 series Telemetry pipeline: принято / отправлено / ошибк send failed spans
ok 1 series Telemetry pipeline: принято / отправлено / ошибк dropped spans (queue full)
ok 1 series Telemetry pipeline: принято / отправлено / ошибк send failed logs
ok 1 series Telemetry pipeline: принято / отправлено / ошибк dropped logs (queue full)
ok 3 series Telemetry pipeline: принято / отправлено / ошибк queue {{exporter}}
panels: 32, prometheus queries without data: 0
grafana prometheus ok 84 values Доступность (SLO 99%)
grafana prometheus ok 84 values Латентность ≤500 ms (SLO 95%)
grafana prometheus ok 84 values Error ratio 5xx (2m)
grafana prometheus ok 86 values Старейшее задание
grafana prometheus ok 84 values RPS API
grafana prometheus ok 84 values p95 API (5m)
grafana prometheus ok 86 values Загрузка worker
grafana prometheus ok 86 values Ожидают пул БД
grafana prometheus ok 789 values RPS по маршруту и методу
grafana prometheus ok 179 values RPS по классу статуса
grafana prometheus ok 82 values Латентность API p50/p95/p99 (из histogram bucket
grafana prometheus ok 82 values Латентность API p50/p95/p99 (из histogram bucket
grafana prometheus ok 82 values Латентность API p50/p95/p99 (из histogram bucket
grafana prometheus ok 82 values Доля ошибок 5xx
grafana prometheus ok 683 values p95 по маршруту
grafana prometheus ok 170 values Запросы в обработке
grafana prometheus ok 273 values Jobs по исходу (в сек.)
grafana prometheus ok 77 values Длительность job (succeeded) p50/p95/p99
grafana prometheus ok 77 values Длительность job (succeeded) p50/p95/p99
grafana prometheus ok 77 values Длительность job (succeeded) p50/p95/p99
grafana prometheus ok 258 values Глубина очереди (из PostgreSQL)
grafana prometheus ok 86 values Возраст старейшей job
grafana prometheus ok 77 values Время до ready p50/p95/p99
grafana prometheus ok 77 values Время до ready p50/p95/p99
grafana prometheus ok 77 values Время до ready p50/p95/p99
grafana prometheus ok 86 values Насыщение worker: занято / ёмкость
grafana prometheus ok 86 values Насыщение worker: занято / ёмкость
grafana prometheus ok 86 values Насыщение worker: занято / ёмкость
grafana prometheus ok 344 values Пул БД: used / idle / waiting
grafana prometheus ok 172 values Пул БД: used / idle / waiting
grafana prometheus ok 172 values Пул БД: used / idle / waiting
grafana prometheus ok 350 values CPU процессов (ядра)
grafana prometheus ok 91 values CPU процессов (ядра)
grafana prometheus ok 402 values RSS процессов
grafana prometheus ok 105 values RSS процессов
grafana prometheus ok 76 values Telemetry pipeline: принято / отправлено / ошибк
grafana prometheus ok 80 values Telemetry pipeline: принято / отправлено / ошибк
grafana prometheus ok 91 values Telemetry pipeline: принято / отправлено / ошибк
grafana prometheus ok 247 values Telemetry pipeline: принято / отправлено / ошибк
grafana prometheus ok 91 values Telemetry pipeline: принято / отправлено / ошибк
grafana prometheus ok 91 values Telemetry pipeline: принято / отправлено / ошибк
grafana prometheus ok 91 values Telemetry pipeline: принято / отправлено / ошибк
grafana prometheus ok 91 values Telemetry pipeline: принято / отправлено / ошибк
grafana prometheus ok 273 values Telemetry pipeline: принято / отправлено / ошибк
grafana loki ok 100 values Логи API и worker (warning/error)
grafana tempo ok 20 traces Трассы с ошибками или медленнее 500 ms (TraceQL) (datasource proxy)
via Grafana: queries without data or with errors: 0
+13
View File
@@ -0,0 +1,13 @@
# 2026-11-11T08:10:20Z
$ make test-failover ACTION_SCRIPT=scripts/stop-one.sh (run 1)
Executing explicit failover hook; hook output suppressed to avoid leaking secrets.
{"observed_instances_before": 2, "successful_writes": 128, "failed_attempts": 0, "first_recovery_seconds": 1.265}
PASS: failover preserved confirmed data and existing session. Hook scope needs operator evidence.
mtusi-lab7-api-1-1 Up 38 seconds (healthy)
$ docker compose start api-1 api-2
$ make test-failover ACTION_SCRIPT=scripts/stop-one.sh (run 2)
Executing explicit failover hook; hook output suppressed to avoid leaking secrets.
{"observed_instances_before": 2, "successful_writes": 130, "failed_attempts": 0, "first_recovery_seconds": 0.672}
PASS: failover preserved confirmed data and existing session. Hook scope needs operator evidence.
mtusi-lab7-api-1-1 Up About a minute (healthy)
$ docker compose start api-1 api-2
+342
View File
@@ -0,0 +1,342 @@
[
{
"container": "api-1-1",
"user": "10001:10001",
"privileged": false,
"network": "mtusi-lab7_default",
"pid": "private",
"cap_drop": [
"ALL"
],
"cap_add": null,
"no_new_privileges": true,
"read_only_rootfs": true,
"tmpfs": [
"/tmp"
],
"cpus": 0.5,
"memory_mib": 512,
"pids_limit": 256,
"docker_socket": false,
"published": [],
"problems": []
},
{
"container": "api-2-1",
"user": "10001:10001",
"privileged": false,
"network": "mtusi-lab7_default",
"pid": "private",
"cap_drop": [
"ALL"
],
"cap_add": null,
"no_new_privileges": true,
"read_only_rootfs": true,
"tmpfs": [
"/tmp"
],
"cpus": 0.5,
"memory_mib": 512,
"pids_limit": 256,
"docker_socket": false,
"published": [],
"problems": []
},
{
"container": "grafana-1",
"user": "472",
"privileged": false,
"network": "mtusi-lab7_default",
"pid": "private",
"cap_drop": [
"ALL"
],
"cap_add": null,
"no_new_privileges": true,
"read_only_rootfs": true,
"tmpfs": [
"/tmp"
],
"cpus": 0.5,
"memory_mib": 256,
"pids_limit": 256,
"docker_socket": false,
"published": [
"127.0.0.1:3000->3000/tcp"
],
"problems": []
},
{
"container": "loki-1",
"user": "10001",
"privileged": false,
"network": "mtusi-lab7_default",
"pid": "private",
"cap_drop": [
"ALL"
],
"cap_add": null,
"no_new_privileges": true,
"read_only_rootfs": true,
"tmpfs": [],
"cpus": 1.0,
"memory_mib": 512,
"pids_limit": 256,
"docker_socket": false,
"published": [
"127.0.0.1:3100->3100/tcp"
],
"problems": []
},
{
"container": "minio-1",
"user": "65532",
"privileged": false,
"network": "mtusi-lab7_default",
"pid": "private",
"cap_drop": [
"ALL"
],
"cap_add": null,
"no_new_privileges": true,
"read_only_rootfs": true,
"tmpfs": [
"/tmp"
],
"cpus": 0.5,
"memory_mib": 512,
"pids_limit": 256,
"docker_socket": false,
"published": [],
"problems": []
},
{
"container": "nginx-1",
"user": "101:101",
"privileged": false,
"network": "mtusi-lab7_default",
"pid": "private",
"cap_drop": [
"ALL"
],
"cap_add": null,
"no_new_privileges": true,
"read_only_rootfs": true,
"tmpfs": [
"/etc/nginx/upstream",
"/tmp",
"/var/cache/nginx",
"/var/run"
],
"cpus": 0.25,
"memory_mib": 64,
"pids_limit": 256,
"docker_socket": false,
"published": [
"127.0.0.1:8443->8443/tcp"
],
"problems": []
},
{
"container": "openbao-1",
"user": "100:1000",
"privileged": false,
"network": "mtusi-lab7_default",
"pid": "private",
"cap_drop": [
"ALL"
],
"cap_add": null,
"no_new_privileges": true,
"read_only_rootfs": true,
"tmpfs": [
"/tmp"
],
"cpus": 0.5,
"memory_mib": 256,
"pids_limit": 256,
"docker_socket": false,
"published": [],
"problems": []
},
{
"container": "otel-collector-1",
"user": "10001",
"privileged": false,
"network": "mtusi-lab7_default",
"pid": "private",
"cap_drop": [
"ALL"
],
"cap_add": null,
"no_new_privileges": true,
"read_only_rootfs": true,
"tmpfs": [],
"cpus": 1.0,
"memory_mib": 256,
"pids_limit": 256,
"docker_socket": false,
"published": [],
"problems": []
},
{
"container": "postgres-1",
"user": "70:70",
"privileged": false,
"network": "mtusi-lab7_default",
"pid": "private",
"cap_drop": [
"ALL"
],
"cap_add": null,
"no_new_privileges": true,
"read_only_rootfs": true,
"tmpfs": [
"/tmp",
"/var/run/postgresql"
],
"cpus": 1.0,
"memory_mib": 512,
"pids_limit": 256,
"docker_socket": false,
"published": [],
"problems": []
},
{
"container": "prometheus-1",
"user": "nobody",
"privileged": false,
"network": "mtusi-lab7_default",
"pid": "private",
"cap_drop": [
"ALL"
],
"cap_add": null,
"no_new_privileges": true,
"read_only_rootfs": true,
"tmpfs": [],
"cpus": 1.0,
"memory_mib": 512,
"pids_limit": 256,
"docker_socket": false,
"published": [
"127.0.0.1:9090->9090/tcp"
],
"problems": []
},
{
"container": "rabbitmq-1",
"user": "100:101",
"privileged": false,
"network": "mtusi-lab7_default",
"pid": "private",
"cap_drop": [
"ALL"
],
"cap_add": null,
"no_new_privileges": true,
"read_only_rootfs": true,
"tmpfs": [
"/etc/rabbitmq/conf.d",
"/tmp"
],
"cpus": 1.0,
"memory_mib": 512,
"pids_limit": 256,
"docker_socket": false,
"published": [],
"problems": []
},
{
"container": "tempo-1",
"user": "10001:10001",
"privileged": false,
"network": "mtusi-lab7_default",
"pid": "private",
"cap_drop": [
"ALL"
],
"cap_add": null,
"no_new_privileges": true,
"read_only_rootfs": true,
"tmpfs": [
"/tmp"
],
"cpus": 1.0,
"memory_mib": 1024,
"pids_limit": 256,
"docker_socket": false,
"published": [
"127.0.0.1:3200->3200/tcp"
],
"problems": []
},
{
"container": "valkey-1",
"user": "999:1000",
"privileged": false,
"network": "mtusi-lab7_default",
"pid": "private",
"cap_drop": [
"ALL"
],
"cap_add": null,
"no_new_privileges": true,
"read_only_rootfs": true,
"tmpfs": [
"/data",
"/tmp"
],
"cpus": 0.25,
"memory_mib": 128,
"pids_limit": 256,
"docker_socket": false,
"published": [],
"problems": []
},
{
"container": "worker-1",
"user": "10001:10001",
"privileged": false,
"network": "mtusi-lab7_default",
"pid": "private",
"cap_drop": [
"ALL"
],
"cap_add": null,
"no_new_privileges": true,
"read_only_rootfs": true,
"tmpfs": [
"/tmp"
],
"cpus": 2.0,
"memory_mib": 1536,
"pids_limit": 256,
"docker_socket": false,
"published": [],
"problems": []
},
{
"container": "worker-2",
"user": "10001:10001",
"privileged": false,
"network": "mtusi-lab7_default",
"pid": "private",
"cap_drop": [
"ALL"
],
"cap_add": null,
"no_new_privileges": true,
"read_only_rootfs": true,
"tmpfs": [
"/tmp"
],
"cpus": 2.0,
"memory_mib": 1536,
"pids_limit": 256,
"docker_socket": false,
"published": [],
"problems": []
}
]
+18
View File
@@ -0,0 +1,18 @@
container user capDrop nnp ro cpus mem/pids published problems
api-1-1 10001:10001 ALL True True 0.5 512/256 - ok
api-2-1 10001:10001 ALL True True 0.5 512/256 - ok
grafana-1 472 ALL True True 0.5 256/256 127.0.0.1:3000 ok
loki-1 10001 ALL True True 1.0 512/256 127.0.0.1:3100 ok
minio-1 65532 ALL True True 0.5 512/256 - ok
nginx-1 101:101 ALL True True 0.25 64/256 127.0.0.1:8443 ok
openbao-1 100:1000 ALL True True 0.5 256/256 - ok
otel-collector-1 10001 ALL True True 1.0 256/256 - ok
postgres-1 70:70 ALL True True 1.0 512/256 - ok
prometheus-1 nobody ALL True True 1.0 512/256 127.0.0.1:9090 ok
rabbitmq-1 100:101 ALL True True 1.0 512/256 - ok
tempo-1 10001:10001 ALL True True 1.0 1024/256 127.0.0.1:3200 ok
valkey-1 999:1000 ALL True True 0.25 128/256 - ok
worker-1 10001:10001 ALL True True 2.0 1536/256 - ok
worker-2 10001:10001 ALL True True 2.0 1536/256 - ok
published ports allowed: {'8443': 'nginx business ingress (TLS)', '3000': 'Grafana (HTTPS + login)', '9090': 'Prometheus (mTLS operator)', '3100': 'Loki (mTLS operator)', '3200': 'Tempo (mTLS operator)'}
15 containers, 0 problems
+16
View File
@@ -0,0 +1,16 @@
Trivy 0.58.1, DB 2026-11-11; scanned with docker save (no Docker socket in the scanner)
== app BEFORE (python 3.12.8, pillow 11.0.0, urllib3 2.3.0)
/scan/app.tar (debian 12.9) os-pkgs {'CRITICAL': 9, 'HIGH': 145, 'LOW': 158, 'MEDIUM': 217} | HIGH+CRIT with fix: 56/154 | secrets: 0
Python lang-pkgs {'CRITICAL': 5, 'HIGH': 43, 'LOW': 2, 'MEDIUM': 26} | HIGH+CRIT with fix: 48/48 | secrets: 0
== app AFTER (python 3.12.16, pillow 13.0.0, urllib3 2.8.0)
/scan/app.tar (debian 12.15) os-pkgs {'CRITICAL': 2, 'HIGH': 96, 'LOW': 108, 'MEDIUM': 129, 'UNKNOWN': 10} | HIGH+CRIT with fix: 0/98 | secrets: 0
Python lang-pkgs {'HIGH': 3, 'LOW': 2, 'MEDIUM': 9} | HIGH+CRIT with fix: 3/3 | secrets: 0
== nginx:1.27.3-alpine
/scan/nginx.tar (alpine 3.20.5) os-pkgs {'CRITICAL': 3, 'HIGH': 37, 'LOW': 31, 'MEDIUM': 33} | HIGH+CRIT with fix: 40/40 | secrets: 0
== openbao/openbao:2.1.0
/scan/openbao.tar (alpine 3.20.3) os-pkgs {'CRITICAL': 2, 'HIGH': 26, 'LOW': 23, 'MEDIUM': 14} | HIGH+CRIT with fix: 28/28 | secrets: 0
bin/bao lang-pkgs {'CRITICAL': 2, 'HIGH': 61, 'LOW': 9, 'MEDIUM': 68, 'UNKNOWN': 2} | HIGH+CRIT with fix: 59/63 | secrets: 0
+80
View File
@@ -0,0 +1,80 @@
10:18:35 scenario A: scenario_a
10:18:35 client saw: missing X-Request-Id
10:18:35 committed attachment a3900cbb-c50d-496c-9962-ba0ec39928d3 survived the API crash
10:18:35 statuses: processing -> ready
10:18:35 audit attempt=1 enqueued api:api-1
10:18:35 audit attempt=1 claimed 2e84bfa8176e:4f81b283
10:18:35 audit attempt=1 succeeded 2e84bfa8176e:4f81b283
10:18:36 scenario A PASS (1.9s)
10:18:36 scenario B: scenario_b
10:18:59 statuses: queued -> processing -> queued -> ready
10:18:59 audit attempt=1 enqueued api:api-2
10:18:59 audit attempt=1 claimed eb9974d4233a:3bafe435
10:18:59 audit attempt=1 retry_scheduled sweeper:2e84bfa8176e:4f81b28 lease_expired delay=1.34s
10:18:59 audit attempt=2 claimed 2e84bfa8176e:4f81b283
10:18:59 audit attempt=2 succeeded 2e84bfa8176e:4f81b283
10:19:00 scenario B PASS (23.6s)
10:19:00 scenario C: scenario_c
10:19:01 statuses: queued -> ready
10:19:01 audit attempt=1 enqueued api:api-2
10:19:01 audit attempt=1 claimed eb9974d4233a:f07c7c15
10:19:01 audit attempt=1 succeeded eb9974d4233a:f07c7c15
10:19:11 scenario C PASS (10.8s)
10:19:11 scenario D: scenario_d
10:19:22 statuses: processing -> queued -> ready
10:19:22 audit attempt=1 enqueued api:api-1
10:19:22 audit attempt=1 claimed 2e84bfa8176e:4f81b283
10:19:22 audit attempt=1 retry_scheduled 2e84bfa8176e:4f81b283 dependency_unavailable delay=1.33s
10:19:22 audit attempt=2 claimed eb9974d4233a:ea4f119d
10:19:22 audit attempt=2 retry_scheduled eb9974d4233a:ea4f119d dependency_unavailable delay=2.5s
10:19:22 audit attempt=3 claimed 2e84bfa8176e:4f81b283
10:19:22 audit attempt=3 retry_scheduled 2e84bfa8176e:4f81b283 dependency_unavailable delay=5.78s
10:19:22 audit attempt=4 claimed eb9974d4233a:ea4f119d
10:19:22 audit attempt=4 succeeded eb9974d4233a:ea4f119d
10:19:24 backoff delays: [1.33, 2.5, 5.78]
10:19:24 scenario D PASS (12.6s)
10:19:24 scenario E: scenario_e
10:19:24 audit attempt=1 enqueued api:api-2
10:19:24 audit attempt=1 claimed 2e84bfa8176e:4f81b283
10:19:24 audit attempt=1 failed 2e84bfa8176e:4f81b283 invalid_image
10:19:24 scenario E PASS (0.7s)
10:19:24 scenario F: scenario_f
10:19:48 failed registry contains the job; replay
10:20:11 statuses: queued -> ready
10:20:11 audit attempt=1 enqueued api:api-1
10:20:11 audit attempt=1 claimed eb9974d4233a:ea4f119d
10:20:11 audit attempt=1 retry_scheduled eb9974d4233a:ea4f119d dependency_unavailable delay=1.28s
10:20:11 audit attempt=2 claimed 2e84bfa8176e:4f81b283
10:20:11 audit attempt=2 retry_scheduled 2e84bfa8176e:4f81b283 dependency_unavailable delay=2.55s
10:20:11 audit attempt=3 claimed eb9974d4233a:ea4f119d
10:20:11 audit attempt=3 retry_scheduled eb9974d4233a:ea4f119d dependency_unavailable delay=6.47s
10:20:11 audit attempt=4 claimed 2e84bfa8176e:4f81b283
10:20:11 audit attempt=4 retry_scheduled 2e84bfa8176e:4f81b283 dependency_unavailable delay=9.94s
10:20:11 audit attempt=5 claimed eb9974d4233a:ea4f119d
10:20:11 audit attempt=5 failed eb9974d4233a:ea4f119d retry_exhausted
10:20:11 audit attempt=6 replayed operator:test-suite
10:20:11 audit attempt=6 claimed 2e84bfa8176e:4f81b283
10:20:11 audit attempt=6 retry_scheduled 2e84bfa8176e:4f81b283 dependency_unavailable delay=20.59s
10:20:11 audit attempt=7 claimed eb9974d4233a:ea4f119d
10:20:11 audit attempt=7 succeeded eb9974d4233a:ea4f119d
10:20:13 second replay refused: job is succeeded, attachment is ready
10:20:14 scenario F PASS (50.2s)
10:20:14 scenario G: scenario_g
10:20:38 statuses: processing -> queued -> processing -> ready
10:20:38 audit attempt=1 enqueued api:api-1
10:20:38 audit attempt=1 claimed 2e84bfa8176e:4f81b283
10:20:38 audit attempt=1 retry_scheduled sweeper:eb9974d4233a:ea4f119 lease_expired delay=1.12s
10:20:38 audit attempt=2 claimed eb9974d4233a:ea4f119d
10:20:38 audit attempt=2 succeeded eb9974d4233a:ea4f119d
10:21:11 scenario G PASS (56.4s)
10:21:11 scenario H: scenario_h
10:21:15 DLQ depth 0 -> 1
10:21:15 scenario H PASS (4.1s)
10:21:15 scenario I: scenario_i
10:21:19 broker down: upload 202, outbox holds 1 unpublished job
10:21:25 statuses: queued -> ready
10:21:25 audit attempt=1 enqueued api:api-1
10:21:25 audit attempt=1 claimed 2e84bfa8176e:4f81b283
10:21:25 audit attempt=1 succeeded 2e84bfa8176e:4f81b283
10:21:26 scenario I PASS (11.4s)
PASS: failure windows A B C D E F G H I
+14
View File
@@ -0,0 +1,14 @@
10:18:08 stop all workers
10:18:08 upload 202 queued id=59f4941d-1a35-4d70-a976-c8ed89746f38
10:18:08 message 0f104c92-c0dd-46a0-b906-f58c9fde4017 created with queued attachment
10:18:10 broker queue while worker is down: {'messages': 1, 'ready': 1, 'unacked': 0}
10:18:11 restart api-1 api-2 rabbitmq (volumes kept)
10:18:23 started before: mtusi-lab7-api-1-1 2026-11-11T07:17:26.446583425Z; mtusi-lab7-api-2-1 2026-11-11T07:17:38.07347875Z; mtusi-lab7-rabbitmq-1 2026-11-11T07:17:27.208089551Z
10:18:23 started after: mtusi-lab7-api-1-1 2026-11-11T07:18:11.610777668Z; mtusi-lab7-api-2-1 2026-11-11T07:18:11.669354168Z; mtusi-lab7-rabbitmq-1 2026-11-11T07:18:12.345023127Z
10:18:24 broker queue after broker restart: {'messages': 1, 'ready': 1, 'unacked': 0}
10:18:24 start workers
10:18:27 status sequence observed: queued -> ready
10:18:28 objects: ['attachments/59f4941d-1a35-4d70-a976-c8ed89746f38/original', 'attachments/59f4941d-1a35-4d70-a976-c8ed89746f38/v1/crop.jpg', 'attachments/59f4941d-1a35-4d70-a976-c8ed89746f38/v1/optimized.webp', 'attachments/59f4941d-1a35-4d70-a976-c8ed89746f38/v1/thumbnail.jpg']
10:18:28 redelivery: republish the finished job through the outbox (duplicate message)
10:18:34 duplicate acked as no-op: variants=3 successes=1
PASS: worker down / API+broker restart / redelivery no-op
+87
View File
@@ -0,0 +1,87 @@
{
"argon2_bench_api_container_0_5_cpu": [
{
"m_kib": 19456,
"t": 2,
"p": 1,
"p50_ms": 11.3,
"max_ms": 66.6,
"peak_rss_mib": 37.3
},
{
"m_kib": 12288,
"t": 3,
"p": 1,
"p50_ms": 9.3,
"max_ms": 62.0,
"peak_rss_mib": 37.3
},
{
"m_kib": 47104,
"t": 1,
"p": 1,
"p50_ms": 16.6,
"max_ms": 69.2,
"peak_rss_mib": 83.0
},
{
"m_kib": 65536,
"t": 3,
"p": 1,
"p50_ms": 171.6,
"max_ms": 175.5,
"peak_rss_mib": 101.0
},
{
"m_kib": 65536,
"t": 3,
"p": 4,
"p50_ms": 390.0,
"max_ms": 806.1,
"peak_rss_mib": 101.2
}
],
"baseline": {
"attackers": 0,
"seconds": 35,
"login_attempts_per_s": 0.0,
"login_status_counts": {},
"login_401_p50_ms": null,
"login_401_p99_ms": null,
"probe_ok": 165,
"probe_errors": 0,
"probe_p50_ms": 9.5,
"probe_p99_ms": 46.4,
"api_cpu_pct_of_one_core_both_replicas": 10.3,
"api_rss_samples": {
"mtusi-lab7-api-2-1": "97.59MiB",
"mtusi-lab7-api-1-1": "97.34MiB"
}
},
"flood": {
"attackers": 32,
"seconds": 37,
"login_attempts_per_s": 40.4,
"login_status_counts": {
"401": 1496
},
"login_401_p50_ms": 802.6,
"login_401_p99_ms": 2396.6,
"probe_ok": 128,
"probe_errors": 0,
"probe_p50_ms": 28.5,
"probe_p99_ms": 295.0,
"api_cpu_pct_of_one_core_both_replicas": 89.6,
"api_rss_samples": {
"mtusi-lab7-api-2-1": "196.7MiB",
"mtusi-lab7-api-1-1": "183.3MiB"
}
},
"config": {
"PASSWORD_HASH_CONCURRENCY_per_replica": 4,
"PASSWORD_HASH_QUEUE_SECONDS": 3,
"replicas": 2,
"api_cpu_limit": 0.5,
"api_mem_limit_mib": 512
}
}
+27
View File
@@ -0,0 +1,27 @@
10:32:44 message sent request_id=94e97b26265542fb9d208a905b5d5701 (text marker kept private)
10:32:47 upload 913f8afd-4a07-4a58-b943-ea623e6ec0d0: queued -> queued -> processing -> ready
10:32:51 Tempo: trace 715b953a7f7536b44b99c48205a5c639, 42 spans; tree (DB client spans omitted):
api SERVER POST /api/v1/chats/{chat_id}/attachments 15.3 ms UNSET {"http.response.status_code": "202", "messenger.request_id": "95e2a7eb2f9e46319830eca2e087ccfb", "messenger.instance_id": "api-2", "messenger.attachment_id": "913f8afd-4a07-4a58-b943-ea623e6ec0d0"}
api CLIENT S3.PutObject 8.4 ms UNSET {"rpc.method": "PutObject"}
api PRODUCER attachments.process publish 3.1 ms UNSET {"messaging.message.id": "52bd90b1-34f0-4737-86e7-50e164191b3f", "messenger.job.attempt": "1", "messenger.attachment_id": "913f8afd-4a07-4a58-b943-ea623e6ec0d0"}
worker CONSUMER attachments.process process 8.3 ms ERROR {"messaging.message.id": "52bd90b1-34f0-4737-86e7-50e164191b3f", "messenger.attachment_id": "913f8afd-4a07-4a58-b943-ea623e6ec0d0", "messenger.job.attempt": "1", "messenger.job.outcome": "retry"}
api PRODUCER attachments.process publish 4.8 ms UNSET {"messaging.message.id": "52bd90b1-34f0-4737-86e7-50e164191b3f", "messenger.job.attempt": "2", "messenger.attachment_id": "913f8afd-4a07-4a58-b943-ea623e6ec0d0"}
worker CONSUMER attachments.process process 174.7 ms UNSET {"messaging.message.id": "52bd90b1-34f0-4737-86e7-50e164191b3f", "messenger.attachment_id": "913f8afd-4a07-4a58-b943-ea623e6ec0d0", "messenger.job.attempt": "2", "messenger.job.outcome": "succeeded"}
worker CLIENT S3.GetObject 15.2 ms UNSET {"rpc.method": "GetObject"}
worker INTERNAL imageproc 128.0 ms UNSET {"messenger.pipeline_version": "1"}
worker CLIENT S3.CopyObject 5.3 ms UNSET {"rpc.method": "CopyObject"}
worker CLIENT S3.PutObject 3.0 ms UNSET {"rpc.method": "PutObject"}
worker CLIENT S3.PutObject 2.1 ms UNSET {"rpc.method": "PutObject"}
worker CLIENT S3.PutObject 1.8 ms UNSET {"rpc.method": "PutObject"}
worker CLIENT S3.DeleteObject 1.0 ms UNSET {"rpc.method": "DeleteObject"}
10:32:51 PASS: W3C context API -> outbox -> broker -> worker (retry) -> S3/DB is one trace with producer/consumer links
10:32:51 Loki: 4 records with trace_id=715b953a7f7536b44b99c48205a5c639: [('api', 'attachment_queued'), ('worker', 'job_claimed'), ('worker', 'job_attempt_failed'), ('worker', 'job_finished')]
10:32:51 Loki record fields: ['code_filepath', 'code_function', 'code_lineno', 'deployment_environment_name', 'detected_level', 'event', 'flags', 'observed_timestamp', 'scope_name', 'service_instance_id', 'service_name', 'service_namespace', 'service_version', 'severity_number', 'severity_text', 'span_id', 'telemetry_sdk_language', 'telemetry_sdk_name', 'telemetry_sdk_version', 'trace_id', 'ts']
10:32:55 HTTP 500 X-Request-Id=2df37bc19c3d4676804688b4abcb2ae1 -> Loki event=unhandled_error trace_id=f63428fc5f86c4f25be261c5db8ecc08
10:32:55 Tempo: GET /api/v1/chats status=ERROR request_id matches; exception event recorded=True
10:32:55 message POST trace 3157b85474b226259a91fb7e6ddeec5a: ['POST /api/v1/chats/{chat_id}/messages', 'SELECT', 'SELECT chat_members', 'SELECT idempotency_keys', 'INSERT messages', 'INSERT idempotency_keys']
10:32:55 PASS: password, bearer token, message text, filename, Authorization, signed URLs, image bytes absent from traces and logs
10:32:55 PASS: 1921 series, label names: ['__name__', 'db_client_connection_state', 'decision', 'deployment_environment_name', 'error_type', 'http_method', 'http_request_method', 'http_response_status_code', 'http_route', 'http_scheme', 'http_status_code', 'instance', 'job', 'job_type', 'le', 'net_host_name', 'net_host_port', 'net_protocol_name', 'net_protocol_version', 'network_protocol_version', 'otel_scope_name', 'otel_scope_version', 'outcome', 'process_cpu_owner', 'queue', 'rule', 'service_instance_id', 'service_name', 'service_version', 'state', 'url_scheme']
10:32:55 http_route values (templates only): ['/api/v1/attachments/{attachment_id}', '/api/v1/attachments/{attachment_id}/content', '/api/v1/auth/sessions', '/api/v1/auth/sessions/current', '/api/v1/chats', '/api/v1/chats/{chat_id}', '/api/v1/chats/{chat_id}/attachments', '/api/v1/chats/{chat_id}/messages', '/api/v1/users', '/api/v1/users/me']
10:33:07 PASS: required metrics present: http_server_request_duration_seconds_bucket, messenger_jobs_processed_total, messenger_job_duration_seconds_bucket, messenger_attachment_time_to_ready_seconds_bucket, messenger_queue_depth, messenger_queue_oldest_age_seconds, messenger_worker_busy, messenger_worker_capacity, db_client_connection_count, db_client_connection_pending_requests, process_cpu_time_seconds_total, process_memory_usage_bytes, otelcol_receiver_accepted_spans_total, otelcol_exporter_sent_spans_total, otelcol_exporter_queue_size
PASS: observability levels 3-4 (traces/logs/metrics correlation and privacy)
+36
View File
@@ -0,0 +1,36 @@
# 2026-11-11T08:09:52Z scripts/restart.sh
$ docker compose ps (before)
mtusi-lab7-api-1-1 Up 51 minutes (healthy)
mtusi-lab7-api-2-1 Up 51 minutes (healthy)
mtusi-lab7-grafana-1 Up About an hour (healthy)
mtusi-lab7-loki-1 Up About an hour (healthy)
mtusi-lab7-minio-1 Up About an hour (healthy)
mtusi-lab7-nginx-1 Up 43 minutes (healthy)
mtusi-lab7-openbao-1 Up About a minute (healthy)
mtusi-lab7-otel-collector-1 Up 42 minutes
mtusi-lab7-postgres-1 Up About an hour (healthy)
mtusi-lab7-prometheus-1 Up About an hour (healthy)
mtusi-lab7-rabbitmq-1 Up 40 minutes (healthy)
mtusi-lab7-tempo-1 Up About an hour (healthy)
mtusi-lab7-valkey-1 Up About an hour (healthy)
mtusi-lab7-worker-1 Up 50 minutes (healthy)
mtusi-lab7-worker-2 Up 51 seconds (healthy)
$ make test-persistence ACTION_SCRIPT=scripts/restart.sh
Executing explicit persistence hook; hook output suppressed to avoid leaking secrets.
PASS: persistence preserved confirmed data and existing session. Hook scope needs operator evidence.
$ docker compose ps (after)
mtusi-lab7-api-1-1 Up 2 seconds (health: starting)
mtusi-lab7-api-2-1 Up 1 second (health: starting)
mtusi-lab7-grafana-1 Up 4 seconds (health: starting)
mtusi-lab7-loki-1 Up 2 seconds (health: starting)
mtusi-lab7-minio-1 Up 7 seconds (healthy)
mtusi-lab7-nginx-1 Up 2 seconds (health: starting)
mtusi-lab7-openbao-1 Up 7 seconds (healthy)
mtusi-lab7-otel-collector-1 Up 4 seconds
mtusi-lab7-postgres-1 Up 7 seconds (healthy)
mtusi-lab7-prometheus-1 Up 4 seconds (health: starting)
mtusi-lab7-rabbitmq-1 Up 6 seconds (healthy)
mtusi-lab7-tempo-1 Up 4 seconds (health: starting)
mtusi-lab7-valkey-1 Up 7 seconds (healthy)
mtusi-lab7-worker-1 Up 1 second (health: starting)
mtusi-lab7-worker-2 Up 1 second (health: starting)
+8
View File
@@ -0,0 +1,8 @@
11:08:20 before: old password accepted, 2 app_worker connections open
11:08:21 rotated: app_worker password changed in PostgreSQL and OpenBao (messenger/worker, new KV version)
11:08:30 both workers loaded the new KV version and switched the pool (10 s after rotation)
11:08:30 terminated all existing app_worker sessions: the pools must reconnect with the new password
11:08:36 3 uploads after the forced reconnect are ready; 2 app_worker connections open again
11:08:37 probe: old password -> rejected: FATAL: password authentication failed for user "app_worker" | new password -> accepted
11:08:37 traffic: 116 requests, unexpected errors 0, uploads 20; failed jobs since rotation: 0
PASS: app_worker password rotated via OpenBao without rebuild/restart; old password revoked
+2
View File
@@ -0,0 +1,2 @@
python3 tests/smoke.py --base-url "https://localhost:8443" --ca-file "/Users/alenchha/mtusi2026lab7/secrets/pki/ca.crt"
PASS: lab7 public API scenario; infrastructure and grading evidence remain separate.
@@ -0,0 +1,9 @@
# 2026-11-11T08:08:18Z (OpenBao sealed at this moment: running services use the secrets they already hold)
$ make check
PASS: offline skeleton structure, local refs and Python syntax; application NOT tested.
$ make validate
PASS: full OpenAPI 3.1 and JSON Schema validation; application NOT tested.
$ make test CA_FILE=/Users/alenchha/mtusi2026lab7/secrets/pki/ca.crt
PASS: lab7 public API scenario; infrastructure and grading evidence remain separate.
$ make test-security CA_FILE=/Users/alenchha/mtusi2026lab7/secrets/pki/ca.crt
PASS: trusted HTTPS works; untrusted CA rejected. This does NOT verify internal mTLS, OpenBao or hardening.
File diff suppressed because it is too large Load Diff
+124
View File
@@ -0,0 +1,124 @@
PASS A LB -> api-1:8080 no client cert expect=reject rejected: closed without response
PASS A LB -> api-1:8080 foreign CA (claims lb identity) expect=reject rejected: closed without response
PASS A LB -> api-1:8080 same CA, identity intruder expect=reject rejected: closed without response
PASS A LB -> api-1:8080 same CA, identity worker expect=reject rejected: closed without response
PASS A LB -> api-1:8080 same CA, identity api expect=reject rejected: closed without response
PASS A LB -> api-1:8080 lb.client.messenger expect=accept accepted: HTTP/1.1 200 OK
PASS A LB -> api-1:8080 plaintext client expect=reject server answered b''
PASS A LB -> api-2:8080 no client cert expect=reject rejected: closed without response
PASS A LB -> api-2:8080 foreign CA (claims lb identity) expect=reject rejected: closed without response
PASS A LB -> api-2:8080 same CA, identity intruder expect=reject rejected: closed without response
PASS A LB -> api-2:8080 same CA, identity worker expect=reject rejected: closed without response
PASS A LB -> api-2:8080 same CA, identity api expect=reject rejected: closed without response
PASS A LB -> api-2:8080 lb.client.messenger expect=accept accepted: HTTP/1.1 200 OK
PASS A LB -> api-2:8080 plaintext client expect=reject server answered b''
PASS I client -> nginx:8443 trusted CA, hostname nginx expect=accept accepted: HTTP/1.1 200 OK
PASS I client -> nginx:8443 untrusted CA in client trust store expect=reject rejected: server cert verify failed: unable to get local issuer certificate
PASS I client -> nginx:8443 wrong hostname (evil.example) expect=reject rejected: server cert verify failed: Hostname mismatch, certificate is not valid for 'evil.example'.
PASS I client -> nginx:8443 plaintext client expect=reject server answered b'HTTP/1.1 400 Bad Request'
PASS B svc -> postgres:5432 plaintext (sslmode=disable) expect=reject OperationalError: connection failed: connection to server at "172.22.0.10", port 5432 failed: FATAL: pg_hba.c
PASS B svc -> postgres:5432 foreign CA as root (verify-full) expect=reject OperationalError: connection failed: connection to server at "172.22.0.10", port 5432 failed: SSL error: certi
PASS B svc -> postgres:5432 hostname mismatch (IP, verify-full) expect=reject connection failed: connection to server at "172.22.0.10", port 5432 failed: server certificate for "postgres"
PASS B svc -> postgres:5432 TLS verify-full + app_api password expect=accept connected
PASS B svc -> postgres:5432 wrong password expect=reject connection failed: connection to server at "172.22.0.10", port 5432 failed: FATAL: password authentication fa
PASS B app_worker privileges SELECT count(*) FROM users expect=deny InsufficientPrivilege
PASS B app_worker privileges SELECT count(*) FROM messages expect=deny InsufficientPrivilege
PASS B app_worker privileges SELECT count(*) FROM sessions expect=deny InsufficientPrivilege
PASS B app_worker privileges DELETE FROM attachments WHERE false expect=deny InsufficientPrivilege
PASS B app_worker privileges SELECT count(*) FROM attachment_jobs expect=allow executed
PASS B app_api privileges SELECT count(*) FROM users expect=allow executed
PASS B app_api privileges CREATE TABLE audit_probe (x int) expect=deny InsufficientPrivilege
PASS B app_api privileges ALTER ROLE app_worker PASSWORD 'x' expect=deny InsufficientPrivilege
PASS B app_api privileges SELECT count(*) FROM schema_migrations expect=deny InsufficientPrivilege
PASS C svc -> minio:9000 foreign CA as trust anchor expect=reject SSLError
PASS C svc -> minio:9000 plaintext http:// expect=reject ConnectionClosedError
PASS C worker S3 rights PUT attachments/* expect=allow ok
PASS C worker S3 rights GET attachments/* expect=deny AccessDenied
PASS C worker S3 rights DELETE attachments/* expect=deny AccessDenied
PASS C worker S3 rights PUT staging/* expect=deny AccessDenied
PASS C worker S3 rights LIST bucket expect=deny AccessDenied
PASS C worker S3 rights PUT outside prefixes expect=deny AccessDenied
PASS C api S3 rights PUT staging/* expect=allow ok
PASS C api S3 rights PUT attachments/* (only worker publishes) expect=deny AccessDenied
PASS C api S3 rights GET attachments/* expect=allow ok
PASS C api S3 rights LIST bucket (reconciler) expect=allow ok
PASS C api S3 rights create bucket expect=deny AccessDenied
PASS C api S3 rights cleanup audit objects expect=allow ok
PASS D svc -> rabbitmq:5672 plaintext client expect=reject connection failed: ConnectionRefusedError
PASS D svc -> rabbitmq:5671 no client cert expect=reject AMQPConnectionError Server communication error: SSLError(1, '[SSL: TLSV13_ALERT_
PASS D svc -> rabbitmq:5671 foreign CA (claims worker name) expect=reject AMQPConnectionError Server communication error: SSLError(1, '[SSL: TLSV1_ALERT_U
PASS D svc -> rabbitmq:5671 same CA, unknown identity intruder expect=reject ProbableAuthenticationError ACCESS_REFUSED - Login was refused using authentication mech
PASS D svc -> rabbitmq:5671 same CA, identity lb expect=reject ProbableAuthenticationError ACCESS_REFUSED - Login was refused using authentication mech
PASS D api AMQP rights publish to exchange attachments expect=allow ok
PASS D api AMQP rights consume attachments.process expect=deny ChannelAccessRefused ACCESS_REFUSED - read access to queue 'attachments.process' in vhost '
PASS D api AMQP rights declare a queue (configure) expect=deny ChannelAccessRefused ACCESS_REFUSED - configure access to queue 'audit-probe' in vhost 'mes
PASS D api AMQP rights publish via default exchange expect=deny ChannelAccessRefused ACCESS_REFUSED - write access to exchange 'amq.default' in vhost 'mess
PASS D worker AMQP rights consume attachments.process expect=allow ok
PASS D worker AMQP rights publish to exchange attachments expect=deny ChannelAccessRefused ACCESS_REFUSED - write access to exchange 'attachments' in vhost 'mess
PASS D worker AMQP rights declare a queue (configure) expect=deny ChannelAccessRefused ACCESS_REFUSED - configure access to queue 'audit-probe' in vhost 'mes
PASS E svc -> otel-collector:4318 no client cert expect=reject rejected: after handshake: TLSV13_ALERT_CERTIFICATE_REQUIRED
PASS E svc -> otel-collector:4318 foreign CA expect=reject rejected: after handshake: TLSV1_ALERT_UNKNOWN_CA
PASS E svc -> otel-collector:4318 root CA identity lb (not ingest CA) expect=reject rejected: after handshake: TLSV1_ALERT_UNKNOWN_CA
PASS E svc -> otel-collector:4318 root CA identity api (not ingest CA) expect=reject rejected: after handshake: TLSV1_ALERT_UNKNOWN_CA
PASS E svc -> otel-collector:4318 telemetry CA (not ingest CA) expect=reject rejected: after handshake: TLSV1_ALERT_UNKNOWN_CA
PASS E svc -> otel-collector:4318 ingest CA api.otel expect=accept accepted: HTTP/1.1 200 OK
PASS E svc -> otel-collector:4318 ingest CA worker.otel expect=accept accepted: HTTP/1.1 200 OK
PASS F -> prometheus:9090 no client cert expect=reject rejected: after handshake: TLSV13_ALERT_CERTIFICATE_REQUIRED
PASS F -> prometheus:9090 foreign CA expect=reject rejected: after handshake: TLSV1_ALERT_UNKNOWN_CA
PASS F -> prometheus:9090 root CA identity api expect=reject rejected: after handshake: TLSV1_ALERT_UNKNOWN_CA
PASS F -> prometheus:9090 ingest CA (apps cannot bypass collector) expect=reject rejected: after handshake: TLSV1_ALERT_UNKNOWN_CA
PASS F -> prometheus:9090 telemetry CA collector.out expect=accept accepted: HTTP/1.1 200 OK
PASS F -> prometheus:9090 telemetry CA grafana.out expect=accept accepted: HTTP/1.1 200 OK
PASS F -> prometheus:9090 telemetry CA operator expect=accept accepted: HTTP/1.1 200 OK
PASS F -> loki:3100 no client cert expect=reject rejected: after handshake: TLSV13_ALERT_CERTIFICATE_REQUIRED
PASS F -> loki:3100 foreign CA expect=reject rejected: after handshake: TLSV1_ALERT_UNKNOWN_CA
PASS F -> loki:3100 root CA identity api expect=reject rejected: after handshake: TLSV1_ALERT_UNKNOWN_CA
PASS F -> loki:3100 ingest CA (apps cannot bypass collector) expect=reject rejected: after handshake: TLSV1_ALERT_UNKNOWN_CA
PASS F -> loki:3100 telemetry CA collector.out expect=accept accepted: HTTP/1.1 200 OK
PASS F -> loki:3100 telemetry CA grafana.out expect=accept accepted: HTTP/1.1 200 OK
PASS F -> loki:3100 telemetry CA operator expect=accept accepted: HTTP/1.1 200 OK
PASS F -> tempo:3200 no client cert expect=reject rejected: after handshake: TLSV13_ALERT_CERTIFICATE_REQUIRED
PASS F -> tempo:3200 foreign CA expect=reject rejected: after handshake: TLSV1_ALERT_UNKNOWN_CA
PASS F -> tempo:3200 root CA identity api expect=reject rejected: after handshake: TLSV1_ALERT_UNKNOWN_CA
PASS F -> tempo:3200 ingest CA (apps cannot bypass collector) expect=reject rejected: after handshake: TLSV1_ALERT_UNKNOWN_CA
PASS F -> tempo:3200 telemetry CA collector.out expect=accept accepted: HTTP/1.1 200 OK
PASS F -> tempo:3200 telemetry CA grafana.out expect=accept accepted: HTTP/1.1 200 OK
PASS F -> tempo:3200 telemetry CA operator expect=accept accepted: HTTP/1.1 200 OK
PASS F collector -> tempo:4317 (gRPC) no client cert expect=reject rejected: after handshake: TLSV13_ALERT_CERTIFICATE_REQUIRED
PASS F collector -> tempo:4317 (gRPC) ingest CA expect=reject rejected: after handshake: TLSV1_ALERT_UNKNOWN_CA
PASS F collector -> tempo:4317 (gRPC) telemetry CA collector.out expect=accept accepted: @
PASS G api -> valkey:6379 plaintext client expect=reject connection failed: ConnectionResetError
PASS G api -> valkey:6379 foreign CA as trust anchor expect=deny ConnectionError Error 1 connecting to valkey:6379. [SSL: CERTIFICATE_VERIFY_
PASS G api -> valkey:6379 no authentication (default user off) expect=deny AuthenticationError Authentication required.
PASS G api -> valkey:6379 user api, wrong password expect=deny AuthenticationError invalid username-password pair or user is disabled.
PASS G api -> valkey:6379 api: SET/GET session:* expect=allow ok
PASS G api -> valkey:6379 api: INCR ratelimit:* expect=allow ok
PASS G api -> valkey:6379 api: GET outside allowed keys expect=deny NoPermissionError No permissions to access a key
PASS G api -> valkey:6379 api: FLUSHALL expect=deny NoPermissionError User api has no permissions to run the 'flushall' command
PASS G api -> valkey:6379 api: CONFIG GET expect=deny NoPermissionError User api has no permissions to run the 'config|get' command
PASS G api -> valkey:6379 api: KEYS * expect=deny NoPermissionError User api has no permissions to run the 'keys' command
PASS G api -> valkey:6379 health: GET session:* expect=deny NoPermissionError User health has no permissions to run the 'get' command
PASS H svc -> openbao:8200 cert login: no client cert expect=reject HTTP 400 token=False
PASS H svc -> openbao:8200 cert login: same CA, identity intruder expect=reject HTTP 400 token=False
PASS H svc -> openbao:8200 cert login: worker cert, role api expect=reject HTTP 400 token=False
PASS H svc -> openbao:8200 cert login: api cert, role worker expect=reject HTTP 400 token=False
PASS H svc -> openbao:8200 cert login: lb cert, role api expect=reject HTTP 400 token=False
PASS H svc -> openbao:8200 cert login: foreign CA (claims worker name) expect=reject HTTP 400 token=False
PASS H svc -> openbao:8200 cert login: worker cert, role worker expect=accept HTTP 200 token=True
PASS H worker token policies / ttl expect=scoped policies=['default', 'messenger-worker'] ttl=900s
PASS H worker token read own messenger/worker expect=allow HTTP 200
PASS H worker token read messenger/api expect=deny HTTP 403
PASS H worker token write own secret expect=deny HTTP 403
PASS H worker token write own policy expect=deny HTTP 403
PASS H worker token list auth methods (admin) expect=deny HTTP 403
PASS H svc -> openbao:8200 cert login: api cert, role api expect=accept HTTP 200 token=True
PASS H api token policies / ttl expect=scoped policies=['default', 'messenger-api'] ttl=900s
PASS H api token read own messenger/api expect=allow HTTP 200
PASS H api token read messenger/worker expect=deny HTTP 403
PASS H api token write own secret expect=deny HTTP 403
PASS H api token write own policy expect=deny HTTP 403
PASS H api token list auth methods (admin) expect=deny HTTP 403
PASS J operator -> grafana:3000 HTTPS without login expect=reject accepted: HTTP/1.1 401 Unauthorized
PASS J operator -> grafana:3000 plaintext client expect=reject server answered b'HTTP/1.0 400 Bad Request'
122 checks, 0 failed
+139
View File
@@ -0,0 +1,139 @@
Container mtusi-lab7-worker-run-dcda01946f3d Creating
Container mtusi-lab7-worker-run-dcda01946f3d Created
PASS A LB -> api-1:8080 no client cert expect=reject rejected: closed without response
PASS A LB -> api-1:8080 foreign CA (claims lb identity) expect=reject rejected: closed without response
PASS A LB -> api-1:8080 same CA, identity intruder expect=reject rejected: closed without response
PASS A LB -> api-1:8080 same CA, identity worker expect=reject rejected: closed without response
PASS A LB -> api-1:8080 same CA, identity api expect=reject rejected: closed without response
PASS A LB -> api-1:8080 lb.client.messenger expect=accept accepted: HTTP/1.1 200 OK
PASS A LB -> api-1:8080 plaintext client expect=reject server answered b''
PASS A LB -> api-2:8080 no client cert expect=reject rejected: closed without response
PASS A LB -> api-2:8080 foreign CA (claims lb identity) expect=reject rejected: closed without response
PASS A LB -> api-2:8080 same CA, identity intruder expect=reject rejected: closed without response
PASS A LB -> api-2:8080 same CA, identity worker expect=reject rejected: closed without response
PASS A LB -> api-2:8080 same CA, identity api expect=reject rejected: closed without response
PASS A LB -> api-2:8080 lb.client.messenger expect=accept accepted: HTTP/1.1 200 OK
PASS A LB -> api-2:8080 plaintext client expect=reject server answered b''
PASS I client -> nginx:8443 trusted CA, hostname nginx expect=accept accepted: HTTP/1.1 200 OK
PASS I client -> nginx:8443 untrusted CA in client trust store expect=reject rejected: server cert verify failed: unable to get local issuer certificate
PASS I client -> nginx:8443 wrong hostname (evil.example) expect=reject rejected: server cert verify failed: Hostname mismatch, certificate is not valid for 'evil.example'.
PASS I client -> nginx:8443 plaintext client expect=reject server answered b'HTTP/1.1 400 Bad Request'
PASS B svc -> postgres:5432 plaintext (sslmode=disable) expect=reject OperationalError: connection failed: connection to server at "172.22.0.9", port 5432 failed: FATAL: pg_hba.co
PASS B svc -> postgres:5432 foreign CA as root (verify-full) expect=reject OperationalError: connection failed: connection to server at "172.22.0.9", port 5432 failed: SSL error: certif
PASS B svc -> postgres:5432 hostname mismatch (IP, verify-full) expect=reject connection failed: connection to server at "172.22.0.9", port 5432 failed: server certificate for "postgres" (
PASS B svc -> postgres:5432 TLS verify-full + app_api password expect=accept connected
PASS B svc -> postgres:5432 wrong password expect=reject connection failed: connection to server at "172.22.0.9", port 5432 failed: FATAL: password authentication fai
PASS B app_worker privileges SELECT count(*) FROM users expect=deny InsufficientPrivilege
PASS B app_worker privileges SELECT count(*) FROM messages expect=deny InsufficientPrivilege
PASS B app_worker privileges SELECT count(*) FROM sessions expect=deny InsufficientPrivilege
PASS B app_worker privileges DELETE FROM attachments WHERE false expect=deny InsufficientPrivilege
PASS B app_worker privileges SELECT count(*) FROM attachment_jobs expect=allow executed
PASS B app_api privileges SELECT count(*) FROM users expect=allow executed
PASS B app_api privileges CREATE TABLE audit_probe (x int) expect=deny InsufficientPrivilege
PASS B app_api privileges ALTER ROLE app_worker PASSWORD 'x' expect=deny InsufficientPrivilege
PASS B app_api privileges SELECT count(*) FROM schema_migrations expect=deny InsufficientPrivilege
PASS C svc -> minio:9000 foreign CA as trust anchor expect=reject SSLError
PASS C svc -> minio:9000 plaintext http:// expect=reject ConnectionClosedError
PASS C worker S3 rights PUT attachments/* expect=allow ok
PASS C worker S3 rights GET attachments/* expect=deny AccessDenied
PASS C worker S3 rights DELETE attachments/* expect=deny AccessDenied
PASS C worker S3 rights PUT staging/* expect=deny AccessDenied
PASS C worker S3 rights LIST bucket expect=deny AccessDenied
PASS C worker S3 rights PUT outside prefixes expect=deny AccessDenied
PASS C api S3 rights PUT staging/* expect=allow ok
PASS C api S3 rights PUT attachments/* (only worker publishes) expect=deny AccessDenied
PASS C api S3 rights GET attachments/* expect=allow ok
PASS C api S3 rights LIST bucket (reconciler) expect=allow ok
PASS C api S3 rights create bucket expect=deny AccessDenied
PASS C api S3 rights cleanup audit objects expect=allow ok
PASS D svc -> rabbitmq:5672 plaintext client expect=reject connection failed: ConnectionRefusedError
PASS D svc -> rabbitmq:5671 no client cert expect=reject AMQPConnectionError Server communication error: SSLError(1, '[SSL: TLSV13_ALERT_
PASS D svc -> rabbitmq:5671 foreign CA (claims worker name) expect=reject AMQPConnectionError Server communication error: SSLError(1, '[SSL: TLSV1_ALERT_U
PASS D svc -> rabbitmq:5671 same CA, unknown identity intruder expect=reject ProbableAuthenticationError ACCESS_REFUSED - Login was refused using authentication mech
PASS D svc -> rabbitmq:5671 same CA, identity lb expect=reject ProbableAuthenticationError ACCESS_REFUSED - Login was refused using authentication mech
PASS D api AMQP rights publish to exchange attachments expect=allow ok
PASS D api AMQP rights consume attachments.process expect=deny ChannelAccessRefused ACCESS_REFUSED - read access to queue 'attachments.process' in vhost '
PASS D api AMQP rights declare a queue (configure) expect=deny ChannelAccessRefused ACCESS_REFUSED - configure access to queue 'audit-probe' in vhost 'mes
PASS D api AMQP rights publish via default exchange expect=deny ChannelAccessRefused ACCESS_REFUSED - write access to exchange 'amq.default' in vhost 'mess
PASS D worker AMQP rights consume attachments.process expect=allow ok
PASS D worker AMQP rights publish to exchange attachments expect=deny ChannelAccessRefused ACCESS_REFUSED - write access to exchange 'attachments' in vhost 'mess
PASS D worker AMQP rights declare a queue (configure) expect=deny ChannelAccessRefused ACCESS_REFUSED - configure access to queue 'audit-probe' in vhost 'mes
PASS E svc -> otel-collector:4318 no client cert expect=reject rejected: after handshake: TLSV13_ALERT_CERTIFICATE_REQUIRED
PASS E svc -> otel-collector:4318 foreign CA expect=reject rejected: after handshake: TLSV1_ALERT_UNKNOWN_CA
PASS E svc -> otel-collector:4318 root CA identity lb (not ingest CA) expect=reject rejected: after handshake: TLSV1_ALERT_UNKNOWN_CA
PASS E svc -> otel-collector:4318 root CA identity api (not ingest CA) expect=reject rejected: after handshake: TLSV1_ALERT_UNKNOWN_CA
PASS E svc -> otel-collector:4318 telemetry CA (not ingest CA) expect=reject rejected: after handshake: TLSV1_ALERT_UNKNOWN_CA
PASS E svc -> otel-collector:4318 ingest CA api.otel expect=accept accepted: HTTP/1.1 200 OK
PASS E svc -> otel-collector:4318 ingest CA worker.otel expect=accept accepted: HTTP/1.1 200 OK
PASS F -> prometheus:9090 no client cert expect=reject rejected: after handshake: TLSV13_ALERT_CERTIFICATE_REQUIRED
PASS F -> prometheus:9090 foreign CA expect=reject rejected: after handshake: TLSV1_ALERT_UNKNOWN_CA
PASS F -> prometheus:9090 root CA identity api expect=reject rejected: after handshake: TLSV1_ALERT_UNKNOWN_CA
PASS F -> prometheus:9090 ingest CA (apps cannot bypass collector) expect=reject rejected: after handshake: TLSV1_ALERT_UNKNOWN_CA
PASS F -> prometheus:9090 telemetry CA collector.out expect=accept accepted: HTTP/1.1 200 OK
PASS F -> prometheus:9090 telemetry CA grafana.out expect=accept accepted: HTTP/1.1 200 OK
PASS F -> prometheus:9090 telemetry CA operator expect=accept accepted: HTTP/1.1 200 OK
PASS F -> loki:3100 no client cert expect=reject rejected: after handshake: TLSV13_ALERT_CERTIFICATE_REQUIRED
PASS F -> loki:3100 foreign CA expect=reject rejected: after handshake: TLSV1_ALERT_UNKNOWN_CA
PASS F -> loki:3100 root CA identity api expect=reject rejected: after handshake: TLSV1_ALERT_UNKNOWN_CA
PASS F -> loki:3100 ingest CA (apps cannot bypass collector) expect=reject rejected: after handshake: TLSV1_ALERT_UNKNOWN_CA
PASS F -> loki:3100 telemetry CA collector.out expect=accept accepted: HTTP/1.1 503 Service Unavailable
PASS F -> loki:3100 telemetry CA grafana.out expect=accept accepted: HTTP/1.1 503 Service Unavailable
PASS F -> loki:3100 telemetry CA operator expect=accept accepted: HTTP/1.1 503 Service Unavailable
PASS F -> tempo:3200 no client cert expect=reject rejected: after handshake: TLSV13_ALERT_CERTIFICATE_REQUIRED
PASS F -> tempo:3200 foreign CA expect=reject rejected: after handshake: TLSV1_ALERT_UNKNOWN_CA
PASS F -> tempo:3200 root CA identity api expect=reject rejected: after handshake: TLSV1_ALERT_UNKNOWN_CA
PASS F -> tempo:3200 ingest CA (apps cannot bypass collector) expect=reject rejected: after handshake: TLSV1_ALERT_UNKNOWN_CA
PASS F -> tempo:3200 telemetry CA collector.out expect=accept accepted: HTTP/1.1 503 Service Unavailable
PASS F -> tempo:3200 telemetry CA grafana.out expect=accept accepted: HTTP/1.1 503 Service Unavailable
PASS F -> tempo:3200 telemetry CA operator expect=accept accepted: HTTP/1.1 503 Service Unavailable
PASS F collector -> tempo:4317 (gRPC) no client cert expect=reject rejected: after handshake: TLSV13_ALERT_CERTIFICATE_REQUIRED
PASS F collector -> tempo:4317 (gRPC) ingest CA expect=reject rejected: after handshake: TLSV1_ALERT_UNKNOWN_CA
PASS F collector -> tempo:4317 (gRPC) telemetry CA collector.out expect=accept accepted: @
PASS G api -> valkey:6379 plaintext client expect=reject connection failed: ConnectionResetError
PASS G api -> valkey:6379 foreign CA as trust anchor expect=deny ConnectionError Error 1 connecting to valkey:6379. [SSL: CERTIFICATE_VERIFY_
PASS G api -> valkey:6379 no authentication (default user off) expect=deny AuthenticationError Authentication required.
PASS G api -> valkey:6379 user api, wrong password expect=deny AuthenticationError invalid username-password pair or user is disabled.
PASS G api -> valkey:6379 api: SET/GET session:* expect=allow ok
PASS G api -> valkey:6379 api: INCR ratelimit:* expect=allow ok
PASS G api -> valkey:6379 api: GET outside allowed keys expect=deny NoPermissionError No permissions to access a key
PASS G api -> valkey:6379 api: FLUSHALL expect=deny NoPermissionError User api has no permissions to run the 'flushall' command
PASS G api -> valkey:6379 api: CONFIG GET expect=deny NoPermissionError User api has no permissions to run the 'config|get' command
PASS G api -> valkey:6379 api: KEYS * expect=deny NoPermissionError User api has no permissions to run the 'keys' command
PASS G api -> valkey:6379 health: GET session:* expect=deny NoPermissionError User health has no permissions to run the 'get' command
PASS H svc -> openbao:8200 cert login: no client cert expect=reject HTTP 400 token=False
PASS H svc -> openbao:8200 cert login: same CA, identity intruder expect=reject HTTP 400 token=False
PASS H svc -> openbao:8200 cert login: worker cert, role api expect=reject HTTP 400 token=False
PASS H svc -> openbao:8200 cert login: api cert, role worker expect=reject HTTP 400 token=False
PASS H svc -> openbao:8200 cert login: lb cert, role api expect=reject HTTP 400 token=False
PASS H svc -> openbao:8200 cert login: foreign CA (claims worker name) expect=reject HTTP 400 token=False
PASS H svc -> openbao:8200 cert login: worker cert, role worker expect=accept HTTP 200 token=True
PASS H worker token policies / ttl expect=scoped policies=['default', 'messenger-worker'] ttl=900s
PASS H worker token read own messenger/worker expect=allow HTTP 200
PASS H worker token read messenger/api expect=deny HTTP 403
PASS H worker token write own secret expect=deny HTTP 403
PASS H worker token write own policy expect=deny HTTP 403
PASS H worker token list auth methods (admin) expect=deny HTTP 403
PASS H svc -> openbao:8200 cert login: api cert, role api expect=accept HTTP 200 token=True
PASS H api token policies / ttl expect=scoped policies=['default', 'messenger-api'] ttl=900s
PASS H api token read own messenger/api expect=allow HTTP 200
PASS H api token read messenger/worker expect=deny HTTP 403
PASS H api token write own secret expect=deny HTTP 403
PASS H api token write own policy expect=deny HTTP 403
PASS H api token list auth methods (admin) expect=deny HTTP 403
PASS J operator -> grafana:3000 HTTPS without login expect=reject accepted: HTTP/1.1 401 Unauthorized
PASS J operator -> grafana:3000 plaintext client expect=reject server answered b'HTTP/1.0 400 Bad Request'
PASS K rabbitmq:25672 Erlang distribution expect=closed ConnectionRefusedError
PASS K rabbitmq:4369 epmd expect=closed ConnectionRefusedError
PASS K rabbitmq:15672 management UI expect=closed ConnectionRefusedError
PASS K loki:9096 Loki internal gRPC expect=closed ConnectionRefusedError
PASS K tempo:9095 Tempo internal gRPC expect=closed ConnectionRefusedError
PASS K otel-collector:8888 collector self-metrics expect=closed ConnectionRefusedError
PASS K otel-collector:13133 collector health expect=closed ConnectionRefusedError
PASS K otel-collector:4317 collector OTLP/gRPC (disabled) expect=closed ConnectionRefusedError
PASS K api-1:8081 API loopback health expect=closed ConnectionRefusedError
PASS K api-2:8081 API loopback health expect=closed ConnectionRefusedError
PASS K openbao:8201 OpenBao cluster port expect=closed ConnectionRefusedError
PASS K minio:9001 MinIO console expect=closed ConnectionRefusedError
PASS K postgres:5433 no second PostgreSQL listener expect=closed ConnectionRefusedError
135 checks, 0 failed
+15
View File
@@ -0,0 +1,15 @@
PASS K rabbitmq:25672 Erlang distribution expect=closed ConnectionRefusedError
PASS K rabbitmq:4369 epmd expect=closed ConnectionRefusedError
PASS K rabbitmq:15672 management UI expect=closed ConnectionRefusedError
PASS K loki:9096 Loki internal gRPC expect=closed ConnectionRefusedError
PASS K tempo:9095 Tempo internal gRPC expect=closed ConnectionRefusedError
PASS K otel-collector:8888 collector self-metrics expect=closed ConnectionRefusedError
PASS K otel-collector:13133 collector health expect=closed ConnectionRefusedError
PASS K otel-collector:4317 collector OTLP/gRPC (disabled) expect=closed ConnectionRefusedError
PASS K api-1:8081 API loopback health expect=closed ConnectionRefusedError
PASS K api-2:8081 API loopback health expect=closed ConnectionRefusedError
PASS K openbao:8201 OpenBao cluster port expect=closed ConnectionRefusedError
PASS K minio:9001 MinIO console expect=closed ConnectionRefusedError
PASS K postgres:5433 no second PostgreSQL listener expect=closed ConnectionRefusedError
13 checks, 0 failed
+20
View File
@@ -0,0 +1,20 @@
ok 320x200 -> thumbnail 256x160
ok crop 128x128
ok optimized WebP 320x200, no upscale
ok thumbnail/crop are JPEG
ok 40x10: thumbnail 40x10, crop 128x128
ok 3000x2 -> 256x1 / 1280x1 (min 1px)
ok 1001x999 -> 256x255 (floor)
ok EXIF orientation applied: 400x200 (o=6) -> 128x256
ok rotated content: red half on top after orientation 6
ok EXIF removed from thumbnail/optimized
ok transparent PNG -> white JPEG thumbnail
ok WebP optimized keeps alpha
ok 16-bit PNG, CMYK JPEG, palette+transparency PNG are processed
ok pixel limit enforced before decode -> image_too_large (exit 4)
ok corrupted PNG -> invalid_image (exit 3)
ok 36 Mpx PNG with 160 MiB address-space limit -> image_too_complex (exit 5), got 5
ok 39.5 Mpx PNG (31 MB file) ok in 1.0s, peak child RSS 320 MiB
ok CPU limit exhausted -> SIGXCPU (worker: permanent image_too_complex), got -24
ok 39.5 Mpx JPEG (7 MB file) ok in 0.3s, peak child RSS 337 MiB
RESULT: PASS