ldap-rest 0.1.4 → 0.1.6
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.
- package/README.md +31 -21
- package/docs/README.md +23 -486
- package/docs/{DEVELOPER_GUIDE.md → client-development/README.md} +24 -24
- package/docs/client-development/api/README.md +75 -0
- package/docs/client-development/browser/README.md +65 -0
- package/docs/{plugins/DEVELOPMENT.md → plugin-development/README.md} +4 -9
- package/docs/plugin-development/hooks.md +18 -0
- package/docs/usage/README.md +89 -0
- package/docs/usage/configuration.md +375 -0
- package/docs/usage/plugins/README.md +87 -0
- package/docs/usage/plugins/auth/README.md +65 -0
- package/docs/usage/plugins/auth/crowdsec.md +95 -0
- package/docs/usage/plugins/auth/hmac.md +293 -0
- package/docs/usage/plugins/auth/llng.md +99 -0
- package/docs/usage/plugins/auth/oidc.md +167 -0
- package/docs/usage/plugins/auth/rate-limit.md +62 -0
- package/docs/usage/plugins/auth/token.md +136 -0
- package/docs/usage/plugins/auth/totp.md +213 -0
- package/docs/usage/plugins/auth/trusted-proxy.md +127 -0
- package/docs/usage/plugins/integrations/README.md +42 -0
- package/docs/usage/plugins/ldap/README.md +79 -0
- package/docs/usage/troubleshooting.md +105 -0
- package/package.json +9 -1
- package/docs/authentication.md +0 -1194
- /package/docs/{OPENAPI.md → client-development/api/openapi.md} +0 -0
- /package/docs/{api/REFERENCE.md → client-development/api/reference.md} +0 -0
- /package/docs/{api/REST_API.md → client-development/api/rest-api.md} +0 -0
- /package/docs/{browser/LIBRARIES.md → client-development/browser/libraries.md} +0 -0
- /package/docs/{examples/EXAMPLES.md → client-development/examples/README.md} +0 -0
- /package/docs/{examples → client-development/examples/ldif}/twake-mailbox-type-nomenclature.ldif +0 -0
- /package/docs/{examples → client-development/examples/ldif}/twake-mailbox-type-schema-amendment.ldif +0 -0
- /package/docs/{schemas/SCHEMAS.md → client-development/schemas/README.md} +0 -0
- /package/docs/{PLUGIN_DEPENDENCIES.md → plugin-development/dependencies.md} +0 -0
- /package/docs/{testing-with-embedded-ldap.md → plugin-development/testing.md} +0 -0
- /package/docs/{presenterm.md → presentations/en.md} +0 -0
- /package/docs/{presenterm-fr.md → presentations/fr.md} +0 -0
- /package/docs/{authzLinid1.md → usage/plugins/auth/authz-linid1.md} +0 -0
- /package/docs/{authzPerBranch.md → usage/plugins/auth/authz-per-branch.md} +0 -0
- /package/docs/{twakeAppAccountsApi.md → usage/plugins/integrations/app-accounts.md} +0 -0
- /package/docs/{twakeCalendarResources.md → usage/plugins/integrations/calendar-resources.md} +0 -0
- /package/docs/{twakeJames.md → usage/plugins/integrations/james-mail.md} +0 -0
- /package/docs/{jamesTeamMailboxes.md → usage/plugins/integrations/james-mailboxes.md} +0 -0
- /package/docs/{ldapBulkImport.md → usage/plugins/ldap/bulk-import.md} +0 -0
- /package/docs/{ldapExternalUsersInGroups.md → usage/plugins/ldap/external-users.md} +0 -0
- /package/docs/{ldapFlatGeneric.md → usage/plugins/ldap/flat-generic.md} +0 -0
- /package/docs/{ldapGroups.md → usage/plugins/ldap/groups.md} +0 -0
- /package/docs/{onChange.md → usage/plugins/ldap/on-change.md} +0 -0
- /package/docs/{ldapOrganizations.md → usage/plugins/ldap/organizations.md} +0 -0
- /package/docs/{ldapTrash.md → usage/plugins/ldap/trash.md} +0 -0
- /package/docs/{static.md → usage/plugins/utilities/static.md} +0 -0
- /package/docs/{weblogs.md → usage/plugins/utilities/weblogs.md} +0 -0
|
@@ -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.
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
# Plugins
|
|
2
|
+
|
|
3
|
+
LDAP-Rest is extensible through a plugin system. This section documents all available plugins.
|
|
4
|
+
|
|
5
|
+
## LDAP Plugins
|
|
6
|
+
|
|
7
|
+
LDAP entity management:
|
|
8
|
+
|
|
9
|
+
| Plugin | Description |
|
|
10
|
+
| ---------------------------------------- | ------------------------------------------------------- |
|
|
11
|
+
| [flat-generic](ldap/flat-generic.md) | Generic LDAP entity management (users, positions, etc.) |
|
|
12
|
+
| [groups](ldap/groups.md) | LDAP group management with member validation |
|
|
13
|
+
| [organizations](ldap/organizations.md) | Hierarchical organization management |
|
|
14
|
+
| [bulk-import](ldap/bulk-import.md) | Bulk import from CSV |
|
|
15
|
+
| [trash](ldap/trash.md) | Trash system (soft delete) |
|
|
16
|
+
| [external-users](ldap/external-users.md) | Automatic external contact creation |
|
|
17
|
+
| [on-change](ldap/on-change.md) | LDAP change detection |
|
|
18
|
+
|
|
19
|
+
## Authentication Plugins
|
|
20
|
+
|
|
21
|
+
Secure API access:
|
|
22
|
+
|
|
23
|
+
| Plugin | Description |
|
|
24
|
+
| ---------------------- | ---------------------------------------- |
|
|
25
|
+
| [token](auth/token.md) | Bearer token authentication |
|
|
26
|
+
| [totp](auth/totp.md) | TOTP authentication (time-based codes) |
|
|
27
|
+
| [hmac](auth/hmac.md) | HMAC-SHA256 signing for backend services |
|
|
28
|
+
| [llng](auth/llng.md) | LemonLDAP::NG SSO integration |
|
|
29
|
+
| [oidc](auth/oidc.md) | OpenID Connect / OAuth 2.0 |
|
|
30
|
+
|
|
31
|
+
## Authorization Plugins
|
|
32
|
+
|
|
33
|
+
Access control:
|
|
34
|
+
|
|
35
|
+
| Plugin | Description |
|
|
36
|
+
| -------------------------------------------- | ------------------------------- |
|
|
37
|
+
| [authz-per-branch](auth/authz-per-branch.md) | Branch-level LDAP authorization |
|
|
38
|
+
| [authz-linid1](auth/authz-linid1.md) | LinID 1.x integration |
|
|
39
|
+
|
|
40
|
+
## Security Plugins
|
|
41
|
+
|
|
42
|
+
Protection and rate limiting:
|
|
43
|
+
|
|
44
|
+
| Plugin | Description |
|
|
45
|
+
| -------------------------------------- | --------------------------------- |
|
|
46
|
+
| [trusted-proxy](auth/trusted-proxy.md) | X-Forwarded-For header validation |
|
|
47
|
+
| [rate-limit](auth/rate-limit.md) | Request rate limiting |
|
|
48
|
+
| [crowdsec](auth/crowdsec.md) | IP blocking via CrowdSec |
|
|
49
|
+
|
|
50
|
+
## Integration Plugins
|
|
51
|
+
|
|
52
|
+
Connect to external systems:
|
|
53
|
+
|
|
54
|
+
| Plugin | Description |
|
|
55
|
+
| -------------------------------------------------------- | ---------------------------- |
|
|
56
|
+
| [james-mail](integrations/james-mail.md) | Apache James synchronization |
|
|
57
|
+
| [james-mailboxes](integrations/james-mailboxes.md) | Apache James team mailboxes |
|
|
58
|
+
| [calendar-resources](integrations/calendar-resources.md) | Twake calendar resources |
|
|
59
|
+
| [app-accounts](integrations/app-accounts.md) | Applicative accounts API |
|
|
60
|
+
|
|
61
|
+
## Utility Plugins
|
|
62
|
+
|
|
63
|
+
| Plugin | Description |
|
|
64
|
+
| ------------------------------- | ------------------ |
|
|
65
|
+
| [static](utilities/static.md) | Static file server |
|
|
66
|
+
| [weblogs](utilities/weblogs.md) | HTTP logging |
|
|
67
|
+
|
|
68
|
+
## Plugin Dependencies
|
|
69
|
+
|
|
70
|
+
Some plugins require other plugins:
|
|
71
|
+
|
|
72
|
+
```
|
|
73
|
+
core/twake/james
|
|
74
|
+
└─ requires: core/ldap/onChange
|
|
75
|
+
|
|
76
|
+
core/ldap/externalUsersInGroups
|
|
77
|
+
└─ requires: core/ldap/groups
|
|
78
|
+
|
|
79
|
+
core/auth/authzPerBranch
|
|
80
|
+
└─ requires: An authentication plugin
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
See [the complete dependencies matrix](../../plugin-development/dependencies.md).
|
|
84
|
+
|
|
85
|
+
## Load Order
|
|
86
|
+
|
|
87
|
+
Authentication plugins are loaded first to secure API endpoints. The order is defined in `src/plugins/priority.json`.
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
# Authentication Plugins
|
|
2
|
+
|
|
3
|
+
LDAP-Rest provides multiple authentication plugins to secure API access. These plugins can be used individually or combined depending on your infrastructure requirements.
|
|
4
|
+
|
|
5
|
+
## Available Authentication Methods
|
|
6
|
+
|
|
7
|
+
| Method | Plugin | Description |
|
|
8
|
+
| ------------------------- | ------------------------- | ------------------------------------------------ |
|
|
9
|
+
| [Token](token.md) | `core/auth/token` | Simple bearer token authentication |
|
|
10
|
+
| [TOTP](totp.md) | `core/auth/totp` | Time-based One-Time Password authentication |
|
|
11
|
+
| [HMAC](hmac.md) | `core/auth/hmac` | HMAC-SHA256 request signing for backend services |
|
|
12
|
+
| [LemonLDAP::NG](llng.md) | `core/auth/llng` | Integration with LemonLDAP::NG SSO |
|
|
13
|
+
| [OpenID Connect](oidc.md) | `core/auth/openidconnect` | OAuth 2.0 / OpenID Connect authentication |
|
|
14
|
+
|
|
15
|
+
## Authorization Plugins
|
|
16
|
+
|
|
17
|
+
| Method | Plugin | Description |
|
|
18
|
+
| ----------------------------------------------- | -------------------------- | --------------------------- |
|
|
19
|
+
| [Authorization Per Branch](authz-per-branch.md) | `core/auth/authzPerBranch` | Branch-level access control |
|
|
20
|
+
| [Authorization LinID 1.x](authz-linid1.md) | `core/auth/authzLinid1` | LinID 1.x integration |
|
|
21
|
+
|
|
22
|
+
## Security Plugins
|
|
23
|
+
|
|
24
|
+
| Method | Plugin | Description |
|
|
25
|
+
| --------------------------------- | ------------------------ | ----------------------------------------------------- |
|
|
26
|
+
| [Trusted Proxy](trusted-proxy.md) | `core/auth/trustedProxy` | Validate X-Forwarded-For headers from reverse proxies |
|
|
27
|
+
| [Rate Limiting](rate-limit.md) | `core/auth/rateLimit` | Prevent brute force attacks |
|
|
28
|
+
| [CrowdSec](crowdsec.md) | `core/auth/crowdsec` | IP reputation and blocking |
|
|
29
|
+
|
|
30
|
+
## Choosing an Authentication Method
|
|
31
|
+
|
|
32
|
+
| Feature | Token | TOTP | HMAC | LemonLDAP::NG | OpenID Connect |
|
|
33
|
+
| ---------------------- | ------------- | ----------------- | ---------------------- | --------------------- | -------------------------------- |
|
|
34
|
+
| **Setup Complexity** | Simple | Simple | Medium | Medium | Medium |
|
|
35
|
+
| **User Management** | None | Manual | Manual (service-based) | External (LLNG) | External (Provider) |
|
|
36
|
+
| **SSO Support** | No | No | No | Yes | Yes |
|
|
37
|
+
| **MFA Support** | No | Yes (TOTP itself) | N/A | Yes (via LLNG) | Yes (via Provider) |
|
|
38
|
+
| **Session Management** | Stateless | Stateless | Stateless | LLNG Sessions | OIDC Sessions |
|
|
39
|
+
| **Code Expiration** | Never | 30-60 seconds | Per-request | Session-based | Session-based |
|
|
40
|
+
| **Request Integrity** | No | No | Yes (body + path hash) | No | No |
|
|
41
|
+
| **Replay Protection** | No | Yes (time-based) | Yes (timestamp) | Session-based | Session-based |
|
|
42
|
+
| **Best For** | APIs, Scripts | APIs, Enhanced | Backend Services | Enterprises with LLNG | Cloud/SaaS, Enterprises with SSO |
|
|
43
|
+
| **Dependencies** | None | None | None | lemonldap-ng-handler | express-openid-connect |
|
|
44
|
+
|
|
45
|
+
## Combining with Authorization
|
|
46
|
+
|
|
47
|
+
All authentication plugins set `req.user` to the authenticated identity. You can use hooks to implement custom authorization:
|
|
48
|
+
|
|
49
|
+
```javascript
|
|
50
|
+
hooks: {
|
|
51
|
+
afterAuth: async ([req, res]) => {
|
|
52
|
+
// Check if user can access this endpoint
|
|
53
|
+
if (req.path.startsWith('/api/v1/ldap/users') && !isAdmin(req.user)) {
|
|
54
|
+
throw new Error('Forbidden: Admin access required');
|
|
55
|
+
}
|
|
56
|
+
return [req, res];
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
## See Also
|
|
62
|
+
|
|
63
|
+
- [LemonLDAP::NG Documentation](https://lemonldap-ng.org/documentation)
|
|
64
|
+
- [OpenID Connect Specification](https://openid.net/connect/)
|
|
65
|
+
- [express-openid-connect](https://github.com/auth0/express-openid-connect)
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
# CrowdSec Integration
|
|
2
|
+
|
|
3
|
+
IP reputation and blocking using [CrowdSec](https://crowdsec.net/).
|
|
4
|
+
|
|
5
|
+
## Configuration
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
--plugin core/auth/crowdsec \
|
|
9
|
+
--crowdsec-url "http://localhost:8080" \
|
|
10
|
+
--crowdsec-api-key "your-api-key"
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
**Environment Variables:**
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
DM_CROWDSEC_URL="http://localhost:8080"
|
|
17
|
+
DM_CROWDSEC_API_KEY="your-api-key"
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Prerequisites
|
|
21
|
+
|
|
22
|
+
1. **CrowdSec Installation**: Running CrowdSec instance
|
|
23
|
+
2. **API Key**: Bouncer API key from CrowdSec
|
|
24
|
+
|
|
25
|
+
## How It Works
|
|
26
|
+
|
|
27
|
+
1. Extracts client IP from request (respects trusted proxy)
|
|
28
|
+
2. Queries CrowdSec API for IP reputation
|
|
29
|
+
3. Blocks requests from banned IPs with `403 Forbidden`
|
|
30
|
+
4. Allows legitimate requests to proceed
|
|
31
|
+
|
|
32
|
+
## Use Cases
|
|
33
|
+
|
|
34
|
+
- **IP Reputation**: Block known malicious IPs
|
|
35
|
+
- **Threat Intelligence**: Leverage community-shared threat data
|
|
36
|
+
- **Dynamic Blocking**: Automatic response to attacks
|
|
37
|
+
- **Compliance**: Security monitoring and logging
|
|
38
|
+
|
|
39
|
+
## CrowdSec Setup
|
|
40
|
+
|
|
41
|
+
### Install CrowdSec
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
# Debian/Ubuntu
|
|
45
|
+
curl -s https://packagecloud.io/install/repositories/crowdsec/crowdsec/script.deb.sh | sudo bash
|
|
46
|
+
sudo apt install crowdsec
|
|
47
|
+
|
|
48
|
+
# Generate bouncer API key
|
|
49
|
+
sudo cscli bouncers add ldap-rest-bouncer
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
### Configure LDAP-Rest
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
npx ldap-rest \
|
|
56
|
+
--plugin core/auth/crowdsec \
|
|
57
|
+
--crowdsec-url "http://localhost:8080" \
|
|
58
|
+
--crowdsec-api-key "generated-api-key" \
|
|
59
|
+
...
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
## Combining with Other Security Plugins
|
|
63
|
+
|
|
64
|
+
Recommended security stack:
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
--plugin core/auth/trustedProxy \
|
|
68
|
+
--trusted-proxy "127.0.0.1" \
|
|
69
|
+
--plugin core/auth/crowdsec \
|
|
70
|
+
--crowdsec-url "http://localhost:8080" \
|
|
71
|
+
--crowdsec-api-key "your-api-key" \
|
|
72
|
+
--plugin core/auth/rateLimit \
|
|
73
|
+
--rate-limit-max 100 \
|
|
74
|
+
--plugin core/auth/token \
|
|
75
|
+
--auth-token "your-token"
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
Order matters:
|
|
79
|
+
|
|
80
|
+
1. `trustedProxy` - Sanitize IP headers first
|
|
81
|
+
2. `crowdsec` - Block known bad IPs
|
|
82
|
+
3. `rateLimit` - Limit request frequency
|
|
83
|
+
4. Authentication plugins
|
|
84
|
+
|
|
85
|
+
## Security Considerations
|
|
86
|
+
|
|
87
|
+
- Keep CrowdSec updated for latest threat intelligence
|
|
88
|
+
- Monitor CrowdSec logs for blocked requests
|
|
89
|
+
- Consider local decisions for sensitive applications
|
|
90
|
+
- Use HTTPS between LDAP-Rest and CrowdSec API
|
|
91
|
+
|
|
92
|
+
## See Also
|
|
93
|
+
|
|
94
|
+
- [CrowdSec Documentation](https://docs.crowdsec.net/)
|
|
95
|
+
- [CrowdSec Hub](https://hub.crowdsec.net/)
|