Thanks @chris for your feedback.
my configuration file parameters are updated as follows:
tls:
mode: requireTLS
certificateKeyFile: /mongodb/bin/cert_dir/mongodb-ca.pem
CAFile : /mongodb/bin/cert_dir/mongodb-ca.pem
when starting MongoDB using this command:
/mongodb/bin/mongod --config /mongodb/log/etc/mongod.conf --setParameter tlsUseSystemCA=true
The following error message was thrown
{"t":{"$date":"2024-03-14T09:28:16.699Z"},"s":"F", "c":"CONTROL", "id":20574, "ctx":"main","msg":"Error during global initialization","attr":{"error":{"code":72,"codeName":"InvalidOptions","errmsg":"The use of both a CA File and the System Certificate store is not supported."}}}
{"t":{"$date":"2024-03-18T05:51:06.131Z"},"s":"F", "c":"CONTROL", "id":20574, "ctx":"main","msg":"Error during global initialization","attr":{"error":{"code":72,"codeName":"InvalidOptions","errmsg":"The use of both a CA File and the System Certificate store is not supported."}}}
if i remove --setParameter tlsUseSystemCA=true the MongoDB instance starts up Ok
nohup /mongodb/bin/mongod --config /mongodb/log/etc/mongod.conf &
Now, if I attempt to connect using mongo shell command utility:
/mongodb/bin/mongo --port XXXX --tls --host XXXXX.DOMAIN.com --tlsCertificateKeyFile /mongodb/bin/cert_dir/mongodb-ca.pem
MongoDB shell version v4.4.29
connecting to: mongodb://XXXXX.DOMAIN.com:XXXX/?compressors=disabled&gssapiServiceName=mongodb
{"t":{"$date":"2024-03-18T06:02:03.276Z"},"s":"I", "c":"NETWORK", "id":5490002, "ctx":"thread1","msg":"Started a new thread for the timer service"}
{"t":{"$date":"2024-03-18T06:02:03.288Z"},"s":"E", "c":"NETWORK", "id":23256, "ctx":"js","msg":"**SSL peer certificate validation failed"**,"attr":{"**error":"SSL peer certificate validation failed: self signed certificate"**}}
Mongo shell will succeed in connecting when the following parameter is added “****–tlsAllowInvalidCertificates**”** :
/mongodb/bin/mongo --port XXXX --tls --host XXXXX.DOMAIN.com --tlsCertificateKeyFile /mongodb/bin/cert_dir/mongodb-ca.pem –tlsAllowInvalidCertificates
This means “self signed certificate” is totally can’t be used anymore ? This will cause major impact !!
[[SERVER-72839] Server skips peer certificate validation if neither CAFile nor clusterCAFile is provided - MongoDB Jira](https://jira.mongodb.org/browse/SERVER-72839)