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:
+13
@@ -21,8 +21,10 @@ from src.infra.logger import AbstractLogger, get_logger
|
||||
from src.infra.password import prepare_dummy_hash
|
||||
from src.infra.s3.instance import object_storage
|
||||
from src.infra.tls import (
|
||||
API_STORAGES,
|
||||
PROTOCOL_IMPORT_PATH,
|
||||
api_tls_problems,
|
||||
client_tls_problems,
|
||||
ssl_context_factory,
|
||||
)
|
||||
from src.schemas.enums import RunModeEnum
|
||||
@@ -164,6 +166,17 @@ def main() -> None:
|
||||
run_mode=settings.app.run_mode,
|
||||
)
|
||||
sys.exit(2)
|
||||
# TLS к хранилищам (change storage-tls, design, решение 5): CA стенда и
|
||||
# имена PostgreSQL, Valkey и S3 — до первого подключения; поля без
|
||||
# значений и путей, код 2
|
||||
problems = client_tls_problems(settings, API_STORAGES)
|
||||
if problems:
|
||||
logger.error(
|
||||
"Invalid client TLS settings",
|
||||
fields=problems,
|
||||
run_mode=settings.app.run_mode,
|
||||
)
|
||||
sys.exit(2)
|
||||
reload = settings.app.run_mode == RunModeEnum.CONSOLE
|
||||
uvicorn.run(
|
||||
"src.main:app",
|
||||
|
||||
Reference in New Issue
Block a user