This document covers Vault policies, tokens, and leases - together worth 30% of the exam (15% policies, 10% tokens, 5% leases). Understanding policy syntax, token types, and lease management is essential for the Vault Associate certification.
# Read and list KV secretspath"secret/data/my-app/*"{capabilities=["read", "list"]}# Full access to a specific pathpath"secret/data/my-app/config"{capabilities=["create", "read", "update", "delete", "list"]}# Deny access (overrides any other policy)path"secret/data/admin/*"{capabilities=["deny"]}# Transit encrypt/decrypt (uses update, not read/create)path"transit/encrypt/my-key"{capabilities=["update"]}path"transit/decrypt/my-key"{capabilities=["update"]}# Generate database credentialspath"database/creds/app-role"{capabilities=["read"]}# Manage auth methods (sudo required for sys/ paths)path"sys/auth/*"{capabilities=["create", "update", "delete", "sudo"]}
# Create token with TTL
vaulttokencreate-ttl=1h-policy=my-policy
# Renew token (extends TTL up to max_ttl)
vaulttokenrenew
vaulttokenrenew-increment=2h
# Token TTL lifecycle:# 1. Token created with TTL=1h, max_ttl=24h# 2. After 45 min, renewed: TTL resets to 1h# 3. Can keep renewing until max_ttl (24h total lifetime)# 4. After 24h from creation, token expires regardless of renewal
System max TTL (768h = 32 days)
βββ Auth method max TTL
βββ Role max TTL
βββ Token max TTL
βββ Token TTL (renewable up to max TTL)
Can look up token properties without the token itself
Can revoke a token using only its accessor
Used for audit logging (token ID is never logged)
Batch tokens do not have accessors
# List token accessors
vaultlistauth/token/accessors
# Lookup by accessor
vaulttokenlookup-accessor<accessor>
# Revoke by accessor
vaulttokenrevoke-accessor<accessor>
# Create periodic token (renewable indefinitely)
vaulttokencreate-period=24h-policy=my-policy
# Properties:# - Has a period instead of max TTL# - Can be renewed indefinitely as long as renewed within period# - Each renewal resets the TTL to the period value# - If not renewed within period, token expires
# List leases (by prefix)
vaultlistsys/leases/lookup/database/creds/app-role
# Lookup lease details
vaultleaselookup<lease_id>
# Renew a lease
vaultleaserenew<lease_id>
vaultleaserenew-increment=2h<lease_id>
# Revoke a specific lease
vaultleaserevoke<lease_id>
# Revoke all leases under a prefix
vaultleaserevoke-prefixdatabase/creds/app-role
# Force revoke (no cleanup, last resort)
vaultleaserevoke-force<lease_id>