2017-08-08 16:28:17 +00:00
|
|
|
---
|
2020-01-18 00:18:09 +00:00
|
|
|
layout: api
|
|
|
|
page_title: AppRole - Auth Methods - HTTP API
|
|
|
|
description: This is the API documentation for the Vault AppRole auth method.
|
2017-08-08 16:28:17 +00:00
|
|
|
---
|
|
|
|
|
2017-09-13 01:48:52 +00:00
|
|
|
# AppRole 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 AppRole auth method. For
|
|
|
|
general information about the usage and operation of the AppRole method, please
|
2020-01-22 20:05:41 +00:00
|
|
|
see the [Vault AppRole method documentation](/docs/auth/approle).
|
2017-08-08 16:28:17 +00:00
|
|
|
|
2017-09-13 01:48:52 +00:00
|
|
|
This documentation assumes the AppRole method is mounted at the `/auth/approle`
|
2017-09-21 21:14:40 +00:00
|
|
|
path in Vault. Since it is possible to enable auth methods at any location,
|
2017-08-08 16:28:17 +00:00
|
|
|
please update your API calls accordingly.
|
|
|
|
|
|
|
|
## List Roles
|
|
|
|
|
2017-09-13 01:48:52 +00:00
|
|
|
This endpoint returns a list the existing AppRoles in the method.
|
2017-08-08 16:28:17 +00:00
|
|
|
|
2020-01-18 00:18:09 +00:00
|
|
|
| Method | Path |
|
|
|
|
| :----- | :------------------- |
|
|
|
|
| `LIST` | `/auth/approle/role` |
|
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/approle/role
|
2017-08-08 16:28:17 +00:00
|
|
|
```
|
|
|
|
|
|
|
|
### Sample Response
|
|
|
|
|
|
|
|
```json
|
|
|
|
{
|
|
|
|
"auth": null,
|
|
|
|
"warnings": null,
|
|
|
|
"wrap_info": null,
|
|
|
|
"data": {
|
2020-01-18 00:18:09 +00:00
|
|
|
"keys": ["dev", "prod", "test"]
|
2017-08-08 16:28:17 +00:00
|
|
|
},
|
|
|
|
"lease_duration": 0,
|
|
|
|
"renewable": false,
|
|
|
|
"lease_id": ""
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
2019-02-04 16:17:16 +00:00
|
|
|
## Create/Update AppRole
|
2017-08-08 16:28:17 +00:00
|
|
|
|
|
|
|
Creates a new AppRole or updates an existing AppRole. This endpoint
|
|
|
|
supports both `create` and `update` capabilities. There can be one or more
|
|
|
|
constraints enabled on the role. It is required to have at least one of them
|
|
|
|
enabled while creating or updating a role.
|
|
|
|
|
2020-01-18 00:18:09 +00:00
|
|
|
| Method | Path |
|
|
|
|
| :----- | :------------------------------ |
|
|
|
|
| `POST` | `/auth/approle/role/:role_name` |
|
2017-08-08 16:28:17 +00:00
|
|
|
|
|
|
|
### Parameters
|
|
|
|
|
|
|
|
- `role_name` `(string: <required>)` - Name of the AppRole.
|
2017-09-13 01:48:52 +00:00
|
|
|
- `bind_secret_id` `(bool: true)` - Require `secret_id` to be presented when
|
2017-08-08 16:28:17 +00:00
|
|
|
logging in using this AppRole.
|
2018-06-20 02:57:11 +00:00
|
|
|
- `secret_id_bound_cidrs` `(array: [])` - Comma-separated string or list of CIDR
|
2018-03-08 22:49:08 +00:00
|
|
|
blocks; if set, specifies blocks of IP addresses which can perform the login
|
|
|
|
operation.
|
2017-08-08 16:28:17 +00:00
|
|
|
- `secret_id_num_uses` `(integer: 0)` - Number of times any particular SecretID
|
2017-09-13 01:48:52 +00:00
|
|
|
can be used to fetch a token from this AppRole, after which the SecretID will
|
2020-01-18 00:18:09 +00:00
|
|
|
expire. A value of zero will allow unlimited uses.
|
2017-09-13 01:48:52 +00:00
|
|
|
- `secret_id_ttl` `(string: "")` - Duration in either an integer number of
|
2017-08-08 16:28:17 +00:00
|
|
|
seconds (`3600`) or an integer time unit (`60m`) after which any SecretID
|
|
|
|
expires.
|
2021-10-29 17:10:06 +00:00
|
|
|
- `local_secret_ids` `(bool: false)` - If set, the secret IDs generated
|
2018-04-23 21:05:53 +00:00
|
|
|
using this role will be cluster local. This can only be set during role
|
|
|
|
creation and once set, it can't be reset later.
|
2019-07-30 19:58:32 +00:00
|
|
|
|
2020-12-17 21:53:33 +00:00
|
|
|
@include 'tokenfields.mdx'
|
2017-08-08 16:28:17 +00:00
|
|
|
|
|
|
|
### Sample Payload
|
|
|
|
|
|
|
|
```json
|
|
|
|
{
|
|
|
|
"token_ttl": "10m",
|
|
|
|
"token_max_ttl": "15m",
|
2020-01-18 00:18:09 +00:00
|
|
|
"token_policies": ["default"],
|
2017-08-08 16:28:17 +00:00
|
|
|
"period": 0,
|
|
|
|
"bind_secret_id": 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/approle/role/application1
|
2017-08-08 16:28:17 +00:00
|
|
|
```
|
|
|
|
|
|
|
|
## Read AppRole
|
|
|
|
|
|
|
|
Reads the properties of an existing AppRole.
|
|
|
|
|
2020-01-18 00:18:09 +00:00
|
|
|
| Method | Path |
|
|
|
|
| :----- | :------------------------------ |
|
|
|
|
| `GET` | `/auth/approle/role/:role_name` |
|
2017-08-08 16:28:17 +00:00
|
|
|
|
|
|
|
### Parameters
|
|
|
|
|
|
|
|
- `role_name` `(string: <required>)` - Name of the AppRole.
|
|
|
|
|
|
|
|
### 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/approle/role/application1
|
2017-08-08 16:28:17 +00:00
|
|
|
```
|
|
|
|
|
|
|
|
### Sample Response
|
|
|
|
|
|
|
|
```json
|
|
|
|
{
|
|
|
|
"auth": null,
|
|
|
|
"warnings": null,
|
|
|
|
"wrap_info": null,
|
|
|
|
"data": {
|
|
|
|
"token_ttl": 1200,
|
|
|
|
"token_max_ttl": 1800,
|
|
|
|
"secret_id_ttl": 600,
|
|
|
|
"secret_id_num_uses": 40,
|
2020-01-18 00:18:09 +00:00
|
|
|
"token_policies": ["default"],
|
2017-08-08 16:28:17 +00:00
|
|
|
"period": 0,
|
|
|
|
"bind_secret_id": true,
|
2022-02-09 17:34:13 +00:00
|
|
|
"secret_id_bound_cidrs": []
|
2017-08-08 16:28:17 +00:00
|
|
|
},
|
|
|
|
"lease_duration": 0,
|
|
|
|
"renewable": false,
|
|
|
|
"lease_id": ""
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
## Delete AppRole
|
|
|
|
|
2017-09-13 01:48:52 +00:00
|
|
|
Deletes an existing AppRole from the method.
|
2017-08-08 16:28:17 +00:00
|
|
|
|
2020-01-18 00:18:09 +00:00
|
|
|
| Method | Path |
|
|
|
|
| :------- | :------------------------------ |
|
|
|
|
| `DELETE` | `/auth/approle/role/:role_name` |
|
2017-08-08 16:28:17 +00:00
|
|
|
|
|
|
|
### Parameters
|
|
|
|
|
|
|
|
- `role_name` `(string: <required>)` - Name of the AppRole.
|
|
|
|
|
|
|
|
### 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/approle/role/application1
|
2017-08-08 16:28:17 +00:00
|
|
|
```
|
|
|
|
|
|
|
|
## Read AppRole Role ID
|
|
|
|
|
|
|
|
Reads the RoleID of an existing AppRole.
|
|
|
|
|
2020-01-18 00:18:09 +00:00
|
|
|
| Method | Path |
|
|
|
|
| :----- | :-------------------------------------- |
|
|
|
|
| `GET` | `/auth/approle/role/:role_name/role-id` |
|
2017-08-08 16:28:17 +00:00
|
|
|
|
|
|
|
### Parameters
|
|
|
|
|
|
|
|
- `role_name` `(string: <required>)` - Name of the AppRole.
|
|
|
|
|
|
|
|
### 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/approle/role/application1/role-id
|
2017-08-08 16:28:17 +00:00
|
|
|
```
|
|
|
|
|
|
|
|
### Sample Response
|
|
|
|
|
|
|
|
```json
|
|
|
|
{
|
|
|
|
"auth": null,
|
|
|
|
"warnings": null,
|
|
|
|
"wrap_info": null,
|
|
|
|
"data": {
|
|
|
|
"role_id": "e5a7b66e-5d08-da9c-7075-71984634b882"
|
|
|
|
},
|
|
|
|
"lease_duration": 0,
|
|
|
|
"renewable": false,
|
|
|
|
"lease_id": ""
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
## Update AppRole Role ID
|
|
|
|
|
|
|
|
Updates the RoleID of an existing AppRole to a custom value.
|
|
|
|
|
2020-01-18 00:18:09 +00:00
|
|
|
| Method | Path |
|
|
|
|
| :----- | :-------------------------------------- |
|
|
|
|
| `POST` | `/auth/approle/role/:role_name/role-id` |
|
2017-08-08 16:28:17 +00:00
|
|
|
|
|
|
|
### Parameters
|
|
|
|
|
|
|
|
- `role_name` `(string: <required>)` - Name of the AppRole.
|
|
|
|
- `role_id` `(string: <required>)` - Value to be set as RoleID.
|
|
|
|
|
|
|
|
### Sample Payload
|
|
|
|
|
|
|
|
```json
|
|
|
|
{
|
|
|
|
"role_id": "custom-role-id"
|
|
|
|
}
|
2017-08-25 16:34:12 +00:00
|
|
|
```
|
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/approle/role/application1/role-id
|
2017-08-08 16:28:17 +00:00
|
|
|
```
|
|
|
|
|
|
|
|
### Sample Response
|
|
|
|
|
|
|
|
```json
|
|
|
|
{
|
|
|
|
"auth": null,
|
|
|
|
"warnings": null,
|
|
|
|
"wrap_info": null,
|
|
|
|
"data": {
|
|
|
|
"role_id": "e5a7b66e-5d08-da9c-7075-71984634b882"
|
|
|
|
},
|
|
|
|
"lease_duration": 0,
|
|
|
|
"renewable": false,
|
|
|
|
"lease_id": ""
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
## Generate New Secret ID
|
|
|
|
|
|
|
|
Generates and issues a new SecretID on an existing AppRole. Similar to
|
|
|
|
tokens, the response will also contain a `secret_id_accessor` value which can
|
|
|
|
be used to read the properties of the SecretID without divulging the SecretID
|
|
|
|
itself, and also to delete the SecretID from the AppRole.
|
|
|
|
|
2020-01-18 00:18:09 +00:00
|
|
|
| Method | Path |
|
|
|
|
| :----- | :---------------------------------------- |
|
|
|
|
| `POST` | `/auth/approle/role/:role_name/secret-id` |
|
2017-08-08 16:28:17 +00:00
|
|
|
|
|
|
|
### Parameters
|
|
|
|
|
|
|
|
- `role_name` `(string: <required>)` - Name of the AppRole.
|
2020-01-18 00:18:09 +00:00
|
|
|
- `metadata` `(string: "")` - Metadata to be tied to the SecretID. This should be
|
2017-09-13 01:48:52 +00:00
|
|
|
a JSON-formatted string containing the metadata in key-value pairs. This
|
|
|
|
metadata will be set on tokens issued with this SecretID, and is logged in
|
2017-08-08 16:28:17 +00:00
|
|
|
audit logs _in plaintext_.
|
2020-01-18 00:18:09 +00:00
|
|
|
- `cidr_list` `(array: [])` - Comma separated string or list of CIDR blocks
|
2018-03-08 22:49:08 +00:00
|
|
|
enforcing secret IDs to be used from specific set of IP addresses. If
|
2022-02-09 17:34:13 +00:00
|
|
|
`secret_id_bound_cidrs` is set on the role, then the list of CIDR blocks listed
|
2018-03-08 22:49:08 +00:00
|
|
|
here should be a subset of the CIDR blocks listed on the role.
|
2018-08-21 15:54:04 +00:00
|
|
|
- `token_bound_cidrs` `(array: [])` - Comma-separated string or list of CIDR
|
|
|
|
blocks; if set, specifies blocks of IP addresses which can use the auth tokens
|
|
|
|
generated by this SecretID. Overrides any role-set value but must be a subset.
|
2017-08-08 16:28:17 +00:00
|
|
|
|
|
|
|
### Sample Payload
|
|
|
|
|
|
|
|
```json
|
|
|
|
{
|
2018-01-23 21:30:15 +00:00
|
|
|
"metadata": "{ \"tag1\": \"production\" }"
|
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/approle/role/application1/secret-id
|
2017-08-08 16:28:17 +00:00
|
|
|
```
|
|
|
|
|
|
|
|
### Sample Response
|
|
|
|
|
|
|
|
```json
|
|
|
|
{
|
|
|
|
"auth": null,
|
|
|
|
"warnings": null,
|
|
|
|
"wrap_info": null,
|
|
|
|
"data": {
|
|
|
|
"secret_id_accessor": "84896a0c-1347-aa90-a4f6-aca8b7558780",
|
2021-02-04 00:32:16 +00:00
|
|
|
"secret_id": "841771dc-11c9-bbc7-bcac-6a3945a69cd9",
|
|
|
|
"secret_id_ttl": 600
|
2017-08-08 16:28:17 +00:00
|
|
|
},
|
|
|
|
"lease_duration": 0,
|
|
|
|
"renewable": false,
|
|
|
|
"lease_id": ""
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
## List Secret ID Accessors
|
|
|
|
|
|
|
|
Lists the accessors of all the SecretIDs issued against the AppRole.
|
|
|
|
This includes the accessors for "custom" SecretIDs as well.
|
|
|
|
|
2020-01-18 00:18:09 +00:00
|
|
|
| Method | Path |
|
|
|
|
| :----- | :---------------------------------------- |
|
|
|
|
| `LIST` | `/auth/approle/role/:role_name/secret-id` |
|
2017-08-08 16:28:17 +00:00
|
|
|
|
|
|
|
### Parameters
|
|
|
|
|
|
|
|
- `role_name` `(string: <required>)` - Name of the AppRole.
|
|
|
|
|
|
|
|
### 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/approle/role/application1/secret-id
|
2017-08-08 16:28:17 +00:00
|
|
|
```
|
|
|
|
|
|
|
|
### Sample Response
|
|
|
|
|
|
|
|
```json
|
|
|
|
{
|
|
|
|
"auth": null,
|
|
|
|
"warnings": null,
|
|
|
|
"wrap_info": null,
|
|
|
|
"data": {
|
|
|
|
"keys": [
|
|
|
|
"ce102d2a-8253-c437-bf9a-aceed4241491",
|
|
|
|
"a1c8dee4-b869-e68d-3520-2040c1a0849a",
|
|
|
|
"be83b7e2-044c-7244-07e1-47560ca1c787",
|
|
|
|
"84896a0c-1347-aa90-a4f6-aca8b7558780",
|
|
|
|
"239b1328-6523-15e7-403a-a48038cdc45a"
|
|
|
|
]
|
|
|
|
},
|
|
|
|
"lease_duration": 0,
|
|
|
|
"renewable": false,
|
|
|
|
"lease_id": ""
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
## Read AppRole Secret ID
|
|
|
|
|
|
|
|
Reads out the properties of a SecretID.
|
|
|
|
|
2020-01-18 00:18:09 +00:00
|
|
|
| Method | Path |
|
|
|
|
| :----- | :----------------------------------------------- |
|
|
|
|
| `POST` | `/auth/approle/role/:role_name/secret-id/lookup` |
|
2017-08-08 16:28:17 +00:00
|
|
|
|
|
|
|
### Parameters
|
|
|
|
|
|
|
|
- `role_name` `(string: <required>)` - Name of the AppRole.
|
2020-01-18 00:18:09 +00:00
|
|
|
- `secret_id` `(string: <required>)` - Secret ID attached to the role.
|
2017-08-08 16:28:17 +00:00
|
|
|
|
|
|
|
### Sample Payload
|
|
|
|
|
|
|
|
```json
|
|
|
|
{
|
|
|
|
"secret_id": "84896a0c-1347-aa90-a4f6-aca8b7558780"
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
### 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-04-24 15:20:29 +00:00
|
|
|
--data @payload.json \
|
2018-03-23 15:41:51 +00:00
|
|
|
http://127.0.0.1:8200/v1/auth/approle/role/application1/secret-id/lookup
|
2017-08-08 16:28:17 +00:00
|
|
|
```
|
|
|
|
|
|
|
|
## Destroy AppRole Secret ID
|
|
|
|
|
|
|
|
Destroy an AppRole secret ID.
|
|
|
|
|
2020-01-18 00:18:09 +00:00
|
|
|
| Method | Path |
|
|
|
|
| :----- | :------------------------------------------------ |
|
|
|
|
| `POST` | `/auth/approle/role/:role_name/secret-id/destroy` |
|
2017-08-08 16:28:17 +00:00
|
|
|
|
|
|
|
### Parameters
|
|
|
|
|
|
|
|
- `role_name` `(string: <required>)` - Name of the AppRole.
|
2020-01-18 00:18:09 +00:00
|
|
|
- `secret_id` `(string: <required>)` - Secret ID attached to the role.
|
2017-08-08 16:28:17 +00:00
|
|
|
|
|
|
|
### Sample Payload
|
|
|
|
|
|
|
|
```json
|
|
|
|
{
|
|
|
|
"secret_id": "84896a0c-1347-aa90-a4f6-aca8b7558780"
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
### 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-04-24 15:20:29 +00:00
|
|
|
--data @payload.json \
|
2018-03-23 15:41:51 +00:00
|
|
|
http://127.0.0.1:8200/v1/auth/approle/role/application1/secret-id/destroy
|
2017-08-08 16:28:17 +00:00
|
|
|
```
|
|
|
|
|
|
|
|
## Read AppRole Secret ID Accessor
|
|
|
|
|
|
|
|
Reads out the properties of a SecretID.
|
|
|
|
|
2020-01-18 00:18:09 +00:00
|
|
|
| Method | Path |
|
|
|
|
| :----- | :-------------------------------------------------------- |
|
|
|
|
| `POST` | `/auth/approle/role/:role_name/secret-id-accessor/lookup` |
|
2017-08-08 16:28:17 +00:00
|
|
|
|
|
|
|
### Parameters
|
|
|
|
|
|
|
|
- `role_name` `(string: <required>)` - Name of the AppRole.
|
2020-01-18 00:18:09 +00:00
|
|
|
- `secret_id_accessor` `(string: <required>)` - Secret ID accessor attached to the role.
|
2017-08-08 16:28:17 +00:00
|
|
|
|
|
|
|
### Sample Payload
|
|
|
|
|
|
|
|
```json
|
|
|
|
{
|
|
|
|
"secret_id_accessor": "84896a0c-1347-aa90-a4f6-aca8b7558780"
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
### 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-04-24 15:20:29 +00:00
|
|
|
--data @payload.json \
|
2018-03-23 15:41:51 +00:00
|
|
|
http://127.0.0.1:8200/v1/auth/approle/role/application1/secret-id-accessor/lookup
|
2017-08-08 16:28:17 +00:00
|
|
|
```
|
|
|
|
|
|
|
|
## Destroy AppRole Secret ID Accessor
|
|
|
|
|
|
|
|
Destroy an AppRole secret ID by its accessor.
|
|
|
|
|
2020-01-18 00:18:09 +00:00
|
|
|
| Method | Path |
|
|
|
|
| :----- | :--------------------------------------------------------- |
|
|
|
|
| `POST` | `/auth/approle/role/:role_name/secret-id-accessor/destroy` |
|
2017-08-08 16:28:17 +00:00
|
|
|
|
|
|
|
### Parameters
|
|
|
|
|
|
|
|
- `role_name` `(string: <required>)` - Name of the AppRole.
|
2020-01-18 00:18:09 +00:00
|
|
|
- `secret_id_accessor` `(string: <required>)` - Secret ID accessor attached to the role.
|
2017-08-08 16:28:17 +00:00
|
|
|
|
|
|
|
### Sample Payload
|
|
|
|
|
|
|
|
```json
|
|
|
|
{
|
|
|
|
"secret_id_accessor": "84896a0c-1347-aa90-a4f6-aca8b7558780"
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
### 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-04-24 15:20:29 +00:00
|
|
|
--data @payload.json \
|
2018-03-23 15:41:51 +00:00
|
|
|
http://127.0.0.1:8200/v1/auth/approle/role/application1/secret-id-accessor/destroy
|
2017-08-08 16:28:17 +00:00
|
|
|
```
|
|
|
|
|
|
|
|
## Create Custom AppRole Secret ID
|
|
|
|
|
|
|
|
Assigns a "custom" SecretID against an existing AppRole. This is used in the
|
|
|
|
"Push" model of operation.
|
|
|
|
|
2020-01-18 00:18:09 +00:00
|
|
|
| Method | Path |
|
|
|
|
| :----- | :----------------------------------------------- |
|
|
|
|
| `POST` | `/auth/approle/role/:role_name/custom-secret-id` |
|
2017-08-08 16:28:17 +00:00
|
|
|
|
|
|
|
### Parameters
|
|
|
|
|
|
|
|
- `role_name` `(string: <required>)` - Name of the AppRole.
|
2020-01-18 00:18:09 +00:00
|
|
|
- `secret_id` `(string: <required>)` - SecretID to be attached to the Role.
|
|
|
|
- `metadata` `(string: "")` - Metadata to be tied to the SecretID. This should be
|
2017-09-13 01:48:52 +00:00
|
|
|
a JSON-formatted string containing the metadata in key-value pairs. This
|
|
|
|
metadata will be set on tokens issued with this SecretID, and is logged in
|
2017-08-08 16:28:17 +00:00
|
|
|
audit logs _in plaintext_.
|
2018-03-08 22:49:08 +00:00
|
|
|
- `cidr_list` `(array: [])` - Comma separated string or list of CIDR blocks
|
2018-03-20 18:54:10 +00:00
|
|
|
enforcing secret IDs to be used from specific set of IP addresses. If
|
2022-02-09 17:34:13 +00:00
|
|
|
`secret_id_bound_cidrs` is set on the role, then the list of CIDR blocks listed
|
2018-03-08 22:49:08 +00:00
|
|
|
here should be a subset of the CIDR blocks listed on the role.
|
2018-08-21 15:54:04 +00:00
|
|
|
- `token_bound_cidrs` `(array: [])` - Comma-separated string or list of CIDR
|
|
|
|
blocks; if set, specifies blocks of IP addresses which can use the auth tokens
|
|
|
|
generated by this SecretID. Overrides any role-set value but must be a subset.
|
2017-08-08 16:28:17 +00:00
|
|
|
|
|
|
|
### Sample Payload
|
|
|
|
|
|
|
|
```json
|
|
|
|
{
|
2017-10-11 13:25:43 +00:00
|
|
|
"secret_id": "testsecretid"
|
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/approle/role/application1/custom-secret-id
|
2017-08-08 16:28:17 +00:00
|
|
|
```
|
|
|
|
|
|
|
|
### Sample Response
|
|
|
|
|
|
|
|
```json
|
|
|
|
{
|
|
|
|
"auth": null,
|
|
|
|
"warnings": null,
|
|
|
|
"wrap_info": null,
|
|
|
|
"data": {
|
|
|
|
"secret_id_accessor": "84896a0c-1347-aa90-a4f6-aca8b7558780",
|
|
|
|
"secret_id": "testsecretid"
|
|
|
|
},
|
|
|
|
"lease_duration": 0,
|
|
|
|
"renewable": false,
|
|
|
|
"lease_id": ""
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
## Login With AppRole
|
|
|
|
|
|
|
|
Issues a Vault token based on the presented credentials. `role_id` is always
|
|
|
|
required; if `bind_secret_id` is enabled (the default) on the AppRole,
|
|
|
|
`secret_id` is required too. Any other bound authentication values on the
|
|
|
|
AppRole (such as client IP CIDR) are also evaluated.
|
|
|
|
|
2020-01-18 00:18:09 +00:00
|
|
|
| Method | Path |
|
|
|
|
| :----- | :-------------------- |
|
|
|
|
| `POST` | `/auth/approle/login` |
|
2017-08-08 16:28:17 +00:00
|
|
|
|
|
|
|
### Parameters
|
|
|
|
|
|
|
|
- `role_id` `(string: <required>)` - RoleID of the AppRole.
|
2020-01-18 00:18:09 +00:00
|
|
|
- `secret_id` `(string: <required>)` - SecretID belonging to AppRole.
|
2017-08-08 16:28:17 +00:00
|
|
|
|
|
|
|
### Sample Payload
|
|
|
|
|
|
|
|
```json
|
|
|
|
{
|
|
|
|
"role_id": "59d6d1ca-47bb-4e7e-a40b-8be3bc5a0ba8",
|
|
|
|
"secret_id": "84896a0c-1347-aa90-a4f6-aca8b7558780"
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
### Sample Request
|
|
|
|
|
2020-05-21 17:18:17 +00:00
|
|
|
```shell-session
|
2017-08-08 16:28:17 +00:00
|
|
|
$ curl \
|
|
|
|
--request POST \
|
|
|
|
--data @payload.json \
|
2018-03-23 15:41:51 +00:00
|
|
|
http://127.0.0.1:8200/v1/auth/approle/login
|
2017-08-08 16:28:17 +00:00
|
|
|
```
|
|
|
|
|
|
|
|
### Sample Response
|
|
|
|
|
|
|
|
```json
|
|
|
|
{
|
|
|
|
"auth": {
|
|
|
|
"renewable": true,
|
|
|
|
"lease_duration": 1200,
|
|
|
|
"metadata": null,
|
2020-01-18 00:18:09 +00:00
|
|
|
"token_policies": ["default"],
|
2017-08-08 16:28:17 +00:00
|
|
|
"accessor": "fd6c9a00-d2dc-3b11-0be5-af7ae0e1d374",
|
|
|
|
"client_token": "5b1a0318-679c-9c45-e5c6-d1b9a9035d49"
|
|
|
|
},
|
|
|
|
"warnings": null,
|
|
|
|
"wrap_info": null,
|
|
|
|
"data": null,
|
|
|
|
"lease_duration": 0,
|
|
|
|
"renewable": false,
|
|
|
|
"lease_id": ""
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
## Read, Update, or Delete AppRole Properties
|
|
|
|
|
|
|
|
Updates the respective property in the existing AppRole. All of these
|
|
|
|
parameters of the AppRole can be updated using the `/auth/approle/role/:role_name`
|
|
|
|
endpoint directly. The endpoints for each field is provided separately
|
|
|
|
to be able to delegate specific endpoints using Vault's ACL system.
|
|
|
|
|
2020-01-18 00:18:09 +00:00
|
|
|
| Method | Path |
|
2020-12-17 21:53:33 +00:00
|
|
|
| :---------------- | :---------------------------------------------------- | --------- |
|
2020-01-18 00:18:09 +00:00
|
|
|
| `GET/POST/DELETE` | `/auth/approle/role/:role_name/policies` | `200/204` |
|
|
|
|
| `GET/POST/DELETE` | `/auth/approle/role/:role_name/secret-id-num-uses` | `200/204` |
|
|
|
|
| `GET/POST/DELETE` | `/auth/approle/role/:role_name/secret-id-ttl` | `200/204` |
|
|
|
|
| `GET/POST/DELETE` | `/auth/approle/role/:role_name/token-ttl` | `200/204` |
|
|
|
|
| `GET/POST/DELETE` | `/auth/approle/role/:role_name/token-max-ttl` | `200/204` |
|
|
|
|
| `GET/POST/DELETE` | `/auth/approle/role/:role_name/bind-secret-id` | `200/204` |
|
|
|
|
| `GET/POST/DELETE` | `/auth/approle/role/:role_name/secret-id-bound-cidrs` | `200/204` |
|
|
|
|
| `GET/POST/DELETE` | `/auth/approle/role/:role_name/token-bound-cidrs` | `200/204` |
|
|
|
|
| `GET/POST/DELETE` | `/auth/approle/role/:role_name/period` | `200/204` |
|
2017-08-08 16:28:17 +00:00
|
|
|
|
2017-08-18 14:46:29 +00:00
|
|
|
Refer to `/auth/approle/role/:role_name` endpoint.
|
2018-09-20 17:25:33 +00:00
|
|
|
|
|
|
|
## Tidy Tokens
|
|
|
|
|
|
|
|
Performs some maintenance tasks to clean up invalid entries that may remain
|
|
|
|
in the token store. Generally, running this is not needed unless upgrade
|
|
|
|
notes or support personnel suggest it. This may perform a lot of I/O to the
|
|
|
|
storage method so should be used sparingly.
|
|
|
|
|
2020-01-18 00:18:09 +00:00
|
|
|
| Method | Path |
|
|
|
|
| :----- | :----------------------------- |
|
|
|
|
| `POST` | `/auth/approle/tidy/secret-id` |
|
2018-09-20 17:25:33 +00:00
|
|
|
|
|
|
|
### Sample Request
|
|
|
|
|
2020-05-21 17:18:17 +00:00
|
|
|
```shell-session
|
2018-09-20 17:25:33 +00:00
|
|
|
$ curl \
|
|
|
|
--header "X-Vault-Token: ..." \
|
|
|
|
--request POST \
|
|
|
|
http://127.0.0.1:8200/v1/auth/approle/tidy/secret-id
|
|
|
|
```
|
|
|
|
|
|
|
|
### Sample Response
|
|
|
|
|
|
|
|
```json
|
|
|
|
{
|
|
|
|
"request_id": "b20b56e3-4699-5b19-cc6b-e74f7b787bbf",
|
|
|
|
"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
|
|
|
|
}
|
|
|
|
```
|