我用postfix设置了LDAP访问。
ldapsearch -D "cn=postfix,ou=users,ou=system,[domain]" -w postfix -b "ou=users,ou=people,[domain]" -s sub "(&(objectclass=inetOrgPerson)(mail=[mailaddr]))"
提供正确的条目。 LDAPconfiguration文件看起来像
root@server2:/etc/postfix/ldap# cat mailbox_maps.cf server_host = localhost search_base = ou=users,ou=people,[domain] scope = sub bind = yes bind_dn = cn=postfix,ou=users,ou=system,[domain] bind_pw = postfix query_filter = (&(objectclass=inetOrgPerson)(mail=%s)) result_attribute = uid debug_level = 2
bind_dn和bind_pw应该和我上面用ldapsearch一样。 不过,调用postmap不起作用:
root@server2:/etc/postfix/ldap# postmap -q [mailaddr] ldap:/etc/postfix/ldap/mailbox_maps.cf postmap: warning: dict_ldap_lookup: /etc/postfix/ldap/mailbox_maps.cf: Search base 'ou=users,ou=people,[domain]' not found: 32: No such object
如果我更改LDAPconfiguration,以便匿名用户可以完全访问LDAP
olcAccess: {-1}to * by * read
那么它的作品:
root@server2:/etc/postfix/ldap# postmap -q [mailaddr] ldap:/etc/postfix/ldap/mailbox_maps.cf [user-id]
但是,当我限制这个后缀用户的访问权限:
olcAccess: {-1}to * by dn="cn=postfix,ou=users,ou=system,[domain]" read by * break
它不起作用,但会产生上面列出的错误(尽pipeldapsearch工作,只有postmap不)。
为什么在与后缀DN绑定时不起作用? 我想我正确设置了postfix用户的LDAP ACL,就像ldapsearch命令应该certificate的一样。 什么可以是这种行为的原因?
解决了它 – LDAP版本丢失。 mailbox_maps.cf需要一个额外的条目
version = 3
因为LDAP服务器不允许LDAPv2。