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:
@@ -85,6 +85,9 @@ CRASH_MARKERS = (
|
||||
"automatic recovery in progress",
|
||||
)
|
||||
CRASH_LINES_MAX = 20
|
||||
# отказ pg_hba.conf стенда соединению без TLS (change storage-tls): в журнале
|
||||
# прогона его быть не должно — healthcheck и пробы hook ходят по TLS
|
||||
PLAINTEXT_REFUSAL = "no encryption"
|
||||
# «тесный» API: короткие сроки сессии и ключа идемпотентности, пул из
|
||||
# одного соединения
|
||||
TIGHT_ENV = {
|
||||
@@ -389,14 +392,19 @@ def postgres_log_check(project: str) -> int:
|
||||
crashes = [line for line in lines if any(m in line for m in CRASH_MARKERS)]
|
||||
too_many = sum("too many clients" in line for line in lines)
|
||||
admin = sum("administrator command" in line for line in lines)
|
||||
# отказы соединений без TLS (change storage-tls): healthcheck, пробы hook и
|
||||
# процессы стенда ходят по TLS — такой строки быть не должно
|
||||
plaintext = [line for line in lines if PLAINTEXT_REFUSAL in line]
|
||||
say(
|
||||
f"postgres log: {len(lines)} lines, crash markers {len(crashes)}; "
|
||||
f'"too many clients" {too_many}, "administrator command" {admin}',
|
||||
f'"too many clients" {too_many}, "administrator command" {admin}, '
|
||||
f'"{PLAINTEXT_REFUSAL}" {len(plaintext)}',
|
||||
)
|
||||
if not crashes:
|
||||
if not crashes and not plaintext:
|
||||
return 0
|
||||
say("crash markers in the postgres log:")
|
||||
for line in crashes[:CRASH_LINES_MAX]:
|
||||
if crashes:
|
||||
say("crash markers in the postgres log:")
|
||||
for line in (crashes + plaintext)[:CRASH_LINES_MAX]:
|
||||
print(line, flush=True)
|
||||
return 1
|
||||
|
||||
|
||||
Reference in New Issue
Block a user