Skip to content

Commit fcfc435

Browse files
committed
DOCS-11100: LDAP - substituted DNs must be RFC4514 escaped
1 parent 478fb2e commit fcfc435

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
@@ -403,10 +403,11 @@ MongoDB maps each returned group distinguished name (DN) returned by
403403
the LDAP :setting:`query <ldap.security.authz.queryTemplate>` to a
404404
:ref:`role <authorization>` on the ``admin`` database.
405405

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

411412
.. note::
412413

@@ -417,6 +418,13 @@ returned groups to a role, MongoDB grants no privileges to the user.
417418
appropriate roles in the ``admin`` database. Users still authenticate
418419
against the ``$external`` database.
419420

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

422430
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
@@ -2594,6 +2594,9 @@ description: |
25942594
corresponding `regex capture group
25952595
<http://www.regular-expressions.info/refcapture.html>`_ extracted
25962596
from the authentication username via the ``match`` regex.
2597+
2598+
The result of the substitution must be an `RFC4514
2599+
<https://www.ietf.org/rfc/rfc4514.txt>`_ escaped string.
25972600
25982601
- ``"cn={0},ou=engineering,
25992602
dc=example,dc=com"``
@@ -2614,6 +2617,14 @@ description: |
26142617
- ``"ou=engineering,dc=example,
26152618
dc=com??one?(user={0})"``
26162619
2620+
.. note::
2621+
2622+
An explanation of `RFC4514 <https://www.ietf.org/rfc/rfc4514.txt>`_,
2623+
`RFC4515 <https://tools.ietf.org/search/rfc4515>`_,
2624+
`RFC4516 <https://tools.ietf.org/html/rfc4516>`_, or LDAP queries is out
2625+
of scope for the MongoDB Documentation. Please review the RFC directly or
2626+
use your preferred LDAP resource.
2627+
26172628
For each document in the array, you must use either ``substitution`` or
26182629
``ldapQuery``. You *cannot* specify both in the same document.
26192630
@@ -2672,13 +2683,6 @@ description: |
26722683
This setting can be configured on a running {{program}} using the
26732684
:dbcommand:`setParameter` database command.
26742685
2675-
.. note::
2676-
2677-
An explanation of `RFC4515 <https://tools.ietf.org/search/rfc4515>`_,
2678-
`RFC4516 <https://tools.ietf.org/html/rfc4516>`_ or LDAP queries is out
2679-
of scope for the MongoDB Documentation. Please review the RFC directly or
2680-
use your preferred LDAP resource.
2681-
26822686
---
26832687
program: mongod
26842688
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)