test: verify security boundaries and recovery

This commit is contained in:
2026-11-06 21:17:03 +03:00
parent ee547e5523
commit 5ac64f51fa
26 changed files with 1752 additions and 68 deletions
+46
View File
@@ -0,0 +1,46 @@
#!/bin/sh
set -eu
script_dir=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)
. "$script_dir/openbao-common.sh"
require_command "$BAO_BIN"
require_command python3
require_file "$BAO_CACERT"
mkdir -p "$openbao_runtime_dir/operator"
chmod 0700 "$openbao_runtime_dir" "$openbao_runtime_dir/operator"
status_file=$(mktemp "$openbao_runtime_dir/.status.XXXXXX")
init_file=$(mktemp "$openbao_runtime_dir/operator/.init.XXXXXX")
chmod 0600 "$status_file" "$init_file"
cleanup() {
rm -f "$status_file" "$init_file"
}
trap cleanup EXIT HUP INT TERM
openbao_status "$status_file"
if [ "$(json_field "$status_file" initialized)" = "true" ]; then
echo "OpenBao is already initialized"
exit 0
fi
if [ -e "$openbao_operator_file" ]; then
fail "operator material already exists for an uninitialized OpenBao instance"
fi
"$BAO_BIN" operator init \
-key-shares=3 \
-key-threshold=2 \
-format=json >"$init_file"
chmod 0600 "$init_file"
mv "$init_file" "$openbao_operator_file"
echo "OpenBao initialized; operator material saved to .runtime/openbao/operator/init.json"
echo "Keep this file offline and run scripts/openbao-unseal.sh"