-
Notifications
You must be signed in to change notification settings - Fork 23
CLOUDP-356376 Allow Search to work with x509 cluster auth #568
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
MCK 1.6.0 Release NotesNew Features
Bug Fixes
Other Changes
|
| resource["spec"]["security"]["authentication"] = { | ||
| "enabled": True, | ||
| "modes": ["X509", "SCRAM"], | ||
| "agents": {"mode": "X509"}, | ||
| "internalCluster": "X509", | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the only addition to the code already in the e2e_search_enterprise_tls test.
| create_agent_tls_certs(issuer, namespace, mdb.name, "certs") | ||
| create_x509_mongodb_tls_certs(issuer, namespace, mdb.name, f"certs-{mdb.name}-clusterfile") | ||
| create_x509_mongodb_tls_certs(issuer, namespace, mdb.name, f"certs-{mdb.name}-cert", mdb.get_members()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The other change, necessary to populate the secrets expected by the MongoDB CR change above.
| date: 2025-11-03 | ||
| --- | ||
|
|
||
| * **MongoDBSearch**: MongoDB deployments using X509 internal cluster authentication are now supported. Previously MongoDB Search required SCRAM authentication among members of a MongoDB replica set. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's worth mentioning that mongot itself still cannot authenticate using x509, so SCRAM auth must be enabled for clients to connect (but it might be both x509, but SCRAM is mandatory for search)
| f"{mdbs.name}-search", | ||
| replicas=1, | ||
| service_name=search_service_name, | ||
| additional_domains=[f"{search_service_name}.{namespace}.svc.cluster.local"], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this service FQDN actually validated by mongod when connecting to mongot? It should, right?
Also when we switch to L7 our proxy component should probably present the same cert, or at least cert issued for the same service FQDN?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm actually not a 100% if mongod performs hostname validation. I'll comment this out and see what happens.
re. L7 proxies - the proxy will terminate the TLS connection from mongod, and establish its own TLS connection to the mongots it represents. It can use the same TLS certificate as mongot, or its own (though it too will have to be signed by the same CA). We'll sort this out separately with load balancing, however, and adjust as necessary. This is just a copy of the existing TLS test we have.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@lsierant it does seem that when mongod connects to mongot the hostname is validated against mongot's TLS certificate. Commenting out the additional_domains specification here causes the createSearchIndex command to fail with a Error connecting to Search Index Management service message.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
| --- | ||
| kind: feature | ||
| date: 2025-11-03 | ||
| --- | ||
|
|
||
| * **MongoDBSearch**: MongoDB deployments using X509 internal cluster authentication are now supported. Previously MongoDB Search required SCRAM authentication among members of a MongoDB replica set. Note: SCRAM client authentication is still required, this change merely relaxes the requirements on internal cluster authentication. | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
| }, | ||
| // Internal cluster authentication tests | ||
| { | ||
| name: "X509 internal cluster auth not supported", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shouldn't we keep this test case and just verify that we don't throw an error? As I understand there are three options for internalClusterAuth right now:
- SCRAM
- X5909
- empty
Shouldn't we validate if received internalClusterAuth that is outside of the accepted values?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The existing e2e tests cover the SCRAM internal auth cases, and the new e2e test covers x509 so I thought since the Validate method no longer concerns itself with internal cluster auth at all those unit test cases are no longer relevant, but I agree - it costs nothing to have them still.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I proly don't understand completely this change, so let me ask some questions. Basically this change boils down to removing
if r.Spec.Security.GetInternalClusterAuthenticationMode() == util.X509 {
return xerrors.New("MongoDBSearch does not support X.509 internal cluster authentication")
}...and in result allowing to provide x509 internal cluster authentication. Is that correct?
|
@MaciejKaras exactly - not supporting x509 internal cluster authentication was a mongot limitation that was lifted with the change in #527, so this PR just removes our validation check for x509 auth and adds a test. |
Summary
With the switch to gRPC for mongot in #527 it's now possible for Search to be deployed against clusters that use x509 internal authentication. This removes the validation check for the internal cluster authentication mode and adds a new e2e test based on the existing
search_enterprise_tlstest that verifies existing functionality against a x509 cluster.Proof of Work
New test.
Checklist
skip-changeloglabel if not needed