# Матрица доверия | Связь | Порт и протокол | Server trust и client identity | Минимальные права / lifecycle | Доказательство | | --- | --- | --- | --- | --- | | Клиент → Nginx | `8443`, TLS 1.3 | Public CA, SAN `localhost`; Bearer session | Сессия хранится как hash с TTL; общий login limiter | `make test-security`; `make test`; `make test-login-rate-limit` | | Nginx → API replicas | `8443`, mTLS | Internal CA; server SAN `api`; client URI `spiffe://mtusi/lab7/load-balancer` | Leaf выпускается bootstrap и меняется без rebuild | `make test-tls-matrix`: allow LB, deny no-cert/foreign/forbidden | | Prometheus → API metrics | `9091`, mTLS | Internal CA; URI `spiffe://mtusi/lab7/prometheus` | Только `/metrics`; business route отсутствует | `make test-tls-matrix` | | API/worker/dispatcher/reconciler → PostgreSQL | `5432`, TLS 1.3 `verify-full` + client cert | SAN `postgres`; отдельные API, worker, dispatcher, reconciler certs | Разные DB roles/grants; migrator отдельный one-shot | `infra/security/test-dependency-matrix.sh` | | API → Valkey | gateway `16379`, mTLS; backend TLS | SAN `redis-gateway`; API URI SAN; Valkey ACL user `messenger_api` | Только session/rate-limit prefixes; password приходит из OpenBao | dependency matrix: разрешён session key, запрещён arbitrary key | | Dispatcher → Redis Streams | gateway `26379`, mTLS; backend TLS | Dispatcher URI SAN | Producer ACL без consume | dependency matrix: `XADD` разрешён, `XREAD` запрещён | | Worker → Redis Streams | gateway `36379`, mTLS; backend TLS | Worker URI SAN | Consumer/ack ACL, unrelated stream запрещён; credential ротируется | dependency matrix и `make test-worker-compromise` | | API/worker/reconciler → MinIO | `9000`, HTTPS | Internal CA, SAN `s3` | API: staging; worker: staging+attachments; reconciler: cleanup; разные keys | dependency matrix проверяет разрешённые и запрещённые prefixes | | API/worker/dispatcher/reconciler → OTel gateway | `4317/4318`, mTLS | Internal CA; exact allowlist service URI SAN | Только telemetry ingest | dependency matrix отклоняет same-CA Prometheus identity | | OTel Collector → Loki/Tempo/Prometheus | локальный TLS gateway → backend network | Collector identity и Internal CA | Backend ports не опубликованы; plaintext hop только внутри выделенной `telemetry_storage` network | `infra/otel/collector.yaml`, Prometheus targets, TLS matrix | | Grafana → Prometheus/Loki/Tempo | отдельные HTTPS gateways | Grafana client certificate, Internal CA, exact URI SAN | Read-only datasource access; UI опубликован только на `127.0.0.1:3000` по HTTPS | provisioned datasource health API и gateway config | | OpenBao Agent API/worker → OpenBao | `8200`, TLS 1.3 | OpenBao SAN; AppRole RoleID+SecretID с TTL 1 час | Раздельные KV policies; renewable token; rendered file `0600` в защищённом volume, Agent token в tmpfs | `scripts/openbao-test-policy.sh`, `scripts/openbao-rotate.sh` | | Оператор → OpenBao | `127.0.0.1:8200`, TLS 1.3 | CA; root token только в operator runtime file | Init/unseal/bootstrap/rotation; Raft volume persistent | `scripts/bootstrap-local.sh`, `infra/openbao/README.md` | | Оператор → Grafana | `127.0.0.1:3000`, HTTPS | Internal CA, login/password | Административный UI не слушает внешний интерфейс | `docker compose port grafana 3000` и HTTPS health | | Replication/cluster channels | N/A | PostgreSQL, Valkey, Redis, MinIO и OpenBao запущены по одному экземпляру | Репликация не заявлена; отказ зависимости обнаруживается readiness | Документированное ограничение стенда | ## Каналы bootstrap, health и scrape - `127.0.0.1:8082` существует только внутри каждого app container и используется Docker healthcheck; business router на нём отсутствует. - Публичный `/health/ready` проходит через ingress TLS, но не раскрывает credentials или содержимое зависимостей. - Metrics listener требует Prometheus URI SAN; сертификат LB и сертификаты приложений отклоняются. - Bootstrap jobs подключены только к нужным внутренним сетям, не публикуют порты и завершаются после установки ACL/roles/secrets. - Private keys, root token, unseal shares, RoleID/SecretID и rendered secrets хранятся в `.runtime`/Docker volumes и отсутствуют в Git.