lab7: TLS/mTLS по trust matrix, OpenBao (cert auth, KV, policies), роли БД, Argon2id+rehash, лимит входа, hardening, secprobe и тесты
This commit is contained in:
@@ -0,0 +1,130 @@
|
||||
# ВАРИАНТ ТРЕКА 1 (tail sampling): SDK отправляет 100% spans, Collector хранит
|
||||
# только трассы с ошибкой, медленные (≥ 250 ms) и 10% остальных.
|
||||
#
|
||||
# OpenTelemetry Collector (contrib) — приём OTLP от API/relay/worker и раздача
|
||||
# по хранилищам: traces → Tempo, logs → Loki (OTLP/HTTP), metrics → Prometheus (pull).
|
||||
#
|
||||
# Ограничение памяти и буферов:
|
||||
# memory_limiter — первым в каждом pipeline: при превышении soft limit Collector
|
||||
# отказывает receiver-у (SDK получает ошибку и отбрасывает данные по своей
|
||||
# ограниченной очереди), вместо бесконечного роста RSS;
|
||||
# batch — пакеты до 1024 элементов / 2 s;
|
||||
# sending_queue (in-memory, queue_size пакетов) + retry_on_failure (≤ 60 s) —
|
||||
# при недоступном Tempo/Loki данные ждут ограниченное время в ограниченной
|
||||
# очереди, затем отбрасываются и считаются в otelcol_exporter_send_failed_*.
|
||||
# Метрики не буферизуются вовсе: exporter prometheus хранит только текущее
|
||||
# cumulative-состояние серий, Prometheus забирает его сам (pull).
|
||||
# Lab7: приём OTLP только по HTTPS с клиентским сертификатом отдельного CA телеметрии
|
||||
# (tca): сертификаты LB/хранилищ, даже от основного CA стенда, ingest не получают.
|
||||
receivers:
|
||||
otlp:
|
||||
protocols:
|
||||
http:
|
||||
endpoint: 0.0.0.0:4318
|
||||
tls:
|
||||
cert_file: /run/secrets/otel-collector.crt
|
||||
key_file: /run/secrets/otel-collector.key
|
||||
client_ca_file: /run/secrets/tca.crt
|
||||
min_version: "1.2"
|
||||
|
||||
processors:
|
||||
# Решение по трассе целиком через decision_wait после её первого span;
|
||||
# num_traces ограничивает память буфера решений.
|
||||
tail_sampling:
|
||||
decision_wait: 5s
|
||||
num_traces: 20000
|
||||
expected_new_traces_per_sec: 200
|
||||
policies:
|
||||
- name: errors
|
||||
type: status_code
|
||||
status_code: { status_codes: [ERROR] }
|
||||
- name: slow
|
||||
type: latency
|
||||
latency: { threshold_ms: 250 }
|
||||
- name: baseline
|
||||
type: probabilistic
|
||||
probabilistic: { sampling_percentage: 10 }
|
||||
memory_limiter:
|
||||
check_interval: 1s
|
||||
limit_mib: 200
|
||||
spike_limit_mib: 50
|
||||
batch:
|
||||
send_batch_size: 1024
|
||||
send_batch_max_size: 2048
|
||||
timeout: 2s
|
||||
# Защита от утечек на случай ошибки инструментирования: такие ключи не должны
|
||||
# появляться, но если появятся — удаляются до экспорта.
|
||||
attributes/scrub:
|
||||
actions:
|
||||
- { key: http.request.header.authorization, action: delete }
|
||||
- { key: http.request.header.cookie, action: delete }
|
||||
- { key: authorization, action: delete }
|
||||
- { key: password, action: delete }
|
||||
- { key: token, action: delete }
|
||||
- { key: db.query.parameters, action: delete }
|
||||
|
||||
exporters:
|
||||
otlp/tempo:
|
||||
endpoint: tempo:4317
|
||||
tls: # mTLS к Tempo: CA стенда + сертификат Collector
|
||||
ca_file: /run/secrets/ca.crt
|
||||
cert_file: /run/secrets/otel-collector.crt
|
||||
key_file: /run/secrets/otel-collector.key
|
||||
sending_queue:
|
||||
enabled: true
|
||||
num_consumers: 2
|
||||
queue_size: 200
|
||||
retry_on_failure:
|
||||
enabled: true
|
||||
initial_interval: 1s
|
||||
max_interval: 10s
|
||||
max_elapsed_time: 60s
|
||||
otlphttp/loki:
|
||||
endpoint: https://loki:3100/otlp
|
||||
tls: # mTLS к Loki
|
||||
ca_file: /run/secrets/ca.crt
|
||||
cert_file: /run/secrets/otel-collector.crt
|
||||
key_file: /run/secrets/otel-collector.key
|
||||
sending_queue:
|
||||
enabled: true
|
||||
num_consumers: 2
|
||||
queue_size: 200
|
||||
retry_on_failure:
|
||||
enabled: true
|
||||
initial_interval: 1s
|
||||
max_interval: 10s
|
||||
max_elapsed_time: 60s
|
||||
prometheus:
|
||||
endpoint: 0.0.0.0:8889
|
||||
tls: # Prometheus забирает метрики по mTLS (сертификат CA стенда)
|
||||
cert_file: /run/secrets/otel-collector.crt
|
||||
key_file: /run/secrets/otel-collector.key
|
||||
client_ca_file: /run/secrets/ca.crt
|
||||
enable_open_metrics: true # exemplars (trace_id) в histogram buckets
|
||||
metric_expiration: 1m # серии остановленного процесса исчезают через 1 мин (absent() в alerts)
|
||||
|
||||
service:
|
||||
telemetry:
|
||||
logs:
|
||||
level: warn
|
||||
metrics:
|
||||
level: detailed
|
||||
readers:
|
||||
- pull:
|
||||
exporter:
|
||||
prometheus:
|
||||
host: 0.0.0.0
|
||||
port: 8888
|
||||
pipelines:
|
||||
traces:
|
||||
receivers: [otlp]
|
||||
processors: [memory_limiter, tail_sampling, attributes/scrub, batch]
|
||||
exporters: [otlp/tempo]
|
||||
metrics:
|
||||
receivers: [otlp]
|
||||
processors: [memory_limiter, batch]
|
||||
exporters: [prometheus]
|
||||
logs:
|
||||
receivers: [otlp]
|
||||
processors: [memory_limiter, attributes/scrub, batch]
|
||||
exporters: [otlphttp/loki]
|
||||
@@ -0,0 +1,111 @@
|
||||
# OpenTelemetry Collector (contrib) — приём OTLP от API/relay/worker и раздача
|
||||
# по хранилищам: traces → Tempo, logs → Loki (OTLP/HTTP), metrics → Prometheus (pull).
|
||||
#
|
||||
# Ограничение памяти и буферов:
|
||||
# memory_limiter — первым в каждом pipeline: при превышении soft limit Collector
|
||||
# отказывает receiver-у (SDK получает ошибку и отбрасывает данные по своей
|
||||
# ограниченной очереди), вместо бесконечного роста RSS;
|
||||
# batch — пакеты до 1024 элементов / 2 s;
|
||||
# sending_queue (in-memory, queue_size пакетов) + retry_on_failure (≤ 60 s) —
|
||||
# при недоступном Tempo/Loki данные ждут ограниченное время в ограниченной
|
||||
# очереди, затем отбрасываются и считаются в otelcol_exporter_send_failed_*.
|
||||
# Метрики не буферизуются вовсе: exporter prometheus хранит только текущее
|
||||
# cumulative-состояние серий, Prometheus забирает его сам (pull).
|
||||
# Lab7: приём OTLP только по HTTPS с клиентским сертификатом отдельного CA телеметрии
|
||||
# (tca): сертификаты LB/хранилищ, даже от основного CA стенда, ingest не получают.
|
||||
receivers:
|
||||
otlp:
|
||||
protocols:
|
||||
http:
|
||||
endpoint: 0.0.0.0:4318
|
||||
tls:
|
||||
cert_file: /run/secrets/otel-collector.crt
|
||||
key_file: /run/secrets/otel-collector.key
|
||||
client_ca_file: /run/secrets/tca.crt
|
||||
min_version: "1.2"
|
||||
|
||||
processors:
|
||||
memory_limiter:
|
||||
check_interval: 1s
|
||||
limit_mib: 200
|
||||
spike_limit_mib: 50
|
||||
batch:
|
||||
send_batch_size: 1024
|
||||
send_batch_max_size: 2048
|
||||
timeout: 2s
|
||||
# Защита от утечек на случай ошибки инструментирования: такие ключи не должны
|
||||
# появляться, но если появятся — удаляются до экспорта.
|
||||
attributes/scrub:
|
||||
actions:
|
||||
- { key: http.request.header.authorization, action: delete }
|
||||
- { key: http.request.header.cookie, action: delete }
|
||||
- { key: authorization, action: delete }
|
||||
- { key: password, action: delete }
|
||||
- { key: token, action: delete }
|
||||
- { key: db.query.parameters, action: delete }
|
||||
|
||||
exporters:
|
||||
otlp/tempo:
|
||||
endpoint: tempo:4317
|
||||
tls: # mTLS к Tempo: CA стенда + сертификат Collector
|
||||
ca_file: /run/secrets/ca.crt
|
||||
cert_file: /run/secrets/otel-collector.crt
|
||||
key_file: /run/secrets/otel-collector.key
|
||||
sending_queue:
|
||||
enabled: true
|
||||
num_consumers: 2
|
||||
queue_size: 200
|
||||
retry_on_failure:
|
||||
enabled: true
|
||||
initial_interval: 1s
|
||||
max_interval: 10s
|
||||
max_elapsed_time: 60s
|
||||
otlphttp/loki:
|
||||
endpoint: https://loki:3100/otlp
|
||||
tls: # mTLS к Loki
|
||||
ca_file: /run/secrets/ca.crt
|
||||
cert_file: /run/secrets/otel-collector.crt
|
||||
key_file: /run/secrets/otel-collector.key
|
||||
sending_queue:
|
||||
enabled: true
|
||||
num_consumers: 2
|
||||
queue_size: 200
|
||||
retry_on_failure:
|
||||
enabled: true
|
||||
initial_interval: 1s
|
||||
max_interval: 10s
|
||||
max_elapsed_time: 60s
|
||||
prometheus:
|
||||
endpoint: 0.0.0.0:8889
|
||||
tls: # Prometheus забирает метрики по mTLS (сертификат CA стенда)
|
||||
cert_file: /run/secrets/otel-collector.crt
|
||||
key_file: /run/secrets/otel-collector.key
|
||||
client_ca_file: /run/secrets/ca.crt
|
||||
enable_open_metrics: true # exemplars (trace_id) в histogram buckets
|
||||
metric_expiration: 1m # серии остановленного процесса исчезают через 1 мин (absent() в alerts)
|
||||
|
||||
service:
|
||||
telemetry:
|
||||
logs:
|
||||
level: warn
|
||||
metrics:
|
||||
level: detailed
|
||||
readers:
|
||||
- pull:
|
||||
exporter:
|
||||
prometheus:
|
||||
host: 0.0.0.0
|
||||
port: 8888
|
||||
pipelines:
|
||||
traces:
|
||||
receivers: [otlp]
|
||||
processors: [memory_limiter, attributes/scrub, batch]
|
||||
exporters: [otlp/tempo]
|
||||
metrics:
|
||||
receivers: [otlp]
|
||||
processors: [memory_limiter, batch]
|
||||
exporters: [prometheus]
|
||||
logs:
|
||||
receivers: [otlp]
|
||||
processors: [memory_limiter, attributes/scrub, batch]
|
||||
exporters: [otlphttp/loki]
|
||||
Reference in New Issue
Block a user