Set Up Self-Managed X.509 Authentication
On this page
Self-managed X.509 certificates, also known as mutual TLS or mTLS, provide database users access to the clusters in your project. Database users are separate from Atlas users. Database users have access to MongoDB databases, while Atlas users have access to the Atlas application itself.
Considerations
If you enable LDAP authorization, you can't connect to your clusters with users that authenticate with an Atlas-managed X.509 certificate.
After you enable LDAP authorization, you can connect to your clusters with users that authenticate with an self-managed X.509 certificate. However, the user's Common Name in their X.509 certificate must match the Distinguished Name of a user who is authorized to access your database with LDAP.
You can have both users that authenticate with self-managed certificates and users that authenticate with Atlas-managed X.509 certificates in the same database.
Required Access
To manage database users, you must have
Organization Owner
or Project Owner
access to Atlas.
Prerequisites
To use self-managed X.509 certificates, you must have a Public Key Infrastructure to integrate with MongoDB Atlas.
Configure a Project to use a Public Key Infrastructure
In Atlas, go to the Advanced page for your project.
If it's not already displayed, select the organization that contains your project from the Organizations menu in the navigation bar.
If it's not already displayed, select your project from the Projects menu in the navigation bar.
In the sidebar, click Advanced under the Security heading.
The Advanced page displays.
Provide a PEM-encoded Certificate Authority.
To save one customer-managed X.509 configuration for the project you specify using the Atlas CLI, run the following command:
atlas security customerCerts create [options]
To learn more about the command syntax and parameters, see the Atlas CLI documentation for atlas security customerCerts create.
You can provide a Certificate Authority (CA) using the Atlas UI by either:
Clicking Upload and selecting a
.pem
file from your filesystem and clicking Save.Copying the contents of a
.pem
file into the provided text area and clicking Save.
You can concatenate multiple CAs in the same .pem
file or
in the text area. Users can authenticate with certificates
generated by any of the provided CAs.
When you upload a CA, a project-level alert is automatically created to send a notification 30 days before the CA expires, repeating every 24 hours. You can view and edit this alert from Atlas's Alert Settings page. For more information on configuring alerts, see Configure Alert Settings.
View or Modify Self-Managed X.509 Authentication Settings
To return the details for one customer-managed X.509 configuration for the project you specify using the Atlas CLI, run the following command:
atlas security customerCerts describe [options]
To disable one customer-managed X.509 configuration for the project you specify using the Atlas CLI, run the following command:
atlas security customerCerts disable [options]
To learn more about the syntax and parameters for the previous commands, see the Atlas CLI documentation for atlas security customerCerts describe and atlas security customerCerts disable.
To view or edit your CA using the Atlas UI, click the Self-Managed X.509 Authentication Settings icon.
Add a Database User using Self-Managed X.509 Authentication
In Atlas, go to the Database Access page for your project.
If it's not already displayed, select the organization that contains your project from the Organizations menu in the navigation bar.
If it's not already displayed, select your project from the Projects menu in the navigation bar.
In the sidebar, click Database Access under the Security heading.
The Database Access page displays.
Enter user information.
Field | Description | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Distinguished Name | The user's Common Name (CN) and optionally additional Distinguished Name fields (RFC 4514) from the following table:
For more information on Distinguished Name fields, see RFC 4514. For example:
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
User Privileges | You can assign roles in one of the following ways:
For information on the built-in Atlas privileges, see Built-in Roles. For more information on authorization, see Role-Based Access Control and Built-in Roles in the MongoDB manual. |