Retire mini legacy Vault into c1 OpenBao #184

Closed
opened 2026-11-22 21:00:06 +00:00 by ginjiruu · 4 comments
Owner

Retire mini's legacy Vault (OpenBao 2.0.4, ns vault) into the c1 OpenBao. Scoped 2026-11-22 from a read-only inventory (key names and metadata only) and the live ESO objects.

Why now

  • ESO reads it with a root token. ClusterSecretStore/vault-backend uses Secret external-secrets/vault-token: policy root, no TTL, created 2024-08-08. Any pod that can read that Secret owns every secret on mini. The init root token (2024-08-07) was never revoked either; those two are the only live tokens.
  • Single pod, file storage, Shamir seal with no auto-unseal: every mini restart needs a manual unseal.
  • Its OIDC role still allows only the retired vault.animeteamspeak.moe callback, so UI login is dead, and it keeps a second callback on the kanidm vault client.
  • No IaC owns it (vault-config is gone; openbao-config manages c1 only).

What it holds

Mount Content Plan
secret/ (KV v2) 73 keys migrate (see key table)
kv-v2/ 4 keys from 2024-08 (foo, forgejo, forgejo-db-creds, discord-flux-webhook) archive only
remote-secrets/ cloudflare-certmanager-secrets, discord-flux-webhook; read by clusters/remote decision D4
database/ no connections, no roles drop
pki-apiserver/ 1 issuer, 1 cert, no roles, no consumer in git drop
agent-registry/ builtin plugin, empty drop
auth approle/ role vault-runner (old vault-config runner) drop
auth oidc/, oidc-cli/ human login, dead callback drop (c1 has both)

secret/ keys by consumer

  • LIVE (37): read by the 51 mini ExternalSecrets on vault-backend, or written by its 5 PushSecrets (nats-token, argo-workflows-s3, velero-mini-seaweed-s3, velero-portable-seaweed-s3, vmuser-mini-tenant).
  • REF (8): referenced in lab/clusters manifests not deployed on mini: discord-flux-webhook, fluxcd-dev-apps-source-read-key, argocd-secrets, copyparty-secrets, kargo-secrets, wasabi-s3, vui-secrets, yamtrack-secrets.
  • STANDBY (7): standby/ apps: endurain-secrets, n8n-secrets, peekaping-secrets, pinniped-oidc-secret, qbittorrent-secrets, semaphore, shiori-configuration-secret.
  • ArgoCD apps repo only (4): lubelogger-secrets, supabase-secrets, wiredoor-secrets (inactive apps), portable-cluster-argocd-apps-repo.
  • Unreferenced anywhere (18), checked in lab/clusters, argocd-apps, automation, ghost-blog, authz-bridge, iac, machine-configs: automation-project-repo, collabora-secrets, docker-mailserver-secrets, external-dns-secrets, forgejo-runner-values, foundry-values, generated/diag_kvtest, generated/diag_test, grafana-admin-values, harbor-node-pull (superseded by c1 infra/harbor/node-pull), k8s-hub-ca-portable, k8s-hub-mtls-mail, k8s-hub-mtls-mini, nextcloud-configuration-secret, velero-internal-bucket, velero-truenas-bucket, wasabi-velero, wiredoor-values.

Key fact that makes this cheap

c1's secret/ mount is the same layout (KV v2, same key names) on purpose (vault/eso-mini.tf header), and mini's ESO already logs into c1 OpenBao with its own ServiceAccount (JWT mount kubernetes-mini, role external-secrets; store openbao). Every one of the ~45 manifests names the store vault-backend, and nothing else in git dials mini Vault. So one file, clusters/mini/eso/vault-backend.yaml, moves all 51 ExternalSecrets and 5 PushSecrets once the keys exist on c1 and the policy grants them.

Plan

Stage 0: iac (this repo)

  • vault/eso-mini.tf: grant role external-secrets read on each migrated path (explicit list in a local, not secret/*) and create/update on the 5 PushSecret paths. The existing routeros/unifi/pdns grants stay.
  • Optionally move mini-sa-jwks.pem freshness into the gate (task check:mini-jwks exists): after the cutover, an rke2 reinstall on mini would stop all mini secrets from refreshing until the PEM is updated.

Stage 1: copy (one session, needs a human OpenBao login)

  • Script: for each migrated key, bao kv get -mount=secret from mini (ESO's token, just in time) and bao kv put -mount=secret to c1 with a vault_superadmins OIDC token (vault-login.py, 30 min TTL). Then compare a per-key data hash on both sides. Version history is not carried over, only the current version. Nothing on mini changes in this stage.

Stage 2: cutover (lab/clusters)

  • Before: record a hash of every target k8s Secret's data.
  • clusters/mini/eso/vault-backend.yaml: server https://secrets.infra.caosh.int.animeteamspeak.moe (JWT auth is not CIDR-bound, so the passthrough Gateway is fine and spreads over the thinks), path secret, auth jwt kubernetes-mini / role external-secrets. The openbao store moves from 10.30.20.21 to the same name.
  • After: all 51 ExternalSecrets SecretSynced, 5 PushSecrets Synced, and every k8s Secret hash unchanged. Rollback = revert the one file (mini Vault is untouched until stage 4).
  • Consider raising refreshInterval from 15s: 51 objects at 4/min is ~200 logins/min against OpenBao for values that rarely change.

Stage 3: soak a few days. PushSecret writes (velero, argo, nats, vmuser) land on c1.

Stage 4: decommission

  • Final encrypted export of all mounts (decision D3 for where), then revoke both root tokens and delete external-secrets/vault-token.
  • lab/clusters: remove clusters/mini/vault/ (HelmRelease, namespace, routes-internal, egress policy); Flux prunes, and the vault.apps.caosh.int record goes with the route. Delete PVC vault/data-vault-0 after the export.
  • iac kanidm/oauth2.tf: the vault client drops the mini callback, and origin moves to https://secrets.infra.caosh.int.animeteamspeak.moe/.
  • Docs: flux-clusters ADR-0002 gets a superseded note, CONTEXT.md "Vault IaC" and the VSO entry (VSO is out per #103), docs/agents/secrets.md pattern 2 (stores and paths), AGENTS.md.

Stage 5 (optional, later): rename vault-backend to openbao in the ~45 manifests and drop the alias store. Fold the flat paths into the catalog layout when #103 resumes.

Decisions needed

  • D1 path layout: keep flat secret/<key> for the move (recommended; matches today, zero manifest churn) or go straight to the #103 catalog layout (apps/<app>/{generated,manual}; touches every manifest and blocks on #103).
  • D2 which keys: recommended: migrate LIVE + REF + STANDBY + the 4 ArgoCD-repo keys (56). The 18 unreferenced keys, kv-v2/ and remote-secrets/ exist afterwards only in the encrypted export.
  • D3 export location: an age-encrypted file offline, or a c1 KV path such as archive/mini-vault/.
  • D4 portable and remote: both define vault-backend against the retired public URL (dead since 2026-11-20) and are unreachable from here. Delete those store definitions, or leave them for the mx2-to-c3 conversion.

Effort

Stage 0 small PR; stage 1 one sitting with a login; stage 2 one-file PR plus about 30 min of verification; stage 4 three small PRs. About one working session plus the soak. Blast radius in stage 2 is every mini secret, mitigated by unchanged paths and data, a hash check, and a one-file rollback while mini Vault keeps running.

Related: #103 (catalog: an agent principal with manual-secret-manager is what would let an agent do stage 1 without a human token).

Retire mini's legacy Vault (OpenBao 2.0.4, ns `vault`) into the c1 OpenBao. Scoped 2026-11-22 from a read-only inventory (key names and metadata only) and the live ESO objects. ## Why now - **ESO reads it with a root token.** `ClusterSecretStore/vault-backend` uses Secret `external-secrets/vault-token`: policy `root`, no TTL, created 2024-08-08. Any pod that can read that Secret owns every secret on mini. The init root token (2024-08-07) was never revoked either; those two are the only live tokens. - Single pod, file storage, **Shamir seal with no auto-unseal**: every mini restart needs a manual unseal. - Its OIDC role still allows only the retired `vault.animeteamspeak.moe` callback, so UI login is dead, and it keeps a second callback on the kanidm `vault` client. - No IaC owns it (vault-config is gone; openbao-config manages c1 only). ## What it holds | Mount | Content | Plan | |---|---|---| | `secret/` (KV v2) | 73 keys | migrate (see key table) | | `kv-v2/` | 4 keys from 2024-08 (`foo`, `forgejo`, `forgejo-db-creds`, `discord-flux-webhook`) | archive only | | `remote-secrets/` | `cloudflare-certmanager-secrets`, `discord-flux-webhook`; read by `clusters/remote` | decision D4 | | `database/` | no connections, no roles | drop | | `pki-apiserver/` | 1 issuer, 1 cert, no roles, no consumer in git | drop | | `agent-registry/` | builtin plugin, empty | drop | | auth `approle/` | role `vault-runner` (old vault-config runner) | drop | | auth `oidc/`, `oidc-cli/` | human login, dead callback | drop (c1 has both) | ### `secret/` keys by consumer - **LIVE (37)**: read by the 51 mini ExternalSecrets on `vault-backend`, or written by its 5 PushSecrets (`nats-token`, `argo-workflows-s3`, `velero-mini-seaweed-s3`, `velero-portable-seaweed-s3`, `vmuser-mini-tenant`). - **REF (8)**: referenced in lab/clusters manifests not deployed on mini: `discord-flux-webhook`, `fluxcd-dev-apps-source-read-key`, `argocd-secrets`, `copyparty-secrets`, `kargo-secrets`, `wasabi-s3`, `vui-secrets`, `yamtrack-secrets`. - **STANDBY (7)**: `standby/` apps: `endurain-secrets`, `n8n-secrets`, `peekaping-secrets`, `pinniped-oidc-secret`, `qbittorrent-secrets`, `semaphore`, `shiori-configuration-secret`. - **ArgoCD apps repo only (4)**: `lubelogger-secrets`, `supabase-secrets`, `wiredoor-secrets` (inactive apps), `portable-cluster-argocd-apps-repo`. - **Unreferenced anywhere (18)**, checked in lab/clusters, argocd-apps, automation, ghost-blog, authz-bridge, iac, machine-configs: `automation-project-repo`, `collabora-secrets`, `docker-mailserver-secrets`, `external-dns-secrets`, `forgejo-runner-values`, `foundry-values`, `generated/diag_kvtest`, `generated/diag_test`, `grafana-admin-values`, `harbor-node-pull` (superseded by c1 `infra/harbor/node-pull`), `k8s-hub-ca-portable`, `k8s-hub-mtls-mail`, `k8s-hub-mtls-mini`, `nextcloud-configuration-secret`, `velero-internal-bucket`, `velero-truenas-bucket`, `wasabi-velero`, `wiredoor-values`. ## Key fact that makes this cheap c1's `secret/` mount is the same layout (KV v2, same key names) on purpose (`vault/eso-mini.tf` header), and mini's ESO already logs into c1 OpenBao with its own ServiceAccount (JWT mount `kubernetes-mini`, role `external-secrets`; store `openbao`). Every one of the ~45 manifests names the store `vault-backend`, and nothing else in git dials mini Vault. So **one file**, `clusters/mini/eso/vault-backend.yaml`, moves all 51 ExternalSecrets and 5 PushSecrets once the keys exist on c1 and the policy grants them. ## Plan **Stage 0: iac (this repo)** - `vault/eso-mini.tf`: grant role `external-secrets` read on each migrated path (explicit list in a local, not `secret/*`) and create/update on the 5 PushSecret paths. The existing routeros/unifi/pdns grants stay. - Optionally move `mini-sa-jwks.pem` freshness into the gate (`task check:mini-jwks` exists): after the cutover, an rke2 reinstall on mini would stop all mini secrets from refreshing until the PEM is updated. **Stage 1: copy (one session, needs a human OpenBao login)** - Script: for each migrated key, `bao kv get -mount=secret` from mini (ESO's token, just in time) and `bao kv put -mount=secret` to c1 with a `vault_superadmins` OIDC token (`vault-login.py`, 30 min TTL). Then compare a per-key data hash on both sides. Version history is not carried over, only the current version. Nothing on mini changes in this stage. **Stage 2: cutover (lab/clusters)** - Before: record a hash of every target k8s Secret's data. - `clusters/mini/eso/vault-backend.yaml`: server `https://secrets.infra.caosh.int.animeteamspeak.moe` (JWT auth is not CIDR-bound, so the passthrough Gateway is fine and spreads over the thinks), path `secret`, auth jwt `kubernetes-mini` / role `external-secrets`. The `openbao` store moves from `10.30.20.21` to the same name. - After: all 51 ExternalSecrets `SecretSynced`, 5 PushSecrets `Synced`, and every k8s Secret hash unchanged. Rollback = revert the one file (mini Vault is untouched until stage 4). - Consider raising `refreshInterval` from 15s: 51 objects at 4/min is ~200 logins/min against OpenBao for values that rarely change. **Stage 3: soak** a few days. PushSecret writes (velero, argo, nats, vmuser) land on c1. **Stage 4: decommission** - Final encrypted export of all mounts (decision D3 for where), then revoke both root tokens and delete `external-secrets/vault-token`. - lab/clusters: remove `clusters/mini/vault/` (HelmRelease, namespace, routes-internal, egress policy); Flux prunes, and the `vault.apps.caosh.int` record goes with the route. Delete PVC `vault/data-vault-0` after the export. - iac `kanidm/oauth2.tf`: the `vault` client drops the mini callback, and `origin` moves to `https://secrets.infra.caosh.int.animeteamspeak.moe/`. - Docs: flux-clusters ADR-0002 gets a superseded note, CONTEXT.md "Vault IaC" and the VSO entry (VSO is out per #103), `docs/agents/secrets.md` pattern 2 (stores and paths), AGENTS.md. **Stage 5 (optional, later)**: rename `vault-backend` to `openbao` in the ~45 manifests and drop the alias store. Fold the flat paths into the catalog layout when #103 resumes. ## Decisions needed - **D1 path layout**: keep flat `secret/<key>` for the move (recommended; matches today, zero manifest churn) or go straight to the #103 catalog layout (`apps/<app>/{generated,manual}`; touches every manifest and blocks on #103). - **D2 which keys**: recommended: migrate LIVE + REF + STANDBY + the 4 ArgoCD-repo keys (56). The 18 unreferenced keys, `kv-v2/` and `remote-secrets/` exist afterwards only in the encrypted export. - **D3 export location**: an age-encrypted file offline, or a c1 KV path such as `archive/mini-vault/`. - **D4 portable and remote**: both define `vault-backend` against the retired public URL (dead since 2026-11-20) and are unreachable from here. Delete those store definitions, or leave them for the mx2-to-c3 conversion. ## Effort Stage 0 small PR; stage 1 one sitting with a login; stage 2 one-file PR plus about 30 min of verification; stage 4 three small PRs. About one working session plus the soak. Blast radius in stage 2 is every mini secret, mitigated by unchanged paths and data, a hash check, and a one-file rollback while mini Vault keeps running. Related: #103 (catalog: an agent principal with `manual-secret-manager` is what would let an agent do stage 1 without a human token).
Author
Owner

Decisions (owner, 2026-11-22): D1 keep flat secret/. D2 migrate the 56 keys (LIVE + REF + STANDBY + the 4 ArgoCD-repo keys). D3 no export, no backup: one copy, then mini Vault is deleted, so the 18 unreferenced keys, kv-v2/ and remote-secrets/ are dropped for good. D4 delete the portable and remote vault-backend store definitions.

Decisions (owner, 2026-11-22): D1 keep flat secret/<key>. D2 migrate the 56 keys (LIVE + REF + STANDBY + the 4 ArgoCD-repo keys). D3 no export, no backup: one copy, then mini Vault is deleted, so the 18 unreferenced keys, kv-v2/ and remote-secrets/ are dropped for good. D4 delete the portable and remote vault-backend store definitions.
Author
Owner

Progress 2026-11-22:

  • Stage 0 done: #185 applied (mini-external-secrets: 32 read + 5 push paths; plan was exactly one policy update, 8 -> 82 path grants).
  • Stage 1 done: 56 keys copied to c1 secret/ (data + custom_metadata on the 5 PushSecret targets), each re-read and sha256-compared; an independent second pass reports 56/56 identical. Values never left memory. Script: ~/.local/share/lab-scripts/migrate-mini-vault.py on arch-ws.
  • Stage 2 done: lab/clusters#1782 merged. vault-backend and openbao stores on mini point at https://secrets.infra.caosh.int.animeteamspeak.moe with JWT login (no more root token in use); portable/remote stores deleted (D4). After a forced sync: 49 ExternalSecrets refreshed and Ready, 5 PushSecrets Synced to c1, every target k8s Secret hash identical to the pre-cutover baseline, no ESO errors.
  • Stage 3: soak. Mini Vault still runs untouched (rollback = revert #1782).
  • Stage 4 pending owner go: delete mini Vault (no export, D3), delete external-secrets/vault-token, kanidm vault client mini callback, docs.
Progress 2026-11-22: - Stage 0 done: #185 applied (mini-external-secrets: 32 read + 5 push paths; plan was exactly one policy update, 8 -> 82 path grants). - Stage 1 done: 56 keys copied to c1 secret/<key> (data + custom_metadata on the 5 PushSecret targets), each re-read and sha256-compared; an independent second pass reports 56/56 identical. Values never left memory. Script: ~/.local/share/lab-scripts/migrate-mini-vault.py on arch-ws. - Stage 2 done: lab/clusters#1782 merged. vault-backend and openbao stores on mini point at https://secrets.infra.caosh.int.animeteamspeak.moe with JWT login (no more root token in use); portable/remote stores deleted (D4). After a forced sync: 49 ExternalSecrets refreshed and Ready, 5 PushSecrets Synced to c1, every target k8s Secret hash identical to the pre-cutover baseline, no ESO errors. - Stage 3: soak. Mini Vault still runs untouched (rollback = revert #1782). - Stage 4 pending owner go: delete mini Vault (no export, D3), delete external-secrets/vault-token, kanidm vault client mini callback, docs.
Author
Owner

Cluster-side tracker: lab/clusters#1669.

Cluster-side tracker: lab/clusters#1669.
Author
Owner

Done 2026-11-22. mini legacy Vault deleted (lab/clusters#1783): namespace, PVC/PV and the root-token Secret gone, no export (D3). All mini secrets read the c1 OpenBao through vault-backend with ESO JWT login (#1782); 56 keys copied and hash-verified, 49 ExternalSecrets and 5 PushSecrets green with unchanged data. kanidm vault client serves only c1 (#187). ESO metrics scraped into VictoriaMetrics (#1786); alerting deliberately left for later. Found on the way: mini internal-dns external-dns had lost its RBAC since lab/clusters#1763 (shared chart ClusterRole deleted by the public release); fixed with own-named RBAC (#1787), which also removed the stale vault.apps record.

Done 2026-11-22. mini legacy Vault deleted (lab/clusters#1783): namespace, PVC/PV and the root-token Secret gone, no export (D3). All mini secrets read the c1 OpenBao through vault-backend with ESO JWT login (#1782); 56 keys copied and hash-verified, 49 ExternalSecrets and 5 PushSecrets green with unchanged data. kanidm vault client serves only c1 (#187). ESO metrics scraped into VictoriaMetrics (#1786); alerting deliberately left for later. Found on the way: mini internal-dns external-dns had lost its RBAC since lab/clusters#1763 (shared chart ClusterRole deleted by the public release); fixed with own-named RBAC (#1787), which also removed the stale vault.apps record.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
lab/iac#184
No description provided.