Implement lab 7 security and mTLS
Skeleton contracts / contracts (pull_request) Blocked by required conditions

This commit is contained in:
2026-11-26 16:55:53 +03:00
parent 20afc2c790
commit ab7b467957
54 changed files with 3240 additions and 25 deletions
+26
View File
@@ -0,0 +1,26 @@
#!/bin/sh
set -eu
BAO_ADDR=${BAO_ADDR:-http://127.0.0.1:8200}
export BAO_ADDR
echo "OpenBao bootstrap. Secrets are printed only to the operator terminal; do not commit them."
if ! bao status >/dev/null 2>&1; then
echo "OpenBao is unavailable at $BAO_ADDR" >&2; exit 2
fi
if [ "$(bao status -format=json | sed -n 's/.*\"initialized\":\([a-z]*\).*/\1/p')" = "false" ]; then
bao operator init -key-shares=3 -key-threshold=2
echo "Save the init output in an external password manager, then unseal with two shares."
exit 0
fi
echo "If sealed, run: bao operator unseal (twice, using different shares)."
bao secrets enable -path=secret kv-v2 2>/dev/null || true
bao policy write api infra/openbao/policies/api.hcl
bao policy write worker infra/openbao/policies/worker.hcl
bao auth enable approle 2>/dev/null || true
echo "Create short-lived AppRoles and inject only their wrapped secret_ids into the services."
echo "Example after authentication:"
echo " bao kv put secret/messenger/database_url database_url=..."
echo " bao kv put secret/messenger/cache_url cache_url=..."
echo " bao kv put secret/messenger/s3_access_key_id s3_access_key_id=..."
echo " bao kv put secret/messenger/s3_secret_access_key s3_secret_access_key=..."
echo "Then write the scoped token to secrets/openbao_token.txt (chmod 600), set OPENBAO_ENABLED=true and recreate api/worker."