我正在尝试使用 LDAP 查找拒绝发送到特定电子邮件地址的电子邮件。
我制作了这个 ldap 查找表:
version = 3
timeout = 100
## set the size_limit to 1 since we only
## want to find one email address match
size_limit = 1
expansion_limit = 0
start_tls = no
tls_require_cert = no
server_host = ldaps://ldap.xxxx.test/
search_base = ou=NoEmail, ou=xxxx,dc=xxxx,dc=xxx,dc=test
scope = sub
query_filter = (|(|(mail=%[email protected](mail=%[email protected]))(uid=%s))
result_attribute = mail
result_filter = reject
bind = yes
bind_dn = cn=ldap-user,ou=SystemUsers,dc=xxxx,dc=xxx,dc=test
bind_pw = xxxxxxxxxxxxx
如果我运行命令postmap -q USERNAME ldap:/etc/postfix/ldap-deleted.cf
,我会得到输出:reject
,但 postfix 仍然接受邮件。
smtpd_restriction_classes
我已经尝试过smtpd_recipient_restrictions
smtpd_restriction_classes = noauth
noauth = check_recipient_access ldap:/etc/postfix/ldap-deleted.cf
smtpd_recipient_restrictions = check_recipient_access ldap:/etc/postfix/ldap-deleted.cf, permit_mynetworks,reject_unauth_destination
我也尝试过smtpd_helo_restrictions
smtpd_helo_restrictions = ldap:/etc/postfix/ldap-deleted.cf
日志仅显示以下内容:
Sep 21 09:11:45 tst postfix/qmgr[4354]: CEDFB26DA14: from=<[email protected]>, size=769, nrcpt=1 (queue active)
Sep 21 09:11:45 tst postfix/smtpd[4383]: disconnect from unknown[xxxxxxxxxx] ehlo=2 starttls=1 mail=1 rcpt=1 data=1 quit=1 commands=7
Sep 21 09:11:45 tst postfix/local[4388]: CEDFB26DA14: to=<[email protected]>, relay=local, delay=0.19, delays=0.13/0.01/0/0.05, dsn=2.0.0, status=sent (delivered to mailbox)
答案1
我发现local_recipient_maps
,将 Postfix 锁定为仅接受我在 ldap 文件中指定的用户的邮件
local_recipient_maps = ldap:/etc/postfix/ldap-active.cf