Rotate a provider key
Checked with iron-vault 0.2.0-alpha (features: dev-mode), built from main at 378d57d.
Give a stored credential a new secret; every route that uses it sends the new one, with no config change or restart. Revoke the old key at the provider afterwards: the provider accepts it until you do.
Output captured against httpbin.org, with a test value in place of each pass show.
Prerequisites
- The service running and Ready, with the
httpbin_keycredential andhttpbinroute from getting started. - The approval passphrase.
- The new key from the provider.
Steps
1. Replace the secret
replace takes the same --origin options as add. The old origins are not kept, so name every one again:
iron-vault replace httpbin_key --origin httpbin.org
It shows what changes and which routes use the credential, then asks for the approval passphrase and the new secret:
replace credential httpbin_key
record: f40ebf97-… -> a new record ID, assigned when the change is written
kind: static -> static
origins: httpbin.org:443 -> httpbin.org:443
routes using httpbin_key: httpbin (callers: me)
Approval passphrase for "approval passphrase":
Secret for httpbin_key:
replaced httpbin_key (static) as record 22327b62-…
From a script, put the approval passphrase on the first line of stdin and the secret after it:
{ pass show iron-vault-approval; pass show httpbin; } | iron-vault replace httpbin_key --origin httpbin.org
replace credential httpbin_key
record: 22327b62-… -> a new record ID, assigned when the change is written
kind: static -> static
origins: httpbin.org:443 -> httpbin.org:443
routes using httpbin_key: httpbin (callers: me)
replaced httpbin_key (static) as record 21f505bb-…
2. Check that the route uses the new key
iron-vault list
curl -s -H "Proxy-Authorization: Bearer $(cat ~/.iron-vault-tokens/me)" http://127.0.0.1:7878/httpbin/headers
httpbin_key static httpbin.org:443 healthy
{
"headers": {
"Accept": "*/*",
"Authorization": "Bearer [iron-vault:scrubbed]",
…
The first request may get 429: the route’s rate limit
starts empty after a replace. While the switch is in
progress, requests get 503 with reason checking.
3. Find the change in the log
jq -c 'select(.event == "credential.replaced")' ~/iron-vault-dev.log
{"service":"iron-vault","service_version":"0.2.0-alpha","schema_version":1,"deployment_profile":"development","timestamp":"2026-11-07T10:20:34.208637Z","level":"INFO","message":"credential replaced","event":"credential.replaced","credential":"httpbin_key","old_record_id":"f40ebf97-…","record_id":"22327b62-…","kind":"static","origins":"https://httpbin.org:443","old_kind":"static","old_origins":"https://httpbin.org:443","target":"iron-vault.audit"}
4. Revoke the old key at the provider
Do it in the provider’s console.
Changing the origins or the kind
replace also changes a key’s origins and kind. The new record must suit every route that uses the credential, or
nothing changes:
iron-vault replace httpbin_key --origin postman-echo.com
iron-vault: the service answered error 24 (credential-in-use): routes use credential httpbin_key and would stop working: route httpbin sends credential httpbin_key to postman-echo.com:443, which its record does not permit; approve a config without them first
To move a key to another host, change one side at a time:
replacewith the new origin alongside the old one:--origin httpbin.org --origin postman-echo.com.- Approve a config that points the route at the new host.
replaceagain with only the new origin.
What can go wrong
iron-vault: the service answered error 9 (approval-denied): the approval passphrase does not open the approver key. The approval passphrase was wrong. Nothing changed; the old key is still in use. The log has avault.presence-refusedrecord with"refusal":"wrong_passphrase".iron-vault: the service answered error 24 (credential-in-use): …. The new origins or kind don’t suit a route that uses the credential, as above.429on the first request afterwards. The bucket starts empty after areplace.- The provider refuses the new key. Iron Vault sends what you typed. Check for a stray space or a truncated paste,
then
replaceagain.
Reference
- CLI:
replaceand its stdin layout. - Audit log:
credential.replaced. - Related: remove a credential safely, rotate or revoke a caller token.