# Distinguished name for MongoDB

**URL:** <https://community.letsencrypt.org/t/distinguished-name-for-mongodb/166300>\
**Category:** Help\
**Created:** [November 24, 2021, 2:14pm UTC](https://community.letsencrypt.org/t/distinguished-name-for-mongodb/166300 "2021-11-24T14:14:35Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![parthjoshi](https://sea3.discourse-cdn.com/letsencrypt/user_avatar/community.letsencrypt.org/parthjoshi/32/55964_2.png) [@parthjoshi](https://community.letsencrypt.org/u/parthjoshi)\
**Post date:** [November 24, 2021, 2:14pm UTC](https://community.letsencrypt.org/t/distinguished-name-for-mongodb/166300/1 "2021-11-24T14:14:35Z")

</div>

Hi, just ran into this while trying to use Let's Encrypt issued certificates for MongoDB. MongoDB's documentation states that:

The Distinguished Name ( `DN` ), found in the member certificate's `subject` , must specify a non-empty value for _at least one_ of the following attributes:

- the Organization ( `O` )
- the Organizational Unit ( `OU` )
- the Domain Component ( `DC` )

I understand that Let's Encrypt CA cannot verify `O` or `OU` but is it possible to provide `DC` in some way. Otherwise, I'm at a loss on how to use Let's Encrypt CA issued certificates for my MongoDB deployment. I'm using certbot to automate my certificate issuance flow.

---

<div class="post-metadata">

**Author:** ![Osiris](https://avatars.discourse-cdn.com/v4/letter/o/839c29/32.png) [@Osiris](https://community.letsencrypt.org/u/Osiris)\
**Post date:** [November 24, 2021, 2:22pm UTC](https://community.letsencrypt.org/t/distinguished-name-for-mongodb/166300/2 "2021-11-24T14:22:27Z")

</div>

I can't find such requirements in the MongoDB documentation? Can you post a link?

---

<div class="post-metadata">

**Author:** ![parthjoshi](https://sea3.discourse-cdn.com/letsencrypt/user_avatar/community.letsencrypt.org/parthjoshi/32/55964_2.png) [@parthjoshi](https://community.letsencrypt.org/u/parthjoshi)\
**Post date:** [November 24, 2021, 6:32pm UTC](https://community.letsencrypt.org/t/distinguished-name-for-mongodb/166300/3 "2021-11-24T18:32:48Z")

</div>

Here you go [https://docs.mongodb.com/manual/tutorial/configure-x509-member-authentication/#certificate-requirements](https://docs.mongodb.com/manual/tutorial/configure-x509-member-authentication/#certificate-requirements)

---

<div class="post-metadata">

**Author:** ![parthjoshi](https://sea3.discourse-cdn.com/letsencrypt/user_avatar/community.letsencrypt.org/parthjoshi/32/55964_2.png) [@parthjoshi](https://community.letsencrypt.org/u/parthjoshi)\
**Post date:** [November 24, 2021, 6:40pm UTC](https://community.letsencrypt.org/t/distinguished-name-for-mongodb/166300/4 "2021-11-24T18:40:03Z")

</div>

Also found this thread on the MongoDB forums that talks about the same problem [Let's Encrypt certificate for internal membership authentication - #3 by Alexey\_Roshka - Ops and Admin - MongoDB Developer Community Forums](https://www.mongodb.com/community/forums/t/lets-encrypt-certificate-for-internal-membership-authentication/11013/3)

---

<div class="post-metadata">

**Author:** ![rmbolger](https://sea3.discourse-cdn.com/letsencrypt/user_avatar/community.letsencrypt.org/rmbolger/32/27474_2.png) [@rmbolger](https://community.letsencrypt.org/u/rmbolger)\
**Post date:** [November 24, 2021, 6:43pm UTC](https://community.letsencrypt.org/t/distinguished-name-for-mongodb/166300/5 "2021-11-24T18:43:47Z")

</div>

That page describes the certificate requirements necessary for membership authentication which is another way of saying client authentication. You don't need a publicly trusted certificate for that purpose. And while Let's Encrypt certificates _can_ be used for client authentication in some circumstances, they are not generally intended for that purpose.

> Sharded cluster members and replica set members can use x.509 certificates to verify their membership to the cluster or the replica set instead of using [keyfiles](https://docs.mongodb.com/manual/core/security-internal-authentication/#std-label-internal-auth-keyfile). The membership authentication is an internal process.

This would be the appropriate portion of the documentation that could be used with Let's Encrypt certificates.

> **[Configure mongod and mongos for TLS/SSL — MongoDB Manual](https://www.mongodb.com/docs/manual/tutorial/configure-ssl/)**

> For production use, your MongoDB deployment should use valid certificates generated and signed by a certificate authority. You or your organization can generate and maintain an independent certificate authority, or use certificates generated by third-party TLS vendors. Obtaining and managing certificates is beyond the scope of this documentation.

---

<div class="post-metadata">

**Author:** ![parthjoshi](https://sea3.discourse-cdn.com/letsencrypt/user_avatar/community.letsencrypt.org/parthjoshi/32/55964_2.png) [@parthjoshi](https://community.letsencrypt.org/u/parthjoshi)\
**Post date:** [November 25, 2021, 10:39am UTC](https://community.letsencrypt.org/t/distinguished-name-for-mongodb/166300/6 "2021-11-25T10:39:12Z")

</div>

Thanks for the information. My main goal is to have a secure MongoDB setup while automating the certificate management process for MongoDB. While I understand that Let's Encrypt certificates should not be used for client authentication, I see that certificates issued by Let's Encrypt do have `extKeyUsage: clientAuth, serverAuth`.

So my questions essentially boil down to (I understand that this might not be the best forum to ask these but any help would be greatly appreciated and be of great use to others that face a similar issue):

1. If I use TLS in MongoDB only for server auth and use keyfile authentication for membership (internal) auth, does that mean that internal traffic between the members is unencrypted and hence insecure?
2. If the answer to 1 is yes, then is my only solution to setup an internal PKI using something like `step-ca` to issue and renew self-signed certificates? The key thing here is not just issuing certs which can be done in a myriad of ways but also automating renewals and other certificate management tasks.

---

<div class="post-metadata">

**Author:** ![rmbolger](https://sea3.discourse-cdn.com/letsencrypt/user_avatar/community.letsencrypt.org/rmbolger/32/27474_2.png) [@rmbolger](https://community.letsencrypt.org/u/rmbolger)\
**Post date:** [November 25, 2021, 4:50pm UTC](https://community.letsencrypt.org/t/distinguished-name-for-mongodb/166300/7 "2021-11-25T16:50:06Z")

</div>

I don't know enough about MongoDB to answer the first question. But as for the second question, yes. Typically an internal CA is used to issue certificates that either have specialized requirements or that simply don't need to be publicly trusted. You can even take renewal automation out of the equation by simply making your cert lifetimes longer than the expected lifetime of the service.

---

<div class="post-metadata">

**Author:** ![Osiris](https://avatars.discourse-cdn.com/v4/letter/o/839c29/32.png) [@Osiris](https://community.letsencrypt.org/u/Osiris)\
**Post date:** [November 25, 2021, 4:58pm UTC](https://community.letsencrypt.org/t/distinguished-name-for-mongodb/166300/8 "2021-11-25T16:58:08Z")

</div>

It's usually also perfectly possible to have a publicly trusted certificate at the server end and use an internal CA for user authentication. Frankly, IMO using a publicly trusted certificate for user authentication is not the proper way to do it anyway. You also wouldn't want to update your users certificates every 60-90 days 😉

---

<div class="post-metadata">

**Author:** ![parthjoshi](https://sea3.discourse-cdn.com/letsencrypt/user_avatar/community.letsencrypt.org/parthjoshi/32/55964_2.png) [@parthjoshi](https://community.letsencrypt.org/u/parthjoshi)\
**Post date:** [November 25, 2021, 10:04pm UTC](https://community.letsencrypt.org/t/distinguished-name-for-mongodb/166300/9 "2021-11-25T22:04:17Z")

</div>

Thanks @rmbolger and @Osiris for all your help. Since my requirement is not to use these certificates for user authentication but internal authentication between servers within a MongoDB cluster (where 1 replica acts as a client and the other as a server), I will go ahead and setup an internal ACME server for our purposes. I've looked a the documentation of `step-ca` and it does not seem particularly difficult to configure and should integrate easily with my existing `certbot` setup as well.

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/letsencrypt/original/3X/c/a/ca6c06ea1ea201324bba7048c6841ce60236468d.png) [@system](https://community.letsencrypt.org/u/system)\
**Post date:** [December 25, 2021, 10:04pm UTC](https://community.letsencrypt.org/t/distinguished-name-for-mongodb/166300/10 "2021-12-25T22:04:19Z")

</div>

Closed on December 25, 2021, 10:04pm UTC

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
