Create
Make the key of a nats vault.
The command writes a new random AES-256 key to the key_file of the vault in
controller.secrets.vaults, with the mode 0600. The vault encrypts each value
with this key. The command does not replace a key that exists, because each
value under it would then not decrypt. Use rotate for that. It prints the ID
of the key, not the key. The controller makes the key at start when the file is
not there, so run this only to make the key before that.
osapi controller secret key create [flags]
Examples
osapi controller secret key create --vault default
Result
The command prints:
$ osapi controller secret key create --vault default Vault key: Name: default Key file: /etc/osapi/secrets.key Key ID: 3f9a1c0e7b2d4a58
With --json, the command prints:
{
"name": "default",
"key_file": "/etc/osapi/secrets.key",
"key_id": "3f9a1c0e7b2d4a58"
}
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.