feat: require TLS to PostgreSQL, Valkey and S3
Storage servers accept only TLS 1.3 (pg_hba hostssl / hostnossl reject, Valkey port 0, S3 gateway HTTPS only) with stand identities postgres, valkey and s3. Clients trust only the stand CA from [client_tls] ca_file and check the host name; no switch to disable verification. Processes exit with code 2 without a CA or with an IP storage address. Temporary stands, CI and bench/ run on TLS storages; make storage_tls_check adds negative checks. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -246,6 +246,26 @@ def test_telemetry_from_environment(monkeypatch: pytest.MonkeyPatch) -> None:
|
||||
assert loaded.telemetry.metric_buckets is MetricBucketsEnum.COARSE
|
||||
|
||||
|
||||
def test_client_tls_from_environment(monkeypatch: pytest.MonkeyPatch) -> None:
|
||||
"""Спек `service-configuration`, «Доверие к серверам зависимостей»: CA —
|
||||
из окружения процесса (compose и цели make), по умолчанию пусто."""
|
||||
assert _EnvironmentOnly().client_tls.ca_file == ""
|
||||
monkeypatch.setenv("CLIENT_TLS__CA_FILE", "/run/secrets/ca.crt")
|
||||
assert _EnvironmentOnly().client_tls.ca_file == "/run/secrets/ca.crt"
|
||||
|
||||
|
||||
def test_s3_endpoint_is_https() -> None:
|
||||
"""Шлюз S3 — только HTTPS (change `storage-tls`): URL с именем хоста."""
|
||||
s3 = _ArgumentsOnly(s3={"host": "s3", "port": 8333}).s3
|
||||
assert s3.endpoint_url == "https://s3:8333"
|
||||
|
||||
|
||||
def test_example_toml_has_no_client_tls() -> None:
|
||||
"""Путь CA задают compose и цели make, в `config_example.toml` его нет:
|
||||
toml смонтирован и в консоль, и в контейнеры с разными путями."""
|
||||
assert "client_tls" not in EXAMPLE_TOML_PATH.read_text()
|
||||
|
||||
|
||||
def test_wrong_ratio_from_environment_names_field(
|
||||
monkeypatch: pytest.MonkeyPatch,
|
||||
) -> None:
|
||||
|
||||
Reference in New Issue
Block a user