We are using MongoDB 4.0 community version with 1 primary 2 secondary replicaset, we need to do encryption in transit so which one is recommended ssl or tsl ? and what is the difference between ssl and tls ?


TLS (Transport Layer Security) is the successor to the now deprecated SSL (Secure Sockets Layer). Early versions of TLS included some backward compatibility with SSL, but modern security protocols are now fully TLS. Older versions of SSL (and TLS) have known weaknesses and are not recommended (and often no longer supported).

The mongod and mongos configuration files have a net.ssl.disabledProtocols configuration option to disallow usage of some protocol versions for improved security. Starting in version 4.0, MongoDB disables the use of TLS 1.0 if TLS 1.1+ is available on the system.

The two protocols are often described as TLS/SSL since SSL is the older (and typically more familiar) reference.

MongoDB configuration parameters for TLS/SSL in MongoDB 4.0 include SSL in the name for historical reasons, but starting from MongoDB 4.2 there are new TLS options (which are renamed equivalents of the older SSL options) to provide clarity that the protocol is in fact TLS.

  • Thanks stennie for your help:) But today itself when i enabled ssl on my mongo config file..after changing config in my api i am getting below error : Error receiving request from client: SSLHandshakeFailed: SSL peer certificate validation failed: certificate signature failure. – sanjay bhanushali Jan 24 at 12:44
  • @sanjaybhanushali The error message indicates a problem validating your client certificate. Perhaps you are missing the Certificate Authority (CA) .pem file for verification. See Configure mongod and mongos for TLS/SSL and TLS/SSL Configuration for Clients for more details. – Stennie Jan 24 at 21:35

Not the answer you're looking for? Browse other questions tagged or ask your own question.