TLS Error when Starting MongoDB


I do have a RapidSSL Certificate (PEM File) and want to use it to encrypt my MongoDB Connection. MongoDB (Standalone) Server is installed on a Ubuntu 22.04 machine.

But once I try to start it using the certificate using this configuration:

# network interfaces 
  port: 27017
   mode: requireTLS
   certificateKeyFile: /etc/ssl/Cert.pem

I´m getting the following error:

{"t":{"$date":"2023-08-14T09:20:54.869+02:00"},"s":"I",  "c":"CONTROL",  "id":20698,   "ctx":"-","msg":"***** SERVER RESTARTED *****"}
{"t":{"$date":"2023-08-14T09:20:54.869+02:00"},"s":"I",  "c":"NETWORK",  "id":4915701, "ctx":"-","msg":"Initialized wire specification","attr":{"spec":{"incomingExternalClient":{"minWireVersion":0,"maxWireVersion":17},"incomingInternalClient":{"minWireVersion":0,"maxWireVersion":17},"outgoing":{"minWireVersion":6,"maxWireVersion":17},"isInternalClient":true}}}
{"t":{"$date":"2023-08-14T09:20:54.869+02:00"},"s":"I",  "c":"CONTROL",  "id":23285,   "ctx":"-","msg":"Automatically disabling TLS 1.0, to force-enable TLS 1.0 specify --sslDisabledProtocols 'none'"}
{"t":{"$date":"2023-08-14T09:20:54.874+02:00"},"s":"E",  "c":"NETWORK",  "id":23251,   "ctx":"-","msg":"Cannot read PEM key","attr":{"keyFile":"/etc/ssl/Cert.pem","error":"error:00000000:lib(0)::reason(0)"}}
{"t":{"$date":"2023-08-14T09:20:54.874+02:00"},"s":"F",  "c":"CONTROL",  "id":20574,   "ctx":"-","msg":"Error during global initialization","attr":{"error":{"code":140,"codeName":"InvalidSSLConfiguration","errmsg":"Can not set up PEM key file."}}}

I´ve checked the certficiate using openssl and it works. Permissions are also set (tried using 777)

You should not give 777
It should have just read permissions
Give 400 and see if it works


@Ramachandra_Tummala wasn´t anything like that.

I´ve checked the certificate file and the CSR was also included. I´ve removed the CSR Code from the certificate and then it worked.

1 Like