This repository was archived by the owner on Jun 8, 2025. It is now read-only.
Fixed MongoDB insecureSkipVerify, Added MongoDB TLS certificate, ca, key#309
Closed
saharatss wants to merge 2 commits intoiegomez:masterfrom
Closed
Fixed MongoDB insecureSkipVerify, Added MongoDB TLS certificate, ca, key#309saharatss wants to merge 2 commits intoiegomez:masterfrom
saharatss wants to merge 2 commits intoiegomez:masterfrom
Conversation
iegomez
reviewed
Jan 25, 2024
Owner
iegomez
left a comment
There was a problem hiding this comment.
Thanks for this PR!
Could you add some tests to ensure changes are working?
| if m.withTLS { | ||
| opts.TLSConfig = &tls.Config{} | ||
| log.Infof("mongo backend: tls enabled") | ||
| opts.TLSConfig = &tls.Config{ |
Owner
There was a problem hiding this comment.
Could you add new empty lines here and between following if checks to aid readability?
Author
|
I updated the code regarding your comments. It's in my second commit. please check. Now, I am working on the testing script. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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_tlsoption to enable TLS, but in the backends/mongo.go file readmongo_use_tlswhich meansauth_opt_mongo_use_tlsSo I changed the configuration option key from
mongo_use_tlstomongo_tlsto 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_tlscafor TLS Certificate Authority (CA)auth_opt_mongo_tlscertfor TLS Client Certificateauth_opt_mongo_tlskeyfor TLS Client Certificate Private Key