MongoDB backups fail with TLS hostname mismatch after Let’s Encrypt rollout (URI host uses container name instead of FQDN) #6377
yashodhank
started this conversation in
Improvement Requests
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Summary
Affected version
Environment
Steps to reproduce
HostSNI
=mongo-<db-id>.<domain>
).Actual behavior
mongodb://root:<REDACTED>@iwso4ssc8s0sk0gggg0wws4o:27017/?directConnection=true&tls=true&tlsCAFile=/etc/mongo/certs/ca.pem
Expected behavior
Root cause analysis
iwso4ssc8s0sk0gggg0wws4o
) as host.mongo-iwso4ssc8s0sk0gggg0wws4o.4d.realdomain.in
), not the container name.Proposed changes (safe defaults + configurability)
HostSNI
rule; else allow a per-database “Backup hostname” override in UI/API.tlsCAFile
when using LE/public CA and rely on system CAs inside the backup runner container.tlsAllowInvalidHostnames=true
to the URI. Default: off.mongodb://<user>:<pass>@<fqdn>:27017/?tls=true&authSource=admin
&directConnection=true
if needed.tlsCAFile=...
for private CAs/self-signed.Acceptance criteria
Security considerations
tlsCAFile
for LE removes brittle mount paths and avoids misconfigured trust anchors.Workarounds (users can apply today)
...@mongo-<db-id>.<domain>:27017/?tls=true&authSource=admin
&tlsAllowInvalidHostnames=true
to the URI used by the backup job.tlsCAFile
and rely on system CAs.Additional context
mongo-<db-id>.<domain>
and forwards to the container name: this is correct and expected.Suggested implementation sketch
hostForBackup
:tls=true
, includesauthSource=admin
, and conditionally addstlsAllowInvalidHostnames
andtlsCAFile
(for private/self-signed only).Repro command (for testing fix)
tlsAllowInvalidHostnames
):mongodump --uri="mongodb://root:<REDACTED>@<container-name>:27017/?tls=true&authSource=admin&tlsAllowInvalidHostnames=true" --archive=/tmp/test.archive.gz --gzip
Thank you! Happy to help test a PR or provide additional logs.
Beta Was this translation helpful? Give feedback.
All reactions