This commit is contained in:
Getlles
2026-11-25 01:43:37 +03:00
parent 8c7b051c2a
commit 3cd4603888
28 changed files with 1122 additions and 228 deletions
+14 -4
View File
@@ -60,27 +60,37 @@ bao_exec kv put secret/messenger/worker/s3 \
bao_exec write auth/approle/role/messenger-api \
token_policies="messenger-api" \
token_ttl="1h" \
token_max_ttl="4h" >/dev/null
token_max_ttl="4h" \
secret_id_ttl="24h" \
secret_id_num_uses=10 >/dev/null
bao_exec write auth/approle/role/messenger-worker \
token_policies="messenger-worker" \
token_ttl="1h" \
token_max_ttl="4h" >/dev/null
token_max_ttl="4h" \
secret_id_ttl="24h" \
secret_id_num_uses=10 >/dev/null
API_ROLE_ID=$(bao_exec read -field=role_id auth/approle/role/messenger-api/role-id)
API_SECRET_ID=$(bao_exec write -f -field=secret_id auth/approle/role/messenger-api/secret-id)
API_SECRET_JSON=$(bao_exec write -format=json -f auth/approle/role/messenger-api/secret-id)
API_SECRET_ID=$(echo "$API_SECRET_JSON" | python3 -c "import sys,json; print(json.load(sys.stdin)['data']['secret_id'])")
API_SECRET_ACCESSOR=$(echo "$API_SECRET_JSON" | python3 -c "import sys,json; print(json.load(sys.stdin)['data']['secret_id_accessor'])")
WORKER_ROLE_ID=$(bao_exec read -field=role_id auth/approle/role/messenger-worker/role-id)
WORKER_SECRET_ID=$(bao_exec write -f -field=secret_id auth/approle/role/messenger-worker/secret-id)
WORKER_SECRET_JSON=$(bao_exec write -format=json -f auth/approle/role/messenger-worker/secret-id)
WORKER_SECRET_ID=$(echo "$WORKER_SECRET_JSON" | python3 -c "import sys,json; print(json.load(sys.stdin)['data']['secret_id'])")
WORKER_SECRET_ACCESSOR=$(echo "$WORKER_SECRET_JSON" | python3 -c "import sys,json; print(json.load(sys.stdin)['data']['secret_id_accessor'])")
cat > ./infra/certs/api-approle.env <<EOF
BAO_ROLE_ID=${API_ROLE_ID}
BAO_SECRET_ID=${API_SECRET_ID}
BAO_SECRET_ID_ACCESSOR=${API_SECRET_ACCESSOR}
EOF
cat > ./infra/certs/worker-approle.env <<EOF
BAO_ROLE_ID=${WORKER_ROLE_ID}
BAO_SECRET_ID=${WORKER_SECRET_ID}
BAO_SECRET_ID_ACCESSOR=${WORKER_SECRET_ACCESSOR}
EOF
chmod 600 ./infra/certs/api-approle.env ./infra/certs/worker-approle.env