forked from mtusi2026/mtusi2026lab7
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:
@@ -331,6 +331,15 @@ ASCII `bytes`, шаблон W3C версии `00`, `tracestate` до 512 сим
|
||||
пересоздаёт пул того же класса (`recreate`), метрики читают текущий
|
||||
`engine.sync_engine.pool`. Опирается на `Pool.connect()`, SQLAlchemy закреплён `<2.2`; смену
|
||||
ловит `service-tests/db/test_pool_counts.py`.
|
||||
- **TLS к хранилищам** (с change `storage-tls`, `tls.md`, «Хранилища»): фабрики принимают CA
|
||||
явно — `create_engine(database, *, ca_file)`, `create_cache(cache, *, namespace, ca_file)`,
|
||||
`create_object_storage(s3, *, namespace, ca_file)`; глобалы процесса API и точки входа worker,
|
||||
relay, уборщика передают `settings.client_tls.ca_file`. Контекст — `build_client_context`
|
||||
(`src/infra/tls/client.py`); redis-py — класс соединения `TlsConnection`
|
||||
(`cache/client.py`), S3 — `verify=ca_file` и `https://` из `S3.endpoint_url`. Перевод ошибок
|
||||
прежний: отказ рукопожатия — та же недоступность (503 у PostgreSQL и S3, обход у Valkey).
|
||||
Новое соединение к замороженному серверу теперь упирается в срок соединения уже на
|
||||
рукопожатии TLS (у S3 — `connect_timeout_seconds` 1 с, а не срок вызова 5 с).
|
||||
- Клиенты внешних сервисов: адреса и секреты из `settings`
|
||||
(`.claude/rules/settings.md`), таймаут на каждый вызов, ошибки
|
||||
переводятся в доменные исключения. Логи — по `logging.md`, без
|
||||
|
||||
Reference in New Issue
Block a user