Automate harbor-config-openbao (hand-made SecretID) and keep the node-pull password out of tofu state #23

Open
opened 2026-11-11 23:39:19 +00:00 by ginjiruu · 1 comment
Owner

Related: #21 (hand-made openbao-config-vars).

Why

The harbor-config Terraform object on mini logs in to OpenBao with a SecretID for approle-runners/harbor-config (lab/iac vault/runners.tf). It sits in the Secret harbor-config-openbao (key openbao_secret_id) in mini's flux-system, created by hand on 2026-11-11. That breaks the rule of no hand-applied secrets on clusters. Nothing rotates it, and nothing recreates it if mini is rebuilt.

Separately: the cluster-node-pull robot password sits in the harbor root's tofu state three times (random_password, harbor_robot_account.secret, and from lab/iac#59 vault_kv_secret_v2.data_json). Anyone who can read Secrets in mini's flux-system can read it from tfstate-default-harbor-config.

What

  • Deliver harbor-config-openbao automatically, the same mechanism as #21. ESO can't read it from OpenBao, because it is the credential used to reach OpenBao, so this needs the bootstrap answer #21 settles. Candidates: tofu-controller's own OpenBao auth via a k8s service account (auth/kubernetes on mini), or the openbao-config root minting the SecretID and writing the Secret through the kubernetes provider.
  • Keep the robot password out of state: ephemeral "random_password", harbor_robot_account.secret_wo, vault_kv_secret_v2.data_json_wo with a data_json_wo_version to bump on rotation.

Done when

  • harbor-config-openbao is created and rotated without a human
  • the robot password no longer appears in tfstate-default-harbor-config
  • mini rebuild (c2) brings both back with no manual step
Related: #21 (hand-made `openbao-config-vars`). ## Why The `harbor-config` Terraform object on mini logs in to OpenBao with a SecretID for `approle-runners/harbor-config` (lab/iac `vault/runners.tf`). It sits in the Secret `harbor-config-openbao` (key `openbao_secret_id`) in mini's `flux-system`, **created by hand** on 2026-11-11. That breaks the rule of no hand-applied secrets on clusters. Nothing rotates it, and nothing recreates it if mini is rebuilt. Separately: the `cluster-node-pull` robot password sits in the `harbor` root's tofu state three times (`random_password`, `harbor_robot_account.secret`, and from lab/iac#59 `vault_kv_secret_v2.data_json`). Anyone who can read Secrets in mini's `flux-system` can read it from `tfstate-default-harbor-config`. ## What - Deliver `harbor-config-openbao` automatically, the same mechanism as #21. ESO can't read it from OpenBao, because it is the credential used to reach OpenBao, so this needs the bootstrap answer #21 settles. Candidates: tofu-controller's own OpenBao auth via a k8s service account (auth/kubernetes on mini), or the openbao-config root minting the SecretID and writing the Secret through the kubernetes provider. - Keep the robot password out of state: `ephemeral "random_password"`, `harbor_robot_account.secret_wo`, `vault_kv_secret_v2.data_json_wo` with a `data_json_wo_version` to bump on rotation. ## Done when - [ ] `harbor-config-openbao` is created and rotated without a human - [ ] the robot password no longer appears in `tfstate-default-harbor-config` - [ ] mini rebuild (c2) brings both back with no manual step
Author
Owner

Intended design (2026-11-11). It removes both hand-made secrets (this one and #21's openbao-config-vars):

  1. Runners log in with their service account, not an AppRole SecretID. An OpenBao auth/kubernetes-mini mount validates the tofu-controller runner pod's SA token against mini's API server and issues a scoped token (role harbor-config gets the same policy as approle-runners/harbor-config). Nothing to deliver. Same pattern as the existing auth/kubernetes-think. The bootstrap runner (openbao-config) is the special case: it configures OpenBao itself, so its kubernetes mount and role are created once at the ceremony and never managed by that root.
  2. Read secrets ephemerally instead of through varsFrom Secrets: ephemeral "vault_kv_secret_v2" for e.g. the Harbor admin password, so harbor-config-vars goes away too and the value never reaches state.
  3. Write-only attributes for generated secrets: ephemeral "random_password", harbor_robot_account.secret_wo, vault_kv_secret_v2.data_json_wo with a version to bump on rotation.
  4. Encrypt the state at rest: OpenTofu (>= 1.7) client-side state encryption with an OpenBao Transit key provider, so tfstate-* Secrets hold ciphertext. Check first: the tofu-controller runner image must run OpenTofu, not Terraform.
Intended design (2026-11-11). It removes both hand-made secrets (this one and #21's `openbao-config-vars`): 1. **Runners log in with their service account, not an AppRole SecretID.** An OpenBao `auth/kubernetes-mini` mount validates the tofu-controller runner pod's SA token against mini's API server and issues a scoped token (role `harbor-config` gets the same policy as `approle-runners/harbor-config`). Nothing to deliver. Same pattern as the existing `auth/kubernetes-think`. The bootstrap runner (openbao-config) is the special case: it configures OpenBao itself, so its kubernetes mount and role are created once at the ceremony and never managed by that root. 2. **Read secrets ephemerally instead of through varsFrom Secrets**: `ephemeral "vault_kv_secret_v2"` for e.g. the Harbor admin password, so `harbor-config-vars` goes away too and the value never reaches state. 3. **Write-only attributes for generated secrets**: `ephemeral "random_password"`, `harbor_robot_account.secret_wo`, `vault_kv_secret_v2.data_json_wo` with a version to bump on rotation. 4. **Encrypt the state at rest**: OpenTofu (>= 1.7) client-side state encryption with an OpenBao Transit key provider, so `tfstate-*` Secrets hold ciphertext. Check first: the tofu-controller runner image must run OpenTofu, not Terraform.
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/machine-configs#23
No description provided.