lab7: безопасность, mTLS, OpenBao и PKI lifecycle
Application / Go invariants and static checks (pull_request) Canceled after 0s
Application / Lab7 verified TLS and retained features (pull_request) Canceled after 0s
Skeleton contracts / contracts (pull_request) Canceled after 0s

This commit is contained in:
Vladislav Kunetskiy
2026-11-10 14:39:57 +03:00
parent 20afc2c790
commit 1b6e96ccc0
570 changed files with 298308 additions and 137 deletions
+69
View File
@@ -0,0 +1,69 @@
# HAProxy 3.2; shares only the Collector network namespace.
global
log stdout format raw local0
maxconn 512
hard-stop-after 30s
tune.ssl.cachesize 0
ssl-default-bind-options ssl-min-ver TLSv1.2 no-tls-tickets
defaults
mode http
log global
log-format "%ST %Tt %b"
option dontlognull
option http-server-close
timeout connect 2s
timeout client 30s
timeout server 30s
timeout http-request 5s
timeout http-keep-alive 2s
frontend collector_ingest
bind :4318 ssl crt /run/identity/current/tls.pem ca-file /run/identity/current/ca.crt crl-file /run/identity/current/ca.crl verify required
# The authenticated certificate CN, never an HTTP header, is the role.
acl writer ssl_c_s_dn(CN) -m str api worker relay
acl write_method method POST
acl write_path path -m str /v1/traces /v1/metrics /v1/logs
http-request allow if writer write_method write_path
http-request deny deny_status 403
default_backend collector_otlp
frontend collector_metrics
bind :8888 ssl crt /run/identity/current/tls.pem ca-file /run/identity/current/ca.crt crl-file /run/identity/current/ca.crl verify required
acl reader ssl_c_s_dn(CN) -m str prometheus operator
acl read_method method GET
acl metrics_path path -m str /metrics
http-request allow if reader read_method metrics_path
http-request deny deny_status 403
default_backend collector_self_metrics
frontend application_metrics
bind :8889 ssl crt /run/identity/current/tls.pem ca-file /run/identity/current/ca.crt crl-file /run/identity/current/ca.crl verify required
acl reader ssl_c_s_dn(CN) -m str prometheus operator
acl read_method method GET
acl metrics_path path -m str /metrics
http-request allow if reader read_method metrics_path
http-request deny deny_status 403
default_backend collector_application_metrics
frontend collector_health
# 13133 is already the private receiver; the TLS gateway uses 13134.
bind :13134 ssl crt /run/identity/current/tls.pem ca-file /run/identity/current/ca.crt crl-file /run/identity/current/ca.crl verify required
acl reader ssl_c_s_dn(CN) -m str prometheus operator
acl read_method method GET
acl health_path path -m str /
http-request allow if reader read_method health_path
http-request deny deny_status 403
default_backend collector_private_health
backend collector_otlp
server local 127.0.0.1:14318
backend collector_self_metrics
server local 127.0.0.1:18888
backend collector_application_metrics
server local 127.0.0.1:18889
backend collector_private_health
server local 127.0.0.1:13133
+36
View File
@@ -0,0 +1,36 @@
# HAProxy 3.2 public browser ingress; Grafana enforces its normal user auth.
global
log stdout format raw local0
maxconn 512
hard-stop-after 30s
tune.ssl.cachesize 0
ssl-default-bind-options ssl-min-ver TLSv1.2 no-tls-tickets
defaults
mode http
log global
log-format "%ST %Tt %b"
option dontlognull
option http-server-close
timeout connect 2s
timeout client 30s
timeout server 30s
timeout http-request 5s
timeout http-keep-alive 2s
timeout tunnel 30s
frontend grafana_browser_https
# Browsers verify the server certificate; no client certificate is needed.
bind :3000 ssl crt /run/identity/current/tls.pem
http-request set-header X-Forwarded-For %[src]
http-request set-header X-Forwarded-Proto https
http-request set-header X-Forwarded-Port 3000
# No auth-proxy identity may be supplied by a browser.
http-request del-header X-WEBAUTH-USER
http-request del-header X-WEBAUTH-EMAIL
http-request del-header X-WEBAUTH-NAME
http-response set-header Strict-Transport-Security "max-age=31536000"
default_backend grafana_private
backend grafana_private
server local 127.0.0.1:13000
+56
View File
@@ -0,0 +1,56 @@
# HAProxy 3.2; Loki HTTP and gRPC remain on loopback.
global
log stdout format raw local0
maxconn 512
hard-stop-after 30s
tune.ssl.cachesize 0
ssl-default-bind-options ssl-min-ver TLSv1.2 no-tls-tickets
defaults
mode http
log global
log-format "%ST %Tt %b"
option dontlognull
option http-server-close
timeout connect 2s
timeout client 30s
timeout server 30s
timeout http-request 5s
timeout http-keep-alive 2s
frontend loki_https
bind :3100 ssl crt /run/identity/current/tls.pem ca-file /run/identity/current/ca.crt crl-file /run/identity/current/ca.crl verify required
acl collector ssl_c_s_dn(CN) -m str collector
acl grafana ssl_c_s_dn(CN) -m str grafana
acl prometheus ssl_c_s_dn(CN) -m str prometheus
acl operator ssl_c_s_dn(CN) -m str operator
acl read_method method GET
acl write_method method POST
acl query_method method GET POST
acl ingest_path path -m str /otlp/v1/logs /loki/api/v1/push
acl query_path path -m str /loki/api/v1/query /loki/api/v1/query_range /loki/api/v1/labels /loki/api/v1/series
acl label_values path -m reg ^/loki/api/v1/label/[A-Za-z_][A-Za-z0-9_]*/values$
acl explore_path path -m str /loki/api/v1/index/stats /loki/api/v1/index/volume /loki/api/v1/index/volume_range /loki/api/v1/patterns /loki/api/v1/detected_fields /loki/api/v1/detected_labels
acl field_values path -m reg ^/loki/api/v1/detected_field/[A-Za-z_][A-Za-z0-9_]*/values$
acl health_path path -m str /metrics /ready
acl status_path path -m str /loki/api/v1/status/buildinfo /config /services /ring
# Preserve the existing single-tenant store; a client cannot select a tenant.
http-request set-header X-Scope-OrgID fake
http-request allow if collector write_method ingest_path
http-request allow if grafana query_method query_path
http-request allow if grafana read_method label_values
http-request allow if grafana read_method explore_path
http-request allow if grafana read_method field_values
http-request allow if prometheus read_method health_path
http-request allow if operator query_method query_path
http-request allow if operator read_method label_values
http-request allow if operator read_method explore_path
http-request allow if operator read_method field_values
http-request allow if operator read_method health_path
http-request allow if operator read_method status_path
# Collector cannot query; Grafana cannot push, delete or administer.
http-request deny deny_status 403
default_backend loki_private
backend loki_private
server local 127.0.0.1:13100
+46
View File
@@ -0,0 +1,46 @@
# HAProxy 3.2; Prometheus must listen only on 127.0.0.1:19090.
global
log stdout format raw local0
maxconn 512
hard-stop-after 30s
tune.ssl.cachesize 0
ssl-default-bind-options ssl-min-ver TLSv1.2 no-tls-tickets
defaults
mode http
log global
log-format "%ST %Tt %b"
option dontlognull
option http-server-close
timeout connect 2s
timeout client 30s
timeout server 30s
timeout http-request 5s
timeout http-keep-alive 2s
frontend prometheus_https
bind :9090 ssl crt /run/identity/current/tls.pem ca-file /run/identity/current/ca.crt crl-file /run/identity/current/ca.crl verify required
acl grafana ssl_c_s_dn(CN) -m str grafana
acl prometheus ssl_c_s_dn(CN) -m str prometheus
acl operator ssl_c_s_dn(CN) -m str operator
acl read_method method GET
acl query_method method GET POST
acl query_path path -m str /api/v1/query /api/v1/query_range /api/v1/labels /api/v1/series /api/v1/metadata
acl label_values path -m reg ^/api/v1/label/[A-Za-z_][A-Za-z0-9_]*/values$
acl buildinfo_path path -m str /api/v1/status/buildinfo
acl health_path path -m str /metrics /-/healthy /-/ready
acl status_path path -m str /api/v1/status/buildinfo /api/v1/status/runtimeinfo /api/v1/status/flags /api/v1/status/config /api/v1/status/tsdb /api/v1/targets /api/v1/rules /api/v1/alerts
http-request allow if grafana query_method query_path
http-request allow if grafana read_method label_values
http-request allow if grafana read_method buildinfo_path
http-request allow if prometheus read_method health_path
http-request allow if operator query_method query_path
http-request allow if operator read_method label_values
http-request allow if operator read_method health_path
http-request allow if operator read_method status_path
# No role gets reload, quit, admin, federation, remote-write or OTLP writes.
http-request deny deny_status 403
default_backend prometheus_private
backend prometheus_private
server local 127.0.0.1:19090
+66
View File
@@ -0,0 +1,66 @@
# HAProxy 3.2; only the collector principal can use the OTLP gRPC gateway.
global
log stdout format raw local0
maxconn 512
hard-stop-after 30s
tune.ssl.cachesize 0
ssl-default-bind-options ssl-min-ver TLSv1.2 no-tls-tickets
defaults tempo_http_defaults
mode http
log global
log-format "%ST %Tt %b"
option dontlognull
option http-server-close
timeout connect 2s
timeout client 30s
timeout server 30s
timeout http-request 5s
timeout http-keep-alive 2s
frontend tempo_https
bind :3200 ssl crt /run/identity/current/tls.pem ca-file /run/identity/current/ca.crt crl-file /run/identity/current/ca.crl verify required
acl grafana ssl_c_s_dn(CN) -m str grafana
acl prometheus ssl_c_s_dn(CN) -m str prometheus
acl operator ssl_c_s_dn(CN) -m str operator
acl read_method method GET
acl query_path path -m str /api/search /api/search/tags /api/v2/search/tags /api/metrics/query /api/metrics/query_range /api/echo
acl trace_path path -m reg ^/api/(v2/)?traces/[0-9a-fA-F]{1,32}$
acl tag_values path -m reg ^/api/(v2/)?search/tag/[A-Za-z0-9_.:-]+/values$
acl health_path path -m str /metrics /ready
acl status_path path -m str /status /api/status/buildinfo
http-request set-header X-Scope-OrgID fake
http-request allow if grafana read_method query_path
http-request allow if grafana read_method trace_path
http-request allow if grafana read_method tag_values
http-request allow if prometheus read_method health_path
http-request allow if operator read_method query_path
http-request allow if operator read_method trace_path
http-request allow if operator read_method tag_values
http-request allow if operator read_method health_path
http-request allow if operator read_method status_path
# The HTTP listener has no collector write, admin or alternate gRPC route.
http-request deny deny_status 403
default_backend tempo_private_http
backend tempo_private_http
server local 127.0.0.1:13200
# Separate defaults prevent inheriting HTTP options or HTTP log fields in TCP.
defaults tempo_grpc_defaults
mode tcp
log global
log-format "%Tt %b"
option dontlognull
timeout connect 2s
timeout client 30s
timeout server 30s
frontend tempo_otlp_tls
bind :4437 ssl crt /run/identity/current/tls.pem ca-file /run/identity/current/ca.crt crl-file /run/identity/current/ca.crl verify required alpn h2
acl collector ssl_c_s_dn(CN) -m str collector
tcp-request content reject unless collector
default_backend tempo_private_otlp
backend tempo_private_otlp
server local 127.0.0.1:14317