我使用MYSQL在Postfix中定义了全局白名单,其中包含以下选项:
smtpd_recipient_restrictions = reject_invalid_hostname, check_client_access mysql:/etc/postfix/client_whitelist check_sender_access mysql:/etc/postfix/sender_whitelist check_recipient_access mysql:/etc/postfix/recipient_whitelist permit_mynetworks,reject
/etc/postfix/client_whitelist
host = localhost:3306 user = root password = password dbname = postfix query = SELECT restriction FROM client_whitelist WHERE client = "%s" AND status = "1";
mysql表
+---------------+-------------+--------+ | client | restriction | status | +---------------+-------------+--------+ | 192.168.66.18 | OK | 1 | | 192.168.66.92 | OK | 1 | | 192.168.66.93 | REJECT | 1 | +---------------+-------------+--------+
我有发送者和接收者的同一张桌子。 我的主要问题是,我有多个域后面的后缀,我想过滤客户端/发件人考虑到哪个是接收器。 例如:
Mail from 192.168.66.92 and sender "[email protected]" IS ALLOW to "[email protected]" Mail from 192.168.66.92 and sender "[email protected]" IS NOT ALLOW to "[email protected]" Mail from 192.168.66.18 IS ALLOW for recipient or domain "domain1.com" Mail from 192.168.66.18 IS NOT ALLOW for recipient or domain "domain2.com"
有什么办法来实现这个在后缀? 我一直在googleing,但没有运气。
另一方面,我正在考虑把一个“后缀代理”redirect到另一个后缀实例,每个实例筛选每个域。 但是即使可能,我也不确定这个环境的性能。
这在一个访问检查中是不可能的,因为它只提供一个值作为input(客户端,发送者或收件人,基于你使用的访问检查),但不能超过一个。
这在postfix访问表的工作方式中是固有的。
您可以通过使用像postfwd(可以一次访问所有这些值)的策略服务或通过使用限制类来解决此问题 。
例如,这允许您在客户端上实施限制类,并返回访问检查的结果,而不是OK或REJECT。
查看访问手册页以获取有关访问地图和可能结果的更多详细信息。
请注意,如果包含“OK”和“REJECT”作为结果,则“白名单”对于您所拥有的术语不是有用的术语。