MongoDB x509 authentication settings

For setting up x509 certificates in MongoDB, please follow the links below:

  1. MongoDB security guide on x509 Authentication
  2. Third party blog explaining in detail for x509 authentication

Once you have configured the x509 authentication in MongoDB, then you will be having the .pem and .crt file for the database user which is going to access the database.

Then add/update the following configuration in config.json file.

{
    "db" : "mongodb://localhost:27001/db-name?ssl=true",
    "dbOpts": {
        "user": "emailAddress=john.doe@example.com,CN=XYZ,OU=XYZ-Client,O=XYZ,L=XYZ,ST=XYZ,C=XYZ",
        "auth": { "authMechanism": "MONGODB-X509" },
        "server": {
            "sslValidate": false,
            "sslKey": {"filePath": "/absolute/path/to/db-user.pem"},
            "sslCert": {"filePath": "/absolute/path/to/db-user.crt"}
        }
    }
}

 

Â