I am trying to connect to mongo using Java driver with X509 auth with the tls options.
https://www.mongodb.com/docs/manual/reference/connection-string/#tls-options
tls=true&tlsCertificateKeyFile=local.pem&tlsCertificateKeyFilePassword=
But, getting the warning.
2022-05-27T17:16:17.985Z WARN main org.mongodb.driver.uri Connection string contains unsupported option 'tlscafile'.
2022-05-27T17:16:17.985Z WARN main org.mongodb.driver.uri Connection string contains unsupported option 'tlscertificatekeyfilepassword'.
2022-05-27T17:16:17.986Z WARN main org.mongodb.driver.uri Connection string contains unsupported option 'tlscertificatekeyfile'.
Is this not supported yet in the driver?
CodePudding user response:
These options are not supported via java connection string. See https://jira.mongodb.org/browse/JAVA-3066.
Options the driver can't implement (Because TLS is configured in Java via system properties. Applications that want this behavior have to configure either those system properties or provide a custom SslContext to the driver via settings):
tlsAllowInvalidCertificates
tlsCAFile
tlsCertificateKeyFile
tlsCertificateKeyFilePassword
I'm not familar with java itself, but the description says that you should configure SslContext or system properties. UPDATE: See here about how it can be configured.