929 lines
37 KiB
YAML
929 lines
37 KiB
YAML
# Учебный стенд lab7 «Безопасность, mTLS и OpenBao» (поверх lab6, бизнес-API без изменений).
|
||
#
|
||
# клиент ─TLS─▶ lb:8443 ─mTLS(identity lb)─▶ api×2:8443 ─TLS verify-full + client cert─▶ postgres
|
||
# │ ├─TLS + ACL──────────▶ redis ├─mTLS(api)──▶ nats ◀─mTLS(worker)─ worker×2
|
||
# │ ├─TLS + SigV4 prefix─▶ s3 ├─mTLS───────▶ otel-gw ─▶ collector ─mTLS─▶ *-gw ─▶ prometheus/loki/tempo
|
||
# └─TLS + AppRole────────▶ openbao (scoped KV, токен 5 мин) grafana ─mTLS(read-only)─▶ *-gw
|
||
# Секреты сервисов приложения — ТОЛЬКО из OpenBao; compose secrets — только у инфраструктуры и one-shot задач.
|
||
# Наружу (только 127.0.0.1): 8443 (API, + 8444/8445 для профилей ttl/fault), 3000 (Grafana HTTPS), 8200 (OpenBao HTTPS).
|
||
# Запуск из чистого clone: ./scripts/init-secrets.sh && ./scripts/up.sh (Windows: scripts\init-secrets.ps1; scripts\up.ps1)
|
||
name: mtusi-lab7
|
||
|
||
# ------------------------------------------------------------------------------------------- общие блоки
|
||
x-hardening: &hardening # контейнер без лишних прав: RO rootfs, без capabilities, без повышения
|
||
read_only: true
|
||
cap_drop: [ALL]
|
||
security_opt: ["no-new-privileges:true"]
|
||
init: false
|
||
|
||
x-app-image: &app-image
|
||
build:
|
||
context: .
|
||
dockerfile: Dockerfile
|
||
image: mtusi-lab7-app:local
|
||
|
||
x-trust: &trust ./secrets/tls/trust:/run/tls/trust:ro # CA, CRL, pinned (публичное)
|
||
|
||
x-app-env: &app-env
|
||
APP_ENV: ${APP_ENV:-lab}
|
||
APP_HOST: 0.0.0.0
|
||
APP_PORT: "8443" # единственный сетевой listener: mTLS
|
||
HEALTH_PORT: "8081" # только 127.0.0.1 внутри контейнера (/health/*)
|
||
APP_TLS: "true"
|
||
MTLS_ALLOWED_CLIENTS: spiffe://mtusi.lab/lb
|
||
TLS_CA_FILE: /run/tls/trust/ca.crt
|
||
TLS_CRL_FILE: /run/tls/trust/crl.pem
|
||
TLS_CERT_FILE: /run/tls/self/tls.crt
|
||
TLS_KEY_FILE: /run/tls/self/tls.key
|
||
# PostgreSQL: TLS verify-full (CA + имя postgres) + клиентский сертификат; роль/пароль — из OpenBao.
|
||
DB_HOST: postgres
|
||
DB_PORT: "5432"
|
||
DB_NAME: messenger
|
||
DB_SSLMODE: verify-full
|
||
DB_SSLROOTCERT: /run/tls/trust/ca.crt
|
||
DB_SSLCRL: /run/tls/trust/crl.pem
|
||
DB_SSLCERT: /run/tls/self/tls.crt
|
||
DB_SSLKEY: /run/tls/self/tls.key
|
||
DB_POOL_MIN: "1"
|
||
DB_POOL_MAX: ${DB_POOL_MAX:-10}
|
||
DB_POOL_TIMEOUT_SECONDS: "2"
|
||
DB_STATEMENT_TIMEOUT_MS: "5000"
|
||
DB_MAX_LIFETIME_SECONDS: "600"
|
||
SESSION_STORE: postgres
|
||
SESSION_TTL_SECONDS: ${SESSION_TTL_SECONDS:-3600}
|
||
SESSION_CACHE_TTL_SECONDS: ${SESSION_CACHE_TTL_SECONDS:-60}
|
||
IDEMPOTENCY_TTL_SECONDS: ${IDEMPOTENCY_TTL_SECONDS:-86400}
|
||
CACHE_TIMEOUT_SECONDS: "0.2"
|
||
REQUEST_TIMEOUT_SECONDS: "10"
|
||
SHUTDOWN_DRAIN_SECONDS: ${SHUTDOWN_DRAIN_SECONDS:-3}
|
||
MIGRATE_ON_START: "false"
|
||
S3_ENDPOINT: https://s3:9000
|
||
S3_REGION: ${S3_REGION:-us-east-1}
|
||
S3_BUCKET: ${S3_BUCKET:-messenger-attachments}
|
||
MAX_UPLOAD_BYTES: ${MAX_UPLOAD_BYTES:-10485760}
|
||
MAX_IMAGE_PIXELS: ${MAX_IMAGE_PIXELS:-40000000}
|
||
UPLOAD_CONCURRENCY: ${UPLOAD_CONCURRENCY:-16}
|
||
UPLOAD_TIMEOUT_SECONDS: "120"
|
||
UPLOAD_GRACE_SECONDS: ${UPLOAD_GRACE_SECONDS:-900}
|
||
JANITOR_INTERVAL_SECONDS: "60"
|
||
BROKER_URL: tls://nats:4222 # без учётных данных: identity — клиентский сертификат
|
||
BROKER_ACK_WAIT_SECONDS: ${BROKER_ACK_WAIT_SECONDS:-20}
|
||
BROKER_MAX_ACK_PENDING: ${BROKER_MAX_ACK_PENDING:-16}
|
||
PIPELINE_VERSION: ${PIPELINE_VERSION:-1}
|
||
JOB_MAX_ATTEMPTS: ${JOB_MAX_ATTEMPTS:-5}
|
||
JOB_LEASE_SECONDS: ${JOB_LEASE_SECONDS:-20}
|
||
RELAY_INTERVAL_SECONDS: "1"
|
||
FAULT_HOOKS: ${FAULT_HOOKS:-}
|
||
# OpenBao: AppRole (role_id + SecretID из /run/bao) → токен 5 мин со scoped policy. Корневого токена нет.
|
||
BAO_ADDR: https://openbao:8200
|
||
BAO_CACERT: /run/tls/trust/ca.crt
|
||
BAO_ROLE_ID_FILE: /run/bao/role_id
|
||
BAO_SECRET_ID_FILE: /run/bao/secret_id
|
||
BAO_REFRESH_SECONDS: ${BAO_REFRESH_SECONDS:-15}
|
||
BAO_MAX_STALE_SECONDS: ${BAO_MAX_STALE_SECONDS:-3600}
|
||
BAO_STARTUP_TIMEOUT: "120"
|
||
# Argon2id (≥ 19 MiB, t=2, p=1; итог обоснован kdf-bench) и бюджет KDF на реплику.
|
||
ARGON2_MEMORY_KIB: ${ARGON2_MEMORY_KIB:-19456}
|
||
ARGON2_ITERATIONS: ${ARGON2_ITERATIONS:-3}
|
||
ARGON2_PARALLELISM: ${ARGON2_PARALLELISM:-1}
|
||
KDF_CONCURRENCY: ${KDF_CONCURRENCY:-2}
|
||
KDF_QUEUE_TIMEOUT_SECONDS: ${KDF_QUEUE_TIMEOUT_SECONDS:-1}
|
||
LOGIN_IP_LIMIT: ${LOGIN_IP_LIMIT:-120}
|
||
LOGIN_IP_WINDOW_SECONDS: ${LOGIN_IP_WINDOW_SECONDS:-60}
|
||
LOGIN_FAIL_LIMIT: ${LOGIN_FAIL_LIMIT:-5}
|
||
LOGIN_FAIL_WINDOW_SECONDS: ${LOGIN_FAIL_WINDOW_SECONDS:-300}
|
||
REGISTER_IP_LIMIT: ${REGISTER_IP_LIMIT:-600}
|
||
REGISTER_IP_WINDOW_SECONDS: ${REGISTER_IP_WINDOW_SECONDS:-60}
|
||
# OpenTelemetry → mTLS-шлюз Collector (identity = сертификат сервиса).
|
||
OTEL_SDK_DISABLED: ${OTEL_SDK_DISABLED:-false}
|
||
OTEL_EXPORTER_OTLP_ENDPOINT: https://otel-collector:4318
|
||
OTEL_EXPORTER_OTLP_PROTOCOL: http/protobuf
|
||
OTEL_EXPORTER_OTLP_CERTIFICATE: /run/tls/trust/ca.crt
|
||
OTEL_EXPORTER_OTLP_CLIENT_CERTIFICATE: /run/tls/self/tls.crt
|
||
OTEL_EXPORTER_OTLP_CLIENT_KEY: /run/tls/self/tls.key
|
||
OTEL_EXPORTER_OTLP_TIMEOUT: "5"
|
||
OTEL_RESOURCE_ATTRIBUTES: deployment.environment.name=${APP_ENV:-lab}
|
||
OTEL_TRACES_SAMPLER: parentbased_traceidratio
|
||
OTEL_TRACES_SAMPLER_ARG: ${OTEL_TRACES_SAMPLER_ARG:-1.0}
|
||
OTEL_METRIC_EXPORT_INTERVAL: "10000"
|
||
OTEL_BSP_MAX_QUEUE_SIZE: "2048"
|
||
OTEL_BSP_SCHEDULE_DELAY: "1000"
|
||
OTEL_BLRP_MAX_QUEUE_SIZE: "2048"
|
||
OTEL_BLRP_SCHEDULE_DELAY: "1000"
|
||
OTEL_ATTRIBUTE_VALUE_LENGTH_LIMIT: "1024"
|
||
OTEL_PYTHON_SDK_INTERNAL_METRICS_ENABLED: "true"
|
||
|
||
x-api: &api
|
||
<<: [*app-image, *hardening]
|
||
user: "10001:10001"
|
||
tmpfs: ["/tmp:size=16m,mode=1777"]
|
||
environment: &api-env
|
||
<<: *app-env
|
||
OTEL_SERVICE_NAME: messenger-api
|
||
SESSION_CACHE: redis
|
||
CACHE_URL: rediss://redis:6379/0 # TLS + ACL-пользователь messenger-api (пароль — из OpenBao)
|
||
BROKER_INBOX_PREFIX: _INBOX_api
|
||
volumes:
|
||
- *trust
|
||
- ./secrets/tls/api:/run/tls/self:ro
|
||
- ./secrets/bao/api:/run/bao:ro # role_id + SecretID (первый секрет; ротируется оператором)
|
||
depends_on: &api-deps
|
||
migrate: {condition: service_completed_successfully}
|
||
s3-init: {condition: service_completed_successfully}
|
||
broker-init: {condition: service_completed_successfully}
|
||
openbao: {condition: service_healthy}
|
||
redis: {condition: service_started}
|
||
networks: [app, data, objects, broker, telemetry, vault] # НЕТ ports: только через LB (mTLS)
|
||
restart: unless-stopped
|
||
stop_signal: SIGTERM
|
||
stop_grace_period: 15s
|
||
|
||
services:
|
||
# ======================================================================================= вход
|
||
lb:
|
||
<<: *hardening
|
||
image: haproxy:3.0.5-alpine
|
||
user: "99:99"
|
||
tmpfs: ["/tmp:size=4m,mode=1777"]
|
||
volumes:
|
||
- ./infra/haproxy/haproxy.cfg:/usr/local/etc/haproxy/haproxy.cfg:ro
|
||
- *trust
|
||
- ./secrets/tls/ingress:/run/tls/ingress:ro # серверный сертификат для клиентов (SAN localhost)
|
||
- ./secrets/tls/lb:/run/tls/lb:ro # клиентская identity LB для mTLS к API
|
||
environment:
|
||
LB_SERVER_MAXCONN: ${LB_SERVER_MAXCONN:-10}
|
||
LB_QUEUE_TIMEOUT: ${LB_QUEUE_TIMEOUT:-2s}
|
||
LB_IP_RATE_LIMIT: ${LB_IP_RATE_LIMIT:-5000}
|
||
LB_LOGIN_MAXCONN: ${LB_LOGIN_MAXCONN:-3} # слотов на реплику для POST /auth/sessions и /users
|
||
ports:
|
||
- "127.0.0.1:${API_PORT:-8443}:8443" # публичный API — только HTTPS
|
||
- "127.0.0.1:${API_TTL_PORT:-8444}:8444" # api-ttl (профиль ttl)
|
||
- "127.0.0.1:${API_FAULT_PORT:-8445}:8445" # api-fault (профиль fault)
|
||
healthcheck:
|
||
test: ["CMD", "wget", "-q", "-O", "/dev/null", "http://127.0.0.1:8404/stats"]
|
||
interval: 5s
|
||
timeout: 2s
|
||
retries: 3
|
||
networks: [edge, app]
|
||
restart: unless-stopped
|
||
stop_grace_period: 5s
|
||
deploy:
|
||
resources:
|
||
limits: {cpus: "0.5", memory: 128M, pids: 64}
|
||
|
||
# ======================================================================================= приложение
|
||
api:
|
||
<<: *api
|
||
deploy:
|
||
replicas: ${API_REPLICAS:-2}
|
||
resources:
|
||
limits: {cpus: "${API_CPUS:-1.0}", memory: "${API_MEMORY:-512M}", pids: 256}
|
||
|
||
api-ttl: # короткий TTL сессии — тест истечения (LB :8444)
|
||
<<: *api
|
||
profiles: [ttl]
|
||
environment:
|
||
<<: *api-env
|
||
SESSION_TTL_SECONDS: "2"
|
||
deploy:
|
||
resources:
|
||
limits: {cpus: "0.5", memory: 256M, pids: 256}
|
||
|
||
api-fault: # тесты отказов уровня 4 lab5 (LB :8445)
|
||
<<: *api
|
||
profiles: [fault]
|
||
environment:
|
||
<<: *api-env
|
||
FAULT_INJECT: ${API_FAULT_INJECT:-crash_after_commit_before_publish}
|
||
UPLOAD_GRACE_SECONDS: "10"
|
||
UPLOAD_TIMEOUT_SECONDS: "5"
|
||
JANITOR_INTERVAL_SECONDS: "2"
|
||
deploy:
|
||
resources:
|
||
limits: {cpus: "0.5", memory: 256M, pids: 256}
|
||
|
||
worker:
|
||
<<: [*app-image, *hardening]
|
||
command: ["worker"]
|
||
user: "10001:10001"
|
||
tmpfs: ["/tmp:size=64m,mode=1777"]
|
||
environment:
|
||
<<: *app-env
|
||
OTEL_SERVICE_NAME: messenger-worker
|
||
SESSION_CACHE: "off"
|
||
BROKER_INBOX_PREFIX: _INBOX_worker
|
||
WORKER_CONCURRENCY: ${WORKER_CONCURRENCY:-2}
|
||
WORKER_PIPELINES: ${WORKER_PIPELINES:-1,2}
|
||
JOB_TIMEOUT_SECONDS: ${JOB_TIMEOUT_SECONDS:-60}
|
||
JOB_RETRY_BASE_SECONDS: ${JOB_RETRY_BASE_SECONDS:-2}
|
||
JOB_RETRY_MAX_SECONDS: ${JOB_RETRY_MAX_SECONDS:-60}
|
||
JOB_STUCK_SECONDS: ${JOB_STUCK_SECONDS:-600}
|
||
WORKER_PROCESS_MEMORY_MB: ${WORKER_PROCESS_MEMORY_MB:-768}
|
||
STAGING_RETENTION_SECONDS: ${STAGING_RETENTION_SECONDS:-86400}
|
||
MAINTENANCE_INTERVAL_SECONDS: "5"
|
||
WORKER_DRAIN_SECONDS: "20"
|
||
volumes:
|
||
- *trust
|
||
- ./secrets/tls/worker:/run/tls/self:ro
|
||
- ./secrets/bao/worker:/run/bao:ro
|
||
depends_on:
|
||
migrate: {condition: service_completed_successfully}
|
||
s3-init: {condition: service_completed_successfully}
|
||
broker-init: {condition: service_completed_successfully}
|
||
openbao: {condition: service_healthy}
|
||
networks: [data, objects, broker, telemetry, vault]
|
||
healthcheck:
|
||
test: ["CMD", "python", "-m", "messenger", "worker-healthcheck"]
|
||
interval: 5s
|
||
timeout: 3s
|
||
retries: 6
|
||
start_period: 20s
|
||
restart: unless-stopped
|
||
stop_grace_period: 30s
|
||
deploy:
|
||
replicas: ${WORKER_REPLICAS:-2}
|
||
resources:
|
||
limits: {cpus: "${WORKER_CPUS:-1.0}", memory: "${WORKER_MEMORY:-1G}", pids: 256}
|
||
|
||
# ======================================================================================= one-shot (оператор)
|
||
# Миграции схемы — владелец схемы messenger_owner (пароль — compose secret, сертификат identity migrate).
|
||
migrate:
|
||
<<: [*app-image, *hardening]
|
||
command: ["migrate"]
|
||
user: "10001:10001"
|
||
tmpfs: ["/tmp:size=4m,mode=1777"]
|
||
environment: &owner-env
|
||
DB_HOST: postgres
|
||
DB_NAME: messenger
|
||
DB_SSLMODE: verify-full
|
||
DB_SSLROOTCERT: /run/tls/trust/ca.crt
|
||
DB_SSLCERT: /run/tls/self/tls.crt
|
||
DB_SSLKEY: /run/tls/self/tls.key
|
||
DB_USER: messenger_owner
|
||
DB_PASSWORD_FILE: /run/secrets/db_owner_password
|
||
SESSION_CACHE: "off"
|
||
OTEL_SDK_DISABLED: "true"
|
||
APP_TLS: "false"
|
||
secrets: [db_owner_password]
|
||
volumes:
|
||
- *trust
|
||
- ./secrets/tls/migrate:/run/tls/self:ro
|
||
depends_on:
|
||
postgres: {condition: service_healthy}
|
||
networks: [data]
|
||
restart: "no"
|
||
deploy:
|
||
resources:
|
||
limits: {cpus: "0.5", memory: 256M, pids: 64}
|
||
|
||
# Bootstrap брокера (stream + durable consumer) — identity bootstrap (единственная с правами $JS.API.>).
|
||
broker-init:
|
||
<<: [*app-image, *hardening]
|
||
command: ["broker-bootstrap"]
|
||
user: "10001:10001"
|
||
tmpfs: ["/tmp:size=4m,mode=1777"]
|
||
environment: &bootstrap-env
|
||
BROKER_URL: tls://nats:4222
|
||
BROKER_INBOX_PREFIX: _INBOX_bootstrap
|
||
BROKER_ACK_WAIT_SECONDS: ${BROKER_ACK_WAIT_SECONDS:-20}
|
||
BROKER_MAX_ACK_PENDING: ${BROKER_MAX_ACK_PENDING:-16}
|
||
TLS_CA_FILE: /run/tls/trust/ca.crt
|
||
TLS_CERT_FILE: /run/tls/self/tls.crt
|
||
TLS_KEY_FILE: /run/tls/self/tls.key
|
||
DB_HOST: postgres
|
||
SESSION_CACHE: "off"
|
||
OTEL_SDK_DISABLED: "true"
|
||
APP_TLS: "false"
|
||
volumes:
|
||
- *trust
|
||
- ./secrets/tls/bootstrap:/run/tls/self:ro
|
||
depends_on:
|
||
nats: {condition: service_healthy}
|
||
networks: [broker]
|
||
restart: "no"
|
||
deploy:
|
||
resources:
|
||
limits: {cpus: "0.25", memory: 128M, pids: 64}
|
||
|
||
# Bootstrap S3: приватный bucket admin-ключом + проверка prefix-прав identity api/worker и запрета анонима.
|
||
s3-init:
|
||
<<: [*app-image, *hardening]
|
||
command: ["s3-bootstrap"]
|
||
user: "10001:10001"
|
||
tmpfs: ["/tmp:size=4m,mode=1777"]
|
||
environment:
|
||
S3_ENDPOINT: https://s3:9000
|
||
S3_REGION: ${S3_REGION:-us-east-1}
|
||
S3_BUCKET: ${S3_BUCKET:-messenger-attachments}
|
||
TLS_CA_FILE: /run/tls/trust/ca.crt
|
||
S3_ADMIN_ACCESS_KEY_ID_FILE: /run/secrets/s3_admin_access_key_id
|
||
S3_ADMIN_SECRET_ACCESS_KEY_FILE: /run/secrets/s3_admin_secret_access_key
|
||
S3_ACCESS_KEY_ID_FILE: /run/secrets/s3_api_access_key_id
|
||
S3_SECRET_ACCESS_KEY_FILE: /run/secrets/s3_api_secret_access_key
|
||
S3_WORKER_ACCESS_KEY_ID_FILE: /run/secrets/s3_worker_access_key_id
|
||
S3_WORKER_SECRET_ACCESS_KEY_FILE: /run/secrets/s3_worker_secret_access_key
|
||
OTEL_SDK_DISABLED: "true"
|
||
secrets: [s3_admin_access_key_id, s3_admin_secret_access_key, s3_api_access_key_id, s3_api_secret_access_key,
|
||
s3_worker_access_key_id, s3_worker_secret_access_key]
|
||
volumes: [*trust]
|
||
depends_on:
|
||
s3: {condition: service_healthy}
|
||
networks: [objects]
|
||
restart: "no"
|
||
deploy:
|
||
resources:
|
||
limits: {cpus: "0.25", memory: 128M, pids: 64}
|
||
|
||
# Права томов для сервисов, работающих не от root (nats/s3 — uid 1000, tempo — 10001). Без сети.
|
||
volumes-init:
|
||
<<: *app-image
|
||
user: "0:0"
|
||
entrypoint: ["sh", "-c", "chown -R 1000:1000 /v/nats /v/s3 && chown -R 10001:10001 /v/tempo"]
|
||
command: []
|
||
read_only: true
|
||
cap_drop: [ALL]
|
||
cap_add: [CHOWN, DAC_OVERRIDE, FOWNER]
|
||
security_opt: ["no-new-privileges:true"]
|
||
volumes:
|
||
- natsdata:/v/nats
|
||
- s3data:/v/s3
|
||
- tempodata:/v/tempo
|
||
network_mode: none
|
||
restart: "no"
|
||
|
||
# Операторские инструменты (профиль tools): PKI и CLI заданий. НЕ работают постоянно на стенде.
|
||
pki:
|
||
<<: *app-image
|
||
profiles: [tools]
|
||
user: "0:0" # выставляет владельца ключей = uid сервиса (Linux bind mount)
|
||
entrypoint: ["python", "-m", "messenger", "pki"]
|
||
command: ["status"]
|
||
working_dir: /work
|
||
environment:
|
||
PKI_ROOT: /work/secrets
|
||
LEAF_DAYS: ${LEAF_DAYS:-30}
|
||
volumes:
|
||
- ./secrets:/work/secrets
|
||
read_only: true
|
||
tmpfs: ["/tmp:size=4m"]
|
||
cap_drop: [ALL]
|
||
cap_add: [CHOWN, DAC_OVERRIDE, FOWNER]
|
||
security_opt: ["no-new-privileges:true"]
|
||
network_mode: none
|
||
restart: "no"
|
||
|
||
ops: # docker compose --profile tools up -d ops; ... exec -T ops python -m messenger jobs …
|
||
<<: [*app-image, *hardening]
|
||
profiles: [tools]
|
||
user: "10001:10001"
|
||
entrypoint: ["python", "-c", "import signal,time; signal.signal(signal.SIGTERM, lambda *a: exit(0)); time.sleep(10**9)"]
|
||
command: []
|
||
healthcheck: {disable: true} # не HTTP-сервис: HEALTHCHECK образа к нему не относится
|
||
tmpfs: ["/tmp:size=16m,mode=1777"]
|
||
environment:
|
||
<<: [*owner-env, *bootstrap-env]
|
||
S3_ENDPOINT: https://s3:9000
|
||
S3_BUCKET: ${S3_BUCKET:-messenger-attachments}
|
||
S3_ACCESS_KEY_ID_FILE: /run/secrets/s3_admin_access_key_id
|
||
S3_SECRET_ACCESS_KEY_FILE: /run/secrets/s3_admin_secret_access_key
|
||
BROKER_STREAM: ATTACHMENT_JOBS
|
||
PIPELINE_VERSION: ${PIPELINE_VERSION:-1}
|
||
JOB_MAX_ATTEMPTS: ${JOB_MAX_ATTEMPTS:-5}
|
||
secrets: [db_owner_password, s3_admin_access_key_id, s3_admin_secret_access_key]
|
||
volumes:
|
||
- *trust
|
||
- ./secrets/tls/bootstrap:/run/tls/self:ro
|
||
networks: [data, objects, broker]
|
||
restart: "no"
|
||
deploy:
|
||
resources:
|
||
limits: {cpus: "0.5", memory: 256M, pids: 64}
|
||
|
||
# Отрицательные тесты внутренних связей (профиль tests): запускается оператором, видит все внутренние
|
||
# сети и тестовые identity (rogue/foreign/expired/revoked) + действующие сертификаты для позитивных проверок.
|
||
probe:
|
||
<<: *app-image
|
||
profiles: [tests]
|
||
user: "0:0"
|
||
healthcheck: {disable: true}
|
||
entrypoint: ["python"]
|
||
command: ["student-tests/internal_security.py"]
|
||
working_dir: /repo
|
||
environment:
|
||
PYTHONPATH: /app/src
|
||
S3_BUCKET: ${S3_BUCKET:-messenger-attachments}
|
||
TLS_CA_FILE: /run/tls/trust/ca.crt
|
||
read_only: true
|
||
tmpfs: ["/tmp:size=16m"]
|
||
cap_drop: [ALL]
|
||
cap_add: [DAC_READ_SEARCH] # читать ключи разных uid (только чтение)
|
||
security_opt: ["no-new-privileges:true"]
|
||
volumes:
|
||
- ./student-tests:/repo/student-tests:ro
|
||
- ./tests:/repo/tests:ro
|
||
- ./secrets/tls:/secrets/tls:ro
|
||
- ./secrets/test:/secrets/test:ro
|
||
- ./secrets/bao:/secrets/bao:ro
|
||
- *trust
|
||
networks: [app, data, objects, broker, telemetry, observability, vault]
|
||
restart: "no"
|
||
|
||
# Трек 1 «Компрометация worker» (профиль tests): изолированный «злоумышленник» в сетевой позиции worker
|
||
# (ровно сети worker) с УКРАДЕННЫМ снимком материала worker (secrets/test/stolen-worker: сертификат, ключ,
|
||
# role_id, SecretID). Других секретов у него нет. Запуск — research/worker_compromise.py.
|
||
attacker:
|
||
<<: *app-image
|
||
profiles: [tests]
|
||
user: "10001:10001"
|
||
healthcheck: {disable: true}
|
||
entrypoint: ["python"]
|
||
command: ["research/attacker.py", "matrix"]
|
||
working_dir: /repo
|
||
environment:
|
||
PYTHONPATH: /app/src
|
||
S3_BUCKET: ${S3_BUCKET:-messenger-attachments}
|
||
MATERIAL: /stolen
|
||
read_only: true
|
||
tmpfs: ["/tmp:size=16m,mode=1777"]
|
||
cap_drop: [ALL]
|
||
security_opt: ["no-new-privileges:true"]
|
||
volumes:
|
||
- ./research:/repo/research:ro
|
||
- ./secrets/test/stolen:/stolen:ro
|
||
- ./secrets/test/loot:/loot # что «вынесено» (секреты из OpenBao) — для проверки после ротации
|
||
- *trust
|
||
networks: [data, objects, broker, telemetry, vault]
|
||
restart: "no"
|
||
deploy:
|
||
resources:
|
||
limits: {cpus: "0.5", memory: 256M, pids: 64}
|
||
|
||
# ======================================================================================= данные
|
||
postgres:
|
||
<<: *hardening
|
||
image: postgres:16.10-alpine
|
||
user: "70:70"
|
||
# Ключ сервера копируется в tmpfs с правами 0600 (PostgreSQL отвергает ключ с правами group/world,
|
||
# а bind mount на Docker Desktop/Windows их показывает) — затем официальный entrypoint.
|
||
entrypoint: ["sh", "-c", "install -d -m 700 /tmp/pgtls && install -m 600 /run/tls/self/tls.key /tmp/pgtls/tls.key && exec docker-entrypoint.sh \"$$@\"", "--"]
|
||
command:
|
||
- postgres
|
||
- -c
|
||
- max_connections=${PG_MAX_CONNECTIONS:-100}
|
||
- -c
|
||
- hba_file=/etc/postgresql/pg_hba.conf
|
||
- -c
|
||
- ident_file=/etc/postgresql/pg_ident.conf
|
||
- -c
|
||
- ssl=on
|
||
- -c
|
||
- ssl_cert_file=/run/tls/self/tls.crt
|
||
- -c
|
||
- ssl_key_file=/tmp/pgtls/tls.key
|
||
- -c
|
||
- ssl_ca_file=/run/tls/trust/ca.crt
|
||
- -c
|
||
- ssl_crl_file=/run/tls/trust/crl.pem
|
||
- -c
|
||
- ssl_min_protocol_version=TLSv1.2
|
||
- -c
|
||
- password_encryption=scram-sha-256
|
||
- -c
|
||
- log_connections=on
|
||
- -c
|
||
- log_line_prefix=%m [%p] %q%u@%d
|
||
environment:
|
||
POSTGRES_USER: postgres # суперпользователь — только оператор (peer через unix-socket)
|
||
POSTGRES_DB: messenger
|
||
POSTGRES_PASSWORD_FILE: /run/secrets/postgres_password
|
||
POSTGRES_INITDB_ARGS: "--auth-host=scram-sha-256 --data-checksums"
|
||
secrets: [postgres_password, db_owner_password, db_api_a_password, db_worker_a_password]
|
||
volumes:
|
||
- pgdata:/var/lib/postgresql/data
|
||
- ./infra/postgres/pg_hba.conf:/etc/postgresql/pg_hba.conf:ro
|
||
- ./infra/postgres/pg_ident.conf:/etc/postgresql/pg_ident.conf:ro
|
||
- ./infra/postgres/initdb:/docker-entrypoint-initdb.d:ro
|
||
- *trust
|
||
- ./secrets/tls/postgres:/run/tls/self:ro
|
||
tmpfs:
|
||
- /tmp:size=16m,uid=70,gid=70,mode=0700
|
||
- /var/run/postgresql:size=1m,uid=70,gid=70,mode=0775
|
||
healthcheck:
|
||
test: ["CMD-SHELL", "pg_isready -h /var/run/postgresql -U postgres -d messenger"]
|
||
interval: 2s
|
||
timeout: 3s
|
||
retries: 30
|
||
start_period: 10s
|
||
networks: [data]
|
||
shm_size: 256m
|
||
restart: unless-stopped
|
||
stop_grace_period: 30s
|
||
deploy:
|
||
resources:
|
||
limits: {cpus: "${PG_CPUS:-1.0}", memory: 1G, pids: 256}
|
||
|
||
# Redis — кэш сессий и счётчики лимитов. Только TLS (port 0), клиентский сертификат обязателен,
|
||
# пользователь default выключен; ACL-файл собирается в tmpfs из secrets (хеши SHA-256 паролей).
|
||
redis:
|
||
<<: *hardening
|
||
image: redis:7.4.2-alpine
|
||
user: "999:1000"
|
||
tmpfs: ["/tmp:size=4m,mode=1777", "/data:size=4m,mode=1777"]
|
||
command:
|
||
- sh
|
||
- -c
|
||
- |
|
||
umask 077
|
||
h() { tr -d '\r\n' < "/run/secrets/$$1" | sha256sum | cut -d' ' -f1; }
|
||
cat > /tmp/users.acl <<ACL
|
||
user default off
|
||
user messenger-api on #$$(h redis_api_password) resetkeys ~sess:v1:* ~rl:v1:* resetchannels -@all +get +set +del +exists +incr +pexpire +pttl +ping +evalsha +eval +script|load
|
||
user ops on #$$(h redis_ops_password) ~* &* +@all
|
||
ACL
|
||
exec redis-server --port 0 --tls-port 6379 --tls-cert-file /run/tls/self/tls.crt \
|
||
--tls-key-file /run/tls/self/tls.key --tls-ca-cert-file /run/tls/trust/ca.crt --tls-auth-clients yes \
|
||
--tls-protocols "TLSv1.2 TLSv1.3" --aclfile /tmp/users.acl --save '' --appendonly no \
|
||
--maxmemory 64mb --maxmemory-policy volatile-lru --protected-mode yes
|
||
secrets: [redis_api_password, redis_ops_password]
|
||
volumes:
|
||
- *trust
|
||
- ./secrets/tls/redis:/run/tls/self:ro
|
||
healthcheck:
|
||
test: ["CMD-SHELL", "REDISCLI_AUTH=\"$$(cat /run/secrets/redis_ops_password)\" redis-cli --tls --cacert /run/tls/trust/ca.crt --cert /run/tls/self/tls.crt --key /run/tls/self/tls.key -h redis --user ops ping | grep -q PONG"]
|
||
interval: 2s
|
||
timeout: 2s
|
||
retries: 15
|
||
networks: [data]
|
||
restart: unless-stopped
|
||
deploy:
|
||
resources:
|
||
limits: {cpus: "0.25", memory: 128M, pids: 64}
|
||
|
||
nats:
|
||
<<: *hardening
|
||
image: nats:2.11.17-alpine
|
||
user: "1000:1000"
|
||
entrypoint: ["nats-server"]
|
||
command: ["--config", "/run/tls/conf/nats.conf"]
|
||
volumes:
|
||
- natsdata:/data
|
||
- ./infra/nats/nats.conf:/run/tls/conf/nats.conf:ro
|
||
- *trust
|
||
- ./secrets/tls/nats:/run/tls/self:ro
|
||
depends_on:
|
||
volumes-init: {condition: service_completed_successfully}
|
||
healthcheck:
|
||
test: ["CMD", "wget", "-q", "-O", "/dev/null", "http://127.0.0.1:8222/healthz?js-enabled-only=true"]
|
||
interval: 2s
|
||
timeout: 2s
|
||
retries: 30
|
||
start_period: 5s
|
||
networks: [broker]
|
||
restart: unless-stopped
|
||
stop_grace_period: 10s
|
||
deploy:
|
||
resources:
|
||
limits: {cpus: "0.5", memory: 256M, pids: 128}
|
||
|
||
# SeaweedFS: master/volume/filer — только 127.0.0.1 внутри контейнера (in-process, loopback);
|
||
# наружу — только S3 API :9000 по TLS (сертификат s3, перечитывается при ротации), сеть objects.
|
||
s3:
|
||
<<: *hardening
|
||
image: chrislusf/seaweedfs:4.52
|
||
user: "1000:1000"
|
||
entrypoint: ["/usr/bin/weed"]
|
||
stop_signal: SIGINT
|
||
stop_grace_period: 5s
|
||
tmpfs: ["/tmp:size=64m,mode=1777"]
|
||
command:
|
||
- -logtostderr=true
|
||
- server
|
||
- -dir=/data
|
||
- -ip=127.0.0.1
|
||
- -ip.bind=127.0.0.1
|
||
- -s3
|
||
- -s3.port=9000
|
||
- -s3.ip.bind=0.0.0.0
|
||
- -s3.config=/run/secrets/s3_config
|
||
- -s3.cert.file=/run/tls/self/tls.crt
|
||
- -s3.key.file=/run/tls/self/tls.key
|
||
- -s3.port.grpc=0
|
||
- -s3.port.iceberg=0
|
||
- -s3.port.lance=0
|
||
- -master.volumeSizeLimitMB=1024
|
||
- -master.electionTimeout=2s
|
||
- -volume.max=0
|
||
- -volume.preStopSeconds=1
|
||
- -s3.concurrentFileUploadLimit=8
|
||
- -s3.concurrentUploadLimitMB=96
|
||
- -filer.concurrentUploadLimitMB=96
|
||
- -volume.concurrentUploadLimitMB=96
|
||
- -s3.cacheCapacityMB=32
|
||
- -master.telemetry=false
|
||
environment:
|
||
GOMEMLIMIT: 640MiB
|
||
secrets: [s3_config]
|
||
volumes:
|
||
- s3data:/data
|
||
- *trust
|
||
- ./secrets/tls/s3:/run/tls/self:ro
|
||
depends_on:
|
||
volumes-init: {condition: service_completed_successfully}
|
||
healthcheck:
|
||
# master — лидер и запись возможна (loopback, plaintext внутри процесса/контейнера); S3-шлюз — тот же процесс.
|
||
test: ["CMD-SHELL", "wget -q -O /dev/null http://127.0.0.1:9333/cluster/healthz && wget -q -O - http://127.0.0.1:9333/dir/assign | grep -q fid"]
|
||
interval: 2s
|
||
timeout: 2s
|
||
retries: 30
|
||
start_period: 10s
|
||
networks: [objects]
|
||
restart: unless-stopped
|
||
deploy:
|
||
resources:
|
||
limits: {cpus: "1.0", memory: 1G, pids: 256}
|
||
|
||
# ======================================================================================= секреты
|
||
# OpenBao 2.7 вне dev-mode: raft на томе baodata, TLS, аудит в baologs. После каждого старта —
|
||
# sealed: оператор выполняет unseal (scripts/bao-unseal). healthy = инициализирован И распечатан.
|
||
openbao:
|
||
<<: *hardening
|
||
image: openbao/openbao:2.7.2
|
||
entrypoint: ["bao", "server", "-config=/openbao/config/openbao.hcl"]
|
||
command: []
|
||
tmpfs: ["/tmp:size=4m,mode=1777"]
|
||
environment:
|
||
BAO_ADDR: https://127.0.0.1:8200
|
||
BAO_CACERT: /run/tls/trust/ca.crt
|
||
SKIP_SETCAP: "true"
|
||
volumes:
|
||
- baodata:/openbao/file
|
||
- baologs:/openbao/logs
|
||
- ./infra/openbao/openbao.hcl:/openbao/config/openbao.hcl:ro
|
||
- *trust
|
||
- ./secrets/tls/openbao:/run/tls/self:ro
|
||
ports:
|
||
- "127.0.0.1:${BAO_PORT:-8200}:8200" # оператор (init/unseal/rotation) — только loopback хоста
|
||
healthcheck:
|
||
test: ["CMD", "bao", "status"] # код 0 только если initialized и unsealed
|
||
interval: 2s
|
||
timeout: 3s
|
||
retries: 1000000 # ждёт оператора (unseal), не «умирает»
|
||
start_period: 2s
|
||
networks:
|
||
vault: {}
|
||
vault-ops: {}
|
||
restart: unless-stopped
|
||
stop_grace_period: 10s
|
||
deploy:
|
||
resources:
|
||
limits: {cpus: "0.5", memory: 256M, pids: 128}
|
||
|
||
# ======================================================================================= наблюдаемость
|
||
# Каждый backend живёт в сетевом namespace своего mTLS-шлюза (HAProxy): сам слушает только 127.0.0.1,
|
||
# шлюз проверяет клиентский сертификат (CA + CRL) и разрешает identity конкретные пути/методы.
|
||
otel-gw:
|
||
<<: *hardening
|
||
image: haproxy:3.0.5-alpine
|
||
user: "99:99"
|
||
tmpfs: ["/tmp:size=4m,mode=1777"]
|
||
volumes:
|
||
- ./infra/gateway/otel-gw.cfg:/usr/local/etc/haproxy/haproxy.cfg:ro
|
||
- ./infra/gateway/403.http:/usr/local/etc/haproxy/403.http:ro
|
||
- *trust
|
||
- ./secrets/tls/otel-gw:/run/tls/self:ro
|
||
networks:
|
||
telemetry: {aliases: [otel-collector]}
|
||
observability: {aliases: [otel-collector]}
|
||
restart: unless-stopped
|
||
deploy:
|
||
resources:
|
||
limits: {cpus: "0.25", memory: 64M, pids: 64}
|
||
otel-collector:
|
||
<<: *hardening
|
||
image: otel/opentelemetry-collector-contrib:0.130.0
|
||
command: ["--config=/etc/otelcol-contrib/collector.yaml"]
|
||
user: "10001:10001"
|
||
volumes:
|
||
- ./infra/otel/collector.yaml:/etc/otelcol-contrib/collector.yaml:ro
|
||
- *trust
|
||
- ./secrets/tls/otel-collector:/run/tls/self:ro
|
||
environment:
|
||
GOMEMLIMIT: 180MiB
|
||
network_mode: "service:otel-gw"
|
||
depends_on:
|
||
otel-gw: {condition: service_started, restart: true}
|
||
restart: unless-stopped
|
||
stop_grace_period: 10s
|
||
deploy:
|
||
resources:
|
||
limits: {cpus: "${COLLECTOR_CPUS:-0.5}", memory: 256M, pids: 128}
|
||
|
||
prometheus-gw:
|
||
<<: *hardening
|
||
image: haproxy:3.0.5-alpine
|
||
user: "99:99"
|
||
tmpfs: ["/tmp:size=4m,mode=1777"]
|
||
volumes:
|
||
- ./infra/gateway/prometheus-gw.cfg:/usr/local/etc/haproxy/haproxy.cfg:ro
|
||
- ./infra/gateway/403.http:/usr/local/etc/haproxy/403.http:ro
|
||
- *trust
|
||
- ./secrets/tls/prometheus-gw:/run/tls/self:ro
|
||
networks:
|
||
observability: {aliases: [prometheus]}
|
||
restart: unless-stopped
|
||
deploy:
|
||
resources:
|
||
limits: {cpus: "0.25", memory: 64M, pids: 64}
|
||
prometheus:
|
||
<<: *hardening
|
||
image: prom/prometheus:v3.5.5
|
||
user: "65534:65534"
|
||
command:
|
||
- --config.file=/etc/prometheus/prometheus.yml
|
||
- --storage.tsdb.path=/prometheus
|
||
- --storage.tsdb.retention.time=7d
|
||
- --storage.tsdb.retention.size=1GB
|
||
- --web.listen-address=127.0.0.1:9091
|
||
- --web.enable-otlp-receiver
|
||
- --web.enable-remote-write-receiver
|
||
volumes:
|
||
- ./infra/prometheus:/etc/prometheus:ro
|
||
- promdata:/prometheus
|
||
- *trust
|
||
- ./secrets/tls/prometheus:/run/tls/self:ro
|
||
healthcheck:
|
||
test: ["CMD", "wget", "-q", "-O", "/dev/null", "http://127.0.0.1:9091/-/ready"]
|
||
interval: 5s
|
||
timeout: 3s
|
||
retries: 20
|
||
start_period: 10s
|
||
network_mode: "service:prometheus-gw"
|
||
depends_on:
|
||
prometheus-gw: {condition: service_started, restart: true}
|
||
restart: unless-stopped
|
||
deploy:
|
||
resources:
|
||
limits: {cpus: "0.5", memory: 512M, pids: 128}
|
||
|
||
loki-gw:
|
||
<<: *hardening
|
||
image: haproxy:3.0.5-alpine
|
||
user: "99:99"
|
||
tmpfs: ["/tmp:size=4m,mode=1777"]
|
||
volumes:
|
||
- ./infra/gateway/loki-gw.cfg:/usr/local/etc/haproxy/haproxy.cfg:ro
|
||
- ./infra/gateway/403.http:/usr/local/etc/haproxy/403.http:ro
|
||
- *trust
|
||
- ./secrets/tls/loki-gw:/run/tls/self:ro
|
||
networks:
|
||
observability: {aliases: [loki]}
|
||
restart: unless-stopped
|
||
deploy:
|
||
resources:
|
||
limits: {cpus: "0.25", memory: 64M, pids: 64}
|
||
loki:
|
||
<<: *hardening
|
||
image: grafana/loki:3.5.3
|
||
user: "10001:10001"
|
||
command: ["-config.file=/etc/loki/loki.yaml"]
|
||
tmpfs: ["/tmp:size=16m,mode=1777"]
|
||
volumes:
|
||
- ./infra/loki/loki.yaml:/etc/loki/loki.yaml:ro
|
||
- lokidata:/loki
|
||
network_mode: "service:loki-gw"
|
||
depends_on:
|
||
loki-gw: {condition: service_started, restart: true}
|
||
restart: unless-stopped
|
||
deploy:
|
||
resources:
|
||
limits: {cpus: "0.5", memory: 512M, pids: 128}
|
||
|
||
tempo-gw:
|
||
<<: *hardening
|
||
image: haproxy:3.0.5-alpine
|
||
user: "99:99"
|
||
tmpfs: ["/tmp:size=4m,mode=1777"]
|
||
volumes:
|
||
- ./infra/gateway/tempo-gw.cfg:/usr/local/etc/haproxy/haproxy.cfg:ro
|
||
- ./infra/gateway/403.http:/usr/local/etc/haproxy/403.http:ro
|
||
- *trust
|
||
- ./secrets/tls/tempo-gw:/run/tls/self:ro
|
||
networks:
|
||
observability: {aliases: [tempo]}
|
||
restart: unless-stopped
|
||
deploy:
|
||
resources:
|
||
limits: {cpus: "0.25", memory: 64M, pids: 64}
|
||
tempo:
|
||
<<: *hardening
|
||
image: grafana/tempo:2.8.4
|
||
user: "10001:10001"
|
||
command: ["-config.file=/etc/tempo/tempo.yaml"]
|
||
tmpfs: ["/tmp:size=16m,mode=1777"]
|
||
volumes:
|
||
- ./infra/tempo/tempo.yaml:/etc/tempo/tempo.yaml:ro
|
||
- tempodata:/var/tempo
|
||
- *trust
|
||
- ./secrets/tls/tempo:/run/tls/self:ro
|
||
network_mode: "service:tempo-gw"
|
||
depends_on:
|
||
volumes-init: {condition: service_completed_successfully}
|
||
tempo-gw: {condition: service_started, restart: true}
|
||
restart: unless-stopped
|
||
deploy:
|
||
resources:
|
||
limits: {cpus: "0.5", memory: 512M, pids: 128}
|
||
|
||
# Grafana — HTTPS (сертификат grafana: SAN localhost/127.0.0.1/grafana) только на 127.0.0.1:3000;
|
||
# к источникам — mTLS identity grafana с правами только на чтение. Пароль admin — compose secret.
|
||
grafana:
|
||
<<: *hardening
|
||
image: grafana/grafana:13.3.1
|
||
user: "472:0"
|
||
tmpfs: ["/tmp:size=16m,mode=1777"]
|
||
environment:
|
||
GF_SECURITY_ADMIN_USER: admin
|
||
GF_SECURITY_ADMIN_PASSWORD__FILE: /run/secrets/grafana_admin_password
|
||
GF_SECURITY_DISABLE_GRAVATAR: "true"
|
||
GF_SECURITY_COOKIE_SECURE: "true"
|
||
GF_SECURITY_STRICT_TRANSPORT_SECURITY: "true"
|
||
GF_AUTH_ANONYMOUS_ENABLED: "false"
|
||
GF_USERS_ALLOW_SIGN_UP: "false"
|
||
GF_ANALYTICS_REPORTING_ENABLED: "false"
|
||
GF_ANALYTICS_CHECK_FOR_UPDATES: "false"
|
||
GF_ANALYTICS_CHECK_FOR_PLUGIN_UPDATES: "false"
|
||
GF_PLUGINS_PREINSTALL_DISABLED: "true"
|
||
GF_NEWS_NEWS_FEED_ENABLED: "false"
|
||
GF_SERVER_PROTOCOL: https
|
||
GF_SERVER_CERT_FILE: /run/tls/self/tls.crt
|
||
GF_SERVER_CERT_KEY: /run/tls/self/tls.key
|
||
GF_SERVER_MIN_TLS_VERSION: TLS1.2
|
||
GF_SERVER_ROOT_URL: https://127.0.0.1:${GRAFANA_PORT:-3000}/
|
||
GF_LOG_LEVEL: warn
|
||
secrets: [grafana_admin_password]
|
||
volumes:
|
||
- ./infra/grafana/provisioning:/etc/grafana/provisioning:ro
|
||
- ./infra/grafana/dashboards:/etc/grafana/dashboards:ro
|
||
- grafanadata:/var/lib/grafana
|
||
- *trust
|
||
- ./secrets/tls/grafana:/run/tls/self:ro
|
||
ports:
|
||
- "127.0.0.1:${GRAFANA_PORT:-3000}:3000"
|
||
healthcheck:
|
||
test: ["CMD-SHELL", "curl -fsS --cacert /run/tls/trust/ca.crt -o /dev/null https://localhost:3000/api/health || wget -q --ca-certificate=/run/tls/trust/ca.crt -O /dev/null https://localhost:3000/api/health"]
|
||
interval: 5s
|
||
timeout: 3s
|
||
retries: 30
|
||
start_period: 20s
|
||
depends_on:
|
||
prometheus: {condition: service_started}
|
||
loki: {condition: service_started}
|
||
tempo: {condition: service_started}
|
||
networks: [observability, ui]
|
||
restart: unless-stopped
|
||
deploy:
|
||
resources:
|
||
limits: {cpus: "0.5", memory: 512M, pids: 256}
|
||
|
||
networks:
|
||
edge: {} # только LB: публикация 127.0.0.1:8443
|
||
app: {internal: true} # LB ↔ API (mTLS)
|
||
data: {internal: true} # API/worker ↔ PostgreSQL/Redis (TLS)
|
||
objects: {internal: true} # API/worker ↔ S3 (TLS)
|
||
broker: {internal: true} # API/worker ↔ NATS (mTLS)
|
||
telemetry: {internal: true} # API/worker → otel-gw (mTLS)
|
||
observability: {internal: true} # Collector/Grafana ↔ шлюзы backend'ов (mTLS)
|
||
ui: {} # только Grafana: 127.0.0.1:3000
|
||
vault: # API/worker → OpenBao; фиксированная подсеть = secret_id/token bound CIDR
|
||
internal: true
|
||
ipam:
|
||
config: [{subnet: "${VAULT_SUBNET:-10.207.70.0/24}"}]
|
||
vault-ops: {} # только OpenBao: публикация 127.0.0.1:8200 оператору
|
||
|
||
volumes:
|
||
pgdata: {}
|
||
s3data: {}
|
||
natsdata: {}
|
||
baodata: {} # OpenBao raft (зашифрован barrier-ключом; без unseal нечитаем)
|
||
baologs: {} # аудит OpenBao (значения — HMAC)
|
||
promdata: {}
|
||
lokidata: {}
|
||
tempodata: {}
|
||
grafanadata: {}
|
||
|
||
secrets: # только инфраструктура и one-shot задачи; файлы создаёт scripts/init-secrets
|
||
postgres_password: {file: ./secrets/postgres_password}
|
||
db_owner_password: {file: ./secrets/db_owner_password}
|
||
db_api_a_password: {file: ./secrets/db_api_a_password}
|
||
db_worker_a_password: {file: ./secrets/db_worker_a_password}
|
||
redis_api_password: {file: ./secrets/redis_api_password}
|
||
redis_ops_password: {file: ./secrets/redis_ops_password}
|
||
s3_config: {file: ./secrets/s3_config.json}
|
||
s3_admin_access_key_id: {file: ./secrets/s3_admin_access_key_id}
|
||
s3_admin_secret_access_key: {file: ./secrets/s3_admin_secret_access_key}
|
||
s3_api_access_key_id: {file: ./secrets/s3_api_access_key_id}
|
||
s3_api_secret_access_key: {file: ./secrets/s3_api_secret_access_key}
|
||
s3_worker_access_key_id: {file: ./secrets/s3_worker_access_key_id}
|
||
s3_worker_secret_access_key: {file: ./secrets/s3_worker_secret_access_key}
|
||
grafana_admin_password: {file: ./secrets/grafana_admin_password}
|