Skip to content

Commit 1985697

Browse files
mbettini-oxsirainen
authored andcommitted
config: dict.md - Update to config-rewrite
1 parent 89aa609 commit 1985697

File tree

2 files changed

+49
-27
lines changed

2 files changed

+49
-27
lines changed

data/settings.js

Lines changed: 25 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4803,7 +4803,7 @@ How long to wait for answer before aborting request.`
48034803
},
48044804

48054805
dict_map: {
4806-
tags: [ 'dict', 'dict-sql' ],
4806+
tags: [ 'dict', 'dict-sql', 'dict-ldap' ],
48074807
values: setting_types.NAMED_LIST_FILTER,
48084808
seealso: [ 'dict_map_pattern' ],
48094809
text: `
@@ -4812,7 +4812,7 @@ Creates a new dict mapping. The filter name refers to the
48124812
},
48134813

48144814
dict_map_pattern: {
4815-
tags: [ 'dict', 'dict-sql' ],
4815+
tags: [ 'dict', 'dict-sql', 'dict-ldap' ],
48164816
values: setting_types.STRING,
48174817
text: `
48184818
Pattern that is matched to the accessed dict keys. The [[setting,dict_map]]
@@ -4845,13 +4845,15 @@ optional if no expiration is used by the code accessing the dict map.`
48454845
},
48464846

48474847
dict_map_value: {
4848-
tags: [ 'dict', 'dict-sql' ],
4848+
tags: [ 'dict', 'dict-sql', 'dict-ldap' ],
48494849
values: setting_types.NAMED_LIST_FILTER,
48504850
seealso: [ 'dict_map_value_name' ],
48514851
text: `
4852-
Creates a new value for the dict map. The filter name refers to the
4852+
- sql: Creates a new value for the dict map. The filter name refers to the
48534853
[[setting,dict_map_value_name]] setting. Dict supports reading/writing multiple
4854-
values for the same key.`
4854+
values for the same key.
4855+
4856+
- ldap: Value to be returned from an ldap search, as a [[link,settings_variables,variable-expression]]`
48554857
},
48564858

48574859
dict_map_field: {
@@ -10983,7 +10985,7 @@ SASL realm to use.`
1098310985
},
1098410986

1098510987
ldap_base: {
10986-
tags: [ 'auth-ldap' ],
10988+
tags: [ 'auth-ldap', 'dict-ldap' ],
1098710989
values: setting_types.STRING,
1098810990
text: `
1098910991
LDAP base.
@@ -11023,8 +11025,24 @@ You may need to recompile OpenLDAP with debugging enabled to get enough output.`
1102311025
Specify dereference which is set as an LDAP option.`
1102411026
},
1102511027

11028+
dict_map_ldap_filter: {
11029+
tags: [ 'dict-ldap' ],
11030+
values: setting_types.STRING,
11031+
text: `
11032+
The ldap filter to use to find the ldap entry.
11033+
11034+
This setting is required for ldap [[setting,dict_map]]`
11035+
},
11036+
11037+
ldap_max_idle_time: {
11038+
tags: [ 'dict-ldap' ],
11039+
values: setting_types.TIME,
11040+
text: `
11041+
Disconnect from LDAP server after connection has been idle for this many seconds.`
11042+
},
11043+
1102611044
ldap_scope: {
11027-
tags: [ 'auth-ldap' ],
11045+
tags: [ 'auth-ldap', 'dict-ldap' ],
1102811046
default: 'subtree',
1102911047
values: setting_types.ENUM,
1103011048
values_enum: [ 'base', 'onelevel', 'subtree' ],

docs/core/config/dict.md

Lines changed: 24 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,22 @@ See [[link,auth_ldap]].
8181

8282
::: code-group
8383
```[dovecot.conf]
84-
dict_legacy {
85-
somedict = ldap:/path/to/dovecot-ldap-dict.conf.ext
84+
dict_server {
85+
dict ldap {
86+
driver = ldap
87+
ldap_uris = ldap://{{LDAPHOST}}
88+
ldap_auth_dn = uid=testadmin,cn=users,dc=dovecot,dc=net
89+
ldap_auth_dn_password = testadmin
90+
ldap_timeout_secs = 5
91+
ldap_base = dc=dovecot,dc=net
92+
ldap_starttls = no
93+
ssl_client_require_valid_cert = no
94+
95+
dict_map priv/test/home {
96+
ldap_filter = (&(homeDirectory=*)(uid=%{user}))
97+
value = %{ldap:homeDirectory}
98+
}
99+
}
86100
}
87101
```
88102
:::
@@ -95,30 +109,20 @@ dict_legacy {
95109
#### Examples
96110

97111
To map a key to a search:
98-
99112
```
100-
map {
101-
pattern = priv/test/mail
102-
filter = (mail=*) # the () is required
103-
base_dn = ou=container,dc=domain
104-
username_attribute = uid # default is cn
105-
value_attribute = mail
113+
dict_map priv/test/mail {
114+
ldap_filter = (&(uid=%{user})(mail=*))
115+
ldap_base = ou=container,dc=domain
116+
value = %{ldap:mail}
106117
}
107118
```
108119

109120
To do a more complex search:
110-
111121
```
112-
map {
113-
pattern = priv/test/mail/$location
114-
filter = (&(mail=*)(location=%{location}) # the () is required
115-
base_dn = ou=container,dc=domain
116-
username_attribute = uid # default is cn
117-
value_attribute = mail
118-
119-
fields {
120-
location=$location
121-
}
122+
dict_map priv/test/mail/$location {
123+
ldap_filter = (&(uid=%{user})(mail=*)(uid=%{pattern:location}))
124+
ldap_base = ou=container,dc=domain
125+
value = %{ldap:mail}
122126
}
123127
```
124128

0 commit comments

Comments
 (0)