forked from mtusi2026/mtusi2026lab7
26 lines
1.6 KiB
Markdown
26 lines
1.6 KiB
Markdown
# OpenBao bootstrap (non-dev, persistent)
|
|
|
|
OpenBao uses file storage in the `openbao_data` volume and HTTPS on 8200. The operator owns initialization, unseal shares and the initial root token. They are never stored in Git, `.env`, images or application configuration.
|
|
|
|
## First initialization (PowerShell)
|
|
|
|
1. Generate local TLS files with `scripts/bootstrap-certs.ps1`.
|
|
2. Start only OpenBao: `docker compose up -d openbao`.
|
|
3. Initialize once and save the output securely offline:
|
|
|
|
`docker compose exec openbao bao operator init -key-shares=3 -key-threshold=2`
|
|
|
|
4. Unseal using two distinct shares:
|
|
|
|
`docker compose exec openbao bao operator unseal`
|
|
|
|
Repeat with the second share. Never put shares in scripts or source control.
|
|
5. Run `scripts/bootstrap-openbao.ps1`. It prompts for the root token without echoing it, creates KV v2, policies and AppRole roles, then writes short-lived SecretIDs and RoleIDs to ignored local files under `secrets/bao/`.
|
|
6. Start API/worker after bootstrap. Each service authenticates with its own AppRole and reads only its own KV path. The application never receives the root token or unseal material.
|
|
|
|
## Restart
|
|
|
|
The storage volume persists. After an ordinary restart, check `bao status`. If sealed, an operator must unseal with two shares. Do not automate unseal by placing shares beside the container.
|
|
|
|
KV v2 secrets are static for this lab-3 baseline. Rotate AppRole SecretIDs by generating new IDs, updating the local files and restarting the affected service. Dynamic credentials and zero-downtime rotation are outside the selected grade.
|