2017-03-15 06:40:33 +00:00
|
|
|
|
---
|
2020-01-18 00:18:09 +00:00
|
|
|
|
layout: api
|
|
|
|
|
page_title: /sys/generate-root - HTTP API
|
2017-03-15 06:40:33 +00:00
|
|
|
|
description: |-
|
|
|
|
|
The `/sys/generate-root/` endpoints are used to create a new root key for
|
|
|
|
|
Vault.
|
|
|
|
|
---
|
|
|
|
|
|
|
|
|
|
# `/sys/generate-root`
|
|
|
|
|
|
|
|
|
|
The `/sys/generate-root` endpoint is used to create a new root key for Vault.
|
|
|
|
|
|
|
|
|
|
## Read Root Generation Progress
|
|
|
|
|
|
|
|
|
|
This endpoint reads the configuration and process of the current root generation
|
|
|
|
|
attempt.
|
|
|
|
|
|
2020-01-18 00:18:09 +00:00
|
|
|
|
| Method | Path |
|
|
|
|
|
| :----- | :--------------------------- |
|
|
|
|
|
| `GET` | `/sys/generate-root/attempt` |
|
2017-03-15 06:40:33 +00:00
|
|
|
|
|
|
|
|
|
### Sample Request
|
|
|
|
|
|
2020-05-21 17:18:17 +00:00
|
|
|
|
```shell-session
|
2017-03-15 06:40:33 +00:00
|
|
|
|
$ curl \
|
2018-03-23 15:41:51 +00:00
|
|
|
|
http://127.0.0.1:8200/v1/sys/generate-root/attempt
|
2017-03-15 06:40:33 +00:00
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
### Sample Response
|
|
|
|
|
|
|
|
|
|
```json
|
|
|
|
|
{
|
|
|
|
|
"started": true,
|
|
|
|
|
"nonce": "2dbd10f1-8528-6246-09e7-82b25b8aba63",
|
|
|
|
|
"progress": 1,
|
|
|
|
|
"required": 3,
|
2017-11-14 11:13:11 +00:00
|
|
|
|
"encoded_token": "",
|
2017-03-15 06:40:33 +00:00
|
|
|
|
"pgp_fingerprint": "",
|
2019-08-14 14:16:10 +00:00
|
|
|
|
"otp_length": 24,
|
2017-03-15 06:40:33 +00:00
|
|
|
|
"complete": false
|
|
|
|
|
}
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
If a root generation is started, `progress` is how many unseal keys have been
|
|
|
|
|
provided for this generation attempt, where `required` must be reached to
|
|
|
|
|
complete. The `nonce` for the current attempt and whether the attempt is
|
2019-08-14 14:16:10 +00:00
|
|
|
|
complete is also displayed.
|
|
|
|
|
|
|
|
|
|
If a PGP key is being used to encrypt the final root
|
|
|
|
|
token, its fingerprint will be returned.
|
|
|
|
|
|
|
|
|
|
If an OTP is being used to encode the final root token it will be returned only
|
|
|
|
|
once, on the response to the start request.
|
|
|
|
|
|
|
|
|
|
The OTP is a base62 string, with length of otp_length.
|
|
|
|
|
The raw bytes (char codes) of the token will be XOR'd with
|
2020-01-18 00:18:09 +00:00
|
|
|
|
this value before being returned as a response to the final unseal
|
2019-08-14 14:16:10 +00:00
|
|
|
|
key, encoded as base64.
|
2017-03-15 06:40:33 +00:00
|
|
|
|
|
|
|
|
|
## Start Root Token Generation
|
|
|
|
|
|
|
|
|
|
This endpoint initializes a new root generation attempt. Only a single root
|
2020-01-18 00:18:09 +00:00
|
|
|
|
generation attempt can take place at a time.
|
2018-10-10 15:51:05 +00:00
|
|
|
|
|
2020-01-18 00:18:09 +00:00
|
|
|
|
| Method | Path |
|
|
|
|
|
| :----- | :--------------------------- |
|
|
|
|
|
| `PUT` | `/sys/generate-root/attempt` |
|
2017-03-15 06:40:33 +00:00
|
|
|
|
|
|
|
|
|
### Parameters
|
|
|
|
|
|
2018-10-10 15:56:50 +00:00
|
|
|
|
- `pgp_key` `(string: <optional>)` – Specifies a base64-encoded PGP public key.
|
|
|
|
|
The raw bytes of the token will be encrypted with this value before being
|
|
|
|
|
returned to the final unseal key provider.
|
2017-03-15 06:40:33 +00:00
|
|
|
|
|
|
|
|
|
### Sample Request
|
|
|
|
|
|
2020-05-21 17:18:17 +00:00
|
|
|
|
```shell-session
|
2017-03-15 06:40:33 +00:00
|
|
|
|
$ curl \
|
|
|
|
|
--request PUT \
|
2020-01-18 00:18:09 +00:00
|
|
|
|
http://127.0.0.1:8200/v1/sys/generate-root/attempt
|
2017-03-15 06:40:33 +00:00
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
### Sample Response
|
|
|
|
|
|
|
|
|
|
```json
|
|
|
|
|
{
|
|
|
|
|
"started": true,
|
|
|
|
|
"nonce": "2dbd10f1-8528-6246-09e7-82b25b8aba63",
|
|
|
|
|
"progress": 1,
|
|
|
|
|
"required": 3,
|
2017-11-14 11:13:11 +00:00
|
|
|
|
"encoded_token": "",
|
2018-10-10 15:51:05 +00:00
|
|
|
|
"otp": "2vPFYG8gUSW9npwzyvxXMug0",
|
2020-01-18 00:18:09 +00:00
|
|
|
|
"otp_length": 24,
|
2017-03-15 06:40:33 +00:00
|
|
|
|
"complete": false
|
|
|
|
|
}
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
## Cancel Root Generation
|
|
|
|
|
|
|
|
|
|
This endpoint cancels any in-progress root generation attempt. This clears any
|
|
|
|
|
progress made. This must be called to change the OTP or PGP key being used.
|
|
|
|
|
|
2019-03-22 16:15:37 +00:00
|
|
|
|
| Method | Path |
|
2020-01-18 00:18:09 +00:00
|
|
|
|
| :------- | :--------------------------- |
|
2019-03-22 16:15:37 +00:00
|
|
|
|
| `DELETE` | `/sys/generate-root/attempt` |
|
2017-03-15 06:40:33 +00:00
|
|
|
|
|
|
|
|
|
### Sample Request
|
|
|
|
|
|
2020-05-21 17:18:17 +00:00
|
|
|
|
```shell-session
|
2017-03-15 06:40:33 +00:00
|
|
|
|
$ curl \
|
|
|
|
|
--request DELETE \
|
2018-03-23 15:41:51 +00:00
|
|
|
|
http://127.0.0.1:8200/v1/sys/generate-root/attempt
|
2017-03-15 06:40:33 +00:00
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
## Provide Key Share to Generate Root
|
|
|
|
|
|
|
|
|
|
This endpoint is used to enter a single master key share to progress the root
|
|
|
|
|
generation attempt. If the threshold number of master key shares is reached,
|
2020-01-18 00:18:09 +00:00
|
|
|
|
Vault will complete the root generation and issue the new token. Otherwise,
|
2017-03-15 06:40:33 +00:00
|
|
|
|
this API must be called multiple times until that threshold is met. The attempt
|
|
|
|
|
nonce must be provided with each call.
|
|
|
|
|
|
2020-01-18 00:18:09 +00:00
|
|
|
|
| Method | Path |
|
|
|
|
|
| :----- | :-------------------------- |
|
|
|
|
|
| `PUT` | `/sys/generate-root/update` |
|
2017-03-15 06:40:33 +00:00
|
|
|
|
|
|
|
|
|
### Parameters
|
|
|
|
|
|
|
|
|
|
- `key` `(string: <required>)` – Specifies a single master key share.
|
|
|
|
|
|
|
|
|
|
- `nonce` `(string: <required>)` – Specifies the nonce of the attempt.
|
|
|
|
|
|
|
|
|
|
### Sample Payload
|
|
|
|
|
|
|
|
|
|
```json
|
|
|
|
|
{
|
|
|
|
|
"key": "acbd1234",
|
2017-07-07 12:25:32 +00:00
|
|
|
|
"nonce": "ad235"
|
2017-03-15 06:40:33 +00:00
|
|
|
|
}
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
### Sample Request
|
|
|
|
|
|
2020-05-21 17:18:17 +00:00
|
|
|
|
```shell-session
|
2017-03-15 06:40:33 +00:00
|
|
|
|
$ curl \
|
|
|
|
|
--request PUT \
|
2017-06-07 14:02:58 +00:00
|
|
|
|
--data @payload.json \
|
2018-03-23 15:41:51 +00:00
|
|
|
|
http://127.0.0.1:8200/v1/sys/generate-root/update
|
2017-03-15 06:40:33 +00:00
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
### Sample Response
|
|
|
|
|
|
|
|
|
|
This returns a JSON-encoded object indicating the attempt nonce, and completion
|
|
|
|
|
status, and the encoded root token, if the attempt is complete.
|
|
|
|
|
|
|
|
|
|
```json
|
|
|
|
|
{
|
|
|
|
|
"started": true,
|
|
|
|
|
"nonce": "2dbd10f1-8528-6246-09e7-82b25b8aba63",
|
|
|
|
|
"progress": 3,
|
|
|
|
|
"required": 3,
|
|
|
|
|
"pgp_fingerprint": "",
|
|
|
|
|
"complete": true,
|
2017-11-14 11:13:11 +00:00
|
|
|
|
"encoded_token": "FPzkNBvwNDeFh4SmGA8c+w=="
|
2017-03-15 06:40:33 +00:00
|
|
|
|
}
|
|
|
|
|
```
|