feat: load process secrets from OpenBao via cert auth

OpenBao 2.7.3 (raft, TLS 1.3 with client certificates) holds the
PostgreSQL role passwords, the Valkey password and the S3 keys; each
process logs in with its own mTLS identity, reads only its paths and
renews its token in the background. Operator init, unseal, configure
and seed go through infra/openbao/bao.py and make bao_*; checks are
make bao_check and driver.py openbao-outage.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-26 13:55:09 +03:00
co-authored by Claude Opus 5.5
parent 4dd4a957be
commit 64210dace0
64 changed files with 6709 additions and 321 deletions
+6 -14
View File
@@ -11,8 +11,6 @@
процессов не входят в служебные базы `postgres` и `template1` (S6).
"""
import subprocess
import sys
import uuid
from collections.abc import AsyncIterator
@@ -21,11 +19,10 @@ import pytest
from conftest import (
ROLE_PASSWORDS,
ROOT,
TEST_DB,
_bootstrap_roles,
admin,
migrate_env,
run_alembic,
settings,
)
from src.infra.db import roles
@@ -56,15 +53,10 @@ WHERE n.nspname = 'public' AND c.relkind IN ('r', 'p')
"""
def _alembic(*args: str) -> subprocess.CompletedProcess[str]:
return subprocess.run(
[sys.executable, "-m", "alembic", *args],
cwd=ROOT,
env=migrate_env(),
check=True,
capture_output=True,
text=True,
)
def _alembic(*args: str) -> str:
"""alembic ролью migrate в процессе теста (секция роли — подстановкой,
change `openbao-secrets`); вывод `--sql` — текстом."""
return run_alembic(*args)
async def _connect(role: str, database: str = TEST_DB) -> asyncpg.Connection:
@@ -380,7 +372,7 @@ async def test_process_roles_cannot_connect_to_maintenance_databases(
def test_offline_sql_prints_grants() -> None:
output = _alembic("upgrade", "head", "--sql").stdout
output = _alembic("upgrade", "head", "--sql")
assert 'REVOKE ALL ON ALL TABLES IN SCHEMA "public" FROM' in output
assert 'GRANT INSERT ON "public"."attachment_job_replays" TO "relay"' in (
output