Symptoms
- Applications start failing with
ORA-01017: invalid username/password,password authentication failed,401 Unauthorizedfrom an API, or SMTP authentication errors. - The failures start right after someone uploaded a new secret version or a scheduled rotation ran.
- Pods or instances that restarted fail first; long-running processes that cached the old value keep working until they restart.
A secret rotation has two halves: the new value in Vault and the matching change in the target system (database user, API key, SMTP credential). Outages happen when only one half is done.
1. Confirm scope and impact (3 minutes)
export SECRET=ocid1.vaultsecret.oc1..xxxx
oci vault secret get --secret-id $SECRET \
--query 'data.{name:"secret-name", state:"lifecycle-state", current:"current-version-number", deletion:"time-of-deletion"}' \
--output table
oci vault secret-version list --secret-id $SECRET --all \
--query 'data[].{v:"version-number", stages:stages, created:"time-created", deletion:"time-of-deletion"}' \
--output table
You now know the current version, when it was created, and which version is PREVIOUS. If lifecycle-state is PENDING_DELETION, someone scheduled the whole secret for deletion: go to step 4 first.
Find who made the change:
oci logging-search search-logs \
--search-query 'search "<compartment_ocid>/_Audit" | where data.resourceId = '"'$SECRET'"' | sort by datetime desc' \
--time-start $(date -u -d '-24 hours' +%Y-%m-%dT%H:%M:%SZ) \
--time-end $(date -u +%Y-%m-%dT%H:%M:%SZ) \
--query 'data.results[].data.{time:datetime, event:data.eventName, who:data.identity.principalName}'
2. Work out which half is wrong
Read both versions without printing them to a shared terminal log:
oci secrets secret-bundle get --secret-id $SECRET --stage CURRENT \
--query 'data."secret-bundle-content".content' --raw-output | base64 -d > /dev/shm/cur
oci secrets secret-bundle get --secret-id $SECRET --stage PREVIOUS \
--query 'data."secret-bundle-content".content' --raw-output | base64 -d > /dev/shm/prev
Test each value against the target system. For an Oracle database user:
sqlplus -L app_user/"$(cat /dev/shm/cur)"@orders_high <<< "select 1 from dual;"
sqlplus -L app_user/"$(cat /dev/shm/prev)"@orders_high <<< "select 1 from dual;"
shred -u /dev/shm/cur /dev/shm/prev
| Current works | Previous works | Meaning | Action |
|---|---|---|---|
| No | Yes | Vault was updated, target was not | Roll back the secret (step 3a) or finish the target change |
| Yes | No | Rotation completed; apps still hold the old value | Restart consumers (step 3b) |
| No | No | Target changed to a third value, or the account is locked | Reset the target credential and write it as a new version (step 3c) |
| Yes | Yes | Credentials are fine | Not a secret problem: check network, account lock, permissions |
Warning
Repeated failed logins can lock the account (
ORA-28000on Oracle, lockout policies on directories). Scale failing consumers down or stop retry storms before testing, or you will turn a rotation problem into a lockout.
3. The fix
3a. Roll back to the previous version
If the target still uses the old credential, make the previous version current again. This is a metadata change and takes effect immediately for new reads:
oci vault secret update --secret-id $SECRET --current-version-number 7
Use the version number from step 1. You cannot change the current version, the contents and the rules in the same call, and the secret must be ACTIVE.
If a scheduled rotation caused the problem, disable it in the console (Secret > Edit rotation) before it runs again, so it does not repeat while you investigate.
3b. Restart consumers so they pick up the current value
# Kubernetes with the Secrets Store CSI driver or an operator syncing Vault secrets
kubectl -n orders rollout restart deploy/orders-api
kubectl -n orders rollout status deploy/orders-api --timeout=5m
For instances that read the secret at boot, use Run Command or your configuration tool to restart the service across the fleet rather than SSH host by host.
3c. Reset the target and write a new version
Set a new password on the target (for example ALTER USER app_user IDENTIFIED BY "<new>" ACCOUNT UNLOCK; on Oracle), then store exactly that value:
printf '%s' "$NEW_PW" | base64 -w0 > /dev/shm/new.b64
oci vault secret update-base64 --secret-id $SECRET \
--secret-content-content "$(cat /dev/shm/new.b64)"
shred -u /dev/shm/new.b64
Then restart consumers as in 3b.
Caution
Do not paste secret values into incident chat, tickets or shell history. Use
printffrom a variable or a file in memory, and clearHISTFILEfor the session if you must type a value.
4. If the secret or a version is scheduled for deletion
# Whole secret in PENDING_DELETION
oci vault secret cancel-secret-deletion --secret-id $SECRET
# A single version scheduled for deletion
oci vault secret-version cancel-secret-version-deletion \
--secret-id $SECRET --secret-version-number 7
Cancel only works before the deletion date. After that, the value is gone: reset the target credential and create a new version as in 3c.
5. Verify recovery
oci vault secret getshows the expectedcurrent-version-numberand stateACTIVE.- Application logs no longer show authentication errors; connection pools are full.
- Database or API side: successful logins from the application account, and no account lock.
Communicate
Tell users: "
Prevent it next time
- Rotate with a dual-credential pattern where the target supports it (two database users or two API keys), so the old value keeps working until every consumer has the new one.
- For database credentials, use Vault's managed rotation for supported targets instead of uploading values by hand, so the target and the secret change together.
- Have applications re-read secrets on authentication failure, instead of only at start.
- Alarm on authentication failures in application logs, and on Vault events for secret updates in production compartments.
- Restrict
manage secret-familyin production to the rotation automation and a break-glass group.
Get the weekly HubDatAI email
One email a week with everything new: posts, learning sessions and videos. Free, no spam, unsubscribe in one click. What you get