> This page location: /docs.md > /docs/development.md > /docs/current/connect-to-cluster.md > /docs/atlas/security/config-db-auth.md

> For the complete MongoDB documentation index, see www.mongodb.com/docs/llms.txt

<!--
Tab options on this page. Append to the .md URL to filter:
  ?tabs=<id,...>   select specific tabs (e.g. ?tabs=nodejs,shell)
  ?allTabs=true    include every tab
  (no param)       default: one tab per tabset

Available tabs:
  other tabs: atlascli, ui
-->

# Set Up Self-Managed X.509 Certificates

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](https://www.mongodb.com/docs/atlas/security-ldaps.md#std-label-ldaps-authentication-authorization), you can't connect to your clusters with users that authenticate with an Atlas-managed X.509 certificate.

After you enable LDAP (Lightweight Directory Access Protocol) 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`](https://www.mongodb.com/docs/atlas/reference/user-roles.md#mongodb-authrole-Organization-Owner) or [`Project Owner`](https://www.mongodb.com/docs/atlas/reference/user-roles.md#mongodb-authrole-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

1. 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 Database & Network Access under the Security heading.

   In the sidebar, click Advanced.

   The [Advanced](https://cloud.mongodb.com/go?l=https%3A%2F%2Fcloud.mongodb.com%2Fv2%2F%3Cproject%3E%23%2Fsecurity%2Fadvanced) page displays.

2. Turn on Self-Managed X.509 Authentication.

   Toggle Self-Managed X.509 Authentication to ON.

3. Provide a PEM-encoded Certificate Authority.

   ### Atlas CLI

   To save one customer-managed X.509 configuration for the project you specify using the Atlas CLI, run the following command:

   ```sh

   atlas security customerCerts create [options]

   ```

   To learn more about the command syntax and parameters, see the Atlas CLI documentation for [atlas security customerCerts create.](https://www.mongodb.com/docs/atlas/cli/current/command/atlas-security-customerCerts-create/)

## View or Modify Self-Managed X.509 Authentication Settings

### Atlas CLI

To return the details for one customer-managed X.509 configuration for the project you specify using the Atlas CLI, run the following command:

```sh

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:

```sh

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](https://www.mongodb.com/docs/atlas/cli/current/command/atlas-security-customerCerts-describe/) and [atlas security customerCerts disable.](https://www.mongodb.com/docs/atlas/cli/current/command/atlas-security-customerCerts-disable/)

**See also: Related Links**

- [Install the Atlas CLI](https://www.mongodb.com/docs/atlas/cli/current/install-atlas-cli/)

- [Connect to the Atlas CLI](https://www.mongodb.com/docs/atlas/cli/current/connect-atlas-cli/)

## Add a Database User using Self-Managed X.509 Authentication

1. In Atlas, go to the Database & Network 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 & Network Access under the Security heading.

   The [Database & Network Access](https://cloud.mongodb.com/go?l=https%3A%2F%2Fcloud.mongodb.com%2Fv2%2F%3Cproject%3E%23%2Fsecurity%2Fdatabase) page displays after you complete the preceding steps.

2. Open the Add New Database User dialog box.

   If it's not already displayed, click the Database Users tab.

   Click  Add New Database User.

3. Select CERTIFICATE.

4. Enter user information.

   | Field | Description |
   | --- | --- |
   | Distinguished Name | The user's Common Name (CN) and optionally additional Distinguished Name fields ([RFC 4514](https://www.rfc-editor.org/rfc/rfc4514)) from the following table: NameDescriptionTypeSize (in MB)`businesscategory``businessCategory` attribute that describes the kinds of business performed by an organization.DirectoryStringSIZE(1..128)`c`Two-letter [ISO 3166](https://www.iso.org/iso-3166-country-codes.html) country code.StringTypeSIZE(2)`cn`Common names of an object. If the object corresponds to a person, it is typically the person's full name.StringTypeSIZE(1..64)`countryofcitizenship`[RFC 3039](https://www.rfc-editor.org/rfc/rfc3039) `CountryOfCitizenship` attribute that contains the identifier of at least one country of citizenship. Accepts [ISO 3166](https://www.iso.org/iso-3166-country-codes.html) codes only.PrintableStringSIZE(2)`countryofresidence`[RFC 3039](https://www.rfc-editor.org/rfc/rfc3039) `CountryOfResidence` attribute that contains the value of at least one country. Accepts [ISO 3166](https://www.iso.org/iso-3166-country-codes.html)  codes only.PrintableStringSIZE(2)`dateofbirth`[RFC 3039](https://www.rfc-editor.org/rfc/rfc3039) `DateOfBirth` attribute, which specifies the date of birth of the subject.GeneralizedTime in this format: `YYYYMMDD000000Z`.`dc``domainComponent` attribute type that contains a DNS domain name.StringType`dn``dnQualifier` attribute type that contains disambiguating information to add to the relative distinguished name of an entry.DirectoryStringSIZE(1..64)`e`Email address in Verisign certificates.`emailaddress``emailAddress` (RSA [PKCS#9](https://datatracker.ietf.org/doc/html/rfc2985) extension) attribute that specifies the electronic-mail address or addresses as an unstructured ASCII string.IA5String`gender`[RFC 3039](https://www.rfc-editor.org/rfc/rfc3039) `Gender` attribute that specifies the value of the gender of the subject. Accepts `M`, `F`, `m`, or `f`.PrintableStringSIZE(1)`generation``generationQualifier` attribute type that contains name strings that are typically the suffix part of a person's name.DirectoryStringSIZE(1..64)`givenname`Name strings that are the part of a person's name that is not their surname.DirectoryStringSIZE(1..64)`initials`Initials of some or all of an individual's names, except the surnames.DirectoryStringSIZE(1..64)`l``localityName` attribute that contains names of a locality or place, such as a city, county, or other geographic region.StringTypeSIZE(1..64)`name`(`id-at-name`) Attribute supertype from which user attribute types with the name syntax inherit.DirectoryStringSIZE(1..64)`nameofbirth`[ISIS-MTT](https://www.teletrust.de/fileadmin/files/ISIS-MTT_Core_Specification_v1.1.pdf) `NameAtBirth` attribute that specifies the name of a person at his or her birth.DirectoryStringSIZE(1..64)`o`Name of an organization.StringTypeSIZE(1..64)`ou`Name of an organizational unit.StringTypeSIZE(1..64)`placeofbirth`[RFC 3039](https://www.rfc-editor.org/rfc/rfc3039) `PlaceOfBirth` that specifies the value of the place of birth.DirectoryStringSIZE(1..128)`postaladdress`[RFC 3039](https://www.rfc-editor.org/rfc/rfc3039) `PostalAddress`, which includes the `stateOrProvinceName` and the `localityName` attribute types, if present, to store address and geographical information.SequenceSIZE (1..6) OF DirectoryString(SIZE(1..30))`postalcode``postalCode` attribute that specifies the code used by a Postal Service to identify postal service zone.DirectoryStringSIZE(1..40)`pseudonym`[RFC 3039](https://www.rfc-editor.org/rfc/rfc3039) `pseudonym` attribute that specifies a pseudonym, such as nicknames and names with spelling other than defined by the registered name.DirectoryStringSIZE(1..64)`serialnumber`Device serial number name.StringTypeSIZE(1..64)`sn`Device serial number name.StringTypeSIZE(1..64)`st`State, or province name.StringTypeSIZE(1..64)`street`Name of street.StringTypeSIZE(1..64)`surname`Naming attributes of type X520name.DirectoryStringSIZE(1..64)`t``Title` attribute, which contains the designated position or function of the subject within an organization.DirectoryStringSIZE(1..64)`telephonenumber``id-at-telephoneNumber`, which is an internationally agreed-upon format for international telephone numbers.PrintableStringSIZE (1..32)`uid`LDAP User ID.DirectoryString`uniqueidentifier`Unique identifier for an object.DirectoryString`unstructuredaddress`[PKCS#9](https://datatracker.ietf.org/doc/html/rfc2985) attribute that specifies the address or addresses of a subject as an unstructured directory string.DirectoryString`unstructuredname`[PKCS#9](https://datatracker.ietf.org/doc/html/rfc2985) attribute that specifies the name or names of a subject as an unstructured ASCII string..DirectoryStringSIZE(1..64) For more information on Distinguished Name fields, see [RFC 4514](https://www.rfc-editor.org/rfc/rfc4514). For example: `CN=Jane Doe,O=MongoDB,C=US` |
   | User Privileges | You can assign roles in one of the following ways: Select [`Atlas admin`](https://www.mongodb.com/docs/manual/reference/built-in-roles.md#mongodb-atlasrole-Atlas-admin), which provides the user with [`readWriteAnyDatabase`](https://www.mongodb.com/docs/manual/reference/built-in-roles.md#mongodb-atlasrole-readWriteAnyDatabase) as well as a number of administrative privileges.; Select [`readWriteAnyDatabase`](https://www.mongodb.com/docs/manual/reference/built-in-roles.md#mongodb-atlasrole-readWriteAnyDatabase), which provides the user with privileges to read and write to any database.; Select [`readAnyDatabase`](https://www.mongodb.com/docs/manual/reference/built-in-roles.md#mongodb-atlasrole-readAnyDatabase) which provides the user with privileges to read any database.; Select Select Custom Role to select a custom role previously created in Atlas. You can create custom roles for database users in cases where the [built-in database user roles](https://www.mongodb.com/docs/manual/reference/built-in-roles/#database-user-roles) cannot describe the desired set of privileges. For more information on custom roles, see [Configure Custom Database Roles.](https://www.mongodb.com/docs/atlas/security-add-mongodb-roles.md#std-label-mongodb-roles); Click Add Default Privileges. When you click this option, you can select individual roles and specify the database on which the roles apply. Optionally, for the `read` and `readWrite` roles, you can also specify a collection. If you do not specify a collection for `read` and `readWrite`, the role applies to all non-`system` collections in the database. For information on the built-in Atlas privileges, see [Built-In Roles.](https://www.mongodb.com/docs/manual/reference/built-in-roles.md#std-label-atlas-user-privileges) For more information on authorization, see [Role-Based Access Control](https://www.mongodb.com/docs/manual/core/authorization/) and [Built-in Roles](https://www.mongodb.com/docs/manual/core/security-built-in-roles/) in the MongoDB manual. |

5. Click Add User.
