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:
@@ -36,6 +36,17 @@ student_test` его не собирает. В образ не попадает
|
||||
- **Замороженный сервер** — `TcpProxy` из `db/conftest.py`, а не `docker pause`
|
||||
рабочего PostgreSQL. Смена внутренних имён адаптера в `_ping_once` падает тестами
|
||||
`test_ping_*`.
|
||||
- **TLS к PostgreSQL** (с change `storage-tls`): `make service_test_db` передаёт
|
||||
`CLIENT_TLS__CA_FILE` (CA стенда); соединение администратора — `ssl=build_client_context(…)`,
|
||||
`make_engine` — `create_engine(…, ca_file=…)`, через `TcpProxy` — `host="localhost"` (прокси на
|
||||
loopback передаёт байты TLS как есть, имя проверяется по SAN). Мягкое закрытие под TLS — Terminate
|
||||
и запись `close_notify`: `test_soft_close_is_graceful` ждёт одну или две порции клиента.
|
||||
- `unit/test_client_tls.py` (change `storage-tls`): флаги контекста, отсутствие системных корней,
|
||||
`client_tls_problems` по процессам, проводка asyncpg / redis-py / aiobotocore, настоящее
|
||||
рукопожатие клиента кэша с локальным TLS-сервером RESP (CA и имя — ответ, посторонний CA и адрес
|
||||
вне SAN — промах и «Cache is unavailable»), точки входа процессом — пустой CA и
|
||||
`DATABASE__HOST=127.0.0.1` — код 2 до подключения; PKI — `pki.sh stand` во временном каталоге,
|
||||
без OpenSSL 3+ — пропуск.
|
||||
- `async def` тесты запускает плагин `anyio`: `pytestmark = pytest.mark.anyio` в модуле,
|
||||
новых зависимостей нет. Цикл событий на тест: engine закрывается в том же тесте.
|
||||
- С change `auth-hardening`: `FakeLoginLimiter` (порт `AbstractLoginLimiter`, `blocked` —
|
||||
|
||||
Reference in New Issue
Block a user