Ravindra BagaleCourses & study guides मराठी

Chapter 94: HashiCorp Vault and Secrets Management

DevOps

94.9 Tokens — TTL, renewal and revocation

Story (fictional teaching scenario). At a fictional Nagpur company, Arjun and Chloe from Paris stop using one permanent shared token for every process.

Tokens — TTL, renewal and revocation
Tokens — TTL, renewal and revocation

Why

A leaked short-lived scoped identity is less harmful than a permanent unrestricted one, but expiry needs client handling.

What

  • Token is an opaque authentication credential: do not parse its internal structure.
  • TTL is the remaining time-to-live.
  • Renewable means a token may request extension; policy and maximum lifetime still constrain it.
  • Revocation invalidates the token. Ordinary child token trees and associated leases can also be revoked; orphan and batch tokens differ.
  • A token accessor is a limited reference for management, not a login credential. Protect it too.

How

  1. Prefer short-lived least-privilege workload tokens.

  2. Inspect the returned TTL after renewal.

  3. Reauthenticate when renewal is no longer allowed.

  4. Treat root tokens as restricted bootstrap/emergency material, not application config.

Example 1: Look up only harmless properties

  1. Read the command or request.
vault token lookup -format=json
  1. Read the result.

Output (illustrative; NOT executed against Vault)

{"data":{"ttl":60,"renewable":true,"policies":["shop-read"]}}
  1. Line by line: This is a deliberately REDACTED illustrative subset. Actual output can include sensitive identity/token information, so do not record the full real response. TTL60 means about sixty seconds remain, not a promise of unlimited renewal.

Example 2: Renewal is bounded

  1. Read the command or request.
Issued at t=0, expires at t=60
At t=30 request another60seconds
Server permits expiry at t=90
  1. Read the result.

Output (illustrative; NOT executed against Vault)

Returned remaining TTL: 60 seconds in this example.
  1. Line by line: Renewal is subject to maximums and token type. A requested increment is not permission to exceed maximum lifetime. Periodic tokens have special renewal behaviour; do not generalize this example to every token.

Ravindra Bagale's Tip

Renewable is not permanent. Always handle expiry.

Did you understand? Let us try it once more.