-1

我有登录的 ldap 表

ldapsearch -x -h ldap.server-b 'ou=mail,ou=Groups,dc=my,dc=org' '(&(cn=mailFullAccess)(memberUid=username))'

输出

dn: cn=mailFullAccess,ou=mail,ou=Groups,dc=my,dc=org
gidNumber: 5555
memberUid: fred
memberUid: bob
memberUid: username
cn: mailFullAccess

创建 LDAP 表

search_base = ou=mail,ou=Groups,dc=my,dc=org
server_host = ldap.server
query_filter = (&(cn=mailFullAccess)(memberUid=%u))
result_attribute = memberUid
result_format = %u      internal_hosts_class
scope = sub
bind = yes

尝试用命令检查

postmap -q username ldap:./mailFullAccess_check.cf

产生结果

fred    internal_hosts_class, bob internal_hosts_class, username internal_hosts_class

找到 1 个匹配项。

和本地域文件列表(local_urls.db)

mydomain1.ru      OK
mydomain2.ru       OK
mydomain3.ru    OK

我想要,“用户名”只能向本地域发送电子邮件

我写在 main.cf 中。SMTP 身份验证(来自 LDAP 的 saslauthd)工作正常。

...
smtpd_recipient_restrictions =
        permit_sasl_authenticated
        reject
...
smtpd_restriction_classes = internal_hosts_class
internal_hosts_class =   check_recipient_access hash:/etc/postfix/border/local_urls, reject
smtpd_sender_restrictions = check_sender_access  ldap:/etc/postfix/border/mailFullAccess_check.cf
...

后缀重启,发送电子邮件并收到错误

Feb  3 11:30:53 email postfix/smtpd[10546]: warning: unknown smtpd restriction: "fred"
4

1 回答 1

1

你的 postmap 命令

postmap -q username ldap:./mailFullAccess_check.cf

应该返回internal_hosts_class字符串。这就是 postfix 抱怨错误unknown smtpd 限制的原因。

解决方案被修改mailFullAccess_check.cf,特别是在result_format成为

result_format = internal_hosts_class
于 2015-02-03T11:27:07.100 回答