Skip to content

Secrets, passwords, and OpenBao: Install OpenBao

Back to Secrets, passwords, and OpenBao.

The service installer provisions a loopback-only, single-node OpenBao with integrated Raft storage and a JSON audit file. The generated directories are openbao/config, openbao/data, and openbao/audit.

Terminal window
brezel-services-installer openbao install --tag latest
brezel-services-installer openbao init
brezel-services-installer openbao status

openbao init writes the initial unseal keys and root token to openbao/bootstrap.json with mode 0600. Move that file to secure offline storage after configuring production authentication and auto-unseal. Do not commit it.

Initialization also asks Brezel to create a confidential Passport client using php bakery system openbao-client <system> --json --redirect=<callback>. The system database assigns the numeric client ID, so no global or hard-coded OAuth ID is required. Re-running initialization finds the client by its stable name and rotates its secret. The installer writes the returned ID and secret to .env, then configures a separate brezel-oidc auth mount and a root-only OpenBao UI role.

For an existing OpenBao cluster, configure the address without creating a local container:

Terminal window
brezel-services-installer openbao install --external https://secrets.example.com

An installation can append any supported seal stanza without interpreting provider-specific settings:

Terminal window
brezel-services-installer openbao install --seal-hcl ./openbao-seal.hcl

Configure the seal before the first openbao init. The file contains a complete OpenBao seal stanza. For example, AWS KMS can use the container’s workload identity without embedding cloud credentials in HCL:

seal "awskms" {
region = "eu-central-1"
kms_key_id = "alias/brezel-openbao"
}

The installer passes the stanza through unchanged, so Transit, PKCS#11, and plugin-based KMS providers can be selected the same way when supported by the pinned OpenBao image. Provider credentials should come from workload identity or protected container environment configuration. Auto-Unseal initialization produces recovery keys rather than Shamir unseal keys; both formats are retained in openbao/bootstrap.json. Do not delete or disable the backing KMS/HSM key: recovery keys alone cannot decrypt the OpenBao root key. Changing an initialized cluster to another seal requires the OpenBao seal migration procedure.

Back up and restore the integrated Raft database with openbao backup <target> and openbao restore <source>. The default listener disables TLS because Docker binds it to 127.0.0.1. Use TLS and a dedicated hostname when OpenBao is reachable outside the host. The managed profile is a single-node deployment; production systems that require network access or high availability should operate a separate TLS-enabled multi-node cluster and configure it with --external. Disable or encrypt swap, pin the OpenBao image version, protect the config/data/audit directories, rotate audit logs, store Raft snapshots off-host, and test restores.

The API authenticates to OpenBao with short-lived JWTs signed by the Passport RSA key by default. OpenBao exchanges those JWTs at its JWT auth mount; no long-lived OpenBao token is required in the API environment.

OPENBAO_ADDR=http://127.0.0.1:8200
OPENBAO_AUTH_DRIVER=jwt
OPENBAO_JWT_MOUNT=jwt
OPENBAO_JWT_ROLE=brezel-api
OPENBAO_JWT_AUDIENCE=openbao
OPENBAO_KV_MOUNT=brezel-secrets
OPENBAO_TOTP_MOUNT=brezel-totp
OPENBAO_UI_URL=https://secrets.example.com
OPENBAO_OIDC_CLIENT_ID=<assigned by Brezel>
OPENBAO_OIDC_CLIENT_SECRET=<generated by Brezel>
OPENBAO_OIDC_ISSUER=https://brezel.example.com/my-system
OPENBAO_OIDC_MOUNT=brezel-oidc
OPENBAO_OIDC_ROLE=brezel-root

OPENBAO_AUTH_DRIVER=token and OPENBAO_TOKEN are available for bootstrap and local diagnostics, not as the preferred production setup. Each OpenBao policy should constrain paths by the brezel_system JWT claim. Shared clusters should use a separate JWT/OIDC role or auth mount per trust boundary.

Brezel extends its existing Passport Authorization Code/PKCE provider with OIDC Discovery, JWKS, UserInfo, and id_token output. The password-manager widget exposes the preselected OpenBao OIDC login only to root users. OpenBao also verifies the brezel_root ID-token claim, so manually opening the OpenBao login route does not bypass that rule. The callback is ${OPENBAO_UI_URL}/ui/vault/auth/${OPENBAO_OIDC_MOUNT}/oidc/callback.

By default, the issuer is ${APP_URL}/${VITE_APP_SYSTEM}. In production, OPENBAO_OIDC_ISSUER must be a canonical URL that OpenBao can reach for discovery and JWKS and that Brezel uses as the ID-token issuer. Keep OPENBAO_UI_URL browser-reachable. Restart long-running PHP processes after changing these values, especially when configuration is cached.

For local .test and .localhost issuers, the managed installer maps the hostname to Docker’s host-gateway instead of the container’s loopback address. It automatically uses the standard Valet or Herd development CA as oidc_discovery_ca_pem. Set OPENBAO_OIDC_DISCOVERY_CA_FILE to the PEM file when another local CA signs the Brezel hostname.