Skip to content
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

Unable to skip CA certificate in TLS config #1617

Open
marnixbouhuis opened this issue Sep 12, 2024 · 5 comments
Open

Unable to skip CA certificate in TLS config #1617

marnixbouhuis opened this issue Sep 12, 2024 · 5 comments

Comments

@marnixbouhuis
Copy link

Hey, we are deploying a mongodb cluster that needs to be reachable from outside the cluster over TLS. For this we want to use certificates provisioned using ACME / cert-bot and LetsEncrypt.

When configuring TLS we get the error saying:

TLS field requires a reference to the CA certificate which signed the server certificates. Neither secret (field caCertificateSecretRef) not configMap (field CaConfigMap) reference present

This error was introduced in this PR: #1119

According to this issue the caConfigMap and caCertificateSecret should both be optional: #519

Since we are using ACME / LetsEncrypt we do not have the CA certificate in a secret.

@phajduk
Copy link

phajduk commented Sep 13, 2024

@marnixbouhuis I can confirm we have the same problem. I will comment more: MongoDB Kubernetes Operator suggests using cert-manager.io to manage certs. As described in their tutorial it's doable to generate LetsEncrypt certificate key using cert-manager.
Without fixing the problem @marnixbouhuis reported we can't easily integrate MongoDB with LetsEncrypt issued certificates.
@dan-mckean any ideas how we should prioritize this? Mentioned PR addressed issue #1114 and #1054 but making CA file mandatory is not the proper fix if certificate is signed by trusted authority as LetsEncrypt.
cc: @adamliesko @slaskawi

@fealebenpae
Copy link
Collaborator

Using Let's Encrypt-issued certificates with a database cluster deployed by the MongoDB Community Operator won't work, unfortunately, even if you were to work around the requirement for a CA certificate.

The issue is that the TLS certificate is validated both by clients connecting from outside the Kubernetes cluster using the replica set horizon hostnames defined in the MongoDBCommunity resource, and by clients within the Kubernetes cluster (including other mongod replica set members talking to each other) which use the Kubernetes cluster DNS to resolve the mongod pods. That's why in the cert-manager example the Certificate resource lists both the external DNS names but also the in-cluster DNS names that resolve to the individual mongod pods within the database cluster. Let's Encrypt will refuse to issue a certificate for the .svc.cluster.local domain and if you attempt to use a certificate with only the external domains then intra-cluster communication will break down.

@phajduk
Copy link

phajduk commented Sep 23, 2024

@fealebenpae you're right. This is why this ticket is a bit more wide.

func getDomain(service, namespace, clusterName string) string {
this function should allow to return non cluster.local domain.

@fealebenpae
Copy link
Collaborator

It's possible to override this with the MongoDB Enterprise operator by setting the spec.externalAccess.externalDoman field on the MongoDB resource. I suppose we can consider backporting this behavior to the Community operator.

@phajduk
Copy link

phajduk commented Oct 29, 2024

Do we have any timeline for this? @fealebenpae @dan-mckean @slaskawi

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants