Skip to content

Commit 487543f

Browse files
npentreljeff-allen-mongo
authored andcommitted
DOCSP-18010: Refactor Authentication mechanisms
1 parent ab83ccb commit 487543f

13 files changed

+499
-750
lines changed

snooty.toml

+1
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ toc_landing_pages = [
6767
"/core/security-hardening",
6868
"/core/security-internal-authentication",
6969
"/core/security-ldap",
70+
"/core/security-scram",
7071
"/core/security-transport-encryption",
7172
"/core/security-users",
7273
"/core/security-x.509",

source/core/authentication-mechanisms.txt

+25-17
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,10 @@ Authentication Mechanisms
1212
:depth: 1
1313
:class: singlecol
1414

15-
.. note::
16-
17-
Starting in version 4.0, MongoDB removes support for the deprecated
18-
MongoDB Challenge-Response (``MONGODB-CR``) authentication mechanism.
1915

2016
MongoDB supports the following authentication mechanisms:
2117

22-
- :doc:`/core/security-scram` (*Default*)
18+
- :doc:`SCRAM Authentication </core/security-scram>` (*Default*)
2319

2420
- :doc:`x.509 Certificate Authentication </core/security-x.509>`.
2521

@@ -30,24 +26,36 @@ authentication mechanisms supported by MongoDB Enterprise.
3026

3127
.. _authentication-mechanism-default:
3228

33-
Default Authentication Mechanism
34-
--------------------------------
29+
SCRAM Authentication
30+
--------------------
31+
32+
Salted Challenge Response Authentication Mechanism (SCRAM) is the
33+
default authentication mechanism for MongoDB.
3534

36-
As of MongoDB 3.0, :ref:`Salted Challenge Response Authentication
37-
Mechanism (SCRAM) <authentication-scram>` is the default
38-
authentication mechanism for MongoDB.
35+
For more information on SCRAM and MongoDB, see:
3936

37+
- :doc:`SCRAM Authentication </core/security-scram>`
38+
- :ref:`scram-client-authentication`
4039

41-
Specify Authentication Mechanism
40+
.. _authentication-mechanism-x509:
41+
42+
x.509 Certificate Authentication
4243
--------------------------------
4344

44-
To specify the authentication mechanism to use, set the
45-
:parameter:`authenticationMechanisms` parameter for :binary:`~bin.mongod` and
46-
:binary:`~bin.mongos`.
45+
MongoDB supports x.509 certificate authentication for client
46+
authentication and internal authentication of the members of replica
47+
sets and sharded clusters. x.509 certificate authentication requires a
48+
secure :doc:`TLS/SSL connection </tutorial/configure-ssl>`.
49+
50+
To use MongoDB with x.509, you must use valid certificates generated and
51+
signed by a certificate authority. The client x.509 certificates
52+
must meet the :ref:`client certificate requirements
53+
<client-x509-certificates-requirements>`.
54+
55+
For more information on x.509 and MongoDB, see:
4756

48-
Clients specify the authentication mechanism in the :method:`db.auth()` method.
49-
For :binary:`~bin.mongosh` and the MongoDB tools, you can also specify the
50-
authentication mechanism from the command line.
57+
- :doc:`x.509 Certificate Authentication </core/security-x.509>`
58+
- :ref:`x509-client-authentication`
5159

5260
.. toctree::
5361
:titlesonly:

source/core/security-internal-authentication.txt

+2-2
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ For example,
6767
.. tabs::
6868

6969
tabs:
70-
70+
7171
- id: single-key
7272
name: Single key
7373
content: |
@@ -175,10 +175,10 @@ see :doc:`/tutorial/upgrade-keyfile-to-x509`.
175175
/tutorial/deploy-replica-set-with-keyfile-access-control
176176
/tutorial/enforce-keyfile-access-control-in-existing-replica-set
177177
/tutorial/enforce-keyfile-access-control-in-existing-replica-set-without-downtime
178-
/tutorial/rotate-key-replica-set
179178
/tutorial/deploy-sharded-cluster-with-keyfile-access-control
180179
/tutorial/enforce-keyfile-access-control-in-existing-sharded-cluster
181180
/tutorial/enforce-keyfile-access-control-in-existing-sharded-cluster-no-downtime
181+
/tutorial/rotate-key-replica-set
182182
/tutorial/rotate-key-sharded-cluster
183183
/tutorial/configure-x509-member-authentication
184184
/tutorial/upgrade-keyfile-to-x509

source/core/security-scram.txt

+34-47
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
.. _authentication-scram:
22

3-
4-
53
=====
64
SCRAM
75
=====
@@ -14,46 +12,32 @@ SCRAM
1412
:depth: 1
1513
:class: singlecol
1614

17-
.. note::
15+
Salted Challenge Response Authentication Mechanism (SCRAM) is the
16+
default authentication mechanism for MongoDB.
1817

19-
Starting in version 4.0, MongoDB removes support for the deprecated
20-
MongoDB Challenge-Response (``MONGODB-CR``) authentication mechanism.
18+
When a user :ref:`authenticates <authentication-auth-as-user>`
19+
themselves, MongoDB uses SCRAM to verify the supplied user credentials
20+
against the user's :data:`name <admin.system.users.user>`,
21+
:data:`password <admin.system.users.credentials>` and
22+
:data:`authentication database <admin.system.users.db>`.
2123

22-
If your deployment has user credentials stored in ``MONGODB-CR``
23-
schema, you must upgrade to SCRAM **before** you upgrade to version
24-
4.0. For information on upgrading to ``SCRAM``, see
25-
:doc:`/release-notes/3.0-scram`.
26-
27-
Salted Challenge Response Authentication Mechanism (SCRAM) is the
28-
default authentication mechanism for MongoDB. SCRAM is based on the
29-
IETF `RFC 5802 <https://tools.ietf.org/html/rfc5802>`_ standard that
30-
defines best practices for implementation of challenge-response
31-
mechanisms for authenticating users with passwords.
32-
33-
Using SCRAM, MongoDB verifies the supplied user credentials against the
34-
user's :data:`name <admin.system.users.user>`, :data:`password
35-
<admin.system.users.credentials>` and :data:`authentication database
36-
<admin.system.users.db>`. The authentication database is the database
37-
where the user was created, and together with the user's name, serves
38-
to identify the user.
24+
SCRAM is based on the IETF `RFC 5802
25+
<https://tools.ietf.org/html/rfc5802>`_ standard that defines best
26+
practices for the implementation of challenge-response mechanisms for
27+
authenticating users with passwords.
3928

4029
.. _authentication-scram-sha-1:
41-
4230
.. _authentication-scram-sha-256:
43-
4431
.. _scram-features:
4532

4633
Features
4734
--------
4835

4936
MongoDB's implementation of SCRAM provides:
5037

51-
- A tunable work factor (i.e. the iteration count),
52-
53-
- Per-user random salts, and
54-
55-
- Authentication of the server to the client as well as the client to the
56-
server.
38+
- A tunable work factor (the iteration count)
39+
- Per-user random salts
40+
- Bi-directional authentication between server and client
5741

5842
.. _scram-mechanisms:
5943

@@ -69,35 +53,34 @@ MongoDB supports the following SCRAM mechanisms:
6953
* - SCRAM Mechanism
7054
- Description
7155

72-
* - ``SCRAM-SHA-1``
56+
* - ``SCRAM-SHA-1``
7357

7458
- Uses the SHA-1 hashing function.
7559

7660
To modify the iteration count for ``SCRAM-SHA-1``, see
7761
:parameter:`scramIterationCount`.
7862

79-
* - ``SCRAM-SHA-256``
63+
* - ``SCRAM-SHA-256``
8064

81-
- Uses the SHA-256 hashing function and requires
82-
featureCompatibilityVersion (``fcv``) set to ``4.0``.
65+
- Uses the SHA-256 hashing function.
8366

8467
To modify the iteration count for ``SCRAM-SHA-256``, see
8568
:parameter:`scramSHA256IterationCount`.
8669

87-
.. versionadded:: 4.0
8870

89-
When creating or updating a SCRAM user, you can indicate the specific
90-
SCRAM mechanism as well as indicate whether the server or the client
91-
digests the password. When using ``SCRAM-SHA-256``, MongoDB requires
92-
server-side password hashing, i.e. the server digests the password. For
93-
details, see :method:`db.createUser()` and :method:`db.updateUser()`.
71+
When you create or update a SCRAM user, you can indicate:
72+
73+
- the SCRAM mechanism to use
74+
- whether the server or the client digests the password
75+
76+
When you use ``SCRAM-SHA-256``, MongoDB requires server-side password
77+
hashing, which means that the server digests the password. For more
78+
information, see :method:`db.createUser()` and
79+
:method:`db.updateUser()`.
9480

9581
Driver Support
9682
--------------
9783

98-
To use SCRAM, you must upgrade your driver if your current driver
99-
version does not support ``SCRAM``.
100-
10184
The minimum driver versions that support ``SCRAM`` are:
10285

10386
.. |driver-compatibility-heading| replace:: Version
@@ -107,12 +90,16 @@ The minimum driver versions that support ``SCRAM`` are:
10790
Additional Information
10891
----------------------
10992

110-
- `Blog Post: Improved Password-Based Authentication in MongoDB 3.0: SCRAM
111-
Explained (Part 1)
93+
- `Blog Post: Improved Password-Based Authentication: SCRAM Explained (Part 1)
11294
<https://www.mongodb.com/blog/post/improved-password-based-authentication-mong
11395
odb-30-scram-explained-part-1?tck=docs_server>`_
11496

115-
- `Blog Post: Improved Password-Based Authentication in MongoDB 3.0: SCRAM
116-
Explained (Part 2)
97+
- `Blog Post: Improved Password-Based Authentication: SCRAM Explained (Part 2)
11798
<https://www.mongodb.com/blog/post/improved-password-based-authentication-mong
11899
odb-30-scram-explained-part-2?tck=docs_server>`_
100+
101+
.. toctree::
102+
:titlesonly:
103+
:hidden:
104+
105+
/tutorial/configure-scram-client-authentication

source/core/security-x.509.txt

+16-67
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,12 @@ x.509
1212
:depth: 1
1313
:class: singlecol
1414

15-
MongoDB supports x.509 certificate authentication for client authentication and
16-
internal authentication of the members of replica sets and sharded clusters.
15+
MongoDB supports x.509 certificate authentication for client
16+
authentication and internal authentication of the members of replica
17+
sets and sharded clusters.
1718

18-
x.509 certificate authentication requires a secure :doc:`TLS/SSL connection
19-
</tutorial/configure-ssl>`.
20-
21-
.. note::
22-
23-
.. include:: /includes/fact-tls-1.0.rst
24-
25-
.. |binary| replace:: MongoDB
19+
x.509 certificate authentication requires a secure :doc:`TLS/SSL
20+
connection </tutorial/configure-ssl>`.
2621

2722
Certificate Authority
2823
---------------------
@@ -37,6 +32,8 @@ Client x.509 Certificates
3732
To authenticate to servers, clients can use x.509 certificates instead
3833
of usernames and passwords.
3934

35+
.. _client-x509-certificates-requirements:
36+
4037
Client Certificate Requirements
4138
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4239

@@ -49,63 +46,21 @@ MongoDB User and ``$external`` Database
4946

5047
To authenticate with a client certificate, you must first add the value
5148
of the ``subject`` from the client certificate as a MongoDB user. Each
52-
unique x.509 client certificate corresponds to a single MongoDB user;
53-
i.e. you cannot use a single client certificate to authenticate more
54-
than one MongoDB user.
49+
unique x.509 client certificate corresponds to a single MongoDB user.
50+
You cannot use a single client certificate to authenticate more than one
51+
MongoDB user.
5552

56-
Add the user in the ``$external`` database; i.e. the
57-
:ref:`authentication-database` is the ``$external`` database
53+
Add the user in the ``$external`` database. The ``$external`` database
54+
is the :ref:`authentication-database` for the user.
5855

5956
.. include:: /includes/extracts/sessions-external-username-limit.rst
6057

61-
Authenticate
62-
~~~~~~~~~~~~
63-
64-
To connect and authenticate using x.509 client certificate:
65-
66-
- For MongoDB 4.2 or greater, include the following options for the client:
67-
68-
- :option:`--tls <mongosh --tls>` (or the deprecated ``--ssl`` option)
69-
70-
- :option:`--tlsCertificateKeyFile <mongosh --tlsCertificateKeyFile>`
71-
(or the deprecated ``--sslPEMKeyFile`` option)
72-
73-
- :option:`--tlsCertificateKeyFilePassword <mongosh --tlsCertificateKeyFile>`
74-
(or the deprecated ``--sslPEMKeyPassword`` option) if the
75-
certificate key file is encrypted
76-
77-
- :option:`--authenticationDatabase '$external'
78-
<mongosh --authenticationDatabase>`
79-
80-
- :option:`--authenticationMechanism MONGODB-X509
81-
<mongosh --authenticationMechanism>`
82-
83-
- For MongoDB 4.0 and earlier, include the following options for the client:
84-
85-
- ``--ssl``
86-
87-
- ``--sslPEMKeyFile``
88-
89-
- ``--sslPEMKeyPassword`` option if
90-
the ``--sslPEMKeyFile`` is encrypted.
91-
92-
- :option:`--authenticationDatabase '$external'
93-
<mongosh --authenticationDatabase>`
94-
95-
- :option:`--authenticationMechanism MONGODB-X509 <mongosh --authenticationMechanism>`
96-
97-
You can also make the TLS/SSL connection first, and then use
98-
:method:`db.auth()` in the ``$external`` database to authenticate.
99-
100-
For examples of both cases, see the :ref:`authenticate-with-x509-cert`
101-
section in :doc:`/tutorial/configure-x509-client-authentication`
102-
10358
Member x.509 Certificates
104-
--------------------------
59+
-------------------------
10560

106-
For internal authentication, members of sharded clusters and replica sets
107-
can use x.509 certificates instead of keyfiles, which use the
108-
:doc:`/core/security-scram` authentication mechanism.
61+
For internal authentication between members of sharded clusters and
62+
replica sets you can use x.509 certificates instead of keyfiles, which
63+
use the :doc:`/core/security-scram` authentication mechanism.
10964

11065
.. _x509-member-certificate-requirements:
11166

@@ -119,12 +74,6 @@ MongoDB Configuration for Membership Authentication
11974

12075
.. include:: /includes/extracts/x509-member-auth-configuration.rst
12176

122-
Next Steps
123-
~~~~~~~~~~
124-
125-
For an example of x.509 internal authentication, see
126-
:doc:`/tutorial/configure-x509-member-authentication`.
127-
12877
.. toctree::
12978
:titlesonly:
13079
:hidden:

source/includes/extracts-ssl-facts.yaml

+6-10
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
11
ref: ssl-facts-x509-invalid-certificate
22
content: |
33
4-
Starting in MongoDB 4.0, if you specify
5-
``--sslAllowInvalidCertificates`` or
6-
``net.ssl.allowInvalidCertificates: true`` (or in MongoDB 4.2, the
7-
alias ``--tlsAllowInvalidateCertificates`` or
8-
``net.tls.allowInvalidCertificates: true``) when using x.509
4+
Starting in MongoDB 4.2, if you specify
5+
``--tlsAllowInvalidateCertificates`` or
6+
``net.tls.allowInvalidCertificates: true`` when using x.509
97
authentication, an invalid certificate is only sufficient to
10-
establish a TLS/SSL connection but is *insufficient* for
8+
establish a TLS connection but it is *insufficient* for
119
authentication.
1210
1311
---
@@ -28,10 +26,8 @@ ref: ssl-facts-x509-ca-file
2826
content: |
2927
3028
To use x.509 authentication, ``--tlsCAFile`` or ``net.tls.CAFile``
31-
must be specified unless using ``--tlsCertificateSelector`` or
32-
``--net.tls.certificateSelector``. Or if using the ``ssl`` aliases,
33-
``--sslCAFile`` or ``net.ssl.CAFile`` must be specified unless using
34-
``--sslCertificateSelector`` or ``net.ssl.certificateSelector``.
29+
must be specified unless you are using ``--tlsCertificateSelector``
30+
or ``--net.tls.certificateSelector``.
3531
3632
---
3733
ref: ssl-facts-see-more

0 commit comments

Comments
 (0)