← All churts

uBix Vault 1.7: Hand Out Role Administration Without Handing Out Root

uBix Vault 1.7: Hand Out Role Administration Without Handing Out Root

Who can make themselves root?

That’s the question I’d ask of any secrets manager before I let more than one person administer it.

In uBix Vault before 1.7, the honest answer was: anyone who could write a login role. A JWT, Kubernetes or AppRole role could list the root policy, and logging in through that role handed out a root token. So the moment I wanted to let someone else manage login roles, say a CI pipeline that sets up its own service accounts, or a team that owns its own apps, I was really handing them root.

1.6 was about keeping its own data. 1.7 is about delegation: letting other people manage login roles while still controlling what those roles hand out.

If you haven’t met it: uBix Vault is a lightweight, open, Vault-API-compatible secrets manager. One small Go binary, no plugin processes, and Vault’s request shapes, so the vault CLI and External Secrets Operator work unmodified.

What changed

  • Root comes only from the key holders. A root token now comes only from initialization, from generate-root (a quorum of unseal key shares), or from another root token. Every auth method (JWT, Kubernetes, AppRole, userpass, cert, LDAP groups) refuses root when a role is written, and refuses it again at login. Only a root token can create another root token through auth/token/create; sudo is no longer enough. This matches Vault.
  • Parameter limits in ACL policies. Policies accept allowed_parameters, denied_parameters and required_parameters, in JSON and HCL, with Vault’s semantics. A policy can let someone write a role, but only with certain values. The limits come from the most specific matching path, so a broader grant such as auth/* doesn’t lift them.
  • Partial role updates everywhere. On JWT, Kubernetes, AppRole and cert roles and on userpass users, a write to an existing role changes only the fields it sends, as in Vault. Every method accepts token_policies, and list fields accept either a list or a comma-separated string. Concurrent updates to the same role are applied one at a time, so neither is lost.
  • A token can ask what it may do. sys/capabilities-self and sys/capabilities work, so vault token capabilities does too. The answer is computed the same way as the real permission check, and a test holds the two together, including for identity and templated policies.

Example: a role administrator who can’t escalate

This policy lets someone manage JWT and Kubernetes login roles, but only hand out policies that start with app-:

path "auth/jwt/role/*" {
  capabilities = ["create", "update", "read", "list"]
  allowed_parameters = {
    "token_policies"  = ["app-*"]
    "role_type"       = []
    "user_claim"      = []
    "bound_audiences" = []
    "bound_claims"    = []
    "token_ttl"       = []
    "token_max_ttl"   = []
  }
}

path "auth/kubernetes/role/*" {
  capabilities = ["create", "update", "read", "list"]
  allowed_parameters = {
    "token_policies"                   = ["app-*"]
    "bound_service_account_names"      = []
    "bound_service_account_namespaces" = []
    "token_ttl"                        = []
    "token_max_ttl"                    = []
  }
}

A holder of this policy can create a JWT role that grants ["app-web", "app-db"]. A request is refused with 403 if:

  • it grants admin,
  • it mixes app-web with anything outside app-*, or
  • it uses the older policies field, which this policy doesn’t list.

Every element of a list must be allowed, and root is refused whatever the policy says. Because updates are partial now, a later token_ttl=2h write changes just the TTL.

Before you upgrade

  • A role that lists root stops working. Logins through it now fail. Remove root from the role. Writing an ACL policy named root is also refused.
  • Role writes no longer replace the whole role. If you relied on a write clearing the fields it left out, send them empty instead ("bound_claims": {}).
  • Limits apply to the JSON body of POST and PUT writes. Limits on GET query parameters aren’t supported. required_parameters checks that a parameter is present, as Vault does, so an empty value such as {} passes.

Upgrading is a binary or image swap (chart 0.1.23, appVersion 1.7.0), with no storage migration. Before you roll out, while you’re still on 1.6.0, find any role that lists root. 1.6.0 reports a role’s policies as policies and 1.7.0 as token_policies, so this check reads both. It matches the way 1.7.0 does (ignoring case and surrounding spaces), and a role it can’t list or read is reported as an error rather than skipped:

#!/usr/bin/env bash
# Needs a token that can list and read the roles. Keep only the auth methods
# you have enabled (default mount paths shown). Any failure is reported, so
# no output and exit status 0 means no role lists root.
methods=(jwt/role kubernetes/role approle/role cert/certs userpass/users ldap/groups)
status=0
for dir in "${methods[@]}"; do
  if ! names=$(vault list -format=json "auth/$dir" 2>&1); then
    [[ $names == *"No value found"* ]] && continue   # no roles here
    echo "ERROR: cannot list auth/$dir: $names" >&2; status=1; continue
  fi
  while IFS= read -r name; do
    if ! role=$(vault read -format=json "auth/$dir/$name" 2>&1); then
      echo "ERROR: cannot read auth/$dir/$name: $role" >&2; status=1; continue
    fi
    if jq -e '[.data.token_policies, .data.policies] | flatten
              | map(select(. != null) | ascii_downcase | gsub("^\\s+|\\s+$"; ""))
              | index("root")' >/dev/null <<<"$role"; then
      echo "auth/$dir/$name lists root"; status=1
    fi
  done < <(jq -r '.[]?' <<<"$names")
done
exit $status

Where it stops

  • There’s no independent security audit. That’s still the open milestone, so weigh it against what your secrets are worth.
  • Raft storage is still experimental. The MySQL-backed HA path is the stable one.

The repo is github.com/ubixsys/ubixvault, BSD 3-Clause, with the Helm chart in deploy/charts/ubixvault. The full list is in the v1.7.0 changelog. If you delegate role administration and find a way back to root, I want to hear about it.

← All churts