github.com/outbrain/consul@v1.4.5/website/source/docs/commands/acl.html.md (about) 1 --- 2 layout: "docs" 3 page_title: "Commands: ACL" 4 sidebar_current: "docs-commands-acl" 5 --- 6 7 # Consul ACLs 8 9 Command: `consul acl` 10 11 The `acl` command is used to interact with Consul's ACLs via the command 12 line. It exposes top-level commands for bootstrapping the ACL system, 13 managing tokens and policies, translating legacy rules, and setting the 14 tokens for use by an agent. 15 16 ACLs are also accessible via the [HTTP API](/api/acl/acl.html). 17 18 19 Bootstrap Consul's ACLs: 20 21 ```sh 22 $ consul acl bootstrap 23 AccessorID: 4d123dff-f460-73c3-02c4-8dd64d136e01 24 SecretID: 86cddfb9-2760-d947-358d-a2811156bf31 25 Description: Bootstrap Token (Global Management) 26 Local: false 27 Create Time: 2018-10-22 11:27:04.479026 -0400 EDT 28 Policies: 29 00000000-0000-0000-0000-000000000001 - global-management 30 ``` 31 32 Create a policy: 33 34 ```sh 35 $ consul acl policy create -name "acl-replication" -description "Token capable of replicating ACL policies" -rules 'acl = "read"' 36 ID: 35b8ecb0-707c-ee18-2002-81b238b54b38 37 Name: acl-replication 38 Description: Token capable of replicating ACL policies 39 Datacenters: 40 Rules: 41 acl = "read" 42 ``` 43 44 Create a token: 45 46 ```sh 47 $ consul acl token create -description "Agent Policy Replication - my-agent" -policy-name "acl-replication" 48 AccessorID: c24c11aa-4e08-e25c-1a67-705a2e8d75a4 49 SecretID: e7024f9c-f016-02dd-6217-daedbffb86ac 50 Description: Agent Policy Replication - my-agent 51 Local: false 52 Create Time: 2018-10-22 11:34:49.960482 -0400 EDT 53 Policies: 54 35b8ecb0-707c-ee18-2002-81b238b54b38 - acl-replication 55 ``` 56 57 For more examples, ask for subcommand help or view the subcommand documentation 58 by clicking on one of the links in the sidebar. 59 60 ## Usage 61 62 Usage: `consul acl <subcommand>` 63 64 For the exact documentation for your Consul version, run `consul acl -h` to 65 view the complete list of subcommands. 66 67 ```text 68 Usage: consul acl <subcommand> [options] [args] 69 70 This command has subcommands for interacting with Consul's ACLs. 71 Here are some simple examples, and more detailed examples are available 72 in the subcommands or the documentation. 73 74 Bootstrap ACLs: 75 76 $ consul acl bootstrap 77 78 List all ACL Tokens: 79 80 $ consul acl token list 81 82 Create a new ACL Policy: 83 84 $ consul acl policy create -name "new-policy" \ 85 -description "This is an example policy" \ 86 -datacenter "dc1" \ 87 -datacenter "dc2" \ 88 -rules @rules.hcl 89 90 Set the default agent token: 91 92 $ consul acl set-agent-token default 0bc6bc46-f25e-4262-b2d9-ffbe1d96be6f 93 94 For more examples, ask for subcommand help or view the documentation. 95 96 Subcommands: 97 bootstrap Bootstrap Consul's ACL system 98 policy Manage Consul's ACL Policies 99 set-agent-token Interact with the Consul's ACLs 100 token Manage Consul's ACL Tokens 101 translate-rules Translate the legacy rule syntax into the current syntax 102 103 ``` 104 105 For more information, examples, and usage about a subcommand, click on the name 106 of the subcommand in the sidebar or one of the links below: