You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
## Related PR
- Code PR: apache/doris#63411
## Versions
- [x] dev
- [ ] 4.x
- [ ] 3.x
- [ ] 2.1
## Languages
- [x] Chinese
- [x] English
## Summary
Adds documentation for `ldap_default_roles`, which allows Doris to grant
configured default roles to every LDAP-authenticated user.
The update explains:
1. How `ldap_default_roles` differs from the built-in `ldapDefaultRole`.
2. How default LDAP roles are merged with LDAP group roles and existing
Doris user privileges.
3. That roles configured in `ldap_default_roles` must already exist in
Doris.
4. How to configure `ldap_default_roles` in `ldap.conf`.
5. How to update `ldap_default_roles` online with `ADMIN SET FRONTEND
CONFIG`.
6. That online updates of `ldap_default_roles` refresh the LDAP user
cache automatically.
## Files
- `docs/admin-manual/auth/authentication/ldap.md`
-
`i18n/zh-CN/docusaurus-plugin-content-docs/current/admin-manual/auth/authentication/ldap.md`
@@ -35,6 +37,7 @@ Apache Doris supports integration with third-party LDAP services, so the existin
35
37
| --- | --- |
36
38
| Enterprise unified identity authentication | An LDAP/AD account system already exists, and you want Doris users to reuse it directly without creating accounts again in Doris |
37
39
| Centralized privilege management | Manage role members through LDAP groups; adjust LDAP group members to batch-adjust Doris privileges |
40
+
| Baseline privileges for LDAP users | Grant the same Doris roles to all LDAP-authenticated users through configuration, while still keeping LDAP group authorization |
38
41
| Temporary access | Users that exist only in LDAP can log in to Doris as temporary users based on LDAP group privileges |
39
42
| Encrypted channel | Encryption is required for the connection between Doris FE and the LDAP server (LDAPS) |
40
43
@@ -87,6 +90,7 @@ In LDAP, data is organized in a tree structure. The following is a typical LDAP
87
90
3.**Configure the client**: Enable the cleartext password plugin in the MySQL Client or JDBC Client to send the LDAP password.
88
91
4.**(Optional) Enable LDAPS**: Encrypt the channel between FE and LDAP.
89
92
5.**(Optional) Configure group authorization**: Create `role` in Doris with the same name as the LDAP groups and grant privileges.
93
+
6.**(Optional) Configure default roles**: Grant baseline Doris roles to all LDAP-authenticated users through `ldap_default_roles`.
@@ -126,6 +131,7 @@ The configuration items are explained below:
126
131
|`ldap_user_basedn`| The base `dn` for user search |
127
132
|`ldap_user_filter`| User match filter. `{login}` is replaced with the login user name |
128
133
|`ldap_group_basedn`| The base `dn` for group search, used for group authorization |
134
+
|`ldap_default_roles`| Optional. Comma-separated Doris roles granted to every LDAP-authenticated user. These roles are added in addition to LDAP group roles |
129
135
130
136
:::tip
131
137
To enable LDAPS (encrypted connection to the LDAP server), see the [LDAPS (Encrypted Connection)](#ldaps-encrypted-connection) section below.
@@ -235,8 +241,8 @@ After LDAP is enabled, the login behavior under different user states is as foll
235
241
236
242
- The temporary account is valid only for the current connection and is automatically destroyed after the connection is closed.
237
243
- Doris does not create persistent user metadata for a temporary user.
238
-
- The privileges of a temporary user are determined by LDAP group authorization (see the "Group Authorization"section below).
239
-
- If the temporary user has no corresponding group privileges, it has the `select_priv` privilege on `information_schema` by default.
244
+
- The privileges of a temporary user are determined by LDAP group authorization and `ldap_default_roles`(see the "Group Authorization"and "Default Roles for LDAP Users" sections below).
245
+
- If the temporary user has no corresponding group privileges or configured default roles, it has the `select_priv` privilege on `information_schema` by default.
240
246
241
247
:::
242
248
@@ -265,7 +271,7 @@ mysql -hDoris_HOST -PDoris_PORT -ujack -p 123456
265
271
266
272
- LDAP user attributes: `uid: jack`, password: `abcdef`
267
273
268
-
Log in with the LDAP password. Doris automatically creates the temporary user `jack@'%'` and logs in. The temporary user has the basic privilege `DatabasePrivs`: `Select_priv`, and is automatically destroyed after the connection is closed:
274
+
Log in with the LDAP password. Doris automatically creates the temporary user `jack@'%'` and logs in. The temporary user receives LDAP group roles and configured default roles if they are available. If no matching roles are available, it has the basic privilege `DatabasePrivs`: `Select_priv`, and is automatically destroyed after the connection is closed:
269
275
270
276
```sql
271
277
mysql -hDoris_HOST -PDoris_PORT -ujack -p abcdef
@@ -290,6 +296,7 @@ LDAP group authorization maps LDAP `group` to Doris `role`, providing centralize
290
296
291
297
- If the `dn` of an LDAP user appears in the `member` attribute of an LDAP group node, Doris considers the user to belong to that group.
292
298
- When the user logs in, Doris automatically grants the user the `role` privileges corresponding to the LDAP groups it belongs to.
299
+
- If `ldap_default_roles` is configured, Doris also grants those default roles to the user.
293
300
- After the user logs out, Doris automatically revokes these `role` privileges.
294
301
295
302
:::caution Prerequisites
@@ -302,9 +309,9 @@ The final privileges of the logged-in user depend on its state in LDAP and Doris
302
309
303
310
| LDAP user | Doris user | Final privileges |
304
311
| --------- | ---------- | ---------------- |
305
-
| Exists | Exists | LDAP group privileges + Doris user privileges |
312
+
| Exists | Exists | LDAP group privileges + configured default roles + Doris user privileges |
306
313
| Does not exist | Exists | Doris user privileges |
307
-
| Exists | Does not exist | LDAP group privileges |
314
+
| Exists | Does not exist | LDAP group privileges + configured default roles |
308
315
309
316
### Group Name Mapping Rules
310
317
@@ -331,6 +338,50 @@ Suppose user jack belongs to the LDAP groups `doris_rd`, `doris_qa`, and `doris_
331
338
332
339
:::
333
340
341
+
## Default Roles for LDAP Users
342
+
343
+
<!-- Knowledge type: Configuration parameters -->
344
+
<!-- Applicable scenario: Granting baseline Doris privileges to all LDAP-authenticated users -->
345
+
346
+
`ldap_default_roles` is used to grant baseline Doris roles to every LDAP-authenticated user. It is useful when all LDAP users should have the same basic privileges, but maintaining a dedicated LDAP group that contains all LDAP users is impractical.
347
+
348
+
`ldap_default_roles` does not replace LDAP group authorization. When an LDAP user logs in, Doris merges all of the following privileges:
349
+
350
+
- Doris roles mapped from the user's LDAP groups.
351
+
- Doris roles configured in `ldap_default_roles`.
352
+
- Existing privileges of the Doris user, if the same account also exists in Doris.
353
+
- The built-in `ldapDefaultRole`, which provides `select_priv` on `information_schema`.
354
+
355
+
:::caution Prerequisites
356
+
Roles listed in `ldap_default_roles` must already exist in Doris. If a configured role does not exist, Doris ignores that role and logs a warning.
357
+
:::
358
+
359
+
### Configure Default Roles
360
+
361
+
Create the roles and grant privileges to them:
362
+
363
+
```sql
364
+
CREATE ROLE ldap_readonly;
365
+
CREATE ROLE ldap_query_user;
366
+
367
+
GRANT SELECT_PRIV ON internal.example_db.* TO ROLE 'ldap_readonly';
368
+
GRANT SELECT_PRIV ON internal.example_db.example_table TO ROLE 'ldap_query_user';
ADMIN SET FRONTEND CONFIG ("ldap_default_roles" = "ldap_readonly,ldap_query_user");
381
+
```
382
+
383
+
After `ldap_default_roles` is updated online, Doris refreshes the LDAP user cache automatically so later LDAP logins can use the new default roles.
384
+
334
385
## LDAPS (Encrypted Connection)
335
386
336
387
<!-- Knowledge type: Configuration parameters -->
@@ -395,6 +446,8 @@ In the following scenarios, you may need to manually refresh the cache so that t
395
446
- User or group information in the LDAP service has been modified.
396
447
- The `Role` privileges corresponding to LDAP user groups in Doris have been modified.
397
448
449
+
Online updates to `ldap_default_roles` refresh the LDAP user cache automatically. You do not need to run `refresh ldap` only for this configuration change.
450
+
398
451
You can refresh the cache with the `refresh ldap` statement. For details, see [REFRESH-LDAP](../../../sql-manual/sql-statements/account-management/REFRESH-LDAP).
399
452
400
453
## Known Limitations
@@ -411,6 +464,8 @@ You can refresh the cache with the `refresh ldap` statement. For details, see [R
411
464
412
465
After logging in to Doris with an LDAP user, run `show grants;` to view all roles of the current user. Among them, `ldapDefaultRole` is the default role that every LDAP user has.
413
466
467
+
`ldapDefaultRole` is a built-in temporary role that provides `select_priv` on `information_schema`. It is different from roles configured in `ldap_default_roles`.
468
+
414
469
### Q: An LDAP user has fewer roles in Doris than expected. How do I troubleshoot?
415
470
416
471
Check the following items one by one:
@@ -419,6 +474,7 @@ Check the following items one by one:
419
474
2. Check whether the expected `group` is located under the organizational structure corresponding to `ldap_group_basedn`.
420
475
3. Check whether the expected `group` contains the `member` attribute.
421
476
4. Check whether the `member` attribute of the expected `group` contains the `dn` of the current user.
477
+
5. If the missing role is configured in `ldap_default_roles`, check whether the role name is spelled correctly and whether the role exists in Doris.
422
478
423
479
### Q: LDAPS connection fails. How do I troubleshoot?
0 commit comments