Skip to content

Commit 7168853

Browse files
authored
Microsoft Active Directory you can have groups in groups support. (#40)
To support this you need to set the leaf group member option for it to follow the sub groups (if any).
1 parent 1c9d2d6 commit 7168853

4 files changed

Lines changed: 18 additions & 0 deletions

File tree

Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,8 @@ init_ldap: init_openldap init_redis
9191
-e LDAP_FORWARD_ATTRIBUTE="mail" \
9292
-e LDAP_GROUP_FILTER="(&(mail=%s)(objectClass=mailGroup))" \
9393
-e LDAP_GROUP_ATTRIBUTE="uid" \
94+
-e LDAP_GROUP_RESULT_ATTRIBUTE="mail" \
95+
-e LDAP_GROUP_RESULT_MEMBER="member" \
9496
-e LDAP_SENDER_FILTER="(&(|(mail=%s)(mailalias=%s))(objectClass=mailAccount))" \
9597
-e LDAP_SENDER_ATTRIBUTE="mail" \
9698
-e LDAP_DOVECOT_USER_ATTRS="=home=/var/mail/vhosts/%d/%n/,=mail=maildir:/var/mail/vhosts/%d/%n/mail/,mailuserquota=quota_rule=*:bytes=%\$$" \

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -392,6 +392,8 @@ When using LDAP authentication the following additional variables become availab
392392
| **LDAP_GROUP_FILTER** | The search filter for group lookups | *optional* |
393393
| **LDAP_GROUP_ATTRIBUTE** | The attributes for group lookup | *optional* |
394394
| **LDAP_GROUP_FORMAT** | The format for group lookups | *optional* |
395+
| **LDAP_GROUP_RESULT_ATTRIBUTE** | The leaf result attribute group | *optional* |
396+
| **LDAP_GROUP_RESULT_MEMBER** | The special result attribute of the group | *optional* |
395397
| **LDAP_SENDER_SEARCH_BASE** | The search base for sender lookups | *optional* | ${LDAP_DEFAULT_SEARCH_BASE} |
396398
| **LDAP_SENDER_SEARCH_SCOPE** | The search scope for sender lookups | *optional* | ${LDAP_DEFAULT_SEARCH_SCOPE} |
397399
| **LDAP_SENDER_FILTER** | The search filter for sender lookups | **required** |

rootfs/etc/postfix/ldap/virtual-group-maps.cf

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,19 @@ search_base = {{ .LDAP_GROUP_SEARCH_BASE }}
2828
scope = {{ .LDAP_GROUP_SEARCH_SCOPE }}
2929

3030
query_filter = {{ .LDAP_GROUP_FILTER }}
31+
32+
{{ if ne .LDAP_GROUP_ATTRIBUTE "" }}
3133
result_attribute = {{ .LDAP_GROUP_ATTRIBUTE }}
34+
{{ end }}
3235

3336
{{ if ne .LDAP_GROUP_FORMAT "" }}
3437
result_format = {{ .LDAP_GROUP_FORMAT }}
3538
{{ end }}
3639

40+
{{ if ne .LDAP_GROUP_RESULT_ATTRIBUTE "" }}
41+
leaf_result_attribute = {{ .LDAP_GROUP_RESULT_ATTRIBUTE }}
42+
{{ end }}
43+
44+
{{ if ne .LDAP_GROUP_RESULT_MEMBER "" }}
45+
special_result_attribute = {{ .LDAP_GROUP_RESULT_MEMBER }}
46+
{{ end }}

rootfs/usr/local/bin/setup.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,8 @@ if [ "$DBDRIVER" = "ldap" ]; then
126126
export LDAP_GROUP_FILTER
127127
export LDAP_GROUP_ATTRIBUTE
128128
export LDAP_GROUP_FORMAT
129+
export LDAP_GROUP_RESULT_ATTRIBUTE
130+
export LDAP_GROUP_RESULT_MEMBER
129131

130132
export LDAP_SENDER_SEARCH_BASE
131133
export LDAP_SENDER_SEARCH_SCOPE
@@ -182,6 +184,8 @@ if [ "$DBDRIVER" = "ldap" ]; then
182184
LDAP_GROUP_FILTER=${LDAP_GROUP_FILTER:-}
183185
LDAP_GROUP_ATTRIBUTE=${LDAP_GROUP_ATTRIBUTE:-}
184186
LDAP_GROUP_FORMAT=${LDAP_GROUP_FORMAT:-}
187+
LDAP_GROUP_RESULT_ATTRIBUTE=${LDAP_GROUP_RESULT_ATTRIBUTE:-}
188+
LDAP_GROUP_RESULT_MEMBER=${LDAP_GROUP_RESULT_MEMBER:-}
185189

186190
LDAP_SENDER_SEARCH_BASE=${LDAP_SENDER_SEARCH_BASE:-"${LDAP_DEFAULT_SEARCH_BASE}"}
187191
LDAP_SENDER_SEARCH_SCOPE=${LDAP_SENDER_SEARCH_SCOPE:-"${LDAP_DEFAULT_SEARCH_SCOPE}"}

0 commit comments

Comments
 (0)