我们正在尝试使用PostFix来检查发件人电子邮件地址是否被允许发送到特定的电子邮件地址。
另一种描述它的方式是我想要特定的电子邮件地址只允许来自特定电子邮件地址的传入消息(不是SMTPlogin)。
会有这样的工作? main.cf:
smtpd_recipient_restrictions = [other restrictions here] check_sender_access mysql:/etc/postfix/restricted_senders_to_recipents.cf
restricted_senders_to_recipents.cf:
user = uname password = pword hosts = 127.0.0.1 dbname = dbname #!!!PSEUDOCODE!!! query = SELECT allowed FROM members WHERE sender = %sender AND recipent = %recipent;
这可能吗? 如果那么如何?
我知道MySQL的别名是这样工作的,因为我们已经在使用它了。 ( http://www.postfix.org/mysql_table.5.html )
简短的答案是可能的否。
Postfix支持Postfix Per-Client / User /等每个发件人/收件人/客户端限制。 访问控制与smtpd_restriction_classes 。 根据您的要求,您必须dynamic设置smtpd_restriction_classes参数,但不适用于后缀。
作为解决方法,您可以使用Milter(请参阅文档 )或类似Postfwd或PolicyD
似乎你可以在两部分的过程中完成这一点。
首先,创build一个smtpd_sender_restriction,它是一个mysql查找地址的用户,这些用户需要acl:
smtpd_recipient_restrictions = reject_non_fqdn_sender, ... mysql:/etc/postfix/protected_users.cf
接下来,因为mysql查找将返回一类用户,您可以指定该类用户进行匿名查找以决定是否可以发送邮件:
smtpd_recipient_restrictions = reject_non_fqdn_sender, ... proxy:mysql:/etc/postfix/protected_users.cf
whitelist = check_sender_access proxy:mysql:/etc/postfix/whitelist.cf,拒绝
这两部分查找应该做你需要的。
参考