2019-05-01 21:11:23 +00:00
|
|
|
---
|
2020-09-01 15:14:13 +00:00
|
|
|
layout: commands
|
2020-04-07 18:55:19 +00:00
|
|
|
page_title: 'Commands: ACL Token'
|
2019-05-01 21:11:23 +00:00
|
|
|
---
|
|
|
|
|
|
|
|
# Consul ACL Tokens
|
|
|
|
|
|
|
|
Command: `consul acl token`
|
|
|
|
|
|
|
|
The `acl token` command is used to manage Consul's ACL tokens.
|
|
|
|
It exposes commands for creating, updating, reading, deleting, and listing tokens.
|
|
|
|
This command is available in Consul 1.4.0 and newer.
|
|
|
|
|
2020-04-09 23:46:54 +00:00
|
|
|
ACL tokens may also be managed via the [HTTP API](/api/acl/tokens).
|
2019-05-01 21:11:23 +00:00
|
|
|
|
|
|
|
-> **Note:** All of the example subcommands in this document will require a valid
|
2020-04-07 18:55:19 +00:00
|
|
|
Consul token with the appropriate permissions. Either set the
|
2019-05-01 21:11:23 +00:00
|
|
|
`CONSUL_HTTP_TOKEN` environment variable to the token's secret ID or pass the
|
|
|
|
secret ID as the value of the `-token` parameter.
|
|
|
|
|
|
|
|
## Usage
|
|
|
|
|
|
|
|
Usage: `consul acl token <subcommand>`
|
|
|
|
|
2020-04-07 18:55:19 +00:00
|
|
|
For the exact documentation for your Consul version, run `consul acl token -h` to view the complete list of subcommands.
|
2019-05-01 21:11:23 +00:00
|
|
|
|
|
|
|
```text
|
|
|
|
Usage: consul acl token <subcommand> [options] [args]
|
|
|
|
|
|
|
|
...
|
|
|
|
|
|
|
|
Subcommands:
|
|
|
|
clone Clone an ACL token
|
|
|
|
create Create an ACL token
|
|
|
|
delete Delete an ACL token
|
|
|
|
list List ACL tokens
|
|
|
|
read Read an ACL token
|
|
|
|
update Update an ACL token
|
|
|
|
```
|
|
|
|
|
|
|
|
For more information, examples, and usage about a subcommand, click on the name
|
|
|
|
of the subcommand in the sidebar.
|
|
|
|
|
|
|
|
## Identifying Tokens
|
|
|
|
|
|
|
|
Several of the subcommands need to operate on a specific token. Those
|
|
|
|
subcommands support specifying the token by its ID using the `-id` parameter.
|
|
|
|
|
|
|
|
The ID may be specified as a unique UUID prefix instead of the entire UUID. As
|
2019-05-23 00:22:11 +00:00
|
|
|
long as it is unique it will be resolved to the full UUID and used. Additionally
|
2019-05-01 21:11:23 +00:00
|
|
|
builtin token names will be accepted as the value of the `-id`.
|
|
|
|
|
|
|
|
Builtin Tokens:
|
|
|
|
|
2020-04-07 18:55:19 +00:00
|
|
|
| Token UUID | Token Name |
|
|
|
|
| ------------------------------------ | ---------- |
|
|
|
|
| 00000000-0000-0000-0000-000000000002 | anonymous |
|
2019-05-01 21:11:23 +00:00
|
|
|
|
|
|
|
## Basic Examples
|
|
|
|
|
|
|
|
Create a new ACL token:
|
|
|
|
|
2020-05-19 18:32:38 +00:00
|
|
|
```shell-session
|
2019-05-01 21:11:23 +00:00
|
|
|
$ consul acl token create \
|
|
|
|
-description "This is an example token" \
|
|
|
|
-policy-id 06acc965
|
|
|
|
```
|
|
|
|
|
|
|
|
List all tokens:
|
|
|
|
|
2020-05-19 18:32:38 +00:00
|
|
|
```shell-session
|
2019-05-01 21:11:23 +00:00
|
|
|
$ consul acl token list
|
|
|
|
```
|
|
|
|
|
|
|
|
Update a token:
|
|
|
|
|
2020-05-19 18:32:38 +00:00
|
|
|
```shell-session
|
2019-05-01 21:11:23 +00:00
|
|
|
$ consul acl token update -id 986193 -description "WonderToken"
|
|
|
|
```
|
|
|
|
|
|
|
|
Read a token with an accessor ID:
|
|
|
|
|
2020-05-19 18:32:38 +00:00
|
|
|
```shell-session
|
2019-05-01 21:11:23 +00:00
|
|
|
$ consul acl token read -id 986193
|
|
|
|
```
|
|
|
|
|
|
|
|
Delete a token
|
|
|
|
|
2020-05-19 18:32:38 +00:00
|
|
|
```shell-session
|
2019-05-01 21:11:23 +00:00
|
|
|
$ consul acl token delete -id 986193
|
|
|
|
```
|