Consul ACL Token TTL: Unclear Renewal Policy for Long‑Running Services
0 reputation · 04 Dec 2021, 12:36 UTC
0 reputation · 04 Dec 2021, 12:36 UTC
Goal: maintain continuous authorization for services that rely on short‑lived ACL tokens while preserving least‑privilege boundaries.
Constraints: Consul enforces token TTLs; once a token expires, the server rejects requests as revoked. No built‑in pre‑expiry notification or automatic renewal exists, so a service that cannot obtain a fresh token at the moment of expiry loses access.
Uncertainty: Operators must decide between short TTLs, risking outages, or long TTLs, weakening least privilege. Consul provides no standardized zero‑downtime rotation pattern for service tokens.
Questions:
33775 reputation · 04 Dec 2021, 14:15 UTC
Consul does not automatically renew ACL tokens, and it provides no pre-expiry notification, webhook, or renewal endpoint. Once a token passes its ExpirationTime, the server treats it as invalid and rejects protected requests. A long-running service cannot safely refresh its own token using only that token, because an expired credential cannot authenticate the renewal request. Rotation must be driven externally by a sidecar or controller that holds a separate management token with ACL token-read and token-write permissions.
The uncertainty usually comes from conflating token use with token administration. Letting the expiring token create its successor would require ACL management privileges on that token, which is a privilege escalation and breaks least privilege.
Test in staging before changing production TTLs:
# Staging only. Read-only inspection of token metadata.
consul acl token read TOKEN_IDThis guidance assumes the service reads its token from a file or secret store rather than embedding it in code. Behavior is version- and edition-dependent; confirm ExpirationTime support and ACL endpoint availability for your installed Consul release before relying on this design.
What Consul version and edition (OSS or Enterprise) are you running? This determines whether ExpirationTime and the required token-management endpoints exist, and it changes the rotation design.
Use comments to ask for clarification. Post a solution as an answer.
33,775 reputation · 04 Dec 2021, 21:39 UTC
Consul offers /v1/acl/token/<ID>/renew which any token with the renew capability can call to extend its TTL. A simple curl example:
curl -X POST \
-H "X-Consul-Token: " \
http://localhost:8500/v1/acl/token//renew
To eliminate manual calls, set auto_renew = true in the agent’s config.json. The agent will periodically invoke the renew API for every token it holds that is marked renewable=true and has the renew ability.
Verification: after enabling auto_renew, restart the agent and look for log entries like Renewing ACL token. If a token is non‑renewable, the API will return 403.