Skip to content

Commit 6db159e

Browse files
RUBY-2989 Obtain AWS credentials for CSFLE (#2605)
1 parent ecb5cc5 commit 6db159e

File tree

3 files changed

+56
-2
lines changed

3 files changed

+56
-2
lines changed

source/reference/authentication.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -328,6 +328,8 @@ The temporary credentials can also be provided via a URI:
328328
client = Mongo::Client.new(
329329
'mongodb://<AWS-ACCESS-KEY-ID>:<AWS-SECRET-ACCESS-KEY>@mongodb.example.com/mydb?authMechanism=MONGODB-AWS&authMechanismProperties=AWS_SESSION_TOKEN:<AWS-SESSION-TOKEN>')
330330

331+
.. _auto-retrieve-aws-credentials:
332+
331333
Automatically Retrieving Credentials
332334
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
333335

@@ -475,7 +477,7 @@ for more information.
475477

476478
# Authenticate as appuser@MYREALM:
477479
client = Mongo::Client.new("mongodb://appuser%[email protected]:27017/mydb?authMechanism=GSSAPI")
478-
480+
479481
# Authenticate as myapp/appuser@MYREALM:
480482
client = Mongo::Client.new("mongodb://myapp%2Fappuser%[email protected]:27017/mydb?authMechanism=GSSAPI")
481483

source/reference/client-side-encryption.txt

Lines changed: 42 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -853,7 +853,7 @@ There is no default key vault namespace, and this option must be provided.
853853
``:kms_providers``
854854
~~~~~~~~~~~~~~~~~~
855855

856-
A Hash that contains KMP provider names as keys, and provider options as values.
856+
A Hash that contains KMS provider names as keys, and provider options as values.
857857

858858
.. code-block:: ruby
859859

@@ -864,11 +864,52 @@ A Hash that contains KMP provider names as keys, and provider options as values.
864864
aws: {
865865
access_key_id: 'IAM-ACCESS-KEY-ID',
866866
secret_access_key: 'IAM-SECRET-ACCESS-KEY'
867+
},
868+
azure: {
869+
tenant_id: 'AZURE-TENANT-ID',
870+
client_id: 'AZURE-CLIENT-ID',
871+
client_secret: 'AZURE-CLIENT-SECRET'
872+
},
873+
gcp: {
874+
email: 'GCP-EMAIL',
875+
# :private_key value should be GCP private key as base64 encoded
876+
# DER RSA private key, or PEM RSA private key, if you are using MRI Ruby.
877+
private_key: 'GCP-PRIVATE-KEY',
878+
},
879+
kmip: {
880+
# KMIP server endpoint may include port.
881+
endpoint: 'KMIP-SERVER-HOST'
882+
},
883+
# TLS options to connect to KMIP server.
884+
kms_tls_options: {
885+
kmip: {
886+
ssl_ca_cert: 'PATH-TO-CA-FILE',
887+
ssl_cert: 'PATH-TO-CLIENT-CERT-FILE',
888+
ssl_key: 'PATH-TO-CLIENT-KEY-FILE'
889+
}
867890
}
868891
}
869892
}
870893
)
871894

895+
The client can retrieve AWS credentials from the environment or from EC2 or ECS
896+
metadata endpoints. To retrieve credentials automatically, specify an empty Hash
897+
as KMS provider options for AWS:
898+
899+
.. code-block:: ruby
900+
901+
Mongo::Client.new(['localhost:27017'],
902+
auto_encryption_options: {
903+
key_vault_namespace: 'encryption.__keyVault',
904+
kms_providers: {
905+
aws: {}
906+
}
907+
}
908+
)
909+
910+
See :ref:`"Automatically Retrieving Credentials" <auto-retrieve-aws-credentials>`
911+
for more detailed information about the credential retrieval.
912+
872913
``:kms_tls_options``
873914
~~~~~~~~~~~~~~~~~~~~
874915

source/release-notes.txt

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,17 @@ for the complete list of changes, including those internal to the driver and
1818
its test suite.
1919

2020

21+
.. _release-notes-2.19:
22+
23+
2.19
24+
====
25+
26+
This release includes the following new features:
27+
28+
- Added support for automatic AWS credentials retrieval when AWS KMS is used for
29+
client side encryption.
30+
31+
2132
.. _release-notes-2.18:
2233

2334
2.18

0 commit comments

Comments
 (0)