2017-08-08 16:28:17 +00:00
|
|
|
|
---
|
2020-01-18 00:18:09 +00:00
|
|
|
|
layout: api
|
|
|
|
|
page_title: Token - Auth Methods - HTTP API
|
|
|
|
|
description: This is the API documentation for the Vault token auth method.
|
2017-08-08 16:28:17 +00:00
|
|
|
|
---
|
|
|
|
|
|
2017-09-13 01:48:52 +00:00
|
|
|
|
# Token Auth Method (API)
|
2017-08-08 16:28:17 +00:00
|
|
|
|
|
2017-09-13 01:48:52 +00:00
|
|
|
|
This is the API documentation for the Vault token auth method. For
|
|
|
|
|
general information about the usage and operation of the token method, please
|
2020-01-22 20:05:41 +00:00
|
|
|
|
see the [Vault Token method documentation](/docs/auth/token).
|
2017-08-08 16:28:17 +00:00
|
|
|
|
|
|
|
|
|
## List Accessors
|
|
|
|
|
|
2017-09-13 01:48:52 +00:00
|
|
|
|
This endpoint lists token accessor. This requires `sudo` capability, and access
|
2017-08-08 16:28:17 +00:00
|
|
|
|
to it should be tightly controlled as the accessors can be used to revoke very
|
|
|
|
|
large numbers of tokens and their associated leases at once.
|
|
|
|
|
|
2020-01-18 00:18:09 +00:00
|
|
|
|
| Method | Path |
|
|
|
|
|
| :----- | :---------------------- |
|
|
|
|
|
| `LIST` | `/auth/token/accessors` |
|
2017-08-08 16:28:17 +00:00
|
|
|
|
|
|
|
|
|
### Sample Request
|
|
|
|
|
|
2020-05-21 17:18:17 +00:00
|
|
|
|
```shell-session
|
2017-08-08 16:28:17 +00:00
|
|
|
|
$ curl \
|
|
|
|
|
--header "X-Vault-Token: ..." \
|
|
|
|
|
--request LIST \
|
2018-03-23 15:41:51 +00:00
|
|
|
|
http://127.0.0.1:8200/v1/auth/token/accessors
|
2017-08-08 16:28:17 +00:00
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
### Sample Response
|
|
|
|
|
|
|
|
|
|
```json
|
|
|
|
|
{
|
|
|
|
|
"auth": null,
|
|
|
|
|
"warnings": null,
|
|
|
|
|
"wrap_info": null,
|
|
|
|
|
"data": {
|
|
|
|
|
"keys": [
|
|
|
|
|
"476ea048-ded5-4d07-eeea-938c6b4e43ec",
|
|
|
|
|
"bb00c093-b7d3-b0e9-69cc-c4d85081165b"
|
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
"lease_duration": 0,
|
|
|
|
|
"renewable": false,
|
|
|
|
|
"lease_id": ""
|
|
|
|
|
}
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
## Create Token
|
|
|
|
|
|
|
|
|
|
Creates a new token. Certain options are only available when called by a
|
|
|
|
|
root token. If used via the `/auth/token/create-orphan` endpoint, a root
|
|
|
|
|
token is not required to create an orphan token (otherwise set with the
|
|
|
|
|
`no_parent` option). If used with a role name in the path, the token will
|
|
|
|
|
be created against the specified role name; this may override options set
|
|
|
|
|
during this call.
|
|
|
|
|
|
2020-01-18 00:18:09 +00:00
|
|
|
|
| Method | Path |
|
|
|
|
|
| :----- | :------------------------------ |
|
|
|
|
|
| `POST` | `/auth/token/create` |
|
|
|
|
|
| `POST` | `/auth/token/create-orphan` |
|
|
|
|
|
| `POST` | `/auth/token/create/:role_name` |
|
2017-08-08 16:28:17 +00:00
|
|
|
|
|
|
|
|
|
### Parameters
|
|
|
|
|
|
2017-09-13 01:48:52 +00:00
|
|
|
|
- `id` `(string: "")` – The ID of the client token. Can only be specified by a
|
2020-04-27 16:39:33 +00:00
|
|
|
|
root token. The ID provided may not contain a `.` character. Otherwise, the
|
|
|
|
|
token ID is a randomly generated value.
|
2020-06-29 16:20:23 +00:00
|
|
|
|
|
|
|
|
|
_Note:_ The ID should not start with the `s.` prefix.
|
2020-12-17 21:53:33 +00:00
|
|
|
|
|
2017-08-08 16:28:17 +00:00
|
|
|
|
- `role_name` `(string: "")` – The name of the token role.
|
2017-09-13 01:48:52 +00:00
|
|
|
|
- `policies` `(array: "")` – A list of policies for the token. This must be a
|
2021-09-21 15:25:06 +00:00
|
|
|
|
subset of the policies belonging to the token making the request, unless
|
2021-07-15 22:13:58 +00:00
|
|
|
|
the calling token is root or contains `sudo` capabilities to `auth/token/create`.
|
2017-08-08 16:28:17 +00:00
|
|
|
|
If not specified, defaults to all the policies of the calling token.
|
2017-09-13 01:48:52 +00:00
|
|
|
|
- `meta` `(map: {})` – A map of string to string valued metadata. This is
|
|
|
|
|
passed through to the audit devices.
|
2020-04-13 17:03:05 +00:00
|
|
|
|
- `no_parent` `(bool: false)` - This argument only has effect if used by a root
|
|
|
|
|
or sudo caller. When set to true, the token created will not have a parent.
|
2017-09-13 01:48:52 +00:00
|
|
|
|
- `no_default_policy` `(bool: false)` - If true the `default` policy will not be
|
2017-08-08 16:28:17 +00:00
|
|
|
|
contained in this token's policy set.
|
|
|
|
|
- `renewable` `(bool: true)` - Set to `false` to disable the ability of the token
|
2020-01-18 00:18:09 +00:00
|
|
|
|
to be renewed past its initial TTL. Setting the value to `true` will allow
|
2017-08-08 16:28:17 +00:00
|
|
|
|
the token to be renewable up to the system/mount maximum TTL.
|
|
|
|
|
- `lease` `(string: "")` - DEPRECATED; use `ttl` instead
|
2019-04-22 19:15:21 +00:00
|
|
|
|
- `ttl` `(string: "")` - The TTL period of the token, provided as "1h", where
|
2017-08-08 16:28:17 +00:00
|
|
|
|
hour is the largest suffix. If not provided, the token is valid for the
|
2020-01-22 20:05:41 +00:00
|
|
|
|
[default lease TTL](/docs/configuration), or indefinitely if the
|
2017-08-08 16:28:17 +00:00
|
|
|
|
root policy is used.
|
2019-04-22 19:15:21 +00:00
|
|
|
|
- `type` `(string: "")` - The token type. Can be "batch" or "service". Defaults
|
|
|
|
|
to the type specified by the role configuration named by `role_name`.
|
2017-09-13 01:48:52 +00:00
|
|
|
|
- `explicit_max_ttl` `(string: "")` - If set, the token will have an explicit
|
2020-01-18 00:18:09 +00:00
|
|
|
|
max TTL set upon it. This maximum token TTL _cannot_ be changed later, and
|
2017-09-13 01:48:52 +00:00
|
|
|
|
unlike with normal tokens, updates to the system/mount max TTL value will
|
|
|
|
|
have no effect at renewal time -- the token will never be able to be renewed
|
|
|
|
|
or used past the value set at issue time.
|
2017-08-08 16:28:17 +00:00
|
|
|
|
- `display_name` `(string: "token")` - The display name of the token.
|
2017-09-13 01:48:52 +00:00
|
|
|
|
- `num_uses` `(integer: 0)` - The maximum uses for the given token. This can be
|
|
|
|
|
used to create a one-time-token or limited use token. The value of 0 has no
|
2017-08-08 16:28:17 +00:00
|
|
|
|
limit to the number of uses.
|
2017-09-13 01:48:52 +00:00
|
|
|
|
- `period` `(string: "")` - If specified, the token will be periodic; it will have
|
|
|
|
|
no maximum TTL (unless an "explicit-max-ttl" is also set) but every renewal
|
2020-04-13 17:03:05 +00:00
|
|
|
|
will use the given period. Requires a root token or one with the sudo capability.
|
2020-01-18 00:18:09 +00:00
|
|
|
|
- `entity_alias` `(string: "")` - Name of the entity alias to associate with
|
|
|
|
|
during token creation. Only works in combination with `role_name` argument
|
|
|
|
|
and used entity alias must be listed in `allowed_entity_aliases`. If this has
|
|
|
|
|
been specified, the entity will not be inherited from the parent.
|
2017-08-08 16:28:17 +00:00
|
|
|
|
|
|
|
|
|
### Sample Payload
|
|
|
|
|
|
|
|
|
|
```json
|
|
|
|
|
{
|
2020-01-18 00:18:09 +00:00
|
|
|
|
"policies": ["web", "stage"],
|
2019-07-05 22:38:37 +00:00
|
|
|
|
"meta": {
|
2017-08-08 16:28:17 +00:00
|
|
|
|
"user": "armon"
|
|
|
|
|
},
|
|
|
|
|
"ttl": "1h",
|
|
|
|
|
"renewable": true
|
|
|
|
|
}
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
### Sample Request
|
|
|
|
|
|
2020-05-21 17:18:17 +00:00
|
|
|
|
```shell-session
|
2017-08-08 16:28:17 +00:00
|
|
|
|
$ curl \
|
|
|
|
|
--header "X-Vault-Token: ..." \
|
|
|
|
|
--request POST \
|
|
|
|
|
--data @payload.json \
|
2018-03-23 15:41:51 +00:00
|
|
|
|
http://127.0.0.1:8200/v1/auth/token/create
|
2017-08-08 16:28:17 +00:00
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
### Sample Response
|
|
|
|
|
|
|
|
|
|
```json
|
|
|
|
|
{
|
2019-07-05 22:38:37 +00:00
|
|
|
|
"request_id": "f00341c1-fad5-f6e6-13fd-235617f858a1",
|
|
|
|
|
"lease_id": "",
|
|
|
|
|
"renewable": false,
|
|
|
|
|
"lease_duration": 0,
|
|
|
|
|
"data": null,
|
|
|
|
|
"wrap_info": null,
|
|
|
|
|
"warnings": [
|
|
|
|
|
"Policy \"stage\" does not exist",
|
|
|
|
|
"Policy \"web\" does not exist"
|
|
|
|
|
],
|
2017-08-08 16:28:17 +00:00
|
|
|
|
"auth": {
|
2019-07-05 22:38:37 +00:00
|
|
|
|
"client_token": "s.wOrq9dO9kzOcuvB06CMviJhZ",
|
|
|
|
|
"accessor": "B6oixijqmeR4bsLOJH88Ska9",
|
2020-01-18 00:18:09 +00:00
|
|
|
|
"policies": ["default", "stage", "web"],
|
|
|
|
|
"token_policies": ["default", "stage", "web"],
|
2017-08-08 16:28:17 +00:00
|
|
|
|
"metadata": {
|
|
|
|
|
"user": "armon"
|
|
|
|
|
},
|
|
|
|
|
"lease_duration": 3600,
|
2019-07-05 22:38:37 +00:00
|
|
|
|
"renewable": true,
|
|
|
|
|
"entity_id": "",
|
|
|
|
|
"token_type": "service",
|
|
|
|
|
"orphan": false
|
2017-08-08 16:28:17 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
## Lookup a Token
|
|
|
|
|
|
|
|
|
|
Returns information about the client token.
|
|
|
|
|
|
2020-01-18 00:18:09 +00:00
|
|
|
|
| Method | Path |
|
|
|
|
|
| :----- | :------------------- |
|
|
|
|
|
| `POST` | `/auth/token/lookup` |
|
2017-08-08 16:28:17 +00:00
|
|
|
|
|
|
|
|
|
### Parameters
|
|
|
|
|
|
|
|
|
|
- `token` `(string: <required>)` - Token to lookup.
|
|
|
|
|
|
|
|
|
|
### Sample Payload
|
|
|
|
|
|
|
|
|
|
```json
|
|
|
|
|
{
|
|
|
|
|
"token": "ClientToken"
|
|
|
|
|
}
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
### Sample Request
|
|
|
|
|
|
2020-05-21 17:18:17 +00:00
|
|
|
|
```shell-session
|
2017-08-08 16:28:17 +00:00
|
|
|
|
$ curl \
|
|
|
|
|
--header "X-Vault-Token: ..." \
|
|
|
|
|
--request POST \
|
|
|
|
|
--data @payload.json \
|
2018-03-23 15:41:51 +00:00
|
|
|
|
http://127.0.0.1:8200/v1/auth/token/lookup
|
2017-08-08 16:28:17 +00:00
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
### Sample Response
|
|
|
|
|
|
|
|
|
|
```json
|
|
|
|
|
{
|
|
|
|
|
"data": {
|
2018-04-17 15:40:00 +00:00
|
|
|
|
"accessor": "8609694a-cdbc-db9b-d345-e782dbb562ed",
|
|
|
|
|
"creation_time": 1523979354,
|
|
|
|
|
"creation_ttl": 2764800,
|
|
|
|
|
"display_name": "ldap2-tesla",
|
|
|
|
|
"entity_id": "7d2e3179-f69b-450c-7179-ac8ee8bd8ca9",
|
|
|
|
|
"expire_time": "2018-05-19T11:35:54.466476215-04:00",
|
|
|
|
|
"explicit_max_ttl": 0,
|
|
|
|
|
"id": "cf64a70f-3a12-3f6c-791d-6cef6d390eed",
|
2020-01-18 00:18:09 +00:00
|
|
|
|
"identity_policies": ["dev-group-policy"],
|
2018-04-17 15:40:00 +00:00
|
|
|
|
"issue_time": "2018-04-17T11:35:54.466476078-04:00",
|
2017-08-08 16:28:17 +00:00
|
|
|
|
"meta": {
|
2018-04-17 15:40:00 +00:00
|
|
|
|
"username": "tesla"
|
2017-08-08 16:28:17 +00:00
|
|
|
|
},
|
2018-04-17 15:40:00 +00:00
|
|
|
|
"num_uses": 0,
|
|
|
|
|
"orphan": true,
|
|
|
|
|
"path": "auth/ldap2/login/tesla",
|
2020-01-18 00:18:09 +00:00
|
|
|
|
"policies": ["default", "testgroup2-policy"],
|
2018-04-17 15:40:00 +00:00
|
|
|
|
"renewable": true,
|
|
|
|
|
"ttl": 2764790
|
2017-08-08 16:28:17 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
## Lookup a Token (Self)
|
|
|
|
|
|
|
|
|
|
Returns information about the current client token.
|
|
|
|
|
|
2020-01-18 00:18:09 +00:00
|
|
|
|
| Method | Path |
|
|
|
|
|
| :----- | :------------------------ |
|
|
|
|
|
| `GET` | `/auth/token/lookup-self` |
|
2017-08-08 16:28:17 +00:00
|
|
|
|
|
|
|
|
|
### Sample Request
|
|
|
|
|
|
2020-05-21 17:18:17 +00:00
|
|
|
|
```shell-session
|
2017-08-08 16:28:17 +00:00
|
|
|
|
$ curl \
|
|
|
|
|
--header "X-Vault-Token: ..." \
|
2018-03-23 15:41:51 +00:00
|
|
|
|
http://127.0.0.1:8200/v1/auth/token/lookup-self
|
2017-08-08 16:28:17 +00:00
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
### Sample Response
|
|
|
|
|
|
|
|
|
|
```json
|
|
|
|
|
{
|
|
|
|
|
"data": {
|
2018-04-17 15:40:00 +00:00
|
|
|
|
"accessor": "8609694a-cdbc-db9b-d345-e782dbb562ed",
|
|
|
|
|
"creation_time": 1523979354,
|
|
|
|
|
"creation_ttl": 2764800,
|
|
|
|
|
"display_name": "ldap2-tesla",
|
|
|
|
|
"entity_id": "7d2e3179-f69b-450c-7179-ac8ee8bd8ca9",
|
|
|
|
|
"expire_time": "2018-05-19T11:35:54.466476215-04:00",
|
|
|
|
|
"explicit_max_ttl": 0,
|
|
|
|
|
"id": "cf64a70f-3a12-3f6c-791d-6cef6d390eed",
|
2020-01-18 00:18:09 +00:00
|
|
|
|
"identity_policies": ["dev-group-policy"],
|
2018-04-17 15:40:00 +00:00
|
|
|
|
"issue_time": "2018-04-17T11:35:54.466476078-04:00",
|
2017-08-08 16:28:17 +00:00
|
|
|
|
"meta": {
|
2018-04-17 15:40:00 +00:00
|
|
|
|
"username": "tesla"
|
2017-08-08 16:28:17 +00:00
|
|
|
|
},
|
2018-04-17 15:40:00 +00:00
|
|
|
|
"num_uses": 0,
|
|
|
|
|
"orphan": true,
|
|
|
|
|
"path": "auth/ldap2/login/tesla",
|
2020-01-18 00:18:09 +00:00
|
|
|
|
"policies": ["default", "testgroup2-policy"],
|
2018-04-17 15:40:00 +00:00
|
|
|
|
"renewable": true,
|
|
|
|
|
"ttl": 2764790
|
2017-08-08 16:28:17 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
```
|
|
|
|
|
|
2019-11-08 16:32:01 +00:00
|
|
|
|
## Lookup a Token (Accessor)
|
2017-08-08 16:28:17 +00:00
|
|
|
|
|
|
|
|
|
Returns information about the client token from the accessor.
|
|
|
|
|
|
2020-01-18 00:18:09 +00:00
|
|
|
|
| Method | Path |
|
|
|
|
|
| :----- | :---------------------------- |
|
|
|
|
|
| `POST` | `/auth/token/lookup-accessor` |
|
2017-08-08 16:28:17 +00:00
|
|
|
|
|
|
|
|
|
### Parameters
|
|
|
|
|
|
|
|
|
|
- `accessor` `(string: <required>)` - Token accessor to lookup.
|
|
|
|
|
|
|
|
|
|
### Sample Payload
|
|
|
|
|
|
|
|
|
|
```json
|
|
|
|
|
{
|
2018-04-17 15:52:58 +00:00
|
|
|
|
"accessor": "8609694a-cdbc-db9b-d345-e782dbb562ed"
|
2017-08-08 16:28:17 +00:00
|
|
|
|
}
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
### Sample Request
|
|
|
|
|
|
2020-05-21 17:18:17 +00:00
|
|
|
|
```shell-session
|
2017-08-08 16:28:17 +00:00
|
|
|
|
$ curl \
|
|
|
|
|
--header "X-Vault-Token: ..." \
|
|
|
|
|
--request POST \
|
|
|
|
|
--data @payload.json \
|
2018-03-23 15:41:51 +00:00
|
|
|
|
http://127.0.0.1:8200/v1/auth/token/lookup-accessor
|
2017-08-08 16:28:17 +00:00
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
### Sample Response
|
|
|
|
|
|
|
|
|
|
```json
|
|
|
|
|
{
|
|
|
|
|
"data": {
|
2018-04-17 15:52:58 +00:00
|
|
|
|
"accessor": "8609694a-cdbc-db9b-d345-e782dbb562ed",
|
|
|
|
|
"creation_time": 1523979354,
|
2017-08-08 16:28:17 +00:00
|
|
|
|
"creation_ttl": 2764800,
|
2018-04-17 15:52:58 +00:00
|
|
|
|
"display_name": "ldap2-tesla",
|
|
|
|
|
"entity_id": "7d2e3179-f69b-450c-7179-ac8ee8bd8ca9",
|
|
|
|
|
"expire_time": "2018-05-19T11:35:54.466476215-04:00",
|
|
|
|
|
"explicit_max_ttl": 0,
|
|
|
|
|
"id": "",
|
2020-01-18 00:18:09 +00:00
|
|
|
|
"identity_policies": ["dev-group-policy"],
|
2018-04-17 15:52:58 +00:00
|
|
|
|
"issue_time": "2018-04-17T11:35:54.466476078-04:00",
|
|
|
|
|
"meta": {
|
|
|
|
|
"username": "tesla"
|
|
|
|
|
},
|
2017-08-08 16:28:17 +00:00
|
|
|
|
"num_uses": 0,
|
2018-04-17 15:52:58 +00:00
|
|
|
|
"orphan": true,
|
|
|
|
|
"path": "auth/ldap2/login/tesla",
|
2020-01-18 00:18:09 +00:00
|
|
|
|
"policies": ["default", "testgroup2-policy"],
|
2018-04-17 15:52:58 +00:00
|
|
|
|
"renewable": true,
|
|
|
|
|
"ttl": 2763902
|
|
|
|
|
}
|
2017-08-08 16:28:17 +00:00
|
|
|
|
}
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
## Renew a Token
|
|
|
|
|
|
2017-09-13 01:48:52 +00:00
|
|
|
|
Renews a lease associated with a token. This is used to prevent the expiration
|
|
|
|
|
of a token, and the automatic revocation of it. Token renewal is possible only
|
2017-08-08 16:28:17 +00:00
|
|
|
|
if there is a lease associated with it.
|
|
|
|
|
|
2020-01-18 00:18:09 +00:00
|
|
|
|
| Method | Path |
|
|
|
|
|
| :----- | :------------------ |
|
|
|
|
|
| `POST` | `/auth/token/renew` |
|
2017-08-08 16:28:17 +00:00
|
|
|
|
|
|
|
|
|
### Parameters
|
|
|
|
|
|
2017-09-13 01:48:52 +00:00
|
|
|
|
- `token` `(string: <required>)` - Token to renew. This can be part of the URL
|
2017-08-08 16:28:17 +00:00
|
|
|
|
or the body.
|
2021-09-16 23:54:46 +00:00
|
|
|
|
- `increment` `(string: "")` - An optional requested increment duration can be
|
2021-09-21 15:25:06 +00:00
|
|
|
|
provided. This increment may not be honored, for instance in the case of periodic tokens.
|
|
|
|
|
If not supplied, Vault will use the default TTL. This is specified as a numeric string
|
2021-09-16 23:54:46 +00:00
|
|
|
|
with suffix like "30s" or "5m".
|
2017-08-08 16:28:17 +00:00
|
|
|
|
|
|
|
|
|
### Sample Payload
|
|
|
|
|
|
|
|
|
|
```json
|
|
|
|
|
{
|
|
|
|
|
"token": "ClientToken"
|
|
|
|
|
}
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
### Sample Request
|
|
|
|
|
|
2020-05-21 17:18:17 +00:00
|
|
|
|
```shell-session
|
2017-08-08 16:28:17 +00:00
|
|
|
|
$ curl \
|
|
|
|
|
--header "X-Vault-Token: ..." \
|
|
|
|
|
--request POST \
|
|
|
|
|
--data @payload.json \
|
2018-03-23 15:41:51 +00:00
|
|
|
|
http://127.0.0.1:8200/v1/auth/token/renew
|
2017-08-08 16:28:17 +00:00
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
### Sample Response
|
|
|
|
|
|
|
|
|
|
```json
|
|
|
|
|
{
|
|
|
|
|
"auth": {
|
|
|
|
|
"client_token": "ABCD",
|
2020-01-18 00:18:09 +00:00
|
|
|
|
"policies": ["web", "stage"],
|
2017-08-08 16:28:17 +00:00
|
|
|
|
"metadata": {
|
|
|
|
|
"user": "armon"
|
|
|
|
|
},
|
|
|
|
|
"lease_duration": 3600,
|
2018-03-19 15:47:42 +00:00
|
|
|
|
"renewable": true
|
2017-08-08 16:28:17 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
## Renew a Token (Self)
|
|
|
|
|
|
2017-09-13 01:48:52 +00:00
|
|
|
|
Renews a lease associated with the calling token. This is used to prevent the
|
|
|
|
|
expiration of a token, and the automatic revocation of it. Token renewal is
|
2017-08-08 16:28:17 +00:00
|
|
|
|
possible only if there is a lease associated with it.
|
|
|
|
|
|
2020-01-18 00:18:09 +00:00
|
|
|
|
| Method | Path |
|
|
|
|
|
| :----- | :----------------------- |
|
|
|
|
|
| `POST` | `/auth/token/renew-self` |
|
2017-08-08 16:28:17 +00:00
|
|
|
|
|
|
|
|
|
### Parameters
|
|
|
|
|
|
2021-09-16 23:54:46 +00:00
|
|
|
|
- `increment` `(string: "")` - An optional requested increment duration can be
|
2021-09-21 15:25:06 +00:00
|
|
|
|
provided. This increment may not be honored, for instance in the case of periodic tokens.
|
|
|
|
|
If not supplied, Vault will use the default TTL. This is specified as a numeric string
|
2021-09-16 23:54:46 +00:00
|
|
|
|
with suffix like "30s" or "5m".
|
2017-08-08 16:28:17 +00:00
|
|
|
|
|
|
|
|
|
### Sample Payload
|
|
|
|
|
|
|
|
|
|
```json
|
|
|
|
|
{
|
|
|
|
|
"increment": "1h"
|
|
|
|
|
}
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
### Sample Request
|
|
|
|
|
|
2020-05-21 17:18:17 +00:00
|
|
|
|
```shell-session
|
2017-08-08 16:28:17 +00:00
|
|
|
|
$ curl \
|
|
|
|
|
--header "X-Vault-Token: ..." \
|
|
|
|
|
--request POST \
|
|
|
|
|
--data @payload.json \
|
2018-03-23 15:41:51 +00:00
|
|
|
|
http://127.0.0.1:8200/v1/auth/token/renew-self
|
2017-08-08 16:28:17 +00:00
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
### Sample Response
|
|
|
|
|
|
|
|
|
|
```json
|
|
|
|
|
{
|
|
|
|
|
"auth": {
|
|
|
|
|
"client_token": "ABCD",
|
2020-01-18 00:18:09 +00:00
|
|
|
|
"policies": ["web", "stage"],
|
2017-08-08 16:28:17 +00:00
|
|
|
|
"metadata": {
|
|
|
|
|
"user": "armon"
|
|
|
|
|
},
|
|
|
|
|
"lease_duration": 3600,
|
2018-03-19 15:47:42 +00:00
|
|
|
|
"renewable": true
|
2017-08-08 16:28:17 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
```
|
|
|
|
|
|
2019-11-08 16:32:01 +00:00
|
|
|
|
## Renew a Token (Accessor)
|
|
|
|
|
|
|
|
|
|
Renews a lease associated with a token using its accessor. This is used to
|
|
|
|
|
prevent the expiration of a token, and the automatic revocation of it. Token
|
|
|
|
|
renewal is possible only if there is a lease associated with it.
|
|
|
|
|
|
2020-01-18 00:18:09 +00:00
|
|
|
|
| Method | Path |
|
|
|
|
|
| :----- | :--------------------------- |
|
|
|
|
|
| `POST` | `/auth/token/renew-accessor` |
|
2019-11-08 16:32:01 +00:00
|
|
|
|
|
|
|
|
|
### Parameters
|
|
|
|
|
|
|
|
|
|
- `accessor` `(string: <required>)` - Accessor associated with the token to
|
2020-01-18 00:18:09 +00:00
|
|
|
|
renew.
|
2019-11-08 16:32:01 +00:00
|
|
|
|
- `increment` `(string: "")` - An optional requested lease increment can be
|
2020-01-18 00:18:09 +00:00
|
|
|
|
provided. This increment may be ignored.
|
2019-11-08 16:32:01 +00:00
|
|
|
|
|
|
|
|
|
### Sample Payload
|
|
|
|
|
|
|
|
|
|
```json
|
|
|
|
|
{
|
|
|
|
|
"accessor": "7JFKXuXKXa2D44YfDiovZ9aq"
|
|
|
|
|
}
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
### Sample Request
|
|
|
|
|
|
2020-05-21 17:18:17 +00:00
|
|
|
|
```shell-session
|
2019-11-08 16:32:01 +00:00
|
|
|
|
$ curl \
|
|
|
|
|
--header "X-Vault-Token: ..." \
|
|
|
|
|
--request POST \
|
|
|
|
|
--data @payload.json \
|
|
|
|
|
http://127.0.0.1:8200/v1/auth/token/renew-accessor
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
### Sample Response
|
|
|
|
|
|
|
|
|
|
```json
|
|
|
|
|
{
|
|
|
|
|
"auth": {
|
|
|
|
|
"client_token": "",
|
2020-01-18 00:18:09 +00:00
|
|
|
|
"policies": ["web", "stage"],
|
2019-11-08 16:32:01 +00:00
|
|
|
|
"metadata": {
|
|
|
|
|
"user": "armon"
|
|
|
|
|
},
|
|
|
|
|
"lease_duration": 3600,
|
|
|
|
|
"renewable": true
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
```
|
|
|
|
|
|
2017-08-08 16:28:17 +00:00
|
|
|
|
## Revoke a Token
|
|
|
|
|
|
2018-05-19 06:27:53 +00:00
|
|
|
|
Revokes a token and all child tokens. When the token is revoked, all dynamic secrets
|
2017-08-08 16:28:17 +00:00
|
|
|
|
generated with it are also revoked.
|
|
|
|
|
|
2020-01-18 00:18:09 +00:00
|
|
|
|
| Method | Path |
|
|
|
|
|
| :----- | :------------------- |
|
|
|
|
|
| `POST` | `/auth/token/revoke` |
|
2017-08-08 16:28:17 +00:00
|
|
|
|
|
|
|
|
|
### Parameters
|
|
|
|
|
|
|
|
|
|
- `token` `(string: <required>)` - Token to revoke.
|
|
|
|
|
|
|
|
|
|
### Sample Payload
|
|
|
|
|
|
|
|
|
|
```json
|
|
|
|
|
{
|
|
|
|
|
"token": "ClientToken"
|
|
|
|
|
}
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
### Sample Request
|
|
|
|
|
|
2020-05-21 17:18:17 +00:00
|
|
|
|
```shell-session
|
2017-08-08 16:28:17 +00:00
|
|
|
|
$ curl \
|
|
|
|
|
--header "X-Vault-Token: ..." \
|
|
|
|
|
--request POST \
|
|
|
|
|
--data @payload.json \
|
2018-03-23 15:41:51 +00:00
|
|
|
|
http://127.0.0.1:8200/v1/auth/token/revoke
|
2017-08-08 16:28:17 +00:00
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
## Revoke a Token (Self)
|
|
|
|
|
|
2017-09-13 01:48:52 +00:00
|
|
|
|
Revokes the token used to call it and all child tokens. When the token is
|
2017-08-08 16:28:17 +00:00
|
|
|
|
revoked, all dynamic secrets generated with it are also revoked.
|
|
|
|
|
|
2020-01-18 00:18:09 +00:00
|
|
|
|
| Method | Path |
|
|
|
|
|
| :----- | :------------------------ |
|
|
|
|
|
| `POST` | `/auth/token/revoke-self` |
|
2017-08-08 16:28:17 +00:00
|
|
|
|
|
|
|
|
|
### Sample Request
|
|
|
|
|
|
2020-05-21 17:18:17 +00:00
|
|
|
|
```shell-session
|
2017-08-08 16:28:17 +00:00
|
|
|
|
$ curl \
|
|
|
|
|
--header "X-Vault-Token: ..." \
|
|
|
|
|
--request POST \
|
2018-03-23 15:41:51 +00:00
|
|
|
|
http://127.0.0.1:8200/v1/auth/token/revoke-self
|
2017-08-08 16:28:17 +00:00
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
## Revoke a Token Accessor
|
|
|
|
|
|
2020-01-18 00:18:09 +00:00
|
|
|
|
Revoke the token associated with the accessor and all the child tokens. This is
|
2017-09-13 01:48:52 +00:00
|
|
|
|
meant for purposes where there is no access to token ID but there is need to
|
2017-08-08 16:28:17 +00:00
|
|
|
|
revoke a token and its children.
|
|
|
|
|
|
2020-01-18 00:18:09 +00:00
|
|
|
|
| Method | Path |
|
|
|
|
|
| :----- | :---------------------------- |
|
|
|
|
|
| `POST` | `/auth/token/revoke-accessor` |
|
2017-08-08 16:28:17 +00:00
|
|
|
|
|
|
|
|
|
### Parameters
|
|
|
|
|
|
|
|
|
|
- `accessor` `(string: <required>)` - Accessor of the token.
|
|
|
|
|
|
|
|
|
|
### Sample Payload
|
|
|
|
|
|
|
|
|
|
```json
|
|
|
|
|
{
|
|
|
|
|
"accessor": "2c84f488-2133-4ced-87b0-570f93a76830"
|
|
|
|
|
}
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
### Sample Request
|
|
|
|
|
|
2020-05-21 17:18:17 +00:00
|
|
|
|
```shell-session
|
2017-08-08 16:28:17 +00:00
|
|
|
|
$ curl \
|
|
|
|
|
--header "X-Vault-Token: ..." \
|
|
|
|
|
--request POST \
|
|
|
|
|
--data @payload.json \
|
2018-03-23 15:41:51 +00:00
|
|
|
|
http://127.0.0.1:8200/v1/auth/token/revoke-accessor
|
2017-08-08 16:28:17 +00:00
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
## Revoke Token and Orphan Children
|
|
|
|
|
|
|
|
|
|
Revokes a token but not its child tokens. When the token is revoked, all secrets
|
|
|
|
|
generated with it are also revoked. All child tokens are orphaned, but can be
|
|
|
|
|
revoked sub-sequently using `/auth/token/revoke/`. This is a root-protected
|
|
|
|
|
endpoint.
|
|
|
|
|
|
2020-01-18 00:18:09 +00:00
|
|
|
|
| Method | Path |
|
|
|
|
|
| :----- | :-------------------------- |
|
|
|
|
|
| `POST` | `/auth/token/revoke-orphan` |
|
2017-08-08 16:28:17 +00:00
|
|
|
|
|
|
|
|
|
### Parameters
|
|
|
|
|
|
2017-09-13 01:48:52 +00:00
|
|
|
|
- `token` `(string: <required>)` - Token to revoke. This can be part of the URL
|
2017-08-08 16:28:17 +00:00
|
|
|
|
or the body.
|
|
|
|
|
|
|
|
|
|
### Sample Payload
|
|
|
|
|
|
|
|
|
|
```json
|
|
|
|
|
{
|
|
|
|
|
"token": "ClientToken"
|
|
|
|
|
}
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
### Sample Request
|
|
|
|
|
|
2020-05-21 17:18:17 +00:00
|
|
|
|
```shell-session
|
2017-08-08 16:28:17 +00:00
|
|
|
|
$ curl \
|
|
|
|
|
--header "X-Vault-Token: ..." \
|
|
|
|
|
--request POST \
|
|
|
|
|
--data @payload.json \
|
2018-03-23 15:41:51 +00:00
|
|
|
|
http://127.0.0.1:8200/v1/auth/token/revoke-orphan
|
2017-08-08 16:28:17 +00:00
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
## Read Token Role
|
|
|
|
|
|
|
|
|
|
Fetches the named role configuration.
|
|
|
|
|
|
2020-01-18 00:18:09 +00:00
|
|
|
|
| Method | Path |
|
|
|
|
|
| :----- | :----------------------------- |
|
|
|
|
|
| `GET` | `/auth/token/roles/:role_name` |
|
2017-08-08 16:28:17 +00:00
|
|
|
|
|
|
|
|
|
### Parameters
|
|
|
|
|
|
|
|
|
|
- `role_name` `(string: <required>)` - The name of the token role.
|
|
|
|
|
|
|
|
|
|
### Sample Request
|
|
|
|
|
|
2020-05-21 17:18:17 +00:00
|
|
|
|
```shell-session
|
2017-08-08 16:28:17 +00:00
|
|
|
|
$ curl \
|
|
|
|
|
--header "X-Vault-Token: ..." \
|
2018-03-23 15:41:51 +00:00
|
|
|
|
http://127.0.0.1:8200/v1/auth/token/roles/nomad
|
2017-08-08 16:28:17 +00:00
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
### Sample Response
|
|
|
|
|
|
|
|
|
|
```javascript
|
|
|
|
|
{
|
|
|
|
|
"request_id": "075a19cd-4e56-a3ca-d956-7609819831ec",
|
|
|
|
|
"lease_id": "",
|
|
|
|
|
"lease_duration": 0,
|
|
|
|
|
"renewable": false,
|
|
|
|
|
"data": {
|
2019-07-01 09:39:54 +00:00
|
|
|
|
"allowed_entity_aliases": [
|
|
|
|
|
"my-entity-alias"
|
2017-08-08 16:28:17 +00:00
|
|
|
|
],
|
2019-07-01 09:39:54 +00:00
|
|
|
|
"allowed_policies": [],
|
2017-08-08 16:28:17 +00:00
|
|
|
|
"disallowed_policies": [],
|
2021-09-21 15:25:06 +00:00
|
|
|
|
"allowed_policies_glob": [],
|
|
|
|
|
"disallowed_policies_glob": [],
|
2017-08-08 16:28:17 +00:00
|
|
|
|
"explicit_max_ttl": 0,
|
|
|
|
|
"name": "nomad",
|
|
|
|
|
"orphan": false,
|
|
|
|
|
"path_suffix": "",
|
|
|
|
|
"period": 0,
|
2019-07-01 09:39:54 +00:00
|
|
|
|
"renewable": true,
|
|
|
|
|
"token_explicit_max_ttl": 0,
|
2021-09-21 16:53:08 +00:00
|
|
|
|
"token_no_default_policy": false,
|
2019-07-01 09:39:54 +00:00
|
|
|
|
"token_period": 0,
|
|
|
|
|
"token_type": "default-service"
|
2017-08-08 16:28:17 +00:00
|
|
|
|
},
|
|
|
|
|
"warnings": null
|
|
|
|
|
}
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
## List Token Roles
|
|
|
|
|
|
|
|
|
|
List available token roles.
|
|
|
|
|
|
2020-01-18 00:18:09 +00:00
|
|
|
|
| Method | Path |
|
|
|
|
|
| :----- | :------------------ |
|
|
|
|
|
| `LIST` | `/auth/token/roles` |
|
2017-08-08 16:28:17 +00:00
|
|
|
|
|
|
|
|
|
### Sample Request
|
|
|
|
|
|
2020-05-21 17:18:17 +00:00
|
|
|
|
```shell-session
|
2017-08-08 16:28:17 +00:00
|
|
|
|
$ curl \
|
|
|
|
|
--header "X-Vault-Token: ..." \
|
|
|
|
|
--request LIST
|
2018-03-23 15:41:51 +00:00
|
|
|
|
http://127.0.0.1:8200/v1/auth/token/roles
|
2017-08-08 16:28:17 +00:00
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
### Sample Response
|
|
|
|
|
|
|
|
|
|
```json
|
|
|
|
|
{
|
|
|
|
|
"data": {
|
2020-01-18 00:18:09 +00:00
|
|
|
|
"keys": ["role1", "role2"]
|
2017-08-08 16:28:17 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
## Create/Update Token Role
|
|
|
|
|
|
2017-09-13 01:48:52 +00:00
|
|
|
|
Creates (or replaces) the named role. Roles enforce specific behavior when
|
2017-08-08 16:28:17 +00:00
|
|
|
|
creating tokens that allow token functionality that is otherwise not
|
|
|
|
|
available or would require `sudo`/root privileges to access. Role
|
|
|
|
|
parameters, when set, override any provided options to the `create`
|
|
|
|
|
endpoints. The role name is also included in the token path, allowing all
|
2018-01-22 23:04:43 +00:00
|
|
|
|
tokens created against a role to be revoked using the
|
|
|
|
|
`/sys/leases/revoke-prefix` endpoint.
|
2017-08-08 16:28:17 +00:00
|
|
|
|
|
2020-01-18 00:18:09 +00:00
|
|
|
|
| Method | Path |
|
|
|
|
|
| :----- | :----------------------------- |
|
|
|
|
|
| `POST` | `/auth/token/roles/:role_name` |
|
2017-08-08 16:28:17 +00:00
|
|
|
|
|
|
|
|
|
### Parameters
|
|
|
|
|
|
|
|
|
|
- `role_name` `(string: <required>)` – The name of the token role.
|
2017-09-13 01:48:52 +00:00
|
|
|
|
- `allowed_policies` `(list: [])` – If set, tokens can be created with any
|
|
|
|
|
subset of the policies in this list, rather than the normal semantics of
|
|
|
|
|
tokens being a subset of the calling token's policies. The parameter is a
|
|
|
|
|
comma-delimited string of policy names. If at creation time
|
|
|
|
|
`no_default_policy` is not set and `"default"` is not contained in
|
2021-09-21 15:25:06 +00:00
|
|
|
|
`disallowed_policies` or glob matched in `disallowed_policies_glob`,
|
|
|
|
|
the `"default"` policy will be added to the created token automatically.
|
2017-09-13 01:48:52 +00:00
|
|
|
|
- `disallowed_policies` `(list: [])` – If set, successful token creation via
|
|
|
|
|
this role will require that no policies in the given list are requested. The
|
|
|
|
|
parameter is a comma-delimited string of policy names. Adding `"default"` to
|
2017-08-08 16:28:17 +00:00
|
|
|
|
this list will prevent `"default"` from being added automatically to created
|
|
|
|
|
tokens.
|
2021-09-21 15:25:06 +00:00
|
|
|
|
- `allowed_policies_glob` `(list: [])` – If set, tokens can be created with any
|
|
|
|
|
subset of glob matched policies in this list, rather than the normal semantics
|
|
|
|
|
of tokens being a subset of the calling token's policies. The parameter is a
|
|
|
|
|
comma-delimited string of policy name globs. If at creation time
|
|
|
|
|
`no_default_policy` is not set and `"default"` is not contained in
|
|
|
|
|
`disallowed_policies` or glob matched in `disallowed_policies_glob`,
|
|
|
|
|
the `"default"` policy will be added to the created token automatically.
|
|
|
|
|
If combined with `allowed_policies` policies need to only match one of the two
|
|
|
|
|
lists to be permitted. Note that unlike `allowed_policies` the policies listed
|
|
|
|
|
in `allowed_policies_glob` will not be added to the token when no policies are
|
|
|
|
|
specified in the call to `/auth/token/create/:role_name`.
|
|
|
|
|
- `disallowed_policies_glob` `(list: [])` – If set, successful token creation via
|
|
|
|
|
this role will require that no requested policies glob match any of policies in
|
|
|
|
|
this list. The parameter is a comma-delimited string of policy name globs.
|
|
|
|
|
Adding any glob that matches `"default"` to this list will prevent `"default"`
|
|
|
|
|
from being added automatically to created tokens.
|
|
|
|
|
If combined with `disallowed_policies` policies need to only match one of the
|
|
|
|
|
two lists to be blocked.
|
2018-01-03 19:02:31 +00:00
|
|
|
|
- `orphan` `(bool: false)` - If `true`, tokens created against this policy will
|
2017-09-13 01:48:52 +00:00
|
|
|
|
be orphan tokens (they will have no parent). As such, they will not be
|
2017-08-08 16:28:17 +00:00
|
|
|
|
automatically revoked by the revocation of any other token.
|
|
|
|
|
- `renewable` `(bool: true)` - Set to `false` to disable the ability of the token
|
2020-01-18 00:18:09 +00:00
|
|
|
|
to be renewed past its initial TTL. Setting the value to `true` will allow
|
2017-08-08 16:28:17 +00:00
|
|
|
|
the token to be renewable up to the system/mount maximum TTL.
|
2017-09-13 01:48:52 +00:00
|
|
|
|
- `path_suffix` `(string: "")` - If set, tokens created against this role will
|
2017-08-08 16:28:17 +00:00
|
|
|
|
have the given suffix as part of their path in addition to the role name. This
|
2017-09-13 01:48:52 +00:00
|
|
|
|
can be useful in certain scenarios, such as keeping the same role name in the
|
|
|
|
|
future but revoking all tokens created against it before some point in time.
|
2017-08-08 16:28:17 +00:00
|
|
|
|
The suffix can be changed, allowing new callers to have the new suffix as part
|
2017-09-13 01:48:52 +00:00
|
|
|
|
of their path, and then tokens with the old suffix can be revoked via
|
2018-01-22 23:04:43 +00:00
|
|
|
|
`/sys/leases/revoke-prefix`.
|
2020-01-18 00:18:09 +00:00
|
|
|
|
- `allowed_entity_aliases` `(string: "", or list: [])` - String or JSON list
|
|
|
|
|
of allowed entity aliases. If set, specifies the entity aliases which are
|
|
|
|
|
allowed to be used during token generation. This field supports globbing.
|
2021-01-27 17:56:54 +00:00
|
|
|
|
Note that `allowed_entity_aliases` is not case sensitive.
|
2017-08-08 16:28:17 +00:00
|
|
|
|
|
2020-12-17 21:53:33 +00:00
|
|
|
|
@include 'tokenstorefields.mdx'
|
2019-07-30 19:58:32 +00:00
|
|
|
|
|
2017-08-08 16:28:17 +00:00
|
|
|
|
### Sample Payload
|
|
|
|
|
|
|
|
|
|
```json
|
|
|
|
|
"allowed_policies": [
|
|
|
|
|
"dev"
|
|
|
|
|
],
|
|
|
|
|
"name": "nomad",
|
|
|
|
|
"orphan": false,
|
2018-04-21 14:49:16 +00:00
|
|
|
|
"bound_cidrs": ["127.0.0.1/32", "128.252.0.0/16"],
|
2019-07-01 09:39:54 +00:00
|
|
|
|
"renewable": true,
|
|
|
|
|
"allowed_entity_aliases": ["web-entity-alias", "app-entity-*"]
|
2017-08-08 16:28:17 +00:00
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
### Sample Request
|
|
|
|
|
|
2020-05-21 17:18:17 +00:00
|
|
|
|
```shell-session
|
2017-08-08 16:28:17 +00:00
|
|
|
|
$ curl \
|
|
|
|
|
--header "X-Vault-Token: ..." \
|
|
|
|
|
--request POST
|
|
|
|
|
--data @payload.json
|
2018-03-23 15:41:51 +00:00
|
|
|
|
http://127.0.0.1:8200/v1/auth/token/roles/nomad
|
2017-08-08 16:28:17 +00:00
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
## Delete Token Role
|
|
|
|
|
|
|
|
|
|
This endpoint deletes the named token role.
|
|
|
|
|
|
2020-01-18 00:18:09 +00:00
|
|
|
|
| Method | Path |
|
|
|
|
|
| :------- | :----------------------------- |
|
2019-03-22 16:15:37 +00:00
|
|
|
|
| `DELETE` | `/auth/token/roles/:role_name` |
|
2017-08-08 16:28:17 +00:00
|
|
|
|
|
|
|
|
|
### Parameters
|
|
|
|
|
|
|
|
|
|
- `role_name` `(string: <required>)` - The name of the token role.
|
|
|
|
|
|
|
|
|
|
### Sample Request
|
|
|
|
|
|
2020-05-21 17:18:17 +00:00
|
|
|
|
```shell-session
|
2017-08-08 16:28:17 +00:00
|
|
|
|
$ curl \
|
|
|
|
|
--header "X-Vault-Token: ..." \
|
|
|
|
|
--request DELETE \
|
2018-03-23 15:41:51 +00:00
|
|
|
|
http://127.0.0.1:8200/v1/auth/token/roles/admins
|
2017-08-08 16:28:17 +00:00
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
## Tidy Tokens
|
|
|
|
|
|
|
|
|
|
Performs some maintenance tasks to clean up invalid entries that may remain
|
2020-05-26 13:19:36 +00:00
|
|
|
|
in the token store. On Enterprise, Tidy will only impact the tokens in the
|
|
|
|
|
specified namespace, or the root namespace if unspecified.
|
|
|
|
|
|
|
|
|
|
Generally, running this is not needed unless upgrade notes or support personnel
|
|
|
|
|
suggest it. There are two potential dangers to running tidy: first, this will
|
|
|
|
|
perform a lot of read I/O to the storage method, as it will essentially reload the
|
2020-12-17 21:53:33 +00:00
|
|
|
|
entirety of the token store into memory. Depending on how much cleanup is
|
2020-05-26 13:19:36 +00:00
|
|
|
|
required (usually very little) there may also be a large number of writes.
|
|
|
|
|
Second, this will cause Vault's memory usage to balloon up, because the default
|
|
|
|
|
Vault internal cache is unlimited in size and every value read from storage will
|
2020-12-17 21:53:33 +00:00
|
|
|
|
be cached. Listing the `/auth/token/accessors` endpoint is a good way to get
|
2020-05-26 13:19:36 +00:00
|
|
|
|
some sense of the potential impact: tidy does this and more, so if this call creates problems
|
|
|
|
|
for your cluster, it would be wise to give Vault more resources before attempting
|
2020-12-17 21:53:33 +00:00
|
|
|
|
tidy. Note that the request may time out depending on
|
2020-05-26 13:19:36 +00:00
|
|
|
|
[max duration](https://www.vaultproject.io/docs/configuration#default_max_request_duration)
|
|
|
|
|
and your client's timeout configuration, make sure to allow it run to completion
|
|
|
|
|
to properly judge the impact.
|
|
|
|
|
|
|
|
|
|
Tidy will load every token accessor and cubbyhole in the namespace, as well
|
|
|
|
|
as all the secondary index entries that are used to group tokens into trees so
|
|
|
|
|
that parent token revocation also revokes child tokens.
|
|
|
|
|
|
|
|
|
|
For each parent token listed in the secondary index, tidy will check if the token
|
|
|
|
|
still exists in storage, and if not its child tokens that still exist will be
|
|
|
|
|
made orphans, then the parent token will be removed from the secondary index.
|
|
|
|
|
|
|
|
|
|
For each accessor found, tidy will check if the corresponding token still exists
|
|
|
|
|
in storage, and if not will delete the accessor. If the token still exists in
|
|
|
|
|
storage but shouldn't, tidy will try to revoke it and any child leases it might
|
|
|
|
|
have, then delete the accessor.
|
|
|
|
|
|
|
|
|
|
Finally, any cubbyhole entries that are associated with tokens which weren't deemed
|
|
|
|
|
valid in the above steps will be deleted.
|
|
|
|
|
|
2020-01-18 00:18:09 +00:00
|
|
|
|
| Method | Path |
|
|
|
|
|
| :----- | :----------------- |
|
|
|
|
|
| `POST` | `/auth/token/tidy` |
|
2017-08-08 16:28:17 +00:00
|
|
|
|
|
|
|
|
|
### Sample Request
|
|
|
|
|
|
2020-05-21 17:18:17 +00:00
|
|
|
|
```shell-session
|
2017-08-08 16:28:17 +00:00
|
|
|
|
$ curl \
|
|
|
|
|
--header "X-Vault-Token: ..." \
|
|
|
|
|
--request POST \
|
2018-03-23 15:41:51 +00:00
|
|
|
|
http://127.0.0.1:8200/v1/auth/token/tidy
|
2017-09-13 01:48:52 +00:00
|
|
|
|
```
|
2018-09-20 17:25:33 +00:00
|
|
|
|
|
|
|
|
|
### Sample Response
|
|
|
|
|
|
|
|
|
|
```json
|
|
|
|
|
{
|
|
|
|
|
"request_id": "84437c7f-36a1-6c1d-381d-14ec99217e94",
|
|
|
|
|
"lease_id": "",
|
|
|
|
|
"renewable": false,
|
|
|
|
|
"lease_duration": 0,
|
|
|
|
|
"data": null,
|
|
|
|
|
"wrap_info": null,
|
|
|
|
|
"warnings": [
|
|
|
|
|
"Tidy operation successfully started. Any information from the operation will be printed to Vault's server logs."
|
|
|
|
|
],
|
|
|
|
|
"auth": null
|
|
|
|
|
}
|
|
|
|
|
```
|