2018-10-24 14:24:29 +00:00
|
|
|
---
|
2020-09-01 15:14:13 +00:00
|
|
|
layout: commands
|
2020-04-07 18:55:19 +00:00
|
|
|
page_title: 'Commands: ACL Translate Rules'
|
2018-10-24 14:24:29 +00:00
|
|
|
---
|
|
|
|
|
|
|
|
-> **Deprecated:** This command exists only as a convenience to make legacy ACL migration easier.
|
|
|
|
It will be removed in a future major release when support for the legacy ACL system is removed.
|
|
|
|
|
|
|
|
# Consul ACL Translate Rules
|
|
|
|
|
|
|
|
Command: `consul acl translate-rules`
|
|
|
|
|
2022-01-11 13:26:58 +00:00
|
|
|
Corresponding HTTP API Endpoint: [\[GET\] /v1/acl/rules/translate/:accessor_id](/api-docs/acl#translate-a-legacy-token-s-rules)
|
2022-01-10 17:40:11 +00:00
|
|
|
|
2018-10-24 14:24:29 +00:00
|
|
|
This command translates the legacy ACL rule syntax into the new syntax.
|
|
|
|
|
2022-10-18 19:49:07 +00:00
|
|
|
The table below shows this command's [required ACLs](/api-docs/api-structure#authentication). Configuration of
|
2022-03-30 21:16:26 +00:00
|
|
|
[blocking queries](/api-docs/features/blocking) and [agent caching](/api-docs/features/caching)
|
2022-01-10 21:44:56 +00:00
|
|
|
are not supported from commands, but may be from the corresponding HTTP endpoint.
|
|
|
|
|
|
|
|
| ACL Required |
|
|
|
|
| ------------ |
|
|
|
|
| `acl:read` |
|
|
|
|
|
2018-10-24 14:24:29 +00:00
|
|
|
### Usage
|
|
|
|
|
2020-08-21 14:47:05 +00:00
|
|
|
Usage: `consul acl translate-rules [options] TRANSLATE`
|
2018-10-24 14:24:29 +00:00
|
|
|
|
|
|
|
#### Command Options
|
|
|
|
|
2020-04-07 18:55:19 +00:00
|
|
|
- `TRANSLATE` - The rules to translate. If `-` is used, then
|
|
|
|
the rules will be read from stdin. If `@` is prefixed to
|
|
|
|
the value then the value is considered to be a file and
|
|
|
|
the rules will be read from that file.
|
2018-10-24 14:24:29 +00:00
|
|
|
|
2020-04-07 18:55:19 +00:00
|
|
|
- `-token-secret` - Specifies that what the `TRANSLATE` argument
|
|
|
|
holds is not a rule set but rather the token secret ID of a
|
|
|
|
legacy ACL token that holds the rule set.
|
2018-10-24 14:24:29 +00:00
|
|
|
|
2020-04-07 18:55:19 +00:00
|
|
|
- `-token-accessor` - Specifies that what the `TRANSLATE` argument
|
|
|
|
holds is not a rule set but rather the token accessor ID of a
|
|
|
|
legacy ACL token that holds the rule set.
|
2018-10-24 14:24:29 +00:00
|
|
|
|
2022-07-27 06:17:11 +00:00
|
|
|
#### API Options
|
|
|
|
|
|
|
|
@include 'http_api_options_client.mdx'
|
|
|
|
|
|
|
|
@include 'http_api_options_server.mdx'
|
|
|
|
|
2018-10-24 14:24:29 +00:00
|
|
|
### Examples
|
2020-04-07 18:55:19 +00:00
|
|
|
|
2018-10-24 14:24:29 +00:00
|
|
|
Translate rules within a file:
|
|
|
|
|
2020-05-19 18:32:38 +00:00
|
|
|
```shell-session
|
2018-10-24 14:24:29 +00:00
|
|
|
$ consul acl translate-rules @rules.hcl
|
|
|
|
```
|
|
|
|
|
|
|
|
Translate rules from stdin:
|
|
|
|
|
2020-05-19 18:32:38 +00:00
|
|
|
```shell-session
|
2018-10-24 14:24:29 +00:00
|
|
|
$ consul acl translate-rules -
|
|
|
|
```
|
|
|
|
|
|
|
|
Translate rules from a string argument:
|
|
|
|
|
2020-05-19 18:32:38 +00:00
|
|
|
```shell-session
|
2018-10-24 14:24:29 +00:00
|
|
|
$ consul acl translate-rules 'key "" { policy = "write"}'
|
|
|
|
```
|
|
|
|
|
|
|
|
Translate rules for a legacy ACL token using its SecretID passed from stdin:
|
|
|
|
|
2020-05-19 18:32:38 +00:00
|
|
|
```shell-session
|
2018-10-24 14:24:29 +00:00
|
|
|
$ consul acl translate-rules --token-secret -
|
|
|
|
```
|
|
|
|
|
|
|
|
Translate rules for a legacy ACL token using its AccessorID:
|
|
|
|
|
2020-05-19 18:32:38 +00:00
|
|
|
```shell-session
|
2018-10-24 14:24:29 +00:00
|
|
|
$ consul acl translate-rules 429cd746-03d5-4bbb-a83a-18b164171c89
|
|
|
|
```
|