让 Postfix 通过 UID 而不是 DN 搜索 LDAP 组成员?

让 Postfix 通过 UID 而不是 DN 搜索 LDAP 组成员?

我正在使用 postfix(Debian 6.0 上的 v2.7.1)创建一个电子邮件服务器,其中用户和组存储在 LDAP 服务器中。

用户帐户工作正常,但我想从组创建电子邮件别名(任何发往[电子邮件保护]将被发送到每个成员的电子邮件地址组Abc团体)。

我的群组是posixGroup按以下属性列出其成员的群组memberUid

dn: cn=groupAbc,ou=Groups,dc=domain,dc=tld
objectClass: CourierMailAlias
objectClass: posixGroup
objectClass: top
cn: groupAbc
gidNumber: 1001
maildrop: [email protected]
memberUid: john-doe
memberUid: jane-doe

这是我的 ldap-aliases.cf:

# cat /etc/postfix/ldap-aliases.cf
server_host = 127.0.0.1
version = 3
bind = yes
bind_dn = cn=ldap-reader,dc=domain,dc=tld
bind_pw = SECRET
search_base = dc=domain,dc=tld
query_filter = (&(objectClass=posixGroup)(mail=%s))
result_attribute = mail
special_result_attribute = memberUid
leaf_result_attribute = mail

当我尝试发送电子邮件时,系统日志中出现以下错误:

... postfix/cleanup[6601]: warning: dict_ldap_get_values[1]: search error 34: Invalid DN syntax
... postfix/cleanup[6601]: warning: dict_ldap_lookup: Had some trouble with entries returned by search: Invalid DN syntax
... postfix/cleanup[6601]: warning: 40ACF12106E: virtual_alias_maps map lookup problem for [email protected]

Postfix 正在排除我使用参数定义的属性中的 DN special_result_attribute。如果我将memberUid无名氏“ 到 ”uid=john-doe,ou=用户,dc=域,dc=tld“,电子邮件发送至”[电子邮件保护]“被发送到john-doe的电子邮件地址。

我正在寻找一种方法让 Postfix 对存储在memberUid属性中的 UID 进行 LDAP 搜索。我知道在 Zarafa 的 Postfix 版本上是可行的(http://doc.zarafa.com/7.0/Administrator_Manual/pt-BR/html/_ConfigureOpenLDAP.html) 带有选项ldap_groupmembers_attributeldap_groupmembers_attribute_typeldap_groupmembers_relation_attribute找不到如何在标准 Postfix 上正确执行此操作。

答案1

您的 ldap 配置错误。请使用:

server_host = 127.0.0.1
version = 3
bind = no
query_filter = (&(objectClass=posixGroup)(maildrop=%s))
result_attribute = memberUid, mail

您不能在这里使用“bind = yes”——这行不通。没有组可以/应该绑定(认证)。

相关内容