-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Tom Morelly
committed
Nov 13, 2023
1 parent
b5345b1
commit 162a884
Showing
29 changed files
with
483 additions
and
111 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
# Generate Root | ||
Using the unseal-keys we can regenarate a root token | ||
|
||
## Revoke Root | ||
|
||
```bash | ||
$> vault token revoke $VAULT_TOKEN | ||
Success! Revoked token (if it existed) | ||
$> vault kv get esm/secrets | ||
Error making API request. | ||
|
||
URL: GET https://127.0.0.1/v1/sys/internal/ui/mounts/esm/secrets | ||
Code: 403. Errors: | ||
``` | ||
|
||
## Generate Root | ||
|
||
```bash | ||
# init generate-root process | ||
$> vault operator generate-root -init | ||
A One-Time-Password has been generated for you and is shown in the OTP field. | ||
You will need this value to decode the resulting root token, so keep it safe. | ||
Nonce b024b19a-723d-3ec1-1d26-cf30c680d068 # important | ||
Started true | ||
Progress 0/3 | ||
Complete false | ||
OTP MQHg64qQAHXlOWKJHJFkXBIIisG7 # important | ||
OTP Length 28 | ||
|
||
# because there is no tty, we have to speciy a nonce, and the unseal key via STDIN | ||
$> NONCE=b024b19a-723d-3ec1-1d26-cf30c680d068; for v in $(tf output -json unseal_keys | jq -r '.[]'); do VAULT_ADDR="https://127.0.0.1:8001" echo $v | vault operator generate-root -nonce=$NONCE -; done | ||
Nonce b024b19a-723d-3ec1-1d26-cf30c680d068 | ||
Started true | ||
Progress 1/3 | ||
Complete false | ||
Nonce b024b19a-723d-3ec1-1d26-cf30c680d068 | ||
Started true | ||
Progress 2/3 | ||
Complete false | ||
Nonce b024b19a-723d-3ec1-1d26-cf30c680d068 | ||
Started true | ||
Progress 3/3 | ||
Complete true | ||
Encoded Token JSc7SQd7KyV5GwsLBT4oKwcQIDsvKjEgEBsKfw # important | ||
|
||
# decode token using the OTP | ||
$> vault operator generate-root -decode JSc7SQd7KyV5GwsLBT4oKwcQIDsvKjEgEBsKfw -otp MQHg64qQAHXlOWKJHJFkXBIIisG7 | ||
hvs.1OZt8SSgJicaOZfPwhxiyhMH | ||
``` | ||
## Verify | ||
```bash | ||
$> VAULT_TOKEN=hvs.1OZt8SSgJicaOZfPwhxiyhMH vault token lookup | ||
Key Value | ||
--- ----- | ||
accessor WyUkIqrs4YOehRpv6d7Pn0Oe | ||
creation_time 1699878520 | ||
creation_ttl 0s | ||
display_name root | ||
entity_id n/a | ||
expire_time <nil> | ||
explicit_max_ttl 0s | ||
id hvs.1OZt8SSgJicaOZfPwhxiyhMH | ||
meta <nil> | ||
num_uses 0 | ||
orphan true | ||
path auth/token/root | ||
policies [root] # root token | ||
ttl 0s | ||
type service | ||
``` | ||
# Resources | ||
* [https://developer.hashicorp.com/vault/tutorials/operations/generate-root](https://developer.hashicorp.com/vault/tutorials/operations/generate-root) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
# Rekeying Vault | ||
|
||
You can generate a new unseal keys using the following snippet: | ||
|
||
```bash | ||
# start rekey process with 3 shares and 2 threshold | ||
$> vault operator rekey -init -key-shares=3 -key-threshold=2 | ||
WARNING! If you lose the keys after they are returned, there is no recovery. | ||
Consider canceling this operation and re-initializing with the -pgp-keys flag | ||
to protect the returned unseal keys along with -backup to allow recovery of | ||
the encrypted keys in case of emergency. You can delete the stored keys later | ||
using the -delete flag. | ||
|
||
Key Value | ||
--- ----- | ||
Nonce 91365630-524b-dfce-cf2b-ed777db412d8 | ||
Started true | ||
Rekey Progress 0/3 | ||
New Shares 3 | ||
New Threshold 2 | ||
Verification Required false | ||
|
||
# because there is no tty, we have to speciy a nonce, and the unseal key via STDIN | ||
$> NONCE=91365630-524b-dfce-cf2b-ed777db412d8; for v in $(tf output -json unseal_keys | jq -r '.[]'); do VAULT_ADDR="https://127.0.0.1:8001" echo $v | vault operator rekey -nonce=$NONCE -; done | ||
Key Value | ||
--- ----- | ||
Nonce 91365630-524b-dfce-cf2b-ed777db412d8 | ||
Started true | ||
Rekey Progress 1/3 | ||
New Shares 3 | ||
New Threshold 2 | ||
Verification Required false | ||
Key Value | ||
--- ----- | ||
Nonce 91365630-524b-dfce-cf2b-ed777db412d8 | ||
Started true | ||
Rekey Progress 2/3 | ||
New Shares 3 | ||
New Threshold 2 | ||
Verification Required false | ||
|
||
Key 1: /jkk9//ZEqDoEqXsf3NDRu4R+gIF1tZ9WdN5QrSt0odX # unseal key 1 | ||
Key 2: HroWSiYp5EySPA2rz94f4wg3fCE7GiMTaIIIWmrtsZeT # unseal key 2 | ||
Key 3: LVse36NDsANEEeAW2hJFjgW7vIxP52hBf1hgoi2SY87P # unseal key 3 | ||
|
||
Operation nonce: 91365630-524b-dfce-cf2b-ed777db412d8 | ||
|
||
Vault unseal keys rekeyed with 3 key shares and a key threshold of 2. Please | ||
securely distribute the key shares printed above. When Vault is re-sealed, | ||
restarted, or stopped, you must supply at least 2 of these keys to unseal it | ||
before it can start servicing requests. | ||
``` |
Oops, something went wrong.