Files
mtusi2026lab7/scripts/bao_secret_id.sh
T
ALMiron 912a874f00
Skeleton contracts / contracts (pull_request) Blocked by required conditions
lab 7 openbao
2026-11-23 14:39:13 +03:00

12 lines
562 B
Bash

#!/bin/sh
# Issue a fresh short-lived SecretID (24 h) into ./secrets/approle/<role>/secret_id. Usage: bao_secret_id.sh <role|all>
set -eu
cd "$(dirname "$0")/.."; . scripts/bao_lib.sh; load_root
roles="${1:-all}"; [ "$roles" = all ] && roles="api worker dispatcher sweeper"
for r in $roles; do
mkdir -p "$S/approle/$r"
baoc write -f -field=secret_id "auth/approle/role/$r/secret-id" > "$S/approle/$r/secret_id.new"
chmod 644 "$S/approle/$r/secret_id.new"; mv -f "$S/approle/$r/secret_id.new" "$S/approle/$r/secret_id"
echo "secret_id issued for $r"
done