Webhook icon
Schedule icon
WorkingDirectory icon
Clone icon
Script icon
Docker icon
If icon
SlackIncomingWebhook icon
Log icon
Pause icon
Fail icon
Loop icon
Set icon

Vault ACL Policy GitOps Reconciliation Gate

Reconcile Vault or OpenBao ACL policies with Git using count-confirmed approval, check-and-set writes, flapping detection and read-back verification.

Categories
Infrastructure

ACL policies edited in the UI or by another tool drift from Git, and a policy write changes access for live tokens at once. This blueprint treats Git as the truth but makes every write explicit, concurrency-safe and verified.

How it works

  1. A webhook (from a Git push on the policy repo) or an hourly schedule starts the flow; concurrency allows one run at a time.
  2. clone_policy (io.kestra.plugin.git.Clone) fetches one lowercase name.hcl file per policy. An empty directory, an uppercase name, a file without a path stanza or unbalanced braces fails the run instead of being pushed.
  3. scan_policies lists sys/policies/acl, reads each policy and diffs it with Git, ignoring line endings and trailing whitespace. It looks up the token's own policies with auth/token/lookup-self and never changes them.
  4. A policy that was already reconciled flap_threshold times inside flap_window_days, recorded in KV, is reported as flapping instead of fought over. Unmanaged policies are only deleted after a grace window and never default or root.
  5. The Slack plan describes per policy which paths and capabilities are added or removed and flags sudo or wildcard write gains.
  6. pause_for_approval holds the plan; the operator types the number of changes.
  7. apply_policy_changes loops over the policies. Each apply_policy_change re-reads the live policy, skips it if it changed while waiting, writes with OpenBao's cas version when available and reads it back.
  8. verify_reconciliation re-reads every planned policy, checks nothing else changed, confirms the token still works and stores the previous text for rollback.

What you get

  • Concurrency-safe policy writes with a rollback copy of every overwritten policy.
  • Plans that show privilege changes instead of raw diffs.
  • Protection from locking out the Kestra token or deleting everything after a Git mistake.

Who it's for

  • Platform and security teams that run Vault or OpenBao and keep policies in Git.

Why orchestrate this with Kestra

Flapping detection needs memory across runs, writes need a human decision, and the proof needs an independent read. Git, KV, Pause and Loop express that in one flow.

Prerequisites

  • Vault or OpenBao reachable from the worker, Docker on the worker and a Slack webhook.
  • A token whose policy allows list, read, create, update and delete on sys/policies/acl/* and read on auth/token/lookup-self.

Secrets

  • VAULT_TOKEN: token used for all policy reads and writes.
  • SLACK_WEBHOOK_URL: Slack Incoming Webhook.
  • VAULT_POLICY_WEBHOOK_KEY: key protecting the webhook trigger.

Quick start

  1. Run docker run -d -p 8200:8200 -e BAO_DEV_ROOT_TOKEN_ID=dev-token -e BAO_DEV_LISTEN_ADDRESS=0.0.0.0:8200 openbao/openbao server -dev and create a non-root token.
  2. Commit policies/<name>.hcl files to a Git repository and edit one policy in Vault to create drift.
  3. Create the three secrets and execute with dry_run: true.
  4. Execute with dry_run: false, resume the pause with the planned count and check the verified message.

How to extend

  • The default policy is attached to almost every token, so it counts as the token's own policy and is reported, not changed, when it differs from Git.
  • Add a Kubernetes or Terraform check that finds the second writer behind a flapping policy.
  • Restore a policy from the previous map in the KV audit entry.

Links

See How

New to Kestra?

Use blueprints to kickstart your first workflows.