Fixed MongoDB insecureSkipVerify, Added MongoDB TLS certificate, ca, key #309
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
1. Inconsistent TLS configuration: To configure TLS for MongoDB, the readme.md said change the
auth_opt_mongo_with_tls
option to enable TLS, but in the backends/mongo.go file readmongo_use_tls
which meansauth_opt_mongo_use_tls
So I changed the configuration option key from
mongo_use_tls
tomongo_tls
to be related to other TLS settings.2. insecureSkipVerify defined but never used: It was defined in both doc (readme.md) and backends/mongo.go, but it was never called to be a part of connection configuration.
lead to the error below when trying to connect with self-signed SSL certificate:
3. MongoDB Custom Certificates:
From the document MongoDB - Go Driver:
"To successfully initiate a TLS request, your application must present cryptographic certificates to prove its identity. Your application's certificates must be stored as PEM files to enable TLS when connecting."
So, I added the options to pass certificate paths to the module to complete a TLS connection through:
auth_opt_mongo_tlsca
for TLS Certificate Authority (CA)auth_opt_mongo_tlscert
for TLS Client Certificateauth_opt_mongo_tlskey
for TLS Client Certificate Private Key