上周我花了一些时间来了解Postfix可以做些什么来帮助减less垃圾邮件。 如果我正确理解了不同的*_restrictions
configuration参数控制何时完成检查,然后限制列表,如permit_mynetworks
和check_client_access
控制检查什么 。 那是对的吗?
如果我理解正确,检查按以下顺序进行:
那是对的吗? 如果我理解正确, smtpd_delay_reject
不影响检查的顺序,但只影响拒绝发送 。 对?
smtpd_relay_restrictions
configuration参数似乎没有在我的Plesk 11服务器上设置。 我的Postfix版本是2.8.4。
我也注意到一些检查在不同的configuration参数下被多次列出。 他们是否需要多次列出?
这是我目前的configuration:
smtpd_sender_restrictions = check_sender_access hash:/var/spool/postfix/plesk/blacklists permit_sasl_authenticated check_client_access pcre:/var/spool/postfix/plesk/non_auth.re smtpd_client_restrictions = permit_mynetworks smtpd_recipient_restrictions = permit_mynetworks check_client_access pcre:/var/spool/postfix/plesk/no_relay.re permit_sasl_authenticated reject_unauth_destination
如果我理解正确的话,那也是一样的:
smtpd_sender_restrictions = smtpd_client_restrictions = smtpd_recipient_restrictions = permit_mynetworks check_sender_access hash:/var/spool/postfix/plesk/blacklists permit_sasl_authenticated check_client_access pcre:/var/spool/postfix/plesk/non_auth.re permit_mynetworks check_client_access pcre:/var/spool/postfix/plesk/no_relay.re permit_sasl_authenticated reject_unauth_destination
黑名单文件是空的。 no_auth文件有这样的:
/^/ PREPEND X-No-Auth: unauthenticated sender
no_relay文件有这个:
/^/ PREPEND X-No-Relay: not in my network
如果我理解正确,最后两个将标题添加到所有尚未被允许的电子邮件。
重复检查
Postfix在多次列出时是否再次执行检查? 还是Postfix知道它已经做了检查? 如果检查多次执行,那似乎是一种浪费。 如果它们不被执行多次,那么no_auh / no_relay头文件在所有情况下都会被正确添加吗?
缺lesssmtpd_relay_restrictions
摘自Postfix SMTP中继和访问控制
注:2.10之前的后缀版本没有smtpd_relay_restrictions。 他们在smtpd_recipient_restrictions下结合了邮件转发和垃圾邮件拦截策略。 这可能会导致意想不到的结果。 例如,允许的垃圾邮件阻止策略可能会意外地导致允许的邮件中继策略。
另一个摘录:
有些人build议将所有访问限制放在smtpd_recipient_restrictions列表中。 不幸的是,这可能导致过于宽容的访问。
所以我不想列出smtpd_recipient_restrictions
下的所有限制,但是具有多个限制,并且在不同的限制下进行相同的检查变得混乱。 只使用smtpd_recipient_restrictions
和smtpd_relay_restrictions
并忽略客户端,helo,发件人是否安全?
黑名单
列表中不是那个黑名单吗? 如果发件人是我的networking的一部分,并可以进行身份validation,我应该真的阻止基于发件人的电子邮件? 此时表格是空的,但我不确定Plesk组件可能会将电子邮件地址添加到该表格。 这也违背了RFC要求100%交付给postmaster @和滥用@地址。
在/etc/postfix/main.cf中
#smtpd_client_restrictions = #smtpd_helo_restrictions = #smtpd_sender_restrictions = smtpd_relay_restrictions = permit_mynetworks check_client_access pcre:/var/spool/postfix/plesk/no_relay.re permit_sasl_authenticated check_client_access pcre:/var/spool/postfix/plesk/non_auth.re reject_unauth_destination smtpd_recipient_restrictions = check_recipient_access pcre:/etc/postfix/custom/recipient_checks.pcre check_client_access cidr:/etc/postfix/custom/sinokorea.cidr check_sender_access hash:/var/spool/postfix/plesk/blacklists
在/etc/postfix/custom/recipient_checks.pcre中
# Always accept mail to postmaster@ and abuse@ /^postmaster@/ OK /^abuse@/ OK # Reject all mail sent to mailapp.ourdomain.com # except for certain specific recipients # and bounce messages which may use VERP if /@mailapp\.ourdomain\.com$/ !/^(?:validuser|anothervalid|bounces(?:\+.+)?)@/ REJECT endif
我遇到过在正则expression式中有@
例子。 这不是一个特殊的人物吗?
我的build议configuration会完成我想要的吗?
(请注意,自己和其他Plesk用户阅读此文档 – 可能需要定期执行cron作业以恢复对main.cf文件的更改,因为某些Plesk操作似乎会覆盖此文件。)
不pipe你做什么,不要离开家:
smtpd_client_restrictions = reject_rbl_client zen.spamhaus.org, reject_rbl_client bl.spamcop.net
这些一直为我自己抓住了大多数。
好的,这是一个长期的问题。 我会尽量回答上述问题的一部分。 也许可以根据他们来总结一下。
免责声明:我没有使用plesk,但我已经使用了postfix。 这个问题年龄超过一年,所以也许plesk已经更新了他们的postfixconfiguration。 但是我认为这个问题对于devise和实现postfix限制的人是有用的
smtpd_sender_restrictions = check_sender_access hash:/var/spool/postfix/plesk/blacklists permit_sasl_authenticated check_client_access pcre:/var/spool/postfix/plesk/non_auth.re smtpd_client_restrictions = permit_mynetworks smtpd_recipient_restrictions = permit_mynetworks check_client_access pcre:/var/spool/postfix/plesk/no_relay.re permit_sasl_authenticated reject_unauth_destination
和
smtpd_sender_restrictions = smtpd_client_restrictions = smtpd_recipient_restrictions = permit_mynetworks check_sender_access hash:/var/spool/postfix/plesk/blacklists permit_sasl_authenticated check_client_access pcre:/var/spool/postfix/plesk/non_auth.re permit_mynetworks check_client_access pcre:/var/spool/postfix/plesk/no_relay.re permit_sasl_authenticated reject_unauth_destination
如果电子邮件来自mynetworks,那么它将不会被/var/spool/postfix/plesk/no_relay.re
和/var/spool/postfix/plesk/no_relay.re
检查。 这意味着电子邮件将被接受,而不是改变 。 在后缀动作(拒绝,接受)方面,它不会有所不同,但对于plesk来说,这两个头是很重要的 。
对,重复两次检查可能看起来很浪费。 但是这个重复的检查将被放置在不同的地方/限制。 在每一个检查中,都有一些逻辑或algorithm,postfix如何处理电子邮件。 您可能会担心重复检查check_policy_service或DNSBL等重大错误。 对于像permit_mynetwork这样的轻量级检查,您可以忽略它。
那么,有两个smtpd_recipient_restrictions和smtpd_relay_restrictions应该足够一些先进的限制。 但它是为后缀> = 2.10。 对于使用postfix <2.10的用户,可以将检查放在多个指令中,这样postfix就不会变得过于宽容。
是的,简化你目前的后缀限制很好。 但要注意,后缀是plesk的一部分。 plesk的工程师可能会因为模块化或简单维护等原因而安排这些限制。
概要: