forked from mtusi2026/mtusi2026lab7
Лабораторная 7: безопасность, mTLS и OpenBao, оценка 3
This commit is contained in:
@@ -1,7 +1,9 @@
|
||||
# Конфигурация наблюдаемости — реализовать
|
||||
# Telemetry через TLS
|
||||
|
||||
Добавьте `collector.yaml` с OTLP receivers, processors и exporters выбранной версии Collector. Укажите явные bind endpoints, внутренние сети, memory limits/batch и поведение при backpressure по уровню. Сопоставьте все три pipeline с реально развёрнутыми backend.
|
||||
Collector 0.137.0 принимает HTTP/protobuf OTLP только loopback4318 за TLS sidecar4438. Клиенты api/worker/dispatcher предъявляют свои сертификаты; allowlist проверяет URI SAN. Collector отправляет traces в Tempo :4438 и logs в Loki :3443/otlp со своей identity.
|
||||
|
||||
Добавьте конфигурации storage, Grafana provisioning/datasources, provisioning/dashboards и импортируемые dashboard JSON. На 4 — alert rules и runbooks. Пустой dashboard или debug exporter, который только печатает данные в stdout, не заменяют хранилища/доказательства из `contracts/observability.md`.
|
||||
Prometheus scrape получает app metrics :8899 и collector metrics :8898 по mTLS identity prometheus. Grafana datasource endpoints также mTLS; приватный client key добавляется в secrets/grafana-datasources.yaml при локальном bootstrap, в Git только шаблон sources.yaml без значений.
|
||||
|
||||
Не публикуйте OTLP/metrics/административные ports в общую сеть без необходимости. В lab7 реализуйте TLS/mTLS по trust matrix; экспорт Authorization и message bodies запрещён.
|
||||
Поля telemetry разрешены явно: route template, method/status, duration, request_id/trace_id/span_id, job type/outcome. Ни Authorization, ни тела, ни SQL arguments/credentials не экспортируются. Метрики: api_requests_total, api_duration_seconds_bucket, worker_jobs_total, worker_duration_seconds_bucket. См. dashboards/messenger.json в infra/grafana (точное имя файла можно посмотреть в каталоге).
|
||||
|
||||
`student-tests/observability.py` выполняется во временном operator контейнере: создаёт synthetic chat/upload и проверяет фактические matching log/trace и четыре SDK metrics. Результат evidence/telemetry.json содержит только разрешённые технические данные.
|
||||
|
||||
@@ -0,0 +1,63 @@
|
||||
receivers:
|
||||
otlp:
|
||||
protocols:
|
||||
http:
|
||||
endpoint: 127.0.0.1:4318
|
||||
processors:
|
||||
memory_limiter:
|
||||
check_interval: 1s
|
||||
limit_mib: 192
|
||||
spike_limit_mib: 32
|
||||
batch:
|
||||
timeout: 2s
|
||||
send_batch_size: 128
|
||||
send_batch_max_size: 256
|
||||
exporters:
|
||||
prometheus:
|
||||
endpoint: 127.0.0.1:8889
|
||||
resource_to_telemetry_conversion:
|
||||
enabled: true
|
||||
otlphttp/tempo:
|
||||
endpoint: https://tempo:4438
|
||||
tls:
|
||||
ca_file: /tls/ca.crt
|
||||
cert_file: /tls/service.crt
|
||||
key_file: /tls/service.key
|
||||
timeout: 3s
|
||||
sending_queue:
|
||||
queue_size: 256
|
||||
retry_on_failure:
|
||||
max_elapsed_time: 30s
|
||||
otlphttp/loki:
|
||||
endpoint: https://loki:3443/otlp
|
||||
tls:
|
||||
ca_file: /tls/ca.crt
|
||||
cert_file: /tls/service.crt
|
||||
key_file: /tls/service.key
|
||||
timeout: 3s
|
||||
sending_queue:
|
||||
queue_size: 256
|
||||
retry_on_failure:
|
||||
max_elapsed_time: 30s
|
||||
service:
|
||||
telemetry:
|
||||
metrics:
|
||||
readers:
|
||||
- pull:
|
||||
exporter:
|
||||
prometheus:
|
||||
host: 127.0.0.1
|
||||
port: 8888
|
||||
pipelines:
|
||||
traces:
|
||||
receivers: [otlp]
|
||||
processors: [memory_limiter, batch]
|
||||
exporters: [otlphttp/tempo]
|
||||
metrics:
|
||||
receivers: [otlp]
|
||||
processors: [memory_limiter, batch]
|
||||
exporters: [prometheus]
|
||||
logs:
|
||||
receivers: [otlp]
|
||||
processors: [memory_limiter, batch]
|
||||
exporters: [otlphttp/loki]
|
||||
@@ -0,0 +1,34 @@
|
||||
auth_enabled: false
|
||||
server:
|
||||
http_listen_address: 127.0.0.1
|
||||
grpc_listen_address: 127.0.0.1
|
||||
http_listen_port: 3100
|
||||
common:
|
||||
instance_addr: 127.0.0.1
|
||||
path_prefix: /loki
|
||||
storage:
|
||||
filesystem:
|
||||
chunks_directory: /loki/chunks
|
||||
rules_directory: /loki/rules
|
||||
replication_factor: 1
|
||||
ring:
|
||||
kvstore:
|
||||
store: inmemory
|
||||
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
|
||||
@@ -0,0 +1,21 @@
|
||||
global:
|
||||
scrape_interval: 5s
|
||||
evaluation_interval: 5s
|
||||
scrape_configs:
|
||||
- job_name: messenger
|
||||
scheme: https
|
||||
tls_config:
|
||||
ca_file: /tls/ca.crt
|
||||
cert_file: /tls/service.crt
|
||||
key_file: /tls/service.key
|
||||
static_configs:
|
||||
- targets: ['otel-collector:8899']
|
||||
|
||||
- job_name: collector
|
||||
scheme: https
|
||||
tls_config:
|
||||
ca_file: /tls/ca.crt
|
||||
cert_file: /tls/service.crt
|
||||
key_file: /tls/service.key
|
||||
static_configs:
|
||||
- targets: ['otel-collector:8898']
|
||||
@@ -0,0 +1,22 @@
|
||||
server:
|
||||
http_listen_address: 127.0.0.1
|
||||
grpc_listen_address: 127.0.0.1
|
||||
http_listen_port: 3200
|
||||
distributor:
|
||||
receivers:
|
||||
otlp:
|
||||
protocols:
|
||||
http:
|
||||
endpoint: 127.0.0.1:4318
|
||||
ingester:
|
||||
max_block_duration: 1m
|
||||
compactor:
|
||||
compaction:
|
||||
block_retention: 72h
|
||||
storage:
|
||||
trace:
|
||||
backend: local
|
||||
wal:
|
||||
path: /var/tempo/wal
|
||||
local:
|
||||
path: /var/tempo/blocks
|
||||
Reference in New Issue
Block a user