-
Notifications
You must be signed in to change notification settings - Fork 22
LDAP_parameters_PSMDB #1124
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: 8.0
Are you sure you want to change the base?
LDAP_parameters_PSMDB #1124
Changes from all commits
15083d0
37b19ff
ba378a2
fbd3c42
e5c5309
81f0521
7ddec88
204f0b6
0762574
c93faa2
fba88fd
32702af
a19768f
f637d87
8775b85
0f47ebc
831a390
6bbf4dc
6c9693f
a1d9b8f
e095e8c
86dc1fb
dfbc27f
db11cee
d74c01b
17d3f87
bcc71b8
ec7d54a
0c32e1d
e860bab
fa1ca22
2df5990
5ecace4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3,11 +3,11 @@ | |
| Percona Server for MongoDB provides a set of configuration parameters to enable and fine-tune LDAP authentication and authorization. | ||
|
|
||
|
|
||
| ## User-to-DN cache parameters | ||
| ## UsertoDN cache parameters | ||
|
|
||
| To reduce the number of round trips to the LDAP server during authentication and authorization, Percona Server for MongoDB caches the results of LDAP user-to-DN mapping configured by `security.ldap.userToDNMapping` (exposed as `--ldapUserToDNMapping` at startup and `ldapUserToDNMapping` at runtime). | ||
| To reduce the number of round trips to the LDAP server during authentication and authorization, Percona Server for MongoDB caches the results of LDAP UsertoDN mapping configured by `security.ldap.userToDNMapping` (exposed as `--ldapUserToDNMapping` at startup and `ldapUserToDNMapping` at runtime). | ||
|
|
||
| For more details on configuring user-to-DN mapping, see [LDAP authorization](authorization.md#username-transformation) and [Set up LDAP authentication and authorization using NativeLDAP](ldap-setup.md). | ||
| For more details on configuring UsertoDN mapping, see [LDAP authorization](authorization.md#username-transformation) and [Set up LDAP authentication and authorization using NativeLDAP](ldap-setup.md). | ||
|
|
||
| The cache is controlled by the following server parameters: | ||
|
|
||
|
|
@@ -30,6 +30,130 @@ The cache is automatically invalidated when any of the following parameters chan | |
| | `ldapUserToDNCacheTTLSeconds` | No | Changing the TTL value clears the cache. | | ||
| | `ldapUserToDNCacheSize` | No | Changing the cache size clears the cache. | | ||
| | `ldapServers` | Yes | Comma-separated list of LDAP servers to connect to. | | ||
| | `ldapQueryUser` | optional | Distinguished Name (DN) of the user used to perform LDAP queries. | | ||
| | `ldapQueryPassword` | optional | Password for the query user. | | ||
|
|
||
|
|
||
| ## Connection pool parameters | ||
|
|
||
| These parameters control how Percona Server for MongoDB maintains its pool of connections to the LDAP server. | ||
|
rasika-chivate marked this conversation as resolved.
|
||
|
|
||
|
|
||
| !!! info "Important" | ||
| All connection pool parameters are **startup-only**. They must be defined in the configuration file or via `--setParameter` at launch and cannot be changed via `db.adminCommand()` while the instance is running. | ||
|
|
||
|
|
||
| | Parameter | Required | Description | | ||
| | ------------------------------------------------------- | -------- | ---------------------------------------------------------------------------------------------------------------------------- | | ||
| | `ldapUseConnectionPool` | No | Enables/disables connection pooling. Default is OS dependent: `true` on Windows and specific Linux builds using `libldap_r`. | | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We don't support Windows!
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please clarify what's the default on what OS if possible. |
||
| | `ldapConnectionPoolHostRefreshIntervalMillis` | No | Frequency (in ms) of health checks for pooled connections. Default: `60000`. | | ||
|
rasika-chivate marked this conversation as resolved.
|
||
| | `ldapConnectionPoolIdleHostTimeoutSecs` | No | Seconds a pooled connection can remain idle before being closed. Default: `300`. | | ||
| | `ldapConnectionPoolMinimumConnectionsPerHost` | No | Minimum number of connections to maintain per LDAP host. Default: `1`. | | ||
| | `ldapConnectionPoolMaximumConnectionsPerHost` | No | Maximum number of open connections per LDAP host. Default: `2147483647`. | | ||
| | `ldapConnectionPoolMaximumConnectionsInProgressPerHost` | No | Limits concurrent **in-progress** connection attempts per host to prevent spikes. Default: `2`. | | ||
| | `ldapConnectionPoolUseLatencyForHostPriority` | No | When `true`, the pool prioritizes connections to hosts with the lowest latency. Default: `true`. | | ||
|
|
||
| ??? example "MongoDB configuration file (LDAP section)" | ||
| ```yaml | ||
| security: | ||
| authorization: enabled | ||
| ldap: | ||
| mode: authzAndAuthn | ||
| setParameter: | ||
| # --- Connection Pool Settings (Startup Only) --- | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think that comment is not needed |
||
| ldapUseConnectionPool: true | ||
|
rasika-chivate marked this conversation as resolved.
|
||
| ldapForceMultiThreadMode: true | ||
| ldapConnectionPoolMinimumConnectionsPerHost: 5 | ||
| ldapConnectionPoolMaximumConnectionsPerHost: 100 | ||
| ldapConnectionPoolIdleHostTimeoutSecs: 600 | ||
| ``` | ||
|
rasika-chivate marked this conversation as resolved.
|
||
|
|
||
| ## LDAP cache refresh parameters | ||
|
|
||
| As of **version 8.0.20-8**, Percona Server for MongoDB introduced parameters to optimize authentication performance and reduce unnecessary load on the LDAP server. These settings control how cached user information is refreshed, allowing administrators to fine-tune the balance between maintaining up-to-date user data and minimizing LDAP query overhead—especially in high-scale environments with many concurrent users. | ||
|
|
||
|
|
||
| | **Parameter** | **Required** | **Description** | | ||
| | ----------------------------------- | ------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why so many "-" dashes? |
||
| | `ldapUserCacheRefreshInterval` | No | Defines how often (in seconds) the server refreshes cached user information from LDAP when interval-based refresh is enabled through `ldapShouldRefreshUserCacheEntries=true`. If not explicitly configured, Percona Server for MongoDB uses the built-in default for the server version. Can be configured at startup and runtime. | | ||
| | `ldapShouldRefreshUserCacheEntries` | No | Selects the LDAP user cache refresh strategy. <br><br> - When set to `true`, each cached `$external` user is periodically re-fetched from the LDAP server at the interval defined by `ldapUserCacheRefreshInterval`. The cache is updated only if the user’s roles have changed; otherwise, existing entries remain untouched, ensuring no disruption. If a user no longer exists in LDAP, their cache entry is invalidated individually. <br><br> - When set to `false`, all `$external` users are evicted from the cache at intervals defined by `ldapUserCacheInvalidationInterval`. This preserves the behavior that existed prior to the introduction of `ldapUserCacheRefreshInterval` and `ldapShouldRefreshUserCacheEntries`. <br><br> Default: `false` (expiration-based invalidation using `ldapUserCacheInvalidationInterval`) to maintain backward-compatible behavior unless interval-based refreshing is explicitly enabled. The default value will change to `true` in future major versions. <br><br> This parameter can be configured at startup only.| | ||
| | `ldapUserCacheInvalidationInterval` | No | Defines the interval between total external user cache flushes, in seconds. Cached LDAP user entries are evicted after this interval and are re-acquired from LDAP on the next operation. Default: `30` seconds. This parameter can be configured at startup and runtime. | | ||
| | `ldapUserCacheStalenessInterval` | No | Defines how long `mongod` retains cached LDAP user information after a failed refresh attempt before invalidating the cache entry, in seconds. Maximum allowed value: `86400` seconds. Default: `30` seconds. This parameter can be configured at startup and runtime. | | ||
|
|
||
| ??? example "Interval-based refresh: `ldapShouldRefreshUserCacheEntries: true` " | ||
|
|
||
| === "Runtime (setParameter)" | ||
|
|
||
| ```{.javascript data-prompt=">"} | ||
| > db.adminCommand({ | ||
| ... setParameter: 1, | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please remove dots "..." they are not needed and prevent copying and pasting to the shell |
||
| ... ldapUserCacheRefreshInterval: 300 | ||
| ... }) | ||
| ``` | ||
|
|
||
| === "Command line" | ||
|
|
||
| ```bash | ||
| mongod --setParameter "ldapUserCacheRefreshInterval=300" \ | ||
| --setParameter "ldapShouldRefreshUserCacheEntries=true" | ||
| ``` | ||
|
|
||
| === "Configuration file" | ||
|
|
||
| ```yaml | ||
| setParameter: | ||
| ldapUserCacheRefreshInterval: 300 | ||
| ldapShouldRefreshUserCacheEntries: true | ||
| ``` | ||
|
rasika-chivate marked this conversation as resolved.
|
||
|
|
||
| ??? example "Expiration-based invalidation: `ldapShouldRefreshUserCacheEntries: false`" | ||
|
|
||
|
|
||
| === "Runtime (setParameter)" | ||
|
|
||
| ```{.javascript data-prompt=">"} | ||
| > db.adminCommand({ | ||
| ... setParameter: 1, | ||
| ... ldapUserCacheInvalidationInterval: 30 | ||
| ... }) | ||
| ``` | ||
|
|
||
| === "Command line" | ||
|
|
||
| ```bash | ||
| mongod --setParameter "ldapUserCacheInvalidationInterval=30" \ | ||
| --setParameter "ldapShouldRefreshUserCacheEntries=false" | ||
| ``` | ||
|
|
||
| === "Configuration file" | ||
|
|
||
| ```yaml | ||
| setParameter: | ||
| ldapUserCacheInvalidationInterval: 30 | ||
| ldapShouldRefreshUserCacheEntries: false | ||
| ``` | ||
|
rasika-chivate marked this conversation as resolved.
|
||
|
|
||
|
|
||
| ## Security and concurrency parameters | ||
|
|
||
| These parameters are used for LDAP server authentication, secure connection handling, and ensuring thread-safe operations during concurrent access. | ||
|
|
||
| | **Parameter** | **Required** | **Description** | | ||
| | -------------------------- | ------------ | -------------------------------------------------------------------------------------------------------------------------------------------- | | ||
| | `ldapQueryUser` | No | Specifies the DN (Distinguished Name) of the user that binds to the LDAP server. Default: `N/A`. | | ||
| | `ldapQueryPassword` | No | Specifies the password for `ldapQueryUser`. Default: `N/A`. | | ||
|
rasika-chivate marked this conversation as resolved.
|
||
| | `ldapForceMultiThreadMode` | No | Enables concurrent LDAP operations. Required for connection pooling. Use only with a thread-safe `libldap` implementation. Default: `false`. | | ||
| | `ldapRetryCount` | No | Specifies the number of times the server retries an LDAP operation after a network error. Default: `0`. | | ||
|
|
||
|
|
||
| ??? example "MongoDB configuration file: Performance and retries" | ||
|
|
||
| ```yaml | ||
| security: | ||
| authorization: enabled | ||
| ldap: | ||
| mode: authzAndAuthn | ||
| # --- Performance & Retries --- | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. comment not needed |
||
| setParameter: | ||
| ldapRetryCount: 3 | ||
| ``` | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.