Rotate
Rotate the key of a nats vault.
The command adds a new key to the key_file of the vault, and keeps the old key
for reads. Then it connects to NATS as the controller does, encrypts each value
of the vault again with the new key, and removes the old key from the file. A
controller that runs reads the file at each call, so it needs no restart. If the
rotation stops, the file keeps the old key, and a second rotation completes it.
The earlier versions of a value stay under the old key, and do not decrypt after
the rotation.
osapi controller secret key rotate [flags]
Examples
osapi controller secret key rotate --vault default
Result
The command prints:
$ osapi controller secret key rotate --vault default Vault key: Name: default Key file: /etc/osapi/secrets.key Key ID: a07c5e91d3b8f246 Values: 12
With --json, the command prints:
{
"name": "default",
"key_file": "/etc/osapi/secrets.key",
"key_id": "a07c5e91d3b8f246",
"values": 12
}
Flags
| Flag | Description | Default |
|---|---|---|
--vault | The vault, as controller.secrets.vaults names it, such as default (required) |
Global flags
| Flag | Description | Default |
|---|---|---|
-d, --debug | Enable or disable debug mode | |
-j, --json | Enable JSON output | |
-f, --osapi-file | Path to config file; without one at the default path, osapi runs on the defaults | /etc/osapi/osapi.yaml |
Output tells how the result is printed, and what --json
gives.