forked from mtusi2026/mtusi2026lab7
Compare commits
10
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6d1ed1563b | ||
|
|
a414221d75 | ||
|
|
b862899b97 | ||
|
|
8041d5c02a | ||
|
|
3173c4f2aa | ||
|
|
53f6dcedfa | ||
|
|
049b2867a6 | ||
|
|
627b7ee42f | ||
|
|
1c453e9f0a | ||
|
|
b5b55fda89 |
@@ -62,7 +62,7 @@ jobs:
|
||||
stand:
|
||||
name: Стенд — ${{ matrix.part }}
|
||||
runs-on: ubuntu-24.04
|
||||
timeout-minutes: 80
|
||||
timeout-minutes: 150
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
@@ -97,7 +97,9 @@ jobs:
|
||||
mkdir -p evidence
|
||||
{ nproc; free -m; docker version --format '{{.Server.Version}}'; docker compose version; } > evidence/runner_${{ matrix.part }}.txt
|
||||
docker compose ps -a > evidence/docker_ps_final_${{ matrix.part }}.txt || true
|
||||
for c in $(docker compose ps -aq); do docker inspect -f '{{.Name}} restarts={{.RestartCount}} oom_killed={{.State.OOMKilled}} exit={{.State.ExitCode}}' "$c"; done > evidence/containers_state_${{ matrix.part }}.txt || true
|
||||
docker compose logs --no-color --tail 300 > evidence/compose_logs_${{ matrix.part }}.log 2>&1 || true
|
||||
docker compose logs --no-color api worker relay 2>&1 | grep -v '"msg":"http request"' | tail -3000 > evidence/app_logs_${{ matrix.part }}.log || true
|
||||
- uses: actions/upload-artifact@v4
|
||||
if: always()
|
||||
with:
|
||||
|
||||
+4
-2
@@ -41,11 +41,13 @@ FROM alpine:3.20@sha256:d9e853e87e55526f6b2917df91a2115c36dd7c696a35be12163d44e6
|
||||
# ca-certificates — для HTTPS в lab2+
|
||||
# tzdata — для корректной работы с временными зонами
|
||||
# libwebp-tools — cwebp для варианта optimized (WebP) в worker.
|
||||
RUN apk --no-cache add ca-certificates tzdata libwebp-tools
|
||||
# apk upgrade: исправления базового слоя (Trivy: musl CVE-2026-107891 исправлен в 1.2.5-r4).
|
||||
RUN apk --no-cache upgrade && apk --no-cache add ca-certificates tzdata libwebp-tools
|
||||
|
||||
# Непривилегированный пользователь (UID/GID 1001).
|
||||
RUN addgroup -g 1001 -S appgroup && \
|
||||
adduser -u 1001 -S appuser -G appgroup
|
||||
adduser -u 1001 -S appuser -G appgroup && \
|
||||
mkdir -p /var/lib/messenger/fault && chown appuser:appgroup /var/lib/messenger/fault
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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 <svc>`, `scripts/pki.sh rotate <имя> [CN]`, `bootstrap.py worker-identity gN`,
|
||||
`bootstrap.py revoke-tokens <svc>`.
|
||||
|
||||
Остановка без потери данных: `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, по одному прогону сценария; это подтверждение поведения, а не статистика производительности.
|
||||
|
||||
+37
-2
@@ -15,6 +15,7 @@ import (
|
||||
"flag"
|
||||
"fmt"
|
||||
"github.com/charawein/mtusi2026lab7/internal/service"
|
||||
"github.com/jackc/pgx/v5/pgconn"
|
||||
"io"
|
||||
"log/slog"
|
||||
"os"
|
||||
@@ -178,7 +179,8 @@ func runWorker(ctx context.Context, cfg config.Config, repo *postgres.PipelineRe
|
||||
Owner: owner, Lease: cfg.JobTimeout, JobTimeout: cfg.JobTimeout,
|
||||
MaxBytes: cfg.MaxUploadBytes, MaxPixels: cfg.MaxImagePixels, PixelBudget: cfg.PixelBudget,
|
||||
WebPQuality: cfg.WebPQuality, RetryBase: cfg.RetryBaseDelay, RetryMax: cfg.RetryMaxDelay,
|
||||
FaultPoints: faultPoints(), FaultDir: os.TempDir(), DeleteStaging: true,
|
||||
FaultPoints: faultPoints(), FaultDir: faultDir(), DeleteStaging: true,
|
||||
ClaimRetryDelay: envDuration("CLAIM_RETRY_DELAY", 3*time.Second), OnClaimError: onDBError,
|
||||
})
|
||||
slog.Info("worker starting", "event", "worker.start", "owner", owner, "concurrency", cfg.WorkerConcurrency, "lease", cfg.JobTimeout)
|
||||
// Ёмкость worker (saturation = messenger.worker.busy / capacity).
|
||||
@@ -266,7 +268,7 @@ func waitAll(wg *sync.WaitGroup) <-chan struct{} {
|
||||
func runRelay(ctx context.Context, cfg config.Config, repo *postgres.PipelineRepository) int {
|
||||
store := newStore(cfg)
|
||||
points := faultPoints()
|
||||
afterPublish := func() { worker.Fault(points, os.TempDir(), "relay.after_publish", os.Exit) }
|
||||
afterPublish := func() { worker.Fault(points, faultDir(), "relay.after_publish", os.Exit) }
|
||||
var pub *broker.Publisher
|
||||
defer func() {
|
||||
if pub != nil {
|
||||
@@ -450,3 +452,36 @@ func argon2Hash() int {
|
||||
fmt.Println(h)
|
||||
return 0
|
||||
}
|
||||
|
||||
// faultDir — каталог маркеров точек сбоя (FAULT_DIR, volume в compose).
|
||||
func faultDir() string {
|
||||
if d := os.Getenv("FAULT_DIR"); d != "" {
|
||||
return d
|
||||
}
|
||||
return os.TempDir()
|
||||
}
|
||||
|
||||
// onDBError: PostgreSQL отверг пароль роли (28P01 — оператор ротировал его раньше,
|
||||
// чем наступило плановое обновление секрета) → внеочередное чтение из OpenBao.
|
||||
func onDBError(ctx context.Context, err error) {
|
||||
if platformRef == nil || platformRef.Secrets == nil || err == nil {
|
||||
return
|
||||
}
|
||||
var pe *pgconn.PgError
|
||||
authFailed := errors.As(err, &pe) && pe.Code == "28P01"
|
||||
// Ошибка установления соединения pgx не всегда отдаёт PgError через errors.As.
|
||||
if !authFailed && !strings.Contains(err.Error(), "SQLSTATE 28P01") {
|
||||
return
|
||||
}
|
||||
if platformRef.Secrets.SyncNow(ctx) {
|
||||
slog.InfoContext(ctx, "db credentials refreshed after auth error", "event", "secrets.db_auth_retry",
|
||||
"version", platformRef.Secrets.Version())
|
||||
}
|
||||
}
|
||||
|
||||
func envDuration(k string, def time.Duration) time.Duration {
|
||||
if d, err := time.ParseDuration(os.Getenv(k)); err == nil && d >= 0 {
|
||||
return d
|
||||
}
|
||||
return def
|
||||
}
|
||||
|
||||
+25
-8
@@ -68,7 +68,7 @@ func main() {
|
||||
var out result
|
||||
switch os.Args[1] {
|
||||
case "tls":
|
||||
out = probeTLS(*addr, *name, *ca, *cert, *key, *path)
|
||||
out = probeTLS(*addr, *name, *ca, *cert, *key, *path, *send)
|
||||
case "amqp":
|
||||
out = probeAMQP(*ca, *cert, *key)
|
||||
case "otlp":
|
||||
@@ -191,11 +191,30 @@ func classify(err error) string {
|
||||
return "error: " + s
|
||||
}
|
||||
|
||||
func probeTLS(addr, name, ca, cert, key, path string) result {
|
||||
func probeTLS(addr, name, ca, cert, key, path, send string) result {
|
||||
tc, err := tlsConf(ca, cert, key, name)
|
||||
if err != nil {
|
||||
return result{"result": "error: " + err.Error()}
|
||||
}
|
||||
if send != "" {
|
||||
// Не-HTTP протокол (Redis): рукопожатие с проверкой сертификата сервера + команда.
|
||||
c, err := tls.DialWithDialer(&net.Dialer{Timeout: 5 * time.Second}, "tcp", addr, tc)
|
||||
if err != nil {
|
||||
return result{"addr": addr, "result": classify(err)}
|
||||
}
|
||||
defer c.Close()
|
||||
_ = c.SetDeadline(time.Now().Add(5 * time.Second))
|
||||
if _, err := c.Write([]byte(strings.ReplaceAll(send, `\r\n`, "\r\n"))); err != nil {
|
||||
return result{"addr": addr, "result": classify(err)}
|
||||
}
|
||||
buf := make([]byte, 128)
|
||||
n, err := c.Read(buf)
|
||||
if n == 0 {
|
||||
return result{"addr": addr, "result": classify(err)}
|
||||
}
|
||||
return result{"addr": addr, "result": "ok", "reply_prefix": strings.TrimSpace(string(buf[:n])),
|
||||
"server_serial": c.ConnectionState().PeerCertificates[0].SerialNumber.Text(16)}
|
||||
}
|
||||
// TLS 1.3: отказ сервера в клиентском сертификате приходит после рукопожатия —
|
||||
// поэтому делаем реальный HTTP-запрос и классифицируем его ошибку.
|
||||
cl := &http.Client{Timeout: 10 * time.Second, Transport: &http.Transport{TLSClientConfig: tc, DisableKeepAlives: true}}
|
||||
@@ -274,11 +293,9 @@ func probeAMQP(ca, cert, key string) result {
|
||||
_, err := ch.QueueDeclare("evil.probe", false, true, false, false, nil)
|
||||
return err
|
||||
})
|
||||
try("purge attachment.process", func(ch *amqp.Channel) error {
|
||||
// purge требует configure: при отсутствии прав очередь не очищается
|
||||
_, err := ch.QueuePurge("attachment.process", false)
|
||||
return err
|
||||
})
|
||||
// queue.purge в RabbitMQ авторизуется правом read — оно у worker есть по необходимости
|
||||
// (consume). Зонд purge НЕ выполняет: это разрушило бы очередь стенда. Остаточный
|
||||
// риск описан в security/THREAT_MODEL.md (обнаружение — возраст старейшей queued-работы).
|
||||
try("delete queue attachment.process", func(ch *amqp.Channel) error {
|
||||
_, err := ch.QueueDelete("attachment.process", true, true, false) // ifUnused+ifEmpty: не разрушает
|
||||
return err
|
||||
@@ -542,6 +559,6 @@ func compromise(ctx context.Context, ca, cert, key, otelCert, otelKey, role, pat
|
||||
if otelCert != "" {
|
||||
res["otlp"] = probeOTLP(ca, otelCert, otelKey)
|
||||
}
|
||||
res["api_as_lb"] = probeTLS("api:8443", "api", ca, cert, key, "/api/v1/users/me")
|
||||
res["api_as_lb"] = probeTLS("api:8443", "api", ca, cert, key, "/api/v1/users/me", "")
|
||||
return res
|
||||
}
|
||||
|
||||
+12
-3
@@ -326,6 +326,7 @@ services:
|
||||
- rabbitmq_data:/var/lib/rabbitmq
|
||||
- ./infra/rabbitmq/rabbitmq.conf:/etc/rabbitmq/conf.d/30-lab7.conf:ro
|
||||
- ./infra/rabbitmq/enabled_plugins:/etc/rabbitmq/enabled_plugins:ro
|
||||
- ./infra/rabbitmq/definitions.json:/etc/rabbitmq/lab7-definitions.json:ro
|
||||
secrets:
|
||||
- { source: ca_crt, target: ca.crt }
|
||||
- { source: rabbitmq_crt, target: rabbitmq.crt }
|
||||
@@ -348,14 +349,17 @@ services:
|
||||
relay:
|
||||
image: mtusi2026lab7-api:local
|
||||
<<: *hardened
|
||||
volumes:
|
||||
- fault_state:/var/lib/messenger/fault
|
||||
entrypoint: ["/app/pipeline", "relay"]
|
||||
environment:
|
||||
<<: *app-env
|
||||
OTEL_SERVICE_NAME: messenger-relay
|
||||
BAO_ROLE: relay
|
||||
BAO_KV_PATH: messenger/relay
|
||||
BROKER_DECLARE: "true"
|
||||
BROKER_DECLARE: "false" # топология — у оператора (definitions.json)
|
||||
FAULT_POINTS: ${RELAY_FAULT_POINTS:-}
|
||||
FAULT_DIR: /var/lib/messenger/fault
|
||||
secrets:
|
||||
- { source: ca_crt, target: ca.crt }
|
||||
- { source: relay_crt, target: service.crt }
|
||||
@@ -385,6 +389,8 @@ services:
|
||||
<<: *hardened
|
||||
tmpfs:
|
||||
- /tmp:size=256m,mode=1777 # cwebp: временный PNG/WebP одного изображения
|
||||
volumes:
|
||||
- fault_state:/var/lib/messenger/fault # маркеры точек сбоя (тесты; tmpfs очищается при restart)
|
||||
entrypoint: ["/app/pipeline", "worker"]
|
||||
environment:
|
||||
<<: *app-env
|
||||
@@ -393,6 +399,7 @@ services:
|
||||
BAO_KV_PATH: messenger/worker
|
||||
BROKER_DECLARE: "false"
|
||||
FAULT_POINTS: ${WORKER_FAULT_POINTS:-}
|
||||
FAULT_DIR: /var/lib/messenger/fault
|
||||
GOMEMLIMIT: ${WORKER_GOMEMLIMIT:-560MiB}
|
||||
secrets:
|
||||
- { source: ca_crt, target: ca.crt }
|
||||
@@ -502,7 +509,7 @@ services:
|
||||
networks: [telemetry]
|
||||
deploy:
|
||||
resources:
|
||||
limits: { cpus: "0.50", memory: 512M, pids: 256 }
|
||||
limits: { cpus: "0.50", memory: 1G, pids: 256 }
|
||||
|
||||
tempo-init:
|
||||
image: &tempo-image grafana/tempo:2.6.1
|
||||
@@ -510,6 +517,7 @@ services:
|
||||
entrypoint: ["chown", "10001:10001", "/var/tempo"]
|
||||
cap_drop: [ALL]
|
||||
cap_add: [CHOWN]
|
||||
security_opt: [no-new-privileges:true]
|
||||
volumes:
|
||||
- tempo_data:/var/tempo
|
||||
restart: "no"
|
||||
@@ -531,7 +539,7 @@ services:
|
||||
networks: [telemetry]
|
||||
deploy:
|
||||
resources:
|
||||
limits: { cpus: "0.50", memory: 512M, pids: 256 }
|
||||
limits: { cpus: "0.50", memory: 1G, pids: 256 }
|
||||
|
||||
grafana:
|
||||
image: grafana/grafana:11.4.0
|
||||
@@ -643,6 +651,7 @@ secrets:
|
||||
grafana_key: { file: ./secrets/pki/grafana.key }
|
||||
|
||||
volumes:
|
||||
fault_state:
|
||||
bao_data:
|
||||
prometheus_data:
|
||||
loki_data:
|
||||
|
||||
@@ -12,11 +12,11 @@ TLS шифрует и подтверждает сервер; mTLS также п
|
||||
|
||||
| Связь | Минимум на 3 | Дополнительно на 4 | Доказательство / конфиг |
|
||||
| --- | --- | --- | --- |
|
||||
| Клиент → ingress/LB | HTTPS `127.0.0.1:8443`, TLS ≥ 1.2, сертификат `lb-public` (SAN localhost, 127.0.0.1) от CA стенда; Bearer-сессия (токен 256 бит, в Redis — SHA-256 токена, TTL `SESSION_TTL_SECONDS`) | Logout/expiry → 401; лимит входа общий для реплик (Redis): 10/мин на username, 60/мин на IP → 429 + Retry-After; Argon2id не вычисляется при превышении | `infra/haproxy/haproxy.cfg`; `security_ops.py tls-external`, `acl`; `tests/security.py` |
|
||||
| Клиент → ingress/LB | HTTPS `127.0.0.1:8443`, TLS ≥ 1.2, сертификат `lb-public` (SAN localhost, 127.0.0.1) от CA стенда; Bearer-сессия (токен 256 бит, в Redis — SHA-256 токена, TTL `SESSION_TTL_SECONDS`) | Logout/expiry → 401; лимит входа общий для реплик (Redis): 10/мин на username, 60/мин на IP → 429 + Retry-After (слот резервируется до Argon2id, успешный вход его возвращает — считаются неудачные попытки); Argon2id не вычисляется при превышении | `infra/haproxy/haproxy.cfg`; `security_ops.py tls-external`, `acl`; `tests/security.py` |
|
||||
| LB → API (все реплики) | mTLS: HAProxy `ssl verify required ca-file ca.crt verifyhost api crt lb.pem`; API `RequireAndVerifyClientCert` + allowlist identity `spiffe://messenger/lb` (`API_ALLOWED_CLIENTS`). Порт API 8443 не опубликован, plaintext-порта нет | Ротация leaf `api` (перечитывается без рестарта) и `lb` (новый cert + reload HAProxy); старый `lb` отвергается по `revoked.txt` | `internal/tlsutil`, `cmd/api/main.go`; `security_ops.py mtls` (нет cert / чужой CA / identity attacker / identity worker → отказ, lb → 200), `rotation` |
|
||||
| API/worker → PostgreSQL | TLS `sslmode=verify-full` (CA стенда, имя `postgres`); `pg_hba`: только `hostssl … scram-sha-256`, `hostnossl … reject`. Роли: `app_api`, `app_worker`, `app_relay`, `app_reconciler` с минимальными GRANT (у worker нет `users`, `messages`, `chats`; UPDATE — по столбцам) | Пароль роли — в OpenBao; ротация `bootstrap.py rotate-db <svc>`: новые соединения берут новый пароль (BeforeConnect), старые закрываются (lifetime 10 мин или `pg_terminate_backend` при отзыве) | `migrations/0007_service_roles.up.sql`, `infra/postgres/pg_hba.conf`; `security_ops.py mtls` (sslmode=disable → отказ), `rotation` (старый пароль → отказ), `compromise.py` (матрица прав роли worker) |
|
||||
| API/worker → S3 | HTTPS (MinIO `--certs-dir`, CA стенда); пользователь на сервис: `svc-api` (PUT s/, GET o/ v/ a/ s/, DELETE s/), `svc-worker` (GET s/, PUT v/ o/, DELETE s/), `svc-relay` (DELETE s/), `svc-reconciler` (LIST, GET/DELETE — сверка) | Отказ по чужому префиксу (worker: PUT s/, GET o/, LIST → AccessDenied); ротация `bootstrap.py rotate-s3 <svc>` без рестарта (minio-go перечитывает ключ при смене версии KV) | `infra/s3/init.sh`; `compromise.py`, `security_ops.py rotation` |
|
||||
| API/worker → broker | AMQPS 5671, `listeners.tcp = none`; разные identities: relay = CN `relay-g1` (publish + объявление топологии), worker = CN `worker-g1` (только read `attachment.process`) | mTLS обязателен (`fail_if_no_peer_cert`), SASL EXTERNAL: пользователь = CN; сертификат того же CA с CN `lb`/`attacker` → нет такого пользователя → отказ; паролей нет | `infra/rabbitmq/rabbitmq.conf`, `bootstrap.py rabbit_users`; `security_ops.py mtls` (матрица прав relay/worker) |
|
||||
| API/worker → broker | AMQPS 5671, `listeners.tcp = none`; разные identities: relay = CN `relay-g1` (только write в exchange `attachments`), worker = CN `worker-g1` (только read `attachment.process`); configure нет ни у кого — топологию (quorum-очереди, DLX) создаёт оператор импортом `infra/rabbitmq/definitions.json` | mTLS обязателен (`fail_if_no_peer_cert`), SASL EXTERNAL: пользователь = CN; сертификат того же CA с CN `lb`/`attacker` → нет такого пользователя → отказ; паролей нет | `infra/rabbitmq/rabbitmq.conf`, `infra/rabbitmq/definitions.json`, `bootstrap.py rabbit_users`; `security_ops.py mtls` (матрица прав relay/worker) |
|
||||
| API/worker → Collector | OTLP/HTTPS 4318, сертификат Collector от CA стенда; ingest разрешён только с клиентским сертификатом CA телеметрии | Раздельные identities `api`/`worker`/`relay` (CN) в CA телеметрии; сертификат основного CA (lb, worker) → отказ | `infra/otel/collector.yaml`, `OTEL_EXPORTER_OTLP_*CERTIFICATE*`; `security_ops.py mtls` |
|
||||
| Collector → telemetry backends | mTLS: Collector → Tempo (gRPC 4317) и Loki (HTTPS 3100) с сертификатом `otel-collector`; Prometheus забирает метрики Collector (8889) по mTLS сертификатом `prometheus` | Backend-ы требуют клиентский сертификат CA стенда (без cert → отказ); ротация — `pki.sh rotate otel-collector` + перезапуск Collector | `infra/tempo/tempo.yaml`, `infra/loki/loki.yaml`, `infra/prometheus/prometheus.yml`; `security_ops.py mtls` (servers) |
|
||||
| Grafana → data sources | HTTPS к Prometheus/Loki/Tempo, проверка сервера (`tlsAuthWithCACert`, `serverName`), клиентский сертификат `grafana` | Без клиентского сертификата backend отказывает (проверено зондом) | `infra/grafana/provisioning/datasources/datasources.yaml`, `infra/prometheus/web.yml` |
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
source_commit=a414221d756744e90c2b9b498b66f386a3a7d062
|
||||
run=https://github.com/CharaWein/2026_lab3/actions/runs/43267046991
|
||||
go_tests=success
|
||||
stand=success
|
||||
scan=success
|
||||
@@ -0,0 +1,5 @@
|
||||
# Доказательства
|
||||
|
||||
Храните небольшие обезличенные результаты: команды и stdout проверок, JSON/CSV агрегатов нагрузки, EXPLAIN, dashboard JSON, текст разбора отказа. Укажите дату, commit, аппаратные лимиты и профиль нагрузки.
|
||||
|
||||
Не добавляйте .env, session tokens, cookies, приватные ключи, credentials, реальные сообщения, raw dumps и signed URLs. Для скриншотов скрывайте секреты. Большие логи/бинарные traces сохраняйте отдельно по правилам преподавателя; одного скриншота без методики недостаточно.
|
||||
@@ -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
|
||||
@@ -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
|
||||
@@ -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
|
||||
@@ -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
|
||||
@@ -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)
|
||||
@@ -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)
|
||||
@@ -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
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -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
|
||||
@@ -0,0 +1,2 @@
|
||||
6e304db1ea6a4190 10
|
||||
749718ebe6b58adb 10
|
||||
@@ -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)
|
||||
@@ -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)
|
||||
@@ -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 нагрузки)
|
||||
@@ -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."
|
||||
}
|
||||
@@ -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
|
||||
@@ -0,0 +1 @@
|
||||
PASS: lab7 public API scenario; infrastructure and grading evidence remain separate.
|
||||
@@ -0,0 +1 @@
|
||||
PASS: trusted HTTPS works; untrusted CA rejected. This does NOT verify internal mTLS, OpenBao or hardening.
|
||||
@@ -0,0 +1,5 @@
|
||||
# Доказательства
|
||||
|
||||
Храните небольшие обезличенные результаты: команды и stdout проверок, JSON/CSV агрегатов нагрузки, EXPLAIN, dashboard JSON, текст разбора отказа. Укажите дату, commit, аппаратные лимиты и профиль нагрузки.
|
||||
|
||||
Не добавляйте .env, session tokens, cookies, приватные ключи, credentials, реальные сообщения, raw dumps и signed URLs. Для скриншотов скрывайте секреты. Большие логи/бинарные traces сохраняйте отдельно по правилам преподавателя; одного скриншота без методики недостаточно.
|
||||
@@ -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]
|
||||
@@ -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
|
||||
@@ -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
|
||||
@@ -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
|
||||
@@ -0,0 +1,4 @@
|
||||
=== RUN TestOptimizedWebP
|
||||
--- PASS: TestOptimizedWebP (0.34s)
|
||||
PASS
|
||||
ok github.com/charawein/mtusi2026lab7/internal/imaging 0.350s
|
||||
@@ -0,0 +1,5 @@
|
||||
# Доказательства
|
||||
|
||||
Храните небольшие обезличенные результаты: команды и stdout проверок, JSON/CSV агрегатов нагрузки, EXPLAIN, dashboard JSON, текст разбора отказа. Укажите дату, commit, аппаратные лимиты и профиль нагрузки.
|
||||
|
||||
Не добавляйте .env, session tokens, cookies, приватные ключи, credentials, реальные сообщения, raw dumps и signed URLs. Для скриншотов скрывайте секреты. Большие логи/бинарные traces сохраняйте отдельно по правилам преподавателя; одного скриншота без методики недостаточно.
|
||||
@@ -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
|
||||
@@ -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
|
||||
@@ -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
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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"
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
@@ -0,0 +1,5 @@
|
||||
# Доказательства
|
||||
|
||||
Храните небольшие обезличенные результаты: команды и stdout проверок, JSON/CSV агрегатов нагрузки, EXPLAIN, dashboard JSON, текст разбора отказа. Укажите дату, commit, аппаратные лимиты и профиль нагрузки.
|
||||
|
||||
Не добавляйте .env, session tokens, cookies, приватные ключи, credentials, реальные сообщения, raw dumps и signed URLs. Для скриншотов скрывайте секреты. Большие логи/бинарные traces сохраняйте отдельно по правилам преподавателя; одного скриншота без методики недостаточно.
|
||||
@@ -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.
|
||||
@@ -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.
|
||||
@@ -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']
|
||||
@@ -0,0 +1,5 @@
|
||||
# Доказательства
|
||||
|
||||
Храните небольшие обезличенные результаты: команды и stdout проверок, JSON/CSV агрегатов нагрузки, EXPLAIN, dashboard JSON, текст разбора отказа. Укажите дату, commit, аппаратные лимиты и профиль нагрузки.
|
||||
|
||||
Не добавляйте .env, session tokens, cookies, приватные ключи, credentials, реальные сообщения, raw dumps и signed URLs. Для скриншотов скрывайте секреты. Большие логи/бинарные traces сохраняйте отдельно по правилам преподавателя; одного скриншота без методики недостаточно.
|
||||
@@ -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
|
||||
@@ -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
|
||||
@@ -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
|
||||
@@ -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
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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": []
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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\", "
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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"
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
@@ -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"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
# Доказательства
|
||||
|
||||
Храните небольшие обезличенные результаты: команды и stdout проверок, JSON/CSV агрегатов нагрузки, EXPLAIN, dashboard JSON, текст разбора отказа. Укажите дату, commit, аппаратные лимиты и профиль нагрузки.
|
||||
|
||||
Не добавляйте .env, session tokens, cookies, приватные ключи, credentials, реальные сообщения, raw dumps и signed URLs. Для скриншотов скрывайте секреты. Большие логи/бинарные traces сохраняйте отдельно по правилам преподавателя; одного скриншота без методики недостаточно.
|
||||
@@ -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
|
||||
@@ -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
|
||||
@@ -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
|
||||
@@ -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
|
||||
@@ -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"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1043,7 +1043,8 @@
|
||||
"mode": "none"
|
||||
}
|
||||
},
|
||||
"min": 0
|
||||
"min": 0,
|
||||
"max": 1
|
||||
},
|
||||
"overrides": []
|
||||
},
|
||||
|
||||
@@ -10,6 +10,9 @@
|
||||
# ограниченной очереди), вместо бесконечного роста RSS;
|
||||
# batch — пакеты до 1024 элементов / 2 s;
|
||||
# sending_queue (in-memory, queue_size пакетов) + retry_on_failure (≤ 60 s) —
|
||||
# размер подобран так, чтобы очередь целиком (20 пакетов × 1024 spans) помещалась
|
||||
# ниже soft limit memory_limiter: при queue_size 200 и пакетах до 2048 очередь при
|
||||
# отказе Tempo упиралась в hard limit, и Collector отвергал НОВЫЕ данные (прогон 4);
|
||||
# при недоступном Tempo/Loki данные ждут ограниченное время в ограниченной
|
||||
# очереди, затем отбрасываются и считаются в otelcol_exporter_send_failed_*.
|
||||
# Метрики не буферизуются вовсе: exporter prometheus хранит только текущее
|
||||
@@ -52,7 +55,7 @@ processors:
|
||||
spike_limit_mib: 50
|
||||
batch:
|
||||
send_batch_size: 1024
|
||||
send_batch_max_size: 2048
|
||||
send_batch_max_size: 1024
|
||||
timeout: 2s
|
||||
# Защита от утечек на случай ошибки инструментирования: такие ключи не должны
|
||||
# появляться, но если появятся — удаляются до экспорта.
|
||||
@@ -75,7 +78,7 @@ exporters:
|
||||
sending_queue:
|
||||
enabled: true
|
||||
num_consumers: 2
|
||||
queue_size: 200
|
||||
queue_size: 20 # ≤ 20 пакетов × ≤ 1024 элемента: очередь помещается в memory_limiter
|
||||
retry_on_failure:
|
||||
enabled: true
|
||||
initial_interval: 1s
|
||||
@@ -90,7 +93,7 @@ exporters:
|
||||
sending_queue:
|
||||
enabled: true
|
||||
num_consumers: 2
|
||||
queue_size: 200
|
||||
queue_size: 20 # ≤ 20 пакетов × ≤ 1024 элемента: очередь помещается в memory_limiter
|
||||
retry_on_failure:
|
||||
enabled: true
|
||||
initial_interval: 1s
|
||||
|
||||
@@ -7,6 +7,9 @@
|
||||
# ограниченной очереди), вместо бесконечного роста RSS;
|
||||
# batch — пакеты до 1024 элементов / 2 s;
|
||||
# sending_queue (in-memory, queue_size пакетов) + retry_on_failure (≤ 60 s) —
|
||||
# размер подобран так, чтобы очередь целиком (20 пакетов × 1024 spans) помещалась
|
||||
# ниже soft limit memory_limiter: при queue_size 200 и пакетах до 2048 очередь при
|
||||
# отказе Tempo упиралась в hard limit, и Collector отвергал НОВЫЕ данные (прогон 4);
|
||||
# при недоступном Tempo/Loki данные ждут ограниченное время в ограниченной
|
||||
# очереди, затем отбрасываются и считаются в otelcol_exporter_send_failed_*.
|
||||
# Метрики не буферизуются вовсе: exporter prometheus хранит только текущее
|
||||
@@ -31,7 +34,7 @@ processors:
|
||||
spike_limit_mib: 50
|
||||
batch:
|
||||
send_batch_size: 1024
|
||||
send_batch_max_size: 2048
|
||||
send_batch_max_size: 1024
|
||||
timeout: 2s
|
||||
# Защита от утечек на случай ошибки инструментирования: такие ключи не должны
|
||||
# появляться, но если появятся — удаляются до экспорта.
|
||||
@@ -54,7 +57,7 @@ exporters:
|
||||
sending_queue:
|
||||
enabled: true
|
||||
num_consumers: 2
|
||||
queue_size: 200
|
||||
queue_size: 20 # ≤ 20 пакетов × ≤ 1024 элемента: очередь помещается в memory_limiter
|
||||
retry_on_failure:
|
||||
enabled: true
|
||||
initial_interval: 1s
|
||||
@@ -69,7 +72,7 @@ exporters:
|
||||
sending_queue:
|
||||
enabled: true
|
||||
num_consumers: 2
|
||||
queue_size: 200
|
||||
queue_size: 20 # ≤ 20 пакетов × ≤ 1024 элемента: очередь помещается в memory_limiter
|
||||
retry_on_failure:
|
||||
enabled: true
|
||||
initial_interval: 1s
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
{
|
||||
"rabbit_version": "4.0.9",
|
||||
"vhosts": [{"name": "/"}],
|
||||
"exchanges": [
|
||||
{"name": "attachments", "vhost": "/", "type": "direct", "durable": true, "auto_delete": false, "internal": false, "arguments": {}},
|
||||
{"name": "attachments.dlx", "vhost": "/", "type": "fanout", "durable": true, "auto_delete": false, "internal": false, "arguments": {}}
|
||||
],
|
||||
"queues": [
|
||||
{"name": "attachment.dead", "vhost": "/", "durable": true, "auto_delete": false, "arguments": {"x-queue-type": "quorum"}},
|
||||
{"name": "attachment.process", "vhost": "/", "durable": true, "auto_delete": false,
|
||||
"arguments": {"x-queue-type": "quorum", "x-dead-letter-exchange": "attachments.dlx", "x-delivery-limit": 10}}
|
||||
],
|
||||
"bindings": [
|
||||
{"source": "attachments", "vhost": "/", "destination": "attachment.process", "destination_type": "queue", "routing_key": "process", "arguments": {}},
|
||||
{"source": "attachments.dlx", "vhost": "/", "destination": "attachment.dead", "destination_type": "queue", "routing_key": "", "arguments": {}}
|
||||
]
|
||||
}
|
||||
@@ -20,6 +20,11 @@ distributor:
|
||||
cert_file: /run/secrets/tempo.crt
|
||||
key_file: /run/secrets/tempo.key
|
||||
client_ca_file: /run/secrets/ca.crt
|
||||
# Явный адрес frontend для querier в single-binary: автоматическая настройка после
|
||||
# рестарта Tempo оставляла запросы без ответа (прогон 4, отказ backend).
|
||||
querier:
|
||||
frontend_worker:
|
||||
frontend_address: 127.0.0.1:9095
|
||||
ingester:
|
||||
max_block_duration: 5m
|
||||
compactor:
|
||||
|
||||
@@ -83,7 +83,7 @@ func Load() Config {
|
||||
S3SecretKey: readSecretFile("S3_SECRET_ACCESS_KEY_FILE"),
|
||||
MaxUploadBytes: int64(getInt("MAX_UPLOAD_BYTES", 10*1024*1024)),
|
||||
MaxImagePixels: int64(getInt("MAX_IMAGE_PIXELS", 40_000_000)),
|
||||
BrokerURL: readSecretFile("BROKER_URL_FILE"),
|
||||
BrokerURL: firstNonEmpty(getEnv("BROKER_URL", ""), readSecretFile("BROKER_URL_FILE")), // lab7: amqps без пароля (EXTERNAL)
|
||||
PipelineVersion: max(1, getInt("PIPELINE_VERSION", 1)),
|
||||
JobMaxAttempts: max(1, getInt("JOB_MAX_ATTEMPTS", 5)),
|
||||
JobTimeout: time.Duration(max(5, getInt("JOB_TIMEOUT_SECONDS", 60))) * time.Second,
|
||||
@@ -174,3 +174,12 @@ func parseDuration(s string) time.Duration {
|
||||
}
|
||||
return d
|
||||
}
|
||||
|
||||
func firstNonEmpty(v ...string) string {
|
||||
for _, x := range v {
|
||||
if x != "" {
|
||||
return x
|
||||
}
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
@@ -17,6 +17,8 @@ import (
|
||||
"crypto/tls"
|
||||
"crypto/x509"
|
||||
"fmt"
|
||||
"io"
|
||||
"log/slog"
|
||||
"net/url"
|
||||
"os"
|
||||
"strings"
|
||||
@@ -116,7 +118,7 @@ func (p *Platform) Redis(ctx context.Context) (*redis.Client, error) {
|
||||
}
|
||||
|
||||
// S3 — TLS к MinIO, ключ сервиса из OpenBao.
|
||||
func (p *Platform) S3() (*storage.S3, error) {
|
||||
func (p *Platform) S3() (storage.Store, error) {
|
||||
if p.Secrets == nil {
|
||||
return storage.NewS3(p.Cfg.S3Endpoint, p.Cfg.S3Region, p.Cfg.S3Bucket, p.Cfg.S3AccessKey, p.Cfg.S3SecretKey)
|
||||
}
|
||||
@@ -124,8 +126,12 @@ func (p *Platform) S3() (*storage.S3, error) {
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return storage.NewS3WithCreds(p.Cfg.S3Endpoint, p.Cfg.S3Region, p.Cfg.S3Bucket,
|
||||
st, err := storage.NewS3WithCreds(p.Cfg.S3Endpoint, p.Cfg.S3Region, p.Cfg.S3Bucket,
|
||||
credentials.New(&s3Provider{m: p.Secrets}), pool)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return authRetryStore{Store: st, m: p.Secrets}, nil
|
||||
}
|
||||
|
||||
// BrokerTLS — mTLS к RabbitMQ (пользователь = CN сертификата, SASL EXTERNAL).
|
||||
@@ -163,3 +169,73 @@ func (s *s3Provider) IsExpired() bool {
|
||||
defer s.mu.Unlock()
|
||||
return s.m.Version() != s.ver
|
||||
}
|
||||
|
||||
// authRetryStore: S3 отверг ключ (InvalidAccessKeyId/SignatureDoesNotMatch) →
|
||||
// внеочередное чтение секрета из OpenBao и один повтор, если версия сменилась.
|
||||
// Так ротация/отзыв ключа S3 (сначала MinIO, затем KV) не сжигает попытки работ
|
||||
// в окне до планового обновления секретов (SECRETS_REFRESH).
|
||||
type authRetryStore struct {
|
||||
storage.Store
|
||||
m *secrets.Manager
|
||||
}
|
||||
|
||||
func (s authRetryStore) retry(ctx context.Context, err error) bool {
|
||||
if err == nil || !storage.IsAuthError(err) {
|
||||
return false
|
||||
}
|
||||
changed := s.m.SyncNow(ctx)
|
||||
if changed {
|
||||
slog.Info("s3 credentials refreshed after auth error", "event", "secrets.s3_auth_retry", "version", s.m.Version())
|
||||
}
|
||||
return changed
|
||||
}
|
||||
|
||||
func (s authRetryStore) Put(ctx context.Context, key string, r io.Reader, size int64, ct string) error {
|
||||
err := s.Store.Put(ctx, key, r, size, ct)
|
||||
if sk, ok := r.(io.Seeker); ok && s.retry(ctx, err) {
|
||||
if _, serr := sk.Seek(0, io.SeekStart); serr == nil {
|
||||
return s.Store.Put(ctx, key, r, size, ct)
|
||||
}
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
func (s authRetryStore) Get(ctx context.Context, key string) (io.ReadCloser, int64, error) {
|
||||
rc, n, err := s.Store.Get(ctx, key)
|
||||
if s.retry(ctx, err) {
|
||||
return s.Store.Get(ctx, key)
|
||||
}
|
||||
return rc, n, err
|
||||
}
|
||||
|
||||
func (s authRetryStore) Stat(ctx context.Context, key string) (storage.Object, error) {
|
||||
o, err := s.Store.Stat(ctx, key)
|
||||
if s.retry(ctx, err) {
|
||||
return s.Store.Stat(ctx, key)
|
||||
}
|
||||
return o, err
|
||||
}
|
||||
|
||||
func (s authRetryStore) Delete(ctx context.Context, key string) error {
|
||||
err := s.Store.Delete(ctx, key)
|
||||
if s.retry(ctx, err) {
|
||||
return s.Store.Delete(ctx, key)
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
func (s authRetryStore) Copy(ctx context.Context, src, dst string) error {
|
||||
err := s.Store.Copy(ctx, src, dst)
|
||||
if s.retry(ctx, err) {
|
||||
return s.Store.Copy(ctx, src, dst)
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
func (s authRetryStore) List(ctx context.Context, prefix string, fn func(storage.Object) error) error {
|
||||
err := s.Store.List(ctx, prefix, fn)
|
||||
if s.retry(ctx, err) {
|
||||
return s.Store.List(ctx, prefix, fn)
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -44,6 +44,9 @@ type Manager struct {
|
||||
version int
|
||||
lastOK time.Time
|
||||
lastErr string
|
||||
|
||||
syncMu sync.Mutex // фоновый цикл и SyncNow не синхронизируются одновременно
|
||||
lastSync time.Time
|
||||
}
|
||||
|
||||
// Config — адрес OpenBao (https), роль cert-auth и путь KV v2 (mount secret).
|
||||
@@ -81,7 +84,8 @@ func (m *Manager) Start(ctx context.Context) error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
go m.loop(ctx)
|
||||
// цикл живёт дольше контекста запуска (у api это bootCtx с таймаутом 90 s)
|
||||
go m.loop(context.WithoutCancel(ctx))
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -93,7 +97,11 @@ func (m *Manager) loop(ctx context.Context) {
|
||||
case <-ctx.Done():
|
||||
return
|
||||
case <-t.C:
|
||||
if err := m.sync(ctx); err != nil {
|
||||
m.syncMu.Lock()
|
||||
err := m.sync(ctx)
|
||||
m.lastSync = time.Now()
|
||||
m.syncMu.Unlock()
|
||||
if err != nil {
|
||||
m.mu.Lock()
|
||||
m.lastErr = err.Error()
|
||||
m.mu.Unlock()
|
||||
@@ -147,6 +155,11 @@ func (m *Manager) ensureToken(ctx context.Context) error {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
// cert auth проверяет сертификат TLS-соединения. Keep-alive соединение несёт
|
||||
// сертификат, предъявленный при его рукопожатии, — после ротации identity
|
||||
// (worker-g1 → g2) это был бы старый, уже отозванный. Новое рукопожатие берёт
|
||||
// текущий файл сертификата (KeyPair перечитывает его).
|
||||
m.http.CloseIdleConnections()
|
||||
var out authResp
|
||||
if err := m.call(ctx, "POST", "/v1/auth/cert/login", "", map[string]any{"name": m.role}, &out); err != nil {
|
||||
return fmt.Errorf("cert login: %w", err)
|
||||
@@ -222,6 +235,23 @@ func (m *Manager) call(ctx context.Context, method, path, token string, body any
|
||||
return json.Unmarshal(raw, out)
|
||||
}
|
||||
|
||||
// SyncNow — внеочередное чтение секрета, когда зависимость отвергла credentials
|
||||
// (оператор уже сменил ключ в хранилище, а плановое обновление ещё не наступило).
|
||||
// Не чаще раза в 2 s: волна ошибок не превращается в волну запросов к OpenBao.
|
||||
// Возвращает true, если версия секрета изменилась.
|
||||
func (m *Manager) SyncNow(ctx context.Context) bool {
|
||||
m.syncMu.Lock()
|
||||
defer m.syncMu.Unlock()
|
||||
before := m.Version()
|
||||
if time.Since(m.lastSync) >= 2*time.Second {
|
||||
m.lastSync = time.Now()
|
||||
if err := m.sync(ctx); err != nil {
|
||||
slog.Warn("secrets sync on auth error failed", "event", "secrets.refresh_failed", "err", err)
|
||||
}
|
||||
}
|
||||
return m.Version() != before
|
||||
}
|
||||
|
||||
// Get — текущее значение ключа (из последней успешной версии).
|
||||
func (m *Manager) Get(key string) string {
|
||||
m.mu.RLock()
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
package storage
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"testing"
|
||||
|
||||
"github.com/minio/minio-go/v7"
|
||||
)
|
||||
|
||||
func TestIsAuthError(t *testing.T) {
|
||||
wrap := func(code string) error { return fmt.Errorf("s3 put: %w", minio.ErrorResponse{Code: code}) }
|
||||
for code, want := range map[string]bool{
|
||||
"InvalidAccessKeyId": true, // ключ удалён (отзыв)
|
||||
"SignatureDoesNotMatch": true, // secret key сменён (ротация)
|
||||
"AccessDenied": false, // отказ политики по префиксу — повтор не поможет
|
||||
"NoSuchKey": false,
|
||||
} {
|
||||
if got := IsAuthError(wrap(code)); got != want {
|
||||
t.Errorf("%s: got %v, want %v", code, got, want)
|
||||
}
|
||||
}
|
||||
if IsAuthError(errors.New("dial tcp: connection refused")) || IsAuthError(nil) {
|
||||
t.Error("non-S3 error classified as auth error")
|
||||
}
|
||||
}
|
||||
@@ -74,6 +74,16 @@ func NewS3WithCreds(endpoint, region, bucket string, creds *credentials.Credenti
|
||||
return &S3{client: c, bucket: bucket}, nil
|
||||
}
|
||||
|
||||
// IsAuthError — S3 отверг credentials (ключ сменён или удалён). AccessDenied сюда не
|
||||
// входит: это отказ политики по префиксу, повтор с тем же ключом его не исправит.
|
||||
func IsAuthError(err error) bool {
|
||||
var er minio.ErrorResponse
|
||||
if !errors.As(err, &er) {
|
||||
return false
|
||||
}
|
||||
return er.Code == "InvalidAccessKeyId" || er.Code == "SignatureDoesNotMatch"
|
||||
}
|
||||
|
||||
func isNotFound(err error) bool {
|
||||
code := minio.ToErrorResponse(err).Code
|
||||
return code == "NoSuchKey" || code == "NotFound"
|
||||
|
||||
@@ -93,6 +93,10 @@ func (l *LoginLimiter) Wrap(next http.Handler) http.Handler {
|
||||
kind string
|
||||
}{hkey("rl:login:user:", strings.ToLower(u)), l.perUser, "user"})
|
||||
}
|
||||
// Слот резервируется ДО Argon2id (INCR атомарен — всплеск параллельных попыток
|
||||
// не проходит мимо лимита), а успешный вход его возвращает (DECR): лимит
|
||||
// считает только неудачные попытки, легитимные входы с одного IP его не тратят.
|
||||
var reserved []string
|
||||
for _, c := range checks {
|
||||
n, ttl, err := l.hit(r, c.key)
|
||||
if err != nil {
|
||||
@@ -111,7 +115,28 @@ func (l *LoginLimiter) Wrap(next http.Handler) http.Handler {
|
||||
httputil.WriteError(w, r, service.ErrRateLimited)
|
||||
return
|
||||
}
|
||||
reserved = append(reserved, c.key)
|
||||
}
|
||||
sw := &statusWriter{ResponseWriter: w, status: http.StatusOK}
|
||||
next.ServeHTTP(sw, r)
|
||||
if sw.status < 400 {
|
||||
for _, k := range reserved {
|
||||
if err := l.rdb.Decr(r.Context(), k).Err(); err != nil {
|
||||
slog.WarnContext(r.Context(), "login limiter refund failed", "event", "auth.ratelimit_error", "err", err)
|
||||
}
|
||||
}
|
||||
}
|
||||
next.ServeHTTP(w, r)
|
||||
})
|
||||
}
|
||||
|
||||
type statusWriter struct {
|
||||
http.ResponseWriter
|
||||
status int
|
||||
}
|
||||
|
||||
func (s *statusWriter) WriteHeader(code int) {
|
||||
s.status = code
|
||||
s.ResponseWriter.WriteHeader(code)
|
||||
}
|
||||
|
||||
func (s *statusWriter) Unwrap() http.ResponseWriter { return s.ResponseWriter }
|
||||
|
||||
@@ -79,6 +79,10 @@ func Telemetry(next http.Handler) http.Handler {
|
||||
attribute.String("request_id", httputil.RequestIDFrom(r.Context())),
|
||||
))
|
||||
defer span.End()
|
||||
if sc := span.SpanContext(); sc.IsSampled() {
|
||||
// W3C Trace Context Level 2: клиент (и тест) получает ID трассы своего запроса.
|
||||
w.Header().Set("traceresponse", "00-"+sc.TraceID().String()+"-"+sc.SpanID().String()+"-01")
|
||||
}
|
||||
methodAttr := attribute.String("http.request.method", r.Method)
|
||||
inflight.Add(ctx, 1, metric.WithAttributes(methodAttr))
|
||||
defer inflight.Add(ctx, -1, metric.WithAttributes(methodAttr))
|
||||
|
||||
@@ -65,6 +65,13 @@ type Config struct {
|
||||
FaultPoints map[string]bool
|
||||
FaultDir string
|
||||
DeleteStaging bool
|
||||
// ClaimRetryDelay — пауза перед возвратом сообщения в очередь, если claim не удался
|
||||
// (БД недоступна, пароль роли ротирован). Без неё redelivery идёт ~раз в секунду и
|
||||
// quorum-очередь (x-delivery-limit=10) уводит сообщение в DLQ за ~10 s сбоя.
|
||||
ClaimRetryDelay time.Duration
|
||||
// OnClaimError — реакция платформы на ошибку БД (внеочередное чтение секрета при
|
||||
// отказе аутентификации); nil — нет.
|
||||
OnClaimError func(ctx context.Context, err error)
|
||||
}
|
||||
|
||||
type Worker struct {
|
||||
@@ -126,12 +133,15 @@ func (e *permanentError) Error() string { return e.code + ": " + e.err.Error() }
|
||||
func permanent(code string, err error) error { return &permanentError{code: code, err: err} }
|
||||
|
||||
// Fault — точка внедрения сбоя (трек 5): процесс завершается как при kill -9
|
||||
// ровно один раз (маркер в FaultDir переживает перезапуск контейнера).
|
||||
// ровно один раз на контейнер: маркер в FaultDir (volume — переживает перезапуск
|
||||
// контейнера, tmpfs и read-only rootfs lab7 — нет) с hostname, т.е. ID контейнера:
|
||||
// после restart сбоя нет, пересозданный контейнер снова падает один раз.
|
||||
func Fault(points map[string]bool, dir, point string, exit func(int)) {
|
||||
if !points[point] {
|
||||
return
|
||||
}
|
||||
marker := filepath.Join(dir, "fault-"+point)
|
||||
host, _ := os.Hostname()
|
||||
marker := filepath.Join(dir, "fault-"+point+"-"+host)
|
||||
if _, err := os.Stat(marker); err == nil {
|
||||
return
|
||||
}
|
||||
@@ -185,6 +195,15 @@ func (w *Worker) Handle(ctx context.Context, body []byte) Decision {
|
||||
if err != nil {
|
||||
log.WarnContext(ctx, "claim failed, requeue", "event", "job.claim_failed", "err", err)
|
||||
outcome = "requeue"
|
||||
if w.cfg.OnClaimError != nil {
|
||||
w.cfg.OnClaimError(ctx, err)
|
||||
}
|
||||
if w.cfg.ClaimRetryDelay > 0 {
|
||||
select {
|
||||
case <-ctx.Done():
|
||||
case <-time.After(w.cfg.ClaimRetryDelay):
|
||||
}
|
||||
}
|
||||
return Requeue
|
||||
}
|
||||
switch claim {
|
||||
|
||||
+15
-6
@@ -99,7 +99,8 @@ def unseal():
|
||||
return
|
||||
keys = init_json()['unseal_keys_b64']
|
||||
for k in keys[:2]:
|
||||
bao('operator', 'unseal', '-', token=False, input=k + '\n')
|
||||
# Доля unseal — через stdin (key=-), не аргументом командной строки.
|
||||
bao('write', '-format=json', 'sys/unseal', 'key=-', token=False, input=k)
|
||||
st = bao_status()
|
||||
print('openbao sealed=%s' % st['sealed'])
|
||||
|
||||
@@ -158,12 +159,19 @@ def ensure_creds():
|
||||
def write_backend_files(creds):
|
||||
acl = OP / 'redis_users.acl'
|
||||
h = hashlib.sha256(creds['api']['redis_password'].encode()).hexdigest()
|
||||
# Операторская учётка Redis (администрирование, регрессионный тест ACL); приложениям не выдаётся.
|
||||
opf = OP / 'redis_operator_password'
|
||||
if not opf.exists():
|
||||
opf.write_text(rnd.token_hex(24))
|
||||
os.chmod(opf, 0o600)
|
||||
ho = hashlib.sha256(opf.read_text().strip().encode()).hexdigest()
|
||||
# default отключён; api — только свои ключи и нужные команды; healthcheck — только PING.
|
||||
acl.write_text(
|
||||
'user default off\n'
|
||||
'user healthcheck on nopass resetkeys resetchannels -@all +ping +hello +auth\n'
|
||||
'user api on #%s resetchannels ~session:* ~messages:* ~rl:* -@all +@connection '
|
||||
'+get +set +del +ttl +scan +incr +expire +multi +exec +discard +ping\n' % h)
|
||||
'+get +set +del +ttl +scan +incr +decr +expire +multi +exec +discard +ping\n'
|
||||
'user operator on #%s ~* &* +@all\n' % (h, ho))
|
||||
s3 = OP / 's3_users.txt'
|
||||
s3.write_text(''.join('%s %s %s\n' % (s, creds[s]['s3_access_key'], creds[s]['s3_secret_key']) for s in SERVICES))
|
||||
for p in (acl, s3):
|
||||
@@ -183,10 +191,11 @@ def rabbit_users(worker_cn='worker-g1', relay_cn='relay-g1', drop=()):
|
||||
names = {u['user'] for u in json.loads(users or '[]')}
|
||||
if 'guest' in names:
|
||||
ctl('delete_user', 'guest')
|
||||
perms = {relay_cn: (r'^(attachments|attachments\.dlx|attachment\.process|attachment\.dead)$',
|
||||
r'^(attachments|attachments\.dlx|attachment\.process|attachment\.dead)$',
|
||||
r'^(attachments|attachments\.dlx)$'),
|
||||
worker_cn: ('^$', '^$', r'^attachment\.process$')}
|
||||
# Топологию (exchange, quorum-очереди, DLX, bindings) создаёт оператор импортом
|
||||
# infra/rabbitmq/definitions.json; сервисам configure не нужен вовсе.
|
||||
ctl('import_definitions', '/etc/rabbitmq/lab7-definitions.json')
|
||||
perms = {relay_cn: ('^$', r'^attachments$', '^$'), # только publish в exchange attachments
|
||||
worker_cn: ('^$', '^$', r'^attachment\.process$')} # только чтение своей очереди
|
||||
for u, (conf, write, read) in perms.items():
|
||||
if u not in names:
|
||||
# Пароль случайный и сразу удаляется: вход только SASL EXTERNAL (сертификат).
|
||||
|
||||
@@ -85,7 +85,7 @@ EOF
|
||||
}
|
||||
|
||||
security() {
|
||||
for s in tls-external mtls acl openbao hardening rotation lifecycle argon2 leaks; do
|
||||
for s in tls-external mtls acl openbao hardening rotation lifecycle leaks argon2; do
|
||||
step "безопасность: $s"
|
||||
$PY student-tests/security_ops.py "$s" --base-url "$BASE" --ca-file "$CA_FILE" --output "evidence/security/$s.json" > "evidence/security/$s.log" 2>&1 || echo "FAILED: $s"
|
||||
tail -1 "evidence/security/$s.log"
|
||||
|
||||
@@ -31,7 +31,7 @@ def row(title):
|
||||
y += 1
|
||||
|
||||
|
||||
def ts(title, targets, unit, x, w=8, h=8, desc='', stack=False, minv=None):
|
||||
def ts(title, targets, unit, x, w=8, h=8, desc='', stack=False, minv=None, maxv=None):
|
||||
p = {'type': 'timeseries', 'title': title, 'id': nid(), 'datasource': PROM, 'description': desc,
|
||||
'gridPos': {'h': h, 'w': w, 'x': x, 'y': y},
|
||||
'fieldConfig': {'defaults': {'unit': unit, 'custom': {'fillOpacity': 10, 'showPoints': 'never',
|
||||
@@ -42,6 +42,8 @@ def ts(title, targets, unit, x, w=8, h=8, desc='', stack=False, minv=None):
|
||||
'exemplar': True} for i, (e, l) in enumerate(targets)]}
|
||||
if minv is not None:
|
||||
p['fieldConfig']['defaults']['min'] = minv
|
||||
if maxv is not None:
|
||||
p['fieldConfig']['defaults']['max'] = maxv
|
||||
panels.append(p)
|
||||
|
||||
|
||||
@@ -118,7 +120,7 @@ ts('RabbitMQ: сообщения в очередях',
|
||||
'none', 16)
|
||||
y += 8
|
||||
ts('Saturation worker (busy / capacity)',
|
||||
[('sum(messenger_worker_busy) / sum(messenger_worker_capacity)', 'занято слотов')], 'percentunit', 0, minv=0)
|
||||
[('sum(messenger_worker_busy) / sum(messenger_worker_capacity)', 'занято слотов')], 'percentunit', 0, minv=0, maxv=1)
|
||||
ts('Publish outbox → broker (confirm) p95',
|
||||
[(q('messenger_outbox_publish_duration_seconds_bucket')(0.95), 'p95'),
|
||||
('sum(rate(messenger_outbox_published_total[$__rate_interval]))', 'сообщений/с')], 's', 8)
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
| --- | --- | --- | --- | --- |
|
||||
| T1. Процесс в сети `front`/`back` обращается к API-реплике напрямую, минуя LB (подделка `X-Forwarded-For`, обход лимита входа) | Бизнес-API доступен только через LB | mTLS на API: обязательный клиентский сертификат CA стенда + allowlist identity `lb`; порт API не опубликован | `security_ops.py mtls`: без сертификата, чужой CA, identity `attacker`, identity `worker` → отказ рукопожатия; `lb` → 200 | Компрометация самого LB даёт его identity; митигация — ротация `lb` + отзыв serial |
|
||||
| T2. Перехват/подмена трафика к хранилищам в общей docker-сети (sniffing паролей БД, данных S3) | Конфиденциальность и целостность данных в пути | TLS на всех связях с проверкой сервера (verify-full, CA стенда); plaintext-порты выключены (Redis `port 0`, RabbitMQ `listeners.tcp none`, pg_hba `hostnossl reject`) | `security_ops.py mtls`: TLS с проверкой — да, plaintext (PING, HTTP, sslmode=disable) — нет ответа/отказ | Метрики Collector о себе (:8888) — plaintext внутри сети telemetry (без данных приложений) |
|
||||
| T3. Скомпрометированный worker читает hash паролей, сообщения, чужие файлы, публикует поддельные job, чистит очередь | Least privilege: worker делает только обработку вложений | Роль БД `app_worker` (нет users/messages/chats, UPDATE по столбцам), ключ S3 только `s/` (GET), `v/`,`o/` (PUT); RabbitMQ: только read `attachment.process`; OpenBao policy — только свой путь | `compromise.py`: матрица «до/после» least privilege | Worker по природе читает исходные изображения (`s/`) и пишет варианты — их подмена возможна до ротации identity |
|
||||
| T3. Скомпрометированный worker читает hash паролей, сообщения, чужие файлы, публикует поддельные job, чистит очередь | Least privilege: worker делает только обработку вложений | Роль БД `app_worker` (нет users/messages/chats, UPDATE по столбцам), ключ S3 только `s/` (GET), `v/`,`o/` (PUT); RabbitMQ: только read `attachment.process`; OpenBao policy — только свой путь | `compromise.py`: матрица «до/после» least privilege | Worker по природе читает исходные изображения (`s/`) и пишет варианты — их подмена возможна до ротации identity. Право read на `attachment.process` в RabbitMQ разрешает и `queue.purge` (как и consume+ack без обработки) — отнять его нельзя, не сломав worker; потерянные сообщения не теряют работу: job остаётся `queued` в PostgreSQL, рост возраста старейшей queued-работы поднимает алерт lab6. Автоматического переиздания потерянных сообщений нет — восстановление ручное (новая запись outbox для таких работ), это остаточный риск. Зонд purge не выполняет (разрушил бы очередь стенда) |
|
||||
| T4. Украденный сертификат/секреты сервиса используются после обнаружения | Отозванная identity ничего не даёт | Отзыв токенов OpenBao, смена CN роли (worker-g1 → g2), удаление пользователя RabbitMQ (соединения закрываются), ротация пароля БД и ключа S3, `pg_terminate_backend`; для `lb` — список отозванных serial | `compromise.py` (после реакции: OpenBao/AMQP/БД/S3 → отказ), `security_ops.py rotation` (старый `lb` → отказ) | Нет CRL/OCSP у RabbitMQ/Collector: украденный сертификат телеметрии работает до истечения (30 дней) — только ingest метрик/логов |
|
||||
| T5. Перебор паролей / дорогой login DoS (Argon2id 19 MiB × N параллельных входов исчерпывает RAM/CPU API) | Доступность API, стойкость паролей | Общий для реплик лимит входа (Redis) до вычисления hash → 429 + Retry-After; не более `ARGON2_MAX_CONCURRENT` вычислений на реплику (память ≤ слоты × 19 MiB), сверх — 503 через 2 s; одинаковое время для несуществующего пользователя | `security_ops.py acl` (11-я попытка → 429, верный пароль тоже 429 до конца окна), `argon2` (всплеск 120 входов: коды, пик памяти) | Лимит по IP обходится распределённым источником; на пределе слотов легитимные входы получают 503 |
|
||||
| T6. Посторонний пользователь читает чужой чат/вложение или прикрепляет чужой файл; подмена identity заголовком `X-User-Id` | Доступ только участникам чата | Проверка членства в сервисе; 404 вместо 403; identity только из Bearer-сессии | `security_ops.py acl`: metadata/content/attach → 404, `X-User-Id` игнорируется | — |
|
||||
|
||||
@@ -174,6 +174,8 @@ def scenario_db_gap(c):
|
||||
def scenario_security(c):
|
||||
alice, _, _, chat = c.bootstrap()
|
||||
att = upload(c, alice, chat, fixture('small.png'))['json']
|
||||
# С lab5 worker переносит оригинал staging s/ → o/: ключ берём после ready.
|
||||
wait_status(c, alice, att['id'], ('ready',))
|
||||
key = object_key(att['id'])
|
||||
url = 'http://s3:9000/%s/%s' % (BUCKET, key)
|
||||
# Анонимно изнутри сети стенда (из контейнера API): объект и листинг закрыты.
|
||||
|
||||
@@ -89,7 +89,7 @@ class Uploader:
|
||||
while not self.stop_ev.is_set():
|
||||
try:
|
||||
r = self.c.call('POST', '/api/v1/chats/%s/attachments?filename=u.png' % self.chat['id'], 202,
|
||||
actor=self.actor, raw=SAMPLE, headers={'Content-Type': 'image/png'})
|
||||
actor=self.actor, raw=SAMPLE, headers={'Content-Type': 'image/png'}, schema='Attachment')
|
||||
self.ids.append((time.time(), r['json']['id']))
|
||||
except Failure:
|
||||
self.errors += 1
|
||||
@@ -124,7 +124,8 @@ def main():
|
||||
'worker DB role too broad: %s' % a['db'])
|
||||
check(denied(a['s3'].get('put s/*')) and denied(a['s3'].get('get o/*')) and denied(a['s3'].get('list bucket'))
|
||||
and denied(a['s3'].get('delete o/*')), 'worker S3 key too broad: %s' % a['s3'])
|
||||
check(denied(a['amqp'].get('publish attachments (job)')) and denied(a['amqp'].get('purge attachment.process')),
|
||||
check(denied(a['amqp'].get('publish attachments (job)')) and denied(a['amqp'].get('declare queue evil'))
|
||||
and denied(a['amqp'].get('consume attachment.dead (DLQ)')),
|
||||
'worker broker rights too broad: %s' % a['amqp'])
|
||||
check(denied(a['api_as_lb'].get('result')), 'worker certificate accepted by API')
|
||||
|
||||
@@ -156,7 +157,7 @@ def main():
|
||||
|
||||
# первое задание, принятое после реакции, — когда стало ready (восстановление обработки)
|
||||
probe_att = c.call('POST', '/api/v1/chats/%s/attachments?filename=after.png' % chat['id'], 202, actor=alice, raw=SAMPLE,
|
||||
headers={'Content-Type': 'image/png'})['json']
|
||||
headers={'Content-Type': 'image/png'}, schema='Attachment')['json']
|
||||
meta = wait_status(c, bob, probe_att['id'], ('ready', 'failed'), timeout=240)
|
||||
res['processing_restored_seconds_after_response'] = round(time.time() - t_done, 1)
|
||||
check(meta['status'] == 'ready', 'worker did not recover with the new identity')
|
||||
|
||||
@@ -13,6 +13,19 @@ from concurrent.futures import ThreadPoolExecutor
|
||||
import labutil # noqa: F401 (добавляет tests/ в sys.path)
|
||||
from client import Client, Failure
|
||||
|
||||
_ACTIVE = []
|
||||
|
||||
|
||||
def _stop_all():
|
||||
# Если сценарий упал до load.stop(), потоки нагрузки не дадут процессу завершиться
|
||||
# (ThreadPoolExecutor ждёт их при выходе). Этот hook регистрируется позже
|
||||
# concurrent.futures и поэтому вызывается раньше его join.
|
||||
for load in list(_ACTIVE):
|
||||
load._stop.set()
|
||||
|
||||
|
||||
threading._register_atexit(_stop_all)
|
||||
|
||||
|
||||
class Load:
|
||||
def __init__(self, base_url, ca_file, actor, chat, concurrency=4, timeout=10, prefix='load'):
|
||||
@@ -54,10 +67,13 @@ class Load:
|
||||
self._pool = ThreadPoolExecutor(max_workers=self.concurrency)
|
||||
self._futures = [self._pool.submit(self._worker, w) for w in range(self.concurrency)]
|
||||
self.started = time.time()
|
||||
_ACTIVE.append(self)
|
||||
return self
|
||||
|
||||
def stop(self):
|
||||
self._stop.set()
|
||||
if self in _ACTIVE:
|
||||
_ACTIVE.remove(self)
|
||||
for f in self._futures:
|
||||
f.result()
|
||||
self._pool.shutdown()
|
||||
|
||||
@@ -114,7 +114,7 @@ def scenario_signals(c):
|
||||
spans, _ = o.tempo_trace(tid)
|
||||
server = [s for s in spans if s['kind'] in ('SPAN_KIND_SERVER', 2, '2') or s['name'].startswith('POST /api')]
|
||||
check(server, 'no server span')
|
||||
logs = o.wait_until(lambda: o.loki('{service_name="messenger-api"} | trace_id="%s"' % tid, t0), 60)
|
||||
logs = o.wait_until(lambda: o.loki('{service_name="messenger-api"} | trace_id="%s"' % tid, t0), 120)
|
||||
check(logs, 'no API log with trace_id ' + tid)
|
||||
log_line = logs[0][1]
|
||||
res['request'] = {'request_id': rid_msg, 'trace_id': tid, 'spans': tree(spans)[:12],
|
||||
@@ -141,7 +141,7 @@ def scenario_signals(c):
|
||||
db_in_worker = sorted({s['name'] for s in spans2 if s['service'] == 'messenger-worker' and s['name'] not in
|
||||
('attachment.process process', 'image.decode', 'image.variants') and not s['name'].startswith('S3')})
|
||||
check(all(links.values()), 'broken causal chain: %s' % links)
|
||||
wlogs = o.wait_until(lambda: o.loki('{service_name="messenger-worker"} | trace_id="%s"' % tid2, t0), 60)
|
||||
wlogs = o.wait_until(lambda: o.loki('{service_name="messenger-worker"} | trace_id="%s"' % tid2, t0), 120)
|
||||
check(wlogs, 'no worker log with the upload trace_id')
|
||||
res['upload'] = {'request_id': rid_up, 'trace_id': tid2, 'services': services, 'links': links,
|
||||
'span_count': len(spans2), 'worker_db_spans': db_in_worker[:10], 'tree': tree(spans2)[:40],
|
||||
@@ -298,11 +298,14 @@ def breakdown(spans):
|
||||
srv = next((s for s in spans if s['parent'] == '' or s['name'].startswith(('POST /api', 'GET /api'))), None)
|
||||
if not srv:
|
||||
return None
|
||||
db = sum(s['ms'] for s in spans if s['service'] == srv['service'] and is_db(s))
|
||||
s3 = sum(s['ms'] for s in spans if s['name'].startswith('S3'))
|
||||
# DB-spans вложены (BEGIN/batch/query): сумма перекрывается, поэтому берём самый
|
||||
# длинный отдельный span БД относительно server span.
|
||||
dbs = sorted(((s['name'], s['ms']) for s in spans if s['service'] == srv['service'] and is_db(s)), key=lambda x: -x[1])
|
||||
db = dbs[0][1] if dbs else 0.0
|
||||
s3 = max([s['ms'] for s in spans if s['name'].startswith('S3')] or [0.0])
|
||||
return {'server_span': srv['name'], 'server_ms': srv['ms'], 'status': srv['attrs'].get('http.response.status_code'),
|
||||
'db_ms': round(db, 1), 's3_ms': round(s3, 1), 'db_share': round(db / srv['ms'], 3) if srv['ms'] else None,
|
||||
'db_spans': [(s['name'], s['ms']) for s in spans if is_db(s)][:6]}
|
||||
'longest_db_span_ms': round(db, 1), 'longest_s3_span_ms': round(s3, 1),
|
||||
'db_share': round(db / srv['ms'], 3) if srv['ms'] else None, 'db_spans_longest': dbs[:4]}
|
||||
|
||||
|
||||
def scenario_incident_db(c):
|
||||
@@ -399,13 +402,30 @@ def scenario_backend_down(c):
|
||||
compose('up', '-d', '--wait', '--no-deps', 'tempo', 'loki', timeout=180)
|
||||
t_up = time.time()
|
||||
rid = 'obs-after-' + uuid.uuid4().hex[:8]
|
||||
c.call('POST', '/api/v1/chats/%s/messages' % chat['id'], 201, actor=alice, body={'text': 'after'},
|
||||
headers={'Idempotency-Key': uuid.uuid4().hex, 'X-Request-Id': rid})
|
||||
# gRPC-клиент Collector переподключается к Tempo с экспоненциальной паузой (до 120 s):
|
||||
# измеряем, через сколько секунд после возврата Tempo новые трассы снова доступны.
|
||||
got = o.find_trace('{span.request_id="%s"}' % rid, t_up - 2, timeout=240)
|
||||
sent0 = q('sum({__name__=~"otelcol_exporter_sent_spans(_total)?", exporter="otlp/tempo"})')
|
||||
# Новые запросы после возврата Tempo; трасса ищется по ID из заголовка traceresponse
|
||||
# (минуя поиск) — сначала каждые 5 s новый запрос, пока трасса не появится.
|
||||
got, tids = None, []
|
||||
end = time.time() + 240
|
||||
while time.time() < end and not got:
|
||||
r = c.call('POST', '/api/v1/chats/%s/messages' % chat['id'], 201, actor=alice, body={'text': 'after'},
|
||||
headers={'Idempotency-Key': uuid.uuid4().hex, 'X-Request-Id': rid})
|
||||
tid = (r['headers'].get('traceresponse') or '--').split('-')[1]
|
||||
tids.append(tid)
|
||||
for t in tids:
|
||||
try:
|
||||
if o.tempo_trace(t)[0]:
|
||||
got = t
|
||||
break
|
||||
except Exception:
|
||||
pass
|
||||
if not got:
|
||||
time.sleep(5)
|
||||
phase['tempo_spans_exported_after_up'] = q('sum({__name__=~"otelcol_exporter_sent_spans(_total)?", exporter="otlp/tempo"})') - sent0
|
||||
phase['refused_spans_total'] = q('sum({__name__=~"otelcol_receiver_refused_spans(_total)?"})')
|
||||
phase['new_trace_after_recovery'] = bool(got)
|
||||
phase['traces_visible_seconds_after_tempo_up'] = round(time.time() - t_up, 1) if got else None
|
||||
phase['probe_requests_after_up'] = len(tids)
|
||||
# Фаза 2: остановлен сам Collector — SDK отбрасывает по ограниченной очереди
|
||||
compose('stop', 'otel-collector')
|
||||
t_cd = time.time()
|
||||
|
||||
@@ -25,6 +25,18 @@ def _auth():
|
||||
|
||||
|
||||
def grafana(path, params=None, method='GET', body=None, timeout=30):
|
||||
"""Запрос к Grafana; 502/503/504 (backend перезапускается) — повтор до ~60 s."""
|
||||
import urllib.error
|
||||
for attempt in range(12):
|
||||
try:
|
||||
return _grafana(path, params, method, body, timeout)
|
||||
except urllib.error.HTTPError as e:
|
||||
if e.code not in (502, 503, 504) or attempt == 11:
|
||||
raise
|
||||
time.sleep(5)
|
||||
|
||||
|
||||
def _grafana(path, params=None, method='GET', body=None, timeout=30):
|
||||
url = GRAFANA + path
|
||||
if params:
|
||||
url += ('&' if '?' in url else '?') + urllib.parse.urlencode(params)
|
||||
|
||||
@@ -337,9 +337,10 @@ def scenario_failed_replay(c):
|
||||
# Восстанавливаем исходник и делаем явный replay.
|
||||
import subprocess
|
||||
p = subprocess.run(['docker', 'compose', 'run', '--rm', '--no-deps', '-T', '--entrypoint', 'sh', 's3-init', '-c',
|
||||
'mc alias set s3 http://s3:9000 "$(cat /run/secrets/s3_root_user)" "$(cat /run/secrets/s3_root_password)" >/dev/null; '
|
||||
'mkdir -p /tmp/.mc/certs/CAs && cp /run/secrets/ca.crt /tmp/.mc/certs/CAs/ && '
|
||||
'mc alias set s3 https://s3:9000 "$(cat /run/secrets/s3_root_user)" "$(cat /run/secrets/s3_root_password)" >/dev/null; '
|
||||
'cat > /tmp/o && mc cp -q /tmp/o s3/%s/%s >/dev/null' % (BUCKET, key)], input=sample(), capture_output=True)
|
||||
check(p.returncode == 0, 'restore staging failed')
|
||||
check(p.returncode == 0, 'restore staging failed: %s' % p.stderr.decode(errors='replace')[-300:])
|
||||
rp = compose('run', '--rm', '--no-deps', '-T', '--entrypoint', '/app/pipeline', 'relay', 'replay', att['id'],
|
||||
'--actor', 'lab5-test', check=False)
|
||||
check(rp.returncode == 0, 'replay failed: ' + rp.stdout + rp.stderr[-200:])
|
||||
|
||||
@@ -23,7 +23,11 @@ WHITESPACE_PASSWORDS = (' ' * 12, '\t' * 12, ' ' * 8)
|
||||
|
||||
|
||||
def redis_cli(*args):
|
||||
r = subprocess.run(['docker', 'compose', 'exec', '-T', 'redis', 'redis-cli', *args],
|
||||
# Lab7: Redis только по TLS, пользователь default выключен — операторская учётка
|
||||
# (пароль из secrets/operator, передаётся через окружение exec, не аргументом).
|
||||
pw = (ROOT / 'secrets' / 'operator' / 'redis_operator_password').read_text().strip()
|
||||
r = subprocess.run(['docker', 'compose', 'exec', '-T', '-e', 'REDISCLI_AUTH=' + pw, 'redis', 'redis-cli', '--tls',
|
||||
'--cacert', '/run/secrets/ca.crt', '-h', 'redis', '--user', 'operator', '--no-auth-warning', *args],
|
||||
cwd=ROOT, capture_output=True, text=True, timeout=30)
|
||||
check(r.returncode == 0, 'redis-cli failed: ' + r.stderr.strip())
|
||||
return r.stdout.strip()
|
||||
@@ -35,7 +39,7 @@ def visibility_case(c, alice, bob, chat, denied):
|
||||
# Прогреваем кэш на обеих репликах.
|
||||
for _ in range(4):
|
||||
c.call('GET', path, actor=bob, schema='MessagePage')
|
||||
redis_cli('ACL', 'SETUSER', 'default', *('-' + cmd for cmd in denied))
|
||||
redis_cli('ACL', 'SETUSER', 'api', *('-' + cmd for cmd in denied)) # lab7: пользователь API — api
|
||||
try:
|
||||
sent = c.message(alice, chat, 'после запрета ' + '+'.join(denied))['json']
|
||||
# Каждое следующее чтение (через любую реплику) видит подтверждённую запись.
|
||||
@@ -47,8 +51,8 @@ def visibility_case(c, alice, bob, chat, denied):
|
||||
# встать раньше старых, поэтому проверяем наличие, а не префикс.
|
||||
check(set(before) <= set(ids), 'previously confirmed messages missing')
|
||||
finally:
|
||||
# reset — чтобы снять и точечные запреты, независимо от порядка правил.
|
||||
redis_cli('ACL', 'SETUSER', 'default', 'reset', 'on', 'nopass', '~*', '&*', '+@all')
|
||||
# Исходные права api — из ACL-файла оператора (там же hash пароля).
|
||||
redis_cli('ACL', 'LOAD')
|
||||
return len(before) + 1
|
||||
|
||||
|
||||
|
||||
@@ -129,13 +129,13 @@ def scenario_mtls(c):
|
||||
'trusted_ca_cn_lb': probe('amqp', '-cert', p + 'lb.crt', '-key', p + 'lb.key'),
|
||||
'worker': probe('amqp', '-cert', p + 'worker.crt', '-key', p + 'worker.key'),
|
||||
'relay': probe('amqp', '-cert', p + 'relay.crt', '-key', p + 'relay.key'),
|
||||
'plaintext_5672': probe('plain', '-addr', 'rabbitmq:5672', '-send', 'AMQP\x00\x00\x09\x01'),
|
||||
'plaintext_5672': probe('plain', '-addr', 'rabbitmq:5672', '-send', 'AMQP'),
|
||||
}
|
||||
for k in ('foreign_ca', 'trusted_ca_cn_attacker', 'trusted_ca_cn_lb'):
|
||||
check(denied(broker[k].get('connect')), 'broker %s not rejected: %s' % (k, broker[k]))
|
||||
w, r = broker['worker'], broker['relay']
|
||||
check(w.get('consume attachment.process') == 'allowed' and denied(w.get('publish attachments (job)'))
|
||||
and denied(w.get('declare queue evil')) and denied(w.get('purge attachment.process')), 'worker ACL: %s' % w)
|
||||
and denied(w.get('declare queue evil')) and denied(w.get('delete queue attachment.process')), 'worker ACL: %s' % w)
|
||||
check(r.get('publish attachments (job)') == 'allowed' and denied(r.get('consume attachment.process')), 'relay ACL: %s' % r)
|
||||
|
||||
otel = {
|
||||
@@ -163,6 +163,8 @@ def scenario_mtls(c):
|
||||
if addr is None:
|
||||
continue
|
||||
a = ['tls', '-addr', addr, '-name', sn, '-path', '/']
|
||||
if name == 'redis':
|
||||
a += ['-send', 'PING\\r\\n'] # ответ -NOAUTH: TLS установлен, ACL требует вход
|
||||
if cert:
|
||||
a += ['-cert', p + cert + '.crt', '-key', p + cert + '.key']
|
||||
r_tls = probe(*a)
|
||||
@@ -190,12 +192,13 @@ def scenario_mtls(c):
|
||||
def scenario_acl(c):
|
||||
alice, bob, eve, chat = c.bootstrap()
|
||||
att = c.call('POST', '/api/v1/chats/%s/attachments?filename=a.png' % chat['id'], 202, actor=alice, raw=SAMPLE,
|
||||
headers={'Content-Type': 'image/png'})['json']
|
||||
headers={'Content-Type': 'image/png'}, schema='Attachment')['json']
|
||||
wait_status(c, bob, att['id'], ('ready',))
|
||||
res = {}
|
||||
res['outsider_metadata'] = c.call('GET', '/api/v1/attachments/' + att['id'], (404,), actor=eve)['status']
|
||||
res['outsider_content'] = c.call('GET', '/api/v1/attachments/%s/content' % att['id'], (404,), actor=eve)['status']
|
||||
echat = c.call('POST', '/api/v1/chats', 201, actor=eve, body={'title': 'e', 'member_ids': [eve['id']]})['json']
|
||||
echat = c.call('POST', '/api/v1/chats', 201, actor=eve, body={'title': 'e', 'member_ids': [eve['id']]},
|
||||
schema='Chat')['json']
|
||||
res['attach_foreign_file'] = c.call('POST', '/api/v1/chats/%s/messages' % echat['id'], (404,), actor=eve,
|
||||
body={'text': 'x', 'attachment_ids': [att['id']]},
|
||||
headers={'Idempotency-Key': uuid.uuid4().hex})['status']
|
||||
@@ -350,15 +353,28 @@ def scenario_rotation(c):
|
||||
time.sleep(35) # SECRETS_REFRESH 30 s
|
||||
# Старые соединения закрываются (как при отзыве); новые открываются с новым паролем
|
||||
psql("SELECT count(pg_terminate_backend(pid)) FROM pg_stat_activity WHERE usename = 'app_api'")
|
||||
time.sleep(5)
|
||||
time.sleep(35) # pgx health check (30 s) выбрасывает разорванные соединения
|
||||
res['db_old_password'] = probe('db', '-user', 'app_api', '-stdin', stdin=old_pw).get('connect')
|
||||
check(denied(res['db_old_password']), 'old db password still works')
|
||||
res['api_after_db_rotation'] = c.call('GET', '/api/v1/chats', actor=alice)['status']
|
||||
tries = []
|
||||
for _ in range(12):
|
||||
try:
|
||||
tries.append(c.call('GET', '/api/v1/chats', (200, 503), actor=alice)['status'])
|
||||
except Failure as e:
|
||||
tries.append(str(e)[-40:])
|
||||
if tries[-1] == 200:
|
||||
break
|
||||
time.sleep(5)
|
||||
res['api_after_db_rotation_attempts'] = tries
|
||||
if tries[-1] != 200:
|
||||
res['api_secret_events'] = [l[-220:] for l in compose('logs', '--no-color', '--since', '5m', 'api').stdout.splitlines()
|
||||
if 'secrets.' in l or 'postgres' in l.lower()][-15:]
|
||||
check(tries[-1] == 200, 'API did not recover after DB password rotation: %s' % res)
|
||||
# 2) ключ S3 worker: загрузка после ротации обрабатывается
|
||||
bootstrap('rotate-s3', 'worker')
|
||||
time.sleep(35)
|
||||
att = c.call('POST', '/api/v1/chats/%s/attachments?filename=r.png' % chat['id'], 202, actor=alice, raw=SAMPLE,
|
||||
headers={'Content-Type': 'image/png'})['json']
|
||||
headers={'Content-Type': 'image/png'}, schema='Attachment')['json']
|
||||
res['upload_after_s3_rotation'] = wait_status(c, bob, att['id'], ('ready', 'failed'), timeout=150)['status']
|
||||
check(res['upload_after_s3_rotation'] == 'ready', 'worker did not pick rotated S3 key')
|
||||
# 3) leaf API: перевыпуск на месте, без рестарта; LB видит новый serial
|
||||
@@ -409,14 +425,14 @@ def scenario_lifecycle(c):
|
||||
bootstrap('seal')
|
||||
t_seal = time.time()
|
||||
att = c.call('POST', '/api/v1/chats/%s/attachments?filename=s.png' % chat['id'], 202, actor=alice, raw=SAMPLE,
|
||||
headers={'Content-Type': 'image/png'})['json']
|
||||
headers={'Content-Type': 'image/png'}, schema='Attachment')['json']
|
||||
res['upload_while_sealed'] = wait_status(c, bob, att['id'], ('ready', 'failed'), timeout=120)['status']
|
||||
compose('restart', 'worker')
|
||||
time.sleep(25)
|
||||
wlogs = compose('logs', '--no-color', '--since', '30s', 'worker').stdout
|
||||
res['worker_restart_while_sealed'] = 'openbao not ready' in wlogs or 'sealed' in wlogs
|
||||
att2 = c.call('POST', '/api/v1/chats/%s/attachments?filename=s2.png' % chat['id'], 202, actor=alice, raw=SAMPLE,
|
||||
headers={'Content-Type': 'image/png'})['json']
|
||||
headers={'Content-Type': 'image/png'}, schema='Attachment')['json']
|
||||
time.sleep(5)
|
||||
res['upload_accepted_while_worker_blocked'] = att2['status']
|
||||
bootstrap('unseal')
|
||||
|
||||
Reference in New Issue
Block a user