Ravindra BagaleCourses & study guides मराठी

Chapter 94: HashiCorp Vault and Secrets Management

DevOps

94.11 Dynamic secrets and leases — not KV expiry

Story (fictional teaching scenario). At a fictional Hyderabad school app, Fatima from Cairo studies how one short-lived database user per job differs from copying the same stored password.

Dynamic secrets and leases — not KV expiry
Dynamic secrets and leases — not KV expiry

Why

The credential can be tied to one consumer and a revocation lifecycle, but only if the provider integration is configured and working.

What

  • Dynamic secrets engine generates credentials through a configured provider, such as a database.
  • Lease tracks validity and renewability for generated credentials.
  • Lease ID identifies a generated secret’s lifecycle, not its password.
  • Renew requests a fresh remaining duration from now; the requested increment is advisory.
  • KV stores arbitrary values and does NOT issue leases for those stored secrets.

How

  1. Design provider roles and least privilege before enabling an integration.

  2. Make clients renew or replace credentials before expiry.

  3. Monitor revocation failures; a disconnected provider complicates cleanup.

  4. Do not claim a KV TTL automatically disables a password in an external database.

Example 1: Dynamic response shape, values omitted

  1. Read the command or request.
GET /v1/database/creds/training-readonly
  1. Read the result.

Output (illustrative; NOT executed against Vault)

{"lease_id":"database/creds/training-readonly/DEMO","lease_duration":300,"renewable":true,"data":"CREDENTIALS OMITTED"}
  1. Line by line: The role name selects provider rules. The lease ID is used to manage validity. The generated username/password are intentionally absent here. No real database, account, credential or provider was created.

Example 2: Renewal increment from now

  1. Read the command or request.
At t=120 request increment300seconds
If accepted, remaining TTL becomes about300seconds
  1. Read the result.

Output (illustrative; NOT executed against Vault)

Not: add300seconds to the old expiry automatically.
  1. Line by line: The server/plugin may cap or ignore the requested increment. Always inspect the actual returned lease. Revocation asks the provider to invalidate generated credentials; operations must track failures instead of assuming success.

Ravindra Bagale's Tip

KV versions and dynamic-secret leases are different lifecycles.

Did you understand? Let us try it once more.