lab7: TLS ко всем зависимостям и телеметрии; раздельные роли PostgreSQL (GRANT по коду), ACL Valkey, AMQPS, HTTPS S3, mTLS Collector/Prometheus/Loki/Tempo/Grafana

This commit is contained in:
Alexey Bodanyuk
2026-11-27 16:29:09 +03:00
parent f36da97951
commit 93f4ed1013
28 changed files with 621 additions and 201 deletions
@@ -2,6 +2,10 @@
# the dashboard JSON, the trace->logs and logs->trace links refer to exactly these UIDs
# (prometheus / loki / tempo). A datasource without a fixed uid gets a random one and every
# reference to it breaks ("data source not found").
# Lab 7: every datasource is HTTPS with server verification (internal CA, serverName = the SAN)
# and Grafana's own client certificate (SAN grafana): the three backends require one, Prometheus
# also checks the SAN allowlist. The PEM files are read at provisioning time ($__file{}), from
# Docker secrets mounted only into Grafana.
apiVersion: 1
deleteDatasources:
@@ -14,10 +18,17 @@ datasources:
uid: prometheus
type: prometheus
access: proxy
url: http://prometheus:9090
url: https://prometheus:9090
isDefault: true
editable: false
secureJsonData: &tls_files
tlsCACert: $__file{/run/secrets/internal-ca.crt}
tlsClientCert: $__file{/run/secrets/grafana.crt}
tlsClientKey: $__file{/run/secrets/grafana.key}
jsonData:
tlsAuth: true
tlsAuthWithCACert: true
serverName: prometheus
httpMethod: POST
timeInterval: 15s # = scrape/evaluation interval: $__rate_interval >= 4 x 15 s
prometheusType: Prometheus
@@ -29,9 +40,13 @@ datasources:
uid: loki
type: loki
access: proxy
url: http://loki:3100
url: https://loki:3100
editable: false
secureJsonData: *tls_files
jsonData:
tlsAuth: true
tlsAuthWithCACert: true
serverName: loki
maxLines: 1000
# log line -> its trace in Tempo (trace_id is structured metadata of the OTLP record)
derivedFields:
@@ -46,9 +61,13 @@ datasources:
uid: tempo
type: tempo
access: proxy
url: http://tempo:3200
url: https://tempo:3200
editable: false
secureJsonData: *tls_files
jsonData:
tlsAuth: true
tlsAuthWithCACert: true
serverName: tempo
# span -> the log records of the same trace (and service) in Loki
tracesToLogsV2:
datasourceUid: loki