我想用Postfix来实现以下function:
这就是我所拥有的:(postfix在10.0.8.0上,一些发件人是10.0.8.0和10.0.9.0)
mynetworks_style = subnet smtpd_recipient_restrictions = check_recipient_access sqlite:/etc/postfix/access-bl.query, check_client_access hash:/etc/postfix/trusted_clients, check_recipie nt_access hash:/etc/postfix/local_domains, reject_unauth_destination, permit
所以,现在黑名单的作品。 文件/etc/postfix/trusted_clients包含谁可以发送到任何地方(3),文件/etc/postfix/local_domains包含你可以发送的地方(2)。 这两个都很好,他们回来了。
我的问题是让所有三个一起工作。 不知道是否是订购问题。 目前从10.0.9.17发送一个testing,我的Relay access denied 。 如果我添加:
mynetworks = 10.0.8.0/24 10.0.9.0/24
那么任何人都可以发送到任何地方,所以#2不工作。
Ubuntu 14.04上的Postfix版本是2.10。
有任何想法吗?
输出postconf | grep restrictions postconf | grep restrictions :
smtpd_client_restrictions = smtpd_data_restrictions = smtpd_end_of_data_restrictions = smtpd_etrn_restrictions = smtpd_helo_restrictions = smtpd_recipient_restrictions = check_recipient_access sqlite:/etc/postfix/access-bl.query, check_client_access hash:/etc/postfix/trusted_clients, check_recipient_access hash:/etc/postfix/local_domains, reject_unauth_destination, permit_mynetworks smtpd_relay_restrictions = permit_mynetworks, permit_sasl_authenticated, defer_unauth_destination smtpd_sender_restrictions =
在postfix 2.10中引入了新的参数smtpd_relay_restrictions 。 此限制将在评估smtpd_recipient_restrictions 之前 smtpd_recipient_restrictions 。
从官方文档摘录
smtpd_relay_restrictions(默认值:permit_mynetworks,permit_sasl_authenticated,defer_unauth_destination)在smtpd_recipient_restrictions之前,Postfix SMTP服务器在RCPT TO命令的上下文中应用的邮件中继控制的访问限制。 有关评估上下文和时间的讨论,请参阅SMTPD_ACCESS_README中的“延迟评估SMTP访问限制列表”一节。
因此,我的networking之外的任何客户端mynetworks将获得Relay Access Denied因为这个规则是defer_unauth_destination 。
其中一个解决scheme是在smtpd_relay_restrictions移动限制(2)和(3)。
smtpd_recipient_restrictions = check_recipient_access sqlite:/etc/postfix/access-bl.query smtpd_relay_restrictions = permit_mynetworks, permit_sasl_authenticated, check_client_access hash:/etc/postfix/trusted_clients, check_recipient_access hash:/etc/postfix/local_domains, reject_unauth_destination
注意:
smtpd_relay_restrictions或smtpd_recipient_restrictions 。 无需重复这两个地方。 smtpd_relay_restrictions旨在放置您的putrelay规则的位置,而smtpd_recipient_restrictions是垃圾邮件黑名单的占位符(例如, reject_non_fqdn_sender )。