ldap-rest 0.1.3 → 0.1.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (78) hide show
  1. package/README.md +31 -21
  2. package/dist/abstract/ldapFlat.js +1 -1
  3. package/dist/lib/ldapActions.js +1 -1
  4. package/dist/plugins/ldap/groups.js +1 -1
  5. package/dist/src/abstract/ldapFlat.d.ts +9 -0
  6. package/dist/src/browser/ldap-user-editor/components/UserTree.d.ts +2 -1
  7. package/dist/src/browser/shared/components/DisposableComponent.d.ts +29 -0
  8. package/dist/src/browser/shared/components/Modal.d.ts +6 -1
  9. package/dist/src/lib/ldapActions.d.ts +9 -0
  10. package/dist/src/plugins/ldap/groups.d.ts +9 -0
  11. package/docs/README.md +23 -486
  12. package/docs/{DEVELOPER_GUIDE.md → client-development/README.md} +24 -24
  13. package/docs/client-development/api/README.md +75 -0
  14. package/docs/client-development/browser/README.md +65 -0
  15. package/docs/{plugins/DEVELOPMENT.md → plugin-development/README.md} +4 -9
  16. package/docs/plugin-development/hooks.md +18 -0
  17. package/docs/usage/README.md +89 -0
  18. package/docs/usage/configuration.md +375 -0
  19. package/docs/usage/plugins/README.md +87 -0
  20. package/docs/usage/plugins/auth/README.md +65 -0
  21. package/docs/usage/plugins/auth/crowdsec.md +95 -0
  22. package/docs/usage/plugins/auth/hmac.md +293 -0
  23. package/docs/usage/plugins/auth/llng.md +99 -0
  24. package/docs/usage/plugins/auth/oidc.md +167 -0
  25. package/docs/usage/plugins/auth/rate-limit.md +62 -0
  26. package/docs/usage/plugins/auth/token.md +136 -0
  27. package/docs/usage/plugins/auth/totp.md +213 -0
  28. package/docs/usage/plugins/auth/trusted-proxy.md +127 -0
  29. package/docs/usage/plugins/integrations/README.md +42 -0
  30. package/docs/usage/plugins/ldap/README.md +79 -0
  31. package/docs/usage/troubleshooting.md +105 -0
  32. package/package.json +9 -1
  33. package/static/browser/ldap-user-editor/components/UserTree.js +6 -3
  34. package/static/browser/ldap-user-editor/components/UserTree.js.map +1 -1
  35. package/static/browser/ldap-user-editor.esm.js +62 -3
  36. package/static/browser/ldap-user-editor.esm.js.map +1 -1
  37. package/static/browser/ldap-user-editor.js +62 -3
  38. package/static/browser/ldap-user-editor.js.map +1 -1
  39. package/static/browser/ldap-user-editor.min.js +1 -1
  40. package/static/browser/ldap-user-editor.min.js.map +1 -1
  41. package/static/browser/shared/components/DisposableComponent.js +59 -0
  42. package/static/browser/shared/components/DisposableComponent.js.map +1 -0
  43. package/static/browser/shared/components/Modal.js +16 -6
  44. package/static/browser/shared/components/Modal.js.map +1 -1
  45. package/static/browser/shared.esm.js +72 -6
  46. package/static/browser/shared.esm.js.map +1 -1
  47. package/static/browser/shared.js +72 -6
  48. package/static/browser/shared.js.map +1 -1
  49. package/static/browser/shared.min.js +1 -1
  50. package/static/browser/shared.min.js.map +1 -1
  51. package/docs/authentication.md +0 -1194
  52. /package/docs/{OPENAPI.md → client-development/api/openapi.md} +0 -0
  53. /package/docs/{api/REFERENCE.md → client-development/api/reference.md} +0 -0
  54. /package/docs/{api/REST_API.md → client-development/api/rest-api.md} +0 -0
  55. /package/docs/{browser/LIBRARIES.md → client-development/browser/libraries.md} +0 -0
  56. /package/docs/{examples/EXAMPLES.md → client-development/examples/README.md} +0 -0
  57. /package/docs/{examples → client-development/examples/ldif}/twake-mailbox-type-nomenclature.ldif +0 -0
  58. /package/docs/{examples → client-development/examples/ldif}/twake-mailbox-type-schema-amendment.ldif +0 -0
  59. /package/docs/{schemas/SCHEMAS.md → client-development/schemas/README.md} +0 -0
  60. /package/docs/{PLUGIN_DEPENDENCIES.md → plugin-development/dependencies.md} +0 -0
  61. /package/docs/{testing-with-embedded-ldap.md → plugin-development/testing.md} +0 -0
  62. /package/docs/{presenterm.md → presentations/en.md} +0 -0
  63. /package/docs/{presenterm-fr.md → presentations/fr.md} +0 -0
  64. /package/docs/{authzLinid1.md → usage/plugins/auth/authz-linid1.md} +0 -0
  65. /package/docs/{authzPerBranch.md → usage/plugins/auth/authz-per-branch.md} +0 -0
  66. /package/docs/{twakeAppAccountsApi.md → usage/plugins/integrations/app-accounts.md} +0 -0
  67. /package/docs/{twakeCalendarResources.md → usage/plugins/integrations/calendar-resources.md} +0 -0
  68. /package/docs/{twakeJames.md → usage/plugins/integrations/james-mail.md} +0 -0
  69. /package/docs/{jamesTeamMailboxes.md → usage/plugins/integrations/james-mailboxes.md} +0 -0
  70. /package/docs/{ldapBulkImport.md → usage/plugins/ldap/bulk-import.md} +0 -0
  71. /package/docs/{ldapExternalUsersInGroups.md → usage/plugins/ldap/external-users.md} +0 -0
  72. /package/docs/{ldapFlatGeneric.md → usage/plugins/ldap/flat-generic.md} +0 -0
  73. /package/docs/{ldapGroups.md → usage/plugins/ldap/groups.md} +0 -0
  74. /package/docs/{onChange.md → usage/plugins/ldap/on-change.md} +0 -0
  75. /package/docs/{ldapOrganizations.md → usage/plugins/ldap/organizations.md} +0 -0
  76. /package/docs/{ldapTrash.md → usage/plugins/ldap/trash.md} +0 -0
  77. /package/docs/{static.md → usage/plugins/utilities/static.md} +0 -0
  78. /package/docs/{weblogs.md → usage/plugins/utilities/weblogs.md} +0 -0
@@ -0,0 +1,75 @@
1
+ # REST API
2
+
3
+ LDAP-Rest REST API documentation.
4
+
5
+ ## Overview
6
+
7
+ The LDAP-Rest REST API exposes endpoints for managing LDAP entities.
8
+
9
+ ## Documentation
10
+
11
+ - **[rest-api.md](rest-api.md)** - Complete API usage guide
12
+ - **[reference.md](reference.md)** - Technical reference (HTTP codes, headers, URL encoding)
13
+ - **[openapi.md](openapi.md)** - OpenAPI specification
14
+
15
+ ## Authentication
16
+
17
+ All API requests require authentication. See the [authentication documentation](../../usage/plugins/auth/README.md).
18
+
19
+ ### Token Example
20
+
21
+ ```bash
22
+ curl -H "Authorization: Bearer your-token" \
23
+ http://localhost:8081/api/v1/ldap/users
24
+ ```
25
+
26
+ ## Main Endpoints
27
+
28
+ ### Entities (ldapFlatGeneric)
29
+
30
+ ```
31
+ GET /api/v1/ldap/{pluralName} # List
32
+ GET /api/v1/ldap/{pluralName}/{id} # Get
33
+ POST /api/v1/ldap/{pluralName} # Create
34
+ PUT /api/v1/ldap/{pluralName}/{id} # Modify
35
+ DELETE /api/v1/ldap/{pluralName}/{id} # Delete
36
+ ```
37
+
38
+ ### Groups
39
+
40
+ ```
41
+ GET /api/v1/ldap/groups
42
+ GET /api/v1/ldap/groups/{cn}
43
+ POST /api/v1/ldap/groups
44
+ PUT /api/v1/ldap/groups/{cn}
45
+ DELETE /api/v1/ldap/groups/{cn}
46
+ ```
47
+
48
+ ### Organizations
49
+
50
+ ```
51
+ GET /api/v1/ldap/organizations/top
52
+ GET /api/v1/ldap/organizations/{dn}/subnodes
53
+ POST /api/v1/ldap/organizations
54
+ PUT /api/v1/ldap/organizations/{dn}
55
+ DELETE /api/v1/ldap/organizations/{dn}
56
+ ```
57
+
58
+ ### Configuration
59
+
60
+ ```
61
+ GET /api/v1/config # Available capabilities and schemas
62
+ ```
63
+
64
+ ## Response Codes
65
+
66
+ | Code | Description |
67
+ | ---- | ------------------------- |
68
+ | 200 | Success |
69
+ | 201 | Created |
70
+ | 400 | Invalid request |
71
+ | 401 | Not authenticated |
72
+ | 403 | Access forbidden |
73
+ | 404 | Not found |
74
+ | 409 | Conflict (existing entry) |
75
+ | 500 | Server error |
@@ -0,0 +1,65 @@
1
+ # Browser Libraries
2
+
3
+ Web components for integrating LDAP-Rest into your applications.
4
+
5
+ ## Overview
6
+
7
+ LDAP-Rest provides reusable web components for LDAP management.
8
+
9
+ ## Documentation
10
+
11
+ - **[libraries.md](libraries.md)** - Complete component documentation
12
+
13
+ ## Available Components
14
+
15
+ | Component | Description |
16
+ | -------------------- | ------------------------------ |
17
+ | `LdapTreeViewer` | LDAP tree navigation |
18
+ | `LdapUserEditor` | User editing |
19
+ | `LdapGroupEditor` | Group management |
20
+ | `LdapUnitEditor` | Organizational unit management |
21
+ | `LdapResourceEditor` | Resource management |
22
+
23
+ ## Utilities
24
+
25
+ | Module | Description |
26
+ | ----------------------------- | ------------------------------ |
27
+ | `browser-shared-utils-totp` | TOTP client for authentication |
28
+ | `browser-shared-utils-hmac` | HMAC client for authentication |
29
+ | `browser-shared-utils-dom` | DOM utilities |
30
+ | `browser-shared-utils-form` | Form utilities |
31
+ | `browser-shared-utils-schema` | JSON schema utilities |
32
+
33
+ ## Installation
34
+
35
+ ```bash
36
+ npm install ldap-rest
37
+ ```
38
+
39
+ ## Import
40
+
41
+ ```typescript
42
+ // Components
43
+ import { LdapTreeViewer, LdapUserEditor } from 'ldap-rest/browser';
44
+
45
+ // Utilities
46
+ import { TotpAuthClient } from 'ldap-rest/browser-shared-utils-totp';
47
+ import { HmacAuthClient } from 'ldap-rest/browser-shared-utils-hmac';
48
+ ```
49
+
50
+ ## Quick Example
51
+
52
+ ```typescript
53
+ import { LdapTreeViewer } from 'ldap-rest/browser';
54
+
55
+ const viewer = new LdapTreeViewer({
56
+ apiUrl: 'http://localhost:8081/api/v1',
57
+ container: document.getElementById('tree'),
58
+ });
59
+
60
+ viewer.render();
61
+ ```
62
+
63
+ ## Demos
64
+
65
+ Interactive examples are available in the [examples](../examples/README.md) folder.
@@ -205,15 +205,10 @@ Create a standalone file anywhere on your system, e.g., `/opt/custom-plugins/my-
205
205
  */
206
206
  import type { Express, Request, Response } from 'express';
207
207
 
208
- // Import from ldap-rest (if installed as npm package)
209
- // import DmPlugin, { asyncHandler } from 'ldap-rest/plugin';
210
-
211
- // Or use relative path to node_modules
212
- import DmPlugin from './node_modules/ldap-rest/dist/abstract/plugin.js';
213
- import type { DM } from './node_modules/ldap-rest/dist/bin/index.js';
214
- import type { Hooks } from './node_modules/ldap-rest/dist/hooks.js';
215
- // Import asyncHandler for error handling
216
- import { asyncHandler } from './node_modules/ldap-rest/dist/lib/utils.js';
208
+ // Import from ldap-rest
209
+ import DmPlugin, { asyncHandler } from 'ldap-rest/plugin';
210
+ import type { DM } from 'ldap-rest';
211
+ import type { Hooks } from 'ldap-rest/hooks';
217
212
 
218
213
  export default class ExternalAuditPlugin extends DmPlugin {
219
214
  name = 'externalAudit';
@@ -0,0 +1,18 @@
1
+ # Core hooks
2
+
3
+ Set here the documentation of all hooks.
4
+
5
+ Typescript definitions into [hooks.ts](./src/hooks.ts)
6
+
7
+ ## Demo hooks
8
+
9
+ - **hello**: called by [helloworld demo plugin](./src/plugins/helloworld.ts)
10
+
11
+ ## [LDAP](./src/lib/ldapActions.ts) hooks
12
+
13
+ - **ldapopts**: called before any ldapsearch to modify search options
14
+ - **ldapsearchresult**: called after any ldapsearch to modify search result
15
+ - **ldapaddrequest**: called before any ldapadd
16
+ - **ldapmodifyrequest**: called before any ldapmodify
17
+ - **ldapdeleterequest**: called before any ldapdelete
18
+ - **ldaprenamerequest**: called before any ldap rename/modifyDN operation
@@ -0,0 +1,89 @@
1
+ # Usage - Getting Started
2
+
3
+ Getting started and usage guide for LDAP-Rest.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm install ldap-rest
9
+ ```
10
+
11
+ ## Quick Start
12
+
13
+ ### Minimal Configuration
14
+
15
+ ```bash
16
+ ldap-rest \
17
+ --plugin core/ldap/flatGeneric \
18
+ --ldap-url ldap://localhost:389 \
19
+ --ldap-dn "cn=admin,dc=example,dc=com" \
20
+ --ldap-pwd "password" \
21
+ --ldap-base "dc=example,dc=com" \
22
+ --ldap-flat-schema ./schemas/standard/users.json
23
+ ```
24
+
25
+ ### With Authentication
26
+
27
+ ```bash
28
+ ldap-rest \
29
+ --plugin core/auth/token \
30
+ --plugin core/ldap/flatGeneric \
31
+ --auth-token "secret-token" \
32
+ --ldap-flat-schema ./schemas/standard/users.json \
33
+ ...
34
+ ```
35
+
36
+ ### Complete Configuration
37
+
38
+ ```bash
39
+ ldap-rest \
40
+ --plugin core/auth/token \
41
+ --plugin core/ldap/flatGeneric \
42
+ --plugin core/ldap/groups \
43
+ --plugin core/ldap/organization \
44
+ --plugin core/ldap/bulkImport \
45
+ --plugin core/ldap/externalUsersInGroups \
46
+ --plugin core/static \
47
+ --plugin core/weblogs \
48
+ --ldap-flat-schema ./schemas/standard/users.json \
49
+ --bulk-import-schemas "users:./schemas/standard/users.json" \
50
+ --auth-token "admin-token" \
51
+ --static-path ./static \
52
+ ...
53
+ ```
54
+
55
+ ## LDAP Connection
56
+
57
+ ### Single URL
58
+
59
+ ```bash
60
+ --ldap-url ldap://localhost:389
61
+ ```
62
+
63
+ ### Failover (High Availability)
64
+
65
+ ```bash
66
+ --ldap-url ldap://ldap1.example.com,ldap://ldap2.example.com,ldap://ldap3.example.com
67
+ ```
68
+
69
+ The system will:
70
+
71
+ 1. Try each URL in order
72
+ 2. Use the first successful connection
73
+ 3. Automatically failover on connection failure
74
+
75
+ ## Log Levels
76
+
77
+ ```bash
78
+ --log-level error # Errors only
79
+ --log-level warn # Warnings and errors
80
+ --log-level notice # Web access logs (recommended for production)
81
+ --log-level info # General information
82
+ --log-level debug # Everything, including debug output
83
+ ```
84
+
85
+ ## Next Steps
86
+
87
+ - **[Configuration](configuration.md)** - CLI options and environment variables
88
+ - **[Plugins](plugins/README.md)** - Choose and configure plugins
89
+ - **[Troubleshooting](troubleshooting.md)** - Problem resolution
@@ -0,0 +1,375 @@
1
+ # Configuration
2
+
3
+ All LDAP-Rest configuration options.
4
+
5
+ ## Table of Contents
6
+
7
+ - [Environment Variables](#environment-variables)
8
+ - [Array Options](#array-options)
9
+ - [General Options](#general-options)
10
+ - [LDAP Connection](#ldap-connection)
11
+ - [Special Attributes](#special-attributes)
12
+ - [Plugin Options](#plugin-options)
13
+ - [LDAP Plugins](#ldap-plugins)
14
+ - [core/ldap/organizations](#coreldaporganizations)
15
+ - [core/ldap/groups](#coreldapgroups)
16
+ - [core/ldap/externalUsersInGroups](#coreldapexternalusersingroups)
17
+ - [core/ldap/flatGeneric](#coreldapflatgeneric)
18
+ - [core/ldap/bulkImport](#coreldapbulkimport)
19
+ - [core/ldap/trash](#coreldaptrash)
20
+ - [core/ldap/onChange](#coreldaponchange)
21
+ - [core/ldap/departmentSync](#coreldapdepartmentsync)
22
+ - [Authentication Plugins](#authentication-plugins)
23
+ - [core/auth/token](#coreauthtoken)
24
+ - [core/auth/totp](#coreauthtotp)
25
+ - [core/auth/hmac](#coreauthhmac)
26
+ - [core/auth/llng](#coreauthllng)
27
+ - [core/auth/openidconnect](#coreauthopenidconnect)
28
+ - [Authorization Plugins](#authorization-plugins)
29
+ - [core/auth/authzPerBranch](#coreauthauthzperbranch)
30
+ - [core/auth/authzLinid1](#coreauthauthzlinid1)
31
+ - [Security Plugins](#security-plugins)
32
+ - [core/auth/rateLimit](#coreauthratelimit)
33
+ - [core/auth/crowdsec](#coreauthcrowdsec)
34
+ - [core/auth/trustedProxy](#coreauthtrustedproxy)
35
+ - [Twake Integration Plugins](#twake-integration-plugins)
36
+ - [core/twake/james](#coretwakejames)
37
+ - [core/twake/calendarResources](#coretwakecalendarresources)
38
+ - [core/twake/applicativeAccounts](#coretwakeapplicativeaccounts)
39
+ - [core/twake/appAccountsConsistency](#coretwakeappaccountsconsistency)
40
+ - [Utility Plugins](#utility-plugins)
41
+ - [core/static](#corestatic)
42
+ - [core/weblogs](#coreweblogs)
43
+ - [core/configApi](#coreconfigapi)
44
+ - [Configuration File](#configuration-file)
45
+ - [LDAP Failover](#ldap-failover)
46
+ - [Log Levels (`--log-level`)](#log-levels---log-level)
47
+
48
+ ## Environment Variables
49
+
50
+ All CLI options can be set via environment variables with the `DM_` prefix.
51
+
52
+ ### Array Options
53
+
54
+ Some options accept multiple values (e.g., `--plugin`, `--auth-token`, `--ldap-url`). These can be configured in several ways:
55
+
56
+ **Via CLI - repeat the option:**
57
+
58
+ ```bash
59
+ ldap-rest --plugin core/auth/token --plugin core/ldap/flatGeneric --plugin core/ldap/groups
60
+ ```
61
+
62
+ **Via CLI - use plural form with comma-separated values:**
63
+
64
+ ```bash
65
+ ldap-rest --plugins core/auth/token,core/ldap/flatGeneric,core/ldap/groups
66
+ ```
67
+
68
+ **Via environment variable - use `;` or `,` as separator:**
69
+
70
+ ```bash
71
+ # Semicolon separator (preferred for values containing commas)
72
+ export DM_PLUGINS="core/auth/token;core/ldap/flatGeneric;core/ldap/groups"
73
+
74
+ # Comma separator
75
+ export DM_PLUGINS="core/auth/token,core/ldap/flatGeneric,core/ldap/groups"
76
+ ```
77
+
78
+ > **Note:** If the value contains a semicolon, it will be used as the separator. Otherwise, commas are used. Whitespace around separators is ignored.
79
+
80
+ ## General Options
81
+
82
+ | CLI | Plural | Env | Default | Description |
83
+ | ---------------- | ---------------- | ----------------- | ---------------- | ------------------------------------------- |
84
+ | `--port` | | `DM_PORT` | `8081` | Listen port |
85
+ | `--plugin` | `--plugins` | `DM_PLUGINS` | `[]` | Plugins to load |
86
+ | `--log-level` | | `DM_LOG_LEVEL` | `notice` | Log level: error, warn, notice, info, debug |
87
+ | `--logger` | | `DM_LOGGER` | `console` | Logger type |
88
+ | `--api-prefix` | | `DM_API_PREFIX` | `/api` | API URL prefix |
89
+ | `--mail-domain` | `--mail-domains` | `DM_MAIL_DOMAIN` | `[]` | Mail domains |
90
+ | `--schemas-path` | | `DM_SCHEMAS_PATH` | `static/schemas` | Path to JSON schemas |
91
+
92
+ ## LDAP Connection
93
+
94
+ | CLI | Plural | Env | Default | Description |
95
+ | ---------------------------- | ---------------- | ------------------------ | ---------------------------------- | -------------------------- |
96
+ | `--ldap-url` | `--ldap-urls` | `DM_LDAP_URL` | `ldap://localhost` | LDAP server URL(s) |
97
+ | `--ldap-dn` | | `DM_LDAP_DN` | `cn=admin,dc=example,dc=com` | Bind DN |
98
+ | `--ldap-pwd` | | `DM_LDAP_PWD` | `admin` | Password |
99
+ | `--ldap-base` | | `DM_LDAP_BASE` | | Base DN for searches |
100
+ | `--ldap-user-main-attribute` | | `DM_LDAP_USER_ATTRIBUTE` | `uid` | User identifier attribute |
101
+ | `--ldap-cache-max` | | `DM_LDAP_CACHE_MAX` | `1000` | Max cache entries |
102
+ | `--ldap-cache-ttl` | | `DM_LDAP_CACHE_TTL` | `300` | Cache TTL (seconds) |
103
+ | `--ldap-pool-size` | | `DM_LDAP_POOL_SIZE` | `5` | Connection pool size |
104
+ | `--ldap-connection-ttl` | | `DM_LDAP_CONNECTION_TTL` | `60` | Connection TTL (seconds) |
105
+ | `--user-class` | `--user-classes` | `DM_USER_CLASSES` | `top,twakeAccount,twakeWhitePages` | Default user objectClasses |
106
+
107
+ ## Special Attributes
108
+
109
+ | CLI | Env | Default | Description |
110
+ | -------------------------- | --------------------------- | ----------------------- | ---------------------- |
111
+ | `--mail-attribute` | `DM_MAIL_ATTRIBUTE` | `mail` | Email attribute |
112
+ | `--quota-attribute` | `DM_QUOTA_ATTRIBUTE` | `mailQuota` | Quota attribute |
113
+ | `--delegation-attribute` | `DM_DELEGATION_ATTRIBUTE` | `twakeDelegatedUsers` | Delegation attribute |
114
+ | `--alias-attribute` | `DM_ALIAS_ATTRIBUTE` | `mailAlternateAddress` | Email alias attribute |
115
+ | `--forward-attribute` | `DM_FORWARD_ATTRIBUTE` | `mailForwardingAddress` | Forward attribute |
116
+ | `--display-name-attribute` | `DM_DISPLAY_NAME_ATTRIBUTE` | `displayName` | Display name attribute |
117
+
118
+ ## Plugin Options
119
+
120
+ ### LDAP Plugins
121
+
122
+ #### `core/ldap/organizations`
123
+
124
+ | CLI | Plural | Env | Default | Description |
125
+ | ------------------------------------ | ----------------------------- | ------------------------------------- | ---------------------------------------- | -------------------------- |
126
+ | `--ldap-top-organization` | | `DM_LDAP_TOP_ORGANIZATION` | | Top organization DN |
127
+ | `--ldap-organization-class` | `--ldap-organization-classes` | `DM_LDAP_ORGANIZATION_CLASSES` | `top,organizationalUnit,twakeDepartment` | Organization objectClasses |
128
+ | `--ldap-organization-link-attribute` | | `DM_LDAP_ORGANIZATION_LINK_ATTRIBUTE` | `twakeDepartmentLink` | Link attribute |
129
+ | `--ldap-organization-path-attribute` | | `DM_LDAP_ORGANIZATION_PATH_ATTRIBUTE` | `twakeDepartmentPath` | Path attribute |
130
+ | `--ldap-organization-path-separator` | | `DM_LDAP_ORGANIZATION_PATH_SEPARATOR` | `/` | Path separator |
131
+ | `--ldap-organization-max-subnodes` | | `DM_LDAP_ORGANIZATION_MAX_SUBNODES` | `50` | Max subnodes returned |
132
+
133
+ #### `core/ldap/groups`
134
+
135
+ | CLI | Plural | Env | Default | Description |
136
+ | ---------------------------------- | ----------------- | ------------------------------- | ---------------------------------- | --------------------------- |
137
+ | `--ldap-group-base` | | `DM_LDAP_GROUP_BASE` | | Groups base DN |
138
+ | `--ldap-groups-main-attribute` | | `DM_LDAP_GROUPS_MAIN_ATTRIBUTE` | `cn` | Group identifier attribute |
139
+ | `--group-class` | `--group-classes` | `DM_GROUP_CLASSES` | `top,groupOfNames` | Group objectClasses |
140
+ | `--group-allow-unexistent-members` | | `DM_ALLOW_UNEXISTENT_MEMBERS` | `false` | Allow non-existent members |
141
+ | `--group-default-attributes` | | `DM_GROUP_DEFAULT_ATTRIBUTES` | `{}` | Default attributes (JSON) |
142
+ | `--group-dummy-user` | | `DM_GROUP_DUMMY_USER` | `cn=fakeuser` | Dummy user for empty groups |
143
+ | `--group-schema` | | `DM_GROUP_SCHEMA` | `static/schemas/twake/groups.json` | Group JSON schema path |
144
+
145
+ #### `core/ldap/externalUsersInGroups`
146
+
147
+ | CLI | Plural | Env | Default | Description |
148
+ | --------------------------- | --------------------------- | ---------------------------- | ------------------------------- | --------------------------- |
149
+ | `--external-members-branch` | | `DM_EXTERNAL_MEMBERS_BRANCH` | `ou=contacts,dc=example,dc=com` | External contacts branch |
150
+ | `--external-branch-class` | `--external-branch-classes` | `DM_EXTERNAL_BRANCH_CLASSES` | `top,inetOrgPerson` | External user objectClasses |
151
+
152
+ #### `core/ldap/flatGeneric`
153
+
154
+ | CLI | Plural | Env | Default | Description |
155
+ | -------------------- | --------------------- | --------------------- | ------- | --------------------- |
156
+ | `--ldap-flat-schema` | `--ldap-flat-schemas` | `DM_LDAP_FLAT_SCHEMA` | `[]` | Entity schema path(s) |
157
+
158
+ #### `core/ldap/bulkImport`
159
+
160
+ | CLI | Env | Default | Description |
161
+ | ----------------------------- | ------------------------------ | ---------- | ------------------------ |
162
+ | `--bulk-import-schemas` | `DM_BULK_IMPORT_SCHEMAS` | | Bulk import schemas path |
163
+ | `--bulk-import-max-file-size` | `DM_BULK_IMPORT_MAX_FILE_SIZE` | `10485760` | Max file size (bytes) |
164
+ | `--bulk-import-batch-size` | `DM_BULK_IMPORT_BATCH_SIZE` | `100` | Batch size |
165
+
166
+ #### `core/ldap/trash`
167
+
168
+ | CLI | Env | Default | Description |
169
+ | ----------------------- | ------------------------ | ------- | --------------------------- |
170
+ | `--trash-base` | `DM_TRASH_BASE` | | Trash container DN |
171
+ | `--trash-watched-bases` | `DM_TRASH_WATCHED_BASES` | | DNs to watch for deletions |
172
+ | `--trash-add-metadata` | `DM_TRASH_ADD_METADATA` | `true` | Add deletion metadata |
173
+ | `--trash-auto-create` | `DM_TRASH_AUTO_CREATE` | `true` | Auto-create trash container |
174
+
175
+ #### `core/ldap/onChange`
176
+
177
+ Monitors LDAP modifications and triggers hooks for attribute changes. No configuration options - uses [Special Attributes](#special-attributes) settings.
178
+
179
+ **Hooks triggered:**
180
+
181
+ - `onLdapChange` - Any LDAP modification
182
+ - `onLdapMailChange` - Mail attribute changes
183
+ - `onLdapQuotaChange` - Quota attribute changes
184
+ - `onLdapAliasChange` - Alias attribute changes
185
+ - `onLdapForwardChange` - Forward attribute changes
186
+ - `onLdapDisplayNameChange` - Display name changes (cn, givenName, sn)
187
+
188
+ #### `core/ldap/departmentSync`
189
+
190
+ Maintains consistency of department links when organizations are renamed/moved. No configuration options - uses [core/ldap/organizations](#coreldaporganizations) settings.
191
+
192
+ ### Authentication Plugins
193
+
194
+ #### `core/auth/token`
195
+
196
+ | CLI | Plural | Env | Default | Description |
197
+ | -------------- | --------------- | ---------------- | ------- | --------------------- |
198
+ | `--auth-token` | `--auth-tokens` | `DM_AUTH_TOKENS` | `[]` | Authentication tokens |
199
+
200
+ #### `core/auth/totp`
201
+
202
+ | CLI | Plural | Env | Default | Description |
203
+ | -------------------- | -------------- | --------------------- | ------- | -------------------------------- |
204
+ | `--auth-totp` | `--auth-totps` | `DM_AUTH_TOTP` | `[]` | TOTP config (secret:name:digits) |
205
+ | `--auth-totp-window` | | `DM_AUTH_TOTP_WINDOW` | `1` | Validation window |
206
+ | `--auth-totp-step` | | `DM_AUTH_TOTP_STEP` | `30` | Time step (seconds) |
207
+
208
+ #### `core/auth/hmac`
209
+
210
+ | CLI | Plural | Env | Default | Description |
211
+ | -------------------- | -------------- | --------------------- | -------- | ------------------------------------ |
212
+ | `--auth-hmac` | `--auth-hmacs` | `DM_AUTH_HMAC` | `[]` | HMAC config (service-id:secret:name) |
213
+ | `--auth-hmac-window` | | `DM_AUTH_HMAC_WINDOW` | `120000` | Time window (ms) |
214
+
215
+ #### `core/auth/llng`
216
+
217
+ | CLI | Env | Default | Description |
218
+ | ------------ | ------------- | ------------------------------------ | ------------------------- |
219
+ | `--llng-ini` | `DM_LLNG_INI` | `/etc/lemonldap-ng/lemonldap-ng.ini` | LemonLDAP::NG config path |
220
+
221
+ #### `core/auth/openidconnect`
222
+
223
+ | CLI | Env | Default | Description |
224
+ | ---------------------- | ----------------------- | ------- | ------------------------ |
225
+ | `--oidc-server` | `DM_OIDC_SERVER` | | OIDC server URL |
226
+ | `--oidc-client-id` | `DM_OIDC_CLIENT_ID` | | OIDC Client ID |
227
+ | `--oidc-client-secret` | `DM_OIDC_CLIENT_SECRET` | | OIDC Client Secret |
228
+ | `--base-url` | `DM_BASE_URL` | | Public URL for callbacks |
229
+
230
+ ### Authorization Plugins
231
+
232
+ #### `core/auth/authzPerBranch`
233
+
234
+ | CLI | Env | Default | Description |
235
+ | ------------------------------ | ------------------------------- | ------------------------------------------------ | --------------------------- |
236
+ | `--authz-per-branch-config` | `DM_AUTHZ_PER_BRANCH_CONFIG` | `{default:{read:true,write:false,delete:false}}` | Authorization config (JSON) |
237
+ | `--authz-per-branch-cache-ttl` | `DM_AUTHZ_PER_BRANCH_CACHE_TTL` | `60` | Cache TTL (seconds) |
238
+
239
+ #### `core/auth/authzLinid1`
240
+
241
+ | CLI | Env | Default | Description |
242
+ | ------------------------------- | -------------------------------- | --------------------- | --------------------- |
243
+ | `--authz-local-admin-attribute` | `DM_AUTHZ_LOCAL_ADMIN_ATTRIBUTE` | `twakeLocalAdminLink` | Local admin attribute |
244
+
245
+ ### Security Plugins
246
+
247
+ #### `core/auth/rateLimit`
248
+
249
+ | CLI | Env | Default | Description |
250
+ | ------------------------ | ------------------------- | -------- | ------------------------ |
251
+ | `--rate-limit-window-ms` | `DM_RATE_LIMIT_WINDOW_MS` | `900000` | Time window (ms, 15 min) |
252
+ | `--rate-limit-max` | `DM_RATE_LIMIT_MAX` | `100` | Max requests per window |
253
+
254
+ #### `core/auth/crowdsec`
255
+
256
+ | CLI | Env | Default | Description |
257
+ | ---------------------- | ----------------------- | ------------------------------------ | ------------------- |
258
+ | `--crowdsec-url` | `DM_CROWDSEC_URL` | `http://localhost:8080/v1/decisions` | CrowdSec API URL |
259
+ | `--crowdsec-api-key` | `DM_CROWDSEC_API_KEY` | | CrowdSec API key |
260
+ | `--crowdsec-cache-ttl` | `DM_CROWDSEC_CACHE_TTL` | `60` | Cache TTL (seconds) |
261
+
262
+ #### `core/auth/trustedProxy`
263
+
264
+ | CLI | Plural | Env | Default | Description |
265
+ | ----------------------------- | ------------------- | ------------------------------ | ----------- | ---------------------- |
266
+ | `--trusted-proxy` | `--trusted-proxies` | `DM_TRUSTED_PROXIES` | `[]` | Trusted proxy IPs/CIDR |
267
+ | `--trusted-proxy-auth-header` | | `DM_TRUSTED_PROXY_AUTH_HEADER` | `Auth-User` | User header name |
268
+
269
+ ### Twake Integration Plugins
270
+
271
+ #### `core/twake/james`
272
+
273
+ | CLI | Plural | Env | Default | Description |
274
+ | -------------------------------- | ------------------------------- | --------------------------------- | ----------------------- | --------------------------- |
275
+ | `--james-webadmin-url` | | `DM_JAMES_WEBADMIN_URL` | `http://localhost:8000` | James WebAdmin API URL |
276
+ | `--james-webadmin-token` | | `DM_JAMES_WEBADMIN_TOKEN` | | James authentication token |
277
+ | `--james-signature-template` | | `DM_JAMES_SIGNATURE_TEMPLATE` | | Email signature template |
278
+ | `--james-concurrency` | | `DM_JAMES_CONCURRENCY` | `10` | James API concurrency |
279
+ | `--james-init-delay` | | `DM_JAMES_INIT_DELAY` | `1000` | Init delay (ms) |
280
+ | `--james-mailing-list-branch` | `--james-mailing-list-branches` | `DM_JAMES_MAILING_LIST_BRANCHES` | `[]` | Mailing list branches |
281
+ | `--james-mailbox-type-attribute` | | `DM_JAMES_MAILBOX_TYPE_ATTRIBUTE` | `twakeMailboxType` | Mailbox type attribute |
282
+ | `--ldap-concurrency` | | `DM_LDAP_CONCURRENCY` | `10` | LDAP operations concurrency |
283
+
284
+ #### `core/twake/calendarResources`
285
+
286
+ | CLI | Env | Default | Description |
287
+ | --------------------------------- | ---------------------------------- | ----------------------- | ----------------------------- |
288
+ | `--calendar-webadmin-url` | `DM_CALENDAR_WEBADMIN_URL` | `http://localhost:8080` | Calendar API URL |
289
+ | `--calendar-webadmin-token` | `DM_CALENDAR_WEBADMIN_TOKEN` | | Calendar authentication token |
290
+ | `--calendar-concurrency` | `DM_CALENDAR_CONCURRENCY` | `10` | API concurrency |
291
+ | `--calendar-resource-base` | `DM_CALENDAR_RESOURCE_BASE` | | Resource base DN |
292
+ | `--calendar-resource-objectclass` | `DM_CALENDAR_RESOURCE_OBJECTCLASS` | | Resource objectClass |
293
+ | `--calendar-resource-creator` | `DM_CALENDAR_RESOURCE_CREATOR` | | Resource creator |
294
+ | `--calendar-resource-domain` | `DM_CALENDAR_RESOURCE_DOMAIN` | | Resource domain |
295
+
296
+ #### `core/twake/applicativeAccounts`
297
+
298
+ | CLI | Plural | Env | Default | Description |
299
+ | ------------------------------ | ------------------------------- | -------------------------------- | ------------- | --------------------------------- |
300
+ | `--applicative-account-base` | | `DM_APPLICATIVE_ACCOUNT_BASE` | | Applicative accounts base DN |
301
+ | `--max-app-accounts` | | `DM_MAX_APP_ACCOUNTS` | `5` | Max accounts per user |
302
+ | `--ldap-operational-attribute` | `--ldap-operational-attributes` | `DM_LDAP_OPERATIONAL_ATTRIBUTES` | _(see below)_ | Operational attributes to exclude |
303
+
304
+ Default operational attributes: `dn`, `controls`, `structuralObjectClass`, `entryUUID`, `entryDN`, `subschemaSubentry`, `modifyTimestamp`, `modifiersName`, `createTimestamp`, `creatorsName`, `userPassword`
305
+
306
+ #### `core/twake/appAccountsConsistency`
307
+
308
+ Automatically creates/updates/deletes applicative account entries when users are created/modified/deleted. No configuration options - uses [core/twake/applicativeAccounts](#coretwakeapplicativeaccounts) settings.
309
+
310
+ **Requires:** `core/ldap/onChange`
311
+
312
+ ### Utility Plugins
313
+
314
+ #### `core/static`
315
+
316
+ | CLI | Env | Default | Description |
317
+ | --------------- | ---------------- | -------- | ---------------------- |
318
+ | `--static-path` | `DM_STATIC_PATH` | `static` | Static files directory |
319
+ | `--static-name` | `DM_STATIC_NAME` | `static` | URL path prefix |
320
+
321
+ #### `core/weblogs`
322
+
323
+ Web access logging plugin. No configuration options - just add the plugin to enable access logs.
324
+
325
+ #### `core/configApi`
326
+
327
+ Exposes API configuration at `/api/v1/config` for client applications. Returns available features, schemas, and endpoints. No configuration options.
328
+
329
+ ## Configuration File
330
+
331
+ Use a `.env` file or shell script:
332
+
333
+ ```bash
334
+ # ~/.ldap-rest-config
335
+ export DM_LDAP_URL="ldap://localhost:389"
336
+ export DM_LDAP_DN="cn=admin,dc=example,dc=com"
337
+ export DM_LDAP_PWD="password"
338
+ export DM_LDAP_BASE="dc=example,dc=com"
339
+ export DM_PLUGINS="core/auth/token,core/ldap/flatGeneric"
340
+ export DM_AUTH_TOKENS="secret-token"
341
+ export DM_LOG_LEVEL="notice"
342
+ ```
343
+
344
+ ```bash
345
+ # Load and start
346
+ source ~/.ldap-rest-config
347
+ ldap-rest
348
+ ```
349
+
350
+ ## LDAP Failover
351
+
352
+ For high availability, specify multiple servers:
353
+
354
+ ```bash
355
+ DM_LDAP_URL="ldap://ldap1.example.com,ldap://ldap2.example.com,ldap://ldap3.example.com"
356
+ ```
357
+
358
+ The system will:
359
+
360
+ 1. Try each URL in order
361
+ 2. Use the first successful connection
362
+ 3. Automatically failover if connection fails
363
+ 4. Log failover events
364
+
365
+ ## Log Levels _(`--log-level`)_
366
+
367
+ | Level | Description |
368
+ | -------- | -------------------------------------------- |
369
+ | `error` | Errors only |
370
+ | `warn` | Warnings and errors |
371
+ | `notice` | Web access logs (recommended for production) |
372
+ | `info` | General information |
373
+ | `debug` | Everything, including debug output |
374
+
375
+ The `notice` level is ideal for production as it shows web access logs without flooding with general info messages.