This commit is contained in:
@@ -18,3 +18,4 @@ __pycache__
|
||||
node_modules
|
||||
evidence
|
||||
.DS_Store
|
||||
operator
|
||||
|
||||
+2
-40
@@ -1,41 +1,3 @@
|
||||
# Copy to .env for your LOCAL synthetic test environment; never commit .env.
|
||||
# These are logical interface suggestions; map actual framework names in REPORT.md.
|
||||
APP_HOST=0.0.0.0
|
||||
APP_PORT=8080
|
||||
APP_ENV=lab
|
||||
APP_PORT=8443
|
||||
GRAFANA_PORT=3447
|
||||
SESSION_TTL_SECONDS=3600
|
||||
# Choose credentials locally. File paths contain no secret values.
|
||||
DATABASE_URL_FILE=/run/secrets/database_url
|
||||
# Optional on 3, required use on 4 in lab2; Redis OR Valkey:
|
||||
SESSION_STORE=postgres
|
||||
CACHE_URL_FILE=/run/secrets/cache_url
|
||||
API_REPLICAS=2
|
||||
IDEMPOTENCY_TTL_SECONDS=86400
|
||||
S3_ENDPOINT=https://s3:9000
|
||||
S3_REGION=us-east-1
|
||||
S3_BUCKET=messenger-attachments
|
||||
S3_ACCESS_KEY_ID_FILE=/run/secrets/s3_access_key_id
|
||||
S3_SECRET_ACCESS_KEY_FILE=/run/secrets/s3_secret_access_key
|
||||
MAX_UPLOAD_BYTES=10485760
|
||||
MAX_IMAGE_PIXELS=40000000
|
||||
BROKER_URL_FILE=/run/secrets/broker_url
|
||||
WORKER_CONCURRENCY=2
|
||||
JOB_MAX_ATTEMPTS=5
|
||||
JOB_TIMEOUT_SECONDS=60
|
||||
STAGING_RETENTION_SECONDS=86400
|
||||
OTEL_SERVICE_NAME=messenger-api
|
||||
# Worker must set a distinct service.name.
|
||||
OTEL_EXPORTER_OTLP_ENDPOINT=https://otel-collector:4318
|
||||
OTEL_EXPORTER_OTLP_PROTOCOL=http/protobuf
|
||||
OTEL_RESOURCE_ATTRIBUTES=deployment.environment.name=lab
|
||||
# TLS and OpenBao: actual paths/ports depend on your implemented trust matrix.
|
||||
PUBLIC_BASE_URL=https://localhost:8443
|
||||
TLS_CA_FILE=/run/secrets/ca.crt
|
||||
TLS_CERT_FILE=/run/secrets/service.crt
|
||||
TLS_KEY_FILE=/run/secrets/service.key
|
||||
BAO_ADDR=https://openbao:8200
|
||||
BAO_CACERT=/run/secrets/bao-ca.crt
|
||||
# No root token here. Bootstrap operator -> short-lived service auth -> scoped token.
|
||||
ARGON2_MEMORY_KIB=19456
|
||||
ARGON2_ITERATIONS=2
|
||||
ARGON2_PARALLELISM=1
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
*.sh text eol=lf
|
||||
*.cmd text eol=crlf
|
||||
*.sql text eol=lf
|
||||
@@ -30,3 +30,6 @@ coverage/
|
||||
.vscode/
|
||||
# Keep small, sanitized evidence summaries in evidence/ under version control.
|
||||
# Inspect git diff --cached: ignore rules are not a secret scanner.
|
||||
|
||||
certs/
|
||||
operator/
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
FROM node:22.20.0-alpine
|
||||
WORKDIR /app
|
||||
COPY package.json package-lock.json ./
|
||||
RUN npm ci --omit=dev --ignore-scripts
|
||||
COPY src/ ./src/
|
||||
COPY migrations/ ./migrations/
|
||||
USER node
|
||||
CMD ["node", "src/start.js"]
|
||||
@@ -1,37 +1,70 @@
|
||||
# Отчёт — лабораторная 7
|
||||
|
||||
- Автор, группа: TODO
|
||||
- Целевая оценка; выбранный трек 5, если нужен: TODO
|
||||
- Commit/PR: TODO после публикации
|
||||
- Использованные источники, библиотеки и помощь ИИ: TODO
|
||||
- Автор, группа: Кирюпина Александра Радиевна, БПИ2304.
|
||||
- Целевая оценка: 3; трек 5 не выбран.
|
||||
- Ветка для сдачи: solution/bpi2304-kiryupina. Ссылка на PR добавляется после публикации.
|
||||
- Источники: материалы курса, [OpenBao cert auth](https://openbao.org/docs/auth/cert/), [Node TLS](https://nodejs.org/api/tls.html), документация OpenTelemetry/Grafana. ИИ использовался при подготовке кода, конфигурации, проверок и отчёта.
|
||||
|
||||
## Запуск из чистого clone
|
||||
|
||||
TODO: версии runtime/образов, prerequisites, команды создания локальных secrets/.env, build, миграций, запуска, ожидания готовности, тестов и остановки. Указать необходимые действия оператора. Не вставлять секреты. Отдельно указать безопасную остановку и команду намеренного удаления учебных данных.
|
||||
Нужны Docker Desktop с Linux containers, Python 3.9+ и доступ к реестрам образов/GitHub при первой сборке. В PowerShell из корня проекта:
|
||||
|
||||
```powershell
|
||||
$env:PYTHONUTF8='1'
|
||||
py -m pip install -r requirements-bootstrap.txt
|
||||
py scripts/up.py
|
||||
py scripts/check_contract.py
|
||||
py tests/security.py --base-url https://localhost:8443 --ca-file certs/ca.crt
|
||||
py tests/smoke.py --base-url https://localhost:8443 --ca-file certs/ca.crt
|
||||
```
|
||||
|
||||
up.py создаёт локальные CA/leaf certs и secrets, собирает образы, инициализирует/unseal OpenBao, выдаёт сервисные политики, выполняет миграции и настройку приватного S3. Повторный запуск сохраняет существующие ключи и данные. Исходники MinIO и mc собираются по закреплённым release tags: готовый mc image оказался недоступен. Версии и команды закреплены в Dockerfile, infra/Dockerfile.*, compose.yaml и package-lock.json.
|
||||
|
||||
Вход API: https://localhost:8443. Grafana: https://localhost:3447, пользователь admin, пароль — локальный secrets/grafana_password. В браузере для HTTPS нужен доверенный публичный certs/ca.crt; проверки используют явный CA и не отключают верификацию. Bao — https://localhost:8207. Только эти три порта опубликованы на 127.0.0.1.
|
||||
|
||||
Остановка с сохранением данных: `docker compose down`. Повторная сборка и запуск: `py scripts/up.py`. Намеренное удаление учебных volumes: `docker compose down -v` (уничтожает данные, включая Bao; для нового стенда нужны согласованные новые bootstrap-материалы). Не удалять operator/certs/secrets при обычном рестарте. После отдельного рестарта Bao: `py scripts/bao.py --unseal-only`, затем `docker compose up -d api1 api2 worker lb`.
|
||||
|
||||
## Архитектура и решения
|
||||
|
||||
TODO: схема процессов/хранилищ, источник истины, транзакционные границы, ограничения. Что перенесено из lab6, что изменено в этой работе. Соответствие переменных из .env.example реальной конфигурации.
|
||||
Сохранены две API-реплики, HAProxy, PostgreSQL, S3, RabbitMQ, worker и три хранилища наблюдаемости из lab6. Внешний HTTP заменён HTTPS. LB проверяет CA и SAN каждой API; API требует client cert и отдельно разрешает только SAN lb. Случайный X-Instance-Id не раскрывает имя контейнера. Прямого опубликованного API-порта нет.
|
||||
|
||||
DB/S3/broker используют TLS и разные credentials API/worker. У worker нет доступа к users/sessions, у API нет записи в S3 originals/variants и consume очереди. Collector и backend защищены mTLS-прокси с allowlist ролей и query/ingest paths. Native plaintext listeners доступны только внутри общего loopback namespace сервиса и его прокси; обход проверен отдельно. Полная схема: [contracts/trust-matrix.md](contracts/trust-matrix.md).
|
||||
|
||||
OpenBao 2.2.2 работает в server mode с постоянным file storage. API/worker входят через cert auth, читают только свой KV path и отзывают рабочий token; TTL 300 секунд, max TTL 600. Root/unseal доступны только host-оператору, в app не монтируются. Статические KV credentials допустимы для выбранного уровня и остаются в памяти процесса до его остановки. Sealed Bao блокирует новый старт, но не отзывает уже выданный пароль DB/S3.
|
||||
|
||||
Пароли: Argon2id, 19 MiB, t=2, p=1, случайная соль и параметры в PHC hash; session token хранится только как hash. На 6 последовательных измерениях средний hash занял 18.8 мс при лимите 1.5 CPU и 512 MiB. Выбран обязательный минимум: оставляет запас памяти для обработки запросов; это не измерение предельного DoS-бюджета. Вход ограничен общим PostgreSQL-счётчиком: 30 попыток/60 секунд/IP, далее 429 + Retry-After. LB перезаписывает X-Forwarded-For. JSON ограничен 1 MiB, upload — 10 MiB/40M pixels. API и worker запускаются как uid 1000, cap_drop ALL, no-new-privileges, с CPU/RAM/PID limits.
|
||||
|
||||
## Доказательства критериев
|
||||
|
||||
| Критерий README | Команда/сценарий | Наблюдаемый результат | Файл доказательства |
|
||||
| --- | --- | --- | --- |
|
||||
| Публичный smoke | make test | TODO | TODO |
|
||||
| Остальные пункты уровня 3 | TODO | TODO | TODO |
|
||||
| Все пункты уровня 4, если заявлен | TODO | TODO | TODO |
|
||||
| Выбранный трек 5, если заявлен | TODO | TODO | TODO |
|
||||
| Критерий | Проверка / результат | Файл |
|
||||
| --- | --- | --- |
|
||||
| HTTPS, доверенный CA, прежний API | публичные security.py и smoke.py — PASS | evidence/external-tls.txt, smoke.txt |
|
||||
| Обязательный mTLS обеих API | правильный lb проходит; no cert / foreign CA / trusted worker — отказ | evidence/security.txt |
|
||||
| Все связи защищены, отдельные права | DB plaintext/DDL/users deny, S3 prefix deny, broker consume deny, Collector/Grafana roles | evidence/security.txt, no-bypass.txt |
|
||||
| OpenBao auth/policy | own KV allow, чужой KV и policy write deny, token без root | evidence/security.txt |
|
||||
| Argon2id, лимиты, expiry/ACL/logout | параметры и измерение; 429/Retry-After; TTL=2 → 401; ACL/logout в smoke | evidence/argon2.json, security.txt, expiry.txt, smoke.txt |
|
||||
| Hardening и отсутствие admin secrets в app | безопасная выборка Docker inspect, проверка uid/caps/limits/mounts/ports | evidence/hardening.json, hardening.txt |
|
||||
| Наблюдаемость lab6 сохранена | реальные API/worker traces/logs и 4 metric families через TLS; секретные маркеры не найдены | evidence/telemetry.txt, telemetry.json, grafana.txt |
|
||||
| Перезапуск и отказ реплики | данные/вложения/сессии сохранены; после stop-one 8 записей, 0 ошибок, восстановление 4.156 с | evidence/persistence.txt, failover.txt, lifecycle-*.json |
|
||||
|
||||
TODO: добавить отдельную строку для каждого заявленного критерия. PASS без команды и наблюдения не является доказательством. Проверка инфраструктурного hook требует подтверждения, какие реальные процессы/хранилища перезапущены.
|
||||
Команды дополнительных проверок:
|
||||
|
||||
## Эксперименты и отказы
|
||||
```powershell
|
||||
docker compose run --rm --no-deps checks node /tests/telemetry.js
|
||||
docker compose run --rm --no-deps checks node /tests/no-bypass.js
|
||||
docker compose up -d --wait expiry
|
||||
docker compose run --rm --no-deps checks node /tests/expiry.js
|
||||
docker compose stop expiry
|
||||
docker compose run --rm --no-deps checks
|
||||
py scripts/check-hardening.py
|
||||
py scripts/check-grafana.py
|
||||
py tests/resilience.py --mode persistence --action-script scripts/restart.cmd --base-url https://localhost:8443 --ca-file certs/ca.crt
|
||||
py tests/resilience.py --mode failover --action-script scripts/stop-one.cmd --base-url https://localhost:8443 --ca-file certs/ca.crt
|
||||
py scripts/control.py restore
|
||||
```
|
||||
|
||||
TODO: гипотеза, hardware/лимиты, версии, объём данных, профиль нагрузки, concurrency/arrival rate, длительность/прогрев, повторы, успешные RPS, ошибки, p50/p95/p99, CPU/RAM. Сохранить raw summary без tokens и объяснить ограничения измерения.
|
||||
Rate-limit тест выполняется после остальных входов; после него при повторном входе нужно выдержать Retry-After. Проверки запускают те же public scripts, что make check/test/test-security; Python в Windows использовался с UTF-8. Тестовый профиль checks временно получает тестовые certs для отрицательных проверок; рабочие сервисы такого доступа не имеют.
|
||||
|
||||
| Воздействие | Что ожидаем | Что наблюдали | Время восстановления / потеря данных |
|
||||
| --- | --- | --- | --- |
|
||||
| TODO | TODO | TODO | TODO |
|
||||
## Ограничения
|
||||
|
||||
## Ограничения и следующие шаги
|
||||
|
||||
TODO: какие отказы выдерживаются и какие нет; что не реализовано; где учебное упрощение; какое улучшение подтверждено, а какое пока гипотеза.
|
||||
Один Docker host и по одному хранилищу; нет автоматической ротации, CRL, динамических DB leases и исследования уровня 5. Учебный unseal 1-of-1 требует сохранности operator/ и его резервной копии; это не production bootstrap. Старая база lab6 не импортируется автоматически: лабораторная стартует на отдельных volumes, новые пароли Argon2id. Массовая регистрация не имеет отдельного rate limit. Телеметрия может теряться при длительном отказе backend. Dependency audit не чистый; применимость и остаточные риски — [security/dependency-triage.md](security/dependency-triage.md). Обязательный контракт и public tests сохранены; trust-matrix заполнена по заданию.
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
# Лабораторная 7 — запуск
|
||||
|
||||
Открой PowerShell в этой папке. Запусти Docker Desktop (Linux containers).
|
||||
|
||||
```powershell
|
||||
$env:PYTHONUTF8='1'
|
||||
py -m pip install -r requirements-bootstrap.txt
|
||||
py scripts/up.py
|
||||
py tests/security.py --base-url https://localhost:8443 --ca-file certs/ca.crt
|
||||
py tests/smoke.py --base-url https://localhost:8443 --ca-file certs/ca.crt
|
||||
```
|
||||
|
||||
Первый запуск дольше: собираются исходники MinIO и mc, загружаются образы. Последующие сборки используют кэш. API — https://localhost:8443, это не страница сайта.
|
||||
|
||||
Grafana — https://localhost:3447, логин admin, пароль лежит только у тебя в secrets/grafana_password. Для браузера понадобится доверие к публичному certs/ca.crt; команды тестов уже проверяют этот CA напрямую. Приватные ключи в certs/*.key, *.pem и operator/ никому не отправлять.
|
||||
|
||||
Остановить: `docker compose down`. Повторно запустить: `py scripts/up.py`. Данные и ключи сохраняются. Не используй down -v для обычной остановки.
|
||||
|
||||
Если отдельно перезапускала OpenBao: `py scripts/bao.py --unseal-only`. Этот шаг выполняет оператор; приложение unseal-ключа не имеет.
|
||||
|
||||
Для сдачи используй подготовленный архив: в нём нет .env, certs, secrets, operator и node_modules. REPORT.md коротко описывает решение, evidence содержит фактические проверки. Подробности безопасности — contracts/trust-matrix.md и security/THREAT_MODEL.md.
|
||||
+722
@@ -0,0 +1,722 @@
|
||||
{
|
||||
"name": "mtusi-lab7",
|
||||
"services": {
|
||||
"api1": {
|
||||
"image": "mtusi-messenger:lab7",
|
||||
"build": ".",
|
||||
"user": "1000:1000",
|
||||
"cap_drop": [
|
||||
"ALL"
|
||||
],
|
||||
"security_opt": [
|
||||
"no-new-privileges:true"
|
||||
],
|
||||
"mem_limit": "512m",
|
||||
"cpus": 1.5,
|
||||
"pids_limit": 128,
|
||||
"environment": {
|
||||
"SERVICE_ROLE": "api",
|
||||
"APP_PORT": "8443",
|
||||
"SESSION_TTL_SECONDS": "${SESSION_TTL_SECONDS:-3600}",
|
||||
"S3_ENDPOINT": "https://s3:9000",
|
||||
"OTEL_SERVICE_NAME": "messenger-api",
|
||||
"OTEL_EXPORTER_OTLP_ENDPOINT": "https://otel-collector:3443",
|
||||
"NODE_EXTRA_CA_CERTS": "/tls/ca.crt",
|
||||
"OTEL_PROPAGATORS": "tracecontext"
|
||||
},
|
||||
"volumes": [
|
||||
"./certs/ca.crt:/tls/ca.crt:ro",
|
||||
"./certs/api1.crt:/tls/cert.crt:ro",
|
||||
"./certs/api1.key:/tls/key.pem:ro"
|
||||
],
|
||||
"restart": "on-failure",
|
||||
"depends_on": {
|
||||
"db": {
|
||||
"condition": "service_healthy"
|
||||
},
|
||||
"broker": {
|
||||
"condition": "service_healthy"
|
||||
},
|
||||
"s3": {
|
||||
"condition": "service_healthy"
|
||||
}
|
||||
},
|
||||
"healthcheck": {
|
||||
"test": [
|
||||
"CMD-SHELL",
|
||||
"node -e \"fetch('http://127.0.0.1:9001/health/ready').then(r=>process.exit(r.ok?0:1)).catch(()=>process.exit(1))\""
|
||||
],
|
||||
"interval": "3s",
|
||||
"timeout": "5s",
|
||||
"retries": 40
|
||||
}
|
||||
},
|
||||
"api2": {
|
||||
"image": "mtusi-messenger:lab7",
|
||||
"build": ".",
|
||||
"user": "1000:1000",
|
||||
"cap_drop": [
|
||||
"ALL"
|
||||
],
|
||||
"security_opt": [
|
||||
"no-new-privileges:true"
|
||||
],
|
||||
"mem_limit": "512m",
|
||||
"cpus": 1.5,
|
||||
"pids_limit": 128,
|
||||
"environment": {
|
||||
"SERVICE_ROLE": "api",
|
||||
"APP_PORT": "8443",
|
||||
"SESSION_TTL_SECONDS": "${SESSION_TTL_SECONDS:-3600}",
|
||||
"S3_ENDPOINT": "https://s3:9000",
|
||||
"OTEL_SERVICE_NAME": "messenger-api",
|
||||
"OTEL_EXPORTER_OTLP_ENDPOINT": "https://otel-collector:3443",
|
||||
"NODE_EXTRA_CA_CERTS": "/tls/ca.crt",
|
||||
"OTEL_PROPAGATORS": "tracecontext"
|
||||
},
|
||||
"volumes": [
|
||||
"./certs/ca.crt:/tls/ca.crt:ro",
|
||||
"./certs/api2.crt:/tls/cert.crt:ro",
|
||||
"./certs/api2.key:/tls/key.pem:ro"
|
||||
],
|
||||
"restart": "on-failure",
|
||||
"depends_on": {
|
||||
"db": {
|
||||
"condition": "service_healthy"
|
||||
},
|
||||
"broker": {
|
||||
"condition": "service_healthy"
|
||||
},
|
||||
"s3": {
|
||||
"condition": "service_healthy"
|
||||
}
|
||||
},
|
||||
"healthcheck": {
|
||||
"test": [
|
||||
"CMD-SHELL",
|
||||
"node -e \"fetch('http://127.0.0.1:9001/health/ready').then(r=>process.exit(r.ok?0:1)).catch(()=>process.exit(1))\""
|
||||
],
|
||||
"interval": "3s",
|
||||
"timeout": "5s",
|
||||
"retries": 40
|
||||
}
|
||||
},
|
||||
"worker": {
|
||||
"image": "mtusi-messenger:lab7",
|
||||
"build": ".",
|
||||
"user": "1000:1000",
|
||||
"cap_drop": [
|
||||
"ALL"
|
||||
],
|
||||
"security_opt": [
|
||||
"no-new-privileges:true"
|
||||
],
|
||||
"mem_limit": "512m",
|
||||
"cpus": 1.5,
|
||||
"pids_limit": 128,
|
||||
"environment": {
|
||||
"SERVICE_ROLE": "worker",
|
||||
"APP_PORT": "8443",
|
||||
"SESSION_TTL_SECONDS": "${SESSION_TTL_SECONDS:-3600}",
|
||||
"S3_ENDPOINT": "https://s3:9000",
|
||||
"OTEL_SERVICE_NAME": "messenger-worker",
|
||||
"OTEL_EXPORTER_OTLP_ENDPOINT": "https://otel-collector:3443",
|
||||
"NODE_EXTRA_CA_CERTS": "/tls/ca.crt",
|
||||
"OTEL_PROPAGATORS": "tracecontext"
|
||||
},
|
||||
"volumes": [
|
||||
"./certs/ca.crt:/tls/ca.crt:ro",
|
||||
"./certs/worker.crt:/tls/cert.crt:ro",
|
||||
"./certs/worker.key:/tls/key.pem:ro"
|
||||
],
|
||||
"restart": "on-failure",
|
||||
"depends_on": {
|
||||
"db": {
|
||||
"condition": "service_healthy"
|
||||
},
|
||||
"broker": {
|
||||
"condition": "service_healthy"
|
||||
},
|
||||
"s3": {
|
||||
"condition": "service_healthy"
|
||||
}
|
||||
}
|
||||
},
|
||||
"db": {
|
||||
"image": "postgres:17.6-alpine",
|
||||
"environment": {
|
||||
"POSTGRES_DB": "messenger",
|
||||
"POSTGRES_USER": "messenger",
|
||||
"POSTGRES_PASSWORD_FILE": "/run/secrets/postgres_password"
|
||||
},
|
||||
"secrets": [
|
||||
"postgres_password"
|
||||
],
|
||||
"volumes": [
|
||||
"pgdata:/var/lib/postgresql/data",
|
||||
"./certs/ca.crt:/tls/ca.crt:ro",
|
||||
"./certs/db.crt:/tls/cert.crt:ro",
|
||||
"./certs/db.key:/tls/key.pem:ro",
|
||||
"./secrets/roles.sql:/docker-entrypoint-initdb.d/roles.sql:ro",
|
||||
"./secrets/pg_hba.conf:/etc/postgresql/pg_hba.conf:ro"
|
||||
],
|
||||
"command": [
|
||||
"sh",
|
||||
"-c",
|
||||
"cp /tls/key.pem /tmp/server.key && chown postgres:postgres /tmp/server.key && chmod 600 /tmp/server.key && exec docker-entrypoint.sh postgres -c ssl=on -c ssl_cert_file=/tls/cert.crt -c ssl_key_file=/tmp/server.key -c hba_file=/etc/postgresql/pg_hba.conf"
|
||||
],
|
||||
"healthcheck": {
|
||||
"test": [
|
||||
"CMD-SHELL",
|
||||
"pg_isready -U messenger -d messenger"
|
||||
],
|
||||
"interval": "3s",
|
||||
"timeout": "5s",
|
||||
"retries": 40
|
||||
},
|
||||
"mem_limit": "512m",
|
||||
"cpus": 1,
|
||||
"pids_limit": 256,
|
||||
"security_opt": [
|
||||
"no-new-privileges:true"
|
||||
]
|
||||
},
|
||||
"migrate": {
|
||||
"image": "mtusi-messenger:lab7",
|
||||
"build": ".",
|
||||
"user": "1000:1000",
|
||||
"cap_drop": [
|
||||
"ALL"
|
||||
],
|
||||
"security_opt": [
|
||||
"no-new-privileges:true"
|
||||
],
|
||||
"mem_limit": "512m",
|
||||
"cpus": 1.5,
|
||||
"pids_limit": 128,
|
||||
"command": [
|
||||
"node",
|
||||
"src/migrate.js"
|
||||
],
|
||||
"environment": {
|
||||
"DATABASE_URL_FILE": "/run/secrets/database_url"
|
||||
},
|
||||
"secrets": [
|
||||
"database_url"
|
||||
],
|
||||
"volumes": [
|
||||
"./certs/ca.crt:/tls/ca.crt:ro",
|
||||
"./certs/api1.crt:/tls/cert.crt:ro",
|
||||
"./certs/api1.key:/tls/key.pem:ro"
|
||||
],
|
||||
"depends_on": {
|
||||
"db": {
|
||||
"condition": "service_healthy"
|
||||
}
|
||||
},
|
||||
"restart": "no"
|
||||
},
|
||||
"s3": {
|
||||
"image": "mtusi-minio:RELEASE.2025-04-22T22-12-26Z",
|
||||
"build": {
|
||||
"context": ".",
|
||||
"dockerfile": "infra/Dockerfile.s3"
|
||||
},
|
||||
"command": [
|
||||
"server",
|
||||
"/data",
|
||||
"--certs-dir",
|
||||
"/certificates",
|
||||
"--console-address",
|
||||
"127.0.0.1:9001"
|
||||
],
|
||||
"environment": {
|
||||
"MINIO_ROOT_USER_FILE": "/run/secrets/s3_admin_user",
|
||||
"MINIO_ROOT_PASSWORD_FILE": "/run/secrets/s3_admin_password"
|
||||
},
|
||||
"secrets": [
|
||||
"s3_admin_user",
|
||||
"s3_admin_password"
|
||||
],
|
||||
"volumes": [
|
||||
"s3data:/data",
|
||||
"./certs/s3.crt:/certificates/public.crt:ro",
|
||||
"./certs/s3.key:/certificates/private.key:ro",
|
||||
"./certs/ca.crt:/tls/ca.crt:ro"
|
||||
],
|
||||
"healthcheck": {
|
||||
"test": [
|
||||
"CMD-SHELL",
|
||||
"curl --cacert /tls/ca.crt -f https://s3:9000/minio/health/live"
|
||||
],
|
||||
"interval": "3s",
|
||||
"timeout": "5s",
|
||||
"retries": 40
|
||||
},
|
||||
"mem_limit": "768m",
|
||||
"cpus": 1,
|
||||
"pids_limit": 256,
|
||||
"security_opt": [
|
||||
"no-new-privileges:true"
|
||||
]
|
||||
},
|
||||
"s3-init": {
|
||||
"image": "mtusi-mc:2025-04-16",
|
||||
"entrypoint": [
|
||||
"/bin/sh",
|
||||
"/config/s3-init.sh"
|
||||
],
|
||||
"volumes": [
|
||||
"./certs/ca.crt:/root/.mc/certs/CAs/ca.crt:ro",
|
||||
"./secrets/s3-init.sh:/config/s3-init.sh:ro",
|
||||
"./secrets/s3-api.json:/config/s3-api.json:ro",
|
||||
"./secrets/s3-worker.json:/config/s3-worker.json:ro"
|
||||
],
|
||||
"depends_on": {
|
||||
"s3": {
|
||||
"condition": "service_healthy"
|
||||
}
|
||||
},
|
||||
"restart": "no",
|
||||
"mem_limit": "128m",
|
||||
"cpus": 1,
|
||||
"pids_limit": 256,
|
||||
"security_opt": [
|
||||
"no-new-privileges:true"
|
||||
],
|
||||
"build": {
|
||||
"context": ".",
|
||||
"dockerfile": "infra/Dockerfile.mc"
|
||||
}
|
||||
},
|
||||
"broker": {
|
||||
"image": "rabbitmq:4.1.0-alpine",
|
||||
"hostname": "broker",
|
||||
"volumes": [
|
||||
"brokerdata:/var/lib/rabbitmq",
|
||||
"./certs/ca.crt:/tls/ca.crt:ro",
|
||||
"./certs/broker.crt:/tls/cert.crt:ro",
|
||||
"./certs/broker.key:/tls/key.pem:ro",
|
||||
"./secrets/rabbitmq.conf:/etc/rabbitmq/rabbitmq.conf:ro",
|
||||
"./secrets/rabbit-definitions.json:/etc/rabbitmq/definitions.json:ro",
|
||||
"./infra/rabbit-enabled-plugins:/etc/rabbitmq/enabled_plugins:ro"
|
||||
],
|
||||
"healthcheck": {
|
||||
"test": [
|
||||
"CMD-SHELL",
|
||||
"rabbitmq-diagnostics -q ping"
|
||||
],
|
||||
"interval": "3s",
|
||||
"timeout": "5s",
|
||||
"retries": 40
|
||||
},
|
||||
"mem_limit": "512m",
|
||||
"environment": {
|
||||
"RABBITMQ_SERVER_ADDITIONAL_ERL_ARGS": "+S 2:2"
|
||||
},
|
||||
"cpus": 1,
|
||||
"pids_limit": 256,
|
||||
"security_opt": [
|
||||
"no-new-privileges:true"
|
||||
]
|
||||
},
|
||||
"lb": {
|
||||
"image": "haproxy:3.0.12-alpine",
|
||||
"ports": [
|
||||
"127.0.0.1:${APP_PORT:-8443}:8443"
|
||||
],
|
||||
"volumes": [
|
||||
"./infra/haproxy.cfg:/usr/local/etc/haproxy/haproxy.cfg:ro",
|
||||
"./certs/ca.crt:/tls/ca.crt:ro",
|
||||
"./certs/lb.pem:/tls/server.pem:ro",
|
||||
"./certs/lb.pem:/tls/client.pem:ro"
|
||||
],
|
||||
"depends_on": {
|
||||
"api1": {
|
||||
"condition": "service_healthy"
|
||||
},
|
||||
"api2": {
|
||||
"condition": "service_healthy"
|
||||
}
|
||||
},
|
||||
"mem_limit": "128m",
|
||||
"cpus": 1,
|
||||
"pids_limit": 256,
|
||||
"security_opt": [
|
||||
"no-new-privileges:true"
|
||||
]
|
||||
},
|
||||
"bao": {
|
||||
"image": "openbao/openbao:2.2.2",
|
||||
"command": [
|
||||
"server",
|
||||
"-config=/bao/config/config.hcl"
|
||||
],
|
||||
"volumes": [
|
||||
"baodata:/openbao/file",
|
||||
"./infra/openbao/config.hcl:/bao/config/config.hcl:ro",
|
||||
"./certs/ca.crt:/tls/ca.crt:ro",
|
||||
"./certs/bao.crt:/tls/cert.crt:ro",
|
||||
"./certs/bao.key:/tls/key.pem:ro"
|
||||
],
|
||||
"ports": [
|
||||
"127.0.0.1:8207:8200"
|
||||
],
|
||||
"environment": {
|
||||
"BAO_ADDR": "https://bao:8200",
|
||||
"BAO_CACERT": "/tls/ca.crt"
|
||||
},
|
||||
"mem_limit": "256m",
|
||||
"cap_drop": [
|
||||
"ALL"
|
||||
],
|
||||
"security_opt": [
|
||||
"no-new-privileges:true"
|
||||
],
|
||||
"cpus": 1,
|
||||
"pids_limit": 256,
|
||||
"cap_add": [
|
||||
"CHOWN",
|
||||
"SETUID",
|
||||
"SETGID"
|
||||
]
|
||||
},
|
||||
"otel-collector": {
|
||||
"image": "otel/opentelemetry-collector-contrib:0.123.0",
|
||||
"command": [
|
||||
"--config=/etc/otelcol/config.yaml"
|
||||
],
|
||||
"volumes": [
|
||||
"./infra/otel/collector.yaml:/etc/otelcol/config.yaml:ro",
|
||||
"./certs/ca.crt:/tls/ca.crt:ro",
|
||||
"./certs/collector.crt:/tls/cert.crt:ro",
|
||||
"./certs/collector.key:/tls/key.pem:ro"
|
||||
],
|
||||
"mem_limit": "256m",
|
||||
"cpus": 1,
|
||||
"pids_limit": 256,
|
||||
"security_opt": [
|
||||
"no-new-privileges:true"
|
||||
]
|
||||
},
|
||||
"prometheus": {
|
||||
"image": "prom/prometheus:v3.2.1",
|
||||
"command": [
|
||||
"--config.file=/etc/prometheus/prometheus.yml",
|
||||
"--storage.tsdb.path=/prometheus",
|
||||
"--storage.tsdb.retention.time=3d",
|
||||
"--web.listen-address=127.0.0.1:9090"
|
||||
],
|
||||
"volumes": [
|
||||
"./infra/otel/prometheus.yaml:/etc/prometheus/prometheus.yml:ro",
|
||||
"prometheusdata:/prometheus",
|
||||
"./certs/ca.crt:/tls/ca.crt:ro",
|
||||
"./certs/prometheus.crt:/tls/cert.crt:ro",
|
||||
"./certs/prometheus.key:/tls/key.pem:ro"
|
||||
],
|
||||
"mem_limit": "256m",
|
||||
"cpus": 1,
|
||||
"pids_limit": 256,
|
||||
"security_opt": [
|
||||
"no-new-privileges:true"
|
||||
]
|
||||
},
|
||||
"loki": {
|
||||
"image": "grafana/loki:3.4.2",
|
||||
"command": [
|
||||
"-config.file=/etc/loki/config.yaml"
|
||||
],
|
||||
"volumes": [
|
||||
"./infra/otel/loki.yaml:/etc/loki/config.yaml:ro",
|
||||
"lokidata:/loki"
|
||||
],
|
||||
"mem_limit": "256m",
|
||||
"cpus": 1,
|
||||
"pids_limit": 256,
|
||||
"security_opt": [
|
||||
"no-new-privileges:true"
|
||||
]
|
||||
},
|
||||
"tempo": {
|
||||
"image": "grafana/tempo:2.7.2",
|
||||
"user": "0:0",
|
||||
"command": [
|
||||
"-config.file=/etc/tempo/config.yaml"
|
||||
],
|
||||
"volumes": [
|
||||
"./infra/otel/tempo.yaml:/etc/tempo/config.yaml:ro",
|
||||
"tempodata:/var/tempo"
|
||||
],
|
||||
"mem_limit": "256m",
|
||||
"cpus": 1,
|
||||
"pids_limit": 256,
|
||||
"security_opt": [
|
||||
"no-new-privileges:true"
|
||||
]
|
||||
},
|
||||
"otel-collector-tls": {
|
||||
"image": "mtusi-messenger:lab7",
|
||||
"build": ".",
|
||||
"user": "1000:1000",
|
||||
"cap_drop": [
|
||||
"ALL"
|
||||
],
|
||||
"security_opt": [
|
||||
"no-new-privileges:true"
|
||||
],
|
||||
"mem_limit": "96m",
|
||||
"cpus": 0.5,
|
||||
"pids_limit": 128,
|
||||
"command": [
|
||||
"node",
|
||||
"src/tls-proxy.js"
|
||||
],
|
||||
"network_mode": "service:otel-collector",
|
||||
"environment": {
|
||||
"PROXY_MODE": "collector"
|
||||
},
|
||||
"volumes": [
|
||||
"./certs/ca.crt:/tls/ca.crt:ro",
|
||||
"./certs/collector.crt:/tls/cert.crt:ro",
|
||||
"./certs/collector.key:/tls/key.pem:ro"
|
||||
],
|
||||
"depends_on": [
|
||||
"otel-collector"
|
||||
]
|
||||
},
|
||||
"prometheus-tls": {
|
||||
"image": "mtusi-messenger:lab7",
|
||||
"build": ".",
|
||||
"user": "1000:1000",
|
||||
"cap_drop": [
|
||||
"ALL"
|
||||
],
|
||||
"security_opt": [
|
||||
"no-new-privileges:true"
|
||||
],
|
||||
"mem_limit": "96m",
|
||||
"cpus": 0.5,
|
||||
"pids_limit": 128,
|
||||
"command": [
|
||||
"node",
|
||||
"src/tls-proxy.js"
|
||||
],
|
||||
"network_mode": "service:prometheus",
|
||||
"environment": {
|
||||
"PROXY_MODE": "prometheus"
|
||||
},
|
||||
"volumes": [
|
||||
"./certs/ca.crt:/tls/ca.crt:ro",
|
||||
"./certs/prometheus.crt:/tls/cert.crt:ro",
|
||||
"./certs/prometheus.key:/tls/key.pem:ro"
|
||||
],
|
||||
"depends_on": [
|
||||
"prometheus"
|
||||
]
|
||||
},
|
||||
"loki-tls": {
|
||||
"image": "mtusi-messenger:lab7",
|
||||
"build": ".",
|
||||
"user": "1000:1000",
|
||||
"cap_drop": [
|
||||
"ALL"
|
||||
],
|
||||
"security_opt": [
|
||||
"no-new-privileges:true"
|
||||
],
|
||||
"mem_limit": "96m",
|
||||
"cpus": 0.5,
|
||||
"pids_limit": 128,
|
||||
"command": [
|
||||
"node",
|
||||
"src/tls-proxy.js"
|
||||
],
|
||||
"network_mode": "service:loki",
|
||||
"environment": {
|
||||
"PROXY_MODE": "loki"
|
||||
},
|
||||
"volumes": [
|
||||
"./certs/ca.crt:/tls/ca.crt:ro",
|
||||
"./certs/loki.crt:/tls/cert.crt:ro",
|
||||
"./certs/loki.key:/tls/key.pem:ro"
|
||||
],
|
||||
"depends_on": [
|
||||
"loki"
|
||||
]
|
||||
},
|
||||
"tempo-tls": {
|
||||
"image": "mtusi-messenger:lab7",
|
||||
"build": ".",
|
||||
"user": "1000:1000",
|
||||
"cap_drop": [
|
||||
"ALL"
|
||||
],
|
||||
"security_opt": [
|
||||
"no-new-privileges:true"
|
||||
],
|
||||
"mem_limit": "96m",
|
||||
"cpus": 0.5,
|
||||
"pids_limit": 128,
|
||||
"command": [
|
||||
"node",
|
||||
"src/tls-proxy.js"
|
||||
],
|
||||
"network_mode": "service:tempo",
|
||||
"environment": {
|
||||
"PROXY_MODE": "tempo"
|
||||
},
|
||||
"volumes": [
|
||||
"./certs/ca.crt:/tls/ca.crt:ro",
|
||||
"./certs/tempo.crt:/tls/cert.crt:ro",
|
||||
"./certs/tempo.key:/tls/key.pem:ro"
|
||||
],
|
||||
"depends_on": [
|
||||
"tempo"
|
||||
]
|
||||
},
|
||||
"grafana": {
|
||||
"image": "grafana/grafana:11.6.0",
|
||||
"environment": {
|
||||
"GF_SERVER_PROTOCOL": "https",
|
||||
"GF_SERVER_CERT_FILE": "/tls/cert.crt",
|
||||
"GF_SERVER_CERT_KEY": "/tls/key.pem",
|
||||
"GF_AUTH_ANONYMOUS_ENABLED": "false",
|
||||
"GF_SECURITY_ADMIN_PASSWORD__FILE": "/run/secrets/grafana_password",
|
||||
"GF_ANALYTICS_REPORTING_ENABLED": "false",
|
||||
"GF_ANALYTICS_CHECK_FOR_UPDATES": "false"
|
||||
},
|
||||
"secrets": [
|
||||
"grafana_password"
|
||||
],
|
||||
"volumes": [
|
||||
"grafanadata:/var/lib/grafana",
|
||||
"./certs/ca.crt:/tls/ca.crt:ro",
|
||||
"./certs/grafana.crt:/tls/cert.crt:ro",
|
||||
"./certs/grafana.key:/tls/key.pem:ro",
|
||||
"./secrets/datasources.yaml:/etc/grafana/provisioning/datasources/sources.yaml:ro",
|
||||
"./infra/grafana/provisioning/dashboards:/etc/grafana/provisioning/dashboards:ro",
|
||||
"./infra/grafana/dashboards:/var/lib/grafana/dashboards:ro"
|
||||
],
|
||||
"ports": [
|
||||
"127.0.0.1:${GRAFANA_PORT:-3447}:3000"
|
||||
],
|
||||
"mem_limit": "384m",
|
||||
"cpus": 1,
|
||||
"pids_limit": 256,
|
||||
"security_opt": [
|
||||
"no-new-privileges:true"
|
||||
]
|
||||
},
|
||||
"checks": {
|
||||
"image": "mtusi-messenger:lab7",
|
||||
"user": "1000:1000",
|
||||
"profiles": [
|
||||
"test"
|
||||
],
|
||||
"command": [
|
||||
"node",
|
||||
"/tests/security.js"
|
||||
],
|
||||
"environment": {
|
||||
"NODE_PATH": "/app/node_modules"
|
||||
},
|
||||
"volumes": [
|
||||
"./student-tests:/tests:ro",
|
||||
"./certs:/test-certs:ro",
|
||||
"./evidence:/evidence",
|
||||
"./certs/ca.crt:/tls/ca.crt:ro",
|
||||
"./certs/operator.crt:/tls/cert.crt:ro",
|
||||
"./certs/operator.key:/tls/key.pem:ro",
|
||||
"./tests/fixtures:/fixtures:ro"
|
||||
],
|
||||
"cap_drop": [
|
||||
"ALL"
|
||||
],
|
||||
"security_opt": [
|
||||
"no-new-privileges:true"
|
||||
],
|
||||
"mem_limit": "512m",
|
||||
"cpus": 1.5
|
||||
},
|
||||
"expiry": {
|
||||
"image": "mtusi-messenger:lab7",
|
||||
"build": ".",
|
||||
"user": "1000:1000",
|
||||
"cap_drop": [
|
||||
"ALL"
|
||||
],
|
||||
"security_opt": [
|
||||
"no-new-privileges:true"
|
||||
],
|
||||
"mem_limit": "512m",
|
||||
"cpus": 1.5,
|
||||
"pids_limit": 128,
|
||||
"environment": {
|
||||
"SERVICE_ROLE": "api",
|
||||
"APP_PORT": "8443",
|
||||
"SESSION_TTL_SECONDS": "2",
|
||||
"S3_ENDPOINT": "https://s3:9000",
|
||||
"OTEL_SERVICE_NAME": "messenger-api",
|
||||
"OTEL_EXPORTER_OTLP_ENDPOINT": "https://otel-collector:3443",
|
||||
"NODE_EXTRA_CA_CERTS": "/tls/ca.crt",
|
||||
"OTEL_PROPAGATORS": "tracecontext"
|
||||
},
|
||||
"volumes": [
|
||||
"./certs/ca.crt:/tls/ca.crt:ro",
|
||||
"./certs/api1.crt:/tls/cert.crt:ro",
|
||||
"./certs/api1.key:/tls/key.pem:ro"
|
||||
],
|
||||
"restart": "no",
|
||||
"depends_on": {
|
||||
"db": {
|
||||
"condition": "service_healthy"
|
||||
},
|
||||
"broker": {
|
||||
"condition": "service_healthy"
|
||||
},
|
||||
"s3": {
|
||||
"condition": "service_healthy"
|
||||
}
|
||||
},
|
||||
"healthcheck": {
|
||||
"test": [
|
||||
"CMD-SHELL",
|
||||
"node -e \"fetch('http://127.0.0.1:9001/health/ready').then(r=>process.exit(r.ok?0:1)).catch(()=>process.exit(1))\""
|
||||
],
|
||||
"interval": "3s",
|
||||
"timeout": "5s",
|
||||
"retries": 40
|
||||
},
|
||||
"profiles": [
|
||||
"test"
|
||||
]
|
||||
}
|
||||
},
|
||||
"volumes": {
|
||||
"pgdata": null,
|
||||
"s3data": null,
|
||||
"brokerdata": null,
|
||||
"baodata": null,
|
||||
"prometheusdata": null,
|
||||
"lokidata": null,
|
||||
"tempodata": null,
|
||||
"grafanadata": null
|
||||
},
|
||||
"secrets": {
|
||||
"postgres_password": {
|
||||
"file": "./secrets/postgres_password"
|
||||
},
|
||||
"database_url": {
|
||||
"file": "./secrets/database_url"
|
||||
},
|
||||
"s3_admin_user": {
|
||||
"file": "./secrets/s3_admin_user"
|
||||
},
|
||||
"s3_admin_password": {
|
||||
"file": "./secrets/s3_admin_password"
|
||||
},
|
||||
"grafana_password": {
|
||||
"file": "./secrets/grafana_password"
|
||||
}
|
||||
}
|
||||
}
|
||||
+23
-29
@@ -1,37 +1,31 @@
|
||||
# Матрица доверия — заполнить в решении lab7
|
||||
# Матрица доверия — lab7, оценка 3
|
||||
|
||||
Это обязательная матрица покрытия. Для каждой строки укажите реальный порт, endpoint, CA, service identity, проверку SAN/ACL, срок жизни credentials и команду положительного/отрицательного теста. TLS шифрует и подтверждает сервер; mTLS также проверяет клиента. При доверенном CA всё равно нужно ограничивать разрешённую identity. Plaintext hop допустим только внутри закрытого локального transport/proxy boundary, без опубликованного обхода; границу и rationale нужно доказать.
|
||||
CA создаётся локально scripts/setup.py: RSA 3072, срок 365 дней; leaf RSA 2048, SAN и serverAuth/clientAuth, срок 30 дней. Приватный CA и unseal/root находятся только у оператора в operator/. Leaf keys выдаются контейнерам по одному файлу, не всей папкой. Проверка CA и имени сервера нигде не отключается. Приложение узнаёт credentials при старте из KV OpenBao по своей cert identity; рабочий token TTL 300 секунд, max TTL 600, после чтения отзывается. Статические KV credentials действуют до смены оператором; leaf после истечения нужно перевыпустить. Автоматическая ротация уровня 4 не заявлена.
|
||||
|
||||
| Связь | Минимум на 3 | Дополнительно на 4 | Доказательство / конфиг |
|
||||
| --- | --- | --- | --- |
|
||||
| Клиент → ingress/LB | TLS, CA + hostname, Bearer | Проверка expiry/revocation сессии и общего login rate limit | TODO |
|
||||
| LB → API (все реплики) | mTLS + allowlist LB identity | Ротация leaf без обхода проверки | TODO |
|
||||
| API/worker → PostgreSQL | TLS verify-full + раздельные ограниченные DB roles | Ротация credentials; mTLS — допустимое усиление | TODO |
|
||||
| API/worker → S3 | TLS + разные scoped credentials/prefix rights | Проверка denied prefix и ротация | TODO |
|
||||
| API/worker → broker | TLS + разные producer/consumer identities и ACL | mTLS + ограничение допустимых SAN/ролей | TODO |
|
||||
| API/worker → Collector | TLS; сеть/аутентификация запрещает произвольный ingest | mTLS с раздельными identities | TODO |
|
||||
| Collector → telemetry backends | TLS + scoped backend credentials или mTLS | Ротация и проверка least privilege | TODO |
|
||||
| Grafana → data sources | TLS с проверкой сервера, ограниченная identity | Отрицательные проверки доступа | TODO |
|
||||
| API/worker/agent → OpenBao | TLS + сервисный auth + scoped policy | Renewal/expiry/revocation | TODO |
|
||||
| Оператор → OpenBao/Grafana/S3 admin | TLS + authentication, доступ локальный/через защищённый канал | Разделение operator/application roles | TODO |
|
||||
| API → Redis/Valkey, если используется | TLS + ACL/пароль с минимальными правами | Ротация; mTLS по возможности | TODO |
|
||||
| Replication/кластерные каналы, если добавлены | TLS/mTLS либо подтверждённый шифрованный transport | Проверка заявленной модели отказа | TODO |
|
||||
| Связь | Endpoint, проверка и права | Проверка / конфиг |
|
||||
| --- | --- | --- |
|
||||
| Клиент → LB | https://localhost:8443, SAN localhost, локальный CA, TLS 1.2+; Bearer для бизнес-API | tests/security.py, smoke.py; infra/haproxy.cfg |
|
||||
| LB → API1/API2 | https://api1:8443 / api2:8443, verifyhost, клиентский cert SAN lb; API требует доверенную цепочку И DNS:lb | student-tests/security.js: правильный, отсутствующий, чужой CA, trusted worker cert; src/server.js |
|
||||
| API/worker → DB | db:5432, PostgreSQL TLS verify-full, разные api/worker роли. API DML бизнес-таблиц, worker SELECT/UPDATE только attachments/attachment_jobs. Нет DDL/ownership/superuser | security.js: pg_stat_ssl, denied users/sessions/DDL, plaintext denied; src/db.js, src/migrate.js |
|
||||
| API/worker → S3 | https://s3:9000, SAN s3. API: write/delete staging, read originals/variants; worker: read staging, write originals/variants. Разные keys, один приватный bucket | security.js, scripts/setup.py генерирует policy. root только одноразовому operator s3-init |
|
||||
| API/worker → broker | amqps://broker:5671/messenger, CA+SAN broker, разные пароли. API declare/publish attachments.v1, worker consume/retry той же очереди. API read запрещён | security.js проверяет отказ consume; definitions и TLS config генерирует setup.py |
|
||||
| API/worker → Collector | https://otel-collector:3443/v1/*, mTLS, allowlist SAN api/worker, только POST ingest | src/tls-proxy.js; security.js: allow/deny. Прокси в namespace Collector; внутренний receiver только 127.0.0.1:4318 |
|
||||
| Collector → Loki/Tempo | https://loki:3443/otlp, https://tempo:3443/v1/traces; mTLS identity collector, только ingest | src/tls-proxy.js, infra/otel/collector.yaml; telemetry.js |
|
||||
| Prometheus → Collector metrics | https://otel-collector:3443/metrics, CA+SAN, client SAN prometheus | infra/otel/prometheus.yaml; telemetry.js |
|
||||
| Grafana → источники | https://prometheus:3443, loki:3443, tempo:3443. mTLS identity grafana, query paths; ingest запрещён | setup.py генерирует локальный datasource provisioning с cert/key; security.js и scripts/check-grafana.py |
|
||||
| API/worker → OpenBao | https://bao:8200, CA+SAN bao; cert auth роли api/worker с allowed_dns_sans, scoped KV read, revoke-self | infra/openbao/*.hcl, src/start.js; security.js: own allow, чужой path/policy write deny |
|
||||
| Оператор → Bao/Grafana/S3 | Bao https://localhost:8207 + operator root token; Grafana https://localhost:3447 + пароль admin; S3-admin только внутри одноразового s3-init, TLS+root. Наружу только 127.0.0.1 | compose.yaml; scripts/bao.py; scripts/check-grafana.py |
|
||||
| Redis/Valkey | N/A, не используется | — |
|
||||
| Replication/кластеры | N/A, DB/S3/broker/телеметрия по одному экземпляру | Ограничение стенда |
|
||||
|
||||
Нет выбранного компонента — отметьте N/A с причиной, а не оставляйте пустую строку. Внутренний публичный health listener, если нужен, минимален и изолирован; через него нельзя обращаться к бизнес-API без mTLS. Отдельно задокументируйте scrape/health/bootstrap каналы: они тоже не должны создавать обход.
|
||||
## Закрытые локальные hops
|
||||
|
||||
## Обязательные отрицательные проверки
|
||||
Native HTTP/gRPC Loki и Tempo, HTTP Prometheus и Collector слушают только 127.0.0.1. Каждый TLS-прокси использует network_mode: service:<backend>, поэтому plaintext не выходит из общего network namespace. На Docker-сеть слушает только 3443 с проверкой сертификата и роли/пути. Прямые backend-порты не публикуются. Прокси — часть доверенной границы backend, доступ к Docker host эквивалентен доступу оператора.
|
||||
|
||||
1. HTTPS с правильным CA/hostname проходит; с пустым/чужим CA и неправильным hostname — ошибка верификации, не «сервер недоступен».
|
||||
2. LB→API: без client cert, с cert чужого CA, с запрещённой identity от доверенного CA — отказ; с разрешённой LB identity — успех.
|
||||
3. На 4 повторите набор для broker и Collector; ограничение на network policy не заменяет проверку identity.
|
||||
4. Пользователь вне чата не читает metadata/content и не прикрепляет чужой файл; поддельный X-User-Id не меняет Bearer identity.
|
||||
5. OpenBao app policy читает только свой secret/path; запись policy и чтение чужого path запрещены. Worker не получает admin credentials API/БД/S3.
|
||||
6. На 4 отзовите secret/cert и дождитесь контролируемого эффекта с учётом действующих соединений, TLS resumption и cache/TTL. Покажите новое подключение, иначе тест отзыва может ничего не проверить.
|
||||
API health listener 127.0.0.1:9001 доступен только из той же реплики, разрешает только /health/live и /health/ready; бизнес-маршруты возвращают 404. HAProxy проверяет готовность по основному mTLS listener. PostgreSQL local Unix socket используется операторским init и pg_isready; удалённый plaintext запрещён pg_hba. Rabbit health — локальный диагностический CLI; кластерный transport не используется.
|
||||
|
||||
## Bootstrap и эксплуатация
|
||||
## Bootstrap и lifecycle
|
||||
|
||||
В репозитории только открытые конфиги, policy templates и scripts. CA private key, leaf keys, root token, unseal shares и SecretID не коммитятся, не запекаются в образ и не печатаются в отчёте. Для локального стенда оператор создаёт их вне Git и передаёт через files/secrets с ограниченными правами. Опишите, кто имеет доступ к CA/unseal, что нужно после рестарта OpenBao и как восстановить работу.
|
||||
scripts/up.py выполняется оператором на хосте: создаёт certs/secrets, поднимает Bao, делает init/unseal и записывает policies/KV, затем миграции и S3 policies, затем API/worker/LB. OpenBao использует file storage в volume, не dev-mode. Один unseal share — учебное упрощение; файл operator/bao-init.json имеет режим 0600, не монтируется в контейнеры. После рестарта Bao нужен операторский unseal (`py -X utf8 scripts/bao.py --unseal-only`). После обычного рестарта API unseal не требуется.
|
||||
|
||||
OpenBao не использует dev-mode. Выберите persistent storage и auth метод (например AppRole с короткоживущим SecretID/response wrapping, cert auth или иная обоснованная identity). Не подменяйте root token постоянной переменной BAO_TOKEN в приложении. Рабочие tokens имеют policy, TTL и renewal/re-auth сценарий. Статические KV secrets на 3 допустимы при реальном чтении через сервисную identity; динамические DB credentials — хорошее расширение, но не обязательное название технологии.
|
||||
|
||||
Разрешённый компромисс учебного стенда: ручной operator init/unseal, если он безопасно документирован и не нужен при каждом обычном рестарте API. Автоматическое хранение всех unseal shares рядом с OpenBao без защиты не считается решённым bootstrap.
|
||||
Секреты и generated provisioning исключены из Git/архива. Если Bao sealed/недоступен при старте API, старт завершается с ошибкой без plaintext fallback. Уже запущенные сервисы используют выданные статические KV credentials в памяти, так что запечатывание Bao само по себе их не отзывает. Это ограничение уровня 3. Перезапуск и отказ реплики проверяются operator hooks без удаления volumes.
|
||||
|
||||
+7
-3
@@ -1,5 +1,9 @@
|
||||
# Доказательства
|
||||
# Доказательства lab7
|
||||
|
||||
Храните небольшие обезличенные результаты: команды и stdout проверок, JSON/CSV агрегатов нагрузки, EXPLAIN, dashboard JSON, текст разбора отказа. Укажите дату, commit, аппаратные лимиты и профиль нагрузки.
|
||||
Публичные scripts не менялись: check.txt, external-tls.txt, smoke.txt, persistence.txt и failover.txt содержат реальный вывод. lifecycle-*.json фиксируют процессы и volumes при operator hooks.
|
||||
|
||||
Не добавляйте .env, session tokens, cookies, приватные ключи, credentials, реальные сообщения, raw dumps и signed URLs. Для скриншотов скрывайте секреты. Большие логи/бинарные traces сохраняйте отдельно по правилам преподавателя; одного скриншота без методики недостаточно.
|
||||
security.txt: mTLS для обеих API, OpenBao policies, DB/S3/broker ACL и login rate limit. argon2.json — измерение hash на стенде. expiry.txt — реальная сессия TTL=2. no-bypass.txt проверяет закрытые native plaintext ports. hardening.json — только безопасные поля Docker inspect, без Env и секретов.
|
||||
|
||||
telemetry.json: реальные связанные API/worker logs и traces плюс числа серий метрик. Worker прошёл пять попыток отсутствующего staging и перешёл в failed. grafana.json подтверждает авторизованный HTTPS и запросы к трём TLS/mTLS источникам. dependency-audit.json не является чистым отчётом; разбор — security/dependency-triage.md.
|
||||
|
||||
Все данные синтетические. Ключи, пароли, session tokens и содержимое сообщений в evidence не сохраняются. Команды повторения и ограничения находятся в REPORT.md.
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
PASS: archive inputs checked against local bootstrap passwords, root token, unseal shares and private-key PEM marker; generated certs/secrets/operator/.env/node_modules excluded.
|
||||
@@ -0,0 +1,21 @@
|
||||
{
|
||||
"samples_ms": [
|
||||
26.721587999999997,
|
||||
17.07114899999999,
|
||||
16.818347000000017,
|
||||
17.113460999999916,
|
||||
18.649389999999926,
|
||||
16.302323
|
||||
],
|
||||
"mean_ms": 18.779376333333307,
|
||||
"options": {
|
||||
"algorithm": 2,
|
||||
"version": 1,
|
||||
"memoryCost": 19456,
|
||||
"timeCost": 2,
|
||||
"parallelism": 1,
|
||||
"outputLen": 32
|
||||
},
|
||||
"container_cpu_limit": 1.5,
|
||||
"container_memory_mib": 512
|
||||
}
|
||||
@@ -0,0 +1,170 @@
|
||||
Image openbao/openbao:2.2.2 Pulling
|
||||
84ee1d9518e0 Pulling fs layer 0B
|
||||
d69feb0119fc Pulling fs layer 0B
|
||||
297cc1e5c226 Pulling fs layer 0B
|
||||
828b2b907a78 Pulling fs layer 0B
|
||||
133cd4c3df8f Pulling fs layer 0B
|
||||
09c781d59115 Pulling fs layer 0B
|
||||
f18232174bc9 Pulling fs layer 0B
|
||||
fcf82c875731 Pulling fs layer 0B
|
||||
f18232174bc9 Already exists 0B
|
||||
d69feb0119fc Download complete 0B
|
||||
84ee1d9518e0 Download complete 0B
|
||||
09c781d59115 Download complete 0B
|
||||
09c781d59115 Pull complete 0B
|
||||
828b2b907a78 Download complete 0B
|
||||
fcf82c875731 Download complete 0B
|
||||
fcf82c875731 Pull complete 0B
|
||||
297cc1e5c226 Downloading 1.049MB
|
||||
133cd4c3df8f Download complete 0B
|
||||
84ee1d9518e0 Extracting 1B
|
||||
297cc1e5c226 Downloading 3.146MB
|
||||
84ee1d9518e0 Pull complete 0B
|
||||
297cc1e5c226 Downloading 4.194MB
|
||||
297cc1e5c226 Downloading 5.243MB
|
||||
297cc1e5c226 Downloading 6.291MB
|
||||
297cc1e5c226 Downloading 8.389MB
|
||||
297cc1e5c226 Downloading 9.437MB
|
||||
297cc1e5c226 Downloading 10.49MB
|
||||
297cc1e5c226 Downloading 11.53MB
|
||||
297cc1e5c226 Downloading 12.58MB
|
||||
297cc1e5c226 Downloading 14.68MB
|
||||
297cc1e5c226 Downloading 15.73MB
|
||||
297cc1e5c226 Downloading 16.78MB
|
||||
297cc1e5c226 Downloading 17.83MB
|
||||
297cc1e5c226 Downloading 18.87MB
|
||||
297cc1e5c226 Downloading 19.92MB
|
||||
297cc1e5c226 Downloading 20.97MB
|
||||
297cc1e5c226 Downloading 23.07MB
|
||||
297cc1e5c226 Downloading 24.12MB
|
||||
297cc1e5c226 Downloading 25.17MB
|
||||
297cc1e5c226 Downloading 27.26MB
|
||||
297cc1e5c226 Downloading 28.31MB
|
||||
297cc1e5c226 Downloading 29.36MB
|
||||
297cc1e5c226 Downloading 31.46MB
|
||||
297cc1e5c226 Downloading 32.51MB
|
||||
297cc1e5c226 Downloading 33.55MB
|
||||
297cc1e5c226 Downloading 35.65MB
|
||||
297cc1e5c226 Downloading 36.7MB
|
||||
297cc1e5c226 Downloading 37.75MB
|
||||
297cc1e5c226 Downloading 39.85MB
|
||||
297cc1e5c226 Downloading 40.89MB
|
||||
297cc1e5c226 Downloading 41.94MB
|
||||
297cc1e5c226 Downloading 44.04MB
|
||||
297cc1e5c226 Downloading 45.09MB
|
||||
297cc1e5c226 Downloading 47.19MB
|
||||
297cc1e5c226 Downloading 48.23MB
|
||||
297cc1e5c226 Downloading 49.28MB
|
||||
297cc1e5c226 Downloading 51.38MB
|
||||
297cc1e5c226 Downloading 52.43MB
|
||||
297cc1e5c226 Downloading 53.48MB
|
||||
297cc1e5c226 Downloading 55.57MB
|
||||
297cc1e5c226 Downloading 56.62MB
|
||||
297cc1e5c226 Downloading 57.67MB
|
||||
297cc1e5c226 Downloading 59.77MB
|
||||
297cc1e5c226 Downloading 60.82MB
|
||||
297cc1e5c226 Downloading 61.87MB
|
||||
297cc1e5c226 Downloading 62.91MB
|
||||
297cc1e5c226 Downloading 63.96MB
|
||||
297cc1e5c226 Downloading 66.06MB
|
||||
297cc1e5c226 Downloading 67.11MB
|
||||
297cc1e5c226 Download complete 0B
|
||||
297cc1e5c226 Extracting 1B
|
||||
297cc1e5c226 Extracting 1B
|
||||
297cc1e5c226 Extracting 1B
|
||||
297cc1e5c226 Extracting 1B
|
||||
297cc1e5c226 Extracting 1B
|
||||
297cc1e5c226 Extracting 1B
|
||||
d69feb0119fc Pull complete 0B
|
||||
828b2b907a78 Pull complete 0B
|
||||
133cd4c3df8f Pull complete 0B
|
||||
297cc1e5c226 Pull complete 0B
|
||||
Image openbao/openbao:2.2.2 Pulled
|
||||
Volume mtusi-lab7_s3data Creating
|
||||
Volume mtusi-lab7_prometheusdata Creating
|
||||
Volume mtusi-lab7_grafanadata Creating
|
||||
Volume mtusi-lab7_lokidata Creating
|
||||
Volume mtusi-lab7_pgdata Creating
|
||||
Network mtusi-lab7_default Creating
|
||||
Volume mtusi-lab7_tempodata Creating
|
||||
Volume mtusi-lab7_baodata Creating
|
||||
Volume mtusi-lab7_s3data Creating
|
||||
Network mtusi-lab7_default Creating
|
||||
Volume mtusi-lab7_brokerdata Creating
|
||||
Volume mtusi-lab7_brokerdata Creating
|
||||
Volume mtusi-lab7_tempodata Creating
|
||||
Volume mtusi-lab7_prometheusdata Creating
|
||||
Volume mtusi-lab7_pgdata Creating
|
||||
Volume mtusi-lab7_lokidata Creating
|
||||
Volume mtusi-lab7_grafanadata Creating
|
||||
Volume mtusi-lab7_baodata Creating
|
||||
Volume mtusi-lab7_s3data Created
|
||||
Volume mtusi-lab7_s3data Created
|
||||
Volume mtusi-lab7_brokerdata Created
|
||||
Volume mtusi-lab7_brokerdata Created
|
||||
Volume mtusi-lab7_prometheusdata Created
|
||||
Volume mtusi-lab7_prometheusdata Created
|
||||
Volume mtusi-lab7_lokidata Created
|
||||
Volume mtusi-lab7_lokidata Created
|
||||
Volume mtusi-lab7_tempodata Created
|
||||
Volume mtusi-lab7_tempodata Created
|
||||
Volume mtusi-lab7_baodata Created
|
||||
Volume mtusi-lab7_baodata Created
|
||||
Volume mtusi-lab7_pgdata Created
|
||||
Volume mtusi-lab7_pgdata Created
|
||||
Volume mtusi-lab7_grafanadata Created
|
||||
Volume mtusi-lab7_grafanadata Created
|
||||
Network mtusi-lab7_default Created
|
||||
Network mtusi-lab7_default Created
|
||||
Container mtusi-lab7-bao-1 Creating
|
||||
Container mtusi-lab7-prometheus-1 Creating
|
||||
Container mtusi-lab7-tempo-1 Creating
|
||||
Container mtusi-lab7-otel-collector-1 Creating
|
||||
Container mtusi-lab7-grafana-1 Creating
|
||||
Container mtusi-lab7-loki-1 Creating
|
||||
Container mtusi-lab7-db-1 Creating
|
||||
Container mtusi-lab7-broker-1 Creating
|
||||
Container mtusi-lab7-s3-1 Creating
|
||||
Container mtusi-lab7-tempo-1 Created
|
||||
Container mtusi-lab7-tempo-tls-1 Creating
|
||||
Container mtusi-lab7-otel-collector-1 Created
|
||||
Container mtusi-lab7-otel-collector-tls-1 Creating
|
||||
Container mtusi-lab7-grafana-1 Created
|
||||
Container mtusi-lab7-prometheus-1 Created
|
||||
Container mtusi-lab7-prometheus-tls-1 Creating
|
||||
Container mtusi-lab7-loki-1 Created
|
||||
Container mtusi-lab7-loki-tls-1 Creating
|
||||
Container mtusi-lab7-s3-1 Created
|
||||
Container mtusi-lab7-broker-1 Created
|
||||
Container mtusi-lab7-db-1 Created
|
||||
Container mtusi-lab7-bao-1 Created
|
||||
Container mtusi-lab7-otel-collector-tls-1 Created
|
||||
Container mtusi-lab7-tempo-tls-1 Created
|
||||
Container mtusi-lab7-prometheus-tls-1 Created
|
||||
Container mtusi-lab7-loki-tls-1 Created
|
||||
Container mtusi-lab7-grafana-1 Starting
|
||||
Container mtusi-lab7-otel-collector-1 Starting
|
||||
Container mtusi-lab7-bao-1 Starting
|
||||
Container mtusi-lab7-loki-1 Starting
|
||||
Container mtusi-lab7-db-1 Starting
|
||||
Container mtusi-lab7-tempo-1 Starting
|
||||
Container mtusi-lab7-s3-1 Starting
|
||||
Container mtusi-lab7-broker-1 Starting
|
||||
Container mtusi-lab7-prometheus-1 Starting
|
||||
Container mtusi-lab7-grafana-1 Started
|
||||
Container mtusi-lab7-otel-collector-1 Started
|
||||
Container mtusi-lab7-otel-collector-tls-1 Starting
|
||||
Container mtusi-lab7-bao-1 Started
|
||||
Container mtusi-lab7-loki-1 Started
|
||||
Container mtusi-lab7-loki-tls-1 Starting
|
||||
Container mtusi-lab7-db-1 Started
|
||||
Container mtusi-lab7-tempo-1 Started
|
||||
Container mtusi-lab7-tempo-tls-1 Starting
|
||||
Container mtusi-lab7-s3-1 Started
|
||||
Container mtusi-lab7-broker-1 Started
|
||||
Container mtusi-lab7-prometheus-1 Started
|
||||
Container mtusi-lab7-prometheus-tls-1 Starting
|
||||
Container mtusi-lab7-otel-collector-tls-1 Started
|
||||
Container mtusi-lab7-loki-tls-1 Started
|
||||
Container mtusi-lab7-tempo-tls-1 Started
|
||||
Container mtusi-lab7-prometheus-tls-1 Started
|
||||
@@ -0,0 +1,77 @@
|
||||
Image mtusi-messenger:lab7 Building
|
||||
#1 [internal] load local bake definitions
|
||||
#1 reading from stdin 1.22kB 0.0s done
|
||||
#1 DONE 0.0s
|
||||
|
||||
#2 [internal] load build definition from Dockerfile
|
||||
#2 transferring dockerfile: 250B done
|
||||
#2 DONE 0.0s
|
||||
|
||||
#3 [internal] load metadata for docker.io/library/node:22.20.0-alpine
|
||||
#3 DONE 12.3s
|
||||
|
||||
#4 [internal] load .dockerignore
|
||||
#4 transferring context: 196B done
|
||||
#4 DONE 0.0s
|
||||
|
||||
#5 [1/6] FROM docker.io/library/node:22.20.0-alpine@sha256:dbcedd8aeab47fbc0f4dd4bffa55b7c3c729a707875968d467aaaea42d6225af
|
||||
#5 resolve docker.io/library/node:22.20.0-alpine@sha256:dbcedd8aeab47fbc0f4dd4bffa55b7c3c729a707875968d467aaaea42d6225af 0.0s done
|
||||
#5 DONE 0.0s
|
||||
|
||||
#6 [internal] load build context
|
||||
#6 transferring context: 69.22kB 0.0s done
|
||||
#6 DONE 0.0s
|
||||
|
||||
#7 [2/6] WORKDIR /app
|
||||
#7 CACHED
|
||||
|
||||
#8 [3/6] COPY package.json package-lock.json ./
|
||||
#8 DONE 0.0s
|
||||
|
||||
#9 [4/6] RUN npm ci --omit=dev --ignore-scripts
|
||||
#9 2.596 npm warn deprecated @opentelemetry/sdk-trace-node@1.30.1: Use @opentelemetry/sdk-trace package
|
||||
#9 2.943 npm warn deprecated @opentelemetry/propagator-jaeger@1.30.1: Package no longer supported. See https://github.com/open-telemetry/opentelemetry-js/pull/7077
|
||||
#9 4.539 npm warn deprecated @opentelemetry/sdk-trace-base@1.30.1: Use @opentelemetry/sdk-trace package
|
||||
#9 5.187
|
||||
#9 5.187 added 98 packages, and audited 99 packages in 5s
|
||||
#9 5.187
|
||||
#9 5.187 15 packages are looking for funding
|
||||
#9 5.187 run `npm fund` for details
|
||||
#9 5.201
|
||||
#9 5.201 18 vulnerabilities (13 moderate, 5 high)
|
||||
#9 5.201
|
||||
#9 5.201 To address issues that do not require attention, run:
|
||||
#9 5.201 npm audit fix
|
||||
#9 5.201
|
||||
#9 5.201 To address all issues (including breaking changes), run:
|
||||
#9 5.201 npm audit fix --force
|
||||
#9 5.201
|
||||
#9 5.201 Run `npm audit` for details.
|
||||
#9 5.202 npm notice
|
||||
#9 5.202 npm notice New major version of npm available! 10.9.3 -> 12.2.3
|
||||
#9 5.202 npm notice Changelog: https://github.com/npm/cli/releases/tag/v12.2.3
|
||||
#9 5.202 npm notice To update run: npm install -g npm@12.2.3
|
||||
#9 5.202 npm notice
|
||||
#9 DONE 5.5s
|
||||
|
||||
#10 [5/6] COPY src/ ./src/
|
||||
#10 DONE 0.1s
|
||||
|
||||
#11 [6/6] COPY migrations/ ./migrations/
|
||||
#11 DONE 0.1s
|
||||
|
||||
#12 exporting to image
|
||||
#12 exporting layers
|
||||
#12 exporting layers 3.6s done
|
||||
#12 exporting manifest sha256:840adda338ea4496b7a2f6d8447ec908bfd1fc45611e32e2ed7b85dbd6083887 0.0s done
|
||||
#12 exporting config sha256:88ff19526b2831a7f70628d5f058a310d4571b32ec29abb9eaf539daf3344655 0.0s done
|
||||
#12 exporting attestation manifest sha256:36f1e36eecdf57e4a6c9933fff537dabb8aee87469c95f2f7c17e92b18551025 0.0s done
|
||||
#12 exporting manifest list sha256:532fcd4e0b40162961209eba9401e37ece87066753e0f9ddd1cc57c1c5cbf907 0.0s done
|
||||
#12 naming to docker.io/library/mtusi-messenger:lab7 done
|
||||
#12 unpacking to docker.io/library/mtusi-messenger:lab7
|
||||
#12 unpacking to docker.io/library/mtusi-messenger:lab7 2.0s done
|
||||
#12 DONE 5.7s
|
||||
|
||||
#13 resolving provenance for metadata file
|
||||
#13 DONE 0.0s
|
||||
Image mtusi-messenger:lab7 Built
|
||||
@@ -0,0 +1,85 @@
|
||||
Image mtusi-mc:2025-04-16 Building
|
||||
#1 [internal] load local bake definitions
|
||||
#1 reading from stdin 1.23kB 0.0s done
|
||||
#1 DONE 0.0s
|
||||
|
||||
#2 [internal] load build definition from Dockerfile.mc
|
||||
#2 transferring dockerfile: 577B 0.0s done
|
||||
#2 DONE 0.0s
|
||||
|
||||
#3 [internal] load metadata for docker.io/library/alpine:3.22.1
|
||||
#3 ...
|
||||
|
||||
#4 [internal] load metadata for docker.io/library/golang:1.24.3-alpine
|
||||
#4 DONE 12.3s
|
||||
|
||||
#3 [internal] load metadata for docker.io/library/alpine:3.22.1
|
||||
#3 DONE 12.3s
|
||||
|
||||
#5 [internal] load .dockerignore
|
||||
#5 transferring context: 196B done
|
||||
#5 DONE 0.0s
|
||||
|
||||
#6 [stage-1 1/3] FROM docker.io/library/alpine:3.22.1@sha256:4bcff63911fcb4448bd4fdacec207030997caf25e9bea4045fa6c8c44de311d1
|
||||
#6 resolve docker.io/library/alpine:3.22.1@sha256:4bcff63911fcb4448bd4fdacec207030997caf25e9bea4045fa6c8c44de311d1 0.0s done
|
||||
#6 DONE 0.0s
|
||||
|
||||
#7 [stage-1 2/3] RUN apk add --no-cache ca-certificates curl
|
||||
#7 CACHED
|
||||
|
||||
#8 [build 1/5] FROM docker.io/library/golang:1.24.3-alpine@sha256:b4f875e650466fa0fe62c6fd3f02517a392123eea85f1d7e69d85f780e4db1c1
|
||||
#8 resolve docker.io/library/golang:1.24.3-alpine@sha256:b4f875e650466fa0fe62c6fd3f02517a392123eea85f1d7e69d85f780e4db1c1 0.0s done
|
||||
#8 DONE 0.0s
|
||||
|
||||
#9 [build 2/5] RUN apk add --no-cache git || apk add --no-cache git || apk add --no-cache git
|
||||
#9 CACHED
|
||||
|
||||
#10 [build 3/5] RUN git clone --depth 1 --branch RELEASE.2025-04-16T18-13-26Z https://github.com/minio/mc.git /src
|
||||
#10 0.191 Cloning into '/src'...
|
||||
#10 4.244 warning: refs/tags/RELEASE.2025-04-16T18-13-26Z 1e78af443bf0443eb177f26421fe081f08d83dc5 is not a commit!
|
||||
#10 4.246 Note: switching to 'b00526b153a31b36767991a4f5ce2cced435ee8e'.
|
||||
#10 4.246
|
||||
#10 4.246 You are in 'detached HEAD' state. You can look around, make experimental
|
||||
#10 4.246 changes and commit them, and you can discard any commits you make in this
|
||||
#10 4.246 state without impacting any branches by switching back to a branch.
|
||||
#10 4.246
|
||||
#10 4.246 If you want to create a new branch to retain commits you create, you may
|
||||
#10 4.246 do so (now or later) by using -c with the switch command. Example:
|
||||
#10 4.246
|
||||
#10 4.246 git switch -c <new-branch-name>
|
||||
#10 4.246
|
||||
#10 4.246 Or undo this operation with:
|
||||
#10 4.246
|
||||
#10 4.246 git switch -
|
||||
#10 4.246
|
||||
#10 4.246 Turn off this advice by setting config variable advice.detachedHead to false
|
||||
#10 4.246
|
||||
#10 DONE 4.4s
|
||||
|
||||
#11 [build 4/5] WORKDIR /src
|
||||
#11 DONE 0.1s
|
||||
|
||||
#12 [build 5/5] RUN --mount=type=cache,target=/go/pkg/mod --mount=type=cache,target=/root/.cache/go-build for attempt in 1 2 3 4 5; do CGO_ENABLED=0 go build -trimpath -o /mc . && exit 0; done; exit 1
|
||||
#12 0.433 go: downloading github.com/minio/madmin-go/v3 v3.0.107-0.20250415152934-4b504b82db63
|
||||
#12 1.076 go: downloading google.golang.org/genproto/googleapis/api v0.0.0-20250311173030-29e43e6258d7
|
||||
#12 1.276 go: downloading google.golang.org/genproto/googleapis/rpc v0.0.0-20250303144028-a0af3efb3deb
|
||||
#12 DONE 39.7s
|
||||
|
||||
#13 [stage-1 3/3] COPY --from=build /mc /usr/local/bin/mc
|
||||
#13 DONE 0.1s
|
||||
|
||||
#14 exporting to image
|
||||
#14 exporting layers
|
||||
#14 exporting layers 1.4s done
|
||||
#14 exporting manifest sha256:8d6d70dbd4d7f47affc37d95aa1de1e72be3d903364844c4a50d38aa997fb41d 0.0s done
|
||||
#14 exporting config sha256:3b6f7fd7c5261dd84ad05342b6d15dc4c278d9693e2f1d415dd4e09316aba07b 0.0s done
|
||||
#14 exporting attestation manifest sha256:c8e250f8b59c84fc13e5a944c784368b21406f0ff671aae08110da606909536b 0.0s done
|
||||
#14 exporting manifest list sha256:30fdc90e0a3c60488f6fd8a50134fce3736716135465fdebd57f0d630c2619da 0.0s done
|
||||
#14 naming to docker.io/library/mtusi-mc:2025-04-16 done
|
||||
#14 unpacking to docker.io/library/mtusi-mc:2025-04-16
|
||||
#14 unpacking to docker.io/library/mtusi-mc:2025-04-16 0.2s done
|
||||
#14 DONE 1.7s
|
||||
|
||||
#15 resolving provenance for metadata file
|
||||
#15 DONE 0.0s
|
||||
Image mtusi-mc:2025-04-16 Built
|
||||
@@ -0,0 +1,52 @@
|
||||
Image mtusi-messenger:lab7 Building
|
||||
#1 [internal] load local bake definitions
|
||||
#1 reading from stdin 1.22kB 0.0s done
|
||||
#1 DONE 0.0s
|
||||
|
||||
#2 [internal] load build definition from Dockerfile
|
||||
#2 transferring dockerfile: 250B 0.0s done
|
||||
#2 DONE 0.0s
|
||||
|
||||
#3 [internal] load metadata for docker.io/library/node:22.20.0-alpine
|
||||
#3 DONE 1.4s
|
||||
|
||||
#4 [internal] load .dockerignore
|
||||
#4 transferring context: 206B 0.0s done
|
||||
#4 DONE 0.0s
|
||||
|
||||
#5 [1/6] FROM docker.io/library/node:22.20.0-alpine@sha256:dbcedd8aeab47fbc0f4dd4bffa55b7c3c729a707875968d467aaaea42d6225af
|
||||
#5 resolve docker.io/library/node:22.20.0-alpine@sha256:dbcedd8aeab47fbc0f4dd4bffa55b7c3c729a707875968d467aaaea42d6225af 0.0s done
|
||||
#5 DONE 0.0s
|
||||
|
||||
#6 [internal] load build context
|
||||
#6 transferring context: 2.68kB 0.0s done
|
||||
#6 DONE 0.0s
|
||||
|
||||
#7 [2/6] WORKDIR /app
|
||||
#7 CACHED
|
||||
|
||||
#8 [3/6] COPY package.json package-lock.json ./
|
||||
#8 CACHED
|
||||
|
||||
#9 [4/6] RUN npm ci --omit=dev --ignore-scripts
|
||||
#9 CACHED
|
||||
|
||||
#10 [5/6] COPY src/ ./src/
|
||||
#10 DONE 0.0s
|
||||
|
||||
#11 [6/6] COPY migrations/ ./migrations/
|
||||
#11 DONE 0.0s
|
||||
|
||||
#12 exporting to image
|
||||
#12 exporting layers 0.1s done
|
||||
#12 exporting manifest sha256:854cdffd4d3e5254b4054bcfaf20508087bb087dc40b1464f1c6e2b7413b1172 0.0s done
|
||||
#12 exporting config sha256:3183f97416c0f75398db1a3b4f7bd83bcc35ab3d99c4a1ab16b1ce279c3c3556 0.0s done
|
||||
#12 exporting attestation manifest sha256:6134ed0f12ff3c5b240b8b119e0045c08285f597730be4af13cbb341d8fbb539 0.0s done
|
||||
#12 exporting manifest list sha256:0014276b8dfd1bbfa1ac9a7be1bf8c34ebc6040742f419b170b8b2f5af172eb1 0.0s done
|
||||
#12 naming to docker.io/library/mtusi-messenger:lab7 done
|
||||
#12 unpacking to docker.io/library/mtusi-messenger:lab7 0.0s done
|
||||
#12 DONE 0.3s
|
||||
|
||||
#13 resolving provenance for metadata file
|
||||
#13 DONE 0.0s
|
||||
Image mtusi-messenger:lab7 Built
|
||||
@@ -0,0 +1,254 @@
|
||||
Image mtusi-messenger:lab7 Building
|
||||
Image mtusi-messenger:lab7 Building
|
||||
Image mtusi-messenger:lab7 Building
|
||||
Image mtusi-messenger:lab7 Building
|
||||
Image mtusi-messenger:lab7 Building
|
||||
Image mtusi-minio:RELEASE.2025-04-22T22-12-26Z Building
|
||||
Image mtusi-messenger:lab7 Building
|
||||
Image mtusi-messenger:lab7 Building
|
||||
Image mtusi-messenger:lab7 Building
|
||||
#1 [internal] load local bake definitions
|
||||
#1 reading from stdin 5.26kB 0.0s done
|
||||
#1 DONE 0.0s
|
||||
|
||||
#2 [s3 internal] load build definition from Dockerfile.s3
|
||||
#2 transferring dockerfile: 596B 0.0s done
|
||||
#2 DONE 0.1s
|
||||
|
||||
#3 [prometheus-tls internal] load build definition from Dockerfile
|
||||
#3 transferring dockerfile: 250B 0.0s done
|
||||
#3 DONE 0.1s
|
||||
|
||||
#4 [api2 internal] load metadata for docker.io/library/node:22.20.0-alpine
|
||||
#4 ...
|
||||
|
||||
#5 [s3 internal] load metadata for docker.io/library/golang:1.24.3-alpine
|
||||
#5 ...
|
||||
|
||||
#6 [s3 internal] load metadata for docker.io/library/alpine:3.22.1
|
||||
#6 ...
|
||||
|
||||
#7 [auth] library/alpine:pull token for registry-1.docker.io
|
||||
#7 DONE 0.0s
|
||||
|
||||
#8 [auth] library/golang:pull token for registry-1.docker.io
|
||||
#8 DONE 0.0s
|
||||
|
||||
#9 [auth] library/node:pull token for registry-1.docker.io
|
||||
#9 DONE 0.0s
|
||||
|
||||
#5 [s3 internal] load metadata for docker.io/library/golang:1.24.3-alpine
|
||||
#5 DONE 13.4s
|
||||
|
||||
#6 [s3 internal] load metadata for docker.io/library/alpine:3.22.1
|
||||
#6 DONE 13.4s
|
||||
|
||||
#4 [api2 internal] load metadata for docker.io/library/node:22.20.0-alpine
|
||||
#4 DONE 13.4s
|
||||
|
||||
#10 [migrate internal] load .dockerignore
|
||||
#10 transferring context: 196B done
|
||||
#10 DONE 0.0s
|
||||
|
||||
#11 [api2 internal] load build context
|
||||
#11 transferring context: 133.01kB 0.1s done
|
||||
#11 DONE 0.1s
|
||||
|
||||
#12 [api1 1/6] FROM docker.io/library/node:22.20.0-alpine@sha256:dbcedd8aeab47fbc0f4dd4bffa55b7c3c729a707875968d467aaaea42d6225af
|
||||
#12 resolve docker.io/library/node:22.20.0-alpine@sha256:dbcedd8aeab47fbc0f4dd4bffa55b7c3c729a707875968d467aaaea42d6225af 0.1s done
|
||||
#12 DONE 0.1s
|
||||
|
||||
#13 [s3 build 1/5] FROM docker.io/library/golang:1.24.3-alpine@sha256:b4f875e650466fa0fe62c6fd3f02517a392123eea85f1d7e69d85f780e4db1c1
|
||||
#13 resolve docker.io/library/golang:1.24.3-alpine@sha256:b4f875e650466fa0fe62c6fd3f02517a392123eea85f1d7e69d85f780e4db1c1 0.1s done
|
||||
#13 DONE 0.1s
|
||||
|
||||
#14 [s3 stage-1 1/3] FROM docker.io/library/alpine:3.22.1@sha256:4bcff63911fcb4448bd4fdacec207030997caf25e9bea4045fa6c8c44de311d1
|
||||
#14 resolve docker.io/library/alpine:3.22.1@sha256:4bcff63911fcb4448bd4fdacec207030997caf25e9bea4045fa6c8c44de311d1 0.1s done
|
||||
#14 DONE 0.1s
|
||||
|
||||
#15 [s3 stage-1 2/3] RUN apk add --no-cache ca-certificates curl
|
||||
#15 CACHED
|
||||
|
||||
#16 [s3 build 3/5] RUN git clone --depth 1 --branch RELEASE.2025-04-22T22-12-26Z https://github.com/minio/minio.git /src
|
||||
#16 CACHED
|
||||
|
||||
#17 [s3 build 5/5] RUN --mount=type=cache,target=/go/pkg/mod --mount=type=cache,target=/root/.cache/go-build for attempt in 1 2 3 4 5; do CGO_ENABLED=0 go build -trimpath -o /minio . && exit 0; done; exit 1
|
||||
#17 CACHED
|
||||
|
||||
#18 [s3 build 4/5] WORKDIR /src
|
||||
#18 CACHED
|
||||
|
||||
#19 [s3 build 2/5] RUN apk add --no-cache git || apk add --no-cache git || apk add --no-cache git
|
||||
#19 CACHED
|
||||
|
||||
#20 [s3 stage-1 3/3] COPY --from=build /minio /usr/local/bin/minio
|
||||
#20 CACHED
|
||||
|
||||
#21 [api1 2/6] WORKDIR /app
|
||||
#21 CACHED
|
||||
|
||||
#22 [api1 3/6] COPY package.json package-lock.json ./
|
||||
#22 DONE 0.1s
|
||||
|
||||
#23 [s3] exporting to image
|
||||
#23 exporting layers done
|
||||
#23 exporting manifest sha256:30c9a830e647203222625c3aea74b93bce23627a1390a2f66a5f397993e20e3b 0.0s done
|
||||
#23 exporting config sha256:f0d50e37a289ba1410c733ea58e694f778c6b5482259c8c8c925f3a78b6b6027 0.0s done
|
||||
#23 exporting attestation manifest sha256:f96fd22d442e3df9ca8d7374431a9cdba80db11bf4870ec9275c56a15fe2b487 0.0s done
|
||||
#23 exporting manifest list sha256:39bcf0eb398f80970d6ef729706c065bfaaf82e904ba45b6959a7ba49ce12e52 0.0s done
|
||||
#23 naming to docker.io/library/mtusi-minio:RELEASE.2025-04-22T22-12-26Z done
|
||||
#23 unpacking to docker.io/library/mtusi-minio:RELEASE.2025-04-22T22-12-26Z done
|
||||
#23 DONE 0.1s
|
||||
|
||||
#24 [s3] resolving provenance for metadata file
|
||||
#24 DONE 0.0s
|
||||
|
||||
#25 [tempo-tls 4/6] RUN npm ci --omit=dev --ignore-scripts
|
||||
#25 2.783 npm warn deprecated @opentelemetry/sdk-trace-node@1.30.1: Use @opentelemetry/sdk-trace package
|
||||
#25 3.026 npm warn deprecated @opentelemetry/propagator-jaeger@1.30.1: Package no longer supported. See https://github.com/open-telemetry/opentelemetry-js/pull/7077
|
||||
#25 4.658 npm warn deprecated @opentelemetry/sdk-trace-base@1.30.1: Use @opentelemetry/sdk-trace package
|
||||
#25 5.341
|
||||
#25 5.341 added 128 packages, and audited 129 packages in 5s
|
||||
#25 5.341
|
||||
#25 5.341 27 packages are looking for funding
|
||||
#25 5.341 run `npm fund` for details
|
||||
#25 5.355
|
||||
#25 5.355 20 vulnerabilities (1 low, 13 moderate, 6 high)
|
||||
#25 5.355
|
||||
#25 5.355 To address issues that do not require attention, run:
|
||||
#25 5.355 npm audit fix
|
||||
#25 5.355
|
||||
#25 5.355 To address all issues (including breaking changes), run:
|
||||
#25 5.355 npm audit fix --force
|
||||
#25 5.355
|
||||
#25 5.355 Run `npm audit` for details.
|
||||
#25 5.356 npm notice
|
||||
#25 5.356 npm notice New major version of npm available! 10.9.3 -> 12.2.3
|
||||
#25 5.356 npm notice Changelog: https://github.com/npm/cli/releases/tag/v12.2.3
|
||||
#25 5.356 npm notice To update run: npm install -g npm@12.2.3
|
||||
#25 5.356 npm notice
|
||||
#25 DONE 5.7s
|
||||
|
||||
#26 [migrate 5/6] COPY src/ ./src/
|
||||
#26 DONE 0.1s
|
||||
|
||||
#27 [api2 6/6] COPY migrations/ ./migrations/
|
||||
#27 DONE 0.0s
|
||||
|
||||
#28 [worker] exporting to image
|
||||
#28 exporting layers
|
||||
#28 exporting layers 3.3s done
|
||||
#28 exporting manifest sha256:b2ed9b94bdb4475ef70b60683d299d626c5fd56a89bc69004d927f54044735e2 0.1s done
|
||||
#28 exporting config sha256:d2e706f07ea4fec8bc5c3de3339058c4d8f4de15f64d4c00305e701ae017ad14
|
||||
#28 exporting config sha256:d2e706f07ea4fec8bc5c3de3339058c4d8f4de15f64d4c00305e701ae017ad14 0.1s done
|
||||
#28 exporting attestation manifest sha256:89f24aeda82c8a4266122ffc48bbdcea2542a78ee661985ef9239bacf272cc97
|
||||
#28 exporting attestation manifest sha256:89f24aeda82c8a4266122ffc48bbdcea2542a78ee661985ef9239bacf272cc97 0.1s done
|
||||
#28 exporting manifest list sha256:40150054e63d8a825d1fba0067183ace8ac29514f4bac661244fab106a371304
|
||||
#28 exporting manifest list sha256:40150054e63d8a825d1fba0067183ace8ac29514f4bac661244fab106a371304 0.1s done
|
||||
#28 naming to docker.io/library/mtusi-messenger:lab7 0.0s done
|
||||
#28 unpacking to docker.io/library/mtusi-messenger:lab7
|
||||
#28 unpacking to docker.io/library/mtusi-messenger:lab7 3.5s done
|
||||
#28 DONE 7.4s
|
||||
|
||||
#29 [loki-tls] exporting to image
|
||||
#29 exporting layers 3.3s done
|
||||
#29 exporting manifest sha256:4a896178a9cd616c6002f383ae94cfccda21f488352ccbcd80938ca68d352f41 0.1s done
|
||||
#29 exporting config sha256:f1c86f2906148d3cc70627edb6fae6dd8e7f8ec2b8615223051b99223b7299fd 0.1s done
|
||||
#29 exporting attestation manifest sha256:5c7e257c0a274918aaca37f009025e55fc71aec875a5e6fff3c273d91c148467 0.1s done
|
||||
#29 exporting manifest list sha256:eca88704fd7981f25f26eb08985e64fe11660c4204e6e0491d809f9616448292 0.1s done
|
||||
#29 naming to docker.io/library/mtusi-messenger:lab7 0.0s done
|
||||
#29 unpacking to docker.io/library/mtusi-messenger:lab7 3.5s done
|
||||
#29 DONE 7.4s
|
||||
|
||||
#30 [api2] exporting to image
|
||||
#30 exporting layers 3.3s done
|
||||
#30 exporting manifest sha256:66a9d5140f1cea8ae28dad478680eb8aa68227e1a0cb44a76d63e9331507af36 0.1s done
|
||||
#30 exporting config sha256:ccc4e5c3a831fb96bd9ef07213787e4307341aace580a3966bc111a10b4ade04 0.1s done
|
||||
#30 exporting attestation manifest sha256:aa13800c0f4cac26a6fdcdb34f9f1f73d8dd8c0910771fb7b5faecfde545c83b 0.1s done
|
||||
#30 exporting manifest list sha256:c88aa781bb56de6cc635a20e50ccfced37b30d04b48ffb9f9a06fc2389bb3f24 0.1s done
|
||||
#30 naming to docker.io/library/mtusi-messenger:lab7 0.0s done
|
||||
#30 unpacking to docker.io/library/mtusi-messenger:lab7 3.5s done
|
||||
#30 DONE 7.5s
|
||||
|
||||
#31 [otel-collector-tls] exporting to image
|
||||
#31 exporting layers 3.3s done
|
||||
#31 exporting manifest sha256:70372d46839f869783989f94160830c700b8f9cb7b4ece64243f24ffc3d74050 0.1s done
|
||||
#31 exporting config sha256:721cf96135c0e447e0c5c09146e9919f09691c380344eeed1680917fa5924370 0.1s done
|
||||
#31 exporting attestation manifest sha256:98870eb19afb43fa64b4dc340273976cf9e12b49716e3ee70a904f86467bb0f4 0.1s done
|
||||
#31 exporting manifest list sha256:6212830a53e6fa76bb896f978be0999697f948aa4846b62daea6a449896667d4 0.1s done
|
||||
#31 naming to docker.io/library/mtusi-messenger:lab7 0.0s done
|
||||
#31 unpacking to docker.io/library/mtusi-messenger:lab7 3.5s done
|
||||
#31 DONE 7.5s
|
||||
|
||||
#32 [api1] exporting to image
|
||||
#32 exporting layers 3.3s done
|
||||
#32 exporting manifest sha256:079e2277e6b1973c239954d9ea781c25fbad8d8b82797da87fc0ab71c22921b2 0.1s done
|
||||
#32 exporting config sha256:05292828da6f2c2376cc8260ae23be4b12d2bc6ffe8d5ffda2ee074b8d3d4b83 0.1s done
|
||||
#32 exporting attestation manifest sha256:c9bad4b932869ca3d8d7a26025934708fc50673a9c25faec980ceda46cbab8a4 0.2s done
|
||||
#32 exporting manifest list sha256:d74eec71f5d669793308f207d2179b0f73740d283680aecef48322486dc98808 0.1s done
|
||||
#32 naming to docker.io/library/mtusi-messenger:lab7 0.1s done
|
||||
#32 unpacking to docker.io/library/mtusi-messenger:lab7 3.5s done
|
||||
#32 DONE 7.5s
|
||||
|
||||
#33 [tempo-tls] exporting to image
|
||||
#33 exporting layers 3.3s done
|
||||
#33 exporting manifest sha256:d8e74408d0a58280af5233fab8d8fba40d2c5375fefebb68d0c94fe4ecc10366 0.1s done
|
||||
#33 exporting config sha256:31c64b400dd72886c67b09016755c8157ea6d376595d49ddec35ee7fc08053f5 0.1s done
|
||||
#33 exporting attestation manifest sha256:ee64aa842f3f508a1d05bd50c77817209a9d2c0cc2540166dcc0ae798eeb4d0c 0.1s done
|
||||
#33 exporting manifest list sha256:7c03229e52356299380773010f44bb23375ee6fd1873bdf86120521f2e91651d 0.1s done
|
||||
#33 naming to docker.io/library/mtusi-messenger:lab7 done
|
||||
#33 unpacking to docker.io/library/mtusi-messenger:lab7 3.5s done
|
||||
#33 DONE 7.5s
|
||||
|
||||
#34 [prometheus-tls] exporting to image
|
||||
#34 exporting layers 3.3s done
|
||||
#34 exporting manifest sha256:b2a297ead07f631296e8ff7778240e31b8f8c0cf786c2509950a9ce42683474c 0.1s done
|
||||
#34 exporting config sha256:8b2caf5c555a226138581f39eaee6f68d60a06cfe59c34c23585ea74cad69823 0.1s done
|
||||
#34 exporting attestation manifest sha256:590d3194b9c1bbc92325f2d3a5cbcb58cea61f771ffdab6b5d641c560d707cb7 0.1s done
|
||||
#34 exporting manifest list sha256:f3b7d07bcc9649aabaddfcccc69b66a6afbd4e470230751a509f162c265ae2a4 0.1s done
|
||||
#34 naming to docker.io/library/mtusi-messenger:lab7 done
|
||||
#34 unpacking to docker.io/library/mtusi-messenger:lab7 3.6s done
|
||||
#34 DONE 7.5s
|
||||
|
||||
#35 [migrate] exporting to image
|
||||
#35 exporting layers 3.3s done
|
||||
#35 exporting manifest sha256:48d1a1669f8e5746a5abf34c1a357ae8663454b3357943a08edb24b4ed633ed0 0.1s done
|
||||
#35 exporting config sha256:6c5ff2c9b3e61c088a3adce5fa02bd3ff7e0e474a11ee67278e28921bf53e47b 0.1s done
|
||||
#35 exporting attestation manifest sha256:209fc52c052ed014df19ed7c2967f4bf1831fb9b001e37d5ef1eeec835fedec6 0.1s done
|
||||
#35 exporting manifest list sha256:d9f3e8d6d6a6ae93ad6a8c91f1c0408f4b57258075a340250f40efbcb3d046b5 0.1s done
|
||||
#35 naming to docker.io/library/mtusi-messenger:lab7 0.1s done
|
||||
#35 unpacking to docker.io/library/mtusi-messenger:lab7 3.5s done
|
||||
#35 DONE 7.5s
|
||||
|
||||
#36 [worker] resolving provenance for metadata file
|
||||
#36 DONE 0.4s
|
||||
|
||||
#37 [otel-collector-tls] resolving provenance for metadata file
|
||||
#37 DONE 0.3s
|
||||
|
||||
#38 [loki-tls] resolving provenance for metadata file
|
||||
#38 DONE 0.4s
|
||||
|
||||
#39 [migrate] resolving provenance for metadata file
|
||||
#39 DONE 0.1s
|
||||
|
||||
#40 [prometheus-tls] resolving provenance for metadata file
|
||||
#40 DONE 0.1s
|
||||
|
||||
#41 [api2] resolving provenance for metadata file
|
||||
#41 DONE 0.3s
|
||||
|
||||
#42 [api1] resolving provenance for metadata file
|
||||
#42 DONE 0.0s
|
||||
|
||||
#43 [tempo-tls] resolving provenance for metadata file
|
||||
#43 DONE 0.2s
|
||||
Image mtusi-messenger:lab7 Built
|
||||
Image mtusi-messenger:lab7 Built
|
||||
Image mtusi-messenger:lab7 Built
|
||||
Image mtusi-messenger:lab7 Built
|
||||
Image mtusi-minio:RELEASE.2025-04-22T22-12-26Z Built
|
||||
Image mtusi-messenger:lab7 Built
|
||||
Image mtusi-messenger:lab7 Built
|
||||
Image mtusi-messenger:lab7 Built
|
||||
Image mtusi-messenger:lab7 Built
|
||||
@@ -0,0 +1 @@
|
||||
PASS: offline skeleton structure, local refs and Python syntax; application NOT tested.
|
||||
@@ -0,0 +1,19 @@
|
||||
NAME IMAGE COMMAND SERVICE CREATED STATUS PORTS
|
||||
mtusi-lab7-api1-1 mtusi-messenger:lab7 "docker-entrypoint.s…" api1 About a minute ago Up About a minute (healthy)
|
||||
mtusi-lab7-api2-1 mtusi-messenger:lab7 "docker-entrypoint.s…" api2 About a minute ago Up About a minute (healthy)
|
||||
mtusi-lab7-bao-1 openbao/openbao:2.2.2 "docker-entrypoint.s…" bao 4 hours ago Up 10 minutes 127.0.0.1:8207->8200/tcp
|
||||
mtusi-lab7-broker-1 rabbitmq:4.1.0-alpine "docker-entrypoint.s…" broker About a minute ago Up About a minute (healthy) 4369/tcp, 5671-5672/tcp, 15691-15692/tcp, 25672/tcp
|
||||
mtusi-lab7-db-1 postgres:17.6-alpine "docker-entrypoint.s…" db 4 hours ago Up 10 minutes (healthy) 5432/tcp
|
||||
mtusi-lab7-expiry-1 sha256:532fcd4e0b40162961209eba9401e37ece87066753e0f9ddd1cc57c1c5cbf907 "docker-entrypoint.s…" expiry 12 minutes ago Exited (0) 11 minutes ago
|
||||
mtusi-lab7-grafana-1 grafana/grafana:11.6.0 "/run.sh" grafana 4 hours ago Up 10 minutes 127.0.0.1:3447->3000/tcp
|
||||
mtusi-lab7-lb-1 haproxy:3.0.12-alpine "docker-entrypoint.s…" lb 4 hours ago Up 22 seconds 127.0.0.1:8443->8443/tcp
|
||||
mtusi-lab7-loki-1 grafana/loki:3.4.2 "/usr/bin/loki -conf…" loki 4 hours ago Up 10 minutes 3100/tcp
|
||||
mtusi-lab7-loki-tls-1 mtusi-messenger:lab7 "docker-entrypoint.s…" loki-tls About a minute ago Up About a minute
|
||||
mtusi-lab7-otel-collector-1 otel/opentelemetry-collector-contrib:0.123.0 "/otelcol-contrib --…" otel-collector 4 hours ago Up 10 minutes 4317-4318/tcp, 55678-55679/tcp
|
||||
mtusi-lab7-otel-collector-tls-1 mtusi-messenger:lab7 "docker-entrypoint.s…" otel-collector-tls About a minute ago Up About a minute
|
||||
mtusi-lab7-prometheus-1 prom/prometheus:v3.2.1 "/bin/prometheus --c…" prometheus 4 hours ago Up 10 minutes 9090/tcp
|
||||
mtusi-lab7-prometheus-tls-1 mtusi-messenger:lab7 "docker-entrypoint.s…" prometheus-tls About a minute ago Up About a minute
|
||||
mtusi-lab7-s3-1 sha256:39bcf0eb398f80970d6ef729706c065bfaaf82e904ba45b6959a7ba49ce12e52 "minio server /data …" s3 4 hours ago Up 10 minutes (healthy)
|
||||
mtusi-lab7-tempo-1 grafana/tempo:2.7.2 "/tempo -config.file…" tempo 4 hours ago Up 10 minutes
|
||||
mtusi-lab7-tempo-tls-1 mtusi-messenger:lab7 "docker-entrypoint.s…" tempo-tls About a minute ago Up About a minute
|
||||
mtusi-lab7-worker-1 mtusi-messenger:lab7 "docker-entrypoint.s…" worker About a minute ago Up About a minute
|
||||
@@ -0,0 +1 @@
|
||||
PASS: 21 assignment/contract/public test files byte-identical; trust-matrix.md filled as required.
|
||||
@@ -0,0 +1,519 @@
|
||||
{
|
||||
"auditReportVersion": 2,
|
||||
"vulnerabilities": {
|
||||
"@opentelemetry/core": {
|
||||
"name": "@opentelemetry/core",
|
||||
"severity": "moderate",
|
||||
"isDirect": false,
|
||||
"via": [
|
||||
{
|
||||
"source": 1153174,
|
||||
"name": "@opentelemetry/core",
|
||||
"dependency": "@opentelemetry/core",
|
||||
"title": "OpenTelemetry Core: Unbounded memory allocation in W3C Baggage propagation",
|
||||
"url": "https://github.com/advisories/GHSA-8988-4f7v-96qf",
|
||||
"severity": "moderate",
|
||||
"cwe": [
|
||||
"CWE-770"
|
||||
],
|
||||
"cvss": {
|
||||
"score": 5.3,
|
||||
"vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L"
|
||||
},
|
||||
"range": "<2.8.0"
|
||||
}
|
||||
],
|
||||
"effects": [
|
||||
"@opentelemetry/exporter-logs-otlp-proto",
|
||||
"@opentelemetry/exporter-metrics-otlp-http",
|
||||
"@opentelemetry/exporter-metrics-otlp-proto",
|
||||
"@opentelemetry/exporter-trace-otlp-proto",
|
||||
"@opentelemetry/otlp-exporter-base",
|
||||
"@opentelemetry/otlp-transformer",
|
||||
"@opentelemetry/propagator-b3",
|
||||
"@opentelemetry/propagator-jaeger",
|
||||
"@opentelemetry/resources",
|
||||
"@opentelemetry/sdk-logs",
|
||||
"@opentelemetry/sdk-metrics",
|
||||
"@opentelemetry/sdk-trace-base",
|
||||
"@opentelemetry/sdk-trace-node"
|
||||
],
|
||||
"range": "<2.8.0",
|
||||
"nodes": [
|
||||
"node_modules/@opentelemetry/core"
|
||||
],
|
||||
"fixAvailable": {
|
||||
"name": "@opentelemetry/exporter-logs-otlp-proto",
|
||||
"version": "0.301.2",
|
||||
"isSemVerMajor": true
|
||||
}
|
||||
},
|
||||
"@opentelemetry/exporter-logs-otlp-proto": {
|
||||
"name": "@opentelemetry/exporter-logs-otlp-proto",
|
||||
"severity": "moderate",
|
||||
"isDirect": true,
|
||||
"via": [
|
||||
"@opentelemetry/core",
|
||||
"@opentelemetry/otlp-exporter-base",
|
||||
"@opentelemetry/otlp-transformer",
|
||||
"@opentelemetry/resources",
|
||||
"@opentelemetry/sdk-logs",
|
||||
"@opentelemetry/sdk-trace-base"
|
||||
],
|
||||
"effects": [],
|
||||
"range": "<=0.218.0",
|
||||
"nodes": [
|
||||
"node_modules/@opentelemetry/exporter-logs-otlp-proto"
|
||||
],
|
||||
"fixAvailable": {
|
||||
"name": "@opentelemetry/exporter-logs-otlp-proto",
|
||||
"version": "0.301.2",
|
||||
"isSemVerMajor": true
|
||||
}
|
||||
},
|
||||
"@opentelemetry/exporter-metrics-otlp-http": {
|
||||
"name": "@opentelemetry/exporter-metrics-otlp-http",
|
||||
"severity": "moderate",
|
||||
"isDirect": false,
|
||||
"via": [
|
||||
"@opentelemetry/core",
|
||||
"@opentelemetry/otlp-exporter-base",
|
||||
"@opentelemetry/otlp-transformer",
|
||||
"@opentelemetry/resources",
|
||||
"@opentelemetry/sdk-metrics"
|
||||
],
|
||||
"effects": [],
|
||||
"range": "<=0.218.0",
|
||||
"nodes": [
|
||||
"node_modules/@opentelemetry/exporter-metrics-otlp-http"
|
||||
],
|
||||
"fixAvailable": true
|
||||
},
|
||||
"@opentelemetry/exporter-metrics-otlp-proto": {
|
||||
"name": "@opentelemetry/exporter-metrics-otlp-proto",
|
||||
"severity": "moderate",
|
||||
"isDirect": true,
|
||||
"via": [
|
||||
"@opentelemetry/core",
|
||||
"@opentelemetry/exporter-metrics-otlp-http",
|
||||
"@opentelemetry/otlp-exporter-base",
|
||||
"@opentelemetry/otlp-transformer",
|
||||
"@opentelemetry/resources",
|
||||
"@opentelemetry/sdk-metrics"
|
||||
],
|
||||
"effects": [],
|
||||
"range": "<=0.218.0",
|
||||
"nodes": [
|
||||
"node_modules/@opentelemetry/exporter-metrics-otlp-proto"
|
||||
],
|
||||
"fixAvailable": {
|
||||
"name": "@opentelemetry/exporter-metrics-otlp-proto",
|
||||
"version": "0.301.2",
|
||||
"isSemVerMajor": true
|
||||
}
|
||||
},
|
||||
"@opentelemetry/exporter-trace-otlp-proto": {
|
||||
"name": "@opentelemetry/exporter-trace-otlp-proto",
|
||||
"severity": "moderate",
|
||||
"isDirect": true,
|
||||
"via": [
|
||||
"@opentelemetry/core",
|
||||
"@opentelemetry/otlp-exporter-base",
|
||||
"@opentelemetry/otlp-transformer",
|
||||
"@opentelemetry/resources",
|
||||
"@opentelemetry/sdk-trace-base"
|
||||
],
|
||||
"effects": [],
|
||||
"range": "<=0.218.0",
|
||||
"nodes": [
|
||||
"node_modules/@opentelemetry/exporter-trace-otlp-proto"
|
||||
],
|
||||
"fixAvailable": {
|
||||
"name": "@opentelemetry/exporter-trace-otlp-proto",
|
||||
"version": "0.301.2",
|
||||
"isSemVerMajor": true
|
||||
}
|
||||
},
|
||||
"@opentelemetry/otlp-exporter-base": {
|
||||
"name": "@opentelemetry/otlp-exporter-base",
|
||||
"severity": "moderate",
|
||||
"isDirect": false,
|
||||
"via": [
|
||||
"@opentelemetry/core",
|
||||
"@opentelemetry/otlp-transformer"
|
||||
],
|
||||
"effects": [
|
||||
"@opentelemetry/exporter-metrics-otlp-http",
|
||||
"@opentelemetry/exporter-metrics-otlp-proto",
|
||||
"@opentelemetry/exporter-trace-otlp-proto"
|
||||
],
|
||||
"range": "<=0.218.0",
|
||||
"nodes": [
|
||||
"node_modules/@opentelemetry/otlp-exporter-base"
|
||||
],
|
||||
"fixAvailable": {
|
||||
"name": "@opentelemetry/exporter-trace-otlp-proto",
|
||||
"version": "0.301.2",
|
||||
"isSemVerMajor": true
|
||||
}
|
||||
},
|
||||
"@opentelemetry/otlp-transformer": {
|
||||
"name": "@opentelemetry/otlp-transformer",
|
||||
"severity": "moderate",
|
||||
"isDirect": false,
|
||||
"via": [
|
||||
"@opentelemetry/core",
|
||||
"@opentelemetry/resources",
|
||||
"@opentelemetry/sdk-logs",
|
||||
"@opentelemetry/sdk-metrics",
|
||||
"@opentelemetry/sdk-trace-base"
|
||||
],
|
||||
"effects": [
|
||||
"@opentelemetry/exporter-metrics-otlp-http",
|
||||
"@opentelemetry/exporter-metrics-otlp-proto",
|
||||
"@opentelemetry/exporter-trace-otlp-proto",
|
||||
"@opentelemetry/otlp-exporter-base"
|
||||
],
|
||||
"range": "<=0.218.0",
|
||||
"nodes": [
|
||||
"node_modules/@opentelemetry/otlp-transformer"
|
||||
],
|
||||
"fixAvailable": {
|
||||
"name": "@opentelemetry/exporter-metrics-otlp-proto",
|
||||
"version": "0.301.2",
|
||||
"isSemVerMajor": true
|
||||
}
|
||||
},
|
||||
"@opentelemetry/propagator-b3": {
|
||||
"name": "@opentelemetry/propagator-b3",
|
||||
"severity": "moderate",
|
||||
"isDirect": false,
|
||||
"via": [
|
||||
"@opentelemetry/core"
|
||||
],
|
||||
"effects": [],
|
||||
"range": "0.19.1-alpha.11 - 2.7.1",
|
||||
"nodes": [
|
||||
"node_modules/@opentelemetry/propagator-b3"
|
||||
],
|
||||
"fixAvailable": true
|
||||
},
|
||||
"@opentelemetry/propagator-jaeger": {
|
||||
"name": "@opentelemetry/propagator-jaeger",
|
||||
"severity": "high",
|
||||
"isDirect": false,
|
||||
"via": [
|
||||
"@opentelemetry/core",
|
||||
{
|
||||
"source": 1124011,
|
||||
"name": "@opentelemetry/propagator-jaeger",
|
||||
"dependency": "@opentelemetry/propagator-jaeger",
|
||||
"title": "OpenTelemetry JavaScript: Denial of service in `JaegerPropagator` via unhandled exception on a malformed header",
|
||||
"url": "https://github.com/advisories/GHSA-45rx-2jwx-cxfr",
|
||||
"severity": "high",
|
||||
"cwe": [
|
||||
"CWE-248"
|
||||
],
|
||||
"cvss": {
|
||||
"score": 7.5,
|
||||
"vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H"
|
||||
},
|
||||
"range": "<2.9.0"
|
||||
}
|
||||
],
|
||||
"effects": [
|
||||
"@opentelemetry/sdk-trace-node"
|
||||
],
|
||||
"range": "<=2.8.0",
|
||||
"nodes": [
|
||||
"node_modules/@opentelemetry/propagator-jaeger"
|
||||
],
|
||||
"fixAvailable": {
|
||||
"name": "@opentelemetry/sdk-trace-node",
|
||||
"version": "2.12.1",
|
||||
"isSemVerMajor": true
|
||||
}
|
||||
},
|
||||
"@opentelemetry/resources": {
|
||||
"name": "@opentelemetry/resources",
|
||||
"severity": "moderate",
|
||||
"isDirect": true,
|
||||
"via": [
|
||||
"@opentelemetry/core"
|
||||
],
|
||||
"effects": [],
|
||||
"range": "0.8.0 - 2.7.1",
|
||||
"nodes": [
|
||||
"node_modules/@opentelemetry/resources"
|
||||
],
|
||||
"fixAvailable": {
|
||||
"name": "@opentelemetry/resources",
|
||||
"version": "3.1.1",
|
||||
"isSemVerMajor": true
|
||||
}
|
||||
},
|
||||
"@opentelemetry/sdk-logs": {
|
||||
"name": "@opentelemetry/sdk-logs",
|
||||
"severity": "moderate",
|
||||
"isDirect": true,
|
||||
"via": [
|
||||
"@opentelemetry/core",
|
||||
"@opentelemetry/resources"
|
||||
],
|
||||
"effects": [
|
||||
"@opentelemetry/otlp-transformer"
|
||||
],
|
||||
"range": "<=0.218.0",
|
||||
"nodes": [
|
||||
"node_modules/@opentelemetry/sdk-logs"
|
||||
],
|
||||
"fixAvailable": {
|
||||
"name": "@opentelemetry/sdk-logs",
|
||||
"version": "3.1.1",
|
||||
"isSemVerMajor": true
|
||||
}
|
||||
},
|
||||
"@opentelemetry/sdk-metrics": {
|
||||
"name": "@opentelemetry/sdk-metrics",
|
||||
"severity": "moderate",
|
||||
"isDirect": true,
|
||||
"via": [
|
||||
"@opentelemetry/core",
|
||||
"@opentelemetry/resources"
|
||||
],
|
||||
"effects": [
|
||||
"@opentelemetry/exporter-metrics-otlp-http",
|
||||
"@opentelemetry/exporter-metrics-otlp-proto",
|
||||
"@opentelemetry/otlp-transformer"
|
||||
],
|
||||
"range": "<=2.7.1",
|
||||
"nodes": [
|
||||
"node_modules/@opentelemetry/sdk-metrics"
|
||||
],
|
||||
"fixAvailable": {
|
||||
"name": "@opentelemetry/sdk-metrics",
|
||||
"version": "3.1.1",
|
||||
"isSemVerMajor": true
|
||||
}
|
||||
},
|
||||
"@opentelemetry/sdk-trace-base": {
|
||||
"name": "@opentelemetry/sdk-trace-base",
|
||||
"severity": "moderate",
|
||||
"isDirect": true,
|
||||
"via": [
|
||||
"@opentelemetry/core",
|
||||
"@opentelemetry/resources"
|
||||
],
|
||||
"effects": [],
|
||||
"range": "<=2.7.1",
|
||||
"nodes": [
|
||||
"node_modules/@opentelemetry/sdk-trace-base"
|
||||
],
|
||||
"fixAvailable": {
|
||||
"name": "@opentelemetry/sdk-trace-base",
|
||||
"version": "2.12.1",
|
||||
"isSemVerMajor": true
|
||||
}
|
||||
},
|
||||
"@opentelemetry/sdk-trace-node": {
|
||||
"name": "@opentelemetry/sdk-trace-node",
|
||||
"severity": "high",
|
||||
"isDirect": true,
|
||||
"via": [
|
||||
"@opentelemetry/core",
|
||||
"@opentelemetry/propagator-b3",
|
||||
"@opentelemetry/propagator-jaeger",
|
||||
"@opentelemetry/sdk-trace-base"
|
||||
],
|
||||
"effects": [],
|
||||
"range": "<=2.7.1",
|
||||
"nodes": [
|
||||
"node_modules/@opentelemetry/sdk-trace-node"
|
||||
],
|
||||
"fixAvailable": {
|
||||
"name": "@opentelemetry/sdk-trace-node",
|
||||
"version": "2.12.1",
|
||||
"isSemVerMajor": true
|
||||
}
|
||||
},
|
||||
"decode-uri-component": {
|
||||
"name": "decode-uri-component",
|
||||
"severity": "high",
|
||||
"isDirect": false,
|
||||
"via": [
|
||||
{
|
||||
"source": 1147955,
|
||||
"name": "decode-uri-component",
|
||||
"dependency": "decode-uri-component",
|
||||
"title": "decode-uri-component: Denial of service via exponential decoding of malformed percent-encoded input",
|
||||
"url": "https://github.com/advisories/GHSA-vcc3-ghjq-m6fr",
|
||||
"severity": "moderate",
|
||||
"cwe": [
|
||||
"CWE-400",
|
||||
"CWE-405",
|
||||
"CWE-407",
|
||||
"CWE-1176"
|
||||
],
|
||||
"cvss": {
|
||||
"score": 0,
|
||||
"vectorString": null
|
||||
},
|
||||
"range": "<=0.4.2"
|
||||
},
|
||||
{
|
||||
"source": 1243857,
|
||||
"name": "decode-uri-component",
|
||||
"dependency": "decode-uri-component",
|
||||
"title": "decode-uri-component vulnerable to denial of service via quadratic replacement of percent-encoded runs",
|
||||
"url": "https://github.com/advisories/GHSA-qr28-fpjm-wq7f",
|
||||
"severity": "high",
|
||||
"cwe": [
|
||||
"CWE-400",
|
||||
"CWE-407"
|
||||
],
|
||||
"cvss": {
|
||||
"score": 0,
|
||||
"vectorString": null
|
||||
},
|
||||
"range": "<=0.5.0"
|
||||
}
|
||||
],
|
||||
"effects": [
|
||||
"query-string"
|
||||
],
|
||||
"range": "<=0.5.0",
|
||||
"nodes": [
|
||||
"node_modules/decode-uri-component"
|
||||
],
|
||||
"fixAvailable": {
|
||||
"name": "minio",
|
||||
"version": "7.1.3",
|
||||
"isSemVerMajor": true
|
||||
}
|
||||
},
|
||||
"minio": {
|
||||
"name": "minio",
|
||||
"severity": "high",
|
||||
"isDirect": true,
|
||||
"via": [
|
||||
"query-string",
|
||||
"stream-json"
|
||||
],
|
||||
"effects": [],
|
||||
"range": ">=7.0.30",
|
||||
"nodes": [
|
||||
"node_modules/minio"
|
||||
],
|
||||
"fixAvailable": {
|
||||
"name": "minio",
|
||||
"version": "7.1.3",
|
||||
"isSemVerMajor": true
|
||||
}
|
||||
},
|
||||
"query-string": {
|
||||
"name": "query-string",
|
||||
"severity": "high",
|
||||
"isDirect": false,
|
||||
"via": [
|
||||
"decode-uri-component"
|
||||
],
|
||||
"effects": [
|
||||
"minio"
|
||||
],
|
||||
"range": "5.0.0 - 9.4.1",
|
||||
"nodes": [
|
||||
"node_modules/query-string"
|
||||
],
|
||||
"fixAvailable": {
|
||||
"name": "minio",
|
||||
"version": "7.1.3",
|
||||
"isSemVerMajor": true
|
||||
}
|
||||
},
|
||||
"stream-json": {
|
||||
"name": "stream-json",
|
||||
"severity": "moderate",
|
||||
"isDirect": false,
|
||||
"via": [
|
||||
{
|
||||
"source": 1164823,
|
||||
"name": "stream-json",
|
||||
"dependency": "stream-json",
|
||||
"title": "stream-json: pick/ignore/filter/replace filters are O(depth²) on nested input — small crafted JSON blocks the event loop for seconds→minutes (DoS)",
|
||||
"url": "https://github.com/advisories/GHSA-528h-pc64-c93x",
|
||||
"severity": "moderate",
|
||||
"cwe": [
|
||||
"CWE-407"
|
||||
],
|
||||
"cvss": {
|
||||
"score": 6.2,
|
||||
"vectorString": "CVSS:3.1/AV:L/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H"
|
||||
},
|
||||
"range": "<=3.4.0"
|
||||
},
|
||||
{
|
||||
"source": 1241262,
|
||||
"name": "stream-json",
|
||||
"dependency": "stream-json",
|
||||
"title": "stream-json: JSONC parser and verifier re-scan the whole accumulated comment on every input chunk",
|
||||
"url": "https://github.com/advisories/GHSA-hqr4-qq8f-hg3x",
|
||||
"severity": "moderate",
|
||||
"cwe": [
|
||||
"CWE-407"
|
||||
],
|
||||
"cvss": {
|
||||
"score": 6.2,
|
||||
"vectorString": "CVSS:3.1/AV:L/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H"
|
||||
},
|
||||
"range": "<=3.5.0"
|
||||
},
|
||||
{
|
||||
"source": 1241263,
|
||||
"name": "stream-json",
|
||||
"dependency": "stream-json",
|
||||
"title": "stream-json has a prototype pollution issue: Assembler writes this.current[this.key] on plain objects",
|
||||
"url": "https://github.com/advisories/GHSA-mjw6-4jj6-33hc",
|
||||
"severity": "moderate",
|
||||
"cwe": [
|
||||
"CWE-1321"
|
||||
],
|
||||
"cvss": {
|
||||
"score": 5.1,
|
||||
"vectorString": "CVSS:3.1/AV:L/AC:L/PR:N/UI:N/S:U/C:N/I:L/A:L"
|
||||
},
|
||||
"range": "<3.6.0"
|
||||
}
|
||||
],
|
||||
"effects": [
|
||||
"minio"
|
||||
],
|
||||
"range": "<=3.5.0",
|
||||
"nodes": [
|
||||
"node_modules/stream-json"
|
||||
],
|
||||
"fixAvailable": {
|
||||
"name": "minio",
|
||||
"version": "7.1.3",
|
||||
"isSemVerMajor": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"metadata": {
|
||||
"vulnerabilities": {
|
||||
"info": 0,
|
||||
"low": 0,
|
||||
"moderate": 13,
|
||||
"high": 5,
|
||||
"critical": 0,
|
||||
"total": 18
|
||||
},
|
||||
"dependencies": {
|
||||
"prod": 89,
|
||||
"dev": 0,
|
||||
"optional": 47,
|
||||
"peer": 0,
|
||||
"peerOptional": 0,
|
||||
"total": 135
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
Docker=29.9.2; CPUs=12; MemTotalBytes=8259383296; OS=linux
|
||||
@@ -0,0 +1,3 @@
|
||||
Container mtusi-lab7-checks-run-a6844e7643e9 Creating
|
||||
Container mtusi-lab7-checks-run-a6844e7643e9 Created
|
||||
PASS: real SESSION_TTL_SECONDS=2: valid session returns 200, same token after 2.3 seconds returns 401; no credentials saved.
|
||||
@@ -0,0 +1 @@
|
||||
PASS: trusted HTTPS works; untrusted CA rejected. This does NOT verify internal mTLS, OpenBao or hardening.
|
||||
@@ -0,0 +1,3 @@
|
||||
Executing explicit failover hook; hook output suppressed to avoid leaking secrets.
|
||||
{"observed_instances_before": 2, "successful_writes": 8, "failed_attempts": 0, "first_recovery_seconds": 4.156}
|
||||
PASS: failover preserved confirmed data and existing session. Hook scope needs operator evidence.
|
||||
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"dashboard_uid": "messenger-lab7",
|
||||
"panel_count": 9,
|
||||
"datasources": {
|
||||
"prometheus": "verified HTTPS/mTLS query via Grafana",
|
||||
"loki": "verified HTTPS/mTLS query via Grafana",
|
||||
"tempo": "verified HTTPS/mTLS query via Grafana"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
PASS: authenticated Grafana HTTPS, nine provisioned panels, real queries through all three TLS/mTLS data sources.
|
||||
@@ -0,0 +1,243 @@
|
||||
[
|
||||
{
|
||||
"service": "api1",
|
||||
"user": "1000:1000",
|
||||
"memory_bytes": 536870912,
|
||||
"nano_cpus": 1500000000,
|
||||
"privileged": false,
|
||||
"published_ports": {},
|
||||
"cap_drop": [
|
||||
"ALL"
|
||||
],
|
||||
"security_opt": [
|
||||
"no-new-privileges:true"
|
||||
]
|
||||
},
|
||||
{
|
||||
"service": "api2",
|
||||
"user": "1000:1000",
|
||||
"memory_bytes": 536870912,
|
||||
"nano_cpus": 1500000000,
|
||||
"privileged": false,
|
||||
"published_ports": {},
|
||||
"cap_drop": [
|
||||
"ALL"
|
||||
],
|
||||
"security_opt": [
|
||||
"no-new-privileges:true"
|
||||
]
|
||||
},
|
||||
{
|
||||
"service": "bao",
|
||||
"user": "",
|
||||
"memory_bytes": 268435456,
|
||||
"nano_cpus": 1000000000,
|
||||
"privileged": false,
|
||||
"published_ports": {
|
||||
"8200/tcp": [
|
||||
{
|
||||
"HostIp": "127.0.0.1",
|
||||
"HostPort": "8207"
|
||||
}
|
||||
]
|
||||
},
|
||||
"cap_drop": [
|
||||
"ALL"
|
||||
],
|
||||
"security_opt": [
|
||||
"no-new-privileges:true"
|
||||
]
|
||||
},
|
||||
{
|
||||
"service": "broker",
|
||||
"user": "",
|
||||
"memory_bytes": 536870912,
|
||||
"nano_cpus": 1000000000,
|
||||
"privileged": false,
|
||||
"published_ports": {},
|
||||
"cap_drop": null,
|
||||
"security_opt": [
|
||||
"no-new-privileges:true"
|
||||
]
|
||||
},
|
||||
{
|
||||
"service": "db",
|
||||
"user": "",
|
||||
"memory_bytes": 536870912,
|
||||
"nano_cpus": 1000000000,
|
||||
"privileged": false,
|
||||
"published_ports": {},
|
||||
"cap_drop": null,
|
||||
"security_opt": [
|
||||
"no-new-privileges:true"
|
||||
]
|
||||
},
|
||||
{
|
||||
"service": "grafana",
|
||||
"user": "472",
|
||||
"memory_bytes": 402653184,
|
||||
"nano_cpus": 1000000000,
|
||||
"privileged": false,
|
||||
"published_ports": {
|
||||
"3000/tcp": [
|
||||
{
|
||||
"HostIp": "127.0.0.1",
|
||||
"HostPort": "3447"
|
||||
}
|
||||
]
|
||||
},
|
||||
"cap_drop": null,
|
||||
"security_opt": [
|
||||
"no-new-privileges:true"
|
||||
]
|
||||
},
|
||||
{
|
||||
"service": "lb",
|
||||
"user": "haproxy",
|
||||
"memory_bytes": 134217728,
|
||||
"nano_cpus": 1000000000,
|
||||
"privileged": false,
|
||||
"published_ports": {
|
||||
"8443/tcp": [
|
||||
{
|
||||
"HostIp": "127.0.0.1",
|
||||
"HostPort": "8443"
|
||||
}
|
||||
]
|
||||
},
|
||||
"cap_drop": null,
|
||||
"security_opt": [
|
||||
"no-new-privileges:true"
|
||||
]
|
||||
},
|
||||
{
|
||||
"service": "loki",
|
||||
"user": "10001",
|
||||
"memory_bytes": 268435456,
|
||||
"nano_cpus": 1000000000,
|
||||
"privileged": false,
|
||||
"published_ports": {},
|
||||
"cap_drop": null,
|
||||
"security_opt": [
|
||||
"no-new-privileges:true"
|
||||
]
|
||||
},
|
||||
{
|
||||
"service": "loki-tls",
|
||||
"user": "1000:1000",
|
||||
"memory_bytes": 100663296,
|
||||
"nano_cpus": 500000000,
|
||||
"privileged": false,
|
||||
"published_ports": {},
|
||||
"cap_drop": [
|
||||
"ALL"
|
||||
],
|
||||
"security_opt": [
|
||||
"no-new-privileges:true"
|
||||
]
|
||||
},
|
||||
{
|
||||
"service": "otel-collector",
|
||||
"user": "10001:10001",
|
||||
"memory_bytes": 268435456,
|
||||
"nano_cpus": 1000000000,
|
||||
"privileged": false,
|
||||
"published_ports": {},
|
||||
"cap_drop": null,
|
||||
"security_opt": [
|
||||
"no-new-privileges:true"
|
||||
]
|
||||
},
|
||||
{
|
||||
"service": "otel-collector-tls",
|
||||
"user": "1000:1000",
|
||||
"memory_bytes": 100663296,
|
||||
"nano_cpus": 500000000,
|
||||
"privileged": false,
|
||||
"published_ports": {},
|
||||
"cap_drop": [
|
||||
"ALL"
|
||||
],
|
||||
"security_opt": [
|
||||
"no-new-privileges:true"
|
||||
]
|
||||
},
|
||||
{
|
||||
"service": "prometheus",
|
||||
"user": "nobody",
|
||||
"memory_bytes": 268435456,
|
||||
"nano_cpus": 1000000000,
|
||||
"privileged": false,
|
||||
"published_ports": {},
|
||||
"cap_drop": null,
|
||||
"security_opt": [
|
||||
"no-new-privileges:true"
|
||||
]
|
||||
},
|
||||
{
|
||||
"service": "prometheus-tls",
|
||||
"user": "1000:1000",
|
||||
"memory_bytes": 100663296,
|
||||
"nano_cpus": 500000000,
|
||||
"privileged": false,
|
||||
"published_ports": {},
|
||||
"cap_drop": [
|
||||
"ALL"
|
||||
],
|
||||
"security_opt": [
|
||||
"no-new-privileges:true"
|
||||
]
|
||||
},
|
||||
{
|
||||
"service": "s3",
|
||||
"user": "",
|
||||
"memory_bytes": 805306368,
|
||||
"nano_cpus": 1000000000,
|
||||
"privileged": false,
|
||||
"published_ports": {},
|
||||
"cap_drop": null,
|
||||
"security_opt": [
|
||||
"no-new-privileges:true"
|
||||
]
|
||||
},
|
||||
{
|
||||
"service": "tempo",
|
||||
"user": "0:0",
|
||||
"memory_bytes": 268435456,
|
||||
"nano_cpus": 1000000000,
|
||||
"privileged": false,
|
||||
"published_ports": {},
|
||||
"cap_drop": null,
|
||||
"security_opt": [
|
||||
"no-new-privileges:true"
|
||||
]
|
||||
},
|
||||
{
|
||||
"service": "tempo-tls",
|
||||
"user": "1000:1000",
|
||||
"memory_bytes": 100663296,
|
||||
"nano_cpus": 500000000,
|
||||
"privileged": false,
|
||||
"published_ports": {},
|
||||
"cap_drop": [
|
||||
"ALL"
|
||||
],
|
||||
"security_opt": [
|
||||
"no-new-privileges:true"
|
||||
]
|
||||
},
|
||||
{
|
||||
"service": "worker",
|
||||
"user": "1000:1000",
|
||||
"memory_bytes": 536870912,
|
||||
"nano_cpus": 1500000000,
|
||||
"privileged": false,
|
||||
"published_ports": {},
|
||||
"cap_drop": [
|
||||
"ALL"
|
||||
],
|
||||
"security_opt": [
|
||||
"no-new-privileges:true"
|
||||
]
|
||||
}
|
||||
]
|
||||
@@ -0,0 +1 @@
|
||||
PASS: non-root API/worker, dropped capabilities, resource limits, no privileged/host-network/socket; only localhost TLS/admin ports exposed; app mounts contain only its leaf key/cert and public CA.
|
||||
@@ -0,0 +1,292 @@
|
||||
{
|
||||
"before": [
|
||||
{
|
||||
"service": "api1",
|
||||
"container": "2a54c22515569d495efd8948d0cfee266c8c26da433ba0a7c2abff6892718b5f",
|
||||
"started_at": "2026-11-27T17:00:12.058050917Z",
|
||||
"running": true,
|
||||
"volumes": []
|
||||
},
|
||||
{
|
||||
"service": "api2",
|
||||
"container": "4bf34fafc11e2279dfd06474749b3f61a6aea94fe9c373190a97b2e9e3e28b18",
|
||||
"started_at": "2026-11-27T17:00:11.883707467Z",
|
||||
"running": true,
|
||||
"volumes": []
|
||||
},
|
||||
{
|
||||
"service": "bao",
|
||||
"container": "653dfbe5cba2ad70a466be121479bff1f60049968e50c5eadc81781af2530d18",
|
||||
"started_at": "2026-11-27T16:58:48.001190077Z",
|
||||
"running": true,
|
||||
"volumes": [
|
||||
"mtusi-lab7_baodata",
|
||||
"a1bd035616157d71904e1112d23664c5bb230fc9772da52485c8874ce396fedd"
|
||||
]
|
||||
},
|
||||
{
|
||||
"service": "broker",
|
||||
"container": "42166c6c80c2e555d2e0076c88d5400e502ec730c297444dc6cc4ff4f16f3137",
|
||||
"started_at": "2026-11-27T16:57:27.983542869Z",
|
||||
"running": true,
|
||||
"volumes": [
|
||||
"mtusi-lab7_brokerdata"
|
||||
]
|
||||
},
|
||||
{
|
||||
"service": "db",
|
||||
"container": "45912bc71665b59062b296db22c271c8098a2b8bd088be2389849789ebaa50c4",
|
||||
"started_at": "2026-11-27T16:57:27.425335152Z",
|
||||
"running": true,
|
||||
"volumes": [
|
||||
"mtusi-lab7_pgdata"
|
||||
]
|
||||
},
|
||||
{
|
||||
"service": "expiry",
|
||||
"container": "5dc744efeecc2f47140a8950e83e2df101766f294c1eae0d5ac5ee7edb2e172a",
|
||||
"started_at": "2026-11-27T21:12:55.720353552Z",
|
||||
"running": false,
|
||||
"volumes": []
|
||||
},
|
||||
{
|
||||
"service": "grafana",
|
||||
"container": "172c9cbae7475eb71a1f8e3df2cdb32a8a7c1b50c371f6f90eb0cdbec9fcc768",
|
||||
"started_at": "2026-11-27T16:57:26.567241775Z",
|
||||
"running": true,
|
||||
"volumes": [
|
||||
"mtusi-lab7_grafanadata"
|
||||
]
|
||||
},
|
||||
{
|
||||
"service": "lb",
|
||||
"container": "613eaeb4c35be0d429f3cc97b7824b52b43d7d1b16b7e6100ec44021771dae47",
|
||||
"started_at": "2026-11-27T21:10:21.804192833Z",
|
||||
"running": true,
|
||||
"volumes": []
|
||||
},
|
||||
{
|
||||
"service": "loki",
|
||||
"container": "3bb8a762dd2d4ff84ff409be36ce7e8239f809dbddf9368031319d02c8ba70b8",
|
||||
"started_at": "2026-11-27T21:13:55.764335225Z",
|
||||
"running": true,
|
||||
"volumes": [
|
||||
"mtusi-lab7_lokidata"
|
||||
]
|
||||
},
|
||||
{
|
||||
"service": "loki-tls",
|
||||
"container": "c858e59cd1b3812604effe00911ac7228b44779ac7e96656cca1657637f5158d",
|
||||
"started_at": "2026-11-27T16:57:28.531516598Z",
|
||||
"running": true,
|
||||
"volumes": []
|
||||
},
|
||||
{
|
||||
"service": "otel-collector",
|
||||
"container": "6365ab19151844738a0b467fc724ec9206f3a08a1be458b8f0de74168b6c17bc",
|
||||
"started_at": "2026-11-27T16:57:26.82172655Z",
|
||||
"running": true,
|
||||
"volumes": []
|
||||
},
|
||||
{
|
||||
"service": "otel-collector-tls",
|
||||
"container": "d6cb48fee5990b85873edefdc9c6dbfc08d1ac2d52062b0f38ffe0586f1e87cd",
|
||||
"started_at": "2026-11-27T16:57:28.370678663Z",
|
||||
"running": true,
|
||||
"volumes": []
|
||||
},
|
||||
{
|
||||
"service": "prometheus",
|
||||
"container": "45df629fe73e4675aa9859766a9bd6438631b5cd18a2b36cff3d68ce41dbf5da",
|
||||
"started_at": "2026-11-27T16:57:28.175799936Z",
|
||||
"running": true,
|
||||
"volumes": [
|
||||
"mtusi-lab7_prometheusdata"
|
||||
]
|
||||
},
|
||||
{
|
||||
"service": "prometheus-tls",
|
||||
"container": "982f9001882b676f782eef41727434dc4d3df7e1ad993db9e60fc15d175a6544",
|
||||
"started_at": "2026-11-27T16:57:28.861320075Z",
|
||||
"running": true,
|
||||
"volumes": []
|
||||
},
|
||||
{
|
||||
"service": "s3",
|
||||
"container": "d15520346ffd8f2932e6806c6db8142355bd75defe344039559ad588e1e566a2",
|
||||
"started_at": "2026-11-27T16:57:27.788635753Z",
|
||||
"running": true,
|
||||
"volumes": [
|
||||
"mtusi-lab7_s3data"
|
||||
]
|
||||
},
|
||||
{
|
||||
"service": "tempo",
|
||||
"container": "9f52ec3c62ee9b21f036ba2f36b1d668a1d12d1e4529ee115c32e388f8153fe8",
|
||||
"started_at": "2026-11-27T16:57:27.619382116Z",
|
||||
"running": true,
|
||||
"volumes": [
|
||||
"mtusi-lab7_tempodata"
|
||||
]
|
||||
},
|
||||
{
|
||||
"service": "tempo-tls",
|
||||
"container": "b6ef0acbce31a8c5b78a96ef03483179970dbc825970528425120ced5e1ce1d8",
|
||||
"started_at": "2026-11-27T16:57:28.700811645Z",
|
||||
"running": true,
|
||||
"volumes": []
|
||||
},
|
||||
{
|
||||
"service": "worker",
|
||||
"container": "65fc3ca731e10c3227a341f04c5992f62e3d5c8a074e7e0f98e88916690f7aab",
|
||||
"started_at": "2026-11-27T17:00:11.704540629Z",
|
||||
"running": true,
|
||||
"volumes": []
|
||||
}
|
||||
],
|
||||
"after": [
|
||||
{
|
||||
"service": "api1",
|
||||
"container": "2a54c22515569d495efd8948d0cfee266c8c26da433ba0a7c2abff6892718b5f",
|
||||
"started_at": "2026-11-27T21:14:36.568392042Z",
|
||||
"running": true,
|
||||
"volumes": []
|
||||
},
|
||||
{
|
||||
"service": "api2",
|
||||
"container": "4bf34fafc11e2279dfd06474749b3f61a6aea94fe9c373190a97b2e9e3e28b18",
|
||||
"started_at": "2026-11-27T21:14:36.398994593Z",
|
||||
"running": true,
|
||||
"volumes": []
|
||||
},
|
||||
{
|
||||
"service": "bao",
|
||||
"container": "653dfbe5cba2ad70a466be121479bff1f60049968e50c5eadc81781af2530d18",
|
||||
"started_at": "2026-11-27T21:14:28.730396612Z",
|
||||
"running": true,
|
||||
"volumes": [
|
||||
"mtusi-lab7_baodata",
|
||||
"a1bd035616157d71904e1112d23664c5bb230fc9772da52485c8874ce396fedd"
|
||||
]
|
||||
},
|
||||
{
|
||||
"service": "broker",
|
||||
"container": "42166c6c80c2e555d2e0076c88d5400e502ec730c297444dc6cc4ff4f16f3137",
|
||||
"started_at": "2026-11-27T21:14:28.021779054Z",
|
||||
"running": true,
|
||||
"volumes": [
|
||||
"mtusi-lab7_brokerdata"
|
||||
]
|
||||
},
|
||||
{
|
||||
"service": "db",
|
||||
"container": "45912bc71665b59062b296db22c271c8098a2b8bd088be2389849789ebaa50c4",
|
||||
"started_at": "2026-11-27T21:14:27.481996309Z",
|
||||
"running": true,
|
||||
"volumes": [
|
||||
"mtusi-lab7_pgdata"
|
||||
]
|
||||
},
|
||||
{
|
||||
"service": "expiry",
|
||||
"container": "5dc744efeecc2f47140a8950e83e2df101766f294c1eae0d5ac5ee7edb2e172a",
|
||||
"started_at": "2026-11-27T21:12:55.720353552Z",
|
||||
"running": false,
|
||||
"volumes": []
|
||||
},
|
||||
{
|
||||
"service": "grafana",
|
||||
"container": "172c9cbae7475eb71a1f8e3df2cdb32a8a7c1b50c371f6f90eb0cdbec9fcc768",
|
||||
"started_at": "2026-11-27T21:14:27.82639627Z",
|
||||
"running": true,
|
||||
"volumes": [
|
||||
"mtusi-lab7_grafanadata"
|
||||
]
|
||||
},
|
||||
{
|
||||
"service": "lb",
|
||||
"container": "613eaeb4c35be0d429f3cc97b7824b52b43d7d1b16b7e6100ec44021771dae47",
|
||||
"started_at": "2026-11-27T21:14:41.263176509Z",
|
||||
"running": true,
|
||||
"volumes": []
|
||||
},
|
||||
{
|
||||
"service": "loki",
|
||||
"container": "3bb8a762dd2d4ff84ff409be36ce7e8239f809dbddf9368031319d02c8ba70b8",
|
||||
"started_at": "2026-11-27T21:14:28.381260114Z",
|
||||
"running": true,
|
||||
"volumes": [
|
||||
"mtusi-lab7_lokidata"
|
||||
]
|
||||
},
|
||||
{
|
||||
"service": "loki-tls",
|
||||
"container": "3dda793df790c75bc4121097b61562e7fda514116c54d580d832a1115fc570f6",
|
||||
"started_at": "2026-11-27T21:14:29.152549755Z",
|
||||
"running": true,
|
||||
"volumes": []
|
||||
},
|
||||
{
|
||||
"service": "otel-collector",
|
||||
"container": "6365ab19151844738a0b467fc724ec9206f3a08a1be458b8f0de74168b6c17bc",
|
||||
"started_at": "2026-11-27T21:14:28.55347193Z",
|
||||
"running": true,
|
||||
"volumes": []
|
||||
},
|
||||
{
|
||||
"service": "otel-collector-tls",
|
||||
"container": "eb8db97354953dcb28a2cf54a69f37606b2dc7408a879e87f0df7aa78feb62f6",
|
||||
"started_at": "2026-11-27T21:14:29.286175596Z",
|
||||
"running": true,
|
||||
"volumes": []
|
||||
},
|
||||
{
|
||||
"service": "prometheus",
|
||||
"container": "45df629fe73e4675aa9859766a9bd6438631b5cd18a2b36cff3d68ce41dbf5da",
|
||||
"started_at": "2026-11-27T21:14:27.647110901Z",
|
||||
"running": true,
|
||||
"volumes": [
|
||||
"mtusi-lab7_prometheusdata"
|
||||
]
|
||||
},
|
||||
{
|
||||
"service": "prometheus-tls",
|
||||
"container": "cb9c89929007424cf956991f47fdf838efedbe76ec1f180bf9f97da949685658",
|
||||
"started_at": "2026-11-27T21:14:28.91222163Z",
|
||||
"running": true,
|
||||
"volumes": []
|
||||
},
|
||||
{
|
||||
"service": "s3",
|
||||
"container": "d15520346ffd8f2932e6806c6db8142355bd75defe344039559ad588e1e566a2",
|
||||
"started_at": "2026-11-27T21:14:27.299850171Z",
|
||||
"running": true,
|
||||
"volumes": [
|
||||
"mtusi-lab7_s3data"
|
||||
]
|
||||
},
|
||||
{
|
||||
"service": "tempo",
|
||||
"container": "9f52ec3c62ee9b21f036ba2f36b1d668a1d12d1e4529ee115c32e388f8153fe8",
|
||||
"started_at": "2026-11-27T21:14:28.192105465Z",
|
||||
"running": true,
|
||||
"volumes": [
|
||||
"mtusi-lab7_tempodata"
|
||||
]
|
||||
},
|
||||
{
|
||||
"service": "tempo-tls",
|
||||
"container": "75df6e0176971e13405c37398927fbb010b5fe9c40bd21268306aeea56a5da51",
|
||||
"started_at": "2026-11-27T21:14:29.029763381Z",
|
||||
"running": true,
|
||||
"volumes": []
|
||||
},
|
||||
{
|
||||
"service": "worker",
|
||||
"container": "65fc3ca731e10c3227a341f04c5992f62e3d5c8a074e7e0f98e88916690f7aab",
|
||||
"started_at": "2026-11-27T21:14:36.756753975Z",
|
||||
"running": true,
|
||||
"volumes": []
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,292 @@
|
||||
{
|
||||
"before": [
|
||||
{
|
||||
"service": "api1",
|
||||
"container": "2a54c22515569d495efd8948d0cfee266c8c26da433ba0a7c2abff6892718b5f",
|
||||
"started_at": "2026-11-27T21:14:36.568392042Z",
|
||||
"running": false,
|
||||
"volumes": []
|
||||
},
|
||||
{
|
||||
"service": "api2",
|
||||
"container": "4bf34fafc11e2279dfd06474749b3f61a6aea94fe9c373190a97b2e9e3e28b18",
|
||||
"started_at": "2026-11-27T21:14:36.398994593Z",
|
||||
"running": true,
|
||||
"volumes": []
|
||||
},
|
||||
{
|
||||
"service": "bao",
|
||||
"container": "653dfbe5cba2ad70a466be121479bff1f60049968e50c5eadc81781af2530d18",
|
||||
"started_at": "2026-11-27T21:14:28.730396612Z",
|
||||
"running": true,
|
||||
"volumes": [
|
||||
"mtusi-lab7_baodata",
|
||||
"a1bd035616157d71904e1112d23664c5bb230fc9772da52485c8874ce396fedd"
|
||||
]
|
||||
},
|
||||
{
|
||||
"service": "broker",
|
||||
"container": "42166c6c80c2e555d2e0076c88d5400e502ec730c297444dc6cc4ff4f16f3137",
|
||||
"started_at": "2026-11-27T21:14:28.021779054Z",
|
||||
"running": true,
|
||||
"volumes": [
|
||||
"mtusi-lab7_brokerdata"
|
||||
]
|
||||
},
|
||||
{
|
||||
"service": "db",
|
||||
"container": "45912bc71665b59062b296db22c271c8098a2b8bd088be2389849789ebaa50c4",
|
||||
"started_at": "2026-11-27T21:14:27.481996309Z",
|
||||
"running": true,
|
||||
"volumes": [
|
||||
"mtusi-lab7_pgdata"
|
||||
]
|
||||
},
|
||||
{
|
||||
"service": "expiry",
|
||||
"container": "5dc744efeecc2f47140a8950e83e2df101766f294c1eae0d5ac5ee7edb2e172a",
|
||||
"started_at": "2026-11-27T21:12:55.720353552Z",
|
||||
"running": false,
|
||||
"volumes": []
|
||||
},
|
||||
{
|
||||
"service": "grafana",
|
||||
"container": "172c9cbae7475eb71a1f8e3df2cdb32a8a7c1b50c371f6f90eb0cdbec9fcc768",
|
||||
"started_at": "2026-11-27T21:14:27.82639627Z",
|
||||
"running": true,
|
||||
"volumes": [
|
||||
"mtusi-lab7_grafanadata"
|
||||
]
|
||||
},
|
||||
{
|
||||
"service": "lb",
|
||||
"container": "613eaeb4c35be0d429f3cc97b7824b52b43d7d1b16b7e6100ec44021771dae47",
|
||||
"started_at": "2026-11-27T21:14:41.263176509Z",
|
||||
"running": true,
|
||||
"volumes": []
|
||||
},
|
||||
{
|
||||
"service": "loki",
|
||||
"container": "3bb8a762dd2d4ff84ff409be36ce7e8239f809dbddf9368031319d02c8ba70b8",
|
||||
"started_at": "2026-11-27T21:14:28.381260114Z",
|
||||
"running": true,
|
||||
"volumes": [
|
||||
"mtusi-lab7_lokidata"
|
||||
]
|
||||
},
|
||||
{
|
||||
"service": "loki-tls",
|
||||
"container": "3dda793df790c75bc4121097b61562e7fda514116c54d580d832a1115fc570f6",
|
||||
"started_at": "2026-11-27T21:14:29.152549755Z",
|
||||
"running": true,
|
||||
"volumes": []
|
||||
},
|
||||
{
|
||||
"service": "otel-collector",
|
||||
"container": "6365ab19151844738a0b467fc724ec9206f3a08a1be458b8f0de74168b6c17bc",
|
||||
"started_at": "2026-11-27T21:14:28.55347193Z",
|
||||
"running": true,
|
||||
"volumes": []
|
||||
},
|
||||
{
|
||||
"service": "otel-collector-tls",
|
||||
"container": "eb8db97354953dcb28a2cf54a69f37606b2dc7408a879e87f0df7aa78feb62f6",
|
||||
"started_at": "2026-11-27T21:14:29.286175596Z",
|
||||
"running": true,
|
||||
"volumes": []
|
||||
},
|
||||
{
|
||||
"service": "prometheus",
|
||||
"container": "45df629fe73e4675aa9859766a9bd6438631b5cd18a2b36cff3d68ce41dbf5da",
|
||||
"started_at": "2026-11-27T21:14:27.647110901Z",
|
||||
"running": true,
|
||||
"volumes": [
|
||||
"mtusi-lab7_prometheusdata"
|
||||
]
|
||||
},
|
||||
{
|
||||
"service": "prometheus-tls",
|
||||
"container": "cb9c89929007424cf956991f47fdf838efedbe76ec1f180bf9f97da949685658",
|
||||
"started_at": "2026-11-27T21:14:28.91222163Z",
|
||||
"running": true,
|
||||
"volumes": []
|
||||
},
|
||||
{
|
||||
"service": "s3",
|
||||
"container": "d15520346ffd8f2932e6806c6db8142355bd75defe344039559ad588e1e566a2",
|
||||
"started_at": "2026-11-27T21:14:27.299850171Z",
|
||||
"running": true,
|
||||
"volumes": [
|
||||
"mtusi-lab7_s3data"
|
||||
]
|
||||
},
|
||||
{
|
||||
"service": "tempo",
|
||||
"container": "9f52ec3c62ee9b21f036ba2f36b1d668a1d12d1e4529ee115c32e388f8153fe8",
|
||||
"started_at": "2026-11-27T21:14:28.192105465Z",
|
||||
"running": true,
|
||||
"volumes": [
|
||||
"mtusi-lab7_tempodata"
|
||||
]
|
||||
},
|
||||
{
|
||||
"service": "tempo-tls",
|
||||
"container": "75df6e0176971e13405c37398927fbb010b5fe9c40bd21268306aeea56a5da51",
|
||||
"started_at": "2026-11-27T21:14:29.029763381Z",
|
||||
"running": true,
|
||||
"volumes": []
|
||||
},
|
||||
{
|
||||
"service": "worker",
|
||||
"container": "65fc3ca731e10c3227a341f04c5992f62e3d5c8a074e7e0f98e88916690f7aab",
|
||||
"started_at": "2026-11-27T21:14:36.756753975Z",
|
||||
"running": true,
|
||||
"volumes": []
|
||||
}
|
||||
],
|
||||
"after": [
|
||||
{
|
||||
"service": "api1",
|
||||
"container": "2a54c22515569d495efd8948d0cfee266c8c26da433ba0a7c2abff6892718b5f",
|
||||
"started_at": "2026-11-27T21:17:01.777729222Z",
|
||||
"running": true,
|
||||
"volumes": []
|
||||
},
|
||||
{
|
||||
"service": "api2",
|
||||
"container": "4bf34fafc11e2279dfd06474749b3f61a6aea94fe9c373190a97b2e9e3e28b18",
|
||||
"started_at": "2026-11-27T21:14:36.398994593Z",
|
||||
"running": true,
|
||||
"volumes": []
|
||||
},
|
||||
{
|
||||
"service": "bao",
|
||||
"container": "653dfbe5cba2ad70a466be121479bff1f60049968e50c5eadc81781af2530d18",
|
||||
"started_at": "2026-11-27T21:14:28.730396612Z",
|
||||
"running": true,
|
||||
"volumes": [
|
||||
"mtusi-lab7_baodata",
|
||||
"a1bd035616157d71904e1112d23664c5bb230fc9772da52485c8874ce396fedd"
|
||||
]
|
||||
},
|
||||
{
|
||||
"service": "broker",
|
||||
"container": "42166c6c80c2e555d2e0076c88d5400e502ec730c297444dc6cc4ff4f16f3137",
|
||||
"started_at": "2026-11-27T21:14:28.021779054Z",
|
||||
"running": true,
|
||||
"volumes": [
|
||||
"mtusi-lab7_brokerdata"
|
||||
]
|
||||
},
|
||||
{
|
||||
"service": "db",
|
||||
"container": "45912bc71665b59062b296db22c271c8098a2b8bd088be2389849789ebaa50c4",
|
||||
"started_at": "2026-11-27T21:14:27.481996309Z",
|
||||
"running": true,
|
||||
"volumes": [
|
||||
"mtusi-lab7_pgdata"
|
||||
]
|
||||
},
|
||||
{
|
||||
"service": "expiry",
|
||||
"container": "5dc744efeecc2f47140a8950e83e2df101766f294c1eae0d5ac5ee7edb2e172a",
|
||||
"started_at": "2026-11-27T21:12:55.720353552Z",
|
||||
"running": false,
|
||||
"volumes": []
|
||||
},
|
||||
{
|
||||
"service": "grafana",
|
||||
"container": "172c9cbae7475eb71a1f8e3df2cdb32a8a7c1b50c371f6f90eb0cdbec9fcc768",
|
||||
"started_at": "2026-11-27T21:14:27.82639627Z",
|
||||
"running": true,
|
||||
"volumes": [
|
||||
"mtusi-lab7_grafanadata"
|
||||
]
|
||||
},
|
||||
{
|
||||
"service": "lb",
|
||||
"container": "613eaeb4c35be0d429f3cc97b7824b52b43d7d1b16b7e6100ec44021771dae47",
|
||||
"started_at": "2026-11-27T21:14:41.263176509Z",
|
||||
"running": true,
|
||||
"volumes": []
|
||||
},
|
||||
{
|
||||
"service": "loki",
|
||||
"container": "3bb8a762dd2d4ff84ff409be36ce7e8239f809dbddf9368031319d02c8ba70b8",
|
||||
"started_at": "2026-11-27T21:14:28.381260114Z",
|
||||
"running": true,
|
||||
"volumes": [
|
||||
"mtusi-lab7_lokidata"
|
||||
]
|
||||
},
|
||||
{
|
||||
"service": "loki-tls",
|
||||
"container": "3dda793df790c75bc4121097b61562e7fda514116c54d580d832a1115fc570f6",
|
||||
"started_at": "2026-11-27T21:14:29.152549755Z",
|
||||
"running": true,
|
||||
"volumes": []
|
||||
},
|
||||
{
|
||||
"service": "otel-collector",
|
||||
"container": "6365ab19151844738a0b467fc724ec9206f3a08a1be458b8f0de74168b6c17bc",
|
||||
"started_at": "2026-11-27T21:14:28.55347193Z",
|
||||
"running": true,
|
||||
"volumes": []
|
||||
},
|
||||
{
|
||||
"service": "otel-collector-tls",
|
||||
"container": "eb8db97354953dcb28a2cf54a69f37606b2dc7408a879e87f0df7aa78feb62f6",
|
||||
"started_at": "2026-11-27T21:14:29.286175596Z",
|
||||
"running": true,
|
||||
"volumes": []
|
||||
},
|
||||
{
|
||||
"service": "prometheus",
|
||||
"container": "45df629fe73e4675aa9859766a9bd6438631b5cd18a2b36cff3d68ce41dbf5da",
|
||||
"started_at": "2026-11-27T21:14:27.647110901Z",
|
||||
"running": true,
|
||||
"volumes": [
|
||||
"mtusi-lab7_prometheusdata"
|
||||
]
|
||||
},
|
||||
{
|
||||
"service": "prometheus-tls",
|
||||
"container": "cb9c89929007424cf956991f47fdf838efedbe76ec1f180bf9f97da949685658",
|
||||
"started_at": "2026-11-27T21:14:28.91222163Z",
|
||||
"running": true,
|
||||
"volumes": []
|
||||
},
|
||||
{
|
||||
"service": "s3",
|
||||
"container": "d15520346ffd8f2932e6806c6db8142355bd75defe344039559ad588e1e566a2",
|
||||
"started_at": "2026-11-27T21:14:27.299850171Z",
|
||||
"running": true,
|
||||
"volumes": [
|
||||
"mtusi-lab7_s3data"
|
||||
]
|
||||
},
|
||||
{
|
||||
"service": "tempo",
|
||||
"container": "9f52ec3c62ee9b21f036ba2f36b1d668a1d12d1e4529ee115c32e388f8153fe8",
|
||||
"started_at": "2026-11-27T21:14:28.192105465Z",
|
||||
"running": true,
|
||||
"volumes": [
|
||||
"mtusi-lab7_tempodata"
|
||||
]
|
||||
},
|
||||
{
|
||||
"service": "tempo-tls",
|
||||
"container": "75df6e0176971e13405c37398927fbb010b5fe9c40bd21268306aeea56a5da51",
|
||||
"started_at": "2026-11-27T21:14:29.029763381Z",
|
||||
"running": true,
|
||||
"volumes": []
|
||||
},
|
||||
{
|
||||
"service": "worker",
|
||||
"container": "65fc3ca731e10c3227a341f04c5992f62e3d5c8a074e7e0f98e88916690f7aab",
|
||||
"started_at": "2026-11-27T21:14:36.756753975Z",
|
||||
"running": true,
|
||||
"volumes": []
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,292 @@
|
||||
{
|
||||
"before": [
|
||||
{
|
||||
"service": "api1",
|
||||
"container": "2a54c22515569d495efd8948d0cfee266c8c26da433ba0a7c2abff6892718b5f",
|
||||
"started_at": "2026-11-27T21:14:36.568392042Z",
|
||||
"running": true,
|
||||
"volumes": []
|
||||
},
|
||||
{
|
||||
"service": "api2",
|
||||
"container": "4bf34fafc11e2279dfd06474749b3f61a6aea94fe9c373190a97b2e9e3e28b18",
|
||||
"started_at": "2026-11-27T21:14:36.398994593Z",
|
||||
"running": true,
|
||||
"volumes": []
|
||||
},
|
||||
{
|
||||
"service": "bao",
|
||||
"container": "653dfbe5cba2ad70a466be121479bff1f60049968e50c5eadc81781af2530d18",
|
||||
"started_at": "2026-11-27T21:14:28.730396612Z",
|
||||
"running": true,
|
||||
"volumes": [
|
||||
"mtusi-lab7_baodata",
|
||||
"a1bd035616157d71904e1112d23664c5bb230fc9772da52485c8874ce396fedd"
|
||||
]
|
||||
},
|
||||
{
|
||||
"service": "broker",
|
||||
"container": "42166c6c80c2e555d2e0076c88d5400e502ec730c297444dc6cc4ff4f16f3137",
|
||||
"started_at": "2026-11-27T21:14:28.021779054Z",
|
||||
"running": true,
|
||||
"volumes": [
|
||||
"mtusi-lab7_brokerdata"
|
||||
]
|
||||
},
|
||||
{
|
||||
"service": "db",
|
||||
"container": "45912bc71665b59062b296db22c271c8098a2b8bd088be2389849789ebaa50c4",
|
||||
"started_at": "2026-11-27T21:14:27.481996309Z",
|
||||
"running": true,
|
||||
"volumes": [
|
||||
"mtusi-lab7_pgdata"
|
||||
]
|
||||
},
|
||||
{
|
||||
"service": "expiry",
|
||||
"container": "5dc744efeecc2f47140a8950e83e2df101766f294c1eae0d5ac5ee7edb2e172a",
|
||||
"started_at": "2026-11-27T21:12:55.720353552Z",
|
||||
"running": false,
|
||||
"volumes": []
|
||||
},
|
||||
{
|
||||
"service": "grafana",
|
||||
"container": "172c9cbae7475eb71a1f8e3df2cdb32a8a7c1b50c371f6f90eb0cdbec9fcc768",
|
||||
"started_at": "2026-11-27T21:14:27.82639627Z",
|
||||
"running": true,
|
||||
"volumes": [
|
||||
"mtusi-lab7_grafanadata"
|
||||
]
|
||||
},
|
||||
{
|
||||
"service": "lb",
|
||||
"container": "613eaeb4c35be0d429f3cc97b7824b52b43d7d1b16b7e6100ec44021771dae47",
|
||||
"started_at": "2026-11-27T21:14:41.263176509Z",
|
||||
"running": true,
|
||||
"volumes": []
|
||||
},
|
||||
{
|
||||
"service": "loki",
|
||||
"container": "3bb8a762dd2d4ff84ff409be36ce7e8239f809dbddf9368031319d02c8ba70b8",
|
||||
"started_at": "2026-11-27T21:14:28.381260114Z",
|
||||
"running": true,
|
||||
"volumes": [
|
||||
"mtusi-lab7_lokidata"
|
||||
]
|
||||
},
|
||||
{
|
||||
"service": "loki-tls",
|
||||
"container": "3dda793df790c75bc4121097b61562e7fda514116c54d580d832a1115fc570f6",
|
||||
"started_at": "2026-11-27T21:14:29.152549755Z",
|
||||
"running": true,
|
||||
"volumes": []
|
||||
},
|
||||
{
|
||||
"service": "otel-collector",
|
||||
"container": "6365ab19151844738a0b467fc724ec9206f3a08a1be458b8f0de74168b6c17bc",
|
||||
"started_at": "2026-11-27T21:14:28.55347193Z",
|
||||
"running": true,
|
||||
"volumes": []
|
||||
},
|
||||
{
|
||||
"service": "otel-collector-tls",
|
||||
"container": "eb8db97354953dcb28a2cf54a69f37606b2dc7408a879e87f0df7aa78feb62f6",
|
||||
"started_at": "2026-11-27T21:14:29.286175596Z",
|
||||
"running": true,
|
||||
"volumes": []
|
||||
},
|
||||
{
|
||||
"service": "prometheus",
|
||||
"container": "45df629fe73e4675aa9859766a9bd6438631b5cd18a2b36cff3d68ce41dbf5da",
|
||||
"started_at": "2026-11-27T21:14:27.647110901Z",
|
||||
"running": true,
|
||||
"volumes": [
|
||||
"mtusi-lab7_prometheusdata"
|
||||
]
|
||||
},
|
||||
{
|
||||
"service": "prometheus-tls",
|
||||
"container": "cb9c89929007424cf956991f47fdf838efedbe76ec1f180bf9f97da949685658",
|
||||
"started_at": "2026-11-27T21:14:28.91222163Z",
|
||||
"running": true,
|
||||
"volumes": []
|
||||
},
|
||||
{
|
||||
"service": "s3",
|
||||
"container": "d15520346ffd8f2932e6806c6db8142355bd75defe344039559ad588e1e566a2",
|
||||
"started_at": "2026-11-27T21:14:27.299850171Z",
|
||||
"running": true,
|
||||
"volumes": [
|
||||
"mtusi-lab7_s3data"
|
||||
]
|
||||
},
|
||||
{
|
||||
"service": "tempo",
|
||||
"container": "9f52ec3c62ee9b21f036ba2f36b1d668a1d12d1e4529ee115c32e388f8153fe8",
|
||||
"started_at": "2026-11-27T21:14:28.192105465Z",
|
||||
"running": true,
|
||||
"volumes": [
|
||||
"mtusi-lab7_tempodata"
|
||||
]
|
||||
},
|
||||
{
|
||||
"service": "tempo-tls",
|
||||
"container": "75df6e0176971e13405c37398927fbb010b5fe9c40bd21268306aeea56a5da51",
|
||||
"started_at": "2026-11-27T21:14:29.029763381Z",
|
||||
"running": true,
|
||||
"volumes": []
|
||||
},
|
||||
{
|
||||
"service": "worker",
|
||||
"container": "65fc3ca731e10c3227a341f04c5992f62e3d5c8a074e7e0f98e88916690f7aab",
|
||||
"started_at": "2026-11-27T21:14:36.756753975Z",
|
||||
"running": true,
|
||||
"volumes": []
|
||||
}
|
||||
],
|
||||
"after": [
|
||||
{
|
||||
"service": "api1",
|
||||
"container": "2a54c22515569d495efd8948d0cfee266c8c26da433ba0a7c2abff6892718b5f",
|
||||
"started_at": "2026-11-27T21:14:36.568392042Z",
|
||||
"running": false,
|
||||
"volumes": []
|
||||
},
|
||||
{
|
||||
"service": "api2",
|
||||
"container": "4bf34fafc11e2279dfd06474749b3f61a6aea94fe9c373190a97b2e9e3e28b18",
|
||||
"started_at": "2026-11-27T21:14:36.398994593Z",
|
||||
"running": true,
|
||||
"volumes": []
|
||||
},
|
||||
{
|
||||
"service": "bao",
|
||||
"container": "653dfbe5cba2ad70a466be121479bff1f60049968e50c5eadc81781af2530d18",
|
||||
"started_at": "2026-11-27T21:14:28.730396612Z",
|
||||
"running": true,
|
||||
"volumes": [
|
||||
"mtusi-lab7_baodata",
|
||||
"a1bd035616157d71904e1112d23664c5bb230fc9772da52485c8874ce396fedd"
|
||||
]
|
||||
},
|
||||
{
|
||||
"service": "broker",
|
||||
"container": "42166c6c80c2e555d2e0076c88d5400e502ec730c297444dc6cc4ff4f16f3137",
|
||||
"started_at": "2026-11-27T21:14:28.021779054Z",
|
||||
"running": true,
|
||||
"volumes": [
|
||||
"mtusi-lab7_brokerdata"
|
||||
]
|
||||
},
|
||||
{
|
||||
"service": "db",
|
||||
"container": "45912bc71665b59062b296db22c271c8098a2b8bd088be2389849789ebaa50c4",
|
||||
"started_at": "2026-11-27T21:14:27.481996309Z",
|
||||
"running": true,
|
||||
"volumes": [
|
||||
"mtusi-lab7_pgdata"
|
||||
]
|
||||
},
|
||||
{
|
||||
"service": "expiry",
|
||||
"container": "5dc744efeecc2f47140a8950e83e2df101766f294c1eae0d5ac5ee7edb2e172a",
|
||||
"started_at": "2026-11-27T21:12:55.720353552Z",
|
||||
"running": false,
|
||||
"volumes": []
|
||||
},
|
||||
{
|
||||
"service": "grafana",
|
||||
"container": "172c9cbae7475eb71a1f8e3df2cdb32a8a7c1b50c371f6f90eb0cdbec9fcc768",
|
||||
"started_at": "2026-11-27T21:14:27.82639627Z",
|
||||
"running": true,
|
||||
"volumes": [
|
||||
"mtusi-lab7_grafanadata"
|
||||
]
|
||||
},
|
||||
{
|
||||
"service": "lb",
|
||||
"container": "613eaeb4c35be0d429f3cc97b7824b52b43d7d1b16b7e6100ec44021771dae47",
|
||||
"started_at": "2026-11-27T21:14:41.263176509Z",
|
||||
"running": true,
|
||||
"volumes": []
|
||||
},
|
||||
{
|
||||
"service": "loki",
|
||||
"container": "3bb8a762dd2d4ff84ff409be36ce7e8239f809dbddf9368031319d02c8ba70b8",
|
||||
"started_at": "2026-11-27T21:14:28.381260114Z",
|
||||
"running": true,
|
||||
"volumes": [
|
||||
"mtusi-lab7_lokidata"
|
||||
]
|
||||
},
|
||||
{
|
||||
"service": "loki-tls",
|
||||
"container": "3dda793df790c75bc4121097b61562e7fda514116c54d580d832a1115fc570f6",
|
||||
"started_at": "2026-11-27T21:14:29.152549755Z",
|
||||
"running": true,
|
||||
"volumes": []
|
||||
},
|
||||
{
|
||||
"service": "otel-collector",
|
||||
"container": "6365ab19151844738a0b467fc724ec9206f3a08a1be458b8f0de74168b6c17bc",
|
||||
"started_at": "2026-11-27T21:14:28.55347193Z",
|
||||
"running": true,
|
||||
"volumes": []
|
||||
},
|
||||
{
|
||||
"service": "otel-collector-tls",
|
||||
"container": "eb8db97354953dcb28a2cf54a69f37606b2dc7408a879e87f0df7aa78feb62f6",
|
||||
"started_at": "2026-11-27T21:14:29.286175596Z",
|
||||
"running": true,
|
||||
"volumes": []
|
||||
},
|
||||
{
|
||||
"service": "prometheus",
|
||||
"container": "45df629fe73e4675aa9859766a9bd6438631b5cd18a2b36cff3d68ce41dbf5da",
|
||||
"started_at": "2026-11-27T21:14:27.647110901Z",
|
||||
"running": true,
|
||||
"volumes": [
|
||||
"mtusi-lab7_prometheusdata"
|
||||
]
|
||||
},
|
||||
{
|
||||
"service": "prometheus-tls",
|
||||
"container": "cb9c89929007424cf956991f47fdf838efedbe76ec1f180bf9f97da949685658",
|
||||
"started_at": "2026-11-27T21:14:28.91222163Z",
|
||||
"running": true,
|
||||
"volumes": []
|
||||
},
|
||||
{
|
||||
"service": "s3",
|
||||
"container": "d15520346ffd8f2932e6806c6db8142355bd75defe344039559ad588e1e566a2",
|
||||
"started_at": "2026-11-27T21:14:27.299850171Z",
|
||||
"running": true,
|
||||
"volumes": [
|
||||
"mtusi-lab7_s3data"
|
||||
]
|
||||
},
|
||||
{
|
||||
"service": "tempo",
|
||||
"container": "9f52ec3c62ee9b21f036ba2f36b1d668a1d12d1e4529ee115c32e388f8153fe8",
|
||||
"started_at": "2026-11-27T21:14:28.192105465Z",
|
||||
"running": true,
|
||||
"volumes": [
|
||||
"mtusi-lab7_tempodata"
|
||||
]
|
||||
},
|
||||
{
|
||||
"service": "tempo-tls",
|
||||
"container": "75df6e0176971e13405c37398927fbb010b5fe9c40bd21268306aeea56a5da51",
|
||||
"started_at": "2026-11-27T21:14:29.029763381Z",
|
||||
"running": true,
|
||||
"volumes": []
|
||||
},
|
||||
{
|
||||
"service": "worker",
|
||||
"container": "65fc3ca731e10c3227a341f04c5992f62e3d5c8a074e7e0f98e88916690f7aab",
|
||||
"started_at": "2026-11-27T21:14:36.756753975Z",
|
||||
"running": true,
|
||||
"volumes": []
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
Container mtusi-lab7-checks-run-910fc7b11a41 Creating
|
||||
Container mtusi-lab7-checks-run-910fc7b11a41 Created
|
||||
PASS: native plaintext telemetry/health ports cannot be reached across Docker network; only loopback within proxy boundary.
|
||||
@@ -0,0 +1,2 @@
|
||||
Executing explicit persistence hook; hook output suppressed to avoid leaking secrets.
|
||||
PASS: persistence preserved confirmed data and existing session. Hook scope needs operator evidence.
|
||||
@@ -0,0 +1,403 @@
|
||||
PASS: local certificates and bootstrap material ready; secret values not printed.
|
||||
Image mtusi-messenger:lab7 Building
|
||||
Image mtusi-messenger:lab7 Building
|
||||
Image mtusi-messenger:lab7 Building
|
||||
Image mtusi-messenger:lab7 Building
|
||||
Image mtusi-messenger:lab7 Building
|
||||
Image mtusi-mc:2025-04-16 Building
|
||||
Image mtusi-messenger:lab7 Building
|
||||
Image mtusi-messenger:lab7 Building
|
||||
Image mtusi-messenger:lab7 Building
|
||||
Image mtusi-minio:RELEASE.2025-04-22T22-12-26Z Building
|
||||
#1 [internal] load local bake definitions
|
||||
#1 reading from stdin 5.83kB 0.0s done
|
||||
#1 DONE 0.0s
|
||||
|
||||
#2 [loki-tls internal] load build definition from Dockerfile
|
||||
#2 transferring dockerfile: 250B 0.0s done
|
||||
#2 DONE 0.0s
|
||||
|
||||
#3 [s3 internal] load build definition from Dockerfile.s3
|
||||
#3 transferring dockerfile: 596B 0.0s done
|
||||
#3 DONE 0.0s
|
||||
|
||||
#4 [s3-init internal] load build definition from Dockerfile.mc
|
||||
#4 transferring dockerfile: 577B done
|
||||
#4 DONE 0.1s
|
||||
|
||||
#5 [prometheus-tls internal] load metadata for docker.io/library/node:22.20.0-alpine
|
||||
#5 ...
|
||||
|
||||
#6 [s3-init internal] load metadata for docker.io/library/alpine:3.22.1
|
||||
#6 ...
|
||||
|
||||
#7 [s3-init internal] load metadata for docker.io/library/golang:1.24.3-alpine
|
||||
#7 ...
|
||||
|
||||
#8 [auth] library/alpine:pull token for registry-1.docker.io
|
||||
#8 DONE 0.0s
|
||||
|
||||
#9 [auth] library/node:pull token for registry-1.docker.io
|
||||
#9 DONE 0.0s
|
||||
|
||||
#10 [auth] library/golang:pull token for registry-1.docker.io
|
||||
#10 DONE 0.0s
|
||||
|
||||
#5 [prometheus-tls internal] load metadata for docker.io/library/node:22.20.0-alpine
|
||||
#5 ...
|
||||
|
||||
#6 [s3 internal] load metadata for docker.io/library/alpine:3.22.1
|
||||
#6 DONE 12.3s
|
||||
|
||||
#7 [s3 internal] load metadata for docker.io/library/golang:1.24.3-alpine
|
||||
#7 DONE 12.3s
|
||||
|
||||
#5 [tempo-tls internal] load metadata for docker.io/library/node:22.20.0-alpine
|
||||
#5 DONE 12.3s
|
||||
|
||||
#11 [prometheus-tls internal] load .dockerignore
|
||||
#11 transferring context: 196B done
|
||||
#11 DONE 0.0s
|
||||
|
||||
#12 [loki-tls internal] load build context
|
||||
#12 transferring context: 70.67kB 0.0s done
|
||||
#12 DONE 0.0s
|
||||
|
||||
#13 [s3 stage-1 1/3] FROM docker.io/library/alpine:3.22.1@sha256:4bcff63911fcb4448bd4fdacec207030997caf25e9bea4045fa6c8c44de311d1
|
||||
#13 resolve docker.io/library/alpine:3.22.1@sha256:4bcff63911fcb4448bd4fdacec207030997caf25e9bea4045fa6c8c44de311d1 0.1s done
|
||||
#13 DONE 0.1s
|
||||
|
||||
#14 [s3-init build 1/5] FROM docker.io/library/golang:1.24.3-alpine@sha256:b4f875e650466fa0fe62c6fd3f02517a392123eea85f1d7e69d85f780e4db1c1
|
||||
#14 resolve docker.io/library/golang:1.24.3-alpine@sha256:b4f875e650466fa0fe62c6fd3f02517a392123eea85f1d7e69d85f780e4db1c1 0.1s done
|
||||
#14 DONE 0.1s
|
||||
|
||||
#15 [migrate 1/6] FROM docker.io/library/node:22.20.0-alpine@sha256:dbcedd8aeab47fbc0f4dd4bffa55b7c3c729a707875968d467aaaea42d6225af
|
||||
#15 resolve docker.io/library/node:22.20.0-alpine@sha256:dbcedd8aeab47fbc0f4dd4bffa55b7c3c729a707875968d467aaaea42d6225af 0.1s done
|
||||
#15 DONE 0.1s
|
||||
|
||||
#16 [s3-init build 5/5] RUN --mount=type=cache,target=/go/pkg/mod --mount=type=cache,target=/root/.cache/go-build for attempt in 1 2 3 4 5; do CGO_ENABLED=0 go build -trimpath -o /mc . && exit 0; done; exit 1
|
||||
#16 CACHED
|
||||
|
||||
#17 [s3-init stage-1 2/3] RUN apk add --no-cache ca-certificates curl
|
||||
#17 CACHED
|
||||
|
||||
#18 [s3-init build 3/5] RUN git clone --depth 1 --branch RELEASE.2025-04-16T18-13-26Z https://github.com/minio/mc.git /src
|
||||
#18 CACHED
|
||||
|
||||
#19 [s3-init build 2/5] RUN apk add --no-cache git || apk add --no-cache git || apk add --no-cache git
|
||||
#19 CACHED
|
||||
|
||||
#20 [s3-init build 4/5] WORKDIR /src
|
||||
#20 CACHED
|
||||
|
||||
#21 [s3-init stage-1 3/3] COPY --from=build /mc /usr/local/bin/mc
|
||||
#21 CACHED
|
||||
|
||||
#22 [worker 2/6] WORKDIR /app
|
||||
#22 CACHED
|
||||
|
||||
#23 [worker 3/6] COPY package.json package-lock.json ./
|
||||
#23 DONE 0.1s
|
||||
|
||||
#17 [s3 stage-1 2/3] RUN apk add --no-cache ca-certificates curl
|
||||
#17 CACHED
|
||||
|
||||
#24 [s3 build 4/5] WORKDIR /src
|
||||
#24 CACHED
|
||||
|
||||
#19 [s3 build 2/5] RUN apk add --no-cache git || apk add --no-cache git || apk add --no-cache git
|
||||
#19 CACHED
|
||||
|
||||
#25 [s3 build 3/5] RUN git clone --depth 1 --branch RELEASE.2025-04-22T22-12-26Z https://github.com/minio/minio.git /src
|
||||
#25 CACHED
|
||||
|
||||
#26 [s3 build 5/5] RUN --mount=type=cache,target=/go/pkg/mod --mount=type=cache,target=/root/.cache/go-build for attempt in 1 2 3 4 5; do CGO_ENABLED=0 go build -trimpath -o /minio . && exit 0; done; exit 1
|
||||
#26 CACHED
|
||||
|
||||
#27 [s3 stage-1 3/3] COPY --from=build /minio /usr/local/bin/minio
|
||||
#27 CACHED
|
||||
|
||||
#28 [api1 4/6] RUN npm ci --omit=dev --ignore-scripts
|
||||
#28 ...
|
||||
|
||||
#29 [s3] exporting to image
|
||||
#29 exporting layers done
|
||||
#29 exporting manifest sha256:30c9a830e647203222625c3aea74b93bce23627a1390a2f66a5f397993e20e3b done
|
||||
#29 exporting config sha256:f0d50e37a289ba1410c733ea58e694f778c6b5482259c8c8c925f3a78b6b6027 0.0s done
|
||||
#29 exporting attestation manifest sha256:73766393ae687a6e5107233c711743174e8b1aeda1a23b45a5fb7074cd916cfb 0.1s done
|
||||
#29 exporting manifest list sha256:c13b7c4ba599e25f5dd56d06756ee4d2960c7dfd97562008e3b1be6d31bbf2dc 0.0s done
|
||||
#29 naming to docker.io/library/mtusi-minio:RELEASE.2025-04-22T22-12-26Z done
|
||||
#29 unpacking to docker.io/library/mtusi-minio:RELEASE.2025-04-22T22-12-26Z done
|
||||
#29 DONE 0.2s
|
||||
|
||||
#30 [s3-init] exporting to image
|
||||
#30 exporting layers done
|
||||
#30 exporting manifest sha256:8d6d70dbd4d7f47affc37d95aa1de1e72be3d903364844c4a50d38aa997fb41d 0.0s done
|
||||
#30 exporting config sha256:3b6f7fd7c5261dd84ad05342b6d15dc4c278d9693e2f1d415dd4e09316aba07b done
|
||||
#30 exporting attestation manifest sha256:da303433de011c03291263b382b56644ba2512cb3fea236e9a7c4b34c7c9b653 0.0s done
|
||||
#30 exporting manifest list sha256:43900b393bdb20f08e78871d9ba30d869a299ef15711e008c83d32a615a5bf92 0.0s done
|
||||
#30 naming to docker.io/library/mtusi-mc:2025-04-16 done
|
||||
#30 unpacking to docker.io/library/mtusi-mc:2025-04-16 done
|
||||
#30 DONE 0.2s
|
||||
|
||||
#31 [s3] resolving provenance for metadata file
|
||||
#31 DONE 0.0s
|
||||
|
||||
#32 [s3-init] resolving provenance for metadata file
|
||||
#32 DONE 0.0s
|
||||
|
||||
#28 [api1 4/6] RUN npm ci --omit=dev --ignore-scripts
|
||||
#28 12.11 npm notice This endpoint is being retired. Use the bulk advisory endpoint instead. See the following docs for more info: https://api-docs.npmjs.com/#tag/Audit
|
||||
#28 12.92 npm warn deprecated @opentelemetry/sdk-trace-node@1.30.1: Use @opentelemetry/sdk-trace package
|
||||
#28 13.25 npm warn deprecated @opentelemetry/propagator-jaeger@1.30.1: Package no longer supported. See https://github.com/open-telemetry/opentelemetry-js/pull/7077
|
||||
#28 14.69 npm warn deprecated @opentelemetry/sdk-trace-base@1.30.1: Use @opentelemetry/sdk-trace package
|
||||
#28 21.40
|
||||
#28 21.40 added 98 packages in 21s
|
||||
#28 21.40
|
||||
#28 21.40 15 packages are looking for funding
|
||||
#28 21.40 run `npm fund` for details
|
||||
#28 21.41 npm notice
|
||||
#28 21.41 npm notice New major version of npm available! 10.9.3 -> 12.2.3
|
||||
#28 21.41 npm notice Changelog: https://github.com/npm/cli/releases/tag/v12.2.3
|
||||
#28 21.41 npm notice To update run: npm install -g npm@12.2.3
|
||||
#28 21.41 npm notice
|
||||
#28 DONE 21.6s
|
||||
|
||||
#33 [api2 5/6] COPY src/ ./src/
|
||||
#33 DONE 0.1s
|
||||
|
||||
#34 [loki-tls 6/6] COPY migrations/ ./migrations/
|
||||
#34 DONE 0.0s
|
||||
|
||||
#35 [tempo-tls] exporting to image
|
||||
#35 exporting layers
|
||||
#35 exporting layers 3.7s done
|
||||
#35 exporting manifest sha256:14a77156e00cdab2e2852456b351b9e6f94e39e9d0d057e505351b5b356587f3 0.1s done
|
||||
#35 exporting config sha256:b32e8f583a673e688c2fe54e2fed777b1b871b6a617d3db1f4bb16d263afc3b5
|
||||
#35 exporting config sha256:b32e8f583a673e688c2fe54e2fed777b1b871b6a617d3db1f4bb16d263afc3b5 0.1s done
|
||||
#35 exporting attestation manifest sha256:cfa4bd8a562d275470c05ffd054ec4ee7b008c5ce21520e8a9cc7e97c33e6759
|
||||
#35 exporting attestation manifest sha256:cfa4bd8a562d275470c05ffd054ec4ee7b008c5ce21520e8a9cc7e97c33e6759 0.2s done
|
||||
#35 exporting manifest list sha256:03b961b5a6eed72295f0b518b76699b9153fe474d7a11fc01fb0a234dd7db96a
|
||||
#35 exporting manifest list sha256:03b961b5a6eed72295f0b518b76699b9153fe474d7a11fc01fb0a234dd7db96a 0.1s done
|
||||
#35 naming to docker.io/library/mtusi-messenger:lab7 0.0s done
|
||||
#35 unpacking to docker.io/library/mtusi-messenger:lab7
|
||||
#35 ...
|
||||
|
||||
#36 [loki-tls] exporting to image
|
||||
#36 exporting layers 3.7s done
|
||||
#36 exporting manifest sha256:12313d82d2e426757ab2c8de776aa41090d97bc6b7decd261fe267e9c6d8c492 0.1s done
|
||||
#36 exporting config sha256:55014a68118e0a9ba8896945cff674856bcbba51278b0ce2fcf50847d4ab7c4a 0.1s done
|
||||
#36 exporting attestation manifest sha256:a9200e92ba0a28a7c3454b942d3ca0d7caad7d2c57846d7e33d5752a50c39b1a 0.1s done
|
||||
#36 exporting manifest list sha256:75e61c3809b5e3b79ac905e3bc8a058e8969afa00f0a05d1ecfcb27043e8dbbd 0.1s done
|
||||
#36 naming to docker.io/library/mtusi-messenger:lab7 0.0s done
|
||||
#36 unpacking to docker.io/library/mtusi-messenger:lab7 4.7s done
|
||||
#36 DONE 9.2s
|
||||
|
||||
#37 [migrate] exporting to image
|
||||
#37 exporting layers 3.7s done
|
||||
#37 exporting manifest sha256:31b45ad76abcb1ce56e2f8bc7685896c6d83dd9c47bc567ebedebf9151dcc23e 0.1s done
|
||||
#37 exporting config sha256:3ae072f6956ccd4ae030b8631bdb35331b939ef58830a05c7128c764522c5280 0.2s done
|
||||
#37 exporting attestation manifest sha256:39782e3f90312281be73755f86f0636a9b52b5886d359944758bc3b78e98863f 0.2s done
|
||||
#37 exporting manifest list sha256:7cd0a6d7ee9eec3e8af6817eaebdb35463434d511701b3f8bcb0292455a1cbf8 0.1s done
|
||||
#37 naming to docker.io/library/mtusi-messenger:lab7 0.0s done
|
||||
#37 unpacking to docker.io/library/mtusi-messenger:lab7 4.8s done
|
||||
#37 DONE 9.2s
|
||||
|
||||
#38 [worker] exporting to image
|
||||
#38 exporting layers 3.7s done
|
||||
#38 exporting manifest sha256:4487a731040251107251a6f6fd9a2af362a51d8907107691d9046c82a9447b6d 0.1s done
|
||||
#38 exporting config sha256:dcd0183c49f6bef0bd00d0d74557b9a884a0f840398be6461011fa41dec80899 0.1s done
|
||||
#38 exporting attestation manifest sha256:a7fb7dfea7dd3fbed93f291dfe1975115a180f8ff1f01085bbb7638636d1efe0 0.2s done
|
||||
#38 exporting manifest list sha256:2bbd049b39ccf079dc8fa53e51d75da2a74a79a8cb0ae8da9db1c41a10b264c4 0.1s done
|
||||
#38 naming to docker.io/library/mtusi-messenger:lab7 0.0s done
|
||||
#38 unpacking to docker.io/library/mtusi-messenger:lab7 4.8s done
|
||||
#38 DONE 9.2s
|
||||
|
||||
#39 [api2] exporting to image
|
||||
#39 exporting layers 3.7s done
|
||||
#39 exporting manifest sha256:e9634de21e7afe13b56cc2ce10cbd6bebcbaf8e36cce3d67d0c73df01d6139f0 0.1s done
|
||||
#39 exporting config sha256:0e1fd5aadf465fddc2902c465a507fdd0f39cf81eed9296f31d29fa1268779ff 0.1s done
|
||||
#39 exporting attestation manifest sha256:6a4b3be364db2cbc13560ccb3037dfbcdc6d2af624cdee806fd8c6346641a2a4 0.2s done
|
||||
#39 exporting manifest list sha256:8c3c7de92df2c2aadd1744709b08b4ebc6d6e152b2d5d81f2235ff4b8b25d742 0.1s done
|
||||
#39 naming to docker.io/library/mtusi-messenger:lab7 0.0s done
|
||||
#39 unpacking to docker.io/library/mtusi-messenger:lab7 4.8s done
|
||||
#39 DONE 9.2s
|
||||
|
||||
#40 [api1] exporting to image
|
||||
#40 exporting layers 3.7s done
|
||||
#40 exporting manifest sha256:a60140ae7c755dfbd06f4b90474b78f5bd0ae259d0b7fd9e3f8f60098890ca2c 0.1s done
|
||||
#40 exporting config sha256:8c86867943efe5584b4d1d596a8cb4dc45dcded2d7b99115d251948d653085de 0.1s done
|
||||
#40 exporting attestation manifest sha256:7fa705d8ec819b37c77e2bd91fc0728c27651440462252c4dd9c0c992e6b69e7 0.2s done
|
||||
#40 exporting manifest list sha256:3efa93fddf3356a41083da80ea25b3aa8088d2f13a107924a9a76943546ddab6 0.1s done
|
||||
#40 naming to docker.io/library/mtusi-messenger:lab7 0.0s done
|
||||
#40 unpacking to docker.io/library/mtusi-messenger:lab7 4.9s done
|
||||
#40 DONE 9.4s
|
||||
|
||||
#41 [prometheus-tls] exporting to image
|
||||
#41 exporting layers 3.7s done
|
||||
#41 exporting manifest sha256:f718201134992fc2840465eacd7959651cbc805fc46c247a6123f22c9048bed3 0.1s done
|
||||
#41 exporting config sha256:4ec8b994cf07c200c9bcdd9bd9e6809f9f5b30394f9a8d608dcdc481a10a0ba4 0.1s done
|
||||
#41 exporting attestation manifest sha256:49e879211cec56cda44fbaaccbb569c33d25e74536723aff13bb8f69c7d51460 0.2s done
|
||||
#41 exporting manifest list sha256:14afd83274091c3b64a93871df7e409cc22c9d6477b7a9a531cb360e1092296d 0.1s done
|
||||
#41 naming to docker.io/library/mtusi-messenger:lab7 0.0s done
|
||||
#41 unpacking to docker.io/library/mtusi-messenger:lab7 5.1s done
|
||||
#41 ...
|
||||
|
||||
#35 [tempo-tls] exporting to image
|
||||
#35 unpacking to docker.io/library/mtusi-messenger:lab7 5.0s done
|
||||
#35 DONE 9.5s
|
||||
|
||||
#41 [prometheus-tls] exporting to image
|
||||
#41 DONE 9.6s
|
||||
|
||||
#42 [otel-collector-tls] exporting to image
|
||||
#42 exporting layers 3.7s done
|
||||
#42 exporting manifest sha256:30d0c78cf316a42991bc097188f6107385a782d17a9a99bd0109b4b387ed4dcb 0.1s done
|
||||
#42 exporting config sha256:312e2c10471e5f4430bc997c0d82b2e7da7ad44ee3f63eac77609b07fd1786db 0.1s done
|
||||
#42 exporting attestation manifest sha256:19cc28015f036fe159dddd3e338f9fe71b869438409add15c9a62afaca104972 0.2s done
|
||||
#42 exporting manifest list sha256:626b77ccb56aabf171a60b38a2ce85a07a2f74a7fd5a07c3b78a48b8d963f8e8 0.1s done
|
||||
#42 naming to docker.io/library/mtusi-messenger:lab7 0.0s done
|
||||
#42 unpacking to docker.io/library/mtusi-messenger:lab7 5.1s done
|
||||
#42 DONE 9.6s
|
||||
|
||||
#43 [migrate] resolving provenance for metadata file
|
||||
#43 DONE 0.5s
|
||||
|
||||
#44 [worker] resolving provenance for metadata file
|
||||
#44 DONE 0.4s
|
||||
|
||||
#45 [loki-tls] resolving provenance for metadata file
|
||||
#45 DONE 0.3s
|
||||
|
||||
#46 [api2] resolving provenance for metadata file
|
||||
#46 DONE 0.2s
|
||||
|
||||
#47 [tempo-tls] resolving provenance for metadata file
|
||||
#47 DONE 0.2s
|
||||
|
||||
#48 [prometheus-tls] resolving provenance for metadata file
|
||||
#48 DONE 0.1s
|
||||
|
||||
#49 [api1] resolving provenance for metadata file
|
||||
#49 DONE 0.4s
|
||||
|
||||
#50 [otel-collector-tls] resolving provenance for metadata file
|
||||
#50 DONE 0.0s
|
||||
Image mtusi-messenger:lab7 Built
|
||||
Image mtusi-messenger:lab7 Built
|
||||
Image mtusi-messenger:lab7 Built
|
||||
Image mtusi-messenger:lab7 Built
|
||||
Image mtusi-messenger:lab7 Built
|
||||
Image mtusi-messenger:lab7 Built
|
||||
Image mtusi-messenger:lab7 Built
|
||||
Image mtusi-messenger:lab7 Built
|
||||
Image mtusi-minio:RELEASE.2025-04-22T22-12-26Z Built
|
||||
Image mtusi-mc:2025-04-16 Built
|
||||
Container mtusi-lab7-bao-1 Running
|
||||
Container mtusi-lab7-grafana-1 Running
|
||||
Container mtusi-lab7-s3-1 Running
|
||||
Container mtusi-lab7-tempo-1 Running
|
||||
Container mtusi-lab7-prometheus-1 Running
|
||||
Container mtusi-lab7-loki-1 Running
|
||||
Container mtusi-lab7-db-1 Running
|
||||
Container mtusi-lab7-otel-collector-1 Running
|
||||
Container mtusi-lab7-loki-tls-1 Recreate
|
||||
Container mtusi-lab7-otel-collector-tls-1 Recreate
|
||||
Container mtusi-lab7-prometheus-tls-1 Recreate
|
||||
Container mtusi-lab7-tempo-tls-1 Recreate
|
||||
Container mtusi-lab7-broker-1 Recreate
|
||||
Container mtusi-lab7-broker-1 Recreated
|
||||
Container mtusi-lab7-prometheus-tls-1 Recreated
|
||||
Container mtusi-lab7-otel-collector-tls-1 Recreated
|
||||
Container mtusi-lab7-tempo-tls-1 Recreated
|
||||
Container mtusi-lab7-loki-tls-1 Recreated
|
||||
Container mtusi-lab7-loki-tls-1 Starting
|
||||
Container mtusi-lab7-otel-collector-tls-1 Starting
|
||||
Container mtusi-lab7-broker-1 Starting
|
||||
Container mtusi-lab7-prometheus-tls-1 Starting
|
||||
Container mtusi-lab7-tempo-tls-1 Starting
|
||||
Container mtusi-lab7-loki-tls-1 Started
|
||||
Container mtusi-lab7-otel-collector-tls-1 Started
|
||||
Container mtusi-lab7-broker-1 Started
|
||||
Container mtusi-lab7-prometheus-tls-1 Started
|
||||
Container mtusi-lab7-tempo-tls-1 Started
|
||||
Container mtusi-lab7-db-1 Running
|
||||
Container mtusi-lab7-db-1 Waiting
|
||||
Container mtusi-lab7-db-1 Healthy
|
||||
Container mtusi-lab7-migrate-run-826c53d639dc Creating
|
||||
Container mtusi-lab7-migrate-run-826c53d639dc Created
|
||||
Migrations up to date
|
||||
Container mtusi-lab7-s3-1 Running
|
||||
Container mtusi-lab7-s3-1 Waiting
|
||||
Container mtusi-lab7-s3-1 Healthy
|
||||
Container mtusi-lab7-s3-init-run-01d60bc1252a Creating
|
||||
Container mtusi-lab7-s3-init-run-01d60bc1252a Created
|
||||
Container mtusi-lab7-db-1 Running
|
||||
Container mtusi-lab7-broker-1 Running
|
||||
Container mtusi-lab7-s3-1 Running
|
||||
Container mtusi-lab7-api1-1 Recreate
|
||||
Container mtusi-lab7-worker-1 Recreate
|
||||
Container mtusi-lab7-api2-1 Recreate
|
||||
Container mtusi-lab7-worker-1 Recreated
|
||||
Container mtusi-lab7-api1-1 Recreated
|
||||
Container mtusi-lab7-api2-1 Recreated
|
||||
Container mtusi-lab7-db-1 Waiting
|
||||
Container mtusi-lab7-s3-1 Waiting
|
||||
Container mtusi-lab7-broker-1 Waiting
|
||||
Container mtusi-lab7-s3-1 Waiting
|
||||
Container mtusi-lab7-s3-1 Waiting
|
||||
Container mtusi-lab7-db-1 Waiting
|
||||
Container mtusi-lab7-broker-1 Waiting
|
||||
Container mtusi-lab7-db-1 Waiting
|
||||
Container mtusi-lab7-broker-1 Waiting
|
||||
Container mtusi-lab7-s3-1 Healthy
|
||||
Container mtusi-lab7-s3-1 Healthy
|
||||
Container mtusi-lab7-db-1 Healthy
|
||||
Container mtusi-lab7-broker-1 Healthy
|
||||
Container mtusi-lab7-db-1 Healthy
|
||||
Container mtusi-lab7-broker-1 Healthy
|
||||
Container mtusi-lab7-api2-1 Starting
|
||||
Container mtusi-lab7-broker-1 Healthy
|
||||
Container mtusi-lab7-s3-1 Healthy
|
||||
Container mtusi-lab7-api1-1 Starting
|
||||
Container mtusi-lab7-db-1 Healthy
|
||||
Container mtusi-lab7-worker-1 Starting
|
||||
Container mtusi-lab7-api2-1 Started
|
||||
Container mtusi-lab7-api1-1 Started
|
||||
Container mtusi-lab7-worker-1 Started
|
||||
Container mtusi-lab7-broker-1 Waiting
|
||||
Container mtusi-lab7-worker-1 Waiting
|
||||
Container mtusi-lab7-s3-1 Waiting
|
||||
Container mtusi-lab7-db-1 Waiting
|
||||
Container mtusi-lab7-api1-1 Waiting
|
||||
Container mtusi-lab7-api2-1 Waiting
|
||||
Container mtusi-lab7-s3-1 Healthy
|
||||
Container mtusi-lab7-broker-1 Healthy
|
||||
Container mtusi-lab7-worker-1 Healthy
|
||||
Container mtusi-lab7-db-1 Healthy
|
||||
Container mtusi-lab7-api2-1 Healthy
|
||||
Container mtusi-lab7-api1-1 Healthy
|
||||
Container mtusi-lab7-api2-1 Running
|
||||
Container mtusi-lab7-s3-1 Running
|
||||
Container mtusi-lab7-db-1 Running
|
||||
Container mtusi-lab7-broker-1 Running
|
||||
Container mtusi-lab7-lb-1 Running
|
||||
Container mtusi-lab7-api1-1 Running
|
||||
Container mtusi-lab7-db-1 Waiting
|
||||
Container mtusi-lab7-broker-1 Waiting
|
||||
Container mtusi-lab7-broker-1 Waiting
|
||||
Container mtusi-lab7-s3-1 Waiting
|
||||
Container mtusi-lab7-s3-1 Waiting
|
||||
Container mtusi-lab7-db-1 Waiting
|
||||
Container mtusi-lab7-s3-1 Healthy
|
||||
Container mtusi-lab7-broker-1 Healthy
|
||||
Container mtusi-lab7-s3-1 Healthy
|
||||
Container mtusi-lab7-broker-1 Healthy
|
||||
Container mtusi-lab7-db-1 Healthy
|
||||
Container mtusi-lab7-db-1 Healthy
|
||||
Container mtusi-lab7-api1-1 Waiting
|
||||
Container mtusi-lab7-api2-1 Waiting
|
||||
Container mtusi-lab7-api1-1 Healthy
|
||||
Container mtusi-lab7-api2-1 Healthy
|
||||
PASS: persistent OpenBao initialized/unsealed; cert-auth roles and scoped KV policies configured.
|
||||
PASS: lab7 started. HTTPS https://localhost:8443; CA certs/ca.crt
|
||||
@@ -0,0 +1,10 @@
|
||||
Container mtusi-lab7-checks-run-67f8ed011ef7 Creating
|
||||
Container mtusi-lab7-checks-run-67f8ed011ef7 Created
|
||||
PASS: both API replicas require the LB identity; no certificate, foreign CA and trusted wrong identity rejected. External CA/hostname validation enforced.
|
||||
PASS: OpenBao cert auth issues scoped tokens <=600s; own KV allowed, other role KV and policy writes denied. No root policy.
|
||||
PASS: PostgreSQL TLS verified; plaintext rejected; worker cannot read users/sessions; neither service can create tables.
|
||||
PASS: distinct S3 credentials; API stages/reads but cannot write originals; worker writes originals but cannot read them.
|
||||
PASS: broker uses verified TLS and separate credentials; API producer cannot consume worker queue.
|
||||
PASS: Collector accepts only API/worker identities; Grafana can query Loki but cannot ingest logs.
|
||||
PASS: Argon2id PHC stores salt/parameters, 19 MiB t=2 p=1; six measured hashes and password verification checks.
|
||||
PASS: repeated login returns 429 rate_limited and Retry-After; database counter shared across replicas.
|
||||
@@ -0,0 +1 @@
|
||||
PASS: lab7 public API scenario; infrastructure and grading evidence remain separate.
|
||||
@@ -0,0 +1,753 @@
|
||||
{
|
||||
"apiLog": {
|
||||
"timestamp": "2026-11-27T21:25:18.614Z",
|
||||
"severity": "INFO",
|
||||
"service.name": "messenger-api",
|
||||
"event": "http.completed",
|
||||
"trace_id": "b84d746aaa668ff1294ad4764919fd94",
|
||||
"span_id": "67b37e04eaf54ff2",
|
||||
"request_id": "8abb4f39-e36a-4fea-bff0-4a65224ee4b3",
|
||||
"method": "GET",
|
||||
"route": "/api/v1/users/me",
|
||||
"status": 200,
|
||||
"duration_seconds": 0.003088893000000098
|
||||
},
|
||||
"workerLog": {
|
||||
"timestamp": "2026-11-27T21:25:22.837Z",
|
||||
"severity": "ERROR",
|
||||
"service.name": "messenger-worker",
|
||||
"event": "job.completed",
|
||||
"trace_id": "3267e1a4d17cbe8d30de93a7fbe55034",
|
||||
"span_id": "b63998ca076b4576",
|
||||
"job_type": "attachment.process.v1",
|
||||
"outcome": "failed",
|
||||
"duration_seconds": 0.010547288999994634,
|
||||
"attachment_id": "d2b60cf8-4370-406f-b00c-89edab6966dc"
|
||||
},
|
||||
"traces": {
|
||||
"api": {
|
||||
"batches": [
|
||||
{
|
||||
"resource": {
|
||||
"attributes": [
|
||||
{
|
||||
"key": "service.name",
|
||||
"value": {
|
||||
"stringValue": "messenger-api"
|
||||
}
|
||||
},
|
||||
{
|
||||
"key": "telemetry.sdk.language",
|
||||
"value": {
|
||||
"stringValue": "nodejs"
|
||||
}
|
||||
},
|
||||
{
|
||||
"key": "telemetry.sdk.name",
|
||||
"value": {
|
||||
"stringValue": "opentelemetry"
|
||||
}
|
||||
},
|
||||
{
|
||||
"key": "telemetry.sdk.version",
|
||||
"value": {
|
||||
"stringValue": "1.30.1"
|
||||
}
|
||||
},
|
||||
{
|
||||
"key": "service.version",
|
||||
"value": {
|
||||
"stringValue": "7.0.0"
|
||||
}
|
||||
},
|
||||
{
|
||||
"key": "service.instance.id",
|
||||
"value": {
|
||||
"stringValue": "8add01a0-80bf-4dde-a56a-e53b50687700"
|
||||
}
|
||||
},
|
||||
{
|
||||
"key": "deployment.environment.name",
|
||||
"value": {
|
||||
"stringValue": "lab"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"scopeSpans": [
|
||||
{
|
||||
"scope": {
|
||||
"name": "messenger",
|
||||
"version": "7.0.0"
|
||||
},
|
||||
"spans": [
|
||||
{
|
||||
"traceId": "uE10aqpmj/EpStR2SRn9lA==",
|
||||
"spanId": "12dRbvmD2s8=",
|
||||
"parentSpanId": "Z7N+BOr1T/I=",
|
||||
"name": "postgres.query",
|
||||
"kind": "SPAN_KIND_CLIENT",
|
||||
"startTimeUnixNano": "1795814718612000000",
|
||||
"endTimeUnixNano": "1795814718614513301",
|
||||
"attributes": [
|
||||
{
|
||||
"key": "db.system",
|
||||
"value": {
|
||||
"stringValue": "postgresql"
|
||||
}
|
||||
}
|
||||
],
|
||||
"status": {
|
||||
"code": "STATUS_CODE_OK"
|
||||
}
|
||||
},
|
||||
{
|
||||
"traceId": "uE10aqpmj/EpStR2SRn9lA==",
|
||||
"spanId": "Z7N+BOr1T/I=",
|
||||
"name": "GET /api/v1/users/me",
|
||||
"kind": "SPAN_KIND_SERVER",
|
||||
"startTimeUnixNano": "1795814718611000000",
|
||||
"endTimeUnixNano": "1795814718614323450",
|
||||
"attributes": [
|
||||
{
|
||||
"key": "http.request.method",
|
||||
"value": {
|
||||
"stringValue": "GET"
|
||||
}
|
||||
},
|
||||
{
|
||||
"key": "http.route",
|
||||
"value": {
|
||||
"stringValue": "/api/v1/users/me"
|
||||
}
|
||||
},
|
||||
{
|
||||
"key": "request_id",
|
||||
"value": {
|
||||
"stringValue": "8abb4f39-e36a-4fea-bff0-4a65224ee4b3"
|
||||
}
|
||||
},
|
||||
{
|
||||
"key": "http.response.status_code",
|
||||
"value": {
|
||||
"intValue": "200"
|
||||
}
|
||||
}
|
||||
],
|
||||
"status": {
|
||||
"code": "STATUS_CODE_OK"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"worker": {
|
||||
"batches": [
|
||||
{
|
||||
"resource": {
|
||||
"attributes": [
|
||||
{
|
||||
"key": "service.name",
|
||||
"value": {
|
||||
"stringValue": "messenger-worker"
|
||||
}
|
||||
},
|
||||
{
|
||||
"key": "telemetry.sdk.language",
|
||||
"value": {
|
||||
"stringValue": "nodejs"
|
||||
}
|
||||
},
|
||||
{
|
||||
"key": "telemetry.sdk.name",
|
||||
"value": {
|
||||
"stringValue": "opentelemetry"
|
||||
}
|
||||
},
|
||||
{
|
||||
"key": "telemetry.sdk.version",
|
||||
"value": {
|
||||
"stringValue": "1.30.1"
|
||||
}
|
||||
},
|
||||
{
|
||||
"key": "service.version",
|
||||
"value": {
|
||||
"stringValue": "7.0.0"
|
||||
}
|
||||
},
|
||||
{
|
||||
"key": "service.instance.id",
|
||||
"value": {
|
||||
"stringValue": "0fb307eb-49c8-4a9e-9fe3-df3310dab06d"
|
||||
}
|
||||
},
|
||||
{
|
||||
"key": "deployment.environment.name",
|
||||
"value": {
|
||||
"stringValue": "lab"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"scopeSpans": [
|
||||
{
|
||||
"scope": {
|
||||
"name": "messenger",
|
||||
"version": "7.0.0"
|
||||
},
|
||||
"spans": [
|
||||
{
|
||||
"traceId": "MmfhpNF8vo0w3pOn++VQNA==",
|
||||
"spanId": "RcWLsaX3C78=",
|
||||
"name": "attachment.process",
|
||||
"kind": "SPAN_KIND_CONSUMER",
|
||||
"startTimeUnixNano": "1795814718716000000",
|
||||
"endTimeUnixNano": "1795814719775591292",
|
||||
"attributes": [
|
||||
{
|
||||
"key": "messaging.system",
|
||||
"value": {
|
||||
"stringValue": "rabbitmq"
|
||||
}
|
||||
},
|
||||
{
|
||||
"key": "job.type",
|
||||
"value": {
|
||||
"stringValue": "attachment.process.v1"
|
||||
}
|
||||
},
|
||||
{
|
||||
"key": "job.outcome",
|
||||
"value": {
|
||||
"stringValue": "retry"
|
||||
}
|
||||
}
|
||||
],
|
||||
"status": {
|
||||
"code": "STATUS_CODE_ERROR"
|
||||
}
|
||||
},
|
||||
{
|
||||
"traceId": "MmfhpNF8vo0w3pOn++VQNA==",
|
||||
"spanId": "lkvPTOduyd0=",
|
||||
"parentSpanId": "RcWLsaX3C78=",
|
||||
"name": "attachments.publish",
|
||||
"kind": "SPAN_KIND_PRODUCER",
|
||||
"startTimeUnixNano": "1795814719764000000",
|
||||
"endTimeUnixNano": "1795814719767834002",
|
||||
"attributes": [
|
||||
{
|
||||
"key": "messaging.system",
|
||||
"value": {
|
||||
"stringValue": "rabbitmq"
|
||||
}
|
||||
}
|
||||
],
|
||||
"status": {
|
||||
"code": "STATUS_CODE_OK"
|
||||
}
|
||||
},
|
||||
{
|
||||
"traceId": "MmfhpNF8vo0w3pOn++VQNA==",
|
||||
"spanId": "xodHms5+yLA=",
|
||||
"parentSpanId": "WwOMVFDn6dk=",
|
||||
"name": "s3.get",
|
||||
"kind": "SPAN_KIND_CLIENT",
|
||||
"startTimeUnixNano": "1795814719794000000",
|
||||
"endTimeUnixNano": "1795814719796720088",
|
||||
"status": {
|
||||
"message": "operation_failed",
|
||||
"code": "STATUS_CODE_ERROR"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"resource": {
|
||||
"attributes": [
|
||||
{
|
||||
"key": "service.name",
|
||||
"value": {
|
||||
"stringValue": "messenger-worker"
|
||||
}
|
||||
},
|
||||
{
|
||||
"key": "telemetry.sdk.language",
|
||||
"value": {
|
||||
"stringValue": "nodejs"
|
||||
}
|
||||
},
|
||||
{
|
||||
"key": "telemetry.sdk.name",
|
||||
"value": {
|
||||
"stringValue": "opentelemetry"
|
||||
}
|
||||
},
|
||||
{
|
||||
"key": "telemetry.sdk.version",
|
||||
"value": {
|
||||
"stringValue": "1.30.1"
|
||||
}
|
||||
},
|
||||
{
|
||||
"key": "service.version",
|
||||
"value": {
|
||||
"stringValue": "7.0.0"
|
||||
}
|
||||
},
|
||||
{
|
||||
"key": "service.instance.id",
|
||||
"value": {
|
||||
"stringValue": "0fb307eb-49c8-4a9e-9fe3-df3310dab06d"
|
||||
}
|
||||
},
|
||||
{
|
||||
"key": "deployment.environment.name",
|
||||
"value": {
|
||||
"stringValue": "lab"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"scopeSpans": [
|
||||
{
|
||||
"scope": {
|
||||
"name": "messenger",
|
||||
"version": "7.0.0"
|
||||
},
|
||||
"spans": [
|
||||
{
|
||||
"traceId": "MmfhpNF8vo0w3pOn++VQNA==",
|
||||
"spanId": "r/vwyZ/NGZc=",
|
||||
"parentSpanId": "RcWLsaX3C78=",
|
||||
"name": "s3.get",
|
||||
"kind": "SPAN_KIND_CLIENT",
|
||||
"startTimeUnixNano": "1795814718744000000",
|
||||
"endTimeUnixNano": "1795814718758208747",
|
||||
"status": {
|
||||
"message": "operation_failed",
|
||||
"code": "STATUS_CODE_ERROR"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"resource": {
|
||||
"attributes": [
|
||||
{
|
||||
"key": "service.name",
|
||||
"value": {
|
||||
"stringValue": "messenger-worker"
|
||||
}
|
||||
},
|
||||
{
|
||||
"key": "telemetry.sdk.language",
|
||||
"value": {
|
||||
"stringValue": "nodejs"
|
||||
}
|
||||
},
|
||||
{
|
||||
"key": "telemetry.sdk.name",
|
||||
"value": {
|
||||
"stringValue": "opentelemetry"
|
||||
}
|
||||
},
|
||||
{
|
||||
"key": "telemetry.sdk.version",
|
||||
"value": {
|
||||
"stringValue": "1.30.1"
|
||||
}
|
||||
},
|
||||
{
|
||||
"key": "service.version",
|
||||
"value": {
|
||||
"stringValue": "7.0.0"
|
||||
}
|
||||
},
|
||||
{
|
||||
"key": "service.instance.id",
|
||||
"value": {
|
||||
"stringValue": "0fb307eb-49c8-4a9e-9fe3-df3310dab06d"
|
||||
}
|
||||
},
|
||||
{
|
||||
"key": "deployment.environment.name",
|
||||
"value": {
|
||||
"stringValue": "lab"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"scopeSpans": [
|
||||
{
|
||||
"scope": {
|
||||
"name": "messenger",
|
||||
"version": "7.0.0"
|
||||
},
|
||||
"spans": [
|
||||
{
|
||||
"traceId": "MmfhpNF8vo0w3pOn++VQNA==",
|
||||
"spanId": "WwOMVFDn6dk=",
|
||||
"parentSpanId": "lkvPTOduyd0=",
|
||||
"name": "attachment.process",
|
||||
"kind": "SPAN_KIND_CONSUMER",
|
||||
"startTimeUnixNano": "1795814719772000000",
|
||||
"endTimeUnixNano": "1795814720802817288",
|
||||
"attributes": [
|
||||
{
|
||||
"key": "messaging.system",
|
||||
"value": {
|
||||
"stringValue": "rabbitmq"
|
||||
}
|
||||
},
|
||||
{
|
||||
"key": "job.type",
|
||||
"value": {
|
||||
"stringValue": "attachment.process.v1"
|
||||
}
|
||||
},
|
||||
{
|
||||
"key": "job.outcome",
|
||||
"value": {
|
||||
"stringValue": "retry"
|
||||
}
|
||||
}
|
||||
],
|
||||
"status": {
|
||||
"code": "STATUS_CODE_ERROR"
|
||||
}
|
||||
},
|
||||
{
|
||||
"traceId": "MmfhpNF8vo0w3pOn++VQNA==",
|
||||
"spanId": "hP0BGOc62Vs=",
|
||||
"parentSpanId": "WwOMVFDn6dk=",
|
||||
"name": "attachments.publish",
|
||||
"kind": "SPAN_KIND_PRODUCER",
|
||||
"startTimeUnixNano": "1795814720799000000",
|
||||
"endTimeUnixNano": "1795814720800661304",
|
||||
"attributes": [
|
||||
{
|
||||
"key": "messaging.system",
|
||||
"value": {
|
||||
"stringValue": "rabbitmq"
|
||||
}
|
||||
}
|
||||
],
|
||||
"status": {
|
||||
"code": "STATUS_CODE_OK"
|
||||
}
|
||||
},
|
||||
{
|
||||
"traceId": "MmfhpNF8vo0w3pOn++VQNA==",
|
||||
"spanId": "+iGH+aZl4X4=",
|
||||
"parentSpanId": "5eNrDONVqcM=",
|
||||
"name": "s3.get",
|
||||
"kind": "SPAN_KIND_CLIENT",
|
||||
"startTimeUnixNano": "1795814720808000000",
|
||||
"endTimeUnixNano": "1795814720810517858",
|
||||
"status": {
|
||||
"message": "operation_failed",
|
||||
"code": "STATUS_CODE_ERROR"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"resource": {
|
||||
"attributes": [
|
||||
{
|
||||
"key": "service.name",
|
||||
"value": {
|
||||
"stringValue": "messenger-worker"
|
||||
}
|
||||
},
|
||||
{
|
||||
"key": "telemetry.sdk.language",
|
||||
"value": {
|
||||
"stringValue": "nodejs"
|
||||
}
|
||||
},
|
||||
{
|
||||
"key": "telemetry.sdk.name",
|
||||
"value": {
|
||||
"stringValue": "opentelemetry"
|
||||
}
|
||||
},
|
||||
{
|
||||
"key": "telemetry.sdk.version",
|
||||
"value": {
|
||||
"stringValue": "1.30.1"
|
||||
}
|
||||
},
|
||||
{
|
||||
"key": "service.version",
|
||||
"value": {
|
||||
"stringValue": "7.0.0"
|
||||
}
|
||||
},
|
||||
{
|
||||
"key": "service.instance.id",
|
||||
"value": {
|
||||
"stringValue": "0fb307eb-49c8-4a9e-9fe3-df3310dab06d"
|
||||
}
|
||||
},
|
||||
{
|
||||
"key": "deployment.environment.name",
|
||||
"value": {
|
||||
"stringValue": "lab"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"scopeSpans": [
|
||||
{
|
||||
"scope": {
|
||||
"name": "messenger",
|
||||
"version": "7.0.0"
|
||||
},
|
||||
"spans": [
|
||||
{
|
||||
"traceId": "MmfhpNF8vo0w3pOn++VQNA==",
|
||||
"spanId": "5eNrDONVqcM=",
|
||||
"parentSpanId": "hP0BGOc62Vs=",
|
||||
"name": "attachment.process",
|
||||
"kind": "SPAN_KIND_CONSUMER",
|
||||
"startTimeUnixNano": "1795814720802000000",
|
||||
"endTimeUnixNano": "1795814721815667456",
|
||||
"attributes": [
|
||||
{
|
||||
"key": "messaging.system",
|
||||
"value": {
|
||||
"stringValue": "rabbitmq"
|
||||
}
|
||||
},
|
||||
{
|
||||
"key": "job.type",
|
||||
"value": {
|
||||
"stringValue": "attachment.process.v1"
|
||||
}
|
||||
},
|
||||
{
|
||||
"key": "job.outcome",
|
||||
"value": {
|
||||
"stringValue": "retry"
|
||||
}
|
||||
}
|
||||
],
|
||||
"status": {
|
||||
"code": "STATUS_CODE_ERROR"
|
||||
}
|
||||
},
|
||||
{
|
||||
"traceId": "MmfhpNF8vo0w3pOn++VQNA==",
|
||||
"spanId": "UVvSGuftECE=",
|
||||
"parentSpanId": "5eNrDONVqcM=",
|
||||
"name": "attachments.publish",
|
||||
"kind": "SPAN_KIND_PRODUCER",
|
||||
"startTimeUnixNano": "1795814721812000000",
|
||||
"endTimeUnixNano": "1795814721813667215",
|
||||
"attributes": [
|
||||
{
|
||||
"key": "messaging.system",
|
||||
"value": {
|
||||
"stringValue": "rabbitmq"
|
||||
}
|
||||
}
|
||||
],
|
||||
"status": {
|
||||
"code": "STATUS_CODE_OK"
|
||||
}
|
||||
},
|
||||
{
|
||||
"traceId": "MmfhpNF8vo0w3pOn++VQNA==",
|
||||
"spanId": "T0/9ywOTYe8=",
|
||||
"parentSpanId": "EdWvTrsOgpo=",
|
||||
"name": "s3.get",
|
||||
"kind": "SPAN_KIND_CLIENT",
|
||||
"startTimeUnixNano": "1795814721820000000",
|
||||
"endTimeUnixNano": "1795814721822292610",
|
||||
"status": {
|
||||
"message": "operation_failed",
|
||||
"code": "STATUS_CODE_ERROR"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"resource": {
|
||||
"attributes": [
|
||||
{
|
||||
"key": "service.name",
|
||||
"value": {
|
||||
"stringValue": "messenger-worker"
|
||||
}
|
||||
},
|
||||
{
|
||||
"key": "telemetry.sdk.language",
|
||||
"value": {
|
||||
"stringValue": "nodejs"
|
||||
}
|
||||
},
|
||||
{
|
||||
"key": "telemetry.sdk.name",
|
||||
"value": {
|
||||
"stringValue": "opentelemetry"
|
||||
}
|
||||
},
|
||||
{
|
||||
"key": "telemetry.sdk.version",
|
||||
"value": {
|
||||
"stringValue": "1.30.1"
|
||||
}
|
||||
},
|
||||
{
|
||||
"key": "service.version",
|
||||
"value": {
|
||||
"stringValue": "7.0.0"
|
||||
}
|
||||
},
|
||||
{
|
||||
"key": "service.instance.id",
|
||||
"value": {
|
||||
"stringValue": "0fb307eb-49c8-4a9e-9fe3-df3310dab06d"
|
||||
}
|
||||
},
|
||||
{
|
||||
"key": "deployment.environment.name",
|
||||
"value": {
|
||||
"stringValue": "lab"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"scopeSpans": [
|
||||
{
|
||||
"scope": {
|
||||
"name": "messenger",
|
||||
"version": "7.0.0"
|
||||
},
|
||||
"spans": [
|
||||
{
|
||||
"traceId": "MmfhpNF8vo0w3pOn++VQNA==",
|
||||
"spanId": "EdWvTrsOgpo=",
|
||||
"parentSpanId": "UVvSGuftECE=",
|
||||
"name": "attachment.process",
|
||||
"kind": "SPAN_KIND_CONSUMER",
|
||||
"startTimeUnixNano": "1795814721815000000",
|
||||
"endTimeUnixNano": "1795814722827625511",
|
||||
"attributes": [
|
||||
{
|
||||
"key": "messaging.system",
|
||||
"value": {
|
||||
"stringValue": "rabbitmq"
|
||||
}
|
||||
},
|
||||
{
|
||||
"key": "job.type",
|
||||
"value": {
|
||||
"stringValue": "attachment.process.v1"
|
||||
}
|
||||
},
|
||||
{
|
||||
"key": "job.outcome",
|
||||
"value": {
|
||||
"stringValue": "retry"
|
||||
}
|
||||
}
|
||||
],
|
||||
"status": {
|
||||
"code": "STATUS_CODE_ERROR"
|
||||
}
|
||||
},
|
||||
{
|
||||
"traceId": "MmfhpNF8vo0w3pOn++VQNA==",
|
||||
"spanId": "2R0lKwoDG6E=",
|
||||
"parentSpanId": "EdWvTrsOgpo=",
|
||||
"name": "attachments.publish",
|
||||
"kind": "SPAN_KIND_PRODUCER",
|
||||
"startTimeUnixNano": "1795814722824000000",
|
||||
"endTimeUnixNano": "1795814722825848247",
|
||||
"attributes": [
|
||||
{
|
||||
"key": "messaging.system",
|
||||
"value": {
|
||||
"stringValue": "rabbitmq"
|
||||
}
|
||||
}
|
||||
],
|
||||
"status": {
|
||||
"code": "STATUS_CODE_OK"
|
||||
}
|
||||
},
|
||||
{
|
||||
"traceId": "MmfhpNF8vo0w3pOn++VQNA==",
|
||||
"spanId": "tjmYygdrRXY=",
|
||||
"parentSpanId": "2R0lKwoDG6E=",
|
||||
"name": "attachment.process",
|
||||
"kind": "SPAN_KIND_CONSUMER",
|
||||
"startTimeUnixNano": "1795814722827000000",
|
||||
"endTimeUnixNano": "1795814722837951525",
|
||||
"attributes": [
|
||||
{
|
||||
"key": "messaging.system",
|
||||
"value": {
|
||||
"stringValue": "rabbitmq"
|
||||
}
|
||||
},
|
||||
{
|
||||
"key": "job.type",
|
||||
"value": {
|
||||
"stringValue": "attachment.process.v1"
|
||||
}
|
||||
},
|
||||
{
|
||||
"key": "job.outcome",
|
||||
"value": {
|
||||
"stringValue": "failed"
|
||||
}
|
||||
}
|
||||
],
|
||||
"status": {
|
||||
"code": "STATUS_CODE_ERROR"
|
||||
}
|
||||
},
|
||||
{
|
||||
"traceId": "MmfhpNF8vo0w3pOn++VQNA==",
|
||||
"spanId": "Eqm/RyRcUGM=",
|
||||
"parentSpanId": "tjmYygdrRXY=",
|
||||
"name": "s3.get",
|
||||
"kind": "SPAN_KIND_CLIENT",
|
||||
"startTimeUnixNano": "1795814722831000000",
|
||||
"endTimeUnixNano": "1795814722833412303",
|
||||
"status": {
|
||||
"message": "operation_failed",
|
||||
"code": "STATUS_CODE_ERROR"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"metric_series": {
|
||||
"messenger_http_requests_total": 24,
|
||||
"messenger_http_duration_seconds_bucket": 288,
|
||||
"messenger_jobs_total": 4,
|
||||
"messenger_job_duration_seconds_bucket": 48
|
||||
},
|
||||
"failed_job_attempts": 5
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
Container mtusi-lab7-checks-run-1ccddb66874b Creating
|
||||
Container mtusi-lab7-checks-run-1ccddb66874b Created
|
||||
PASS: TLS/mTLS telemetry pipelines store actual API and failed-worker spans/logs, four metric families, no ID labels or synthetic secret/body leakage; failed job stops after five attempts.
|
||||
@@ -0,0 +1,10 @@
|
||||
FROM golang:1.24.3-alpine AS build
|
||||
RUN apk add --no-cache git || apk add --no-cache git || apk add --no-cache git
|
||||
RUN git clone --depth 1 --branch RELEASE.2025-04-16T18-13-26Z https://github.com/minio/mc.git /src
|
||||
WORKDIR /src
|
||||
RUN --mount=type=cache,target=/go/pkg/mod --mount=type=cache,target=/root/.cache/go-build for attempt in 1 2 3 4 5; do CGO_ENABLED=0 go build -trimpath -o /mc . && exit 0; done; exit 1
|
||||
FROM alpine:3.22.1
|
||||
RUN apk add --no-cache ca-certificates curl
|
||||
COPY --from=build /mc /usr/local/bin/mc
|
||||
ENTRYPOINT ["mc"]
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
FROM golang:1.24.3-alpine AS build
|
||||
RUN apk add --no-cache git || apk add --no-cache git || apk add --no-cache git
|
||||
RUN git clone --depth 1 --branch RELEASE.2025-04-22T22-12-26Z https://github.com/minio/minio.git /src
|
||||
WORKDIR /src
|
||||
RUN --mount=type=cache,target=/go/pkg/mod --mount=type=cache,target=/root/.cache/go-build \
|
||||
for attempt in 1 2 3 4 5; do CGO_ENABLED=0 go build -trimpath -o /minio . && exit 0; done; exit 1
|
||||
|
||||
FROM alpine:3.22.1
|
||||
RUN apk add --no-cache ca-certificates curl
|
||||
COPY --from=build /minio /usr/local/bin/minio
|
||||
ENTRYPOINT ["minio"]
|
||||
+3
-5
@@ -1,7 +1,5 @@
|
||||
# Инфраструктура студента
|
||||
# Инфраструктура lab7
|
||||
|
||||
Здесь разместите конфигурации выбранных сервисов; основную топологию — в корневом compose.yaml/stack.yaml. `compose.example.yaml` — только worksheet ролей и намеренно не запускается. `contracts/infrastructure.json` задаёт минимальные роли, не готовые образы/пароли.
|
||||
compose.yaml содержит полный локальный стенд. Операторский запуск scripts/up.py выполняет порядок bootstrap; одного compose up для первого init/unseal недостаточно. src/tls-proxy.js использует общий network namespace только с конкретным telemetry backend; upstream разрешён исключительно на 127.0.0.1.
|
||||
|
||||
В REPORT.md сопоставьте роль → service name → версия/digest → health/readiness → volume → сеть/порт → способ передачи credentials. Приведите bootstrap (schema, bucket, broker topology, а с lab6 provisioning) и безопасное повторение этих команд.
|
||||
|
||||
Приложение строится из исходников. Не используйте заранее существующий образ преподавательского сервера вместо своей реализации. Restart hook перезапускает все соответствующие stores с volumes; failover hook останавливает только заданную API-реплику.
|
||||
Границы, порты и identities описаны в contracts/trust-matrix.md. certs/, secrets/, operator/ генерируются локально и не включаются в исходники. OpenBao/migration/S3-init — отдельные операторские этапы; root credentials не передаются приложению и worker.
|
||||
|
||||
@@ -0,0 +1,263 @@
|
||||
{
|
||||
"uid": "messenger-lab7",
|
||||
"title": "Messenger — lab7",
|
||||
"schemaVersion": 40,
|
||||
"version": 1,
|
||||
"editable": false,
|
||||
"timezone": "browser",
|
||||
"refresh": "5s",
|
||||
"time": {
|
||||
"from": "now-30m",
|
||||
"to": "now"
|
||||
},
|
||||
"panels": [
|
||||
{
|
||||
"id": 1,
|
||||
"title": "API requests / second",
|
||||
"type": "timeseries",
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"gridPos": {
|
||||
"x": 0,
|
||||
"y": 0,
|
||||
"w": 12,
|
||||
"h": 8
|
||||
},
|
||||
"targets": [
|
||||
{
|
||||
"refId": "A",
|
||||
"expr": "sum by (method,route) (rate(messenger_http_requests_total{route!~\"/health/.*\"}[1m]))",
|
||||
"legendFormat": "{{route}} {{outcome}}"
|
||||
}
|
||||
],
|
||||
"fieldConfig": {
|
||||
"defaults": {
|
||||
"unit": "reqps"
|
||||
},
|
||||
"overrides": []
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": 2,
|
||||
"title": "API 5xx / all business requests",
|
||||
"type": "timeseries",
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"gridPos": {
|
||||
"x": 12,
|
||||
"y": 0,
|
||||
"w": 12,
|
||||
"h": 8
|
||||
},
|
||||
"targets": [
|
||||
{
|
||||
"refId": "A",
|
||||
"expr": "(sum(rate(messenger_http_requests_total{status_class=\"5xx\",route!~\"/health/.*\"}[1m])) or vector(0)) / clamp_min(sum(rate(messenger_http_requests_total{route!~\"/health/.*\"}[1m])),0.000001)",
|
||||
"legendFormat": "{{route}} {{outcome}}"
|
||||
}
|
||||
],
|
||||
"fieldConfig": {
|
||||
"defaults": {
|
||||
"unit": "percentunit",
|
||||
"min": 0,
|
||||
"max": 1
|
||||
},
|
||||
"overrides": []
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": 3,
|
||||
"title": "API p95 duration, seconds",
|
||||
"type": "timeseries",
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"gridPos": {
|
||||
"x": 0,
|
||||
"y": 8,
|
||||
"w": 12,
|
||||
"h": 8
|
||||
},
|
||||
"targets": [
|
||||
{
|
||||
"refId": "A",
|
||||
"expr": "histogram_quantile(0.95,sum by (le) (rate(messenger_http_duration_seconds_bucket{route!~\"/health/.*\"}[1m])))",
|
||||
"legendFormat": "{{route}} {{outcome}}"
|
||||
}
|
||||
],
|
||||
"fieldConfig": {
|
||||
"defaults": {
|
||||
"unit": "s"
|
||||
},
|
||||
"overrides": []
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": 4,
|
||||
"title": "Jobs by outcome / second",
|
||||
"type": "timeseries",
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"gridPos": {
|
||||
"x": 12,
|
||||
"y": 8,
|
||||
"w": 12,
|
||||
"h": 8
|
||||
},
|
||||
"targets": [
|
||||
{
|
||||
"refId": "A",
|
||||
"expr": "sum by (outcome) (rate(messenger_jobs_total[1m]))",
|
||||
"legendFormat": "{{route}} {{outcome}}"
|
||||
}
|
||||
],
|
||||
"fieldConfig": {
|
||||
"defaults": {
|
||||
"unit": "ops"
|
||||
},
|
||||
"overrides": []
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": 5,
|
||||
"title": "Worker p95 duration, seconds",
|
||||
"type": "timeseries",
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"gridPos": {
|
||||
"x": 0,
|
||||
"y": 16,
|
||||
"w": 12,
|
||||
"h": 8
|
||||
},
|
||||
"targets": [
|
||||
{
|
||||
"refId": "A",
|
||||
"expr": "histogram_quantile(0.95,sum by (le) (rate(messenger_job_duration_seconds_bucket[1m])))",
|
||||
"legendFormat": "{{route}} {{outcome}}"
|
||||
}
|
||||
],
|
||||
"fieldConfig": {
|
||||
"defaults": {
|
||||
"unit": "s"
|
||||
},
|
||||
"overrides": []
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": 6,
|
||||
"title": "Jobs total by outcome",
|
||||
"type": "timeseries",
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"gridPos": {
|
||||
"x": 12,
|
||||
"y": 16,
|
||||
"w": 12,
|
||||
"h": 8
|
||||
},
|
||||
"targets": [
|
||||
{
|
||||
"refId": "A",
|
||||
"expr": "sum by (outcome) (messenger_jobs_total)",
|
||||
"legendFormat": "{{route}} {{outcome}}"
|
||||
}
|
||||
],
|
||||
"fieldConfig": {
|
||||
"defaults": {
|
||||
"unit": "short"
|
||||
},
|
||||
"overrides": []
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": 7,
|
||||
"title": "messenger-api logs (TraceID opens Tempo)",
|
||||
"type": "logs",
|
||||
"datasource": {
|
||||
"type": "loki",
|
||||
"uid": "loki"
|
||||
},
|
||||
"gridPos": {
|
||||
"x": 0,
|
||||
"y": 24,
|
||||
"w": 24,
|
||||
"h": 9
|
||||
},
|
||||
"targets": [
|
||||
{
|
||||
"refId": "A",
|
||||
"expr": "{service_name=\"messenger-api\"}",
|
||||
"queryType": "range"
|
||||
}
|
||||
],
|
||||
"options": {
|
||||
"showTime": true,
|
||||
"showLabels": false,
|
||||
"wrapLogMessage": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": 8,
|
||||
"title": "messenger-worker logs (TraceID opens Tempo)",
|
||||
"type": "logs",
|
||||
"datasource": {
|
||||
"type": "loki",
|
||||
"uid": "loki"
|
||||
},
|
||||
"gridPos": {
|
||||
"x": 0,
|
||||
"y": 33,
|
||||
"w": 24,
|
||||
"h": 9
|
||||
},
|
||||
"targets": [
|
||||
{
|
||||
"refId": "A",
|
||||
"expr": "{service_name=\"messenger-worker\"}",
|
||||
"queryType": "range"
|
||||
}
|
||||
],
|
||||
"options": {
|
||||
"showTime": true,
|
||||
"showLabels": false,
|
||||
"wrapLogMessage": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": 9,
|
||||
"title": "API and worker traces",
|
||||
"type": "table",
|
||||
"datasource": {
|
||||
"type": "tempo",
|
||||
"uid": "tempo"
|
||||
},
|
||||
"gridPos": {
|
||||
"x": 0,
|
||||
"y": 42,
|
||||
"w": 24,
|
||||
"h": 8
|
||||
},
|
||||
"targets": [
|
||||
{
|
||||
"refId": "A",
|
||||
"queryType": "traceql",
|
||||
"query": "{ resource.service.name =~ \"messenger-.*\" }",
|
||||
"tableType": "traces",
|
||||
"limit": 20
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
apiVersion: 1
|
||||
providers:
|
||||
- name: Messenger
|
||||
folder: MTUSI
|
||||
type: file
|
||||
editable: false
|
||||
options:
|
||||
path: /var/lib/grafana/dashboards
|
||||
@@ -0,0 +1,3 @@
|
||||
# Datasources are generated locally by scripts/setup.py into secrets/datasources.yaml.
|
||||
# That file contains the Grafana client certificate/private key and is not committed.
|
||||
# compose.yaml mounts only the generated file; no plaintext data source is used.
|
||||
@@ -0,0 +1,26 @@
|
||||
global
|
||||
log stdout format raw local0
|
||||
maxconn 128
|
||||
ssl-default-bind-options ssl-min-ver TLSv1.2
|
||||
ssl-default-server-options ssl-min-ver TLSv1.2
|
||||
defaults
|
||||
mode http
|
||||
timeout connect 3s
|
||||
timeout client 30s
|
||||
timeout server 30s
|
||||
frontend ingress
|
||||
bind :8443 ssl crt /tls/server.pem
|
||||
http-request set-header X-Forwarded-For %[src]
|
||||
default_backend api
|
||||
backend api
|
||||
balance roundrobin
|
||||
option httpchk GET /health/ready
|
||||
server api1 api1:8443 ssl verify required ca-file /tls/ca.crt crt /tls/client.pem verifyhost api1 sni str(api1) check inter 1s fall 2 rise 1 resolvers docker init-addr libc,none resolve-prefer ipv4
|
||||
server api2 api2:8443 ssl verify required ca-file /tls/ca.crt crt /tls/client.pem verifyhost api2 sni str(api2) check inter 1s fall 2 rise 1 resolvers docker init-addr libc,none resolve-prefer ipv4
|
||||
|
||||
resolvers docker
|
||||
nameserver docker 127.0.0.11:53
|
||||
resolve_retries 3
|
||||
timeout resolve 1s
|
||||
timeout retry 1s
|
||||
hold valid 10s
|
||||
@@ -1,7 +1,7 @@
|
||||
# OpenBao — реализовать конфигурацию и политики
|
||||
# OpenBao lab7
|
||||
|
||||
Добавьте non-dev конфигурацию listener/storage/TLS, API/worker policies, bootstrap и rotation scripts. Credentials и unseal material создаются локально; здесь нет готового root token или private key.
|
||||
Конфигурация server-mode и file storage: config.hcl. Scoped политики: api.hcl, worker.hcl. Cert auth и KV настраиваются host-скриптом scripts/bao.py; служебные tokens TTL=300/max=600, после чтения отзываются. Полный bootstrap: scripts/up.py. После рестарта Bao требуется операторский unseal.
|
||||
|
||||
Решение должно показать реальную сервисную аутентификацию и получение нужного secret по ограниченной policy; просто работающий контейнер OpenBao не засчитывается. На 3 статический KV secret допустим. На 4 покажите expiry/renewal/rotation и allow/deny. Путь KV v2 data/metadata и ACL должен соответствовать фактическому mount; не копируйте широкое `path "*"` для приложения.
|
||||
operator/bao-init.json содержит root token и один unseal share, operator/ca.key — private CA. Они не монтируются в сервисы, не коммитятся и не включаются в архив. Для учебного 1-of-1 режима ответственность за защищённое хранение и backup лежит на операторе. Обычный рестарт API не требует unseal заново, если Bao уже открыт.
|
||||
|
||||
Документируйте шаги оператора init/unseal и восстановление после restart. Скрипт не должен печатать tokens/shares или хранить их в Git. См. contracts/trust-matrix.md и REPORT.md.
|
||||
Каждый API/worker имеет только собственный leaf key/cert и публичный CA. Рабочие secrets читаются из OpenBao в память процесса. При sealed/unavailable Bao новый процесс не стартует; уже запущенный продолжает использовать статические KV credentials. Ротация и отзыв существующих DB-соединений не заявлены на оценку 3.
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
path "secret/data/api" { capabilities = ["read"] }
|
||||
path "auth/token/revoke-self" { capabilities = ["update"] }
|
||||
@@ -0,0 +1,11 @@
|
||||
ui = true
|
||||
disable_mlock = true
|
||||
storage "file" { path = "/openbao/file" }
|
||||
listener "tcp" {
|
||||
address = "0.0.0.0:8200"
|
||||
tls_cert_file = "/tls/cert.crt"
|
||||
tls_key_file = "/tls/key.pem"
|
||||
tls_client_ca_file = "/tls/ca.crt"
|
||||
tls_min_version = "tls12"
|
||||
}
|
||||
api_addr = "https://bao:8200"
|
||||
@@ -0,0 +1,2 @@
|
||||
path "secret/data/worker" { capabilities = ["read"] }
|
||||
path "auth/token/revoke-self" { capabilities = ["update"] }
|
||||
@@ -1,7 +1,9 @@
|
||||
# Конфигурация наблюдаемости — реализовать
|
||||
# Наблюдаемость lab7
|
||||
|
||||
Добавьте `collector.yaml` с OTLP receivers, processors и exporters выбранной версии Collector. Укажите явные bind endpoints, внутренние сети, memory limits/batch и поведение при backpressure по уровню. Сопоставьте все три pipeline с реально развёрнутыми backend.
|
||||
Сигналы lab6 сохранены: messenger_http_requests_total (method/route/status_class), messenger_http_duration_seconds histogram; messenger_jobs_total и messenger_job_duration_seconds histogram (job_type/outcome). Длительности в секундах, HTTP route — шаблон. Worker outcomes считают попытки, в том числе retry, а не только уникальные файлы. JSON logs содержат timestamp/severity/service.name/event и trace_id/span_id при активном span. SERVER/CONSUMER spans реальные; поля body/password/Authorization не экспортируются.
|
||||
|
||||
Добавьте конфигурации storage, Grafana provisioning/datasources, provisioning/dashboards и импортируемые dashboard JSON. На 4 — alert rules и runbooks. Пустой dashboard или debug exporter, который только печатает данные в stdout, не заменяют хранилища/доказательства из `contracts/observability.md`.
|
||||
API/worker отправляют OTLP по HTTPS/mTLS в otel-collector:3443. Collector экспортирует в loki:3443/otlp и tempo:3443, Prometheus снимает metrics с otel-collector:3443/metrics. Grafana обращается к каждому backend по HTTPS/mTLS. Роли и закрытые loopback hops: contracts/trust-matrix.md. Приватный datasource provisioning генерируется setup.py в secrets/, dashboard JSON остаётся в Git.
|
||||
|
||||
Не публикуйте OTLP/metrics/административные ports в общую сеть без необходимости. В lab7 реализуйте TLS/mTLS по trust matrix; экспорт Authorization и message bodies запрещён.
|
||||
Prometheus хранит метрики, Loki — логи, Tempo — трассы. История в volumes, retention 3 дня. Dashboard messenger-lab7 показывает RPS, долю 5xx среди бизнес-запросов без health, p95 из histogram buckets, jobs, логи и traces. Примеры связанных trace_id/request_id/attachment_id — evidence/telemetry.json. Для Loki Explore: {service_name="messenger-api"} |= "REQUEST_ID"; для worker — messenger-worker и attachment_id. Из лога доступен View trace.
|
||||
|
||||
Очереди SDK logs/spans по 512, batch 128; Collector memory limiter 128 MiB + spike 32 MiB, Docker limit 256 MiB, exporter queue 256, retry до 10 секунд. Долгая недоступность telemetry backend может привести к потере наблюдений; readiness API зависит от DB/S3/broker, а не от Grafana. SLO/alerts уровня 4 не заявлены.
|
||||
|
||||
@@ -0,0 +1,59 @@
|
||||
receivers:
|
||||
otlp:
|
||||
protocols:
|
||||
http:
|
||||
endpoint: 127.0.0.1:4318
|
||||
processors:
|
||||
memory_limiter:
|
||||
check_interval: 1s
|
||||
limit_mib: 128
|
||||
spike_limit_mib: 32
|
||||
batch:
|
||||
timeout: 1s
|
||||
send_batch_size: 128
|
||||
send_batch_max_size: 256
|
||||
exporters:
|
||||
prometheus:
|
||||
endpoint: 127.0.0.1:9464
|
||||
resource_to_telemetry_conversion:
|
||||
enabled: true
|
||||
otlphttp/loki:
|
||||
endpoint: https://loki:3443/otlp
|
||||
tls:
|
||||
ca_file: /tls/ca.crt
|
||||
cert_file: /tls/cert.crt
|
||||
key_file: /tls/key.pem
|
||||
timeout: 2s
|
||||
sending_queue:
|
||||
queue_size: 256
|
||||
retry_on_failure:
|
||||
initial_interval: 1s
|
||||
max_interval: 3s
|
||||
max_elapsed_time: 10s
|
||||
otlphttp/tempo:
|
||||
endpoint: https://tempo:3443
|
||||
tls:
|
||||
ca_file: /tls/ca.crt
|
||||
cert_file: /tls/cert.crt
|
||||
key_file: /tls/key.pem
|
||||
timeout: 2s
|
||||
sending_queue:
|
||||
queue_size: 256
|
||||
retry_on_failure:
|
||||
initial_interval: 1s
|
||||
max_interval: 3s
|
||||
max_elapsed_time: 10s
|
||||
service:
|
||||
pipelines:
|
||||
metrics:
|
||||
receivers: [otlp]
|
||||
processors: [memory_limiter, batch]
|
||||
exporters: [prometheus]
|
||||
logs:
|
||||
receivers: [otlp]
|
||||
processors: [memory_limiter, batch]
|
||||
exporters: [otlphttp/loki]
|
||||
traces:
|
||||
receivers: [otlp]
|
||||
processors: [memory_limiter, batch]
|
||||
exporters: [otlphttp/tempo]
|
||||
@@ -0,0 +1,42 @@
|
||||
auth_enabled: false
|
||||
server:
|
||||
http_listen_port: 3100
|
||||
http_listen_address: 127.0.0.1
|
||||
grpc_listen_address: 127.0.0.1
|
||||
common:
|
||||
path_prefix: /loki
|
||||
replication_factor: 1
|
||||
ring:
|
||||
instance_addr: 127.0.0.1
|
||||
kvstore:
|
||||
store: inmemory
|
||||
storage:
|
||||
filesystem:
|
||||
chunks_directory: /loki/chunks
|
||||
rules_directory: /loki/rules
|
||||
schema_config:
|
||||
configs:
|
||||
- from: 2024-01-01
|
||||
store: tsdb
|
||||
object_store: filesystem
|
||||
schema: v13
|
||||
index:
|
||||
prefix: index_
|
||||
period: 24h
|
||||
limits_config:
|
||||
allow_structured_metadata: true
|
||||
retention_period: 72h
|
||||
compactor:
|
||||
working_directory: /loki/compactor
|
||||
retention_enabled: true
|
||||
delete_request_store: filesystem
|
||||
analytics:
|
||||
reporting_enabled: false
|
||||
|
||||
ingester:
|
||||
wal:
|
||||
enabled: true
|
||||
dir: /loki/wal
|
||||
|
||||
frontend:
|
||||
address: 127.0.0.1
|
||||
@@ -0,0 +1,11 @@
|
||||
global:
|
||||
scrape_interval: 5s
|
||||
scrape_configs:
|
||||
- job_name: messenger
|
||||
scheme: https
|
||||
tls_config:
|
||||
ca_file: /tls/ca.crt
|
||||
cert_file: /tls/cert.crt
|
||||
key_file: /tls/key.pem
|
||||
static_configs:
|
||||
- targets: [otel-collector:3443]
|
||||
@@ -0,0 +1,24 @@
|
||||
server:
|
||||
http_listen_port: 3200
|
||||
http_listen_address: 127.0.0.1
|
||||
grpc_listen_address: 127.0.0.1
|
||||
distributor:
|
||||
receivers:
|
||||
otlp:
|
||||
protocols:
|
||||
http:
|
||||
endpoint: 127.0.0.1:4318
|
||||
ingester:
|
||||
max_block_duration: 5m
|
||||
compactor:
|
||||
compaction:
|
||||
block_retention: 72h
|
||||
storage:
|
||||
trace:
|
||||
backend: local
|
||||
wal:
|
||||
path: /var/tempo/wal
|
||||
local:
|
||||
path: /var/tempo/blocks
|
||||
usage_report:
|
||||
reporting_enabled: false
|
||||
@@ -0,0 +1 @@
|
||||
[].
|
||||
@@ -0,0 +1,35 @@
|
||||
CREATE TABLE users (
|
||||
id uuid PRIMARY KEY,
|
||||
username text NOT NULL UNIQUE CHECK (username ~ '^[a-z0-9_]{3,32}$'),
|
||||
display_name text NOT NULL CHECK (char_length(display_name) BETWEEN 1 AND 100),
|
||||
password_hash text NOT NULL,
|
||||
created_at timestamptz(3) NOT NULL DEFAULT clock_timestamp()
|
||||
);
|
||||
CREATE TABLE chats (
|
||||
id uuid PRIMARY KEY,
|
||||
title text NOT NULL CHECK (char_length(title) BETWEEN 1 AND 100),
|
||||
created_at timestamptz(3) NOT NULL DEFAULT clock_timestamp()
|
||||
);
|
||||
CREATE TABLE chat_members (
|
||||
chat_id uuid NOT NULL REFERENCES chats(id),
|
||||
user_id uuid NOT NULL REFERENCES users(id),
|
||||
PRIMARY KEY (chat_id, user_id)
|
||||
);
|
||||
CREATE TABLE messages (
|
||||
id uuid PRIMARY KEY,
|
||||
chat_id uuid NOT NULL,
|
||||
sender_id uuid NOT NULL,
|
||||
text text NOT NULL CHECK (char_length(text) BETWEEN 1 AND 4000),
|
||||
created_at timestamptz(3) NOT NULL DEFAULT clock_timestamp(),
|
||||
FOREIGN KEY (chat_id, sender_id) REFERENCES chat_members(chat_id, user_id)
|
||||
);
|
||||
CREATE TABLE sessions (
|
||||
token_hash text PRIMARY KEY,
|
||||
user_id uuid NOT NULL REFERENCES users(id),
|
||||
expires_at timestamptz(3) NOT NULL
|
||||
);
|
||||
CREATE TABLE app_settings (key text PRIMARY KEY, value text NOT NULL);
|
||||
CREATE INDEX messages_history ON messages(chat_id, created_at, id);
|
||||
CREATE INDEX chats_order ON chats(created_at, id);
|
||||
CREATE INDEX member_chats ON chat_members(user_id, chat_id);
|
||||
CREATE INDEX sessions_expiry ON sessions(expires_at);
|
||||
@@ -0,0 +1,11 @@
|
||||
CREATE TABLE message_requests (
|
||||
user_id uuid NOT NULL REFERENCES users(id),
|
||||
chat_id uuid NOT NULL REFERENCES chats(id),
|
||||
key text NOT NULL,
|
||||
text text NOT NULL,
|
||||
message_id uuid NOT NULL REFERENCES messages(id),
|
||||
response jsonb NOT NULL,
|
||||
expires_at timestamptz NOT NULL,
|
||||
PRIMARY KEY (user_id, chat_id, key)
|
||||
);
|
||||
CREATE INDEX message_requests_expiry ON message_requests(expires_at);
|
||||
@@ -0,0 +1,25 @@
|
||||
CREATE TABLE attachments (
|
||||
id uuid PRIMARY KEY,
|
||||
chat_id uuid NOT NULL REFERENCES chats(id),
|
||||
owner_id uuid NOT NULL REFERENCES users(id),
|
||||
filename text NOT NULL CHECK (char_length(filename) BETWEEN 1 AND 255),
|
||||
content_type text NOT NULL CHECK (content_type IN ('image/png','image/jpeg')),
|
||||
size_bytes integer NOT NULL CHECK (size_bytes BETWEEN 1 AND 10485760),
|
||||
sha256 text NOT NULL,
|
||||
object_key text NOT NULL UNIQUE,
|
||||
created_at timestamptz(3) NOT NULL DEFAULT clock_timestamp(),
|
||||
updated_at timestamptz(3) NOT NULL DEFAULT clock_timestamp(),
|
||||
UNIQUE (id,chat_id)
|
||||
);
|
||||
CREATE INDEX attachments_chat ON attachments(chat_id);
|
||||
ALTER TABLE messages DROP CONSTRAINT messages_text_check;
|
||||
ALTER TABLE messages ADD CONSTRAINT messages_text_check CHECK (char_length(text) BETWEEN 0 AND 4000);
|
||||
CREATE TABLE message_attachments (
|
||||
message_id uuid NOT NULL REFERENCES messages(id),
|
||||
attachment_id uuid NOT NULL REFERENCES attachments(id),
|
||||
position integer NOT NULL,
|
||||
PRIMARY KEY (message_id,attachment_id),
|
||||
UNIQUE (message_id,position)
|
||||
);
|
||||
ALTER TABLE message_requests ADD COLUMN attachment_ids uuid[] NOT NULL DEFAULT '{}';
|
||||
UPDATE message_requests SET response = response || '{"attachment_ids":[]}'::jsonb;
|
||||
@@ -0,0 +1,10 @@
|
||||
ALTER TABLE attachments ADD COLUMN status text NOT NULL DEFAULT 'ready'
|
||||
CHECK (status IN ('queued','processing','ready','failed'));
|
||||
ALTER TABLE attachments ADD COLUMN error_code text;
|
||||
ALTER TABLE attachments ADD COLUMN variants jsonb NOT NULL DEFAULT '[]';
|
||||
ALTER TABLE attachments ADD COLUMN staging_key text;
|
||||
CREATE TABLE attachment_jobs (
|
||||
id uuid PRIMARY KEY, attachment_id uuid NOT NULL UNIQUE REFERENCES attachments(id),
|
||||
pipeline_version integer NOT NULL DEFAULT 1 CHECK (pipeline_version=1),
|
||||
attempts integer NOT NULL DEFAULT 0, created_at timestamptz(3) NOT NULL DEFAULT clock_timestamp()
|
||||
);
|
||||
@@ -0,0 +1 @@
|
||||
CREATE TABLE login_limits (key text PRIMARY KEY, window_start timestamptz NOT NULL, attempts integer NOT NULL);
|
||||
Generated
+1868
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,26 @@
|
||||
{
|
||||
"name": "mtusi-lab7-messenger",
|
||||
"version": "1.0.0",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"start": "node src/start.js",
|
||||
"migrate": "node src/migrate.js"
|
||||
},
|
||||
"dependencies": {
|
||||
"@node-rs/argon2": "2.0.2",
|
||||
"@opentelemetry/api": "1.9.0",
|
||||
"@opentelemetry/api-logs": "0.57.2",
|
||||
"@opentelemetry/exporter-logs-otlp-proto": "0.57.2",
|
||||
"@opentelemetry/exporter-metrics-otlp-proto": "0.57.2",
|
||||
"@opentelemetry/exporter-trace-otlp-proto": "0.57.2",
|
||||
"@opentelemetry/resources": "1.30.1",
|
||||
"@opentelemetry/sdk-logs": "0.57.2",
|
||||
"@opentelemetry/sdk-metrics": "1.30.1",
|
||||
"@opentelemetry/sdk-trace-base": "1.30.1",
|
||||
"@opentelemetry/sdk-trace-node": "1.30.1",
|
||||
"amqplib": "0.10.8",
|
||||
"minio": "8.0.7",
|
||||
"pg": "8.16.3",
|
||||
"sharp": "0.35.5"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
cryptography==46.0.3
|
||||
@@ -0,0 +1,38 @@
|
||||
"""Operator-only init/unseal/configure. Never prints or mounts operator credentials."""
|
||||
from pathlib import Path
|
||||
import json,ssl,urllib.request,urllib.error,os,sys,time
|
||||
ROOT=Path(__file__).resolve().parents[1]
|
||||
os.chdir(ROOT)
|
||||
def context(role=None):
|
||||
ctx=ssl.create_default_context(cafile='certs/ca.crt')
|
||||
if role:ctx.load_cert_chain('certs/'+role+'.crt','certs/'+role+'.key')
|
||||
return ctx
|
||||
def call(path,data=None,token=None,role=None):
|
||||
req=urllib.request.Request('https://localhost:8207/v1/'+path,data=None if data is None else json.dumps(data).encode(),headers={'Content-Type':'application/json',**({'X-Vault-Token':token} if token else {})})
|
||||
with urllib.request.urlopen(req,context=context(role),timeout=10) as res:
|
||||
body=res.read();return json.loads(body) if body else {}
|
||||
def main():
|
||||
state=Path('operator/bao-init.json')
|
||||
if not call('sys/init')['initialized']:
|
||||
if state.exists():raise RuntimeError('Existing operator backup but Bao storage is empty; restore storage or explicitly start a new lab.')
|
||||
result=call('sys/init',{'secret_shares':1,'secret_threshold':1})
|
||||
state.write_text(json.dumps(result),encoding='utf8');state.chmod(0o600)
|
||||
if not state.exists():raise RuntimeError('Operator unseal backup required')
|
||||
saved=json.loads(state.read_text())
|
||||
if call('sys/seal-status')['sealed']:call('sys/unseal',{'key':saved['keys_base64'][0]})
|
||||
if '--unseal-only' in sys.argv:
|
||||
print('PASS: OpenBao unsealed by operator; no keys sent to application containers.');return
|
||||
root=saved['root_token']
|
||||
mounts=call('sys/mounts',token=root)
|
||||
if 'secret/' not in mounts:call('sys/mounts/secret',{'type':'kv','options':{'version':'2'}},root)
|
||||
auth=call('sys/auth',token=root)
|
||||
if 'cert/' not in auth:call('sys/auth/cert',{'type':'cert'},root)
|
||||
c=json.loads(Path('operator/credentials.json').read_text())
|
||||
for role in ['api','worker']:
|
||||
call('sys/policies/acl/'+role,{'policy':Path('infra/openbao/'+role+'.hcl').read_text()},root)
|
||||
call('auth/cert/certs/'+role,{'certificate':Path('certs/ca.crt').read_text(),'allowed_dns_sans':[role],'token_policies':[role],'token_ttl':300,'token_max_ttl':600,'token_no_default_policy':True},root)
|
||||
call('secret/data/'+role,{'data':{'database_url':'postgresql://'+role+':'+c['db_'+role]+'@db:5432/messenger','broker_url':'amqps://'+role+':'+c['rabbit_'+role]+'@broker:5671/messenger?heartbeat=5','s3_access_key':role,'s3_secret_key':c['s3_'+role]}},root)
|
||||
print('PASS: persistent OpenBao initialized/unsealed; cert-auth roles and scoped KV policies configured.')
|
||||
if __name__=='__main__':
|
||||
try:main()
|
||||
except urllib.error.HTTPError as e:raise SystemExit('OpenBao operation rejected: HTTP '+str(e.code))
|
||||
@@ -0,0 +1,18 @@
|
||||
"""Verify provisioned dashboards using authenticated HTTPS without exporting credentials."""
|
||||
from pathlib import Path
|
||||
import json,ssl,urllib.request,base64
|
||||
ROOT=Path(__file__).resolve().parents[1]
|
||||
ctx=ssl.create_default_context(cafile=str(ROOT/'certs/ca.crt'))
|
||||
password=(ROOT/'secrets/grafana_password').read_text().strip()
|
||||
headers={'Authorization':'Basic '+base64.b64encode(('admin:'+password).encode()).decode()}
|
||||
def get(path):
|
||||
with urllib.request.urlopen(urllib.request.Request('https://localhost:3447'+path,headers=headers),context=ctx,timeout=20) as r:return json.load(r)
|
||||
dashboard=get('/api/dashboards/uid/messenger-lab7')
|
||||
assert len(dashboard['dashboard']['panels'])==9
|
||||
result={'dashboard_uid':'messenger-lab7','panel_count':9,'datasources':{}}
|
||||
for name,path in [('prometheus','/api/v1/query?query=messenger_http_requests_total'),('loki','/loki/api/v1/labels'),('tempo','/api/search?limit=5')]:
|
||||
value=get('/api/datasources/proxy/uid/'+name+path)
|
||||
assert value
|
||||
result['datasources'][name]='verified HTTPS/mTLS query via Grafana'
|
||||
(ROOT/'evidence/grafana.json').write_text(json.dumps(result,indent=2)+'\n',encoding='utf8')
|
||||
print('PASS: authenticated Grafana HTTPS, nine provisioned panels, real queries through all three TLS/mTLS data sources.')
|
||||
@@ -0,0 +1,22 @@
|
||||
"""Inspect only safe Docker configuration fields, never Env or full inspect output."""
|
||||
from pathlib import Path
|
||||
import json,subprocess
|
||||
ROOT=Path(__file__).resolve().parents[1]
|
||||
ids=subprocess.check_output(['docker','compose','ps','-q'],cwd=ROOT,text=True).split()
|
||||
raw=json.loads(subprocess.check_output(['docker','inspect',*ids],text=True))
|
||||
result=[]
|
||||
for c in raw:
|
||||
h=c['HostConfig'];service=c['Config']['Labels']['com.docker.compose.service']
|
||||
assert not h['Privileged'] and h['NetworkMode']!='host'
|
||||
assert not any('docker.sock' in m['Source'] for m in c['Mounts'])
|
||||
assert h['Memory']>0 and h['NanoCpus']>0
|
||||
ports=h.get('PortBindings') or {}
|
||||
for bindings in ports.values():
|
||||
for b in bindings or []:assert b['HostIp']=='127.0.0.1'
|
||||
if service in ['api1','api2','worker']:
|
||||
assert c['Config']['User']=='1000:1000'
|
||||
assert 'ALL' in h['CapDrop'] and 'no-new-privileges:true' in h['SecurityOpt']
|
||||
assert all(m['Destination'] in ['/tls/ca.crt','/tls/cert.crt','/tls/key.pem'] for m in c['Mounts'])
|
||||
result.append({'service':service,'user':c['Config']['User'],'memory_bytes':h['Memory'],'nano_cpus':h['NanoCpus'],'privileged':False,'published_ports':ports,'cap_drop':h.get('CapDrop'),'security_opt':h.get('SecurityOpt')})
|
||||
(ROOT/'evidence/hardening.json').write_text(json.dumps(result,indent=2)+'\n')
|
||||
print('PASS: non-root API/worker, dropped capabilities, resource limits, no privileged/host-network/socket; only localhost TLS/admin ports exposed; app mounts contain only its leaf key/cert and public CA.')
|
||||
@@ -0,0 +1,34 @@
|
||||
"""Explicit operator lifecycle hooks; volumes and secrets are preserved."""
|
||||
from pathlib import Path
|
||||
import subprocess,sys,os,json,time,urllib.error
|
||||
import bao
|
||||
ROOT=Path(__file__).resolve().parents[1];os.chdir(ROOT)
|
||||
def dc(*args):return subprocess.check_output(['docker','compose',*args],text=True,stderr=subprocess.DEVNULL).strip()
|
||||
def snapshot():
|
||||
ids=dc('ps','-a','-q').splitlines()
|
||||
data=json.loads(subprocess.check_output(['docker','inspect',*ids],text=True))
|
||||
return [{'service':x['Config']['Labels']['com.docker.compose.service'],'container':x['Id'],'started_at':x['State']['StartedAt'],'running':x['State']['Running'],'volumes':[v['Name'] for v in x['Mounts'] if v['Type']=='volume']} for x in data if x['Config']['Labels']['com.docker.compose.service'] not in ['migrate','s3-init','checks']]
|
||||
def main():
|
||||
action=sys.argv[1];before=snapshot()
|
||||
if action=='restart':
|
||||
dc('stop');dc('up','-d','db','s3','broker','bao','otel-collector','prometheus','loki','tempo','grafana','otel-collector-tls','prometheus-tls','loki-tls','tempo-tls')
|
||||
for i in range(40):
|
||||
try:bao.call('sys/init');break
|
||||
except urllib.error.URLError:time.sleep(1)
|
||||
# This script runs on the operator host, never inside an application container.
|
||||
saved=json.loads((ROOT/'operator/bao-init.json').read_text())
|
||||
if bao.call('sys/seal-status')['sealed']:bao.call('sys/unseal',{'key':saved['keys_base64'][0]})
|
||||
dc('up','-d','--wait','--wait-timeout','40','api1','api2','worker');dc('up','-d','lb')
|
||||
elif action=='stop-one':
|
||||
target=os.environ['TARGET_INSTANCE_ID'];selected=None
|
||||
for service in ['api1','api2']:
|
||||
value=dc('exec','-T',service,'node','-e',"fetch('http://127.0.0.1:9001/health/live').then(r=>console.log(r.headers.get('x-instance-id')))")
|
||||
if value==target:selected=service;break
|
||||
if not selected:raise RuntimeError('Unknown API instance')
|
||||
dc('stop','-t','2',selected)
|
||||
elif action=='restore':dc('up','-d','--wait','api1','api2')
|
||||
else:raise RuntimeError('Unknown action')
|
||||
after=snapshot()
|
||||
(ROOT/'evidence'/('lifecycle-'+action+'.json')).write_text(json.dumps({'before':before,'after':after},indent=2)+'\n')
|
||||
print('PASS: '+action+' complete for lab7; volumes preserved')
|
||||
if __name__=='__main__':main()
|
||||
@@ -0,0 +1,7 @@
|
||||
@echo off
|
||||
if defined LAB_PYTHON (
|
||||
"%LAB_PYTHON%" -X utf8 "%~dp0control.py" restart
|
||||
) else (
|
||||
py -X utf8 "%~dp0control.py" restart
|
||||
)
|
||||
exit /b %errorlevel%
|
||||
@@ -0,0 +1,2 @@
|
||||
#!/bin/sh
|
||||
exec python3 "$(dirname "$0")/control.py" restart
|
||||
@@ -0,0 +1,71 @@
|
||||
"""Local bootstrap material. Requires cryptography; never overwrites existing keys/secrets."""
|
||||
from pathlib import Path
|
||||
from datetime import datetime,timedelta,timezone
|
||||
import json,secrets,shutil,hashlib,base64,os
|
||||
from cryptography import x509
|
||||
from cryptography.x509.oid import NameOID,ExtendedKeyUsageOID
|
||||
from cryptography.hazmat.primitives import hashes,serialization
|
||||
from cryptography.hazmat.primitives.asymmetric import rsa
|
||||
ROOT=Path(__file__).resolve().parents[1]
|
||||
os.chdir(ROOT)
|
||||
for d in ['certs','operator','secrets']:
|
||||
Path(d).mkdir(exist_ok=True);Path(d).chmod(0o700)
|
||||
def write(path,value,mode=0o644):
|
||||
p=Path(path);p.parent.mkdir(parents=True,exist_ok=True);p.write_bytes(value if isinstance(value,bytes) else value.encode());p.chmod(mode)
|
||||
def make_ca(name):
|
||||
certpath=Path('certs/'+name+'.crt');keypath=Path('operator/'+name+'.key')
|
||||
if certpath.exists() and keypath.exists():return x509.load_pem_x509_certificate(certpath.read_bytes()),serialization.load_pem_private_key(keypath.read_bytes(),None)
|
||||
if certpath.exists() or keypath.exists():raise SystemExit('Incomplete CA: restore operator backup')
|
||||
key=rsa.generate_private_key(public_exponent=65537,key_size=3072)
|
||||
nameobj=x509.Name([x509.NameAttribute(NameOID.COMMON_NAME,name)])
|
||||
now=datetime.now(timezone.utc)
|
||||
cert=x509.CertificateBuilder().subject_name(nameobj).issuer_name(nameobj).public_key(key.public_key()).serial_number(x509.random_serial_number()).not_valid_before(now-timedelta(minutes=5)).not_valid_after(now+timedelta(days=365)).add_extension(x509.BasicConstraints(ca=True,path_length=0),critical=True).add_extension(x509.KeyUsage(True,False,False,False,False,True,True,False,False),critical=True).sign(key,hashes.SHA256())
|
||||
write(certpath,cert.public_bytes(serialization.Encoding.PEM));write(keypath,key.private_bytes(serialization.Encoding.PEM,serialization.PrivateFormat.PKCS8,serialization.NoEncryption()),0o600)
|
||||
return cert,key
|
||||
ca,cakey=make_ca('ca');bad,badkey=make_ca('untrusted-ca')
|
||||
for name in ['lb','api1','api2','worker','db','s3','broker','bao','collector','prometheus','loki','tempo','grafana','operator','wrong-ca']:
|
||||
if Path('certs/'+name+'.key').exists():continue
|
||||
issuer,issuerkey=(bad,badkey) if name=='wrong-ca' else (ca,cakey)
|
||||
key=rsa.generate_private_key(public_exponent=65537,key_size=2048);now=datetime.now(timezone.utc)
|
||||
names=[name]
|
||||
if name in ['api1','api2']:names.append('api')
|
||||
if name in ['lb','bao','grafana']:names.append('localhost')
|
||||
if name=='collector':names.append('otel-collector')
|
||||
cert=x509.CertificateBuilder().subject_name(x509.Name([x509.NameAttribute(NameOID.COMMON_NAME,name)])).issuer_name(issuer.subject).public_key(key.public_key()).serial_number(x509.random_serial_number()).not_valid_before(now-timedelta(minutes=5)).not_valid_after(now+timedelta(days=30)).add_extension(x509.BasicConstraints(ca=False,path_length=None),True).add_extension(x509.SubjectAlternativeName([x509.DNSName(n) for n in names]),False).add_extension(x509.ExtendedKeyUsage([ExtendedKeyUsageOID.SERVER_AUTH,ExtendedKeyUsageOID.CLIENT_AUTH]),False).sign(issuerkey,hashes.SHA256())
|
||||
pub=cert.public_bytes(serialization.Encoding.PEM);priv=key.private_bytes(serialization.Encoding.PEM,serialization.PrivateFormat.PKCS8,serialization.NoEncryption())
|
||||
write('certs/'+name+'.crt',pub);write('certs/'+name+'.key',priv);write('certs/'+name+'.pem',pub+priv)
|
||||
# Individual key files are readable by non-root container users; the host directory is private.
|
||||
file=Path('operator/credentials.json')
|
||||
if not file.exists():write(file,json.dumps({k:secrets.token_hex(24) for k in ['db_admin','db_api','db_worker','s3_admin','s3_api','s3_worker','rabbit_api','rabbit_worker','grafana']},indent=2),0o600)
|
||||
c=json.loads(file.read_text())
|
||||
write('secrets/postgres_password',c['db_admin']);write('secrets/database_url','postgresql://messenger:'+c['db_admin']+'@db:5432/messenger')
|
||||
write('secrets/s3_admin_user','localadmin');write('secrets/s3_admin_password',c['s3_admin']);write('secrets/grafana_password',c['grafana'])
|
||||
write('secrets/roles.sql',f"CREATE ROLE api LOGIN PASSWORD '{c['db_api']}';\nCREATE ROLE worker LOGIN PASSWORD '{c['db_worker']}';\nREVOKE CREATE ON SCHEMA public FROM PUBLIC;\n")
|
||||
write('secrets/pg_hba.conf','local all all trust\nhostnossl all all all reject\nhostssl messenger messenger all scram-sha-256\nhostssl messenger api all scram-sha-256\nhostssl messenger worker all scram-sha-256\nhostssl all all all reject\n')
|
||||
users=[]
|
||||
for role in ['api','worker']:
|
||||
salt=secrets.token_bytes(4);hashed=base64.b64encode(salt+hashlib.sha256(salt+c['rabbit_'+role].encode()).digest()).decode()
|
||||
users.append({'name':role,'password_hash':hashed,'hashing_algorithm':'rabbit_password_hashing_sha256','tags':[]})
|
||||
write('secrets/rabbit-definitions.json',json.dumps({'users':users,'vhosts':[{'name':'messenger'}],'permissions':[{'user':role,'vhost':'messenger','configure':'^attachments\\.v1$','write':'^(attachments\\.v1|amq\\.default)$','read':'^attachments\\.v1$' if role=='worker' else '^$'} for role in ['api','worker']]}))
|
||||
write('secrets/rabbitmq.conf','listeners.tcp = none\nlisteners.ssl.default = 5671\nssl_options.cacertfile = /tls/ca.crt\nssl_options.certfile = /tls/cert.crt\nssl_options.keyfile = /tls/key.pem\nssl_options.verify = verify_none\nssl_options.fail_if_no_peer_cert = false\nload_definitions = /etc/rabbitmq/definitions.json\n')
|
||||
# JSON is also valid YAML; secureJsonData stays in ignored local secrets.
|
||||
sources=[]
|
||||
for name,kind,url in [('Prometheus','prometheus','https://prometheus:3443'),('Loki','loki','https://loki:3443'),('Tempo','tempo','https://tempo:3443')]:
|
||||
data={'name':name,'uid':kind,'type':kind,'access':'proxy','url':url,'editable':False,'isDefault':kind=='prometheus','jsonData':{'tlsAuth':True,'tlsAuthWithCACert':True,'serverName':kind},'secureJsonData':{'tlsCACert':Path('certs/ca.crt').read_text(),'tlsClientCert':Path('certs/grafana.crt').read_text(),'tlsClientKey':Path('certs/grafana.key').read_text()}}
|
||||
if kind=='loki':data['jsonData']['derivedFields']=[{'name':'TraceID','matcherRegex':'"trace_id":"([a-f0-9]{32})"','datasourceUid':'tempo','url':'$${__value.raw}','urlDisplayLabel':'View trace'}]
|
||||
sources.append(data)
|
||||
write('secrets/datasources.yaml',json.dumps({'apiVersion':1,'datasources':sources},indent=2))
|
||||
# One-time S3 provisioning input, not present in application containers.
|
||||
script='set -eu\nmc alias set local https://s3:9000 localadmin '+c['s3_admin']+' >/dev/null\nmc mb --ignore-existing local/messenger-attachments >/dev/null\n'
|
||||
for role in ['api','worker']:
|
||||
prefix='arn:aws:s3:::messenger-attachments/'
|
||||
statements=[{'Effect':'Allow','Action':['s3:GetBucketLocation','s3:ListBucket'],'Resource':['arn:aws:s3:::messenger-attachments']}]
|
||||
if role=='api':
|
||||
statements += [{'Effect':'Allow','Action':['s3:PutObject','s3:DeleteObject'],'Resource':[prefix+'staging/*']},{'Effect':'Allow','Action':['s3:GetObject'],'Resource':[prefix+'originals/*',prefix+'variants/*']}]
|
||||
else:
|
||||
statements += [{'Effect':'Allow','Action':['s3:GetObject'],'Resource':[prefix+'staging/*']},{'Effect':'Allow','Action':['s3:PutObject'],'Resource':[prefix+'originals/*',prefix+'variants/*']}]
|
||||
write('secrets/s3-'+role+'.json',json.dumps({'Version':'2012-10-17','Statement':statements}))
|
||||
script+=f'mc admin user add local {role} {c["s3_"+role]} >/dev/null\nmc admin policy create local {role} /config/s3-{role}.json >/dev/null\nmc admin policy attach local {role} --user {role} >/dev/null\n'
|
||||
write('secrets/s3-init.sh',script)
|
||||
if not Path('.env').exists():shutil.copyfile('.env.example','.env')
|
||||
print('PASS: local certificates and bootstrap material ready; secret values not printed.')
|
||||
@@ -0,0 +1,8 @@
|
||||
@echo off
|
||||
if defined LAB_PYTHON (
|
||||
"%LAB_PYTHON%" -X utf8 "%~dp0control.py" stop-one
|
||||
) else (
|
||||
py -X utf8 "%~dp0control.py" stop-one
|
||||
)
|
||||
exit /b %errorlevel%
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
#!/bin/sh
|
||||
exec python3 "$(dirname "$0")/control.py" stop-one
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
"""Repeatable local operator startup; no secret values in output."""
|
||||
from pathlib import Path
|
||||
import subprocess,sys,time,urllib.error
|
||||
import bao
|
||||
ROOT=Path(__file__).resolve().parents[1]
|
||||
def run(*args):subprocess.run(args,cwd=ROOT,check=True)
|
||||
def main():
|
||||
run(sys.executable,str(ROOT/'scripts/setup.py'))
|
||||
run('docker','compose','build')
|
||||
run('docker','compose','up','-d','db','s3','broker','bao','otel-collector','prometheus','loki','tempo','grafana','otel-collector-tls','prometheus-tls','loki-tls','tempo-tls')
|
||||
for i in range(60):
|
||||
try:bao.call('sys/init');break
|
||||
except (urllib.error.URLError,TimeoutError):time.sleep(1)
|
||||
else:raise RuntimeError('OpenBao listener unavailable')
|
||||
bao.main()
|
||||
run('docker','compose','run','--rm','migrate')
|
||||
run('docker','compose','run','--rm','s3-init')
|
||||
run('docker','compose','up','-d','--wait','--wait-timeout','90','api1','api2','worker')
|
||||
run('docker','compose','up','-d','lb')
|
||||
run('docker','compose','restart','lb')
|
||||
print('PASS: lab7 started. HTTPS https://localhost:8443; CA certs/ca.crt')
|
||||
if __name__=='__main__':main()
|
||||
+14
-16
@@ -1,19 +1,17 @@
|
||||
# Модель угроз — заполнить
|
||||
# Модель угроз — учебный lab7
|
||||
|
||||
## Активы и акторы
|
||||
Активы: пароли и сессии, сообщения и приватные изображения, ключи сервисов/CA, root/unseal OpenBao, целостность заданий и телеметрии. Акторы: анонимный клиент, участник/посторонний чатам, процесс в Docker-сети без разрешённой identity, скомпрометированный worker, доверенный оператор. Доступ к Docker host и операторским ключам находится за границей модели; это не production-стенд.
|
||||
|
||||
TODO: пользовательские credentials/сессии, сообщения/вложения, service identities, CA/secrets, telemetry. Акторы: участник чата, посторонний пользователь, внешний клиент, скомпрометированный сервис, оператор. Опишите доступ атакующего и границы учебного стенда.
|
||||
| Угроза | Контроль | Доказательство |
|
||||
| --- | --- | --- |
|
||||
| Перехват Basic/Bearer | HTTPS с CA и SAN, внутренние TLS-соединения | external-tls.txt, security.txt |
|
||||
| Обход LB/поддельный сервис | API-порты не опубликованы, обязательное mTLS + SAN lb | security.txt; проверены обе реплики |
|
||||
| Чтение чужого чата/изображения | Bearer → membership check, единый 404, X-User-Id не заменяет identity | smoke.txt |
|
||||
| Перебор паролей | Argon2id 19 MiB, t=2,p=1; общий лимит 30 login/60 секунд по IP от доверенного LB; 429/Retry-After | argon2.json, security.txt |
|
||||
| Кража worker credentials | отдельные KV/DB/S3/broker права, нет users/sessions, запрещён чужой secret path | security.txt |
|
||||
| Подмена/заливка телеметрии | mTLS роли, query/ingest ACL, непубличные native listeners | security.txt, telemetry.txt |
|
||||
| Утечка секретов в Git/логи | файлы оператора не монтируются в app, структурные allowlisted поля, нет SQL/body/Authorization в логах | telemetry.txt, archive-check.txt |
|
||||
| Большой/опасный upload | 10 MiB, 40M pixels, PNG/JPEG magic/decode, random object key; non-root worker с лимитами | smoke.txt, compose.yaml |
|
||||
| Повтор сообщения/задания | транзакционная идемпотентность, durable queue, bounded retry, ACK после результата | smoke.txt, persistence.txt, telemetry.txt |
|
||||
|
||||
## Границы доверия
|
||||
|
||||
TODO: схема и ссылка на заполненную contracts/trust-matrix.md; публичные/внутренние интерфейсы, процессы, секреты и их выдача.
|
||||
|
||||
| Угроза и конкретный путь | Нарушаемый инвариант | Контроль | Отрицательный тест | Остаточное ограничение |
|
||||
| --- | --- | --- | --- | --- |
|
||||
| TODO | TODO | TODO | TODO | TODO |
|
||||
|
||||
На 4 минимум 6 конкретных угроз. Не заменяйте сценарии словами «SQL injection», «безопасный Docker», «mTLS включён» без пути и проверки.
|
||||
|
||||
## Lifecycle и инциденты
|
||||
|
||||
TODO: bootstrap, expiry/renewal, revoke/rotation, компрометация identity, sealed OpenBao и восстановление. Указать владельца CA/unseal и способ защиты bootstrap credentials. Сопоставить scan findings с реальной применимостью и исправлением/остаточным риском.
|
||||
Ограничения: один Docker host, без HA у хранилищ; статические KV secrets; bootstrap cert/key — долгоживущая сервисная identity на 30 дней, защищается файловыми правами; ротация и CRL не реализованы. Лимит login не защищает от распределённой атаки и от массовой регистрации. Один IP может временно ограничить других клиентов за NAT. Политики ограничивают роль, а не каждый индивидуальный чат внутри DB/S3; ACL пользователей выполняет API. Компрометация API даёт доступ ко всем его бизнес-таблицам. Не заявляется отсутствие всех CVE: см. dependency-triage.md.
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
# Разбор dependency audit — lab7
|
||||
|
||||
Фактический npm audit после обновления MinIO JS 8.0.7 и sharp 0.35.5: 18 affected package entries (13 moderate, 5 high), critical=0. Это не 18 независимых ошибок: часть записей — транзитивные зависимости и их родительские пакеты. Полный машинный вывод: evidence/dependency-audit.json. Изображения обрабатывает обновлённый sharp; найденные предупреждения его старого libvips после обновления исчезли. Не утверждается, что все компоненты не имеют CVE.
|
||||
|
||||
| Группа | Применимость в этом стенде / решение |
|
||||
| --- | --- |
|
||||
| OTel core: unbounded W3C Baggage | В Compose явно установлен OTEL_PROPAGATORS=tracecontext. Baggage не используется; HTTP передаёт в extractor только traceparent/tracestate. SDK остаётся в аудите; перед публичной эксплуатацией нужен переход на исправленную согласованную версию SDK. |
|
||||
| JaegerPropagator: malformed header DoS | Jaeger propagator не включён (только tracecontext), пользовательский Jaeger header не передаётся. Модуль присутствует как зависимость SDK, поэтому audit high сохраняется. |
|
||||
| MinIO/query-string/decode-uri-component | Сохранились транзитивные предупреждения. S3 endpoint/bucket задаются оператором, object keys создаёт сервер из UUID; filename не используется в S3 URL. Прямой доступ к уязвимому decoder через произвольный пользовательский URL в текущем API не предусмотрен. Это ограничение достижимости, а не исправление библиотеки. |
|
||||
| stream-json | Используется в MinIO notification client; подписки на уведомления в решении не вызываются, брокер использует отдельную JSON-схему и amqplib. Замена версии требует совместимости; остаточный риск при будущем включении этого API. |
|
||||
|
||||
В локальном стенде публикуются только loopback TLS/admin endpoints. Worker/API имеют лимиты памяти и CPU. Эти меры не заменяют обновления библиотек. Blind npm audit fix --force не применялся: он предлагает несовместимые SDK и откат MinIO. Полный image/CVE scan и production hardening уровня 4 не заявлены; образы закреплены тегами, автоматическое обновление не включено. Для внешнего production-развёртывания нужен отдельный цикл обновления и повторных тестов.
|
||||
@@ -0,0 +1,110 @@
|
||||
'use strict';
|
||||
const sharp = require('sharp');
|
||||
const { randomUUID, createHash } = require('node:crypto');
|
||||
const { pool, transaction } = require('./db');
|
||||
const broker = require('./broker');
|
||||
const { client, bucket, unavailable } = require('./storage');
|
||||
const MAX_BYTES = 10485760, MAX_PIXELS = 40000000;
|
||||
sharp.cache(false);
|
||||
function fail(status, code, message) { throw Object.assign(new Error(message), { status, code }); }
|
||||
function visible(row) {
|
||||
const { object_key, staging_key, ...data } = row;
|
||||
return data;
|
||||
}
|
||||
function readLimited(req) {
|
||||
return new Promise((resolve, reject) => {
|
||||
let size = 0, failed = false;
|
||||
const chunks = [];
|
||||
const tooLarge = () => {
|
||||
failed = true;
|
||||
reject(Object.assign(new Error('File exceeds 10 MiB'), { status: 413, code: 'payload_too_large' }));
|
||||
};
|
||||
if (Number(req.headers['content-length'] || 0) > MAX_BYTES) { req.resume(); tooLarge(); return; }
|
||||
req.on('data', chunk => {
|
||||
if (failed) return;
|
||||
size += chunk.length;
|
||||
if (size > MAX_BYTES) { chunks.length = 0; tooLarge(); }
|
||||
else chunks.push(chunk);
|
||||
});
|
||||
req.on('end', () => { if (!failed) resolve(Buffer.concat(chunks)); });
|
||||
req.on('error', () => reject(Object.assign(new Error('Upload interrupted'), { status: 400, code: 'invalid_request' })));
|
||||
});
|
||||
}
|
||||
async function validateImage(bytes, contentType) {
|
||||
// Reject other formats before asking the image decoder to process them.
|
||||
const png = bytes.length >= 8 && bytes.subarray(0, 8).equals(Buffer.from([137,80,78,71,13,10,26,10]));
|
||||
const jpeg = bytes.length >= 3 && bytes[0] === 255 && bytes[1] === 216 && bytes[2] === 255;
|
||||
if ((!png && !jpeg) || (png ? 'image/png' : 'image/jpeg') !== contentType)
|
||||
fail(415, 'unsupported_media_type', 'Expected a matching PNG or JPEG');
|
||||
try {
|
||||
const decoder = sharp(bytes, { limitInputPixels: MAX_PIXELS, failOn: 'warning' });
|
||||
const info = await decoder.metadata();
|
||||
if (!info.width || !info.height || info.width * info.height > MAX_PIXELS)
|
||||
fail(413, 'payload_too_large', 'Image exceeds 40 million pixels');
|
||||
if (!['png', 'jpeg'].includes(info.format)) fail(415, 'unsupported_media_type', 'Unsupported image');
|
||||
// Full decoding detects truncated/corrupt payloads; the raw result is discarded.
|
||||
// Pixel limit is enforced before allocation. Original bytes are never transformed.
|
||||
await decoder.raw().toBuffer();
|
||||
} catch (error) {
|
||||
if (error.status) throw error;
|
||||
if (/pixel limit/i.test(error.message)) fail(413, 'payload_too_large', 'Image exceeds 40 million pixels');
|
||||
fail(415, 'unsupported_media_type', 'Corrupt image');
|
||||
}
|
||||
}
|
||||
async function upload(req, query, chat, user) {
|
||||
const filename = query.get('filename');
|
||||
if (query.getAll('filename').length !== 1 || !filename || !filename.isWellFormed() ||
|
||||
/^[\p{White_Space}\uFEFF]*$/u.test(filename) || [...filename].length > 255 || /[\/\\\p{Cc}]/u.test(filename))
|
||||
fail(400, 'invalid_request', 'Invalid filename');
|
||||
const contentType = req.headers['content-type']?.split(';')[0].trim().toLowerCase();
|
||||
if (!['image/png', 'image/jpeg'].includes(contentType)) fail(415, 'unsupported_media_type', 'Expected PNG or JPEG');
|
||||
const bytes = await readLimited(req);
|
||||
await validateImage(bytes, contentType);
|
||||
const id = randomUUID(), objectKey = 'staging/' + id;
|
||||
const checksum = createHash('sha256').update(bytes).digest('hex');
|
||||
try { await client.putObject(bucket, objectKey, bytes, bytes.length, { 'Content-Type': contentType }); }
|
||||
catch { throw unavailable(); }
|
||||
let accepted;
|
||||
try {
|
||||
accepted = await transaction(async db => {
|
||||
const row = (await db.query(`INSERT INTO attachments
|
||||
(id,chat_id,owner_id,filename,content_type,size_bytes,sha256,object_key,staging_key,status)
|
||||
VALUES($1,$2,$3,$4,$5,$6,$7,$8,$9,'queued') RETURNING *`,
|
||||
[id,chat.id,user.id,filename,contentType,bytes.length,checksum,'originals/'+id+'/v1',objectKey])).rows[0];
|
||||
const job = (await db.query('INSERT INTO attachment_jobs(id,attachment_id) VALUES($1,$2) RETURNING *',
|
||||
[randomUUID(),id])).rows[0];
|
||||
return {row,job};
|
||||
});
|
||||
} catch (error) {
|
||||
await client.removeObject(bucket,objectKey).catch(() => {});
|
||||
throw error;
|
||||
}
|
||||
// No 202 until the persistent job has a publisher confirm. A failed publish
|
||||
// leaves an unconfirmed queued row; grade 3 has no outbox/reconciler.
|
||||
try { await broker.publish(accepted.job); }
|
||||
catch { throw Object.assign(new Error('Broker unavailable'),{status:503,code:'unavailable'}); }
|
||||
return visible(accepted.row);
|
||||
}
|
||||
|
||||
async function accessible(id, user) {
|
||||
const result = await pool.query(`SELECT a.* FROM attachments a WHERE a.id=$1 AND EXISTS
|
||||
(SELECT 1 FROM chat_members WHERE chat_id=a.chat_id AND user_id=$2)`, [id, user.id]);
|
||||
if (!result.rowCount) fail(404, 'not_found', 'Object not found');
|
||||
return result.rows[0];
|
||||
}
|
||||
async function download(row) {
|
||||
try {
|
||||
const stream = await client.getObject(bucket, row.object_key);
|
||||
const chunks = [];
|
||||
let size = 0;
|
||||
for await (const chunk of stream) {
|
||||
size += chunk.length;
|
||||
if (size > MAX_BYTES) { stream.destroy(); throw new Error(); }
|
||||
chunks.push(chunk);
|
||||
}
|
||||
const bytes = Buffer.concat(chunks);
|
||||
if (bytes.length !== row.size_bytes || createHash('sha256').update(bytes).digest('hex') !== row.sha256) throw new Error();
|
||||
return bytes;
|
||||
} catch { throw unavailable(); }
|
||||
}
|
||||
module.exports = { upload, accessible, visible, download, validateImage };
|
||||
@@ -0,0 +1,42 @@
|
||||
'use strict';
|
||||
const amqp = require('amqplib');
|
||||
const telemetry = require('./telemetry');
|
||||
const {readFileSync} = require('node:fs');
|
||||
const queue = 'attachments.v1';
|
||||
let pending;
|
||||
async function open() {
|
||||
const url = process.env.BROKER_URL || readFileSync(process.env.BROKER_URL_FILE || '/run/secrets/broker_url','utf8').trim();
|
||||
const connection = await amqp.connect(url, {timeout: 5000,ca:require('./tls').ca,rejectUnauthorized:true});
|
||||
connection.on('error', () => {});
|
||||
const channel = await connection.createConfirmChannel();
|
||||
channel.on('error', () => {});
|
||||
await channel.assertQueue(queue, {durable: true});
|
||||
return {connection, channel};
|
||||
}
|
||||
async function publisher() {
|
||||
if (!pending) pending = open().then(value => {
|
||||
value.connection.on('close', () => { pending = null; });
|
||||
value.channel.on('close', () => { pending = null; });
|
||||
return value;
|
||||
}).catch(error => { pending = null; throw error; });
|
||||
return pending;
|
||||
}
|
||||
function payload(job, attempt=1) {
|
||||
return {schema_version:1,job_id:job.id,type:'attachment.process.v1',attachment_id:job.attachment_id,
|
||||
pipeline_version:1,attempt,created_at:new Date(job.created_at).toISOString(),...telemetry.carrier()};
|
||||
}
|
||||
async function publish(job, attempt=1, channel) {
|
||||
return telemetry.operation('attachments.publish',telemetry.SpanKind.PRODUCER,async () => {
|
||||
channel = channel || (await publisher()).channel;
|
||||
await new Promise((resolve,reject) => channel.sendToQueue(queue, Buffer.from(JSON.stringify(payload(job,attempt))),
|
||||
{persistent:true,contentType:'application/json',messageId:job.id}, error => error ? reject(error) : resolve()));
|
||||
}, {'messaging.system':'rabbitmq'});
|
||||
}
|
||||
async function ready() {
|
||||
try { await (await publisher()).channel.checkQueue(queue); }
|
||||
catch { throw Object.assign(new Error('Broker unavailable'),{status:503,code:'unavailable'}); }
|
||||
}
|
||||
async function close() {
|
||||
if (pending) { const value=await pending; await value.connection.close(); }
|
||||
}
|
||||
module.exports = {open,publish,ready,queue,close};
|
||||
@@ -0,0 +1,26 @@
|
||||
'use strict';
|
||||
const { readFileSync } = require('node:fs');
|
||||
const { Pool } = require('pg');
|
||||
const telemetry = require('./telemetry');
|
||||
const pool = new Pool({
|
||||
connectionString: process.env.DATABASE_URL || readFileSync(process.env.DATABASE_URL_FILE || '/run/secrets/database_url', 'utf8').trim(),
|
||||
ssl: {ca:readFileSync('/tls/ca.crt'),rejectUnauthorized:true},
|
||||
max: 10, connectionTimeoutMillis: 3000, idleTimeoutMillis: 10000,
|
||||
statement_timeout: 5000,
|
||||
});
|
||||
const originalQuery=pool.query.bind(pool);
|
||||
pool.query=(...args)=>telemetry.operation('postgres.query',telemetry.SpanKind.CLIENT,()=>originalQuery(...args),{'db.system':'postgresql'});
|
||||
pool.on('error', () => telemetry.log('database.unavailable',{},true));
|
||||
async function transaction(work) {
|
||||
const client = await pool.connect();
|
||||
try {
|
||||
await client.query('BEGIN');
|
||||
const result = await work(client);
|
||||
await client.query('COMMIT');
|
||||
return result;
|
||||
} catch (error) {
|
||||
await client.query('ROLLBACK').catch(() => {});
|
||||
throw error;
|
||||
} finally { client.release(); }
|
||||
}
|
||||
module.exports = { pool, transaction };
|
||||
@@ -0,0 +1,38 @@
|
||||
'use strict';
|
||||
const { randomUUID } = require('node:crypto');
|
||||
const { transaction } = require('./db');
|
||||
const retention = Number(process.env.IDEMPOTENCY_TTL_SECONDS || 86400);
|
||||
if (!Number.isSafeInteger(retention) || retention < 86400) throw new Error('Idempotency retention must be at least 24 hours');
|
||||
|
||||
async function sendMessage(userId, chatId, key, text, attachmentIds = []) {
|
||||
return transaction(async client => {
|
||||
const attached = await client.query('SELECT id,status FROM attachments WHERE chat_id=$1 AND id=ANY($2::uuid[])', [chatId, attachmentIds]);
|
||||
if (attached.rowCount !== attachmentIds.length)
|
||||
throw Object.assign(new Error('Object not found'), { status: 404, code: 'not_found' });
|
||||
if (attached.rows.some(a => a.status === 'failed'))
|
||||
throw Object.assign(new Error('Attachment failed'),{status:409,code:'conflict'});
|
||||
// Shared PostgreSQL lock serializes this operation across all API replicas.
|
||||
// Hash collisions only serialize unrelated keys; the actual lookup uses the full scope.
|
||||
const scope = JSON.stringify([userId, chatId, key]);
|
||||
await client.query('SELECT pg_advisory_xact_lock(hashtextextended($1, 0))', [scope]);
|
||||
await client.query(`DELETE FROM message_requests WHERE user_id=$1 AND chat_id=$2 AND key=$3
|
||||
AND expires_at <= clock_timestamp()`, [userId, chatId, key]);
|
||||
const prior = await client.query('SELECT text,attachment_ids,response FROM message_requests WHERE user_id=$1 AND chat_id=$2 AND key=$3', [userId, chatId, key]);
|
||||
if (prior.rowCount) {
|
||||
if (prior.rows[0].text !== text || JSON.stringify(prior.rows[0].attachment_ids) !== JSON.stringify(attachmentIds))
|
||||
throw Object.assign(new Error('Key already used for another message'), { status: 409, code: 'conflict' });
|
||||
return prior.rows[0].response;
|
||||
}
|
||||
const message = (await client.query(`INSERT INTO messages(id,chat_id,sender_id,text)
|
||||
VALUES($1,$2,$3,$4) RETURNING *`, [randomUUID(), chatId, userId, text])).rows[0];
|
||||
for (let i = 0; i < attachmentIds.length; i++)
|
||||
await client.query('INSERT INTO message_attachments VALUES($1,$2,$3)', [message.id, attachmentIds[i], i]);
|
||||
message.attachment_ids = attachmentIds;
|
||||
await client.query(`INSERT INTO message_requests(user_id,chat_id,key,text,message_id,response,expires_at,attachment_ids)
|
||||
VALUES($1,$2,$3,$4,$5,$6::jsonb,clock_timestamp()+$7*interval '1 second',$8::uuid[])`,
|
||||
[userId, chatId, key, text, message.id, JSON.stringify(message), retention, attachmentIds]);
|
||||
// The HTTP handler returns 201 only after transaction() completes COMMIT.
|
||||
return message;
|
||||
});
|
||||
}
|
||||
module.exports = { sendMessage };
|
||||
@@ -0,0 +1,44 @@
|
||||
'use strict';
|
||||
const { readFileSync, readdirSync } = require('node:fs');
|
||||
const path = require('node:path');
|
||||
const { createHash, randomBytes } = require('node:crypto');
|
||||
const { pool } = require('./db');
|
||||
async function migrate() {
|
||||
const client = await pool.connect();
|
||||
try {
|
||||
await client.query('SELECT pg_advisory_lock(202602)');
|
||||
await client.query(`CREATE TABLE IF NOT EXISTS schema_migrations
|
||||
(version text PRIMARY KEY, checksum text NOT NULL)`);
|
||||
const dir = path.join(__dirname, '..', 'migrations');
|
||||
for (const version of readdirSync(dir).filter(f => /^\d+.*\.sql$/.test(f)).sort()) {
|
||||
const sql = readFileSync(path.join(dir, version), 'utf8').replace(/\r\n/g, '\n');
|
||||
const checksum = createHash('sha256').update(sql).digest('hex');
|
||||
const existing = await client.query('SELECT checksum FROM schema_migrations WHERE version=$1', [version]);
|
||||
if (existing.rowCount) {
|
||||
// Git may normalize Windows line endings; accept only equivalent LF/CRLF text.
|
||||
const windowsChecksum = createHash('sha256').update(sql.replace(/\n/g, '\r\n')).digest('hex');
|
||||
if (![checksum, windowsChecksum].includes(existing.rows[0].checksum)) throw new Error('Migration checksum mismatch');
|
||||
continue;
|
||||
}
|
||||
await client.query('BEGIN');
|
||||
try {
|
||||
await client.query(sql);
|
||||
await client.query('INSERT INTO schema_migrations VALUES ($1,$2)', [version, checksum]);
|
||||
await client.query('COMMIT');
|
||||
} catch (error) { await client.query('ROLLBACK'); throw error; }
|
||||
console.log('Applied migration ' + version);
|
||||
}
|
||||
await client.query(`INSERT INTO app_settings VALUES ('cursor_secret',$1) ON CONFLICT DO NOTHING`, [randomBytes(32).toString('hex')]);
|
||||
await client.query(`GRANT CONNECT ON DATABASE messenger TO api,worker;
|
||||
GRANT USAGE ON SCHEMA public TO api,worker;
|
||||
GRANT SELECT,INSERT,UPDATE,DELETE ON users,sessions,chats,chat_members,messages,message_requests,message_attachments,attachments,attachment_jobs,login_limits TO api;
|
||||
GRANT SELECT ON app_settings TO api;
|
||||
GRANT SELECT,UPDATE ON attachments,attachment_jobs TO worker;`);
|
||||
} finally {
|
||||
await client.query('SELECT pg_advisory_unlock(202602)').catch(() => {});
|
||||
client.release();
|
||||
}
|
||||
}
|
||||
module.exports = { migrate };
|
||||
if (require.main === module) migrate().then(() => console.log('Migrations up to date'))
|
||||
.catch(() => { console.error('Migration failed'); process.exitCode = 1; }).finally(() => pool.end());
|
||||
@@ -0,0 +1,8 @@
|
||||
'use strict';
|
||||
const argon=require('@node-rs/argon2');
|
||||
const options={algorithm:2,version:1,memoryCost:19456,timeCost:2,parallelism:1,outputLen:32};
|
||||
const dummy=argon.hash('dummy-password-never-valid',options);
|
||||
module.exports={options,hashPassword:value=>argon.hash(value,options),verifyPassword:async(value,encoded)=>{
|
||||
try{return await argon.verify(encoded||await dummy,value) && Boolean(encoded);}catch{return false;}
|
||||
}};
|
||||
|
||||
+272
@@ -0,0 +1,272 @@
|
||||
'use strict';
|
||||
const telemetry = require('./telemetry');
|
||||
const https = require('node:https');
|
||||
const tls = require('./tls');
|
||||
const {hashPassword,verifyPassword}=require('./password');
|
||||
const { randomUUID, randomBytes, createHash, createHmac, scrypt, timingSafeEqual } = require('node:crypto');
|
||||
const { promisify } = require('node:util');
|
||||
const { pool, transaction } = require('./db');
|
||||
const { sendMessage } = require('./messages');
|
||||
const attachments = require('./attachments');
|
||||
const storage = require('./storage');
|
||||
const broker = require('./broker');
|
||||
const instanceId = telemetry.instanceId;
|
||||
let stopping = false;
|
||||
const ttl = Number(process.env.SESSION_TTL_SECONDS || 3600);
|
||||
if (!Number.isSafeInteger(ttl) || ttl < 1) throw new Error('Invalid SESSION_TTL_SECONDS');
|
||||
let cursorSecret;
|
||||
const userColumns = 'id, username, display_name, created_at';
|
||||
const chatSelect = `SELECT c.id,c.title,c.created_at,
|
||||
ARRAY(SELECT user_id FROM chat_members WHERE chat_id=c.id ORDER BY user_id) AS member_ids FROM chats c`;
|
||||
function fail(status, code, message) { throw Object.assign(new Error(message), { status, code }); }
|
||||
function invalid(message = 'Invalid request') { fail(400, 'invalid_request', message); }
|
||||
function unauthorized() { fail(401, 'unauthorized', 'Invalid credentials or session'); }
|
||||
function uuid(value) {
|
||||
if (typeof value !== 'string' || value.length !== 36 || !/^[0-9a-f]{8}(-[0-9a-f]{4}){3}-[0-9a-f]{12}$/i.test(value)) invalid('Invalid UUID');
|
||||
return value.toLowerCase();
|
||||
}
|
||||
function fields(body, names) {
|
||||
if (!body || typeof body !== 'object' || Array.isArray(body) ||
|
||||
Object.keys(body).length !== names.length || !names.every(k => Object.hasOwn(body, k))) invalid('Invalid fields');
|
||||
}
|
||||
function string(value, max, min = 1) {
|
||||
if (typeof value !== 'string' || !value.isWellFormed() || /^[\p{White_Space}\uFEFF]*$/u.test(value) ||
|
||||
[...value].length < min || [...value].length > max || value.includes('\0')) invalid('Invalid string');
|
||||
return value;
|
||||
}
|
||||
function username(value) {
|
||||
if (typeof value !== 'string' || value.length < 3 || value.length > 32 || /[^a-z0-9_]/.test(value)) invalid('Invalid username');
|
||||
}
|
||||
function password(value) {
|
||||
if (typeof value !== 'string' || !value.isWellFormed() || [...value].length < 12 || [...value].length > 128 ||
|
||||
/^[\p{White_Space}\uFEFF]*$/u.test(value)) invalid('Invalid password');
|
||||
}
|
||||
function digest(token) { return createHash('sha256').update(token).digest('hex'); }
|
||||
async function rawBody(req) {
|
||||
const chunks = [];
|
||||
let size = 0;
|
||||
for await (const chunk of req) {
|
||||
size += chunk.length;
|
||||
if (size > 1024 * 1024) fail(413, 'payload_too_large', 'Request body too large');
|
||||
chunks.push(chunk);
|
||||
}
|
||||
return Buffer.concat(chunks);
|
||||
}
|
||||
async function body(req) {
|
||||
if (req.headers['content-type']?.split(';')[0].trim().toLowerCase() !== 'application/json')
|
||||
fail(415, 'unsupported_media_type', 'Expected application/json');
|
||||
const bytes = await rawBody(req);
|
||||
try { return JSON.parse(new TextDecoder('utf-8', { fatal: true }).decode(bytes)); }
|
||||
catch { invalid('Invalid JSON'); }
|
||||
}
|
||||
async function identity(req) {
|
||||
const match = /^Bearer ([A-Za-z0-9_-]{43})$/i.exec(req.headers.authorization || '');
|
||||
if (!match) unauthorized();
|
||||
const tokenHash = digest(match[1]);
|
||||
const result = await pool.query(`SELECT u.id,u.username,u.display_name,u.created_at
|
||||
FROM sessions s JOIN users u ON u.id=s.user_id
|
||||
WHERE token_hash=$1 AND expires_at > clock_timestamp()`, [tokenHash]);
|
||||
if (!result.rowCount) unauthorized();
|
||||
return { user: result.rows[0], tokenHash };
|
||||
}
|
||||
async function accessible(id, user) {
|
||||
const result = await pool.query(chatSelect + ` WHERE c.id=$1 AND EXISTS
|
||||
(SELECT 1 FROM chat_members WHERE chat_id=c.id AND user_id=$2)`, [uuid(id), user.id]);
|
||||
if (!result.rowCount) fail(404, 'not_found', 'Object not found');
|
||||
return result.rows[0];
|
||||
}
|
||||
function signature(payload) { return createHmac('sha256', cursorSecret).update(payload).digest('base64url'); }
|
||||
function pagination(query, scope) {
|
||||
if (query.getAll('limit').length > 1 || query.getAll('cursor').length > 1) invalid();
|
||||
const raw = query.get('limit') ?? '50';
|
||||
if (!/^\d+$/.test(raw) || Number(raw) < 1 || Number(raw) > 100) invalid('Invalid limit');
|
||||
let after = null;
|
||||
if (query.has('cursor')) {
|
||||
try {
|
||||
const token = query.get('cursor');
|
||||
if (!/^[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+$/.test(token)) throw new Error();
|
||||
const [payload, mac] = token.split('.');
|
||||
if (signature(payload) !== mac) throw new Error();
|
||||
after = JSON.parse(Buffer.from(payload, 'base64url').toString('utf8'));
|
||||
if (after.scope !== scope || typeof after.created_at !== 'string' || !Number.isFinite(Date.parse(after.created_at))) throw new Error();
|
||||
uuid(after.id);
|
||||
} catch { invalid('Invalid cursor'); }
|
||||
}
|
||||
return { limit: Number(raw), after, scope };
|
||||
}
|
||||
function page(rows, paging) {
|
||||
const items = rows.slice(0, paging.limit);
|
||||
let next_cursor = null;
|
||||
if (rows.length > paging.limit) {
|
||||
const last = items.at(-1);
|
||||
const payload = Buffer.from(JSON.stringify({ scope: paging.scope, created_at: last.created_at, id: last.id })).toString('base64url');
|
||||
next_cursor = payload + '.' + signature(payload);
|
||||
}
|
||||
return { items, next_cursor };
|
||||
}
|
||||
|
||||
async function loginLimit(req){
|
||||
// LB overwrites this header; only allowlisted LB certificate reaches handler.
|
||||
const ip=req.headers['x-forwarded-for']||'unknown';
|
||||
const key=createHash('sha256').update(ip).digest('hex');
|
||||
const r=await pool.query(`INSERT INTO login_limits(key,window_start,attempts) VALUES($1,clock_timestamp(),1)
|
||||
ON CONFLICT(key) DO UPDATE SET attempts=CASE WHEN login_limits.window_start < clock_timestamp()-interval '60 seconds' THEN 1 ELSE login_limits.attempts+1 END,
|
||||
window_start=CASE WHEN login_limits.window_start < clock_timestamp()-interval '60 seconds' THEN clock_timestamp() ELSE login_limits.window_start END RETURNING attempts`,[key]);
|
||||
if(r.rows[0].attempts>30)fail(429,'rate_limited','Too many login attempts');
|
||||
}
|
||||
async function route(req) {
|
||||
const url = new URL(req.url, 'http://localhost');
|
||||
const path = url.pathname, method = req.method;
|
||||
if (method === 'GET' && path === '/health/live') return [200, { status: 'ok' }];
|
||||
if (stopping) fail(503, 'unavailable', 'Server is stopping');
|
||||
if (method === 'GET' && path === '/health/ready') {
|
||||
try { await pool.query('SELECT 1'); }
|
||||
catch { fail(503, 'unavailable', 'Database unavailable'); }
|
||||
await storage.ready();
|
||||
await broker.ready();
|
||||
return [200, { status: 'ok' }];
|
||||
}
|
||||
if (method === 'POST' && path === '/api/v1/users') {
|
||||
const data = await body(req);
|
||||
fields(data, ['username', 'display_name', 'password']);
|
||||
username(data.username); string(data.display_name, 100); password(data.password);
|
||||
const hash = await hashPassword(data.password);
|
||||
try {
|
||||
const result = await pool.query(`INSERT INTO users(id,username,display_name,password_hash)
|
||||
VALUES($1,$2,$3,$4) RETURNING ${userColumns}`, [randomUUID(), data.username, data.display_name, hash]);
|
||||
return [201, result.rows[0]];
|
||||
} catch (error) {
|
||||
if (error.code === '23505') fail(409, 'conflict', 'Username already exists');
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
if (method === 'POST' && path === '/api/v1/auth/sessions') {
|
||||
await loginLimit(req);
|
||||
const match = /^Basic ([A-Za-z0-9+/]+={0,2})$/i.exec(req.headers.authorization || '');
|
||||
if (!match) unauthorized();
|
||||
let name, value;
|
||||
try {
|
||||
const bytes = Buffer.from(match[1], 'base64');
|
||||
if (bytes.toString('base64') !== match[1]) throw new Error();
|
||||
const decoded = new TextDecoder('utf-8', { fatal: true }).decode(bytes);
|
||||
const colon = decoded.indexOf(':');
|
||||
if (colon < 0) throw new Error();
|
||||
name = decoded.slice(0, colon); value = decoded.slice(colon + 1);
|
||||
username(name); password(value);
|
||||
} catch { unauthorized(); }
|
||||
if ((await rawBody(req)).length) invalid('Login must not have a body');
|
||||
const result = await pool.query(`SELECT ${userColumns},password_hash FROM users WHERE username=$1`, [name]);
|
||||
const row = result.rows[0];
|
||||
if (!await verifyPassword(value, row?.password_hash)) unauthorized();
|
||||
const { password_hash, ...user } = row;
|
||||
const token = randomBytes(32).toString('base64url');
|
||||
const session = await pool.query(`INSERT INTO sessions(token_hash,user_id,expires_at)
|
||||
VALUES($1,$2,clock_timestamp()+$3*interval '1 second') RETURNING expires_at`, [digest(token), user.id, ttl]);
|
||||
return [201, { token, token_type: 'Bearer', expires_at: session.rows[0].expires_at, user }];
|
||||
}
|
||||
const { user, tokenHash } = await identity(req);
|
||||
if (method === 'DELETE' && path === '/api/v1/auth/sessions/current') {
|
||||
await pool.query('DELETE FROM sessions WHERE token_hash=$1', [tokenHash]);
|
||||
return [204, null];
|
||||
}
|
||||
if (method === 'GET' && path === '/api/v1/users/me') return [200, user];
|
||||
if (path === '/api/v1/chats' && method === 'POST') {
|
||||
const data = await body(req);
|
||||
fields(data, ['title', 'member_ids']); string(data.title, 100);
|
||||
if (!Array.isArray(data.member_ids) || data.member_ids.length < 1 || data.member_ids.length > 100) invalid('Invalid members');
|
||||
const ids = data.member_ids.map(uuid);
|
||||
if (new Set(ids).size !== ids.length || !ids.includes(user.id)) invalid('Invalid members');
|
||||
return [201, await transaction(async client => {
|
||||
const known = await client.query('SELECT id FROM users WHERE id=ANY($1::uuid[])', [ids]);
|
||||
if (known.rowCount !== ids.length) invalid('Unknown member');
|
||||
const chat = (await client.query('INSERT INTO chats(id,title) VALUES($1,$2) RETURNING *', [randomUUID(), data.title])).rows[0];
|
||||
await client.query('INSERT INTO chat_members(chat_id,user_id) SELECT $1,unnest($2::uuid[])', [chat.id, ids]);
|
||||
return { ...chat, member_ids: ids.sort() };
|
||||
})];
|
||||
}
|
||||
if (path === '/api/v1/chats' && method === 'GET') {
|
||||
const paging = pagination(url.searchParams, 'chats:' + user.id);
|
||||
const rows = (await pool.query(chatSelect + ` WHERE EXISTS
|
||||
(SELECT 1 FROM chat_members WHERE chat_id=c.id AND user_id=$1)
|
||||
AND ($2::timestamptz IS NULL OR (c.created_at,c.id)>($2::timestamptz,$3::uuid))
|
||||
ORDER BY c.created_at,c.id LIMIT $4`, [user.id, paging.after?.created_at ?? null, paging.after?.id ?? null, paging.limit + 1])).rows;
|
||||
return [200, page(rows, paging)];
|
||||
}
|
||||
const attachmentPath = path.match(/^\/api\/v1\/attachments\/([^/]+)(\/content)?$/);
|
||||
if (attachmentPath && method === 'GET') {
|
||||
const row = await attachments.accessible(uuid(attachmentPath[1]), user);
|
||||
if (!attachmentPath[2]) return [200, attachments.visible(row)];
|
||||
if (url.searchParams.getAll('variant').length > 1) invalid('Invalid variant');
|
||||
if (row.status !== 'ready') fail(409, 'conflict', 'Attachment is not ready');
|
||||
const variant = url.searchParams.get('variant') ?? 'original';
|
||||
let content = row;
|
||||
if (variant !== 'original') {
|
||||
const metadata = row.variants.find(v => v.name === variant);
|
||||
if (!metadata) fail(404, 'not_found', 'Object not found');
|
||||
content = {...metadata,object_key:'variants/'+row.id+'/v1/'+variant};
|
||||
}
|
||||
return [200, await attachments.download(content), { 'Content-Type': content.content_type, 'X-Content-Type-Options': 'nosniff' }];
|
||||
}
|
||||
const match = path.match(/^\/api\/v1\/chats\/([^/]+)(\/messages|\/attachments)?$/);
|
||||
if (match) {
|
||||
const chat = await accessible(match[1], user);
|
||||
if (!match[2] && method === 'GET') return [200, chat];
|
||||
if (match[2] === '/attachments' && method === 'POST') return [202, await attachments.upload(req, url.searchParams, chat, user)];
|
||||
if (match[2] === '/messages' && method === 'POST') {
|
||||
const key = req.headers['idempotency-key'];
|
||||
if (typeof key !== 'string' || key.length < 1 || key.length > 128 || /[^A-Za-z0-9._:-]/.test(key)) invalid('Invalid Idempotency-Key');
|
||||
const data = await body(req);
|
||||
if (!data || typeof data !== 'object' || Array.isArray(data) || !Object.hasOwn(data, 'text') ||
|
||||
Object.keys(data).some(k => !['text', 'attachment_ids'].includes(k))) invalid('Invalid fields');
|
||||
if (typeof data.text !== 'string' || !data.text.isWellFormed() || [...data.text].length > 4000 || data.text.includes('\0')) invalid('Invalid text');
|
||||
const rawIds = Object.hasOwn(data, 'attachment_ids') ? data.attachment_ids : [];
|
||||
if (!Array.isArray(rawIds) || rawIds.length > 10) invalid('Invalid attachments');
|
||||
const ids = rawIds.map(uuid);
|
||||
if (new Set(ids).size !== ids.length || (ids.length === 0 && /^[\p{White_Space}\uFEFF]*$/u.test(data.text))) invalid('Empty message or duplicate attachments');
|
||||
return [201, await sendMessage(user.id, chat.id, key, data.text, ids)];
|
||||
}
|
||||
if (match[2] === '/messages' && method === 'GET') {
|
||||
const paging = pagination(url.searchParams, 'messages:' + chat.id);
|
||||
const result = await pool.query(`SELECT m.*, ARRAY(SELECT attachment_id FROM message_attachments
|
||||
WHERE message_id=m.id ORDER BY position) AS attachment_ids FROM messages m WHERE m.chat_id=$1
|
||||
AND ($2::timestamptz IS NULL OR (m.created_at,m.id)>($2::timestamptz,$3::uuid))
|
||||
ORDER BY m.created_at,m.id LIMIT $4`, [chat.id, paging.after?.created_at ?? null, paging.after?.id ?? null, paging.limit + 1]);
|
||||
return [200, page(result.rows, paging)];
|
||||
}
|
||||
}
|
||||
fail(404, 'not_found', 'Object not found');
|
||||
}
|
||||
const server = https.createServer({...tls,requestCert:true,rejectUnauthorized:true}, async (req, res) => {
|
||||
if (!(req.socket.getPeerCertificate().subjectaltname||'').split(', ').includes('DNS:lb')) {req.socket.destroy();return;}
|
||||
const request_id = randomUUID();
|
||||
return telemetry.http(req,res,request_id,async () => {
|
||||
let status, data, responseHeaders;
|
||||
const headers = { 'Content-Type': 'application/json; charset=utf-8', 'X-Request-Id': request_id, 'X-Instance-Id': instanceId };
|
||||
try { [status, data, responseHeaders] = await route(req); }
|
||||
catch (error) {
|
||||
status = error.status || (/^(08|53|57)/.test(error.code || '') || ['ECONNREFUSED', 'ECONNRESET', 'ETIMEDOUT'].includes(error.code) ? 503 : 500);
|
||||
data = { error: { code: error.status ? error.code : status === 503 ? 'unavailable' : 'internal_error',
|
||||
message: error.status ? error.message : status === 503 ? 'Database unavailable' : 'Internal error', request_id } };
|
||||
if (status === 401) headers['WWW-Authenticate'] = req.url.split('?')[0] === '/api/v1/auth/sessions'
|
||||
? 'Basic realm="messenger", charset="UTF-8"' : 'Bearer realm="messenger"';
|
||||
}
|
||||
if (status === 429) headers['Retry-After']='60';
|
||||
if (status === 413) headers.Connection = 'close';
|
||||
res.writeHead(status, { ...headers, ...responseHeaders });
|
||||
res.end(status === 204 ? undefined : Buffer.isBuffer(data) ? data : JSON.stringify(data));
|
||||
});
|
||||
});
|
||||
async function main() {
|
||||
cursorSecret = (await pool.query("SELECT value FROM app_settings WHERE key='cursor_secret'")).rows[0].value;
|
||||
require('node:http').createServer(async(req,res)=>{
|
||||
if(!['/health/live','/health/ready'].includes(req.url)){res.writeHead(404);return res.end();}
|
||||
try{const [status,data]=await route(req);res.writeHead(status,{'X-Instance-Id':instanceId});res.end(JSON.stringify(data));}catch{res.writeHead(503);res.end();}
|
||||
}).listen(9001,'127.0.0.1');
|
||||
server.listen(Number(process.env.APP_PORT || 8443), process.env.APP_HOST || '0.0.0.0', () => telemetry.log('api.started'));
|
||||
}
|
||||
for (const signal of ['SIGTERM', 'SIGINT']) process.on(signal, () => {
|
||||
stopping = true;
|
||||
server.close(async () => { await pool.end(); await broker.close().catch(() => {}); await telemetry.shutdown(); process.exit(0); });
|
||||
setTimeout(() => process.exit(1), 9000).unref();
|
||||
});
|
||||
main().catch(() => { telemetry.log('api.startup_failed',{},true); process.exitCode = 1; pool.end(); });
|
||||
@@ -0,0 +1,26 @@
|
||||
'use strict';
|
||||
// Certificates are bootstrap identity. KV credentials stay only in process memory.
|
||||
const https=require('node:https');
|
||||
const tls=require('./tls');
|
||||
async function bao(path,data,token) {
|
||||
return new Promise((resolve,reject)=>{
|
||||
const req=https.request('https://bao:8200/v1/'+path,{...tls,agent:tls.agent,method:data?'POST':'GET',headers:{'Content-Type':'application/json',...(token?{'X-Vault-Token':token}:{})},timeout:5000},res=>{
|
||||
let body='';res.on('data',b=>body+=b);res.on('end',()=>{if(res.statusCode!==200)return reject(Error('Secret service unavailable'));try{resolve(JSON.parse(body));}catch{reject(Error('Secret response invalid'));}});
|
||||
});req.on('timeout',()=>req.destroy(Error('Secret timeout')));req.on('error',()=>reject(Error('Secret connection failed')));req.end(data?JSON.stringify(data):undefined);
|
||||
});
|
||||
}
|
||||
async function main(){
|
||||
const role=process.env.SERVICE_ROLE;
|
||||
const auth=(await bao('auth/cert/login',{name:role})).auth;
|
||||
if(auth.policies.includes('root'))throw Error('Root policy forbidden');
|
||||
const credentials=(await bao('secret/data/'+role,null,auth.client_token)).data.data;
|
||||
process.env.DATABASE_URL=credentials.database_url;
|
||||
process.env.BROKER_URL=credentials.broker_url;
|
||||
process.env.S3_ACCESS_KEY_ID=credentials.s3_access_key;
|
||||
process.env.S3_SECRET_ACCESS_KEY=credentials.s3_secret_key;
|
||||
// No token needed after startup; explicitly revoke the short-lived token.
|
||||
await bao('auth/token/revoke-self',{},auth.client_token).catch(()=>{});
|
||||
require(role==='worker'?'./worker':'./server');
|
||||
}
|
||||
if(require.main===module)main().catch(()=>{console.error('Service bootstrap failed: check OpenBao readiness and service policy');process.exit(1);});
|
||||
module.exports={bao};
|
||||
@@ -0,0 +1,36 @@
|
||||
'use strict';
|
||||
const { readFileSync } = require('node:fs');
|
||||
const { Agent } = require('node:https');
|
||||
const { Client } = require('minio');
|
||||
const endpoint = new URL(process.env.S3_ENDPOINT || 'https://s3:9000');
|
||||
const bucket = process.env.S3_BUCKET || 'messenger-attachments';
|
||||
const client = new Client({
|
||||
endPoint: endpoint.hostname, port: Number(endpoint.port || 9000), useSSL: true,
|
||||
region: process.env.S3_REGION || 'us-east-1',
|
||||
accessKey: process.env.S3_ACCESS_KEY_ID || readFileSync(process.env.S3_ACCESS_KEY_ID_FILE || '/run/secrets/s3_access_key_id', 'utf8').trim(),
|
||||
secretKey: process.env.S3_SECRET_ACCESS_KEY || readFileSync(process.env.S3_SECRET_ACCESS_KEY_FILE || '/run/secrets/s3_secret_access_key', 'utf8').trim(),
|
||||
transportAgent: new Agent({ ca:readFileSync("/tls/ca.crt"),rejectUnauthorized:true, keepAlive: true, timeout: 5000, maxSockets: 16 }),
|
||||
});
|
||||
function unavailable() { return Object.assign(new Error('Object storage unavailable'), { status: 503, code: 'unavailable' }); }
|
||||
async function ready() {
|
||||
try { if (!await client.bucketExists(bucket)) throw new Error(); }
|
||||
catch { throw unavailable(); }
|
||||
}
|
||||
async function bootstrap() {
|
||||
for (let attempt = 0; attempt < 30; attempt++) {
|
||||
try {
|
||||
if (!await client.bucketExists(bucket)) await client.makeBucket(bucket, process.env.S3_REGION || 'us-east-1');
|
||||
// Remove any anonymous policy; newly created buckets are private by default.
|
||||
await client.setBucketPolicy(bucket, '');
|
||||
console.log('Private bucket ready');
|
||||
return;
|
||||
} catch (error) {
|
||||
if (attempt === 29) throw unavailable();
|
||||
await new Promise(resolve => setTimeout(resolve, 1000));
|
||||
}
|
||||
}
|
||||
}
|
||||
module.exports = { client, bucket, ready, unavailable };
|
||||
if (require.main === module) bootstrap().then(() => process.exit(0)).catch(() => {
|
||||
console.error('Bucket initialization failed'); process.exit(1);
|
||||
});
|
||||
@@ -0,0 +1,92 @@
|
||||
'use strict';
|
||||
const {randomUUID}=require('node:crypto');
|
||||
const {context,trace,propagation,SpanKind,SpanStatusCode}=require('@opentelemetry/api');
|
||||
const instanceId=randomUUID();
|
||||
const service=process.env.OTEL_SERVICE_NAME || 'messenger-api';
|
||||
const endpoint=process.env.OTEL_EXPORTER_OTLP_ENDPOINT;
|
||||
let tracer,meter,logger;
|
||||
const providers=[];
|
||||
if(endpoint) {
|
||||
const {Resource}=require('@opentelemetry/resources');
|
||||
const {NodeTracerProvider}=require('@opentelemetry/sdk-trace-node');
|
||||
const {BatchSpanProcessor}=require('@opentelemetry/sdk-trace-base');
|
||||
const {MeterProvider,PeriodicExportingMetricReader,View,ExplicitBucketHistogramAggregation}=require('@opentelemetry/sdk-metrics');
|
||||
const {LoggerProvider,BatchLogRecordProcessor}=require('@opentelemetry/sdk-logs');
|
||||
const {OTLPTraceExporter}=require('@opentelemetry/exporter-trace-otlp-proto');
|
||||
const {OTLPMetricExporter}=require('@opentelemetry/exporter-metrics-otlp-proto');
|
||||
const {OTLPLogExporter}=require('@opentelemetry/exporter-logs-otlp-proto');
|
||||
const resource=new Resource({'service.name':service,'service.version':'7.0.0','service.instance.id':instanceId,'deployment.environment.name':'lab'});
|
||||
const batching={maxQueueSize:512,maxExportBatchSize:128,scheduledDelayMillis:1000,exportTimeoutMillis:1500};
|
||||
const tp=new NodeTracerProvider({resource});
|
||||
tp.addSpanProcessor(new BatchSpanProcessor(new OTLPTraceExporter({url:endpoint+'/v1/traces',timeoutMillis:1000,httpAgentOptions:require('./tls')}),batching));
|
||||
tp.register();tracer=tp.getTracer('messenger','7.0.0');providers.push(tp);
|
||||
const mp=new MeterProvider({resource,readers:[new PeriodicExportingMetricReader({exporter:new OTLPMetricExporter({url:endpoint+'/v1/metrics',timeoutMillis:1000,httpAgentOptions:require('./tls')}),exportIntervalMillis:5000,exportTimeoutMillis:1500})],
|
||||
views:[new View({instrumentName:'messenger_http_duration_seconds',aggregation:new ExplicitBucketHistogramAggregation([.005,.01,.025,.05,.1,.25,.5,1,2,5,10])}),
|
||||
new View({instrumentName:'messenger_job_duration_seconds',aggregation:new ExplicitBucketHistogramAggregation([.01,.05,.1,.25,.5,1,2,5,10,30,60])})]});
|
||||
meter=mp.getMeter('messenger','7.0.0');providers.push(mp);
|
||||
const lp=new LoggerProvider({resource});lp.addLogRecordProcessor(new BatchLogRecordProcessor(new OTLPLogExporter({url:endpoint+'/v1/logs',timeoutMillis:1000,httpAgentOptions:require('./tls')}),batching));
|
||||
logger=lp.getLogger('messenger','7.0.0');providers.push(lp);
|
||||
}
|
||||
tracer ||= trace.getTracer('messenger');
|
||||
const requests=meter?.createCounter('messenger_http_requests');
|
||||
const httpDuration=meter?.createHistogram('messenger_http_duration_seconds',{unit:'s'});
|
||||
const jobs=meter?.createCounter('messenger_jobs');
|
||||
const jobDuration=meter?.createHistogram('messenger_job_duration_seconds',{unit:'s'});
|
||||
function log(event,attributes={},error=false) {
|
||||
const span=trace.getSpan(context.active())?.spanContext();
|
||||
const record={timestamp:new Date().toISOString(),severity:error?'ERROR':'INFO','service.name':service,event,
|
||||
...(span?{trace_id:span.traceId,span_id:span.spanId}:{}),...attributes};
|
||||
// Only explicit safe attributes from call sites; never log headers, SQL, body or exception.message.
|
||||
logger?.emit({context:context.active(),severityNumber:error?17:9,severityText:record.severity,body:JSON.stringify(record),attributes:{event,...attributes}});
|
||||
console.log(JSON.stringify(record));
|
||||
}
|
||||
function routeTemplate(path) {
|
||||
if(['/health/live','/health/ready','/api/v1/users','/api/v1/users/me','/api/v1/auth/sessions','/api/v1/auth/sessions/current','/api/v1/chats'].includes(path))return path;
|
||||
if(/^\/api\/v1\/chats\/[^/]+\/messages$/.test(path))return '/api/v1/chats/{chat_id}/messages';
|
||||
if(/^\/api\/v1\/chats\/[^/]+\/attachments$/.test(path))return '/api/v1/chats/{chat_id}/attachments';
|
||||
if(/^\/api\/v1\/chats\/[^/]+$/.test(path))return '/api/v1/chats/{chat_id}';
|
||||
if(/^\/api\/v1\/attachments\/[^/]+\/content$/.test(path))return '/api/v1/attachments/{attachment_id}/content';
|
||||
if(/^\/api\/v1\/attachments\/[^/]+$/.test(path))return '/api/v1/attachments/{attachment_id}';
|
||||
return 'unmatched';
|
||||
}
|
||||
async function http(req,res,requestId,run) {
|
||||
const route=routeTemplate(req.url.split('?')[0]);
|
||||
const method=['GET','POST','DELETE','PUT','PATCH','OPTIONS','HEAD'].includes(req.method)?req.method:'OTHER';
|
||||
const parent=propagation.extract(context.active(),{'traceparent':req.headers.traceparent,'tracestate':req.headers.tracestate});
|
||||
return tracer.startActiveSpan(method+' '+route,{kind:SpanKind.SERVER,attributes:{'http.request.method':method,'http.route':route,'request_id':requestId}},parent,async span=>{
|
||||
const start=performance.now();
|
||||
try {return await run();}
|
||||
finally {
|
||||
const status=res.statusCode,duration=(performance.now()-start)/1000,attrs={method,route,status_class:Math.floor(status/100)+'xx'};
|
||||
requests?.add(1,attrs);httpDuration?.record(duration,attrs);
|
||||
span.setAttribute('http.response.status_code',status);span.setStatus({code:status>=500?SpanStatusCode.ERROR:SpanStatusCode.OK});
|
||||
log('http.completed',{request_id:requestId,method,route,status,duration_seconds:duration},status>=500);
|
||||
span.end();
|
||||
}
|
||||
});
|
||||
}
|
||||
async function operation(name,kind,run,attributes={}) {
|
||||
return tracer.startActiveSpan(name,{kind,attributes},async span=>{
|
||||
try {const result=await run();span.setStatus({code:SpanStatusCode.OK});return result;}
|
||||
catch(error){span.setStatus({code:SpanStatusCode.ERROR,message:'operation_failed'});log('dependency.failed',{dependency:name},true);throw error;}
|
||||
finally{span.end();}
|
||||
});
|
||||
}
|
||||
async function job(message,run) {
|
||||
let carrier={};try{carrier=JSON.parse(message.content);}catch{}
|
||||
const parent=propagation.extract(context.active(),carrier);
|
||||
return tracer.startActiveSpan('attachment.process',{kind:SpanKind.CONSUMER,attributes:{'messaging.system':'rabbitmq','job.type':'attachment.process.v1'}},parent,async span=>{
|
||||
const start=performance.now();let outcome='error';
|
||||
try{outcome=(await run()) || 'ignored';return outcome;}
|
||||
finally{
|
||||
const duration=(performance.now()-start)/1000,attrs={job_type:'attachment.process.v1',outcome};
|
||||
jobs?.add(1,attrs);jobDuration?.record(duration,attrs);
|
||||
const error=['failed','retry','error'].includes(outcome);
|
||||
span.setAttribute('job.outcome',outcome);span.setStatus({code:error?SpanStatusCode.ERROR:SpanStatusCode.OK});
|
||||
log('job.completed',{...attrs,duration_seconds:duration,...(/^[0-9a-f-]{36}$/i.test(carrier.attachment_id||'')?{attachment_id:carrier.attachment_id}:{})},error);span.end();
|
||||
}
|
||||
});
|
||||
}
|
||||
function carrier(){const headers={};propagation.inject(context.active(),headers);return headers;}
|
||||
async function shutdown(){await Promise.allSettled(providers.map(p=>p.shutdown()));}
|
||||
module.exports={instanceId,http,job,log,operation,carrier,shutdown,SpanKind};
|
||||
@@ -0,0 +1,17 @@
|
||||
'use strict';
|
||||
const https=require('node:https'),http=require('node:http');
|
||||
const tls=require('./tls');
|
||||
const mode=process.env.PROXY_MODE;
|
||||
const rules={
|
||||
collector:[['/v1/',4318,['api','worker'],['POST']],['/metrics',9464,['prometheus'],['GET']]],
|
||||
loki:[['/otlp/',3100,['collector'],['POST']],['/loki/api/v1/query',3100,['grafana','operator'],['GET','POST']],['/loki/api/v1/label',3100,['grafana','operator'],['GET']],['/loki/api/v1/series',3100,['grafana','operator'],['GET','POST']],['/loki/api/v1/index/stats',3100,['grafana','operator'],['GET']],['/ready',3100,['operator'],['GET']]],
|
||||
tempo:[['/v1/traces',4318,['collector'],['POST']],['/api/',3200,['grafana','operator'],['GET']],['/ready',3200,['operator'],['GET']]],
|
||||
prometheus:[['/api/v1/query',9090,['grafana','operator'],['GET','POST']],['/api/v1/label',9090,['grafana','operator'],['GET']],['/api/v1/series',9090,['grafana','operator'],['GET','POST']],['/api/v1/metadata',9090,['grafana','operator'],['GET']],['/api/v1/status/buildinfo',9090,['grafana','operator'],['GET']],['/-/ready',9090,['operator'],['GET']]]
|
||||
};
|
||||
https.createServer({...tls,requestCert:true,rejectUnauthorized:true},(req,res)=>{
|
||||
const sans=(req.socket.getPeerCertificate().subjectaltname||'').split(', ');
|
||||
const rule=rules[mode]?.find(([prefix,,roles,methods])=>req.url.split('?')[0].startsWith(prefix)&&methods.includes(req.method)&&roles.some(role=>sans.includes('DNS:'+role)));
|
||||
if(!rule){res.writeHead(403);return res.end('Denied');}
|
||||
const upstream=http.request({host:'127.0.0.1',port:rule[1],path:req.url,method:req.method,headers:{...req.headers,host:'localhost'},timeout:10000},r=>{res.writeHead(r.statusCode,r.headers);r.pipe(res);});
|
||||
upstream.on('error',()=>{if(!res.headersSent)res.writeHead(502);res.end();});upstream.on('timeout',()=>upstream.destroy());req.pipe(upstream);
|
||||
}).listen(3443,'0.0.0.0');
|
||||
@@ -0,0 +1,9 @@
|
||||
'use strict';
|
||||
const fs=require('node:fs');
|
||||
const https=require('node:https');
|
||||
const ca=fs.readFileSync('/tls/ca.crt');
|
||||
const cert=fs.readFileSync('/tls/cert.crt');
|
||||
const key=fs.readFileSync('/tls/key.pem');
|
||||
const options={ca,cert,key,minVersion:'TLSv1.2',rejectUnauthorized:true};
|
||||
const agent=new https.Agent({...options,keepAlive:true,maxSockets:16,timeout:5000});
|
||||
module.exports={...options,agent};
|
||||
@@ -0,0 +1,92 @@
|
||||
'use strict';
|
||||
const telemetry = require('./telemetry');
|
||||
const sharp = require('sharp');
|
||||
const {createHash} = require('node:crypto');
|
||||
const {pool} = require('./db');
|
||||
const storage = require('./storage');
|
||||
const {download} = require('./attachments');
|
||||
const broker = require('./broker');
|
||||
const maximum = Number(process.env.JOB_MAX_ATTEMPTS || 5);
|
||||
const delay = Number(process.env.JOB_RETRY_DELAY_MS || 1000);
|
||||
if (!Number.isSafeInteger(maximum) || maximum < 1 || maximum > 20 || !Number.isSafeInteger(delay) || delay < 0 || delay > 60000)
|
||||
throw new Error('Invalid retry configuration');
|
||||
sharp.cache(false);
|
||||
const sha = b => createHash('sha256').update(b).digest('hex');
|
||||
async function processJob(message,channel) {
|
||||
let job;
|
||||
try { job=JSON.parse(message.content); } catch { channel.reject(message,false);return; }
|
||||
if (job.schema_version!==1 || job.type!=='attachment.process.v1' || job.pipeline_version!==1 ||
|
||||
!/^[0-9a-f-]{36}$/i.test(job.job_id || '') || !/^[0-9a-f-]{36}$/i.test(job.attachment_id || '')) {
|
||||
channel.reject(message,false);return;
|
||||
}
|
||||
const db=await pool.connect();
|
||||
let locked=false;
|
||||
try {
|
||||
locked=(await db.query('SELECT pg_try_advisory_lock(hashtextextended($1,5)) AS locked',[job.job_id])).rows[0].locked;
|
||||
if (!locked) { await new Promise(r=>setTimeout(r,250));channel.nack(message,false,true);return; }
|
||||
const work=(await db.query('SELECT * FROM attachment_jobs WHERE id=$1 AND attachment_id=$2',[job.job_id,job.attachment_id])).rows[0];
|
||||
if (!work) { channel.reject(message,false);return; }
|
||||
let row=(await db.query('SELECT * FROM attachments WHERE id=$1',[work.attachment_id])).rows[0];
|
||||
if (['ready','failed'].includes(row.status)) { channel.ack(message);return 'duplicate'; }
|
||||
if (work.attempts >= maximum) {
|
||||
await db.query("UPDATE attachments SET status='failed',error_code='retry_exhausted',updated_at=clock_timestamp() WHERE id=$1",[row.id]);
|
||||
channel.ack(message);return 'failed';
|
||||
}
|
||||
await db.query('BEGIN');
|
||||
await db.query('UPDATE attachment_jobs SET attempts=attempts+1 WHERE id=$1',[work.id]);
|
||||
await db.query("UPDATE attachments SET status='processing',error_code=NULL,updated_at=clock_timestamp() WHERE id=$1",[row.id]);
|
||||
await db.query('COMMIT');
|
||||
const attempt=work.attempts+1;
|
||||
try {
|
||||
const bytes=await telemetry.operation('s3.get',telemetry.SpanKind.CLIENT,()=>download({...row,object_key:row.staging_key}));
|
||||
const info=await sharp(bytes,{limitInputPixels:40000000,failOn:'warning'}).metadata();
|
||||
const swapped=[5,6,7,8].includes(info.orientation);
|
||||
const width=swapped?info.height:info.width, height=swapped?info.width:info.height;
|
||||
const scale=Math.min(1,256/width,256/height);
|
||||
const thumbnail=await sharp(bytes,{limitInputPixels:40000000,failOn:'warning'}).rotate()
|
||||
.resize(Math.max(1,Math.floor(width*scale)),Math.max(1,Math.floor(height*scale)),{fit:'fill'})
|
||||
.flatten({background:'#ffffff'}).jpeg({quality:80}).toBuffer({resolveWithObject:true});
|
||||
const variant={name:'thumbnail',content_type:'image/jpeg',size_bytes:thumbnail.data.length,
|
||||
width:thumbnail.info.width,height:thumbnail.info.height,sha256:sha(thumbnail.data)};
|
||||
await storage.client.putObject(storage.bucket,row.object_key,bytes,bytes.length,{'Content-Type':row.content_type});
|
||||
await storage.client.putObject(storage.bucket,'variants/'+row.id+'/v1/thumbnail',thumbnail.data,
|
||||
thumbnail.data.length,{'Content-Type':'image/jpeg'});
|
||||
await db.query("UPDATE attachments SET status='ready',error_code=NULL,variants=$2::jsonb,updated_at=clock_timestamp() WHERE id=$1",[row.id,JSON.stringify([variant])]);
|
||||
// Both objects and committed metadata precede the consumer acknowledgement.
|
||||
channel.ack(message);
|
||||
return 'success';
|
||||
} catch (error) {
|
||||
const permanent=!error.status && /corrupt|unsupported|image|pixel limit/i.test(error.message);
|
||||
const failed=permanent || attempt>=maximum;
|
||||
await db.query('UPDATE attachments SET status=$2,error_code=$3,updated_at=clock_timestamp() WHERE id=$1',
|
||||
[row.id,failed?'failed':'queued',failed?(permanent?'invalid_image':'retry_exhausted'):null]);
|
||||
if (!failed) {
|
||||
await new Promise(r=>setTimeout(r,delay));
|
||||
await broker.publish(work,attempt+1,channel);
|
||||
}
|
||||
channel.ack(message);
|
||||
return failed?'failed':'retry';
|
||||
}
|
||||
} finally {
|
||||
await db.query('ROLLBACK').catch(()=>{});
|
||||
if (locked) await db.query('SELECT pg_advisory_unlock(hashtextextended($1,5))',[job.job_id]).catch(()=>{});
|
||||
db.release();
|
||||
}
|
||||
}
|
||||
async function main() {
|
||||
const {connection,channel}=await broker.open();
|
||||
connection.on('close',()=>process.exit(1));
|
||||
channel.on('close',()=>process.exit(1));
|
||||
await channel.prefetch(1);
|
||||
await channel.consume(broker.queue,message=>{
|
||||
if (message) telemetry.job(message,()=>processJob(message,channel)).catch(async ()=>{
|
||||
// Connection closure returns unacknowledged deliveries to the durable queue.
|
||||
telemetry.log('worker.interrupted',{},true);
|
||||
await telemetry.shutdown();
|
||||
process.exit(1);
|
||||
});
|
||||
},{noAck:false});
|
||||
telemetry.log('worker.started',{concurrency:1,max_attempts:maximum});
|
||||
}
|
||||
for (const signal of ['SIGTERM','SIGINT']) process.on(signal,async()=>{await telemetry.shutdown();process.exit(0);});
|
||||
main().catch(async()=>{telemetry.log('worker.startup_failed',{},true);await telemetry.shutdown();process.exit(1);});
|
||||
@@ -0,0 +1,13 @@
|
||||
'use strict';
|
||||
const {request}=require('./security');const assert=require('node:assert/strict');const {randomUUID}=require('node:crypto');
|
||||
(async()=>{
|
||||
const url='https://expiry:8443',opts={role:'lb',servername:'api1'};
|
||||
const username='expire_'+randomUUID().slice(0,8),password='temporary-password-'+randomUUID();
|
||||
assert.equal((await request(url+'/api/v1/users',{...opts,method:'POST',body:{username,password,display_name:'Expiry'}})).status,201);
|
||||
const login=await request(url+'/api/v1/auth/sessions',{...opts,method:'POST',headers:{Authorization:'Basic '+Buffer.from(username+':'+password).toString('base64')}});assert.equal(login.status,201);
|
||||
const headers={Authorization:'Bearer '+login.json.token};
|
||||
assert.equal((await request(url+'/api/v1/users/me',{...opts,headers})).status,200);
|
||||
await new Promise(r=>setTimeout(r,2300));
|
||||
assert.equal((await request(url+'/api/v1/users/me',{...opts,headers})).status,401);
|
||||
console.log('PASS: real SESSION_TTL_SECONDS=2: valid session returns 200, same token after 2.3 seconds returns 401; no credentials saved.');
|
||||
})().catch(e=>{console.error('FAIL: '+e.message);process.exitCode=1;});
|
||||
@@ -0,0 +1,4 @@
|
||||
'use strict';
|
||||
const net=require('node:net'),assert=require('node:assert/strict');
|
||||
async function closed(host,port){return new Promise((resolve,reject)=>{const s=net.connect({host,port});s.setTimeout(1500);s.on('connect',()=>{s.destroy();reject(Error('Plaintext bypass '+host+':'+port));});s.on('error',e=>e.code==='ECONNREFUSED'?resolve():reject(e));s.on('timeout',()=>{s.destroy();reject(Error('Unexpected timeout'));});});}
|
||||
(async()=>{for(const [host,ports] of Object.entries({'api1':[9001],'api2':[9001],'otel-collector':[4318,9464],'loki':[3100,9095],'tempo':[3200,4318,9095],'prometheus':[9090]}))for(const port of ports)await closed(host,port);console.log('PASS: native plaintext telemetry/health ports cannot be reached across Docker network; only loopback within proxy boundary.');})().catch(e=>{console.error('FAIL: '+e.message);process.exitCode=1;});
|
||||
@@ -0,0 +1,80 @@
|
||||
'use strict';
|
||||
const https=require('node:https'),net=require('node:net'),fs=require('node:fs'),assert=require('node:assert/strict');
|
||||
const {randomUUID}=require('node:crypto');
|
||||
const ca=fs.readFileSync('/test-certs/ca.crt');
|
||||
function request(url,{role,method='GET',body,headers={},wrongCA=false,servername}={}){
|
||||
return new Promise((resolve,reject)=>{
|
||||
const r=https.request(url,{method,ca:wrongCA?fs.readFileSync('/test-certs/untrusted-ca.crt'):ca,rejectUnauthorized:true,...(servername?{servername}:{}),...(role?{cert:fs.readFileSync('/test-certs/'+role+'.crt'),key:fs.readFileSync('/test-certs/'+role+'.key')}:{}),headers:{...(body?{'Content-Type':'application/json'}:{}),...headers},timeout:10000},res=>{let data='';res.on('data',x=>data+=x);res.on('end',()=>{let json;try{json=JSON.parse(data);}catch{}resolve({status:res.statusCode,headers:res.headers,json,body:data});});});
|
||||
r.on('error',reject);r.on('timeout',()=>r.destroy(Error('timeout')));r.end(body?JSON.stringify(body):undefined);
|
||||
});
|
||||
}
|
||||
async function rejected(p){try{const r=await p;assert.ok([401,403].includes(r.status),'Unexpected success/status '+r.status);}catch(e){if(e.code&&/CERT|TLS|SSL|ECONNRESET|UNABLE_TO_VERIFY_LEAF_SIGNATURE|SELF_SIGNED/.test(e.code))return;throw e;}}
|
||||
async function credentials(role){
|
||||
const identity=role==='api'?'api1':role;
|
||||
const login=await request('https://bao:8200/v1/auth/cert/login',{role:identity,method:'POST',body:{name:role}});
|
||||
assert.equal(login.status,200);const auth=login.json.auth;assert.ok(!auth.policies.includes('root'));assert.ok(auth.lease_duration<=600);
|
||||
const headers={'X-Vault-Token':auth.client_token};
|
||||
const own=await request('https://bao:8200/v1/secret/data/'+role,{role:identity,headers});assert.equal(own.status,200);
|
||||
for(const path of ['secret/data/'+(role==='api'?'worker':'api'),'sys/policies/acl/api']){
|
||||
const r=await request('https://bao:8200/v1/'+path,{role:identity,headers,...(path.startsWith('sys')?{method:'POST',body:{policy:''}}:{})});assert.equal(r.status,403);
|
||||
}
|
||||
await request('https://bao:8200/v1/auth/token/revoke-self',{role:identity,headers,method:'POST',body:{}});
|
||||
return own.json.data.data;
|
||||
}
|
||||
function save(n,v){fs.writeFileSync('/evidence/'+n,JSON.stringify(v,null,2)+'\n');}
|
||||
async function main(){
|
||||
for(const api of ['api1','api2']){
|
||||
const url='https://'+api+':8443/health/ready';assert.equal((await request(url,{role:'lb'})).status,200);
|
||||
for(const role of [undefined,'wrong-ca','worker'])await rejected(request(url,{role}));
|
||||
}
|
||||
await rejected(request('https://lb:8443/health/ready',{wrongCA:true}));
|
||||
await rejected(request('https://lb:8443/health/ready',{servername:'wrong-host.invalid'}));
|
||||
console.log('PASS: both API replicas require the LB identity; no certificate, foreign CA and trusted wrong identity rejected. External CA/hostname validation enforced.');
|
||||
const api=await credentials('api'),worker=await credentials('worker');
|
||||
assert.notEqual(api.database_url,worker.database_url);assert.notEqual(api.broker_url,worker.broker_url);
|
||||
console.log('PASS: OpenBao cert auth issues scoped tokens <=600s; own KV allowed, other role KV and policy writes denied. No root policy.');
|
||||
const {Client}=require('pg');
|
||||
for(const [role,creds] of [['api',api],['worker',worker]]){
|
||||
const db=new Client({connectionString:creds.database_url,ssl:{ca,rejectUnauthorized:true}});await db.connect();
|
||||
assert.equal((await db.query('SELECT ssl FROM pg_stat_ssl WHERE pid=pg_backend_pid()')).rows[0].ssl,true);
|
||||
if(role==='api')assert.ok((await db.query('SELECT count(*) FROM users')).rowCount);
|
||||
else {await assert.rejects(db.query('SELECT password_hash FROM users'),e=>e.code==='42501');await assert.rejects(db.query('SELECT * FROM sessions'),e=>e.code==='42501');}
|
||||
await assert.rejects(db.query('CREATE TABLE unauthorized_table(id int)'),e=>e.code==='42501');await db.end();
|
||||
}
|
||||
const plain=new Client({connectionString:api.database_url,ssl:false});await assert.rejects(plain.connect(),e=>e.code==='28000');await plain.end();
|
||||
console.log('PASS: PostgreSQL TLS verified; plaintext rejected; worker cannot read users/sessions; neither service can create tables.');
|
||||
const {Client:S3}=require('minio');
|
||||
function s3(c){return new S3({endPoint:'s3',port:9000,useSSL:true,region:'us-east-1',accessKey:c.s3_access_key,secretKey:c.s3_secret_key,transportAgent:new https.Agent({ca,rejectUnauthorized:true})});}
|
||||
const a=s3(api),w=s3(worker),bucket='messenger-attachments',key=randomUUID();
|
||||
await a.putObject(bucket,'staging/'+key,Buffer.from('test'));
|
||||
await w.putObject(bucket,'originals/'+key,Buffer.from('test'));
|
||||
await assert.rejects(a.putObject(bucket,'originals/forbidden',Buffer.from('test')),e=>e.code==='AccessDenied');
|
||||
await assert.rejects(w.getObject(bucket,'originals/'+key),e=>e.code==='AccessDenied');
|
||||
const stream=await a.getObject(bucket,'originals/'+key);for await(const b of stream)assert.equal(b.toString(),'test');
|
||||
console.log('PASS: distinct S3 credentials; API stages/reads but cannot write originals; worker writes originals but cannot read them.');
|
||||
const amqp=require('amqplib');const conn=await amqp.connect(api.broker_url,{ca,rejectUnauthorized:true});conn.on('error',()=>{});
|
||||
const ch=await conn.createChannel();ch.on('error',()=>{});
|
||||
await assert.rejects(ch.consume('attachments.v1',()=>{},{}));await conn.close();
|
||||
console.log('PASS: broker uses verified TLS and separate credentials; API producer cannot consume worker queue.');
|
||||
for(const role of ['api1','worker'])assert.equal((await request('https://otel-collector:3443/v1/metrics',{role,method:'POST',body:{}})).status,200);
|
||||
assert.equal((await request('https://otel-collector:3443/v1/metrics',{role:'lb',method:'POST',body:{}})).status,403);
|
||||
await rejected(request('https://otel-collector:3443/v1/metrics',{method:'POST',body:{}}));
|
||||
assert.equal((await request('https://loki:3443/loki/api/v1/labels',{role:'grafana'})).status,200);
|
||||
assert.equal((await request('https://loki:3443/otlp/v1/logs',{role:'grafana',method:'POST',body:{}})).status,403);
|
||||
assert.equal((await request('https://loki:3443/loki/api/v1/push',{role:'grafana',method:'POST',body:{streams:[]}})).status,403);
|
||||
assert.equal((await request('https://prometheus:3443/api/v1/admin/tsdb/delete_series',{role:'grafana',method:'POST',body:{}})).status,403);
|
||||
console.log('PASS: Collector accepts only API/worker identities; Grafana can query Loki but cannot ingest logs.');
|
||||
const {hashPassword,verifyPassword,options}=require('/app/src/password');const times=[];
|
||||
for(let i=0;i<6;i++){const start=performance.now(),encoded=await hashPassword('sample-password-'+i);times.push(performance.now()-start);assert.match(encoded,/^\$argon2id\$v=19\$m=19456,t=2,p=1\$/);assert.ok(await verifyPassword('sample-password-'+i,encoded));assert.ok(!await verifyPassword('wrong-password',encoded));}
|
||||
save('argon2.json',{samples_ms:times,mean_ms:times.reduce((a,b)=>a+b)/times.length,options,container_cpu_limit:1.5,container_memory_mib:512});
|
||||
console.log('PASS: Argon2id PHC stores salt/parameters, 19 MiB t=2 p=1; six measured hashes and password verification checks.');
|
||||
// Login limit is shared by two replicas, last to avoid disturbing other checks.
|
||||
let limited;
|
||||
for(let i=0;i<35;i++){const r=await request('https://lb:8443/api/v1/auth/sessions',{method:'POST',headers:{Authorization:'Basic '+Buffer.from('invalid_user:invalid-password-123').toString('base64')}});if(r.status===429){limited=r;break;}assert.equal(r.status,401);}
|
||||
assert.ok(limited);assert.equal(limited.json.error.code,'rate_limited');assert.ok(Number(limited.headers['retry-after'])>0);
|
||||
console.log('PASS: repeated login returns 429 rate_limited and Retry-After; database counter shared across replicas.');
|
||||
}
|
||||
if(require.main===module)main().catch(e=>{console.error('FAIL: '+e.message);process.exitCode=1;});
|
||||
module.exports={request,credentials,ca};
|
||||
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
'use strict';
|
||||
const {request,credentials,ca}=require('./security');const assert=require('node:assert/strict');const fs=require('node:fs');const {randomUUID}=require('node:crypto');
|
||||
const sleep=ms=>new Promise(r=>setTimeout(r,ms));
|
||||
async function get(url,role='operator'){const r=await request(url,{role});assert.equal(r.status,200,url);return r.json;}
|
||||
async function wait(fn){let error;for(let i=0;i<50;i++){try{const x=await fn();if(x)return x;}catch(e){error=e;}await sleep(1000);}throw error||Error('Observation timed out');}
|
||||
async function main(){
|
||||
const creds=await credentials('api');const {Client}=require('pg');const db=new Client({connectionString:creds.database_url,ssl:{ca,rejectUnauthorized:true}});await db.connect();
|
||||
const username='obs_'+randomUUID().slice(0,8),marker='DoNotExport-'+randomUUID();
|
||||
async function api(path,method='GET',body,headers={}){return request('https://lb:8443/api/v1'+path,{method,body,headers});}
|
||||
assert.equal((await api('/users','POST',{username,password:marker,display_name:marker})).status,201);
|
||||
let login=await api('/auth/sessions','POST',undefined,{Authorization:'Basic '+Buffer.from(username+':'+marker).toString('base64')});if(login.status===429){await sleep((Number(login.headers['retry-after'])+1)*1000);login=await api('/auth/sessions','POST',undefined,{Authorization:'Basic '+Buffer.from(username+':'+marker).toString('base64')});}assert.equal(login.status,201);
|
||||
const h={Authorization:'Bearer '+login.json.token};
|
||||
const me=await api('/users/me','GET',undefined,h);assert.equal(me.status,200);
|
||||
const chat=await api('/chats','POST',{title:marker,member_ids:[login.json.user.id]},h);assert.equal(chat.status,201);
|
||||
// Insert a synthetic durable job with a missing staging object to observe bounded retry/failed.
|
||||
const id=randomUUID(),job=randomUUID();
|
||||
await db.query(`INSERT INTO attachments(id,chat_id,owner_id,filename,content_type,size_bytes,sha256,object_key,staging_key,status) VALUES($1,$2,$3,'synthetic.png','image/png',1,$4,$5,$6,'queued')`,[id,chat.json.id,login.json.user.id,'0'.repeat(64),'originals/'+id+'/v1','staging/missing-'+id]);
|
||||
const row=(await db.query('INSERT INTO attachment_jobs(id,attachment_id) VALUES($1,$2) RETURNING *',[job,id])).rows[0];
|
||||
const amqp=require('amqplib'),conn=await amqp.connect(creds.broker_url,{ca,rejectUnauthorized:true});conn.on('error',()=>{});const channel=await conn.createConfirmChannel();channel.on('error',()=>{});
|
||||
await new Promise((resolve,reject)=>channel.sendToQueue('attachments.v1',Buffer.from(JSON.stringify({schema_version:1,job_id:job,type:'attachment.process.v1',attachment_id:id,pipeline_version:1,attempt:1,created_at:new Date(row.created_at).toISOString()})),{persistent:true},e=>e?reject(e):resolve()));await conn.close();
|
||||
await wait(async()=>{const r=await api('/attachments/'+id,'GET',undefined,h);return r.json.status==='failed';});
|
||||
assert.equal((await db.query('SELECT attempts FROM attachment_jobs WHERE id=$1',[job])).rows[0].attempts,5);await db.end();
|
||||
async function logs(service,filter){const query='{service_name="'+service+'"} |= '+JSON.stringify(filter);const x=await get('https://loki:3443/loki/api/v1/query_range?'+new URLSearchParams({query,limit:'1000'}));return x.data.result.flatMap(s=>s.values.map(v=>JSON.parse(v[1])));}
|
||||
const apiLog=await wait(async()=>(await logs('messenger-api',me.headers['x-request-id'])).find(x=>x.event==='http.completed'));
|
||||
const workerLog=await wait(async()=>(await logs('messenger-worker',id)).find(x=>x.outcome==='failed'));
|
||||
const traces={};for(const [name,log] of Object.entries({api:apiLog,worker:workerLog})){traces[name]=await wait(()=>get('https://tempo:3443/api/traces/'+log.trace_id));assert.ok(JSON.stringify(traces[name]).includes(Buffer.from(log.span_id,'hex').toString('base64')));}
|
||||
const metrics={};for(const name of ['messenger_http_requests_total','messenger_http_duration_seconds_bucket','messenger_jobs_total','messenger_job_duration_seconds_bucket']){
|
||||
metrics[name]=await wait(async()=>{const m=await get('https://prometheus:3443/api/v1/query?query='+encodeURIComponent(name));return m.data.result.length?m:null;});
|
||||
for(const x of metrics[name].data.result)for(const forbidden of ['request_id','user_id','chat_id','message_id','attachment_id','filename'])assert.equal(x.metric[forbidden],undefined);
|
||||
}
|
||||
const corpus=JSON.stringify({traces,metrics,logs:[await logs('messenger-api',''),await logs('messenger-worker','')]});for(const value of [marker,login.json.token,Buffer.from(username+':'+marker).toString('base64')])assert.ok(!corpus.includes(value),'Sensitive telemetry');
|
||||
fs.writeFileSync('/evidence/telemetry.json',JSON.stringify({apiLog,workerLog,traces,metric_series:Object.fromEntries(Object.entries(metrics).map(([k,v])=>[k,v.data.result.length])),failed_job_attempts:5},null,2)+'\n');
|
||||
console.log('PASS: TLS/mTLS telemetry pipelines store actual API and failed-worker spans/logs, four metric families, no ID labels or synthetic secret/body leakage; failed job stops after five attempts.');
|
||||
}
|
||||
main().catch(e=>{console.error('FAIL: '+e.message);process.exit(1);});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user