lab7: OpenBao 2.7.3 (не dev, raft на volume, TLS, audit), AppRole и scoped policy для api/relay/worker, секреты только из OpenBao, скрипт оператора и проверка allow/deny

This commit is contained in:
Alexey Bodanyuk
2026-11-27 16:41:57 +03:00
parent 93f4ed1013
commit 876f610847
16 changed files with 623 additions and 45 deletions
+13 -8
View File
@@ -1,21 +1,26 @@
#!/bin/sh
# Restart hook for `make test-persistence ACTION_SCRIPT=scripts/restart.sh`.
# Restarts EVERY process of the stand: LB, all API replicas, relay, worker(s), PostgreSQL, Valkey,
# S3 (SeaweedFS) and the broker (RabbitMQ). Volumes, schema, data and queued messages are
# preserved: no `down -v`, no FLUSH, no purge, no re-seed.
# Output is suppressed by the test; run it by hand to see the steps.
# S3 (SeaweedFS), the broker (RabbitMQ) and OpenBao. Volumes, schema, data, queued messages and the
# OpenBao storage are preserved: no `down -v`, no FLUSH, no purge, no re-seed.
# Lab 7: OpenBao comes back SEALED; the operator unseal step (scripts/bao_operator.py unseal, shares
# from the operator directory outside the repository) runs before the services that need secrets.
# Output is suppressed by the test; run it by hand to see the steps (no secret is printed).
set -eu
cd "$(dirname "$0")/.."
PY="${PYTHON:-python}"
# 1. Entry point, API and the pipeline processes first: nothing is served or processed while the
# stores restart underneath.
docker compose stop lb api relay worker
# 2. Stores: clean shutdown (PostgreSQL checkpoint, Valkey AOF fsync, SeaweedFS volume/filer
# flush, RabbitMQ quorum log), then start again. Bytes live on s3data, messages on rabbitmqdata.
docker compose restart postgres valkey s3 broker
# 3. API replicas (wait for healthy stores via depends_on), the LB, then relay and worker. HAProxy
# resolves the new replica addresses through Docker DNS by itself - no stale backend list.
# flush, RabbitMQ quorum log, OpenBao raft), then start again.
docker compose restart postgres valkey s3 broker openbao
# 3. Operator: unseal (OpenBao is sealed after every start).
"$PY" scripts/bao_operator.py unseal
# 4. API replicas (log in to OpenBao again, read their secrets), the LB, then relay and worker.
# HAProxy resolves the new replica addresses through Docker DNS by itself.
docker compose start api
docker compose start lb
docker compose start relay worker
echo "restart.sh: lb, api (all replicas), relay, worker, postgres, valkey, s3 and broker restarted with volumes preserved"
echo "restart.sh: lb, api (all replicas), relay, worker, postgres, valkey, s3, broker and openbao restarted with volumes preserved; openbao unsealed"