Table of Contents
- Creating a Token with a Policy
- Inspecting an Existing Token
- Testing Token Capabilities
- Writing Administrative Policies
- Links and References
Creating a Token with a Policy
To issue a new Vault token and bind it to one or more policies, run:Token Attributes
| Field | Description |
|---|---|
| token | The actual authentication token |
| token_accessor | Short-lived handle for revocation or lookup |
| token_duration | Time-to-live (TTL) for the token |
| token_renewable | Indicates if the token can be renewed |
| token_policies | List of attached policies (always includes default) |
| identity_policies | Attached identity group policies (if any) |
Every token in Vault inherits the
default policy. Always design your custom policies to grant only the permissions required for your application.Inspecting an Existing Token
To review the details and policies of an existing Vault token, use:Testing Token Capabilities
Before deploying a token in production, validate that it grants exactly the permissions you need. Suppose yourweb-app policy (web-app.hcl) should:
- Read a secret at
secret/data/api/key/google. - Generate AWS credentials from
aws/creds/s3-readonly.
Always test both allowed and denied operations. Overprovisioned policies can lead to security risks.
Writing Administrative Policies
Vault operators need permissions to manage core system paths undersys/. Below is an example HCL policy granting common operator capabilities:
Key Points
-
Capabilities
read,list,create,update,delete: Standard operations.sudo: Grants access to root-protected endpoints (use sparingly).
-
Least Privilege
Only include the paths and capabilities that each operator role truly requires.