feat: put telemetry backends, LB metrics and Grafana behind mTLS gateways

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-26 10:20:27 +03:00
co-authored by Claude Opus 5.5
parent 8349a454db
commit 1722fb0c35
40 changed files with 3915 additions and 279 deletions
+26 -5
View File
@@ -675,10 +675,25 @@ def _identity_rows() -> dict[str, tuple[str, list[str]]]:
return rows
def _otlp_section(config: str) -> str:
"""Строки `frontend otlp` (до следующего раздела): с change
`telemetry-backends-tls` у шлюза ещё порты метрик Collector со своим
allowlist (`test_telemetry_backends_tls.py`)."""
out: list[str] = []
inside = False
for line in config.splitlines():
if line and not line[0].isspace():
inside = line.split()[:2] == ["frontend", "otlp"]
continue
if inside:
out.append(line)
return "\n".join(out)
def test_gateway_allowlist_matches_identities() -> None:
"""Решение 4: allowlist шлюза — DNS SAN строк `api-client`, `worker`,
`relay` (клиентские профили), ни больше, ни меньше."""
config = GATEWAY_CFG.read_text(encoding="utf-8")
"""Решение 4: allowlist приёма OTLP — DNS SAN строк `api-client`,
`worker`, `relay` (клиентские профили), ни больше, ни меньше."""
config = _otlp_section(GATEWAY_CFG.read_text(encoding="utf-8"))
lines = [
line
for line in config.splitlines()
@@ -715,8 +730,14 @@ def test_gateway_bind_requires_client_tls13_and_crl() -> None:
assert "crl-file /run/secrets/crl.pem" in text
assert "ca-file /run/secrets/ca.crt" in text
assert "crt /run/secrets/otel-collector.pem" in text
# остальные слушатели — только loopback пространства шлюза
others = [words[1] for words in binds if words[1] != ":4318"]
# остальные слушатели — только loopback пространства шлюза, кроме портов
# метрик Collector по mTLS (change telemetry-backends-tls; их параметры —
# test_telemetry_backends_tls.py)
others = [
words[1]
for words in binds
if words[1] not in (":4318", ":8888", ":8889")
]
assert others
assert all(addr.startswith("127.0.0.1:") for addr in others)
assert "server collector 127.0.0.1:14318" in config