diff --git a/builtin/logical/transit/path_datakey.go b/builtin/logical/transit/path_datakey.go index 43652733a3..b4499d45e6 100644 --- a/builtin/logical/transit/path_datakey.go +++ b/builtin/logical/transit/path_datakey.go @@ -32,8 +32,8 @@ ciphertext; "wrapped" will return the ciphertext only.`, "bits": &framework.FieldSchema{ Type: framework.TypeInt, - Description: `Number of bits for the key; currently 128 and -256 are supported. Defaults to 256.`, + Description: `Number of bits for the key; currently 128, 256, +and 512 bits are supported. Defaults to 256.`, Default: 256, }, }, diff --git a/builtin/logical/transit/path_keys.go b/builtin/logical/transit/path_keys.go index 7c6d1d1573..44d3f18ab7 100644 --- a/builtin/logical/transit/path_keys.go +++ b/builtin/logical/transit/path_keys.go @@ -68,10 +68,11 @@ func pathPolicyRead( // Return the response resp := &logical.Response{ Data: map[string]interface{}{ - "name": p.Name, - "cipher_mode": p.CipherMode, - "derived": p.Derived, - "deletion_allowed": p.DeletionAllowed, + "name": p.Name, + "cipher_mode": p.CipherMode, + "derived": p.Derived, + "deletion_allowed": p.DeletionAllowed, + "min_decryption_version": p.MinDecryptionVersion, }, } if p.Derived { diff --git a/website/source/docs/secrets/transit/index.html.md b/website/source/docs/secrets/transit/index.html.md index b002a7667a..567a3182c1 100644 --- a/website/source/docs/secrets/transit/index.html.md +++ b/website/source/docs/secrets/transit/index.html.md @@ -21,14 +21,44 @@ application developers and pushes the burden onto the operators of Vault. Operators of Vault generally include the security team at an organization, which means they can ensure that data is encrypted/decrypted properly. -As of Vault 0.2, the transit backend also supports doing key derivation. This -allows data to be encrypted within a context such that the same context must be -used for decryption. This can be used to enable per transaction unique keys which -further increase the security of data at rest. - Additionally, since encrypt/decrypt operations must enter the audit log, any decryption event is recorded. +Due to Vault's flexible ACLs, other interesting use-cases are possible. For +instance, one set of Internet-facing servers can be given permission to encrypt +with a named key but not decrypt with it; a separate set of servers not +directly connected to the Internet can then perform decryption, reducing the +data's attack surface. + +As of Vault 0.2, the transit backend supports doing key derivation. This +allows data to be encrypted within a context such that the same context must be +used for decryption. This can be used to enable per-transaction unique keys which +further increase the security of data at rest. + +As of Vault 0.3, the transit backend gained two new key features: key rotation +and datakey generation. + +Key rotation allows a new version of the named key to be generated. All data +encrypted with the key will use the newest version of the key; previously +encrypted data can be decrypted using old versions of the key. Administrators +can control which previous versions of a key are available for decryption, to +prevent an attacker gaining an old copy of ciphertext to be able to successfully +decrypt it. At any time, a legitimate user can "rewrap" the data, providing an +old version of the ciphertext and receiving a new version encrypted with the +latest key. Because rewrapping does not expose the plaintext, using Vault's ACL +system, this can even be safely performed by unprivileged users or cron jobs. + +Datakey generation allows processes to request a high-entropy key of a given +bit length be returned to them, encrypted with the named key. Normally this will +also return the key in plaintext to allow for immediate use, but this can be +disabled to accommodate auditing requirements. + +N.B.: As part of adding rotation support, the initial version of a named key +now produces ciphertext starting with version 1, i.e. containing `:v1:`. +Existing keys, when rotated, will jump to version 2 despite their previous +ciphertext output containing `:v0:`. Decryption, however, treats version 0 and +version 1 the same, so old ciphertext will still work. + This page will show a quick start for this backend. For detailed documentation on every path, use `vault path-help` after mounting the backend. @@ -68,7 +98,7 @@ endpoint using our named key: ``` $ echo -n "the quick brown fox" | base64 | vault write transit/encrypt/foo plaintext=- Key Value -ciphertext vault:v0:czEwyKqGZY/limnuzDCUUe5AK0tbBObWqeZgFqxCuIqq7A84SeiOq3sKD0Y/KUvv +ciphertext vault:v1:czEwyKqGZY/limnuzDCUUe5AK0tbBObWqeZgFqxCuIqq7A84SeiOq3sKD0Y/KUvv ``` The encryption endpoint expects the plaintext to be provided as a base64 encoded @@ -79,7 +109,7 @@ is free to store the ciphertext in a database or file at rest. To decrypt, we simply use the decrypt endpoint using the same named key: ``` -$ vault write transit/decrypt/foo ciphertext=vault:v0:czEwyKqGZY/limnuzDCUUe5AK0tbBObWqeZgFqxCuIqq7A84SeiOq3sKD0Y/KUvv +$ vault write transit/decrypt/foo ciphertext=vault:v1:czEwyKqGZY/limnuzDCUUe5AK0tbBObWqeZgFqxCuIqq7A84SeiOq3sKD0Y/KUvv Key Value plaintext dGhlIHF1aWNrIGJyb3duIGZveAo= @@ -133,8 +163,9 @@ only encrypt or decrypt using the named keys they need access to.