Skip to content

Commit 557a1e1

Browse files
mdb-ashleyAshley BrownAshley Brown
authored
DOSCP-17549 Update x.509 client certificate requirements (#660)
* Initial updates to x509 * fixing inline literals * fixing more inline literals * fixing bugs * more updates * small tweaks, trying to fix errors * Fixing spacing issue * Another shot at fixing spacing * Another shot at fixing spacing * Another shot at fixing spacing * Another shot at fixing spacing * Incorporating internal review comments * Incorporating internal review comments Co-authored-by: Ashley Brown <[email protected]> Co-authored-by: Ashley Brown <[email protected]>
1 parent c360e8a commit 557a1e1

File tree

4 files changed

+78
-69
lines changed

4 files changed

+78
-69
lines changed

source/core/security-x.509.txt

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -44,14 +44,15 @@ Client Certificate Requirements
4444
MongoDB User and ``$external`` Database
4545
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4646

47-
To authenticate with a client certificate, you must first add the value
48-
of the ``subject`` from the client certificate as a MongoDB user. Each
49-
unique x.509 client certificate corresponds to a single MongoDB user.
47+
To authenticate with a client certificate, you must first add the client
48+
certificate's ``subject`` as a MongoDB user in the ``$external`` database.
49+
The ``$external`` database is the :ref:`authentication-database` for the user.
50+
51+
Each unique x.509 client certificate is for one MongoDB user.
5052
You cannot use a single client certificate to authenticate more than one
5153
MongoDB user.
5254

53-
Add the user in the ``$external`` database. The ``$external`` database
54-
is the :ref:`authentication-database` for the user.
55+
5556

5657
.. include:: /includes/extracts/sessions-external-username-limit.rst
5758

@@ -64,8 +65,8 @@ Member x.509 Certificates
6465
-------------------------
6566

6667
For internal authentication between members of sharded clusters and
67-
replica sets you can use x.509 certificates instead of keyfiles, which
68-
use the :doc:`/core/security-scram` authentication mechanism.
68+
replica sets, you can use x.509 certificates instead of :doc:`keyfiles
69+
</tutorial/deploy-sharded-cluster-with-keyfile-access-control>`.
6970

7071
.. _x509-member-certificate-requirements:
7172

source/includes/extracts-sessions.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ ref: sessions-external-username-limit
102102
content: |
103103
104104
To use :ref:`sessions` with ``$external`` authentication users
105-
(Kerberos, LDAP, or x.509 users), the usernames cannot be greater
105+
(Kerberos, LDAP, or x.509 users), usernames cannot be greater
106106
than 10k bytes.
107107
108108
---

source/includes/extracts-x509-certificate.yaml

Lines changed: 68 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,18 @@
11
ref: x509-certificate-client
22
content: |
33
4-
Client certificates must have the following properties:
4+
Client certificate requirements:
55
66
- A single Certificate Authority (CA) must issue the certificates
77
for both the client and the server.
8+
9+
- Each unique MongoDB user must have a unique certificate.
10+
11+
- The x.509 certificate must *not* be expired.
12+
13+
.. note::
14+
15+
.. include:: /includes/extracts/4.4-changes-certificate-expiry-warning.rst
816
917
- Client certificates must contain the following fields:
1018
@@ -13,44 +21,55 @@ content: |
1321
keyUsage = digitalSignature
1422
extendedKeyUsage = clientAuth
1523
16-
- Each unique MongoDB user must have a unique certificate.
24+
- At least one of the following client certificate attributes must be **different**
25+
than the attributes in both the :setting:`net.tls.clusterFile` and
26+
:setting:`net.tls.certificateKeyFile` server certificates:
27+
28+
- Organization (``O``)
29+
- Organizational Unit (``OU``)
30+
- Domain Component (``DC``)
31+
32+
- The ``subject`` of a client x.509 certificate, which contains the
33+
Distinguished Name (``DN``), must be **different** than the ``subject``\s
34+
of :ref:`member x.509 certificates <x509-member-certificate>`.
35+
36+
.. important::
37+
38+
If a client x.509 certificate's subject matches the ``O``, ``OU``, and
39+
``DC`` attributes of the :ref:`x509-member-certificate` (or
40+
:parameter:`tlsX509ClusterAuthDNOverride`, if set) exactly, the client
41+
connection is accepted, full permissions are granted, and a warning
42+
message appears in the log.
43+
44+
Only :ref:`cluster member x509 certificates <x509-member-certificate>`
45+
should use the same ``O``, ``OU``, and ``DC`` attribute combinations.
46+
47+
48+
.. versionadded:: 4.2
49+
50+
If the MongoDB deployment has :parameter:`tlsX509ClusterAuthDNOverride`
51+
set, the client x.509 certificate's subject must not match that value.
1752
18-
- A client x.509 certificate's subject, which contains the
19-
Distinguished Name (``DN``), must **differ** from the subjects of
20-
:ref:`member x.509 certificates <x509-member-certificate>`.
21-
22-
At least one of the Organization (``O``), Organizational Unit
23-
(``OU``), or Domain Component (``DC``) attributes in the client
24-
certificate must differ from those in the
25-
:setting:`net.tls.clusterFile` and
26-
:setting:`net.tls.certificateKeyFile` server certificates. If a
27-
client x.509 certificate's subject has the same ``O``, ``OU``, and
28-
``DC`` combination as the :ref:`x509-member-certificate` (or
29-
:parameter:`tlsX509ClusterAuthDNOverride` if set), the client
30-
connection is rejected. Only :ref:`cluster member x509 certificates
31-
<x509-member-certificate>` should use same ``O``, ``OU``, and
32-
``DC`` combinations as this grants full permissions.
33-
34-
If the MongoDB deployment has
35-
:parameter:`tlsX509ClusterAuthDNOverride` set (*available starting
36-
in MongoDB 4.2*), the client x.509 certificate's subject must also
37-
differ from that value.
3853
39-
- The x.509 certificate must *not* be expired.
4054
41-
.. include:: /includes/extracts/4.4-changes-certificate-expiry-warning.rst
4255
---
4356
ref: x509-certificate-member
4457
content: |
4558
46-
Member certificates which you use to verify membership to a sharded
47-
cluster or a replica set (:setting:`net.tls.clusterFile`, if
48-
specified, and :setting:`net.tls.certificateKeyFile`), must have the
49-
following properties:
59+
Use member certificates to verify membership to a sharded
60+
cluster or a replica set. Member certificates are stored in
61+
:setting:`net.tls.clusterFile` and :setting:`net.tls.certificateKeyFile`.
62+
Member certificate requirements:
5063
51-
- A single Certificate Authority (CA) must issue all the x.509
64+
- A single Certificate Authority (CA) must issue all x.509
5265
certificates for the members of a sharded cluster or a replica set.
5366
67+
- The x.509 certificate must *not* be expired.
68+
69+
.. note::
70+
71+
.. include:: /includes/extracts/4.4-changes-certificate-expiry-warning.rst
72+
5473
- The Distinguished Name (``DN``), found in the member certificate's
5574
``subject``, must specify a non-empty value for *at least one* of
5675
the following attributes:
@@ -59,44 +78,37 @@ content: |
5978
- the Organizational Unit (``OU``)
6079
- the Domain Component (``DC``)
6180
62-
- The Organization attributes (``O``\'s), the Organizational Unit
63-
attributes (``OU``\'s), and the Domain Components (``DC``\'s) must
64-
match those from both the :setting:`net.tls.clusterFile` and
65-
:setting:`net.tls.certificateKeyFile` certificates for the other
66-
cluster members (or the :parameter:`tlsX509ClusterAuthDNOverride`
67-
value, if set).
81+
- Each cluster member certificate must have identical ``O``\s, ``OU``\s,
82+
and ``DC``\s in their :setting:`net.tls.clusterFile` and
83+
:setting:`net.tls.certificateKeyFile` certificates. This also applies to
84+
the :parameter:`tlsX509ClusterAuthDNOverride` value, if set. Attribute
85+
order doesn't matter.
6886
69-
To match, the certificate must match all specifications of these
70-
attributes, even the non-specification of these attributes. The
71-
order of the attributes does not matter.
72-
73-
In the following example, the two ``DN``\'s contain matching
74-
specifications for ``O``, ``OU`` as well as the non-specification
75-
of the ``DC`` attribute.
87+
Here's an example. The two ``DN``\s below have matching
88+
specifications for ``O`` and ``OU``, and ``DC`` is not specified.
7689
7790
.. code-block:: none
7891
7992
CN=host1,OU=Dept1,O=MongoDB,ST=NY,C=US
8093
C=US, ST=CA, O=MongoDB, OU=Dept1, CN=host2
8194
82-
However, the following two ``DN``\'s contain a mismatch for the
83-
``OU`` attribute since one contains two ``OU`` specifications and
84-
the other, only one specification.
95+
The following example is incorrect, because the ``DN``\s don't match. One
96+
``DN`` has two ``OU`` specifications and the other has only one ``OU``
97+
specification.
8598
8699
.. code-block:: none
87100
88101
CN=host1,OU=Dept1,OU=Sales,O=MongoDB
89102
CN=host2,OU=Dept1,O=MongoDB
90103
91104
- Either the Common Name (``CN``) or one of the Subject Alternative
92-
Name (``SAN``) entries must match the hostname of the server, used
93-
by the other members of the cluster. Starting in MongoDB 4.2, when
94-
performing comparison of SAN, MongoDB supports comparison of DNS
95-
names or IP addresses. In previous versions, MongoDB only supports
96-
comparisons of DNS names.
105+
Name (``SAN``) entries must match the server hostname for other cluster
106+
members. Starting in MongoDB 4.2, when comparing ``SAN``\s, MongoDB can
107+
compare either DNS names or IP addresses. In previous versions, MongoDB
108+
only compares DNS names.
97109
98110
For example, the certificates for a cluster could have the
99-
following subjects:
111+
following ``subject``\s:
100112
101113
.. code-block:: bash
102114
@@ -112,9 +124,7 @@ content: |
112124
113125
extendedKeyUsage = clientAuth
114126
115-
- The x.509 certificate must *not* be expired.
116127
117-
.. include:: /includes/extracts/4.4-changes-certificate-expiry-warning.rst
118128
---
119129
ref: x509-member-auth-configuration
120130
content: |
@@ -133,17 +143,15 @@ content: |
133143
<mongod --clusterAuthMode>` (*available starting in MongoDB 4.2*)
134144
135145
:binary:`~bin.mongod` and :option:`mongos <mongos
136-
--tlsCertificateKeyFile>` instances use their certificate key file to
137-
prove their identity to clients, but it can also be used for
146+
--tlsCertificateKeyFile>` instances use their certificate key files to
147+
prove their identity to clients, but certificate key files can also be used for
138148
membership authentication. If you do not specify a cluster file,
139-
members use their certificate key file for membership authentication.
140-
The certificate key file is the file you specify with
141-
:setting:`net.tls.certificateKeyFile` or
149+
members use their certificate key files for membership authentication.
150+
Specify the certificate key file with :setting:`net.tls.certificateKeyFile` or
142151
:option:`--tlsCertificateKeyFile <mongod --tlsCertificateKeyFile>`
143152
(*available starting in MongoDB 4.2*).
144153
145-
To use the :setting:`certificate key file
146-
<net.tls.certificateKeyFile>` for both client authentication and
154+
To use the certificate key file for both client authentication and
147155
membership authentication, the certificate must either:
148156
149157
- Omit ``extendedKeyUsage`` or

source/includes/fact-5.0-x509-certificate-client-warning.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,6 @@ The following platforms do not support common name validation:
1010

1111
Clients using these platforms will not
1212
:ref:`authenticate <x509-client-authentication>` to
13-
MongoDB servers which use X.509 certificate whose hostnames are
13+
MongoDB servers that use x.509 certificates whose hostnames are
1414
:ref:`specified by CommonName attributes
1515
<KMIP-subject-alternative-name-CN>`.

0 commit comments

Comments
 (0)