Skip to content

Commit 71449ee

Browse files
schavismpronkevin-loehfelmpreetibhat6
authored
[BACKPORT] Manual cherry-pick of failed release/1.13.x backport PRs (#26798)
* Fix "auto unseal" case inconsistency (#25119) There was inconsistency in the capitalization of auto unseal in this doc. The initial heading had it right. It shouldn't be capitalized according to the documentation style guidance for feature capitalization. Also, high availability doesn't need to be capitalized. Change warning to tag syntax so it's clear what should be part of the aside --------- Co-authored-by: Sarah Chavis <62406755+schavis@users.noreply.github.com> * added documentation for mongodb atlas database secrets engine eventua… (#24152) * added documentation for mongodb atlas database secrets engine eventual consistency * Update events.mdx (#25835) Added missing ' to the command at the end * Add missing beta partial * Add another missing partial --------- Co-authored-by: Mitch Pronschinske <mpronschinske@hashicorp.com> Co-authored-by: kevin-loehfelm <37027455+kevin-loehfelm@users.noreply.github.com> Co-authored-by: preetibhat6 <139800125+preetibhat6@users.noreply.github.com>
1 parent f7bffcc commit 71449ee

File tree

6 files changed

+168
-18
lines changed

6 files changed

+168
-18
lines changed

changelog/24152.txt

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
```release-note:improvement
2+
website/docs: Add note about eventual consietency with the MongoDB Atlas database secrets engine
3+
```

website/content/docs/concepts/events.mdx

+2-2
Original file line numberDiff line numberDiff line change
@@ -132,8 +132,8 @@ By default, the events are delivered in protobuf binary format.
132132
The endpoint can also format the data as JSON if the `json` query parameter is set to `true`:
133133

134134
```shell-session
135-
$ wscat -H "X-Vault-Token: $(vault print token)" --connect 'ws://127.0.0.1:8200/v1/sys/events/subscribe/kv-v2/data-write?json=true
136-
{"id":"901f2388-aabb-a385-7bc0-0b09d5fa060b","source":"https://vaultproject.io/","specversion":"1.0","type":"*","data":{"event":{"id":"901f2388-aabb-a385-7bc0-0b09d5fa060b","metadata":{"current_version":"1","oldest_version":"0","path":"data/foo"}},"event_type":"kv-v2/data-write","plugin_info":{"mount_class":"secret","mount_accessor":"kv_a6081d01","mount_path":"secret/","plugin":"kv"}},"datacontentype":"application/cloudevents","time":"2023-02-17T13:11:39.227341-08:00"}
135+
$ wscat -H "X-Vault-Token: $(vault print token)" --connect 'ws://127.0.0.1:8200/v1/sys/events/subscribe/kv-v2/data-write?json=true'
136+
{"id":"a3be9fb1-b514-519f-5b25-b6f144a8c1ce","source":"vault://mycluster","specversion":"1.0","type":"*","data":{"event":{"id":"a3be9fb1-b514-519f-5b25-b6f144a8c1ce","metadata":{"current_version":"1","data_path":"secret/data/foo","modified":"true","oldest_version":"0","operation":"data-write","path":"secret/data/foo"}},"event_type":"kv-v2/data-write","plugin_info":{"mount_class":"secret","mount_accessor":"kv_5dc4d18e","mount_path":"secret/","plugin":"kv"}},"datacontentype":"application/cloudevents","time":"2023-09-12T15:19:49.394915-07:00"}
137137
...
138138
```
139139

website/content/docs/concepts/seal.mdx

+90-15
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ access to the root key shares.
8585

8686
## Auto unseal
8787

88-
Auto Unseal was developed to aid in reducing the operational complexity of
88+
Auto unseal was developed to aid in reducing the operational complexity of
8989
keeping the unseal key secure. This feature delegates the responsibility of
9090
securing the unseal key from users to a trusted device or service. At startup
9191
Vault will connect to the device or service implementing the seal and ask it
@@ -110,10 +110,13 @@ that would be provided with Shamir. The process remains the same.
110110
For a list of examples and supported providers, please see the
111111
[seal documentation](/vault/docs/configuration/seal).
112112

113-
-> **Warning:** Recovery keys cannot decrypt the root key, and thus are not
114-
sufficient to unseal Vault if the Auto Unseal mechanism isn't working. They
115-
are purely an authorization mechanism. Using Auto Unseal
116-
creates a strict Vault lifecycle dependency on the underlying seal mechanism.
113+
When DR replication is enabled in Vault Enterprise, [Performance Standby](/vault/docs/enterprise/performance-standby) nodes on the DR cluster will seal themselves, so they must be restarted to be unsealed.
114+
115+
<Warning title="Recovery keys cannot decrypt the root key">
116+
117+
Recovery keys cannot decrypt the root key and thus are not sufficient to unseal
118+
Vault if the auto unseal mechanism isn't working. They are purely an authorization mechanism.
119+
Using auto unseal creates a strict Vault lifecycle dependency on the underlying seal mechanism.
117120
This means that if the seal mechanism (such as the Cloud KMS key) becomes unavailable,
118121
or deleted before the seal is migrated, then there is no ability to recover
119122
access to the Vault cluster until the mechanism is available again. **If the seal
@@ -128,6 +131,7 @@ seal configured independently of the primary, and when properly configured guard
128131
against *some* of this risk. Unreplicated items such as local mounts could still
129132
be lost.
130133

134+
</Warning>
131135

132136
## Recovery key
133137

@@ -188,7 +192,7 @@ API prefix for this operation is at `/sys/rekey-recovery-key` rather than
188192

189193
## Seal migration
190194

191-
The Seal migration process cannot be performed without downtime, and due to the
195+
The seal migration process cannot be performed without downtime, and due to the
192196
technical underpinnings of the seal implementations, the process requires that
193197
you briefly take the whole cluster down. While experiencing some downtime may
194198
be unavoidable, we believe that switching seals is a rare event and that the
@@ -198,15 +202,15 @@ inconvenience of the downtime is an acceptable trade-off.
198202
something goes wrong.
199203

200204
~> **NOTE**: Seal migration operation will require both old and new seals to be
201-
available during the migration. For example, migration from Auto Unseal to Shamir
202-
seal will require that the service backing the Auto Unseal is accessible during
205+
available during the migration. For example, migration from auto unseal to Shamir
206+
seal will require that the service backing the auto unseal is accessible during
203207
the migration.
204208

205-
~> **NOTE**: Seal migration from Auto Unseal to Auto Unseal of the same type is
209+
~> **NOTE**: Seal migration from auto unseal to auto unseal of the same type is
206210
supported since Vault 1.6.0. However, there is a current limitation that
207211
prevents migrating from AWSKMS to AWSKMS; all other seal migrations of the same
208-
type are supported. Seal migration from One Auto Unseal type (AWS KMS) to
209-
different Auto Unseal type (HSM, Azure KMS, etc.) is also supported on older
212+
type are supported. Seal migration from one auto unseal type (AWS KMS) to
213+
different auto unseal type (HSM, Azure KMS, etc.) is also supported on older
210214
versions as well.
211215

212216
### Migration post Vault 1.5.1
@@ -253,7 +257,7 @@ any storage backend.
253257
1. Seal migration is now completed. Take down the old active node, update its
254258
configuration to use the new seal blocks (completely unaware of the old seal type)
255259
,and bring it back up. It will be auto-unsealed if the new seal is one of the
256-
Auto seals, or will require unseal keys if the new seal is Shamir.
260+
auto seals, or will require unseal keys if the new seal is Shamir.
257261

258262
1. At this point, configuration files of all the nodes can be updated to only have the
259263
new seal information. Standby nodes can be restarted right away and the active
@@ -277,7 +281,7 @@ keys.
277281

278282
#### Migration from auto unseal to shamir
279283

280-
To migrate from Auto Unseal to Shamir keys, take your server cluster offline
284+
To migrate from auto unseal to Shamir keys, take your server cluster offline
281285
and update the [seal configuration](/vault/docs/configuration/seal) and add `disabled
282286
= "true"` to the seal block. This allows the migration to use this information
283287
to decrypt the key but will not unseal Vault. When you bring your server back
@@ -290,9 +294,9 @@ will be migrated to be used as unseal keys.
290294

291295
~> **NOTE**: Migration between same Auto Unseal types is supported in Vault
292296
1.6.0 and higher. For these pre-1.5.1 steps, it is only possible to migrate from
293-
one type of Auto Unseal to a different type (ie Transit -> AWSKMS).
297+
one type of auto unseal to a different type (ie Transit -> AWSKMS).
294298

295-
To migrate from Auto Unseal to a different Auto Unseal configuration, take your
299+
To migrate from auto unseal to a different auto unseal configuration, take your
296300
server cluster offline and update the existing [seal
297301
configuration](/vault/docs/configuration/seal) and add `disabled = "true"` to the seal
298302
block. Then add another seal block to describe the new seal.
@@ -315,3 +319,74 @@ When the quorum of nodes are back up, Raft will elect a leader and the leader
315319
node that will perform the migration. The migrated information will be replicated to
316320
all other cluster peers and when the peers eventually become the leader,
317321
migration will not happen again on the peer nodes.
322+
323+
## Seal high availability <EnterpriseAlert inline="true" />
324+
325+
@include 'alerts/beta.mdx'
326+
327+
Seal high availability (Seal HA) allows the configuration of more than one auto
328+
seal mechanism such that Vault can tolerate the temporary loss of a seal service
329+
330+
or device for a time. With Seal HA configured with at least two and no more than
331+
three auto seals, Vault can also start up and unseal if one of the
332+
configured seals is still available (though Vault will remain in a degraded mode in
333+
this case). While seals are unavailable, seal wrapping and entropy augmentation can
334+
still occur using the remaining seals, and values produced while a seal is down will
335+
be re-wrapped with all the seals when all seals become healthy again.
336+
337+
An operator should choose two seals that are unlikely to become unavailable at the
338+
same time. For example, they may choose KMS keys in two cloud regions, from
339+
two different providers; or a mix of HSM, KMS, or Transit seals.
340+
341+
When an operator configures an additional seal or removes a seal (one at a time)
342+
and restarts Vault, Vault will automatically detect that it needs to re-wrap
343+
CSPs and seal wrapped values, and will start the process. Seal re-wrapping can
344+
be monitored via the logs or via the `sys/seal-status` endpoint. While a
345+
re-wrap is in progress (or could not complete successfully), changes to the
346+
seal configuration are not allowed.
347+
348+
In additional to high availability, seal HA can be used to migrate between two
349+
auto seals in a simplified manner. To migrate in this way:
350+
351+
In additional to high availability, Seal HA can be used to migrate between two
352+
auto seals in a [simplified manner.](#migration-post-vault-1-16-0-via-seal-ha-for-auto-seals-enterprise)
353+
354+
Note that Shamir seals are not auto seals and cannot be included in a Seal
355+
HA setup. This is because auto seals support seal wrap while Shamir seals
356+
do not, so the loss of the auto seal does not necessarily leave Vault in a
357+
fully available state.
358+
359+
### Use and Configuration
360+
361+
Refer to the [configuration](/vault/docs/configuration/seal/seal-ha) section
362+
for details on configuring Seal HA.
363+
364+
### Seal Re-Wrapping
365+
366+
Whenever seal configuration changes, Vault must re-wrap all CSPs and seal
367+
wrapped values, to ensure each value has an entry encrypted by all configured
368+
seals. Vault detects these configuration changes automatically, and triggers
369+
a re-wrap. Re-wraps can take some time, depending on the number of
370+
seal wrapped values. While re-wrapping is in progress, no configuration changes
371+
to the seals can be made.
372+
373+
Progress of the re-wrap can be monitored using
374+
the [`sys/sealwrap/rewrap`](/vault/api-docs/system/sealwrap-rewrap) endpoint.
375+
376+
### Limitations and Known Issues
377+
378+
In order to limit complexity and increase safety, there are some limitations
379+
to the use and configuration of Seal HA:
380+
381+
* Vault must be configured for a single seal at the time of initialization.
382+
Extra seals can then be added.
383+
* Seals must be added or removed one at a time.
384+
* Only auto seals can be used in HA configurations. Shamir and auto cannot
385+
be mixed.
386+
* A maximum of three seals can be configured.
387+
* As seal wrapped values must be wrapped by all configured seals, it is possible
388+
that large values may fail to persist as the size of the entry is multiplied by
389+
the number of seals causing it to exceed the storage entry size limit. An example
390+
would be storing a large document in KVv2 with seal wrapping enabled.
391+
* It is not possible to rotate the data encryption key nor the recovery keys while
392+
unless all seals are healthy.

website/content/docs/secrets/databases/mongodbatlas.mdx

+63-1
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,69 @@ the proper permissions, it can generate credentials.
7373
lease_duration 1h
7474
lease_renewable true
7575
password FBYwnnh-fwc0quxtKf11
76-
username v-my-role-DKbQEg6uRn
76+
username v-my-password-role-DKbQEg6uRn
77+
```
78+
79+
Each invocation of the command generates a new credential.
80+
81+
MongoDB Atlas database credentials eventually become consistent when the
82+
[MongoDB Atlas Admin API](https://www.mongodb.com/docs/atlas/reference/api-resources-spec/v2/)
83+
coordinates with hosted clusters in your Atlas project. You cannot use the
84+
credentials successfully until the consistency process completes.
85+
86+
If you plan to use MongoDB Atlas credentials in a pipeline, you may need to add
87+
a time delay or secondary process to account for the time required to establish consistency.
88+
89+
#### Client certificate credentials
90+
91+
1. Configure a role that maps a name in Vault to a MongoDB Atlas command that executes and
92+
creates the X509 type database user credential:
93+
94+
```shell-session
95+
$ vault write database/roles/my-dynamic-certificate-role \
96+
db_name=my-mongodbatlas-database \
97+
creation_statements='{"database_name": "$external", "x509Type": "CUSTOMER", "roles": [{"databaseName":"<db_name>","roleName":"readWrite"}]}' \
98+
default_ttl="1h" \
99+
max_ttl="24h" \
100+
credential_type="client_certificate" \
101+
credential_config=ca_cert="$(cat path/to/ca_cert.pem)" \
102+
credential_config=ca_private_key="$(cat path/to/private_key.pem)" \
103+
credential_config=key_type="rsa" \
104+
credential_config=key_bits=2048 \
105+
credential_config=signature_bits=256 \
106+
credential_config=common_name_template="{{.DisplayName}}_{{.RoleName}}_{{unix_time}}"
107+
Success! Data written to: database/roles/my-dynamic-certificate-role
108+
```
109+
110+
1. Generate a new credential by reading from the `/creds` endpoint with the name
111+
of the role:
112+
113+
```shell-session
114+
$ vault read database/creds/my-dynamic-certificate-role
115+
Key Value
116+
--- -----
117+
request_id b6556b2d-c379-5a92-465d-6597c506c821
118+
lease_id database/creds/my-dynamic-certificate-role/AZ5tao6NjLJctx7fm1bujKEL
119+
lease_duration 1h
120+
lease_renewable true
121+
client_certificate -----BEGIN CERTIFICATE-----
122+
...
123+
-----END CERTIFICATE-----
124+
private_key -----BEGIN PRIVATE KEY-----
125+
...
126+
-----END PRIVATE KEY-----
127+
private_key_type rsa
128+
username CN=token_my-dynamic-certificate-role_1677262121
129+
```
130+
131+
## Client certificate authentication
132+
133+
MongoDB Atlas supports [X.509 client certificate based authentication](https://www.mongodb.com/docs/manual/tutorial/configure-x509-client-authentication/)
134+
for enhanced authentication security as an alternative to username and password authentication.
135+
The MongoDB Atlas database plugin can be used to manage client certificate credentials for
136+
MongoDB Atlas users by using `client_certificate` [credential_type](/vault/api-docs/secret/databases#credential_type).
137+
138+
See the [usage](/vault/docs/secrets/databases/mongodbatlas#usage) section for examples using dynamic roles.
77139

78140
## API
79141

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<Note title="Beta feature">
2+
3+
Beta functionality is stable but possibly incomplete and subject to change.
4+
**We strongly discourage using beta features in production deployments of Vault**
5+
6+
</Note>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<EnterpriseAlert product="vault">
2+
<a href="https://www.hashicorp.com/products/vault/pricing">Vault Enterprise</a>
3+
&nbsp; license required
4+
</EnterpriseAlert>

0 commit comments

Comments
 (0)