acl

Command: consul acl

The acl command is used to interact with Consul’s ACLs via the command line. It exposes top-level commands for bootstrapping the ACL system, managing tokens and policies, translating legacy rules, and setting the tokens for use by an agent.

ACLs are also accessible via the HTTP API.

Bootstrap Consul’s ACLs:

  1. $ consul acl bootstrap
  2. AccessorID: 4d123dff-f460-73c3-02c4-8dd64d136e01
  3. SecretID: 86cddfb9-2760-d947-358d-a2811156bf31
  4. Description: Bootstrap Token (Global Management)
  5. Local: false
  6. Create Time: 2018-10-22 11:27:04.479026 -0400 EDT
  7. Policies:
  8. 00000000-0000-0000-0000-000000000001 - global-management

Create a policy:

  1. $ consul acl policy create -name "acl-replication" -description "Token capable of replicating ACL policies" -rules 'acl = "read"'
  2. ID: 35b8ecb0-707c-ee18-2002-81b238b54b38
  3. Name: acl-replication
  4. Description: Token capable of replicating ACL policies
  5. Datacenters:
  6. Rules:
  7. acl = "read"

Create a token:

  1. $ consul acl token create -description "Agent Policy Replication - my-agent" -policy-name "acl-replication"
  2. AccessorID: c24c11aa-4e08-e25c-1a67-705a2e8d75a4
  3. SecretID: e7024f9c-f016-02dd-6217-daedbffb86ac
  4. Description: Agent Policy Replication - my-agent
  5. Local: false
  6. Create Time: 2018-10-22 11:34:49.960482 -0400 EDT
  7. Policies:
  8. 35b8ecb0-707c-ee18-2002-81b238b54b38 - acl-replication

For more examples, ask for subcommand help or view the subcommand documentation by clicking on one of the links in the sidebar.

»Usage

Usage: consul acl <subcommand>

For the exact documentation for your Consul version, run consul acl -h to view the complete list of subcommands.

  1. Usage: consul acl <subcommand> [options] [args]
  2. This command has subcommands for interacting with Consul's ACLs.
  3. Here are some simple examples, and more detailed examples are available
  4. in the subcommands or the documentation.
  5. Bootstrap ACLs:
  6. $ consul acl bootstrap
  7. List all ACL Tokens:
  8. $ consul acl token list
  9. Create a new ACL Policy:
  10. $ consul acl policy create "new-policy" \
  11. -description "This is an example policy" \
  12. -datacenter "dc1" \
  13. -datacenter "dc2" \
  14. -rules @rules.hcl
  15. Set the default agent token:
  16. $ consul acl set-agent-token default 0bc6bc46-f25e-4262-b2d9-ffbe1d96be6f
  17. For more examples, ask for subcommand help or view the documentation.
  18. Subcommands:
  19. bootstrap Bootstrap Consul's ACL system
  20. policy Manage Consul's ACL Policies
  21. set-agent-token Interact with the Consul's ACLs
  22. token Manage Consul's ACL Tokens
  23. translate-rules Translate the legacy rule syntax into the current syntax

For more information, examples, and usage about a subcommand, click on the name of the subcommand in the sidebar or one of the links below: