ЛР 7: mTLS, OpenBao и проверка компрометации worker

This commit is contained in:
celis
2026-11-13 04:25:27 +03:00
parent 20afc2c790
commit 1991fcd737
114 changed files with 11918 additions and 127 deletions
+16
View File
@@ -0,0 +1,16 @@
#!/bin/sh
set -eu
cd "$(dirname "$0")/.."
case ${1:-all} in
all) roles='api worker reconciler' ;;
worker) roles=worker ;;
*) exit 2 ;;
esac
for role in $roles; do
password=$(cat "secrets/operator/db_$role")
case "$password" in *[!a-f0-9]*|'') exit 2 ;; esac
# Передача по stdin, аутентификация оператора через Unix socket и peer map.
printf "ALTER ROLE %s PASSWORD '%s';\n" "$role" "$password" |
docker compose exec -T -u postgres postgres psql -X -U messenger -d messenger -v ON_ERROR_STOP=1 >/dev/null
done
echo 'PostgreSQL: SCRAM credentials настроены'