From 6d1ed1563b31ebc102bb826fc9b751dfeb6ccfc6 Mon Sep 17 00:00:00 2001 From: CharaWein Date: Thu, 12 Nov 2026 20:29:49 +0300 Subject: [PATCH] =?UTF-8?q?lab7:=20=D0=BE=D1=82=D1=87=D1=91=D1=82,=20?= =?UTF-8?q?=D1=80=D0=B0=D0=B7=D0=B1=D0=BE=D1=80=20=D1=81=D0=BA=D0=B0=D0=BD?= =?UTF-8?q?=D0=B8=D1=80=D0=BE=D0=B2=D0=B0=D0=BD=D0=B8=D1=8F,=20=D0=B4?= =?UTF-8?q?=D0=BE=D0=BA=D0=B0=D0=B7=D0=B0=D1=82=D0=B5=D0=BB=D1=8C=D1=81?= =?UTF-8?q?=D1=82=D0=B2=D0=B0=20=D0=BF=D1=80=D0=BE=D0=B3=D0=BE=D0=BD=D0=B0?= =?UTF-8?q?=2043267046991?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Makefile | 5 +- REPORT.md | 189 +++- evidence/RUN.txt | 5 + evidence/base/README.md | 5 + evidence/base/containers_state_base.txt | 17 + evidence/base/docker_ps.txt | 19 + evidence/base/docker_ps_final_base.txt | 18 + evidence/base/docker_stats_base.txt | 16 + evidence/base/failover_1.txt | 8 + evidence/base/failover_2.txt | 8 + evidence/base/idempotency_concurrent.json | 88 ++ evidence/base/images.txt | 13 + evidence/base/instances.txt | 2 + evidence/base/persistence.txt | 36 + evidence/base/regressions.txt | 3 + evidence/base/rolling_update.txt | 92 ++ evidence/base/rolling_update_load.json | 17 + evidence/base/runner_base.txt | 6 + evidence/base/smoke.txt | 1 + evidence/base/test_security.txt | 1 + evidence/go/README.md | 5 + evidence/go/go_test.txt | 24 + evidence/go/security_unit_tests.txt | 16 + evidence/go/telemetry_tests.txt | 18 + .../go/track2/pipeline_fault_injection.txt | 39 + evidence/go/webp_test.txt | 4 + evidence/pipeline/README.md | 5 + .../pipeline/containers_state_pipeline.txt | 17 + .../pipeline/docker_ps_final_pipeline.txt | 18 + evidence/pipeline/docker_stats_pipeline.txt | 16 + evidence/pipeline/pipeline/crash-effect.json | 34 + evidence/pipeline/pipeline/demo.json | 42 + evidence/pipeline/pipeline/failed-replay.json | 36 + evidence/pipeline/pipeline/obs_signals.json | 925 ++++++++++++++++++ evidence/pipeline/pipeline/transient.json | 17 + evidence/pipeline/runner_pipeline.txt | 6 + evidence/scan/README.md | 5 + evidence/scan/TRIAGE.md | 33 + evidence/scan/govulncheck.txt | 9 + evidence/scan/trivy_summary.txt | 6 + evidence/security/README.md | 5 + .../security/containers_state_security.txt | 17 + .../security/docker_ps_final_security.txt | 18 + evidence/security/docker_stats_security.txt | 16 + evidence/security/runner_security.txt | 6 + evidence/security/security/acl.json | 39 + evidence/security/security/argon2.json | 89 ++ evidence/security/security/hardening.json | 313 ++++++ evidence/security/security/leaks.json | 18 + evidence/security/security/lifecycle.json | 32 + evidence/security/security/mtls.json | 149 +++ evidence/security/security/openbao.json | 110 +++ evidence/security/security/rotation.json | 36 + evidence/security/security/tls-external.json | 18 + evidence/track1/README.md | 5 + evidence/track1/containers_state_track1.txt | 17 + evidence/track1/docker_ps_final_track1.txt | 18 + evidence/track1/docker_stats_track1.txt | 16 + evidence/track1/runner_track1.txt | 6 + evidence/track1/track1/compromise.json | 299 ++++++ 60 files changed, 3036 insertions(+), 15 deletions(-) create mode 100644 evidence/RUN.txt create mode 100644 evidence/base/README.md create mode 100644 evidence/base/containers_state_base.txt create mode 100644 evidence/base/docker_ps.txt create mode 100644 evidence/base/docker_ps_final_base.txt create mode 100644 evidence/base/docker_stats_base.txt create mode 100644 evidence/base/failover_1.txt create mode 100644 evidence/base/failover_2.txt create mode 100644 evidence/base/idempotency_concurrent.json create mode 100644 evidence/base/images.txt create mode 100644 evidence/base/instances.txt create mode 100644 evidence/base/persistence.txt create mode 100644 evidence/base/regressions.txt create mode 100644 evidence/base/rolling_update.txt create mode 100644 evidence/base/rolling_update_load.json create mode 100644 evidence/base/runner_base.txt create mode 100644 evidence/base/smoke.txt create mode 100644 evidence/base/test_security.txt create mode 100644 evidence/go/README.md create mode 100644 evidence/go/go_test.txt create mode 100644 evidence/go/security_unit_tests.txt create mode 100644 evidence/go/telemetry_tests.txt create mode 100644 evidence/go/track2/pipeline_fault_injection.txt create mode 100644 evidence/go/webp_test.txt create mode 100644 evidence/pipeline/README.md create mode 100644 evidence/pipeline/containers_state_pipeline.txt create mode 100644 evidence/pipeline/docker_ps_final_pipeline.txt create mode 100644 evidence/pipeline/docker_stats_pipeline.txt create mode 100644 evidence/pipeline/pipeline/crash-effect.json create mode 100644 evidence/pipeline/pipeline/demo.json create mode 100644 evidence/pipeline/pipeline/failed-replay.json create mode 100644 evidence/pipeline/pipeline/obs_signals.json create mode 100644 evidence/pipeline/pipeline/transient.json create mode 100644 evidence/pipeline/runner_pipeline.txt create mode 100644 evidence/scan/README.md create mode 100644 evidence/scan/TRIAGE.md create mode 100644 evidence/scan/govulncheck.txt create mode 100644 evidence/scan/trivy_summary.txt create mode 100644 evidence/security/README.md create mode 100644 evidence/security/containers_state_security.txt create mode 100644 evidence/security/docker_ps_final_security.txt create mode 100644 evidence/security/docker_stats_security.txt create mode 100644 evidence/security/runner_security.txt create mode 100644 evidence/security/security/acl.json create mode 100644 evidence/security/security/argon2.json create mode 100644 evidence/security/security/hardening.json create mode 100644 evidence/security/security/leaks.json create mode 100644 evidence/security/security/lifecycle.json create mode 100644 evidence/security/security/mtls.json create mode 100644 evidence/security/security/openbao.json create mode 100644 evidence/security/security/rotation.json create mode 100644 evidence/security/security/tls-external.json create mode 100644 evidence/track1/README.md create mode 100644 evidence/track1/containers_state_track1.txt create mode 100644 evidence/track1/docker_ps_final_track1.txt create mode 100644 evidence/track1/docker_stats_track1.txt create mode 100644 evidence/track1/runner_track1.txt create mode 100644 evidence/track1/track1/compromise.json diff --git a/Makefile b/Makefile index af3f116..d6d19ba 100644 --- a/Makefile +++ b/Makefile @@ -32,7 +32,10 @@ test-failover: # --- Студенческие цели (lab5) --- up: sh scripts/init-secrets.sh - docker compose --env-file .env up -d --build --wait + sh scripts/pki.sh init + docker compose --env-file .env build + docker compose --profile test build probe + $(PYTHON) scripts/bootstrap.py all down: docker compose --env-file .env stop diff --git a/REPORT.md b/REPORT.md index 9801db4..614cdfb 100644 --- a/REPORT.md +++ b/REPORT.md @@ -1,37 +1,198 @@ # Отчёт — лабораторная 7 -- Автор, группа: TODO -- Целевая оценка; выбранный трек 5, если нужен: TODO -- Commit/PR: TODO после публикации -- Использованные источники, библиотеки и помощь ИИ: TODO +- Автор, группа: Вейнмайер Андрей Андреевич, БВТ2303 +- Целевая оценка: **5** — уровни 3 и 4 полностью + **трек 1 «Компрометация worker»** +- Commit/PR: ветка `solution/bvt2303-weinmaier` в `Weinmaier_Andrew/mtusi2026lab7`; доказательства — прогон + https://github.com/CharaWein/2026_lab3/actions/runs/43267046991 (commit `a414221`, все части `success`), файлы в `evidence/` +- Источники: README и материалы курса (OWASP Password Storage, OWASP File Upload, документация OpenBao: cert auth, + policies, production hardening; Docker security), документация RabbitMQ (TLS, access control), PostgreSQL (`pg_hba`, + `sslmode`), MinIO (policies), Redis (ACL, TLS). Библиотеки: pgx v5, go-redis v9, minio-go v7, amqp091-go, + golang.org/x/crypto/argon2, OpenTelemetry Go SDK. +- Помощь ИИ: ИИ-ассистент использовался при реализации и отладке; все результаты ниже — реальные прогоны, ссылки на них приведены. ## Запуск из чистого clone -TODO: версии runtime/образов, prerequisites, команды создания локальных secrets/.env, build, миграций, запуска, ожидания готовности, тестов и остановки. Указать необходимые действия оператора. Не вставлять секреты. Отдельно указать безопасную остановку и команду намеренного удаления учебных данных. +Версии: Docker 28 / Compose v2.38 (так в прогоне), Go 1.26.11 (только для `go test`), Python 3.9+, `openssl` в PATH. +Образы закреплены по версиям в `compose.yaml` (postgres 16.4, redis 7.4.1, MinIO 2025-04-22, RabbitMQ 4.0.9, +HAProxy 3.0.5, OpenBao 2.1.0, OTel Collector 0.116.1, Prometheus 3.1.0, Loki 3.3.2, Tempo 2.6.1, Grafana 11.4.0). + +```sh +sh scripts/init-secrets.sh # пароли и ключи оператора в secrets/ (вне Git, 600), значения не печатаются +sh scripts/pki.sh init # CA стенда, CA телеметрии, leaf-сертификаты сервисов (ECDSA P-256) +docker compose build && docker compose --profile test build probe +python3 scripts/bootstrap.py all # OpenBao: init (3 доли, порог 2) + unseal + политики + cert-роли + KV; + # роли БД, пользователи MinIO/RabbitMQ, ACL Redis; миграции; запуск стенда +make test BASE_URL=https://localhost:8443 CA_FILE=secrets/pki/ca.crt +``` + +`make up` выполняет те же шаги. Действия оператора: +- после любого рестарта OpenBao он запечатан — `python3 scripts/bootstrap.py unseal` (берёт 2 доли из + `secrets/operator/bao-init.json`; в эксплуатации доли хранятся у разных людей); +- `scripts/restart.sh` — перезапуск всех процессов и хранилищ с unseal; +- ротации: `bootstrap.py rotate-db|rotate-s3 `, `scripts/pki.sh rotate <имя> [CN]`, `bootstrap.py worker-identity gN`, + `bootstrap.py revoke-tokens `. + +Остановка без потери данных: `docker compose stop` (volumes сохраняются). Намеренное удаление учебных данных: +`docker compose down -v` и удаление каталога `secrets/` (CA, доли unseal, пароли) — после этого стенд создаётся заново. + +Все проверки этой работы: `sh scripts/collect-evidence.sh all` (части `base`, `security`, `pipeline`, `track1`). ## Архитектура и решения -TODO: схема процессов/хранилищ, источник истины, транзакционные границы, ограничения. Что перенесено из lab6, что изменено в этой работе. Соответствие переменных из .env.example реальной конфигурации. +``` +клиент ──HTTPS 8443 (127.0.0.1)──► HAProxy lb ──mTLS (identity lb)──► api ×2 ──TLS──► PostgreSQL / Redis / MinIO + │ ▲ + outbox (PostgreSQL) ─► relay ──AMQPS+mTLS──► RabbitMQ ──► worker + все сервисы ──cert auth (тот же сертификат)──► OpenBao (секреты своего пути KV) (CN relay-g1 / worker-g1) + api/worker/relay ──OTLP/HTTPS + mTLS (CA телеметрии)──► Collector ──mTLS──► Tempo / Loki ◄─HTTPS+mTLS── Grafana, Prometheus +``` + +Сети: `front` (lb), `back` (приложения и хранилища), `telemetry`. Наружу опубликованы только `127.0.0.1:8443` (TLS ingress), +`127.0.0.1:3000` (Grafana, HTTPS) и `127.0.0.1:8200` (OpenBao для оператора). + +Что перенесено из lab6 без изменения смысла: контракт API, outbox → RabbitMQ → worker, идемпотентность, пайплайн вложений, +наблюдаемость (трассы сквозь очередь, SLO, дашборд). Что изменено: + +- **PKI** (`scripts/pki.sh`): корневой CA стенда, отдельный CA клиентов телеметрии, leaf на 30 дней с identity + `CN=<роль>` + `URI:spiffe://messenger/<роль>`; ключи CA только у оператора. +- **mTLS LB→API** — двойная проверка: HAProxy проверяет сервер (`verifyhost api`), API требует клиентский сертификат, + проверяет цепочку **и** allowlist identity (`spiffe://messenger/lb`) и список отозванных serial + (`internal/tlsutil`). Сертификаты перечитываются при изменении файла — ротация без рестарта. +- **TLS ко всем хранилищам**: PostgreSQL `sslmode=verify-full` + `pg_hba` только `hostssl … scram-sha-256`; + Redis только TLS-порт (`port 0`), ACL с отдельным пользователем; MinIO по HTTPS; RabbitMQ только AMQPS 5671 + с обязательным клиентским сертификатом и SASL EXTERNAL (пользователь = CN, паролей нет); Collector и бэкенды + телеметрии — mTLS. Полная таблица связей — `contracts/trust-matrix.md`. +- **OpenBao** не в dev-mode: file storage на volume, TLS, Shamir 3/2, audit log. Сервис входит своим клиентским + сертификатом (auth/cert, роль = сервис), policy даёт `read` только на `secret/data/messenger/<сервис>`, токен + 15 мин / максимум 1 ч. Секреты обновляются каждые 30 s, при отказе OpenBao процесс работает на кэше. +- **Least privilege**: роли БД `app_api`, `app_worker`, `app_relay`, `app_reconciler` + (`migrations/0007_service_roles.up.sql`), пользователи MinIO с правами на префиксы, раздельные пользователи RabbitMQ; + топологию очередей создаёт оператор (`infra/rabbitmq/definitions.json`), у приложений нет права configure. +- **Пароли**: Argon2id m=19 MiB, t=2, p=1 (минимум OWASP), rehash старых hash при входе, не более 2 одновременных + вычислений на реплику; лимит входа в Redis (общий для реплик); сессионный токен хранится как SHA-256; тело JSON ≤ 64 KiB. +- **Hardening** контейнеров: non-root, `cap_drop: ALL`, `no-new-privileges`, `read_only` + tmpfs, лимиты CPU/RAM/pids, + без docker.sock и host network. + +Переменные из `.env.example` (`BAO_ADDR`, `BAO_ROLE`, `SECRETS_REFRESH`, `ARGON2_*`, `LOGIN_RATE_PER_USER/IP` и +переменные lab6) подставляются в `compose.yaml` (якорь `x-app-env`). Значения, которые не должны меняться через `.env`, +заданы в `compose.yaml` напрямую (`API_ALLOWED_CLIENTS`, `REVOKED_SERIALS_FILE`, пути к сертификатам); +`CLAIM_RETRY_DELAY` имеет значение по умолчанию в коде (3 s). Секретов в переменных нет — только пути к файлам и адрес OpenBao. ## Доказательства критериев | Критерий README | Команда/сценарий | Наблюдаемый результат | Файл доказательства | | --- | --- | --- | --- | -| Публичный smoke | make test | TODO | TODO | -| Остальные пункты уровня 3 | TODO | TODO | TODO | -| Все пункты уровня 4, если заявлен | TODO | TODO | TODO | -| Выбранный трек 5, если заявлен | TODO | TODO | TODO | +| Публичный smoke через HTTPS | `make test`, `tests/security.py` | PASS: API-сценарий lab7; доверенный HTTPS работает, недоверенный CA отклонён | `evidence/base/smoke.txt`, `test_security.txt` | +| Внешний TLS: CA, hostname, версия | `security_ops.py tls-external` | TLS 1.3 с CA стенда; чужое имя → hostname mismatch; чужой trust store → unable to get local issuer; TLS 1.1 → отказ; порты 8080, 8404, 9090, 5432, 6379, 9000, 5672, 4318 на хосте закрыты | `evidence/security/tls-external.json` | +| mTLS LB→API | `security_ops.py mtls` | без сертификата → `certificate required`; сертификат чужого CA → отказ; доверенный CA с identity `attacker` или `worker` → `bad certificate`; identity `lb` → 200; plaintext HTTP на 8443 → 400 | `evidence/security/mtls.json` (`lb_to_api`) | +| TLS к DB, S3, broker, Collector, бэкендам, OpenBao | `security_ops.py mtls` (servers) | TLS с проверкой сервера у всех; plaintext не обслуживается (Redis не отвечает на PING без TLS, AMQP 5672 закрыт); бэкенды телеметрии без клиентского сертификата отказывают; PostgreSQL `sslmode=disable` → отказ `pg_hba` | `evidence/security/mtls.json` (`servers`) | +| OpenBao не в dev-mode, scoped policy, нет root в app | `security_ops.py openbao` | каждый сервис читает только свой путь: чужие пути, list, запись, запись policy, создание токена, seal → 403; сертификат worker под ролью api → login 400; в контейнерах нет токена в env, только сертификаты | `evidence/security/openbao.json` | +| Hardening | `security_ops.py hardening` | api/worker/relay/reconciler: UID 1001, read-only, `cap_drop ALL`, `no-new-privileges`, лимиты (api 256 MiB/0.5 CPU/256 pids, worker 768 MiB); нигде нет privileged, docker.sock, host network | `evidence/security/hardening.json` | +| Argon2id, ACL, logout, лимиты | `security_ops.py acl` | hash `argon2id m=19456,t=2,p=1`; посторонний → 404 на метаданные, контент и прикрепление чужого файла; подделка `X-User-Id` → 404/401; после logout → 401; JSON 65 KiB → 413; лимит: 10 × 401, затем 429 с `Retry-After: 58`, обслужили 2 реплики (счётчик общий) | `evidence/security/acl.json` | +| Отказ реплики, перезапуск, rolling update через HTTPS | `make test-failover`, `test-persistence`, rolling update | подтверждённые данные и сессии сохранены; rolling update под нагрузкой: 11 673 запроса, 0 ошибок, 129.7 RPS, p99 90 ms | `evidence/base/failover_*.txt`, `persistence.txt`, `rolling_update_load.json` | +| **4:** mTLS broker и Collector, разные identities | `security_ops.py mtls` | RabbitMQ: чужой CA → отказ; доверенный CA с CN `attacker`/`lb` → 403 (нет такого пользователя). worker: только consume своей очереди; publish, DLQ, declare, delete → отказ. relay: только publish. Collector: сертификаты основного CA (lb, worker) → `certificate required`; принимает только CA телеметрии | `evidence/security/mtls.json` (`broker`, `collector`) | +| **4:** rehash, бюджет login DoS, общий rate limit | `security_ops.py acl`, `argon2` | rehash `m=65536,t=1,p=4` → `m=19456,t=2,p=1`; hash 71.9 ms (p50, 1 ядро); всплеск 120 параллельных входов: 59 × 401, 61 × 429 за 2.92 s, память API (пик) 197 / 131 MiB при лимите 256 MiB | `evidence/security/argon2.json` | +| **4:** ротация secret и leaf без пересборки, отзыв identity | `security_ops.py rotation` | пароль роли БД `app_api`: старый → отказ, API → 200; ключ S3 worker: загрузка → ready; leaf `api`: serial `1909…0123` → `8c64…9308` без рестарта; leaf `lb`: старый отвергнут (`bad certificate`), новый → 200; под нагрузкой 34 548 запросов, 6 ошибок (0.017 %), p99 39.5 ms; образы не пересобирались | `evidence/security/rotation.json` | +| **4:** expiry и sealed OpenBao | `security_ops.py lifecycle` | токен api с TTL 20 s / максимум 45 s: 8 входов за 100 s, 0 сбоев обновления, 200/200 запросов OK; OpenBao запечатан 33 s: 8 667 запросов, 0 ошибок; загрузка во время sealed → ready; рестарт worker во время sealed — не стартует без секретов, задание ждёт в `queued`, после unseal ready через 0.5 s | `evidence/security/lifecycle.json` | +| **4:** scan с разбором применимости | govulncheck, Trivy | Go-код: 0 достижимых уязвимостей; образ приложения: 0 HIGH/CRITICAL; сторонние образы — разбор и порядок обновления | `evidence/scan/TRIAGE.md`, `govulncheck.txt`, `trivy_summary.txt` | +| **4:** модель угроз ≥ 6 угроз с тестами | — | 10 угроз (T1–T10): путь, инвариант, контроль, отрицательный тест, остаточный риск | `security/THREAT_MODEL.md` | +| **4:** worker ограничен по CPU/RAM/времени | compose, `pipeline_ops.py` | 1 CPU / 768 MiB / 128 pids, `JOB_TIMEOUT`, бюджет пикселей; пайплайн lab5/6 работает поверх TLS: demo, crash-effect (восстановление на 2-й попытке за 15.7 s), transient (3 попытки → ready), failed-replay | `evidence/pipeline/*.json` | +| **4:** нет утечек в телеметрии | `security_ops.py leaks` | пароль, токен, текст сообщения, Basic-заголовок: 0 совпадений в Loki, в 20 трассах Tempo и в stdout | `evidence/security/leaks.json` | +| **5, трек 1:** компрометация worker | `student-tests/compromise.py` | см. раздел ниже | `evidence/track1/track1/compromise.json` | -TODO: добавить отдельную строку для каждого заявленного критерия. PASS без команды и наблюдения не является доказательством. Проверка инфраструктурного hook требует подтверждения, какие реальные процессы/хранилища перезапущены. +## Трек 1. Компрометация worker + +**Гипотеза.** Если у worker только права, нужные для обработки вложений, то кража его identity (сертификат, ключ и всё, +что он через них получает) не даёт доступа к паролям, сообщениям и чужим файлам. Если identity и секреты отзываются +без рестарта, обработка восстанавливается без потери принятых заданий. + +**Методика** (`student-tests/compromise.py`, изолированный стенд CI): +1. **До least privilege** (модель lab6) — временные учётки с правами worker из lab6: владелец БД, общий ключ S3 на весь bucket, + администратор RabbitMQ; проверяются тем же зондом `secprobe` (в образ приложения он не входит). +2. **После** — зонд с украденным сертификатом worker: вход в OpenBao → его секреты → матрица операций. +3. **Реакция под нагрузкой**: всё время идут загрузки (одна каждые 2 s), выполняются шаги отзыва и ротации. +4. **Проверка**: украденное больше не работает, все принятые задания (202) дошли до ready. + +**Матрица последствий** (allowed / denied, из `comparison` в `compromise.json`): + +| Операция | До (lab6) | После (lab7) | +| --- | --- | --- | +| БД: чтение `users.password_hash`, `messages`, `chat_members` | allowed | denied | +| БД: вставка сообщения, смена `attachments.owner_id`, удаление вложений | allowed | denied | +| БД: `TRUNCATE jobs`, `CREATE TABLE`, `CREATE ROLE` | allowed | denied | +| БД: чтение `jobs`, смена `jobs.state` / `attachments.status`, вставка вариантов | allowed | allowed (нужно для работы) | +| S3: list bucket / всех bucket | allowed | denied | +| S3: put `s/`, `a/`; get/delete `o/`, `v/`, `a/` | allowed | denied | +| S3: get и delete `s/`, put `v/` и `o/` | allowed | allowed (нужно для работы) | +| RabbitMQ: publish задания, чтение DLQ, создание очереди | allowed | denied | +| RabbitMQ: consume `attachment.process` | allowed | allowed (нужно для работы) | +| API в обход LB с сертификатом worker | allowed (HTTP :8080) | denied (`bad certificate`) | +| OpenBao: чужие пути, list, запись, policy, seal | — (секреты файлами) | denied (403) | + +**Реакция** (`response_steps`, время от начала): + +| t, s | Шаг | Длительность, s | +| --- | --- | --- | +| 0.0 | новая identity: сертификат CN `worker-g2` (файл перезаписан на месте) | 0.1 | +| 0.1 | OpenBao: cert-роль worker → только CN `worker-g2`; RabbitMQ: создан `worker-g2`, `worker-g1` удалён, его соединения закрыты | 17.1 | +| 17.2 | отзыв всех токенов OpenBao, выданных worker | 3.7 | +| 20.9 | ротация пароля роли `app_worker` и разрыв её соединений | 1.3 | +| 22.2 | ротация secret key S3 `svc-worker` | 5.2 | + +**Результат:** +- после реакции украденный сертификат: вход в OpenBao → 400, RabbitMQ → 403, API → `bad certificate`; + старый пароль БД → `password authentication failed`; старый ключ S3 → `SignatureDoesNotMatch` на все 15 операций; +- обработка восстановилась **без рестарта** worker (`worker_restarts: 0`): первая загрузка после реакции дошла до ready + через 0.5 s; в логах worker — `secrets.login` (вход с новым сертификатом) и `secrets.version`; +- **задания не потеряны**: принято 27 (из них 21 во время реакции), ошибок загрузки 0, итог — 27 ready. + +**Что пришлось исправить, чтобы реакция проходила под нагрузкой** (найдено прогонами, каждый с ссылкой в истории CI): +1. Клиент OpenBao переиспользовал keep-alive TLS-соединение со старым сертификатом — вход шёл с отозванной identity. + Теперь перед cert login простаивающие соединения закрываются. +2. Ключ S3 меняется в MinIO раньше, чем worker читает новую версию секрета (окно до 30 s), — задания сжигали попытки + и уходили в failed. Теперь при `InvalidAccessKeyId`/`SignatureDoesNotMatch` worker сразу перечитывает секрет и + повторяет операцию (`internal/platform`, тест `internal/storage/autherr_test.go`); при ошибке БД 28P01 — аналогично. +3. При неудачном claim сообщение возвращалось в очередь раз в секунду, и quorum-очередь (`x-delivery-limit=10`) + уводила его в DLQ за ~10 s — задание оставалось `queued` без сообщения. Теперь перед requeue пауза + `CLAIM_RETRY_DELAY` (3 s). + +**Ограничения трека.** Worker по природе читает исходные изображения (`s/`) и пишет варианты: до ротации атакующий может +подменить результат обработки. Право read на очередь в RabbitMQ разрешает и `queue.purge` — его нельзя отнять, не сломав +consume (в зонде purge не выполняется, чтобы не разрушать очередь; риск описан в модели угроз, T3). Сертификат телеметрии +worker (CA телеметрии) в процедуре не перевыпускался: украденный, он по-прежнему позволяет отправлять в Collector +поддельную телеметрию (`otlp: ingest allowed` после реакции) — следующий шаг процедуры. ## Эксперименты и отказы -TODO: гипотеза, hardware/лимиты, версии, объём данных, профиль нагрузки, concurrency/arrival rate, длительность/прогрев, повторы, успешные RPS, ошибки, p50/p95/p99, CPU/RAM. Сохранить raw summary без tokens и объяснить ограничения измерения. +Стенд CI: GitHub runner, 2 vCPU, 7.9 GiB RAM, Docker 28.0.4. Нагрузка — closed-loop POST сообщений без автоматических +повторов; percentiles только по успешным запросам; у closed-loop есть coordinated omission. | Воздействие | Что ожидаем | Что наблюдали | Время восстановления / потеря данных | | --- | --- | --- | --- | -| TODO | TODO | TODO | TODO | +| Ротация пароля БД api, ключа S3 worker, leaf api и lb под нагрузкой (3 потока, 138 s) | без рестарта и пересборки, единичные ошибки | 34 548 запросов, 6 ошибок (0.017 %), 249.5 RPS, p50/p95/p99 10.1/23.1/39.5 ms | API → 200 с первой попытки после ротации; потерь нет | +| OpenBao запечатан (2 потока, 35 s) | работающие процессы живут на кэше, новые не стартуют | 8 667 запросов, 0 ошибок, p99 24.9 ms; рестарт worker во время sealed — ждёт; задание в `queued` | ready через 0.5 s после unseal; потерь нет | +| Короткий TTL токена (20 s, максимум 45 s) | renew, затем повторный вход без сбоев | 8 входов за 100 s, 0 сбоев обновления, 200/200 OK | — | +| Всплеск 120 параллельных входов с одного IP | лимит до Argon2id, память ограничена | 59 × 401, 61 × 429 за 2.92 s; пик памяти API 197 MiB (лимит 256) | — | +| Компрометация worker (трек 1) | отзыв без рестарта, без потери заданий | см. трек 1 | обработка через 0.5 s после реакции; 27/27 ready | +| Остановка API-реплики, рестарт хранилищ (lab3–6 через HTTPS) | данные и сессии сохранены | PASS | см. `evidence/base` | +| Падение worker после побочного эффекта (lab5) | повтор после истечения lease | восстановление на попытке 2 за 15.7 s | потерь нет | + +Бюджет Argon2id (`evidence/security/argon2.json`, 1 ядро): m=19 MiB t=2 — 71.9 ms (13.9 hash/s); m=46 MiB t=1 — 82.8 ms; +m=19 MiB t=3 — 83.2 ms; m=64 MiB t=1 p=4 (параметры lab2–6) — 109.4 ms; m=64 MiB t=3 — 273.6 ms. Выбран минимум +OWASP: он даёт ~14 входов/с на ядро, а 2 слота на реплику ограничивают память Argon2id до 76 MiB на стенд +(2 реплики × 2 × 19 MiB) и пропускную способность до ~56 hash/s; лимиты 10/мин на username и 60/мин на IP отсекают +перебор до вычисления hash. ## Ограничения и следующие шаги -TODO: какие отказы выдерживаются и какие нет; что не реализовано; где учебное упрощение; какое улучшение подтверждено, а какое пока гипотеза. +- **Redis без mTLS**: TLS с проверкой сервера + ACL-пользователь с паролем из OpenBao; клиентский сертификат сервер не + требует (отражено в trust matrix). +- **Сторонние образы** с известными HIGH/CRITICAL (OpenSSL 3.3.2 и др.) не обновлены — разбор и порядок обновления в + `evidence/scan/TRIAGE.md`; первым — HAProxy как единственный внешний TLS endpoint. +- PostgreSQL, Redis, RabbitMQ и OpenBao работают от root образа с минимальным набором capabilities (CHOWN, DAC_OVERRIDE, + FOWNER, SETUID/SETGID) — их entrypoint меняет владельца volume и сбрасывает привилегии; `read_only` для них не включён. +- Потерянное сообщение RabbitMQ (purge скомпрометированным worker, превышение delivery-limit) не переиздаётся + автоматически: задание остаётся `queued` в PostgreSQL, срабатывает алерт возраста старейшей работы, восстановление ручное. +- Доли unseal в учебном стенде лежат у одного оператора в `secrets/operator`; в эксплуатации — у разных людей. +- Сертификат телеметрии worker не входит в процедуру отзыва (см. трек 1). +- Измерения сделаны на одном runner CI, по одному прогону сценария; это подтверждение поведения, а не статистика производительности. diff --git a/evidence/RUN.txt b/evidence/RUN.txt new file mode 100644 index 0000000..5ad620d --- /dev/null +++ b/evidence/RUN.txt @@ -0,0 +1,5 @@ +source_commit=a414221d756744e90c2b9b498b66f386a3a7d062 +run=https://github.com/CharaWein/2026_lab3/actions/runs/43267046991 +go_tests=success +stand=success +scan=success diff --git a/evidence/base/README.md b/evidence/base/README.md new file mode 100644 index 0000000..8df7001 --- /dev/null +++ b/evidence/base/README.md @@ -0,0 +1,5 @@ +# Доказательства + +Храните небольшие обезличенные результаты: команды и stdout проверок, JSON/CSV агрегатов нагрузки, EXPLAIN, dashboard JSON, текст разбора отказа. Укажите дату, commit, аппаратные лимиты и профиль нагрузки. + +Не добавляйте .env, session tokens, cookies, приватные ключи, credentials, реальные сообщения, raw dumps и signed URLs. Для скриншотов скрывайте секреты. Большие логи/бинарные traces сохраняйте отдельно по правилам преподавателя; одного скриншота без методики недостаточно. diff --git a/evidence/base/containers_state_base.txt b/evidence/base/containers_state_base.txt new file mode 100644 index 0000000..fd18ee0 --- /dev/null +++ b/evidence/base/containers_state_base.txt @@ -0,0 +1,17 @@ +/mtusi2026lab7-api-3 restarts=0 oom_killed=false exit=0 +/mtusi2026lab7-api-4 restarts=0 oom_killed=false exit=0 +/mtusi2026lab7-grafana-1 restarts=0 oom_killed=false exit=0 +/mtusi2026lab7-lb-1 restarts=0 oom_killed=false exit=0 +/mtusi2026lab7-loki-1 restarts=0 oom_killed=false exit=0 +/mtusi2026lab7-openbao-1 restarts=0 oom_killed=false exit=0 +/mtusi2026lab7-otel-collector-1 restarts=0 oom_killed=false exit=0 +/mtusi2026lab7-postgres-1 restarts=0 oom_killed=false exit=0 +/mtusi2026lab7-prometheus-1 restarts=0 oom_killed=false exit=0 +/mtusi2026lab7-rabbitmq-1 restarts=0 oom_killed=false exit=0 +/mtusi2026lab7-reconciler-1 restarts=0 oom_killed=false exit=0 +/mtusi2026lab7-redis-1 restarts=0 oom_killed=false exit=0 +/mtusi2026lab7-relay-1 restarts=0 oom_killed=false exit=0 +/mtusi2026lab7-s3-1 restarts=0 oom_killed=false exit=0 +/mtusi2026lab7-tempo-1 restarts=0 oom_killed=false exit=0 +/mtusi2026lab7-tempo-init-1 restarts=0 oom_killed=false exit=0 +/mtusi2026lab7-worker-1 restarts=0 oom_killed=false exit=0 diff --git a/evidence/base/docker_ps.txt b/evidence/base/docker_ps.txt new file mode 100644 index 0000000..6c37ac2 --- /dev/null +++ b/evidence/base/docker_ps.txt @@ -0,0 +1,19 @@ +2026-11-12T17:17:50Z +Docker Compose version v2.38.2 +NAME IMAGE COMMAND SERVICE CREATED STATUS PORTS +mtusi2026lab7-api-1 mtusi2026lab7-api:local "/app/api" api 9 seconds ago Up 6 seconds (healthy) 8443/tcp +mtusi2026lab7-api-2 mtusi2026lab7-api:local "/app/api" api 8 seconds ago Up 7 seconds (healthy) 8443/tcp +mtusi2026lab7-grafana-1 grafana/grafana:11.4.0 "/run.sh" grafana 8 seconds ago Up 6 seconds (healthy) 127.0.0.1:3000->3000/tcp +mtusi2026lab7-lb-1 haproxy:3.0.5-alpine "docker-entrypoint.s…" lb 8 seconds ago Up Less than a second 127.0.0.1:8443->8443/tcp +mtusi2026lab7-loki-1 grafana/loki:3.3.2 "/usr/bin/loki -conf…" loki 8 seconds ago Up 8 seconds 3100/tcp +mtusi2026lab7-openbao-1 openbao/openbao:2.1.0 "docker-entrypoint.s…" openbao About a minute ago Up About a minute 127.0.0.1:8200->8200/tcp +mtusi2026lab7-otel-collector-1 otel/opentelemetry-collector-contrib:0.116.1 "/otelcol-contrib --…" otel-collector 8 seconds ago Up 8 seconds 4317-4318/tcp, 55678-55679/tcp +mtusi2026lab7-postgres-1 postgres:16.4-alpine "sh -c 'install -o p…" postgres 58 seconds ago Up 57 seconds (healthy) 5432/tcp +mtusi2026lab7-prometheus-1 prom/prometheus:v3.1.0 "/bin/prometheus --c…" prometheus 9 seconds ago Up 8 seconds 9090/tcp +mtusi2026lab7-rabbitmq-1 rabbitmq:4.0.9-alpine "docker-entrypoint.s…" rabbitmq 58 seconds ago Up 57 seconds (healthy) 4369/tcp, 5671-5672/tcp, 15691-15692/tcp, 25672/tcp +mtusi2026lab7-reconciler-1 mtusi2026lab7-api:local "/app/reconcile --ap…" reconciler 8 seconds ago Up 7 seconds (healthy) 8443/tcp +mtusi2026lab7-redis-1 redis:7.4.1-alpine "docker-entrypoint.s…" redis 58 seconds ago Up 41 seconds (healthy) 6379/tcp +mtusi2026lab7-relay-1 mtusi2026lab7-api:local "/app/pipeline relay" relay 9 seconds ago Up 7 seconds (healthy) 8443/tcp +mtusi2026lab7-s3-1 bitnamilegacy/minio:2025.4.22@sha256:50cec18ac4184af4671a78aedd5554942c8ae105d51a465fa82037949046da01 "/bin/bash -c 'mkdir…" s3 58 seconds ago Up 57 seconds (healthy) 9000-9001/tcp +mtusi2026lab7-tempo-1 grafana/tempo:2.6.1 "/tempo -config.file…" tempo 8 seconds ago Up 7 seconds +mtusi2026lab7-worker-1 mtusi2026lab7-api:local "/app/pipeline worker" worker 8 seconds ago Up 7 seconds (healthy) 8443/tcp diff --git a/evidence/base/docker_ps_final_base.txt b/evidence/base/docker_ps_final_base.txt new file mode 100644 index 0000000..5a20828 --- /dev/null +++ b/evidence/base/docker_ps_final_base.txt @@ -0,0 +1,18 @@ +NAME IMAGE COMMAND SERVICE CREATED STATUS PORTS +mtusi2026lab7-api-3 mtusi2026lab7-api:local "/app/api" api 53 seconds ago Up 52 seconds (healthy) 8443/tcp +mtusi2026lab7-api-4 mtusi2026lab7-api:local "/app/api" api 41 seconds ago Up 40 seconds (healthy) 8443/tcp +mtusi2026lab7-grafana-1 grafana/grafana:11.4.0 "/run.sh" grafana 6 minutes ago Up 5 minutes (healthy) 127.0.0.1:3000->3000/tcp +mtusi2026lab7-lb-1 haproxy:3.0.5-alpine "docker-entrypoint.s…" lb 6 minutes ago Up 5 minutes 127.0.0.1:8443->8443/tcp +mtusi2026lab7-loki-1 grafana/loki:3.3.2 "/usr/bin/loki -conf…" loki 6 minutes ago Up 5 minutes 3100/tcp +mtusi2026lab7-openbao-1 openbao/openbao:2.1.0 "docker-entrypoint.s…" openbao 7 minutes ago Up 5 minutes 127.0.0.1:8200->8200/tcp +mtusi2026lab7-otel-collector-1 otel/opentelemetry-collector-contrib:0.116.1 "/otelcol-contrib --…" otel-collector 6 minutes ago Up 5 minutes 4317-4318/tcp, 55678-55679/tcp +mtusi2026lab7-postgres-1 postgres:16.4-alpine "sh -c 'install -o p…" postgres 7 minutes ago Up 5 minutes (healthy) 5432/tcp +mtusi2026lab7-prometheus-1 prom/prometheus:v3.1.0 "/bin/prometheus --c…" prometheus 6 minutes ago Up 5 minutes 9090/tcp +mtusi2026lab7-rabbitmq-1 rabbitmq:4.0.9-alpine "docker-entrypoint.s…" rabbitmq 7 minutes ago Up 5 minutes (healthy) 4369/tcp, 5671-5672/tcp, 15691-15692/tcp, 25672/tcp +mtusi2026lab7-reconciler-1 mtusi2026lab7-api:local "/app/reconcile --ap…" reconciler 6 minutes ago Up 5 minutes (healthy) 8443/tcp +mtusi2026lab7-redis-1 redis:7.4.1-alpine "docker-entrypoint.s…" redis 7 minutes ago Up 5 minutes (healthy) 6379/tcp +mtusi2026lab7-relay-1 mtusi2026lab7-api:local "/app/pipeline relay" relay 6 minutes ago Up 5 minutes (healthy) 8443/tcp +mtusi2026lab7-s3-1 bitnamilegacy/minio:2025.4.22@sha256:50cec18ac4184af4671a78aedd5554942c8ae105d51a465fa82037949046da01 "/bin/bash -c 'mkdir…" s3 7 minutes ago Up 5 minutes (healthy) 9000-9001/tcp +mtusi2026lab7-tempo-1 grafana/tempo:2.6.1 "/tempo -config.file…" tempo 6 minutes ago Up 5 minutes +mtusi2026lab7-tempo-init-1 grafana/tempo:2.6.1 "chown 10001:10001 /…" tempo-init 6 minutes ago Exited (0) 6 minutes ago +mtusi2026lab7-worker-1 mtusi2026lab7-api:local "/app/pipeline worker" worker 6 minutes ago Up 5 minutes (healthy) 8443/tcp diff --git a/evidence/base/docker_stats_base.txt b/evidence/base/docker_stats_base.txt new file mode 100644 index 0000000..0c4390e --- /dev/null +++ b/evidence/base/docker_stats_base.txt @@ -0,0 +1,16 @@ +mtusi2026lab7-api-4 0.51% 17.5MiB / 256MiB +mtusi2026lab7-api-3 0.63% 17.07MiB / 256MiB +mtusi2026lab7-grafana-1 0.03% 53.66MiB / 256MiB +mtusi2026lab7-tempo-1 0.96% 139.4MiB / 1GiB +mtusi2026lab7-lb-1 0.33% 14.51MiB / 128MiB +mtusi2026lab7-otel-collector-1 2.16% 57.52MiB / 256MiB +mtusi2026lab7-reconciler-1 3.81% 5.465MiB / 128MiB +mtusi2026lab7-loki-1 0.35% 97.61MiB / 1GiB +mtusi2026lab7-worker-1 3.15% 12.34MiB / 768MiB +mtusi2026lab7-prometheus-1 0.72% 42.93MiB / 512MiB +mtusi2026lab7-relay-1 0.21% 12.42MiB / 128MiB +mtusi2026lab7-postgres-1 0.25% 60.77MiB / 512MiB +mtusi2026lab7-rabbitmq-1 4.61% 77.87MiB / 512MiB +mtusi2026lab7-redis-1 0.44% 4.168MiB / 256MiB +mtusi2026lab7-s3-1 0.04% 208.1MiB / 512MiB +mtusi2026lab7-openbao-1 0.33% 21.78MiB / 256MiB diff --git a/evidence/base/failover_1.txt b/evidence/base/failover_1.txt new file mode 100644 index 0000000..ad21d85 --- /dev/null +++ b/evidence/base/failover_1.txt @@ -0,0 +1,8 @@ +Executing explicit failover hook; hook output suppressed to avoid leaking secrets. +{"observed_instances_before": 2, "successful_writes": 138, "failed_attempts": 0, "first_recovery_seconds": 3.653} +PASS: failover preserved confirmed data and existing session. Hook scope needs operator evidence. +-- контейнеры api после stop-one: +mtusi2026lab7-api-1 0538735e7e2e Up 29 seconds (healthy) +mtusi2026lab7-api-2 7943a102220b Exited (0) 11 seconds ago +mtusi2026lab7-api-1 Up 36 seconds (healthy) +mtusi2026lab7-api-2 Up 6 seconds (healthy) diff --git a/evidence/base/failover_2.txt b/evidence/base/failover_2.txt new file mode 100644 index 0000000..ce3734b --- /dev/null +++ b/evidence/base/failover_2.txt @@ -0,0 +1,8 @@ +Executing explicit failover hook; hook output suppressed to avoid leaking secrets. +{"observed_instances_before": 2, "successful_writes": 138, "failed_attempts": 0, "first_recovery_seconds": 3.634} +PASS: failover preserved confirmed data and existing session. Hook scope needs operator evidence. +-- контейнеры api после stop-one: +mtusi2026lab7-api-1 0538735e7e2e Up 52 seconds (healthy) +mtusi2026lab7-api-2 7943a102220b Exited (0) 11 seconds ago +mtusi2026lab7-api-1 Up 58 seconds (healthy) +mtusi2026lab7-api-2 Up 5 seconds (healthy) diff --git a/evidence/base/idempotency_concurrent.json b/evidence/base/idempotency_concurrent.json new file mode 100644 index 0000000..0d31054 --- /dev/null +++ b/evidence/base/idempotency_concurrent.json @@ -0,0 +1,88 @@ +{ + "rounds": 10, + "parallel_per_round": 16, + "distinct_instances_seen": 2, + "duplicates_found": 0, + "per_round": [ + { + "round": 0, + "requests": 16, + "status_201": 16, + "distinct_messages": 1, + "stored": 1, + "instances": 2 + }, + { + "round": 1, + "requests": 16, + "status_201": 16, + "distinct_messages": 1, + "stored": 1, + "instances": 2 + }, + { + "round": 2, + "requests": 16, + "status_201": 16, + "distinct_messages": 1, + "stored": 1, + "instances": 2 + }, + { + "round": 3, + "requests": 16, + "status_201": 16, + "distinct_messages": 1, + "stored": 1, + "instances": 2 + }, + { + "round": 4, + "requests": 16, + "status_201": 16, + "distinct_messages": 1, + "stored": 1, + "instances": 2 + }, + { + "round": 5, + "requests": 16, + "status_201": 16, + "distinct_messages": 1, + "stored": 1, + "instances": 2 + }, + { + "round": 6, + "requests": 16, + "status_201": 16, + "distinct_messages": 1, + "stored": 1, + "instances": 2 + }, + { + "round": 7, + "requests": 16, + "status_201": 16, + "distinct_messages": 1, + "stored": 1, + "instances": 2 + }, + { + "round": 8, + "requests": 16, + "status_201": 16, + "distinct_messages": 1, + "stored": 1, + "instances": 2 + }, + { + "round": 9, + "requests": 16, + "status_201": 16, + "distinct_messages": 1, + "stored": 1, + "instances": 2 + } + ] +} diff --git a/evidence/base/images.txt b/evidence/base/images.txt new file mode 100644 index 0000000..c2bf882 --- /dev/null +++ b/evidence/base/images.txt @@ -0,0 +1,13 @@ +bitnamilegacy/minio:2025.4.22@sha256:50cec18ac4184af4671a78aedd5554942c8ae105d51a465fa82037949046da01 bitnamilegacy/minio@sha256:50cec18ac4184af4671a78aedd5554942c8ae105d51a465fa82037949046da01 +grafana/grafana:11.4.0 grafana/grafana@sha256:d8ea37798ccc41061a62ab080f2676dda6bf7815558499f901bdb0f533a456fb +grafana/loki:3.3.2 grafana/loki@sha256:8af2de1abbdd7aa92b27c9bcc96f0f4140c9096b507c77921ffddf1c6ad6c48f +grafana/tempo:2.6.1 grafana/tempo@sha256:ef4384fce6e8ad22b95b243d8fc165628cda655376fd50e7850536ad89d71d50 +haproxy:3.0.5-alpine haproxy@sha256:43a2591a6a62a41dd22edb4452880e9c70de489fbd7c54ffb52d035cccbfe949 +mtusi2026lab7-api:local +local-build +openbao/openbao:2.1.0 openbao/openbao@sha256:7de07aa6df3937d44c96c2d65c188b2d4a70546f2a764ad4510301305af6a223 +otel/opentelemetry-collector-contrib:0.116.1 otel/opentelemetry-collector-contrib@sha256:d0ebf65280da2e1b1491d1b93648281afd353d4b9ea19160090303cec9a233bd +postgres:16.4-alpine postgres@sha256:5660c2cbfea50c7a9127d17dc4e48543eedd3d7a41a595a2dfa572471e37e64c +prom/prometheus:v3.1.0 prom/prometheus@sha256:6559acbd5d770b15bb3c954629ce190ac3cbbdb2b7f1c30f0385c4e05104e218 +rabbitmq:4.0.9-alpine rabbitmq@sha256:0a09ddfd00a1ef2e58f497d731e9b2814ef3bebb3668069185c54d085352d2b9 +redis:7.4.1-alpine redis@sha256:c1e88455c85225310bbea54816e9c3f4b5295815e6dbf80c34d40afc6df28275 diff --git a/evidence/base/instances.txt b/evidence/base/instances.txt new file mode 100644 index 0000000..0de984d --- /dev/null +++ b/evidence/base/instances.txt @@ -0,0 +1,2 @@ +6e304db1ea6a4190 10 +749718ebe6b58adb 10 diff --git a/evidence/base/persistence.txt b/evidence/base/persistence.txt new file mode 100644 index 0000000..ced6192 --- /dev/null +++ b/evidence/base/persistence.txt @@ -0,0 +1,36 @@ +-- до: +mtusi2026lab7-api-1 Up 58 seconds (healthy) +mtusi2026lab7-api-2 Up 5 seconds (healthy) +mtusi2026lab7-grafana-1 Up 58 seconds (healthy) +mtusi2026lab7-lb-1 Up 52 seconds +mtusi2026lab7-loki-1 Up About a minute +mtusi2026lab7-openbao-1 Up About a minute +mtusi2026lab7-otel-collector-1 Up About a minute +mtusi2026lab7-postgres-1 Up About a minute (healthy) +mtusi2026lab7-prometheus-1 Up About a minute +mtusi2026lab7-rabbitmq-1 Up About a minute (healthy) +mtusi2026lab7-reconciler-1 Up 59 seconds (healthy) +mtusi2026lab7-redis-1 Up About a minute (healthy) +mtusi2026lab7-relay-1 Up 59 seconds (healthy) +mtusi2026lab7-s3-1 Up About a minute (healthy) +mtusi2026lab7-tempo-1 Up 59 seconds +mtusi2026lab7-worker-1 Up 59 seconds (healthy) +Executing explicit persistence hook; hook output suppressed to avoid leaking secrets. +PASS: persistence preserved confirmed data and existing session. Hook scope needs operator evidence. +-- после: +mtusi2026lab7-api-1 Up 6 seconds (healthy) +mtusi2026lab7-api-2 Up 7 seconds (healthy) +mtusi2026lab7-grafana-1 Up 24 seconds (healthy) +mtusi2026lab7-lb-1 Up Less than a second +mtusi2026lab7-loki-1 Up 23 seconds +mtusi2026lab7-openbao-1 Up 15 seconds +mtusi2026lab7-otel-collector-1 Up 24 seconds +mtusi2026lab7-postgres-1 Up 24 seconds (healthy) +mtusi2026lab7-prometheus-1 Up 24 seconds +mtusi2026lab7-rabbitmq-1 Up 23 seconds (healthy) +mtusi2026lab7-reconciler-1 Up 7 seconds (healthy) +mtusi2026lab7-redis-1 Up 24 seconds (healthy) +mtusi2026lab7-relay-1 Up 7 seconds (healthy) +mtusi2026lab7-s3-1 Up 24 seconds (healthy) +mtusi2026lab7-tempo-1 Up 23 seconds +mtusi2026lab7-worker-1 Up 7 seconds (healthy) diff --git a/evidence/base/regressions.txt b/evidence/base/regressions.txt new file mode 100644 index 0000000..fc57a88 --- /dev/null +++ b/evidence/base/regressions.txt @@ -0,0 +1,3 @@ +PASS: whitespace-only password rejected with 400 (3 variants) +PASS: Redis ACL -incr: message visible on every next read (3 in history) +PASS: Redis ACL -incr -del -unlink -scan: message visible on every next read (4 in history) diff --git a/evidence/base/rolling_update.txt b/evidence/base/rolling_update.txt new file mode 100644 index 0000000..03147fe --- /dev/null +++ b/evidence/base/rolling_update.txt @@ -0,0 +1,92 @@ +-- до: +mtusi2026lab7-api-1 0538735e7e2e Up 3 minutes (healthy) +mtusi2026lab7-api-2 7943a102220b Up 3 minutes (healthy) +#1 [internal] load local bake definitions +#1 reading from stdin 380B done +#1 DONE 0.0s + +#2 [internal] load build definition from Dockerfile +#2 transferring dockerfile: 3.85kB done +#2 DONE 0.0s + +#3 [internal] load metadata for docker.io/library/alpine:3.20@sha256:d9e853e87e55526f6b2917df91a2115c36dd7c696a35be12163d44e6e2a4b6bc +#3 DONE 0.0s + +#4 [internal] load metadata for docker.io/library/golang:1.26.11-alpine +#4 DONE 0.1s + +#5 [internal] load .dockerignore +#5 transferring context: 212B 0.0s done +#5 DONE 0.0s + +#6 [builder 1/6] FROM docker.io/library/golang:1.26.11-alpine@sha256:ae52b5bc6ed045a9ed26ab03dc19327a802a9cc9aa8b27ed57f5c6b60579b0bb +#6 DONE 0.0s + +#7 [stage-2 1/7] FROM docker.io/library/alpine:3.20@sha256:d9e853e87e55526f6b2917df91a2115c36dd7c696a35be12163d44e6e2a4b6bc +#7 DONE 0.0s + +#8 [internal] load build context +#8 transferring context: 10.70kB 0.1s done +#8 DONE 0.1s + +#9 [stage-2 4/7] WORKDIR /app +#9 CACHED + +#10 [builder 3/6] COPY go.mod go.sum ./ +#10 CACHED + +#11 [builder 5/6] COPY . . +#11 CACHED + +#12 [stage-2 2/7] RUN apk --no-cache upgrade && apk --no-cache add ca-certificates tzdata libwebp-tools +#12 CACHED + +#13 [stage-2 5/7] COPY --from=builder --chown=appuser:appgroup /out/api /app/api +#13 CACHED + +#14 [builder 4/6] RUN go mod download +#14 CACHED + +#15 [builder 2/6] WORKDIR /src +#15 CACHED + +#16 [builder 6/6] RUN CGO_ENABLED=0 GOOS=linux go build -ldflags="-s -w -X github.com/charawein/mtusi2026lab7/internal/telemetry.Version=lab7" -trimpath -o /out/ ./cmd/api ./cmd/reconcile ./cmd/pipeline ./cmd/secprobe +#16 CACHED + +#17 [stage-2 6/7] COPY --from=builder --chown=appuser:appgroup /out/reconcile /app/reconcile +#17 CACHED + +#18 [stage-2 3/7] RUN addgroup -g 1001 -S appgroup && adduser -u 1001 -S appuser -G appgroup && mkdir -p /var/lib/messenger/fault && chown appuser:appgroup /var/lib/messenger/fault +#18 CACHED + +#19 [stage-2 7/7] COPY --from=builder --chown=appuser:appgroup /out/pipeline /app/pipeline +#19 CACHED + +#20 exporting to image +#20 exporting layers done +#20 writing image sha256:e830a7fdf17500a1a527dd395f504ccf04238c2f523d963b02d01cb64fd0d9a9 done +#20 naming to docker.io/library/mtusi2026lab7-api:local done +#20 DONE 0.0s + +#21 resolving provenance for metadata file +#21 DONE 0.0s + api Built + Container mtusi2026lab7-postgres-1 Running +no change + Container mtusi2026lab7-api-1 Running + Container mtusi2026lab7-api-2 Running + Container mtusi2026lab7-api-3 Creating + Container mtusi2026lab7-api-3 Created + Container mtusi2026lab7-api-3 Starting + Container mtusi2026lab7-api-3 Started +replaced /mtusi2026lab7-api-1 + Container mtusi2026lab7-api-2 Running + Container mtusi2026lab7-api-3 Running + Container mtusi2026lab7-api-4 Creating + Container mtusi2026lab7-api-4 Created + Container mtusi2026lab7-api-4 Starting + Container mtusi2026lab7-api-4 Started +replaced /mtusi2026lab7-api-2 +mtusi2026lab7-api-3 2027815d9c51 mtusi2026lab7-api:local Up 25 seconds (healthy) +mtusi2026lab7-api-4 919473005fb8 mtusi2026lab7-api:local Up 13 seconds (healthy) +-- замена заняла 62 s (внутри 90 s нагрузки) diff --git a/evidence/base/rolling_update_load.json b/evidence/base/rolling_update_load.json new file mode 100644 index 0000000..fb97275 --- /dev/null +++ b/evidence/base/rolling_update_load.json @@ -0,0 +1,17 @@ +{ + "lab": 7, + "workload": "closed-loop POST messages; no automatic retries", + "requested_duration_seconds": 90.0, + "elapsed_seconds": 90.022, + "concurrency": 4, + "successful_requests": 11673, + "failed_requests": 0, + "error_ratio": 0.0, + "successful_rps": 129.669, + "successful_latency_ms": { + "p50": 26.667, + "p95": 59.833, + "p99": 89.961 + }, + "note": "Latency percentiles cover successes only. Timeouts/errors are counted separately; closed-loop has coordinated omission and client overhead." +} diff --git a/evidence/base/runner_base.txt b/evidence/base/runner_base.txt new file mode 100644 index 0000000..049f128 --- /dev/null +++ b/evidence/base/runner_base.txt @@ -0,0 +1,6 @@ +2 + total used free shared buff/cache available +Mem: 7932 1948 1527 101 4872 5983 +Swap: 3071 0 3071 +28.0.4 +Docker Compose version v2.38.2 diff --git a/evidence/base/smoke.txt b/evidence/base/smoke.txt new file mode 100644 index 0000000..b484213 --- /dev/null +++ b/evidence/base/smoke.txt @@ -0,0 +1 @@ +PASS: lab7 public API scenario; infrastructure and grading evidence remain separate. diff --git a/evidence/base/test_security.txt b/evidence/base/test_security.txt new file mode 100644 index 0000000..ff2e222 --- /dev/null +++ b/evidence/base/test_security.txt @@ -0,0 +1 @@ +PASS: trusted HTTPS works; untrusted CA rejected. This does NOT verify internal mTLS, OpenBao or hardening. diff --git a/evidence/go/README.md b/evidence/go/README.md new file mode 100644 index 0000000..8df7001 --- /dev/null +++ b/evidence/go/README.md @@ -0,0 +1,5 @@ +# Доказательства + +Храните небольшие обезличенные результаты: команды и stdout проверок, JSON/CSV агрегатов нагрузки, EXPLAIN, dashboard JSON, текст разбора отказа. Укажите дату, commit, аппаратные лимиты и профиль нагрузки. + +Не добавляйте .env, session tokens, cookies, приватные ключи, credentials, реальные сообщения, raw dumps и signed URLs. Для скриншотов скрывайте секреты. Большие логи/бинарные traces сохраняйте отдельно по правилам преподавателя; одного скриншота без методики недостаточно. diff --git a/evidence/go/go_test.txt b/evidence/go/go_test.txt new file mode 100644 index 0000000..82c2654 --- /dev/null +++ b/evidence/go/go_test.txt @@ -0,0 +1,24 @@ +? github.com/charawein/mtusi2026lab7/cmd/api [no test files] +? github.com/charawein/mtusi2026lab7/cmd/pipeline [no test files] +? github.com/charawein/mtusi2026lab7/cmd/reconcile [no test files] +? github.com/charawein/mtusi2026lab7/cmd/secprobe [no test files] +? github.com/charawein/mtusi2026lab7/internal/broker [no test files] +? github.com/charawein/mtusi2026lab7/internal/config [no test files] +? github.com/charawein/mtusi2026lab7/internal/domain [no test files] +ok github.com/charawein/mtusi2026lab7/internal/imagecheck 0.022s +ok github.com/charawein/mtusi2026lab7/internal/imaging 0.767s +? github.com/charawein/mtusi2026lab7/internal/platform [no test files] +ok github.com/charawein/mtusi2026lab7/internal/reconcile 0.012s +? github.com/charawein/mtusi2026lab7/internal/repository [no test files] +? github.com/charawein/mtusi2026lab7/internal/repository/postgres [no test files] +? github.com/charawein/mtusi2026lab7/internal/repository/redis [no test files] +? github.com/charawein/mtusi2026lab7/internal/secrets [no test files] +ok github.com/charawein/mtusi2026lab7/internal/service 0.009s +ok github.com/charawein/mtusi2026lab7/internal/storage 0.005s +ok github.com/charawein/mtusi2026lab7/internal/telemetry 0.015s +ok github.com/charawein/mtusi2026lab7/internal/tlsutil 4.229s +? github.com/charawein/mtusi2026lab7/internal/transport/http [no test files] +ok github.com/charawein/mtusi2026lab7/internal/transport/http/middleware 0.005s +? github.com/charawein/mtusi2026lab7/internal/transport/httputil [no test files] +ok github.com/charawein/mtusi2026lab7/internal/worker 6.961s +? github.com/charawein/mtusi2026lab7/student-tests/genfixtures [no test files] diff --git a/evidence/go/security_unit_tests.txt b/evidence/go/security_unit_tests.txt new file mode 100644 index 0000000..3483e10 --- /dev/null +++ b/evidence/go/security_unit_tests.txt @@ -0,0 +1,16 @@ +=== RUN TestTLSIdentityAllowlistRevocationAndReload +2026/11/12 17:14:23 http: TLS handshake error from 127.0.0.1:37240: tls: client didn't provide a certificate +2026/11/12 17:14:23 http: TLS handshake error from 127.0.0.1:37246: client identity not allowed: [attacker] +2026/11/12 17:14:23 http: TLS handshake error from 127.0.0.1:37254: tls: failed to verify certificate: x509: certificate signed by unknown authority +2026/11/12 17:14:25 http: TLS handshake error from 127.0.0.1:44556: client identity not allowed: certificate revoked +--- PASS: TestTLSIdentityAllowlistRevocationAndReload (4.22s) +PASS +ok github.com/charawein/mtusi2026lab7/internal/tlsutil 4.226s +=== RUN TestPutValidatedClassifiesCause +--- PASS: TestPutValidatedClassifiesCause (0.00s) +=== RUN TestValidatePassword +--- PASS: TestValidatePassword (0.00s) +=== RUN TestValidateText +--- PASS: TestValidateText (0.00s) +PASS +ok github.com/charawein/mtusi2026lab7/internal/service 0.006s diff --git a/evidence/go/telemetry_tests.txt b/evidence/go/telemetry_tests.txt new file mode 100644 index 0000000..d957812 --- /dev/null +++ b/evidence/go/telemetry_tests.txt @@ -0,0 +1,18 @@ +=== RUN TestTracePropagationMapAndAMQP +--- PASS: TestTracePropagationMapAndAMQP (0.00s) +=== RUN TestTraceUnsampledSuppressesBackgroundSpans +--- PASS: TestTraceUnsampledSuppressesBackgroundSpans (0.00s) +=== RUN TestTraceLogCorrelation +--- PASS: TestTraceLogCorrelation (0.00s) +=== RUN TestTelemetrySetupBuildsProviders +--- PASS: TestTelemetrySetupBuildsProviders (0.01s) +PASS +ok github.com/charawein/mtusi2026lab7/internal/telemetry 0.011s +=== RUN TestTelemetryRouteTemplateAndStatus +--- PASS: TestTelemetryRouteTemplateAndStatus (0.00s) +PASS +ok github.com/charawein/mtusi2026lab7/internal/transport/http/middleware 0.006s +=== RUN TestPipelineTracePropagationThroughOutbox +--- PASS: TestPipelineTracePropagationThroughOutbox (0.70s) +PASS +ok github.com/charawein/mtusi2026lab7/internal/worker 0.705s diff --git a/evidence/go/track2/pipeline_fault_injection.txt b/evidence/go/track2/pipeline_fault_injection.txt new file mode 100644 index 0000000..7459f84 --- /dev/null +++ b/evidence/go/track2/pipeline_fault_injection.txt @@ -0,0 +1,39 @@ +=== RUN TestPipelineHappyPathAndDuplicate +2026/11/12 17:14:12 INFO duplicate delivery of finished job: ack without work job_id=171265b2-fafc-4d50-a4be-f79e7b3a46f4 attachment_id=240061d5-1d00-40f7-928a-d8fc1d9f2263 version=1 event=job.duplicate +--- PASS: TestPipelineHappyPathAndDuplicate (0.24s) +=== RUN TestPipelineConcurrentDuplicateIsBusy +2026/11/12 17:14:12 INFO job leased by another worker: ack duplicate job_id=4563f346-08b5-4df9-b910-4ef28949eff5 attachment_id=50d6d2d9-545c-4367-99d7-1e0905d4aa81 version=1 event=job.duplicate owner=slow-worker +--- PASS: TestPipelineConcurrentDuplicateIsBusy (0.17s) +=== RUN TestPipelineCrashAfterSideEffectBeforeCommit +2026/11/12 17:14:14 WARN FAULT INJECTION: crashing point=worker.after_side_effect +2026/11/12 17:14:14 INFO job leased by another worker: ack duplicate job_id=a2119a53-ef46-42e2-87c2-3374ef5d364a attachment_id=6af36eaf-d341-4f59-8437-6d0a41a41c94 version=1 event=job.duplicate owner=w-fd7888 +--- PASS: TestPipelineCrashAfterSideEffectBeforeCommit (3.05s) +=== RUN TestPipelineCrashAfterCommitBeforeAck +2026/11/12 17:14:15 WARN FAULT INJECTION: crashing point=worker.after_commit +2026/11/12 17:14:15 INFO duplicate delivery of finished job: ack without work job_id=764d00c1-7085-4f4d-8f0e-e5d1fce0d526 attachment_id=e8964090-117a-4651-b075-a04ab5935c70 version=1 event=job.duplicate +--- PASS: TestPipelineCrashAfterCommitBeforeAck (0.17s) +=== RUN TestPipelineRelayCrashAfterPublishDuplicates +2026/11/12 17:14:15 INFO duplicate delivery of finished job: ack without work job_id=3e545245-fc57-4d3c-82f1-95e7b0f21cc3 attachment_id=2f86dba8-b3d1-4a79-8f6d-9c4d3041d350 version=1 event=job.duplicate +--- PASS: TestPipelineRelayCrashAfterPublishDuplicates (0.17s) +=== RUN TestPipelineVersionReorderAndStaleJob +2026/11/12 17:14:15 INFO duplicate delivery of finished job: ack without work job_id=59e6b1aa-a4ce-4008-b6bd-3ed7918367d5 attachment_id=e440373b-b9fd-4654-9745-d814262eb7eb version=1 event=job.duplicate +--- PASS: TestPipelineVersionReorderAndStaleJob (0.20s) +=== RUN TestPipelineLostLeaseFencing +--- PASS: TestPipelineLostLeaseFencing (0.69s) +=== RUN TestPipelineTransientRetryWithBackoff +2026/11/12 17:14:16 WARN attempt failed job_id=fc0ed4e9-3a91-4fb8-ab2d-29543335a3d7 attachment_id=abeb1248-ee98-46e7-ac2e-29d868dd7efe version=1 event=job.retry attempt=1 code=processing_failed final=false backoff=145.861651ms +2026/11/12 17:14:16 INFO early delivery before backoff: ack, outbox will redeliver job_id=fc0ed4e9-3a91-4fb8-ab2d-29543335a3d7 attachment_id=abeb1248-ee98-46e7-ac2e-29d868dd7efe version=1 event=job.not_due +--- PASS: TestPipelineTransientRetryWithBackoff (0.69s) +=== RUN TestPipelinePermanentFailureAndReplay +2026/11/12 17:14:17 WARN attempt failed job_id=95e8e0c1-b10c-469c-b708-6b547cc2042c attachment_id=78f28e8b-ddd6-42f0-b80c-5b01a708f0fa version=1 event=job.failed attempt=1 code=checksum_mismatch final=true backoff=132.23852ms +--- PASS: TestPipelinePermanentFailureAndReplay (0.20s) +=== RUN TestPipelineRetryExhausted +2026/11/12 17:14:17 WARN attempt failed job_id=b86ec031-3705-40a5-a96d-219da34c55cb attachment_id=ef57db6e-fc00-44c1-aa33-29bbd3cb53e6 version=1 event=job.retry attempt=1 code=processing_failed final=false backoff=115.778267ms +2026/11/12 17:14:18 WARN attempt failed job_id=b86ec031-3705-40a5-a96d-219da34c55cb attachment_id=ef57db6e-fc00-44c1-aa33-29bbd3cb53e6 version=1 event=job.retry attempt=2 code=processing_failed final=false backoff=212.923342ms +2026/11/12 17:14:18 WARN attempt failed job_id=b86ec031-3705-40a5-a96d-219da34c55cb attachment_id=ef57db6e-fc00-44c1-aa33-29bbd3cb53e6 version=1 event=job.failed attempt=3 code=processing_failed final=true backoff=346.808043ms +--- PASS: TestPipelineRetryExhausted (1.63s) +=== RUN TestPipelineTracePropagationThroughOutbox +2026/11/12 17:14:19 WARN attempt failed job_id=d3e37ccd-f331-4f2d-add2-5f4f0c07dc82 attachment_id=71e4e1cd-a9a5-418c-867c-d1956ca5d5fd version=1 event=job.retry attempt=1 code=processing_failed final=false backoff=192.048206ms +--- PASS: TestPipelineTracePropagationThroughOutbox (0.67s) +PASS +ok github.com/charawein/mtusi2026lab7/internal/worker 7.886s diff --git a/evidence/go/webp_test.txt b/evidence/go/webp_test.txt new file mode 100644 index 0000000..23ab489 --- /dev/null +++ b/evidence/go/webp_test.txt @@ -0,0 +1,4 @@ +=== RUN TestOptimizedWebP +--- PASS: TestOptimizedWebP (0.34s) +PASS +ok github.com/charawein/mtusi2026lab7/internal/imaging 0.350s diff --git a/evidence/pipeline/README.md b/evidence/pipeline/README.md new file mode 100644 index 0000000..8df7001 --- /dev/null +++ b/evidence/pipeline/README.md @@ -0,0 +1,5 @@ +# Доказательства + +Храните небольшие обезличенные результаты: команды и stdout проверок, JSON/CSV агрегатов нагрузки, EXPLAIN, dashboard JSON, текст разбора отказа. Укажите дату, commit, аппаратные лимиты и профиль нагрузки. + +Не добавляйте .env, session tokens, cookies, приватные ключи, credentials, реальные сообщения, raw dumps и signed URLs. Для скриншотов скрывайте секреты. Большие логи/бинарные traces сохраняйте отдельно по правилам преподавателя; одного скриншота без методики недостаточно. diff --git a/evidence/pipeline/containers_state_pipeline.txt b/evidence/pipeline/containers_state_pipeline.txt new file mode 100644 index 0000000..b651c6e --- /dev/null +++ b/evidence/pipeline/containers_state_pipeline.txt @@ -0,0 +1,17 @@ +/mtusi2026lab7-api-1 restarts=0 oom_killed=false exit=0 +/mtusi2026lab7-api-2 restarts=0 oom_killed=false exit=0 +/mtusi2026lab7-grafana-1 restarts=0 oom_killed=false exit=0 +/mtusi2026lab7-lb-1 restarts=0 oom_killed=false exit=0 +/mtusi2026lab7-loki-1 restarts=0 oom_killed=false exit=0 +/mtusi2026lab7-openbao-1 restarts=0 oom_killed=false exit=0 +/mtusi2026lab7-otel-collector-1 restarts=0 oom_killed=false exit=0 +/mtusi2026lab7-postgres-1 restarts=0 oom_killed=false exit=0 +/mtusi2026lab7-prometheus-1 restarts=0 oom_killed=false exit=0 +/mtusi2026lab7-rabbitmq-1 restarts=0 oom_killed=false exit=0 +/mtusi2026lab7-reconciler-1 restarts=0 oom_killed=false exit=0 +/mtusi2026lab7-redis-1 restarts=0 oom_killed=false exit=0 +/mtusi2026lab7-relay-1 restarts=0 oom_killed=false exit=0 +/mtusi2026lab7-s3-1 restarts=0 oom_killed=false exit=0 +/mtusi2026lab7-tempo-1 restarts=0 oom_killed=false exit=0 +/mtusi2026lab7-tempo-init-1 restarts=0 oom_killed=false exit=0 +/mtusi2026lab7-worker-1 restarts=0 oom_killed=false exit=0 diff --git a/evidence/pipeline/docker_ps_final_pipeline.txt b/evidence/pipeline/docker_ps_final_pipeline.txt new file mode 100644 index 0000000..e65f682 --- /dev/null +++ b/evidence/pipeline/docker_ps_final_pipeline.txt @@ -0,0 +1,18 @@ +NAME IMAGE COMMAND SERVICE CREATED STATUS PORTS +mtusi2026lab7-api-1 mtusi2026lab7-api:local "/app/api" api About a minute ago Up About a minute (healthy) 8443/tcp +mtusi2026lab7-api-2 mtusi2026lab7-api:local "/app/api" api About a minute ago Up About a minute (healthy) 8443/tcp +mtusi2026lab7-grafana-1 grafana/grafana:11.4.0 "/run.sh" grafana About a minute ago Up About a minute (healthy) 127.0.0.1:3000->3000/tcp +mtusi2026lab7-lb-1 haproxy:3.0.5-alpine "docker-entrypoint.s…" lb About a minute ago Up About a minute 127.0.0.1:8443->8443/tcp +mtusi2026lab7-loki-1 grafana/loki:3.3.2 "/usr/bin/loki -conf…" loki About a minute ago Up About a minute 3100/tcp +mtusi2026lab7-openbao-1 openbao/openbao:2.1.0 "docker-entrypoint.s…" openbao 2 minutes ago Up 2 minutes 127.0.0.1:8200->8200/tcp +mtusi2026lab7-otel-collector-1 otel/opentelemetry-collector-contrib:0.116.1 "/otelcol-contrib --…" otel-collector About a minute ago Up About a minute 4317-4318/tcp, 55678-55679/tcp +mtusi2026lab7-postgres-1 postgres:16.4-alpine "sh -c 'install -o p…" postgres 2 minutes ago Up 2 minutes (healthy) 5432/tcp +mtusi2026lab7-prometheus-1 prom/prometheus:v3.1.0 "/bin/prometheus --c…" prometheus About a minute ago Up About a minute 9090/tcp +mtusi2026lab7-rabbitmq-1 rabbitmq:4.0.9-alpine "docker-entrypoint.s…" rabbitmq 2 minutes ago Up About a minute (healthy) 4369/tcp, 5671-5672/tcp, 15691-15692/tcp, 25672/tcp +mtusi2026lab7-reconciler-1 mtusi2026lab7-api:local "/app/reconcile --ap…" reconciler About a minute ago Up About a minute (healthy) 8443/tcp +mtusi2026lab7-redis-1 redis:7.4.1-alpine "docker-entrypoint.s…" redis 2 minutes ago Up 2 minutes (healthy) 6379/tcp +mtusi2026lab7-relay-1 mtusi2026lab7-api:local "/app/pipeline relay" relay About a minute ago Up About a minute (healthy) 8443/tcp +mtusi2026lab7-s3-1 bitnamilegacy/minio:2025.4.22@sha256:50cec18ac4184af4671a78aedd5554942c8ae105d51a465fa82037949046da01 "/bin/bash -c 'mkdir…" s3 2 minutes ago Up 38 seconds (healthy) 9000-9001/tcp +mtusi2026lab7-tempo-1 grafana/tempo:2.6.1 "/tempo -config.file…" tempo About a minute ago Up About a minute +mtusi2026lab7-tempo-init-1 grafana/tempo:2.6.1 "chown 10001:10001 /…" tempo-init About a minute ago Exited (0) About a minute ago +mtusi2026lab7-worker-1 mtusi2026lab7-api:local "/app/pipeline worker" worker 53 seconds ago Up 30 seconds (healthy) 8443/tcp diff --git a/evidence/pipeline/docker_stats_pipeline.txt b/evidence/pipeline/docker_stats_pipeline.txt new file mode 100644 index 0000000..108fa2b --- /dev/null +++ b/evidence/pipeline/docker_stats_pipeline.txt @@ -0,0 +1,16 @@ +mtusi2026lab7-worker-1 0.01% 14.95MiB / 768MiB +mtusi2026lab7-grafana-1 3.10% 69.02MiB / 256MiB +mtusi2026lab7-tempo-1 0.45% 61.38MiB / 1GiB +mtusi2026lab7-lb-1 0.24% 13.18MiB / 128MiB +mtusi2026lab7-relay-1 0.15% 11.93MiB / 128MiB +mtusi2026lab7-reconciler-1 0.00% 5.191MiB / 128MiB +mtusi2026lab7-api-2 0.21% 53.95MiB / 256MiB +mtusi2026lab7-otel-collector-1 1.03% 48.32MiB / 256MiB +mtusi2026lab7-loki-1 0.40% 61.48MiB / 1GiB +mtusi2026lab7-prometheus-1 0.43% 38.57MiB / 512MiB +mtusi2026lab7-api-1 0.15% 67.27MiB / 256MiB +mtusi2026lab7-postgres-1 2.44% 59.49MiB / 512MiB +mtusi2026lab7-s3-1 0.03% 211.7MiB / 512MiB +mtusi2026lab7-redis-1 0.41% 3.969MiB / 256MiB +mtusi2026lab7-rabbitmq-1 0.13% 76.74MiB / 512MiB +mtusi2026lab7-openbao-1 0.27% 23.18MiB / 256MiB diff --git a/evidence/pipeline/pipeline/crash-effect.json b/evidence/pipeline/pipeline/crash-effect.json new file mode 100644 index 0000000..4c90aa1 --- /dev/null +++ b/evidence/pipeline/pipeline/crash-effect.json @@ -0,0 +1,34 @@ +{ + "scenario": "crash-effect", + "result": { + "attachment_id": "c5db77aa-2a97-4eb8-a77a-d90e17d95e70", + "job_id": "7cc02c86-a5dc-44a7-baeb-f17c9198f1a5", + "worker_restarts": 1, + "attempt": 2, + "seconds_to_ready": 15.7, + "events": "enqueued,claimed,lease_expired_requeued,claimed,done", + "invariants": { + "status": "ready", + "published_version": 1, + "objects_per_version": { + "1": 3 + } + }, + "variants": { + "thumbnail": [ + 256, + 160 + ], + "crop": [ + 128, + 128 + ], + "optimized": [ + 320, + 200 + ], + "optimized_bytes": 2462, + "original_bytes": 111817 + } + } +} diff --git a/evidence/pipeline/pipeline/demo.json b/evidence/pipeline/pipeline/demo.json new file mode 100644 index 0000000..28cd2c6 --- /dev/null +++ b/evidence/pipeline/pipeline/demo.json @@ -0,0 +1,42 @@ +{ + "scenario": "demo", + "result": { + "attachment_id": "a9f29281-fb61-4dc2-be1a-bb051d221790", + "job_id": "208a569c-127b-4997-8598-f8ce2afc6843", + "job_state": "done", + "attempt": 1, + "timeline": [ + "worker stopped", + "upload 202 queued id=a9f29281-fb61-4dc2-be1a-bb051d221790", + "message 201 with queued attachment", + "content 409, other messages OK", + "api and rabbitmq restarted (volumes kept), outbox published=1", + "rabbitmq queues after restart: {'attachment.dead': 0, 'attachment.process': 1}", + "worker started → ready in 1.3 s" + ], + "variants": { + "thumbnail": [ + 256, + 160 + ], + "crop": [ + 128, + 128 + ], + "optimized": [ + 320, + 200 + ], + "optimized_bytes": 2462, + "original_bytes": 111817 + }, + "invariants": { + "status": "ready", + "published_version": 1, + "objects_per_version": { + "1": 3 + } + }, + "events": "enqueued,claimed,done" + } +} diff --git a/evidence/pipeline/pipeline/failed-replay.json b/evidence/pipeline/pipeline/failed-replay.json new file mode 100644 index 0000000..386c53b --- /dev/null +++ b/evidence/pipeline/pipeline/failed-replay.json @@ -0,0 +1,36 @@ +{ + "scenario": "failed-replay", + "result": { + "attachment_id": "03387194-01c7-4af3-8c05-2494b53db329", + "failed_error_code": "checksum_mismatch", + "content_while_failed": 409, + "attach_failed_to_message": 409, + "registry_listed": true, + "replay": { + "attachment_id": "03387194-01c7-4af3-8c05-2494b53db329", + "command": "replay", + "error": "", + "job_id": "c56192e9-dc8c-400b-a33b-09e66e0ecd3d", + "ok": true, + "version": 1 + }, + "replay_after_success": { + "attachment_id": "03387194-01c7-4af3-8c05-2494b53db329", + "command": "replay", + "error": "conflict: job is done, only failed jobs can be replayed", + "job_id": "c56192e9-dc8c-400b-a33b-09e66e0ecd3d", + "ok": false, + "version": 1 + }, + "final_status": "ready", + "events": "enqueued,claimed,failed,replay,claimed,done,replay_refused", + "dlq_messages": 1, + "invariants": { + "status": "ready", + "published_version": 1, + "objects_per_version": { + "1": 3 + } + } + } +} diff --git a/evidence/pipeline/pipeline/obs_signals.json b/evidence/pipeline/pipeline/obs_signals.json new file mode 100644 index 0000000..be3f10a --- /dev/null +++ b/evidence/pipeline/pipeline/obs_signals.json @@ -0,0 +1,925 @@ +{ + "scenario": "signals", + "result": { + "request": { + "request_id": "obs-msg-cce45e31e6b242e6", + "trace_id": "54ff4aa532f0179348c36bde4be6e8d2", + "spans": [ + { + "service": "messenger-api", + "name": "POST /api/v1/chats/{chat_id}/messages", + "kind": "SPAN_KIND_SERVER", + "ms": 2.4, + "parent": null, + "outcome": null, + "attempt": null, + "status": "" + }, + { + "service": "messenger-api", + "name": "get", + "kind": "SPAN_KIND_CLIENT", + "ms": 0.08, + "parent": "messenger-api: POST /api/v1/chats/{chat_id}/messages", + "outcome": null, + "attempt": null, + "status": "" + }, + { + "service": "messenger-api", + "name": "ttl", + "kind": "SPAN_KIND_CLIENT", + "ms": 0.03, + "parent": "messenger-api: POST /api/v1/chats/{chat_id}/messages", + "outcome": null, + "attempt": null, + "status": "" + }, + { + "service": "messenger-api", + "name": "pool.acquire", + "kind": "SPAN_KIND_CLIENT", + "ms": 0.01, + "parent": "messenger-api: POST /api/v1/chats/{chat_id}/messages", + "outcome": null, + "attempt": null, + "status": "" + }, + { + "service": "messenger-api", + "name": "SELECT", + "kind": "SPAN_KIND_CLIENT", + "ms": 0.22, + "parent": "messenger-api: POST /api/v1/chats/{chat_id}/messages", + "outcome": null, + "attempt": null, + "status": "" + }, + { + "service": "messenger-api", + "name": "pool.acquire", + "kind": "SPAN_KIND_CLIENT", + "ms": 0.0, + "parent": "messenger-api: POST /api/v1/chats/{chat_id}/messages", + "outcome": null, + "attempt": null, + "status": "" + }, + { + "service": "messenger-api", + "name": "SELECT", + "kind": "SPAN_KIND_CLIENT", + "ms": 0.17, + "parent": "messenger-api: POST /api/v1/chats/{chat_id}/messages", + "outcome": null, + "attempt": null, + "status": "" + }, + { + "service": "messenger-api", + "name": "pool.acquire", + "kind": "SPAN_KIND_CLIENT", + "ms": 0.0, + "parent": "messenger-api: POST /api/v1/chats/{chat_id}/messages", + "outcome": null, + "attempt": null, + "status": "" + }, + { + "service": "messenger-api", + "name": "BEGIN", + "kind": "SPAN_KIND_CLIENT", + "ms": 0.07, + "parent": "messenger-api: POST /api/v1/chats/{chat_id}/messages", + "outcome": null, + "attempt": null, + "status": "" + }, + { + "service": "messenger-api", + "name": "DELETE", + "kind": "SPAN_KIND_CLIENT", + "ms": 0.2, + "parent": "messenger-api: POST /api/v1/chats/{chat_id}/messages", + "outcome": null, + "attempt": null, + "status": "" + }, + { + "service": "messenger-api", + "name": "INSERT", + "kind": "SPAN_KIND_CLIENT", + "ms": 0.21, + "parent": "messenger-api: POST /api/v1/chats/{chat_id}/messages", + "outcome": null, + "attempt": null, + "status": "" + }, + { + "service": "messenger-api", + "name": "INSERT", + "kind": "SPAN_KIND_CLIENT", + "ms": 0.62, + "parent": "messenger-api: POST /api/v1/chats/{chat_id}/messages", + "outcome": null, + "attempt": null, + "status": "" + } + ], + "log": { + "line": "http request", + "labels": { + "detected_level": "info", + "event": "http.request", + "request_id": "obs-msg-cce45e31e6b242e6", + "route": "/api/v1/chats/{chat_id}/messages", + "service_name": "messenger-api", + "severity_text": "INFO", + "span_id": "19644ee5c6ed3f4f", + "status": "201", + "trace_id": "54ff4aa532f0179348c36bde4be6e8d2" + } + } + }, + "upload": { + "request_id": "obs-upload-93e4699646f94751", + "trace_id": "c305c32ab42753aedfec890c69c52ced", + "services": [ + "messenger-api", + "messenger-relay", + "messenger-worker" + ], + "links": { + "api server → relay producer": true, + "relay producer → worker consumer": true, + "worker consumer → S3 PUT": true, + "worker consumer → image.decode": true + }, + "span_count": 56, + "worker_db_spans": [ + "BEGIN", + "COMMIT", + "INSERT", + "SELECT", + "UPDATE", + "batch start", + "pool.acquire" + ], + "tree": [ + { + "service": "messenger-api", + "name": "POST /api/v1/chats/{chat_id}/attachments", + "kind": "SPAN_KIND_SERVER", + "ms": 11.88, + "parent": null, + "outcome": null, + "attempt": null, + "status": "" + }, + { + "service": "messenger-api", + "name": "get", + "kind": "SPAN_KIND_CLIENT", + "ms": 0.13, + "parent": "messenger-api: POST /api/v1/chats/{chat_id}/attachments", + "outcome": null, + "attempt": null, + "status": "" + }, + { + "service": "messenger-api", + "name": "ttl", + "kind": "SPAN_KIND_CLIENT", + "ms": 0.04, + "parent": "messenger-api: POST /api/v1/chats/{chat_id}/attachments", + "outcome": null, + "attempt": null, + "status": "" + }, + { + "service": "messenger-api", + "name": "pool.acquire", + "kind": "SPAN_KIND_CLIENT", + "ms": 0.01, + "parent": "messenger-api: POST /api/v1/chats/{chat_id}/attachments", + "outcome": null, + "attempt": null, + "status": "" + }, + { + "service": "messenger-api", + "name": "SELECT", + "kind": "SPAN_KIND_CLIENT", + "ms": 0.17, + "parent": "messenger-api: POST /api/v1/chats/{chat_id}/attachments", + "outcome": null, + "attempt": null, + "status": "" + }, + { + "service": "messenger-api", + "name": "pool.acquire", + "kind": "SPAN_KIND_CLIENT", + "ms": 0.01, + "parent": "messenger-api: POST /api/v1/chats/{chat_id}/attachments", + "outcome": null, + "attempt": null, + "status": "" + }, + { + "service": "messenger-api", + "name": "SELECT", + "kind": "SPAN_KIND_CLIENT", + "ms": 0.26, + "parent": "messenger-api: POST /api/v1/chats/{chat_id}/attachments", + "outcome": null, + "attempt": null, + "status": "" + }, + { + "service": "messenger-api", + "name": "SELECT", + "kind": "SPAN_KIND_CLIENT", + "ms": 0.1, + "parent": "messenger-api: SELECT", + "outcome": null, + "attempt": null, + "status": "" + }, + { + "service": "messenger-api", + "name": "pool.acquire", + "kind": "SPAN_KIND_CLIENT", + "ms": 0.0, + "parent": "messenger-api: POST /api/v1/chats/{chat_id}/attachments", + "outcome": null, + "attempt": null, + "status": "" + }, + { + "service": "messenger-api", + "name": "INSERT", + "kind": "SPAN_KIND_CLIENT", + "ms": 0.72, + "parent": "messenger-api: POST /api/v1/chats/{chat_id}/attachments", + "outcome": null, + "attempt": null, + "status": "" + }, + { + "service": "messenger-api", + "name": "INSERT", + "kind": "SPAN_KIND_CLIENT", + "ms": 0.11, + "parent": "messenger-api: INSERT", + "outcome": null, + "attempt": null, + "status": "" + }, + { + "service": "messenger-api", + "name": "S3 PUT", + "kind": "SPAN_KIND_CLIENT", + "ms": 4.88, + "parent": "messenger-api: POST /api/v1/chats/{chat_id}/attachments", + "outcome": null, + "attempt": null, + "status": "" + }, + { + "service": "messenger-api", + "name": "pool.acquire", + "kind": "SPAN_KIND_CLIENT", + "ms": 0.01, + "parent": "messenger-api: POST /api/v1/chats/{chat_id}/attachments", + "outcome": null, + "attempt": null, + "status": "" + }, + { + "service": "messenger-api", + "name": "BEGIN", + "kind": "SPAN_KIND_CLIENT", + "ms": 0.1, + "parent": "messenger-api: POST /api/v1/chats/{chat_id}/attachments", + "outcome": null, + "attempt": null, + "status": "" + }, + { + "service": "messenger-api", + "name": "UPDATE", + "kind": "SPAN_KIND_CLIENT", + "ms": 0.61, + "parent": "messenger-api: POST /api/v1/chats/{chat_id}/attachments", + "outcome": null, + "attempt": null, + "status": "" + }, + { + "service": "messenger-api", + "name": "UPDATE", + "kind": "SPAN_KIND_CLIENT", + "ms": 0.1, + "parent": "messenger-api: UPDATE", + "outcome": null, + "attempt": null, + "status": "" + }, + { + "service": "messenger-api", + "name": "INSERT", + "kind": "SPAN_KIND_CLIENT", + "ms": 0.87, + "parent": "messenger-api: POST /api/v1/chats/{chat_id}/attachments", + "outcome": null, + "attempt": null, + "status": "" + }, + { + "service": "messenger-api", + "name": "INSERT", + "kind": "SPAN_KIND_CLIENT", + "ms": 0.28, + "parent": "messenger-api: INSERT", + "outcome": null, + "attempt": null, + "status": "" + }, + { + "service": "messenger-api", + "name": "INSERT", + "kind": "SPAN_KIND_CLIENT", + "ms": 0.92, + "parent": "messenger-api: POST /api/v1/chats/{chat_id}/attachments", + "outcome": null, + "attempt": null, + "status": "" + }, + { + "service": "messenger-api", + "name": "INSERT", + "kind": "SPAN_KIND_CLIENT", + "ms": 0.25, + "parent": "messenger-api: INSERT", + "outcome": null, + "attempt": null, + "status": "" + }, + { + "service": "messenger-api", + "name": "INSERT", + "kind": "SPAN_KIND_CLIENT", + "ms": 1.94, + "parent": "messenger-api: POST /api/v1/chats/{chat_id}/attachments", + "outcome": null, + "attempt": null, + "status": "" + }, + { + "service": "messenger-api", + "name": "INSERT", + "kind": "SPAN_KIND_CLIENT", + "ms": 1.37, + "parent": "messenger-api: INSERT", + "outcome": null, + "attempt": null, + "status": "" + }, + { + "service": "messenger-api", + "name": "COMMIT", + "kind": "SPAN_KIND_CLIENT", + "ms": 0.61, + "parent": "messenger-api: POST /api/v1/chats/{chat_id}/attachments", + "outcome": null, + "attempt": null, + "status": "" + }, + { + "service": "messenger-relay", + "name": "attachment.process publish", + "kind": "SPAN_KIND_PRODUCER", + "ms": 1.07, + "parent": "messenger-api: POST /api/v1/chats/{chat_id}/attachments", + "outcome": null, + "attempt": null, + "status": "" + }, + { + "service": "messenger-worker", + "name": "attachment.process process", + "kind": "SPAN_KIND_CONSUMER", + "ms": 30.84, + "parent": "messenger-relay: attachment.process publish", + "outcome": "done", + "attempt": "1", + "status": "" + }, + { + "service": "messenger-worker", + "name": "pool.acquire", + "kind": "SPAN_KIND_CLIENT", + "ms": 0.28, + "parent": "messenger-worker: attachment.process process", + "outcome": null, + "attempt": null, + "status": "" + }, + { + "service": "messenger-worker", + "name": "BEGIN", + "kind": "SPAN_KIND_CLIENT", + "ms": 0.07, + "parent": "messenger-worker: attachment.process process", + "outcome": null, + "attempt": null, + "status": "" + }, + { + "service": "messenger-worker", + "name": "SELECT", + "kind": "SPAN_KIND_CLIENT", + "ms": 0.26, + "parent": "messenger-worker: attachment.process process", + "outcome": null, + "attempt": null, + "status": "" + }, + { + "service": "messenger-worker", + "name": "SELECT", + "kind": "SPAN_KIND_CLIENT", + "ms": 0.08, + "parent": "messenger-worker: attachment.process process", + "outcome": null, + "attempt": null, + "status": "" + }, + { + "service": "messenger-worker", + "name": "SELECT", + "kind": "SPAN_KIND_CLIENT", + "ms": 0.17, + "parent": "messenger-worker: attachment.process process", + "outcome": null, + "attempt": null, + "status": "" + }, + { + "service": "messenger-worker", + "name": "UPDATE", + "kind": "SPAN_KIND_CLIENT", + "ms": 0.2, + "parent": "messenger-worker: attachment.process process", + "outcome": null, + "attempt": null, + "status": "" + }, + { + "service": "messenger-worker", + "name": "UPDATE", + "kind": "SPAN_KIND_CLIENT", + "ms": 0.21, + "parent": "messenger-worker: attachment.process process", + "outcome": null, + "attempt": null, + "status": "" + }, + { + "service": "messenger-worker", + "name": "INSERT", + "kind": "SPAN_KIND_CLIENT", + "ms": 0.1, + "parent": "messenger-worker: attachment.process process", + "outcome": null, + "attempt": null, + "status": "" + }, + { + "service": "messenger-worker", + "name": "COMMIT", + "kind": "SPAN_KIND_CLIENT", + "ms": 0.13, + "parent": "messenger-worker: attachment.process process", + "outcome": null, + "attempt": null, + "status": "" + }, + { + "service": "messenger-worker", + "name": "S3 HEAD", + "kind": "SPAN_KIND_CLIENT", + "ms": 0.91, + "parent": "messenger-worker: attachment.process process", + "outcome": null, + "attempt": null, + "status": "" + }, + { + "service": "messenger-worker", + "name": "S3 GET", + "kind": "SPAN_KIND_CLIENT", + "ms": 1.19, + "parent": "messenger-worker: attachment.process process", + "outcome": null, + "attempt": null, + "status": "" + }, + { + "service": "messenger-worker", + "name": "image.decode", + "kind": "SPAN_KIND_INTERNAL", + "ms": 1.74, + "parent": "messenger-worker: attachment.process process", + "outcome": null, + "attempt": null, + "status": "" + }, + { + "service": "messenger-worker", + "name": "image.variants", + "kind": "SPAN_KIND_INTERNAL", + "ms": 16.56, + "parent": "messenger-worker: attachment.process process", + "outcome": null, + "attempt": null, + "status": "" + }, + { + "service": "messenger-worker", + "name": "S3 PUT", + "kind": "SPAN_KIND_CLIENT", + "ms": 1.29, + "parent": "messenger-worker: attachment.process process", + "outcome": null, + "attempt": null, + "status": "" + }, + { + "service": "messenger-worker", + "name": "S3 PUT", + "kind": "SPAN_KIND_CLIENT", + "ms": 0.99, + "parent": "messenger-worker: attachment.process process", + "outcome": null, + "attempt": null, + "status": "" + } + ], + "worker_log_events": [ + "job.claimed", + "job.done" + ] + }, + "metrics": { + "found": { + "http requests (counter = _count)": { + "series": 16, + "names": [ + "http_server_request_duration_seconds_count" + ] + }, + "http duration histogram (s)": { + "series": 224, + "names": [ + "http_server_request_duration_seconds_bucket" + ] + }, + "jobs processed by outcome": { + "series": 6, + "names": [ + "messenger_jobs_processed_total" + ] + }, + "job duration histogram (s)": { + "series": 56, + "names": [ + "messenger_job_duration_seconds_bucket" + ] + }, + "time to ready histogram (s)": { + "series": 28, + "names": [ + "messenger_attachment_time_to_ready_seconds_bucket" + ] + }, + "queue backlog by state": { + "series": 3, + "names": [ + "messenger_jobs_backlog" + ] + }, + "oldest job age (s)": { + "series": 1, + "names": [ + "messenger_jobs_oldest_age_seconds" + ] + }, + "outbox pending": { + "series": 1, + "names": [ + "messenger_outbox_pending" + ] + }, + "rabbitmq queue messages": { + "series": 2, + "names": [ + "rabbitmq_queue_messages_ready" + ] + }, + "worker busy": { + "series": 2, + "names": [ + "messenger_worker_busy" + ] + }, + "worker capacity": { + "series": 2, + "names": [ + "messenger_worker_capacity" + ] + }, + "db pool acquired": { + "series": 5, + "names": [ + "pgxpool_acquired_connections" + ] + }, + "db pool waits": { + "series": 10, + "names": [ + "pgxpool_empty_acquire_total", + "pgxpool_empty_acquire_wait_time_nanoseconds_total" + ] + }, + "process cpu": { + "series": 10, + "names": [ + "process_cpu_time_seconds_total" + ] + }, + "go memory": { + "series": 10, + "names": [ + "go_memory_used_bytes" + ] + } + }, + "labels_total": 129, + "forbidden_labels": [], + "http_route_values": [ + "/api/v1/attachments/{attachment_id}", + "/api/v1/attachments/{attachment_id}/content", + "/api/v1/auth/sessions", + "/api/v1/chats", + "/api/v1/chats/{chat_id}/attachments", + "/api/v1/chats/{chat_id}/messages", + "/api/v1/users", + "/health/live", + "/health/ready" + ], + "example_series_labels": [ + "__name__", + "http_request_method", + "http_response_status_class", + "http_response_status_code", + "http_route", + "instance", + "job" + ] + }, + "leak_check": { + "loki:password": 0, + "loki:session_token": 0, + "loki:message_text": 0, + "loki:bearer_header": 0, + "tempo:password": 0, + "tempo:session_token": 0, + "tempo:message_text": 0, + "tempo:bearer_header": 0, + "stdout:password": 0, + "stdout:session_token": 0, + "stdout:message_text": 0, + "stdout:bearer_header": 0 + }, + "grafana": { + "datasources": [ + "loki:loki", + "prometheus:prometheus", + "tempo:tempo" + ], + "dashboard": "Messenger — API, worker, очередь", + "panels": 30, + "prometheus_targets": 39, + "targets_without_data_now": [ + { + "panel": "Ready быстрее 30 s (5m)", + "legend": "", + "series": 0 + } + ], + "targets": [ + { + "panel": "RPS API (бизнес)", + "legend": "", + "series": 1 + }, + { + "panel": "Доля 5xx (1m)", + "legend": "", + "series": 1 + }, + { + "panel": "Быстрее 250 ms (5m)", + "legend": "", + "series": 1 + }, + { + "panel": "Ready быстрее 30 s (5m)", + "legend": "", + "series": 0 + }, + { + "panel": "Старейшая job", + "legend": "", + "series": 1 + }, + { + "panel": "Alerts firing", + "legend": "", + "series": 1 + }, + { + "panel": "RPS по маршруту и классу ответа", + "legend": "{{http_route}} {{http_response_status_class}}", + "series": 9 + }, + { + "panel": "Задержка API p50 / p95 / p99 (все реплики)", + "legend": "p50", + "series": 1 + }, + { + "panel": "Задержка API p50 / p95 / p99 (все реплики)", + "legend": "p95", + "series": 1 + }, + { + "panel": "Задержка API p50 / p95 / p99 (все реплики)", + "legend": "p99", + "series": 1 + }, + { + "panel": "Доля ошибок 5xx и 4xx", + "legend": "5xx / все", + "series": 1 + }, + { + "panel": "Доля ошибок 5xx и 4xx", + "legend": "4xx / все (ошибки клиента)", + "series": 1 + }, + { + "panel": "p95 по маршруту", + "legend": "{{http_route}}", + "series": 7 + }, + { + "panel": "Запросы в обработке (in-flight) по реплике", + "legend": "{{instance}}", + "series": 2 + }, + { + "panel": "Jobs по исходу (rate)", + "legend": "{{outcome}}", + "series": 5 + }, + { + "panel": "Длительность обработки job p50 / p95 / p99", + "legend": "p50", + "series": 1 + }, + { + "panel": "Длительность обработки job p50 / p95 / p99", + "legend": "p95", + "series": 1 + }, + { + "panel": "Длительность обработки job p50 / p95 / p99", + "legend": "p99", + "series": 1 + }, + { + "panel": "Время до ready (202 → ready) p50 / p95", + "legend": "p50", + "series": 1 + }, + { + "panel": "Время до ready (202 → ready) p50 / p95", + "legend": "p95", + "series": 1 + }, + { + "panel": "Очередь: jobs по состоянию (PostgreSQL)", + "legend": "{{state}}", + "series": 3 + }, + { + "panel": "Очередь: jobs по состоянию (PostgreSQL)", + "legend": "outbox не опубликовано", + "series": 1 + }, + { + "panel": "Возраст старейшей job / outbox", + "legend": "job (queued/processing)", + "series": 1 + }, + { + "panel": "Возраст старейшей job / outbox", + "legend": "outbox", + "series": 1 + }, + { + "panel": "RabbitMQ: сообщения в очередях", + "legend": "ready {{queue}}", + "series": 2 + }, + { + "panel": "RabbitMQ: сообщения в очередях", + "legend": "unacked {{queue}}", + "series": 2 + }, + { + "panel": "Saturation worker (busy / capacity)", + "legend": "занято слотов", + "series": 1 + }, + { + "panel": "Publish outbox → broker (confirm) p95", + "legend": "p95", + "series": 1 + }, + { + "panel": "Publish outbox → broker (confirm) p95", + "legend": "сообщений/с", + "series": 1 + }, + { + "panel": "Пул БД: занято / ожидания", + "legend": "занято {{job}}", + "series": 3 + }, + { + "panel": "Пул БД: занято / ожидания", + "legend": "max {{job}}", + "series": 3 + }, + { + "panel": "Пул БД: занято / ожидания", + "legend": "ожиданий/с {{job}}", + "series": 3 + }, + { + "panel": "CPU процессов", + "legend": "{{job}} {{instance}}", + "series": 8 + }, + { + "panel": "Память Go (used)", + "legend": "{{job}} {{instance}}", + "series": 5 + }, + { + "panel": "Collector: принято / отправлено / потеряно spans", + "legend": "принято", + "series": 1 + }, + { + "panel": "Collector: принято / отправлено / потеряно spans", + "legend": "отправлено", + "series": 1 + }, + { + "panel": "Collector: принято / отправлено / потеряно spans", + "legend": "не доставлено", + "series": 1 + }, + { + "panel": "Collector: принято / отправлено / потеряно spans", + "legend": "отклонено (memory_limiter)", + "series": 1 + }, + { + "panel": "Collector: принято / отправлено / потеряно spans", + "legend": "очередь экспортёров", + "series": 1 + } + ] + }, + "attachment": { + "id": "acee78cc-11ee-453d-9696-426654a97f27", + "status": "ready" + } + } +} diff --git a/evidence/pipeline/pipeline/transient.json b/evidence/pipeline/pipeline/transient.json new file mode 100644 index 0000000..e234d49 --- /dev/null +++ b/evidence/pipeline/pipeline/transient.json @@ -0,0 +1,17 @@ +{ + "scenario": "transient", + "result": { + "attachment_id": "570e91a8-1d7c-425f-9d03-170050581f4a", + "attempts": 3, + "final_status": "ready", + "retry_details": "processing_failed; next_attempt=2 in 1.999s | processing_failed; next_attempt=3 in 3.134s", + "events": "enqueued,claimed,retry_scheduled,claimed,retry_scheduled,claimed,done", + "invariants": { + "status": "ready", + "published_version": 1, + "objects_per_version": { + "1": 3 + } + } + } +} diff --git a/evidence/pipeline/runner_pipeline.txt b/evidence/pipeline/runner_pipeline.txt new file mode 100644 index 0000000..8024717 --- /dev/null +++ b/evidence/pipeline/runner_pipeline.txt @@ -0,0 +1,6 @@ +2 + total used free shared buff/cache available +Mem: 7776 1885 1172 90 5114 5890 +Swap: 3071 0 3071 +28.0.4 +Docker Compose version v2.38.2 diff --git a/evidence/scan/README.md b/evidence/scan/README.md new file mode 100644 index 0000000..8df7001 --- /dev/null +++ b/evidence/scan/README.md @@ -0,0 +1,5 @@ +# Доказательства + +Храните небольшие обезличенные результаты: команды и stdout проверок, JSON/CSV агрегатов нагрузки, EXPLAIN, dashboard JSON, текст разбора отказа. Укажите дату, commit, аппаратные лимиты и профиль нагрузки. + +Не добавляйте .env, session tokens, cookies, приватные ключи, credentials, реальные сообщения, raw dumps и signed URLs. Для скриншотов скрывайте секреты. Большие логи/бинарные traces сохраняйте отдельно по правилам преподавателя; одного скриншота без методики недостаточно. diff --git a/evidence/scan/TRIAGE.md b/evidence/scan/TRIAGE.md new file mode 100644 index 0000000..043d4bd --- /dev/null +++ b/evidence/scan/TRIAGE.md @@ -0,0 +1,33 @@ +# Разбор сканирования зависимостей и образов + +Прогон: https://github.com/CharaWein/2026_lab3/actions/runs/43267046991 (commit a414221). +Инструменты: govulncheck v1.1.4 (Go-код, анализ достижимости), Trivy 0.58.1 (`--severity HIGH,CRITICAL --scanners vuln`). +Полные JSON Trivy в репозиторий не кладутся (около 1.7 MiB); здесь сводка и решения. + +## Код приложения (govulncheck) + +`govulncheck.txt`: **0 уязвимостей в вызываемом коде**. В модулях-зависимостях найдено 2 уязвимости, но код +их не вызывает (символов нет в графе вызовов) — неприменимо. + +История: на Go 1.26.0 govulncheck показывал 38 достижимых уязвимостей стандартной библиотеки +(crypto/tls, net/http, crypto/x509 — всё это используется: TLS-сервер API, mTLS-клиенты). Исправлено переходом +на Go 1.26.11 (`go.mod toolchain`, `golang:1.26.11-alpine` в Dockerfile) и `golang.org/x/net v0.62.0`. + +## Образ приложения mtusi2026lab7-api:local + +**0 HIGH/CRITICAL.** До исправления — 2 HIGH: musl / musl-utils CVE-2026-107891 (1.2.5-r3, исправлено в 1.2.5-r4). +Исправление — `apk --no-cache upgrade` в runtime-слое Dockerfile. + +## Сторонние образы стенда + +| Образ | HIGH/CRITICAL | Есть исправленная версия | Где | Применимость и решение | +| --- | --- | --- | --- | --- | +| postgres:16.4-alpine | 31 (OS) + 60 (gosu) | все | OpenSSL 3.3.2, libxml2/libxslt, musl, zlib; `gosu` собран Go 1.18 | OpenSSL: PostgreSQL принимает TLS только из сети `back` (порт не опубликован) — ошибки разбора сертификатов/CMS/PKCS#12 достижимы лишь для процесса внутри стенда; libxml2/libxslt — только XML-функции SQL, приложение их не вызывает; `gosu` работает один раз при старте (смена пользователя), сетевых обработчиков Go не содержит. **Решение:** обновить до последнего патча 16.x (тот же major, миграции не нужны) — следующий шаг. | +| redis:7.4.1-alpine | 23 (OS) + 60 (gosu) | все | OpenSSL, musl, zlib; `gosu` | TLS-порт Redis только в сети `back`, plaintext выключен (`port 0`), ACL `default off`. **Решение:** обновить до последнего 7.4.x. | +| haproxy:3.0.5-alpine | 23 (OS) | все | OpenSSL 3.3.2, musl, zlib | **Самое применимое**: HAProxy — единственный TLS ingress, опубликован на `127.0.0.1:8443` и терминирует TLS клиентов. CVE-2025-15467 (переполнение при разборе) и CVE-2026-28387 (use-after-free) касаются OpenSSL, который обрабатывает внешние handshake. Смягчение сейчас: публикация только на loopback хоста, TLS ≥ 1.2. **Решение:** обновить до последнего 3.0.x — первое в списке. | +| openbao/openbao:2.1.0 | 28 (OS) + 63 (bin/bao) | 87 из 91 | OpenSSL, musl, libcap; в бинарнике — stdlib Go, x/crypto, x/net, grpc, go-jose, docker/docker | OpenBao слушает только сеть `back` и `127.0.0.1` хоста. Модули docker/docker и pgproto3 относятся к неиспользуемым плагинам (secrets engines Docker/PostgreSQL у нас не включены); stdlib/x/net/x/crypto — применимы к его TLS-листенеру. **Решение:** обновить до актуального 2.x (данные — file storage, совместимы). | +| rabbitmq:4.0.9-alpine | 0 | — | — | — | + +Итого: в собственном коде и образе HIGH/CRITICAL нет; в сторонних образах находки есть, почти все имеют исправленную +версию, но обновление версий сторонних компонентов в этой работе не сделано — оно меняет поведение стенда и требует +отдельного прогона всех сценариев. Это осознанно оставленный риск с порядком обновления: haproxy → openbao → postgres → redis. diff --git a/evidence/scan/govulncheck.txt b/evidence/scan/govulncheck.txt new file mode 100644 index 0000000..aa02fd4 --- /dev/null +++ b/evidence/scan/govulncheck.txt @@ -0,0 +1,9 @@ +=== Symbol Results === + +No vulnerabilities found. + +Your code is affected by 0 vulnerabilities. +This scan also found 0 vulnerabilities in packages you import and 2 +vulnerabilities in modules you require, but your code doesn't appear to call +these vulnerabilities. +Use '-show verbose' for more details. diff --git a/evidence/scan/trivy_summary.txt b/evidence/scan/trivy_summary.txt new file mode 100644 index 0000000..0615bb4 --- /dev/null +++ b/evidence/scan/trivy_summary.txt @@ -0,0 +1,6 @@ +mtusi2026lab7-api:local 0 HIGH/CRITICAL [] +postgres:16.4-alpine 91 HIGH/CRITICAL ['libcrypto3', 'libssl3', 'libxml2', 'libxslt', 'musl', 'musl-utils', 'stdlib', 'xz-libs', 'zlib'] +redis:7.4.1-alpine 83 HIGH/CRITICAL ['libcrypto3', 'libssl3', 'musl', 'musl-utils', 'stdlib', 'zlib'] +rabbitmq:4.0.9-alpine 0 HIGH/CRITICAL [] +haproxy:3.0.5-alpine 23 HIGH/CRITICAL ['libcrypto3', 'libssl3', 'musl', 'musl-utils', 'zlib'] +openbao/openbao:2.1.0 91 HIGH/CRITICAL ['github.com/docker/docker', 'github.com/go-jose/go-jose/v3', 'github.com/golang-jwt/jwt/v4', 'github.com/golang-jwt/jwt/v5', 'github.com/jackc/pgproto3/v2', 'github.com/klauspost/compress', 'go.opentelemetry.io/otel/sdk', 'golang.org/x/crypto', 'golang.org/x/net', 'golang.org/x/oauth2', 'golang.org/x/text', 'google.golang.org/grpc', 'libcap', 'libcap-getcap', 'libcap-setcap'] diff --git a/evidence/security/README.md b/evidence/security/README.md new file mode 100644 index 0000000..8df7001 --- /dev/null +++ b/evidence/security/README.md @@ -0,0 +1,5 @@ +# Доказательства + +Храните небольшие обезличенные результаты: команды и stdout проверок, JSON/CSV агрегатов нагрузки, EXPLAIN, dashboard JSON, текст разбора отказа. Укажите дату, commit, аппаратные лимиты и профиль нагрузки. + +Не добавляйте .env, session tokens, cookies, приватные ключи, credentials, реальные сообщения, raw dumps и signed URLs. Для скриншотов скрывайте секреты. Большие логи/бинарные traces сохраняйте отдельно по правилам преподавателя; одного скриншота без методики недостаточно. diff --git a/evidence/security/containers_state_security.txt b/evidence/security/containers_state_security.txt new file mode 100644 index 0000000..b651c6e --- /dev/null +++ b/evidence/security/containers_state_security.txt @@ -0,0 +1,17 @@ +/mtusi2026lab7-api-1 restarts=0 oom_killed=false exit=0 +/mtusi2026lab7-api-2 restarts=0 oom_killed=false exit=0 +/mtusi2026lab7-grafana-1 restarts=0 oom_killed=false exit=0 +/mtusi2026lab7-lb-1 restarts=0 oom_killed=false exit=0 +/mtusi2026lab7-loki-1 restarts=0 oom_killed=false exit=0 +/mtusi2026lab7-openbao-1 restarts=0 oom_killed=false exit=0 +/mtusi2026lab7-otel-collector-1 restarts=0 oom_killed=false exit=0 +/mtusi2026lab7-postgres-1 restarts=0 oom_killed=false exit=0 +/mtusi2026lab7-prometheus-1 restarts=0 oom_killed=false exit=0 +/mtusi2026lab7-rabbitmq-1 restarts=0 oom_killed=false exit=0 +/mtusi2026lab7-reconciler-1 restarts=0 oom_killed=false exit=0 +/mtusi2026lab7-redis-1 restarts=0 oom_killed=false exit=0 +/mtusi2026lab7-relay-1 restarts=0 oom_killed=false exit=0 +/mtusi2026lab7-s3-1 restarts=0 oom_killed=false exit=0 +/mtusi2026lab7-tempo-1 restarts=0 oom_killed=false exit=0 +/mtusi2026lab7-tempo-init-1 restarts=0 oom_killed=false exit=0 +/mtusi2026lab7-worker-1 restarts=0 oom_killed=false exit=0 diff --git a/evidence/security/docker_ps_final_security.txt b/evidence/security/docker_ps_final_security.txt new file mode 100644 index 0000000..1da4e01 --- /dev/null +++ b/evidence/security/docker_ps_final_security.txt @@ -0,0 +1,18 @@ +NAME IMAGE COMMAND SERVICE CREATED STATUS PORTS +mtusi2026lab7-api-1 mtusi2026lab7-api:local "/app/api" api 5 minutes ago Up 2 minutes (healthy) 8443/tcp +mtusi2026lab7-api-2 mtusi2026lab7-api:local "/app/api" api 5 minutes ago Up 2 minutes (healthy) 8443/tcp +mtusi2026lab7-grafana-1 grafana/grafana:11.4.0 "/run.sh" grafana 6 minutes ago Up 6 minutes (healthy) 127.0.0.1:3000->3000/tcp +mtusi2026lab7-lb-1 haproxy:3.0.5-alpine "docker-entrypoint.s…" lb 6 minutes ago Up 6 minutes 127.0.0.1:8443->8443/tcp +mtusi2026lab7-loki-1 grafana/loki:3.3.2 "/usr/bin/loki -conf…" loki 6 minutes ago Up 6 minutes 3100/tcp +mtusi2026lab7-openbao-1 openbao/openbao:2.1.0 "docker-entrypoint.s…" openbao 7 minutes ago Up 5 minutes 127.0.0.1:8200->8200/tcp +mtusi2026lab7-otel-collector-1 otel/opentelemetry-collector-contrib:0.116.1 "/otelcol-contrib --…" otel-collector 6 minutes ago Up 6 minutes 4317-4318/tcp, 55678-55679/tcp +mtusi2026lab7-postgres-1 postgres:16.4-alpine "sh -c 'install -o p…" postgres 7 minutes ago Up 7 minutes (healthy) 5432/tcp +mtusi2026lab7-prometheus-1 prom/prometheus:v3.1.0 "/bin/prometheus --c…" prometheus 6 minutes ago Up 6 minutes 9090/tcp +mtusi2026lab7-rabbitmq-1 rabbitmq:4.0.9-alpine "docker-entrypoint.s…" rabbitmq 7 minutes ago Up 7 minutes (healthy) 4369/tcp, 5671-5672/tcp, 15691-15692/tcp, 25672/tcp +mtusi2026lab7-reconciler-1 mtusi2026lab7-api:local "/app/reconcile --ap…" reconciler 6 minutes ago Up 6 minutes (healthy) 8443/tcp +mtusi2026lab7-redis-1 redis:7.4.1-alpine "docker-entrypoint.s…" redis 7 minutes ago Up 7 minutes (healthy) 6379/tcp +mtusi2026lab7-relay-1 mtusi2026lab7-api:local "/app/pipeline relay" relay 6 minutes ago Up 6 minutes (healthy) 8443/tcp +mtusi2026lab7-s3-1 bitnamilegacy/minio:2025.4.22@sha256:50cec18ac4184af4671a78aedd5554942c8ae105d51a465fa82037949046da01 "/bin/bash -c 'mkdir…" s3 7 minutes ago Up 7 minutes (healthy) 9000-9001/tcp +mtusi2026lab7-tempo-1 grafana/tempo:2.6.1 "/tempo -config.file…" tempo 6 minutes ago Up 6 minutes +mtusi2026lab7-tempo-init-1 grafana/tempo:2.6.1 "chown 10001:10001 /…" tempo-init 6 minutes ago Exited (0) 6 minutes ago +mtusi2026lab7-worker-1 mtusi2026lab7-api:local "/app/pipeline worker" worker 6 minutes ago Up About a minute (healthy) 8443/tcp diff --git a/evidence/security/docker_stats_security.txt b/evidence/security/docker_stats_security.txt new file mode 100644 index 0000000..6312e26 --- /dev/null +++ b/evidence/security/docker_stats_security.txt @@ -0,0 +1,16 @@ +mtusi2026lab7-api-2 2.01% 129.7MiB / 256MiB +mtusi2026lab7-api-1 2.02% 112.4MiB / 256MiB +mtusi2026lab7-grafana-1 0.20% 56.66MiB / 256MiB +mtusi2026lab7-lb-1 0.28% 21.39MiB / 128MiB +mtusi2026lab7-tempo-1 0.19% 188.7MiB / 1GiB +mtusi2026lab7-relay-1 0.17% 12.81MiB / 128MiB +mtusi2026lab7-worker-1 0.01% 14.2MiB / 768MiB +mtusi2026lab7-otel-collector-1 0.18% 57.44MiB / 256MiB +mtusi2026lab7-loki-1 0.36% 109.2MiB / 1GiB +mtusi2026lab7-prometheus-1 0.33% 41.64MiB / 512MiB +mtusi2026lab7-reconciler-1 0.00% 5.207MiB / 128MiB +mtusi2026lab7-redis-1 0.44% 6.051MiB / 256MiB +mtusi2026lab7-rabbitmq-1 0.14% 92.3MiB / 512MiB +mtusi2026lab7-s3-1 5.80% 402.9MiB / 512MiB +mtusi2026lab7-postgres-1 0.25% 100.3MiB / 512MiB +mtusi2026lab7-openbao-1 0.27% 22MiB / 256MiB diff --git a/evidence/security/runner_security.txt b/evidence/security/runner_security.txt new file mode 100644 index 0000000..5324153 --- /dev/null +++ b/evidence/security/runner_security.txt @@ -0,0 +1,6 @@ +2 + total used free shared buff/cache available +Mem: 7776 2486 427 114 5283 5289 +Swap: 3071 0 3071 +28.0.4 +Docker Compose version v2.38.2 diff --git a/evidence/security/security/acl.json b/evidence/security/security/acl.json new file mode 100644 index 0000000..9046a4f --- /dev/null +++ b/evidence/security/security/acl.json @@ -0,0 +1,39 @@ +{ + "scenario": "acl", + "result": { + "outsider_metadata": 404, + "outsider_content": 404, + "attach_foreign_file": 404, + "fake_x_user_id_with_eve_token": 404, + "x_user_id_without_token": 401, + "after_logout": 401, + "json_body_65KiB": 413, + "stored_hash_params": "argon2id m=19456,t=2,p=1", + "rehash": { + "before": "m=65536,t=1,p=4", + "after": "m=19456,t=2,p=1" + }, + "login_rate_limit": { + "codes": [ + 401, + 401, + 401, + 401, + 401, + 401, + 401, + 401, + 401, + 401, + 429, + 429, + 429, + 429 + ], + "retry_after": "58", + "served_by_replicas": 2 + }, + "correct_password_while_limited": 429, + "after_ttl_expiry": 401 + } +} diff --git a/evidence/security/security/argon2.json b/evidence/security/security/argon2.json new file mode 100644 index 0000000..be75ff5 --- /dev/null +++ b/evidence/security/security/argon2.json @@ -0,0 +1,89 @@ +{ + "scenario": "argon2", + "result": { + "bench": { + "current": { + "MemoryKiB": 19456, + "Iterations": 2, + "Parallelism": 1 + }, + "results": [ + { + "hashes_per_s_one_core": 13.908012405947067, + "m_kib": 19456, + "ms_max": 78.569, + "ms_p50": 71.901, + "p": 1, + "t": 2 + }, + { + "hashes_per_s_one_core": 12.071900237816434, + "m_kib": 47104, + "ms_max": 101.575, + "ms_p50": 82.837, + "p": 1, + "t": 1 + }, + { + "hashes_per_s_one_core": 12.013166430407725, + "m_kib": 19456, + "ms_max": 107.157, + "ms_p50": 83.242, + "p": 1, + "t": 3 + }, + { + "hashes_per_s_one_core": 9.137927883473143, + "m_kib": 65536, + "ms_max": 209.469, + "ms_p50": 109.434, + "p": 4, + "t": 1 + }, + { + "hashes_per_s_one_core": 3.6552245952752567, + "m_kib": 65536, + "ms_max": 295.643, + "ms_p50": 273.581, + "p": 1, + "t": 3 + } + ] + }, + "login_latency_ms_sequential": [ + 62.4, + 26.9, + 26.6, + 26.9, + 26.4, + 26.2, + 27.7, + 27.2 + ], + "dos_burst": { + "attempts": 120, + "seconds": 2.92, + "codes": { + "401": 59, + "429": 61 + }, + "api_mem_peak_mib": [ + 197.0, + 131.2 + ], + "api_mem_before_mib": [ + 66.0, + 67.2 + ] + }, + "budget": { + "hash_ms_p50": 71.901, + "argon2_slots_per_replica": 2, + "replicas": 2, + "max_hashes_per_s_stand": 55.6, + "argon2_memory_bound_mib": 76.0, + "per_ip_limit_per_min": 60, + "per_user_limit_per_min": 10 + } + } +} diff --git a/evidence/security/security/hardening.json b/evidence/security/security/hardening.json new file mode 100644 index 0000000..e046009 --- /dev/null +++ b/evidence/security/security/hardening.json @@ -0,0 +1,313 @@ +{ + "scenario": "hardening", + "result": { + "api": { + "user": "1001:1001", + "read_only": true, + "privileged": false, + "cap_drop": [ + "ALL" + ], + "cap_add": null, + "no_new_privileges": true, + "network_mode": "mtusi2026lab7_back", + "pid_mode": "", + "docker_sock": false, + "memory_limit_mib": 256, + "nano_cpus": 500000000, + "pids_limit": 256, + "published": [], + "process_uid": "1001" + }, + "grafana": { + "user": "472", + "read_only": false, + "privileged": false, + "cap_drop": [ + "ALL" + ], + "cap_add": null, + "no_new_privileges": true, + "network_mode": "mtusi2026lab7_telemetry", + "pid_mode": "", + "docker_sock": false, + "memory_limit_mib": 256, + "nano_cpus": 500000000, + "pids_limit": 256, + "published": [ + "127.0.0.1:3000->3000/tcp" + ] + }, + "lb": { + "user": "haproxy", + "read_only": true, + "privileged": false, + "cap_drop": [ + "ALL" + ], + "cap_add": null, + "no_new_privileges": true, + "network_mode": "mtusi2026lab7_front", + "pid_mode": "", + "docker_sock": false, + "memory_limit_mib": 128, + "nano_cpus": 500000000, + "pids_limit": 256, + "published": [ + "127.0.0.1:8443->8443/tcp" + ] + }, + "loki": { + "user": "10001", + "read_only": true, + "privileged": false, + "cap_drop": [ + "ALL" + ], + "cap_add": null, + "no_new_privileges": true, + "network_mode": "mtusi2026lab7_telemetry", + "pid_mode": "", + "docker_sock": false, + "memory_limit_mib": 1024, + "nano_cpus": 500000000, + "pids_limit": 256, + "published": [] + }, + "openbao": { + "user": "root(image default)", + "read_only": false, + "privileged": false, + "cap_drop": [ + "ALL" + ], + "cap_add": [ + "CAP_CHOWN", + "CAP_DAC_OVERRIDE", + "CAP_FOWNER", + "CAP_SETGID", + "CAP_SETUID" + ], + "no_new_privileges": true, + "network_mode": "mtusi2026lab7_back", + "pid_mode": "", + "docker_sock": false, + "memory_limit_mib": 256, + "nano_cpus": 500000000, + "pids_limit": 256, + "published": [ + "127.0.0.1:8200->8200/tcp" + ] + }, + "otel-collector": { + "user": "10001", + "read_only": true, + "privileged": false, + "cap_drop": [ + "ALL" + ], + "cap_add": null, + "no_new_privileges": true, + "network_mode": "mtusi2026lab7_telemetry", + "pid_mode": "", + "docker_sock": false, + "memory_limit_mib": 256, + "nano_cpus": 500000000, + "pids_limit": 256, + "published": [] + }, + "postgres": { + "user": "root(image default)", + "read_only": false, + "privileged": false, + "cap_drop": [ + "ALL" + ], + "cap_add": [ + "CAP_CHOWN", + "CAP_DAC_OVERRIDE", + "CAP_FOWNER", + "CAP_SETGID", + "CAP_SETUID" + ], + "no_new_privileges": true, + "network_mode": "mtusi2026lab7_back", + "pid_mode": "", + "docker_sock": false, + "memory_limit_mib": 512, + "nano_cpus": 1000000000, + "pids_limit": 512, + "published": [] + }, + "prometheus": { + "user": "nobody", + "read_only": true, + "privileged": false, + "cap_drop": [ + "ALL" + ], + "cap_add": null, + "no_new_privileges": true, + "network_mode": "mtusi2026lab7_telemetry", + "pid_mode": "", + "docker_sock": false, + "memory_limit_mib": 512, + "nano_cpus": 500000000, + "pids_limit": 256, + "published": [] + }, + "rabbitmq": { + "user": "root(image default)", + "read_only": false, + "privileged": false, + "cap_drop": [ + "ALL" + ], + "cap_add": [ + "CAP_CHOWN", + "CAP_DAC_OVERRIDE", + "CAP_FOWNER", + "CAP_SETGID", + "CAP_SETUID" + ], + "no_new_privileges": true, + "network_mode": "mtusi2026lab7_back", + "pid_mode": "", + "docker_sock": false, + "memory_limit_mib": 512, + "nano_cpus": 500000000, + "pids_limit": 512, + "published": [] + }, + "reconciler": { + "user": "1001:1001", + "read_only": true, + "privileged": false, + "cap_drop": [ + "ALL" + ], + "cap_add": null, + "no_new_privileges": true, + "network_mode": "mtusi2026lab7_back", + "pid_mode": "", + "docker_sock": false, + "memory_limit_mib": 128, + "nano_cpus": 250000000, + "pids_limit": 128, + "published": [], + "process_uid": "1001" + }, + "redis": { + "user": "root(image default)", + "read_only": false, + "privileged": false, + "cap_drop": [ + "ALL" + ], + "cap_add": [ + "CAP_CHOWN", + "CAP_DAC_OVERRIDE", + "CAP_SETGID", + "CAP_SETUID" + ], + "no_new_privileges": true, + "network_mode": "mtusi2026lab7_back", + "pid_mode": "", + "docker_sock": false, + "memory_limit_mib": 256, + "nano_cpus": 500000000, + "pids_limit": 256, + "published": [] + }, + "relay": { + "user": "1001:1001", + "read_only": true, + "privileged": false, + "cap_drop": [ + "ALL" + ], + "cap_add": null, + "no_new_privileges": true, + "network_mode": "mtusi2026lab7_back", + "pid_mode": "", + "docker_sock": false, + "memory_limit_mib": 128, + "nano_cpus": 250000000, + "pids_limit": 128, + "published": [], + "process_uid": "1001" + }, + "s3": { + "user": "1001", + "read_only": true, + "privileged": false, + "cap_drop": [ + "ALL" + ], + "cap_add": null, + "no_new_privileges": true, + "network_mode": "mtusi2026lab7_back", + "pid_mode": "", + "docker_sock": false, + "memory_limit_mib": 512, + "nano_cpus": 500000000, + "pids_limit": 256, + "published": [] + }, + "tempo": { + "user": "10001:10001", + "read_only": true, + "privileged": false, + "cap_drop": [ + "ALL" + ], + "cap_add": null, + "no_new_privileges": true, + "network_mode": "mtusi2026lab7_telemetry", + "pid_mode": "", + "docker_sock": false, + "memory_limit_mib": 1024, + "nano_cpus": 500000000, + "pids_limit": 256, + "published": [] + }, + "tempo-init": { + "user": "root", + "read_only": false, + "privileged": false, + "cap_drop": [ + "ALL" + ], + "cap_add": [ + "CAP_CHOWN" + ], + "no_new_privileges": true, + "network_mode": "mtusi2026lab7_telemetry", + "pid_mode": "", + "docker_sock": false, + "memory_limit_mib": 0, + "nano_cpus": 0, + "pids_limit": null, + "published": [] + }, + "worker": { + "user": "1001:1001", + "read_only": true, + "privileged": false, + "cap_drop": [ + "ALL" + ], + "cap_add": null, + "no_new_privileges": true, + "network_mode": "mtusi2026lab7_back", + "pid_mode": "", + "docker_sock": false, + "memory_limit_mib": 768, + "nano_cpus": 1000000000, + "pids_limit": 128, + "published": [], + "process_uid": "1001" + }, + "_image_sensitive_files": [] + } +} diff --git a/evidence/security/security/leaks.json b/evidence/security/security/leaks.json new file mode 100644 index 0000000..0cb78a7 --- /dev/null +++ b/evidence/security/security/leaks.json @@ -0,0 +1,18 @@ +{ + "scenario": "leaks", + "result": { + "loki:password": 0, + "loki:token": 0, + "loki:message_text": 0, + "loki:basic_header": 0, + "tempo:password": 0, + "tempo:token": 0, + "tempo:message_text": 0, + "tempo:basic_header": 0, + "stdout:password": 0, + "stdout:token": 0, + "stdout:message_text": 0, + "stdout:basic_header": 0, + "traces_scanned": 20 + } +} diff --git a/evidence/security/security/lifecycle.json b/evidence/security/security/lifecycle.json new file mode 100644 index 0000000..412e647 --- /dev/null +++ b/evidence/security/security/lifecycle.json @@ -0,0 +1,32 @@ +{ + "scenario": "lifecycle", + "result": { + "api_openbao_logins_in_100s": 8, + "api_refresh_failures": 0, + "api_requests_ok": 200, + "upload_while_sealed": "ready", + "worker_restart_while_sealed": true, + "upload_accepted_while_worker_blocked": "queued", + "ready_seconds_after_unseal": 0.5, + "final_status": "ready", + "sealed_seconds": 33, + "load_while_sealed": { + "requests": 8667, + "ok": 8667, + "errors": 0, + "error_ratio": 0.0, + "ok_rps": 248.5, + "seconds": 34.9, + "latency_ms_all_ok": { + "p50": 6.49, + "p95": 15.21, + "p99": 24.87 + }, + "latency_ms_outside_faults": { + "p50": 6.49, + "p95": 15.21, + "p99": 24.87 + } + } + } +} diff --git a/evidence/security/security/mtls.json b/evidence/security/security/mtls.json new file mode 100644 index 0000000..cf06f7a --- /dev/null +++ b/evidence/security/security/mtls.json @@ -0,0 +1,149 @@ +{ + "scenario": "mtls", + "result": { + "lb_to_api": { + "no_client_cert": { + "addr": "api:8443", + "result": "server_rejected: certificate required" + }, + "foreign_ca_cert_cn_lb": { + "addr": "api:8443", + "result": "server_rejected: certificate required" + }, + "trusted_ca_identity_attacker": { + "addr": "api:8443", + "result": "server_rejected: bad certificate" + }, + "trusted_ca_identity_worker": { + "addr": "api:8443", + "result": "server_rejected: bad certificate" + }, + "identity_lb": { + "addr": "api:8443", + "instance": "449a818793bd6549", + "result": "ok", + "server_serial": "190915b35397e474b2c7e012b34b0123", + "status": 200 + }, + "plaintext_http": { + "addr": "api:8443", + "read_err": "", + "reply_bytes": 76, + "reply_prefix": "\"HTTP/1.0 400 Bad Request\\r\\n\\r\\nClient sent an HTTP request to an HTTPS server.\\n\"" + } + }, + "broker": { + "foreign_ca": { + "connect": "denied: Exception (501) Reason: \"remote error: tls: certificate required\"" + }, + "trusted_ca_cn_attacker": { + "connect": "denied: Exception (403) Reason: \"username or password not allowed\"" + }, + "trusted_ca_cn_lb": { + "connect": "denied: Exception (403) Reason: \"username or password not allowed\"" + }, + "worker": { + "connect": "allowed", + "consume attachment.dead (DLQ)": "denied: Exception (403) Reason: \"ACCESS_REFUSED - read access to queue 'attachment.dead' in vhost '/' refused for user 'worker-g1'\"", + "consume attachment.process": "allowed", + "declare queue evil": "denied: Exception (403) Reason: \"ACCESS_REFUSED - configure access to queue 'evil.probe' in vhost '/' refused for user 'worker-g1'\"", + "delete queue attachment.process": "denied: Exception (403) Reason: \"ACCESS_REFUSED - configure access to queue 'attachment.process' in vhost '/' refused for user 'worker-g1'\"", + "publish attachments (job)": "denied: nack" + }, + "relay": { + "connect": "allowed", + "consume attachment.dead (DLQ)": "denied: Exception (403) Reason: \"ACCESS_REFUSED - read access to queue 'attachment.dead' in vhost '/' refused for user 'relay-g1'\"", + "consume attachment.process": "denied: Exception (403) Reason: \"ACCESS_REFUSED - read access to queue 'attachment.process' in vhost '/' refused for user 'relay-g1'\"", + "declare queue evil": "denied: Exception (403) Reason: \"ACCESS_REFUSED - configure access to queue 'evil.probe' in vhost '/' refused for user 'relay-g1'\"", + "delete queue attachment.process": "denied: Exception (403) Reason: \"ACCESS_REFUSED - configure access to queue 'attachment.process' in vhost '/' refused for user 'relay-g1'\"", + "publish attachments (job)": "allowed" + }, + "plaintext_5672": { + "addr": "rabbitmq:5672", + "plaintext": "no listener (dial tcp 172.18.0.6:5672: connect: connection refused)" + } + }, + "collector": { + "no_client_cert": { + "ingest": "server_rejected: certificate required" + }, + "foreign_ca": { + "ingest": "server_rejected: certificate required" + }, + "main_ca_cert_lb": { + "ingest": "server_rejected: certificate required" + }, + "main_ca_cert_worker": { + "ingest": "server_rejected: certificate required" + }, + "telemetry_ca_worker": { + "ingest": "allowed", + "status": 200 + }, + "plaintext_http": { + "addr": "otel-collector:4318", + "read_err": "", + "reply_bytes": 76, + "reply_prefix": "\"HTTP/1.0 400 Bad Request\\r\\n\\r\\nClient sent an HTTP request to an HTTPS server.\\n\"" + } + }, + "servers": { + "redis": { + "tls_verified": "ok", + "tls_status": null, + "plaintext_reply": "\"\\x15\\x03\\x03\\x00\\x02\\x02\\x16\"", + "plaintext": null + }, + "s3": { + "tls_verified": "ok", + "tls_status": 403, + "plaintext_reply": "\"HTTP/1.0 400 Bad Request\\r\\n\\r\\nClient sent an HTTP request to an HTTPS server.\\n\"", + "plaintext": null + }, + "openbao": { + "tls_verified": "ok", + "tls_status": 404, + "plaintext_reply": "\"HTTP/1.0 400 Bad Request\\r\\n\\r\\nClient sent an HTTP request to an HTTPS server.\\n\"", + "plaintext": null + }, + "tempo": { + "tls_verified": "ok", + "tls_status": 404, + "plaintext_reply": "\"HTTP/1.0 400 Bad Request\\r\\n\\r\\nClient sent an HTTP request to an HTTPS server.\\n\"", + "plaintext": null, + "without_client_cert": "server_rejected: certificate required" + }, + "loki": { + "tls_verified": "ok", + "tls_status": 404, + "plaintext_reply": "\"HTTP/1.0 400 Bad Request\\r\\n\\r\\nClient sent an HTTP request to an HTTPS server.\\n\"", + "plaintext": null, + "without_client_cert": "server_rejected: certificate required" + }, + "prometheus": { + "tls_verified": "ok", + "tls_status": 200, + "plaintext_reply": "\"HTTP/1.0 400 Bad Request\\r\\n\\r\\nClient sent an HTTP request to an HTTPS server.\\n\"", + "plaintext": null, + "without_client_cert": "server_rejected: certificate required" + }, + "collector-metrics": { + "tls_verified": "ok", + "tls_status": 404, + "plaintext_reply": "\"HTTP/1.0 400 Bad Request\\r\\n\\r\\nClient sent an HTTP request to an HTTPS server.\\n\"", + "plaintext": null, + "without_client_cert": "server_rejected: certificate required" + }, + "rabbitmq-metrics": { + "tls_verified": "ok", + "tls_status": 404, + "plaintext_reply": "\"\\x15\\x03\\x01\\x00\\x02\\x02\\n\"", + "plaintext": null, + "without_client_cert": "server_rejected: certificate required" + }, + "postgres": { + "sslmode_disable": "denied: failed to connect to `user=app_api database=messenger`: 172.18.0.3:5432 (postgres): server error: FATAL: pg_hba.conf rejects connection for host \"172.18.0.12\", " + } + } + } +} diff --git a/evidence/security/security/openbao.json b/evidence/security/security/openbao.json new file mode 100644 index 0000000..6b91d3b --- /dev/null +++ b/evidence/security/security/openbao.json @@ -0,0 +1,110 @@ +{ + "scenario": "openbao", + "result": { + "api": { + "create token with other policy": "denied (403)", + "list secrets": "denied (403)", + "login": "allowed", + "read messenger/reconciler": "denied (403)", + "read messenger/relay": "denied (403)", + "read messenger/worker": "denied (403)", + "read own messenger/api": "allowed", + "seal openbao": "denied (403)", + "write own secret": "denied (403)", + "write policy": "denied (403)" + }, + "worker": { + "create token with other policy": "denied (403)", + "list secrets": "denied (403)", + "login": "allowed", + "read messenger/api": "denied (403)", + "read messenger/reconciler": "denied (403)", + "read messenger/relay": "denied (403)", + "read own messenger/worker": "allowed", + "seal openbao": "denied (403)", + "write own secret": "denied (403)", + "write policy": "denied (403)" + }, + "relay": { + "create token with other policy": "denied (403)", + "list secrets": "denied (403)", + "login": "allowed", + "read messenger/api": "denied (403)", + "read messenger/reconciler": "denied (403)", + "read messenger/worker": "denied (403)", + "read own messenger/relay": "allowed", + "seal openbao": "denied (403)", + "write own secret": "denied (403)", + "write policy": "denied (403)" + }, + "reconciler": { + "create token with other policy": "denied (403)", + "list secrets": "denied (403)", + "login": "allowed", + "read messenger/api": "denied (403)", + "read messenger/relay": "denied (403)", + "read messenger/worker": "denied (403)", + "read own messenger/reconciler": "allowed", + "seal openbao": "denied (403)", + "write own secret": "denied (403)", + "write policy": "denied (403)" + }, + "worker_cert_as_api_role": { + "login": "denied: login 400" + }, + "attacker_cert": { + "login": "denied: login 400" + }, + "app_containers": { + "api": { + "env_has_token": false, + "secret_files": [ + "ca.crt", + "otel.crt", + "otel.key", + "revoked.txt", + "service.crt", + "service.key" + ] + }, + "worker": { + "env_has_token": false, + "secret_files": [ + "ca.crt", + "otel.crt", + "otel.key", + "service.crt", + "service.key" + ] + }, + "relay": { + "env_has_token": false, + "secret_files": [ + "ca.crt", + "otel.crt", + "otel.key", + "service.crt", + "service.key" + ] + }, + "reconciler": { + "env_has_token": false, + "secret_files": [ + "ca.crt", + "service.crt", + "service.key" + ] + } + }, + "status": { + "initialized": true, + "sealed": false, + "storage_type": "file", + "t": 2, + "n": 3, + "version": "2.1.0" + }, + "after_restart_sealed": true, + "after_unseal": "allowed" + } +} diff --git a/evidence/security/security/rotation.json b/evidence/security/security/rotation.json new file mode 100644 index 0000000..36741a8 --- /dev/null +++ b/evidence/security/security/rotation.json @@ -0,0 +1,36 @@ +{ + "scenario": "rotation", + "result": { + "db_old_password": "denied: failed to connect to `user=app_api database=messenger`: 172.18.0.3:5432 (postgres): failed SASL auth: FATAL: password authentication failed for user \"app_api\" (", + "api_after_db_rotation_attempts": [ + 200 + ], + "upload_after_s3_rotation": "ready", + "api_leaf_serial": { + "before": "190915b35397e474b2c7e012b34b0123", + "after": "8c644302db8edab1a2e3fedb2c729308" + }, + "old_lb_cert_after_revocation": "server_rejected: bad certificate", + "new_lb_cert": 200, + "load_during_rotations": { + "requests": 34548, + "ok": 34542, + "errors": 6, + "error_ratio": 0.00017, + "ok_rps": 249.5, + "seconds": 138.4, + "latency_ms_all_ok": { + "p50": 10.06, + "p95": 23.1, + "p99": 39.52 + }, + "latency_ms_outside_faults": { + "p50": 10.06, + "p95": 23.1, + "p99": 39.52 + } + }, + "seconds": 138, + "images_rebuilt": false + } +} diff --git a/evidence/security/security/tls-external.json b/evidence/security/security/tls-external.json new file mode 100644 index 0000000..40fe3ff --- /dev/null +++ b/evidence/security/security/tls-external.json @@ -0,0 +1,18 @@ +{ + "scenario": "tls-external", + "result": { + "public_security_py": "PASS: trusted HTTPS works; untrusted CA rejected. This does NOT verify internal mTLS, OpenBao or hardening.", + "trusted_ca_localhost": "ok TLSv1.3", + "wrong_hostname": "cert_verify_error: Hostname mismatch, certificate is not valid for 'messenger.example'.", + "foreign_ca_trust_store": "cert_verify_error: unable to get local issuer certificate", + "tls_1_1": "ssl_error: NO_PROTOCOLS_AVAILABLE", + "host_port_8080": "closed", + "host_port_8404": "closed", + "host_port_9090": "closed", + "host_port_5432": "closed", + "host_port_6379": "closed", + "host_port_9000": "closed", + "host_port_5672": "closed", + "host_port_4318": "closed" + } +} diff --git a/evidence/track1/README.md b/evidence/track1/README.md new file mode 100644 index 0000000..8df7001 --- /dev/null +++ b/evidence/track1/README.md @@ -0,0 +1,5 @@ +# Доказательства + +Храните небольшие обезличенные результаты: команды и stdout проверок, JSON/CSV агрегатов нагрузки, EXPLAIN, dashboard JSON, текст разбора отказа. Укажите дату, commit, аппаратные лимиты и профиль нагрузки. + +Не добавляйте .env, session tokens, cookies, приватные ключи, credentials, реальные сообщения, raw dumps и signed URLs. Для скриншотов скрывайте секреты. Большие логи/бинарные traces сохраняйте отдельно по правилам преподавателя; одного скриншота без методики недостаточно. diff --git a/evidence/track1/containers_state_track1.txt b/evidence/track1/containers_state_track1.txt new file mode 100644 index 0000000..b651c6e --- /dev/null +++ b/evidence/track1/containers_state_track1.txt @@ -0,0 +1,17 @@ +/mtusi2026lab7-api-1 restarts=0 oom_killed=false exit=0 +/mtusi2026lab7-api-2 restarts=0 oom_killed=false exit=0 +/mtusi2026lab7-grafana-1 restarts=0 oom_killed=false exit=0 +/mtusi2026lab7-lb-1 restarts=0 oom_killed=false exit=0 +/mtusi2026lab7-loki-1 restarts=0 oom_killed=false exit=0 +/mtusi2026lab7-openbao-1 restarts=0 oom_killed=false exit=0 +/mtusi2026lab7-otel-collector-1 restarts=0 oom_killed=false exit=0 +/mtusi2026lab7-postgres-1 restarts=0 oom_killed=false exit=0 +/mtusi2026lab7-prometheus-1 restarts=0 oom_killed=false exit=0 +/mtusi2026lab7-rabbitmq-1 restarts=0 oom_killed=false exit=0 +/mtusi2026lab7-reconciler-1 restarts=0 oom_killed=false exit=0 +/mtusi2026lab7-redis-1 restarts=0 oom_killed=false exit=0 +/mtusi2026lab7-relay-1 restarts=0 oom_killed=false exit=0 +/mtusi2026lab7-s3-1 restarts=0 oom_killed=false exit=0 +/mtusi2026lab7-tempo-1 restarts=0 oom_killed=false exit=0 +/mtusi2026lab7-tempo-init-1 restarts=0 oom_killed=false exit=0 +/mtusi2026lab7-worker-1 restarts=0 oom_killed=false exit=0 diff --git a/evidence/track1/docker_ps_final_track1.txt b/evidence/track1/docker_ps_final_track1.txt new file mode 100644 index 0000000..04783f6 --- /dev/null +++ b/evidence/track1/docker_ps_final_track1.txt @@ -0,0 +1,18 @@ +NAME IMAGE COMMAND SERVICE CREATED STATUS PORTS +mtusi2026lab7-api-1 mtusi2026lab7-api:local "/app/api" api About a minute ago Up About a minute (healthy) 8443/tcp +mtusi2026lab7-api-2 mtusi2026lab7-api:local "/app/api" api About a minute ago Up About a minute (healthy) 8443/tcp +mtusi2026lab7-grafana-1 grafana/grafana:11.4.0 "/run.sh" grafana About a minute ago Up About a minute (healthy) 127.0.0.1:3000->3000/tcp +mtusi2026lab7-lb-1 haproxy:3.0.5-alpine "docker-entrypoint.s…" lb About a minute ago Up About a minute 127.0.0.1:8443->8443/tcp +mtusi2026lab7-loki-1 grafana/loki:3.3.2 "/usr/bin/loki -conf…" loki About a minute ago Up About a minute 3100/tcp +mtusi2026lab7-openbao-1 openbao/openbao:2.1.0 "docker-entrypoint.s…" openbao 2 minutes ago Up 2 minutes 127.0.0.1:8200->8200/tcp +mtusi2026lab7-otel-collector-1 otel/opentelemetry-collector-contrib:0.116.1 "/otelcol-contrib --…" otel-collector About a minute ago Up About a minute 4317-4318/tcp, 55678-55679/tcp +mtusi2026lab7-postgres-1 postgres:16.4-alpine "sh -c 'install -o p…" postgres 2 minutes ago Up 2 minutes (healthy) 5432/tcp +mtusi2026lab7-prometheus-1 prom/prometheus:v3.1.0 "/bin/prometheus --c…" prometheus About a minute ago Up About a minute 9090/tcp +mtusi2026lab7-rabbitmq-1 rabbitmq:4.0.9-alpine "docker-entrypoint.s…" rabbitmq 2 minutes ago Up 2 minutes (healthy) 4369/tcp, 5671-5672/tcp, 15691-15692/tcp, 25672/tcp +mtusi2026lab7-reconciler-1 mtusi2026lab7-api:local "/app/reconcile --ap…" reconciler About a minute ago Up About a minute (healthy) 8443/tcp +mtusi2026lab7-redis-1 redis:7.4.1-alpine "docker-entrypoint.s…" redis 2 minutes ago Up About a minute (healthy) 6379/tcp +mtusi2026lab7-relay-1 mtusi2026lab7-api:local "/app/pipeline relay" relay About a minute ago Up About a minute (healthy) 8443/tcp +mtusi2026lab7-s3-1 bitnamilegacy/minio:2025.4.22@sha256:50cec18ac4184af4671a78aedd5554942c8ae105d51a465fa82037949046da01 "/bin/bash -c 'mkdir…" s3 2 minutes ago Up 2 minutes (healthy) 9000-9001/tcp +mtusi2026lab7-tempo-1 grafana/tempo:2.6.1 "/tempo -config.file…" tempo About a minute ago Up About a minute +mtusi2026lab7-tempo-init-1 grafana/tempo:2.6.1 "chown 10001:10001 /…" tempo-init About a minute ago Exited (0) About a minute ago +mtusi2026lab7-worker-1 mtusi2026lab7-api:local "/app/pipeline worker" worker About a minute ago Up About a minute (healthy) 8443/tcp diff --git a/evidence/track1/docker_stats_track1.txt b/evidence/track1/docker_stats_track1.txt new file mode 100644 index 0000000..1e35d53 --- /dev/null +++ b/evidence/track1/docker_stats_track1.txt @@ -0,0 +1,16 @@ +mtusi2026lab7-grafana-1 0.08% 65.02MiB / 256MiB +mtusi2026lab7-lb-1 0.30% 13.46MiB / 128MiB +mtusi2026lab7-tempo-1 0.02% 40.2MiB / 1GiB +mtusi2026lab7-api-1 0.22% 67.7MiB / 256MiB +mtusi2026lab7-otel-collector-1 0.69% 45.99MiB / 256MiB +mtusi2026lab7-reconciler-1 0.00% 5.035MiB / 128MiB +mtusi2026lab7-worker-1 0.16% 17.5MiB / 768MiB +mtusi2026lab7-loki-1 0.69% 49.43MiB / 1GiB +mtusi2026lab7-prometheus-1 0.36% 35.24MiB / 512MiB +mtusi2026lab7-api-2 0.18% 67.39MiB / 256MiB +mtusi2026lab7-relay-1 0.30% 11.89MiB / 128MiB +mtusi2026lab7-s3-1 0.03% 459.4MiB / 512MiB +mtusi2026lab7-postgres-1 0.23% 54.02MiB / 512MiB +mtusi2026lab7-redis-1 0.41% 3.93MiB / 256MiB +mtusi2026lab7-rabbitmq-1 0.99% 91.57MiB / 512MiB +mtusi2026lab7-openbao-1 0.26% 23.14MiB / 256MiB diff --git a/evidence/track1/runner_track1.txt b/evidence/track1/runner_track1.txt new file mode 100644 index 0000000..ab4bd7d --- /dev/null +++ b/evidence/track1/runner_track1.txt @@ -0,0 +1,6 @@ +2 + total used free shared buff/cache available +Mem: 7932 2086 1102 90 5148 5845 +Swap: 3071 0 3071 +28.0.4 +Docker Compose version v2.38.2 diff --git a/evidence/track1/track1/compromise.json b/evidence/track1/track1/compromise.json new file mode 100644 index 0000000..dab283e --- /dev/null +++ b/evidence/track1/track1/compromise.json @@ -0,0 +1,299 @@ +{ + "before_least_privilege": { + "db": { + "connect": "allowed", + "create role": "allowed", + "create table": "allowed", + "delete attachments": "allowed", + "insert attachment_variants": "allowed", + "insert message": "allowed", + "read chat_members": "allowed", + "read jobs": "allowed", + "read messages": "allowed", + "read users.password_hash": "allowed", + "role": "messenger", + "truncate jobs": "allowed", + "update attachments.owner_id": "allowed", + "update attachments.status": "allowed", + "update jobs.state": "allowed" + }, + "s3": { + "delete a/*": "allowed", + "delete o/*": "allowed", + "delete s/*": "allowed", + "delete v/*": "allowed", + "get a/*": "allowed (no such key)", + "get o/*": "allowed (no such key)", + "get s/*": "allowed (no such key)", + "get v/*": "allowed (no such key)", + "list all buckets": "allowed", + "list bucket": "allowed", + "make bucket": "denied (AccessDenied)", + "put a/*": "allowed", + "put o/*": "allowed", + "put s/*": "allowed", + "put v/*": "allowed" + }, + "amqp": { + "connect": "allowed", + "consume attachment.dead (DLQ)": "allowed", + "consume attachment.process": "allowed", + "declare queue evil": "allowed", + "delete queue attachment.process": "denied: Exception (540) Reason: \"NOT_IMPLEMENTED - cannot delete queue 'attachment.process' in vhost '/'. queue.delete operations with if-unused flag set are not suppor", + "publish attachments (job)": "allowed" + }, + "otlp": "allowed (lab6: OTLP по HTTP без аутентификации, любой процесс сети telemetry)", + "api_as_lb": "allowed (lab6: API на :8080 по HTTP, доступен из сети front/back)", + "openbao": "n/a (lab6: секреты всех нужных сервисов — файлами в контейнере)" + }, + "after_least_privilege": { + "amqp": { + "connect": "allowed", + "consume attachment.dead (DLQ)": "denied: Exception (403) Reason: \"ACCESS_REFUSED - read access to queue 'attachment.dead' in vhost '/' refused for user 'worker-g1'\"", + "consume attachment.process": "allowed", + "declare queue evil": "denied: Exception (403) Reason: \"ACCESS_REFUSED - configure access to queue 'evil.probe' in vhost '/' refused for user 'worker-g1'\"", + "delete queue attachment.process": "denied: Exception (403) Reason: \"ACCESS_REFUSED - configure access to queue 'attachment.process' in vhost '/' refused for user 'worker-g1'\"", + "publish attachments (job)": "denied: nack" + }, + "api_as_lb": { + "addr": "api:8443", + "result": "server_rejected: bad certificate" + }, + "db": { + "connect": "allowed", + "create role": "denied", + "create table": "denied", + "delete attachments": "denied", + "insert attachment_variants": "allowed", + "insert message": "denied", + "read chat_members": "denied", + "read jobs": "allowed", + "read messages": "denied", + "read users.password_hash": "denied", + "role": "app_worker", + "truncate jobs": "denied", + "update attachments.owner_id": "denied", + "update attachments.status": "allowed", + "update jobs.state": "allowed" + }, + "identity_cert": "/pki/worker.crt", + "openbao": { + "create token with other policy": "denied (403)", + "list secrets": "denied (403)", + "login": "allowed", + "read messenger/api": "denied (403)", + "read messenger/reconciler": "denied (403)", + "read messenger/relay": "denied (403)", + "read own messenger/worker": "allowed", + "seal openbao": "denied (403)", + "write own secret": "denied (403)", + "write policy": "denied (403)" + }, + "otlp": { + "ingest": "allowed", + "status": 200 + }, + "s3": { + "delete a/*": "denied (AccessDenied)", + "delete o/*": "denied (AccessDenied)", + "delete s/*": "allowed", + "delete v/*": "denied (AccessDenied)", + "get a/*": "denied (AccessDenied)", + "get o/*": "denied (AccessDenied)", + "get s/*": "allowed (no such key)", + "get v/*": "denied (AccessDenied)", + "list all buckets": "denied (AccessDenied)", + "list bucket": "denied (AccessDenied)", + "make bucket": "denied (AccessDenied)", + "put a/*": "denied (AccessDenied)", + "put o/*": "allowed", + "put s/*": "denied (AccessDenied)", + "put v/*": "allowed" + }, + "stolen_secrets": [ + "db_password", + "db_user", + "s3_access_key", + "s3_secret_key" + ] + }, + "response_steps": [ + { + "step": "новая identity: сертификат CN worker-g2 (перезапись файла на месте)", + "at_s": 0.0, + "took_s": 0.1 + }, + { + "step": "OpenBao cert-роль worker → только CN worker-g2; RabbitMQ: worker-g2 создан, worker-g1 удалён (соединения закрыты)", + "at_s": 0.1, + "took_s": 17.1 + }, + { + "step": "отзыв всех токенов OpenBao, выданных worker", + "at_s": 17.2, + "took_s": 3.7 + }, + { + "step": "ротация пароля роли БД app_worker + разрыв её соединений", + "at_s": 20.9, + "took_s": 1.3 + }, + { + "step": "ротация secret key S3 svc-worker", + "at_s": 22.2, + "took_s": 5.2 + } + ], + "processing_restored_seconds_after_response": 0.5, + "worker_recovery_log_events": [ + "secrets.login", + "secrets.version" + ], + "worker_restarts": 0, + "stolen_identity_after_response": { + "amqp": { + "connect": "denied: Exception (403) Reason: \"username or password not allowed\"" + }, + "api_as_lb": { + "addr": "api:8443", + "result": "server_rejected: bad certificate" + }, + "identity_cert": "/pki/test/worker-stolen.crt", + "openbao": { + "login": "denied: login 400" + }, + "otlp": { + "ingest": "allowed", + "status": 200 + }, + "stolen_secrets": "none: openbao login denied (login 400)", + "db_with_stolen_password": "denied: failed to connect to `user=app_worker database=messenger`: 172.18.0.5:5432 (postgres): failed SASL auth: FATAL: password authentication failed for user \"app_wor", + "s3_with_stolen_key": { + "delete a/*": "denied (SignatureDoesNotMatch)", + "delete o/*": "denied (SignatureDoesNotMatch)", + "delete s/*": "denied (SignatureDoesNotMatch)", + "delete v/*": "denied (SignatureDoesNotMatch)", + "get a/*": "denied (SignatureDoesNotMatch)", + "get o/*": "denied (SignatureDoesNotMatch)", + "get s/*": "denied (SignatureDoesNotMatch)", + "get v/*": "denied (SignatureDoesNotMatch)", + "list all buckets": "denied (SignatureDoesNotMatch)", + "list bucket": "denied (SignatureDoesNotMatch)", + "make bucket": "denied (SignatureDoesNotMatch)", + "put a/*": "denied (SignatureDoesNotMatch)", + "put o/*": "denied (SignatureDoesNotMatch)", + "put s/*": "denied (SignatureDoesNotMatch)", + "put v/*": "denied (SignatureDoesNotMatch)" + } + }, + "tasks": { + "accepted_202": 27, + "upload_errors": 0, + "final": { + "ready": 27 + }, + "accepted_during_response": 21 + }, + "comparison": { + "before": { + "db: connect": "allowed", + "db: create role": "allowed", + "db: create table": "allowed", + "db: delete attachments": "allowed", + "db: insert attachment_variants": "allowed", + "db: insert message": "allowed", + "db: read chat_members": "allowed", + "db: read jobs": "allowed", + "db: read messages": "allowed", + "db: read users.password_hash": "allowed", + "db: role": "messenger", + "db: truncate jobs": "allowed", + "db: update attachments.owner_id": "allowed", + "db: update attachments.status": "allowed", + "db: update jobs.state": "allowed", + "s3: delete a/*": "allowed", + "s3: delete o/*": "allowed", + "s3: delete s/*": "allowed", + "s3: delete v/*": "allowed", + "s3: get a/*": "allowed (no such key)", + "s3: get o/*": "allowed (no such key)", + "s3: get s/*": "allowed (no such key)", + "s3: get v/*": "allowed (no such key)", + "s3: list all buckets": "allowed", + "s3: list bucket": "allowed", + "s3: make bucket": "denied (AccessDenied)", + "s3: put a/*": "allowed", + "s3: put o/*": "allowed", + "s3: put s/*": "allowed", + "s3: put v/*": "allowed", + "amqp: connect": "allowed", + "amqp: consume attachment.dead (DLQ)": "allowed", + "amqp: consume attachment.process": "allowed", + "amqp: declare queue evil": "allowed", + "amqp: delete queue attachment.process": "denied: Exception (540) Reason: \"NOT_IMPLEMENTED - cannot delete queue 'attachment.process' in vhost '/'. queue.delete operations with if-unused flag set are not suppor", + "amqp: publish attachments (job)": "allowed", + "otlp": "allowed (lab6: OTLP по HTTP без аутентификации, любой процесс сети telemetry)", + "api_as_lb": "allowed (lab6: API на :8080 по HTTP, доступен из сети front/back)", + "openbao": "n/a (lab6: секреты всех нужных сервисов — файлами в контейнере)" + }, + "after": { + "amqp: connect": "allowed", + "amqp: consume attachment.dead (DLQ)": "denied: Exception (403) Reason: \"ACCESS_REFUSED - read access to queue 'attachment.dead' in vhost '/' refused for user 'worker-g1'\"", + "amqp: consume attachment.process": "allowed", + "amqp: declare queue evil": "denied: Exception (403) Reason: \"ACCESS_REFUSED - configure access to queue 'evil.probe' in vhost '/' refused for user 'worker-g1'\"", + "amqp: delete queue attachment.process": "denied: Exception (403) Reason: \"ACCESS_REFUSED - configure access to queue 'attachment.process' in vhost '/' refused for user 'worker-g1'\"", + "amqp: publish attachments (job)": "denied: nack", + "api_as_lb: addr": "api:8443", + "api_as_lb: result": "server_rejected: bad certificate", + "db: connect": "allowed", + "db: create role": "denied", + "db: create table": "denied", + "db: delete attachments": "denied", + "db: insert attachment_variants": "allowed", + "db: insert message": "denied", + "db: read chat_members": "denied", + "db: read jobs": "allowed", + "db: read messages": "denied", + "db: read users.password_hash": "denied", + "db: role": "app_worker", + "db: truncate jobs": "denied", + "db: update attachments.owner_id": "denied", + "db: update attachments.status": "allowed", + "db: update jobs.state": "allowed", + "identity_cert": "/pki/worker.crt", + "openbao: create token with other policy": "denied (403)", + "openbao: list secrets": "denied (403)", + "openbao: login": "allowed", + "openbao: read messenger/api": "denied (403)", + "openbao: read messenger/reconciler": "denied (403)", + "openbao: read messenger/relay": "denied (403)", + "openbao: read own messenger/worker": "allowed", + "openbao: seal openbao": "denied (403)", + "openbao: write own secret": "denied (403)", + "openbao: write policy": "denied (403)", + "otlp: ingest": "allowed", + "otlp: status": 200, + "s3: delete a/*": "denied (AccessDenied)", + "s3: delete o/*": "denied (AccessDenied)", + "s3: delete s/*": "allowed", + "s3: delete v/*": "denied (AccessDenied)", + "s3: get a/*": "denied (AccessDenied)", + "s3: get o/*": "denied (AccessDenied)", + "s3: get s/*": "allowed (no such key)", + "s3: get v/*": "denied (AccessDenied)", + "s3: list all buckets": "denied (AccessDenied)", + "s3: list bucket": "denied (AccessDenied)", + "s3: make bucket": "denied (AccessDenied)", + "s3: put a/*": "denied (AccessDenied)", + "s3: put o/*": "allowed", + "s3: put s/*": "denied (AccessDenied)", + "s3: put v/*": "allowed", + "stolen_secrets": [ + "db_password", + "db_user", + "s3_access_key", + "s3_secret_key" + ] + } + } +}