// PART 04
Secrets
General Bots uses a layered approach to configuration and secrets management. The goal is to keep .env minimal — containing only Vault connection info — while all sensitive data is stored in Vault.
What goes where
| Layer | Holds |
|---|---|
.env |
VAULT_ADDR, VAULT_TOKEN, VAULT_CACERT — nothing else |
| Zitadel (directory) | user-facing identity: accounts, organizations, applications, MFA, SSO |
| Vault/OpenBao | machine-to-machine secrets: database, storage, cache, mail, LLM keys, encryption keys |
config.csv |
the bot’s non-sensitive settings; sensitive values via vault:path/key references |
Why .env stays minimal: .env files get committed, environment variables
leak into logs and process listings, and a single secret store makes rotation
a Vault write instead of a file edit on every host.
Vault paths reference
| Path | Contents |
|---|---|
secret/gbo/tables |
host, port, database, username, password |
secret/gbo/drive |
accesskey, secret, host, port, bucket, backend |
secret/gbo/cache |
host, port, password |
secret/gbo/llm |
url, model, openai_key (+ per-provider keys) |
secret/gbo/directory |
url, project_id, client_id, client_secret |
secret/gbo/email |
smtp_host, smtp_port, smtp_user, smtp_password, smtp_from, smtp_tls |
secret/gbo/{bot_id}/email |
same fields; overrides gbo/email for one bot |
secret/gbo/meet |
app_id/app_secret (LiveKit keys) |
secret/gbo/alm |
Forgejo admin password, runner token |
secret/gbo/vectordb |
url, api_key |
secret/gbo/observability |
url, org, bucket, token |
secret/gbo/encryption |
master_key, data_key |
secret/gbo/{org_id}/{branch_id}/{bot_id} |
per-bot LLM settings (llm-url, llm-server, llm-key, llm-model, llm-provider, system-prompt, history-limit) |
Per-bot LLM settings fall back: bot path → nil path → global
secret/gbo/llm; environment (LLM_URL/LLM_MODEL/LLM_KEY) only when
Vault has no value.
The bundled secrets server
The bundled server is OpenBao 2.7.3 (MPL-2.0), the open-source fork of
Vault. It speaks the same HTTP API; the component id stays vault, the
VAULT_* variables and secret/gbo/* paths did not change, and only the
program differs: bin/vault/bao (bao.exe on Windows). ./botserver install secrets initializes it with 5 unseal key shares (any 3 unseal), writes the
root token and keys to conf/vault/init.json and vault-unseal-keys, and
keeps data in data/vault with integrated raft storage. On Windows those
files are sealed with DPAPI for the user who runs the stack — a copy cannot be
read by another account, so move secrets with bao kv get instead of copying
files.
Day-to-day operations
./botserver vault health # connection check
./botserver vault put gbo/llm url=... model=... openai_key=...
./botserver vault get gbo/tables # sensitive values are masked
./botserver rotate-secret tables # single component
./botserver rotate-secrets --all # incident path; prints the manual updates required
Rotation rule: update Vault first, restart the process that caches the
secret (the LLM provider is built at boot), revoke the old credential only
after the restart succeeded. The secret cache honors VAULT_CACHE_TTL
(default 300 s). Protect init.json (chmod 600), enable audit logging
(vault audit enable file …), and snapshot the raft store for backup — see
Backup and restore.