In this guide, you’ll enable and configure the Consul ACL system to secure your service mesh. By default, Consul ACLs are disabled. We’ll update the agent configuration on both server nodes, restart the agents, verify cluster membership, and bootstrap the ACL subsystem.Documentation Index
Fetch the complete documentation index at: https://notes.kodekloud.com/llms.txt
Use this file to discover all available pages before exploring further.
Consul ACLs are disabled out of the box. Enabling them enforces access control for API requests, service registrations, and key/value operations.
Prerequisites
- Two Consul server nodes:
- consul-node-a (10.0.101.110)
- consul-node-b (10.0.101.248)
- SSH access to each node
- Consul 1.9+ installed and running without ACLs
| Resource | Details |
|---|---|
| Consul version | ≥ 1.9.0 (Enterprise or OSS) |
| Configuration file | /etc/consul.d/config.hcl |
| Data directory | /etc/consul.d/data |
| Consul datacenter | us-east-1 |
1. Update Configuration on consul-node-a
- SSH into consul-node-a:
- Backup and open the Consul HCL file:
- Append or update the following stanzas:
- Save and exit (
:wq). - Restart the Consul agent:
2. Update Configuration on consul-node-b
Repeat on consul-node-b:- SSH into consul-node-b:
- Edit the configuration:
- Ensure the file matches this configuration (update bind and advertise addresses):
- Save and restart:
3. Verify Cluster Membership
On either server, confirm both nodes are alive:If a node isn’t listed as
alive, check logs with journalctl -u consul and verify network connectivity.4. Bootstrap the ACL System
Bootstrap the ACL subsystem to generate your initial management token:- AccessorID: token identifier
- SecretID: the token for CLI/API authentication
- Policies: grants
global-managementprivileges
default_policy = "allow", you can still run commands like consul members without specifying -token. If you switch to default_policy = "deny", every request will require a valid token.
Store the SecretID securely. Losing it may lock you out of ACL management. Consider rotating tokens after bootstrapping.
Next Steps
- Create fine-grained policies to restrict access by service or path.
- Generate scoped tokens for applications, operators, and CI/CD pipelines.
- Practice authenticating with ACL tokens:
- Integrate Consul ACLs with Terraform or Vault for automated policy management.