Hello,
I’m trying to connect to an external database for my self-hosted Squidex project, which requires the use of a certificate. I have configured the environment variables as follows:
- name: EVENTSTORE__MONGODB__CONFIGURATION
value: “mongodb://test:password@rc1c-external-cloud.net:27018?tls=true&tlsCAFile=/certs/mongodb/root.crt”
- name: STORE__MONGODB__CONFIGURATION
value: “mongodb://test:password@rc1c-external-cloud.net:27018?tls=true&tlsCAFile=/certs/mongodb/root.crt”
However, this is not working and I am getting the following error:
Unhandled exception. System.TimeoutException: A timeout occurred after 30000ms selecting a server using CompositeServerSelector{ Selectors = ReadPreferenceServerSelector{ ReadPreference = { Mode : Primary } }, LatencyLimitingServerSelector{ AllowedLatencyRange = 00:00:00.0150000 }, OperationsCountServerSelector }. Client view of cluster state is { ClusterId : "1", Type : "Unknown", State : "Disconnected", Servers : [{ ServerId: "{ ClusterId : 1, EndPoint : "Unspecified/rc1c-external-cloud.net:27018" }", EndPoint: "Unspecified/rc1c-external-cloud.net:27018", ReasonChanged: "Heartbeat", State: "Disconnected", ServerVersion: , TopologyVersion: , Type: "Unknown", HeartbeatException: "MongoDB.Driver.MongoConnectionException: An exception occurred while opening a connection to the server.
---> System.Security.Authentication.AuthenticationException: The remote certificate is invalid because of errors in the certificate chain: UntrustedRoot
at System.Net.Security.SslStream.SendAuthResetSignal(ProtocolToken message, ExceptionDispatchInfo exception)
at System.Net.Security.SslStream.CompleteHandshake(SslAuthenticationOptions sslAuthenticationOptions)
at System.Net.Security.SslStream.ForceAuthenticationAsync[TIOAdapter](Boolean receiveFirst, Byte[] reAuthenticationData, CancellationToken cancellationToken)
at System.Net.Security.SslStream.AuthenticateAsClient(SslClientAuthenticationOptions sslClientAuthenticationOptions)
at MongoDB.Driver.Core.Connections.SslStreamFactory.CreateStream(EndPoint endPoint, CancellationToken cancellationToken)
at MongoDB.Driver.Core.Connections.BinaryConnection.OpenHelper(CancellationToken cancellationToken)
--- End of inner exception stack trace ---
in deployment i have this step:
command: ["sh", "-c", "curl -o /certs/mongodb/root.crt https://storage.some-cloud.net/cloud-certs/CA.pem && chmod 0644 /certs/mongodb/root.crt"]
Any help would be greatly appreciated.