Skip to content

Commit bb9d2e3

Browse files
committed
DOCS-11100: LDAP - substituted DNs must be RFC4514 escaped
1 parent a77f75d commit bb9d2e3

5 files changed

+34
-11
lines changed

source/core/security-ldap-external.txt

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -401,10 +401,11 @@ MongoDB maps each returned group distinguished name (DN) returned by
401401
the LDAP :setting:`query <ldap.security.authz.queryTemplate>` to a
402402
:ref:`role <authorization>` on the ``admin`` database.
403403

404-
If MongoDB acquires a group whose DN exactly matches the name of an existing
405-
role, MongoDB grants the authenticated user roles and :ref:`privileges
406-
<privileges>` associated with that role. If MongoDB cannot map any of the
407-
returned groups to a role, MongoDB grants no privileges to the user.
404+
If MongoDB acquires a group whose DN **exactly** matches the name of an
405+
existing role, MongoDB grants the authenticated user roles and
406+
:ref:`privileges <privileges>` associated with that role. If MongoDB
407+
cannot map any of the returned groups to a role, MongoDB grants no
408+
privileges to the user.
408409

409410
.. note::
410411

@@ -415,6 +416,13 @@ returned groups to a role, MongoDB grants no privileges to the user.
415416
appropriate roles in the ``admin`` database. Users still authenticate
416417
against the ``$external`` database.
417418

419+
.. important::
420+
421+
If you are using LDAP for authorization and your LDAP group DNs
422+
contain `RFC4514 <https://tools.ietf.org/html/rfc4514>`_ escaped
423+
sequences, the roles you create in the ``admin`` database must also
424+
be escaped following RFC4514.
425+
418426
.. example::
419427

420428
A database has the following roles configured on the ``admin`` database:
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
.. important::
2+
3+
If you use :setting:`~security.ldap.userToDNMapping`\'s
4+
``substitution`` parameter to transform the group name, the result
5+
of the substitution **must** be an `RFC4514
6+
<https://www.ietf.org/rfc/rfc4514.txt>`_ escaped string.

source/includes/options-mongod.yaml

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2500,6 +2500,9 @@ description: |
25002500
corresponding `regex capture group
25012501
<http://www.regular-expressions.info/refcapture.html>`_ extracted
25022502
from the authentication username via the ``match`` regex.
2503+
2504+
The result of the substitution must be an `RFC4514
2505+
<https://www.ietf.org/rfc/rfc4514.txt>`_ escaped string.
25032506
25042507
- ``"cn={0},ou=engineering,
25052508
dc=example,dc=com"``
@@ -2520,6 +2523,14 @@ description: |
25202523
- ``"ou=engineering,dc=example,
25212524
dc=com??one?(user={0})"``
25222525
2526+
.. note::
2527+
2528+
An explanation of `RFC4514 <https://www.ietf.org/rfc/rfc4514.txt>`_,
2529+
`RFC4515 <https://tools.ietf.org/search/rfc4515>`_,
2530+
`RFC4516 <https://tools.ietf.org/html/rfc4516>`_, or LDAP queries is out
2531+
of scope for the MongoDB Documentation. Please review the RFC directly or
2532+
use your preferred LDAP resource.
2533+
25232534
For each document in the array, you must use either ``substitution`` or
25242535
``ldapQuery``. You *cannot* specify both in the same document.
25252536
@@ -2578,13 +2589,6 @@ description: |
25782589
This setting can be configured on a running {{program}} using the
25792590
:dbcommand:`setParameter` database command.
25802591
2581-
.. note::
2582-
2583-
An explanation of `RFC4515 <https://tools.ietf.org/search/rfc4515>`_,
2584-
`RFC4516 <https://tools.ietf.org/html/rfc4516>`_ or LDAP queries is out
2585-
of scope for the MongoDB Documentation. Please review the RFC directly or
2586-
use your preferred LDAP resource.
2587-
25882592
---
25892593
program: mongod
25902594
name: ldapAuthzQueryTemplate

source/includes/steps-configure-ldap-sasl-activedirectory-authentication.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,9 @@ pre: |
217217
:setting:`~security.ldap.authz.queryTemplate`, replacing the ``{USER}``
218218
token with the *transformed* username
219219
``CN=alice,CN=Users,DC=engineering,DC=example,DC=com``.
220+
221+
.. include:: /includes/admonition-important-userToDNMapping-escape.rst
222+
220223
---
221224
title: Configure query credentials.
222225
stepnum: 8

source/includes/steps-kerberos-auth-activedirectory-authz.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -375,6 +375,8 @@ pre: |
375375
token with the *transformed* username
376376
``CN=alice,CN=Users,DC=engineering,DC=example,DC=com``.
377377
378+
.. include:: /includes/admonition-important-userToDNMapping-escape.rst
379+
378380
---
379381
title: Configure query credentials.
380382
stepnum: 10

0 commit comments

Comments
 (0)