我有一个centos 6.5服务器运行Apache和托pipe约8个域名。 还有后缀2.6安装服务这些本地域发送电子邮件由PHP生成(网站联系表格)。 Postfix安装是默认的。 没有对main.cf或任何其他文件进行修改。
现在,其中一个网站已被黑客入侵,并使用以下地址发送垃圾邮件:random_user1@hacked_domain.com,random_user2@hacked_domain.com,random_user3@hacked_domain.com(hacked_domain.com是被黑网站的实际域名)
我想阻止这个特定的(本地)域发送,而所有其他域名应该正常发送。 到目前为止,我创build了一个名为“rbl_blacklist”的后缀文件夹中保存的“黑名单”,如下所示:
hacked_domain.com REJECT
如何在main.cf中使用此文件,以防止发送来自***@hacked_domain.com的邮件?
(也欢迎任何其他build议)
编辑:
我不想阻止某些用户,因为没有任何! 我只想阻止发送的所有电子邮件:*@hacked_domain.com被发送!
在我提出的问题中提到的方法可能是这个问题的一个重复( Postfix阻止本地用户发送 )可以帮助防止您的问题,如果首先使用一个本地帐户提交这些电子邮件。
既然你提到了一个“php(网站联系表单)”,我假设你可能有一个用户在每个域上运行PHP,并且能够阻止链接到被黑客入侵的域上的用户提交邮件。
但是,如果您确实需要阻止postfix发送来自该域的电子邮件,则可以使用smptd_sender_restrictions( http://www.postfix.org/postconf.5.html#smtpd_sender_restrictions ) – 在链接问题中也提到了这一点至。
具体而言,您可以使用check_sender_access并configuration合适的查找表,例如:
smtpd_sender_restrictions = check_sender_access hash:/etc/postfix/block_spam_access
然后,您可以使用您创build的黑名单来填充/etc/postfix/block_spam_access (或者您select的任何path),这应该有所帮助。
有关其他选项,请参阅http://www.postfix.org/access.5.html ,而不是拒绝(DISCARD可能有用)。
另一种方法可能是使用传输地图,可能使用sender_dependent_relayhost_maps ( http://www.postfix.org/postconf.5.html#sender_dependent_relayhost_maps )。
有关传输语法,请参阅http://www.postfix.org/transport.5.html – 您可能需要如下所示的内容: hacked_domain.tld error:mail for hacked_domain.tld is not deliverable
解决scheme是“header_checks”
在main.cf注释掉任何“header_checks”行 – 如果存在,然后添加:
header_checks = pcre:/etc/postfix/header_checks.pcre
创buildheader_checks.pcre文件(在后缀文件夹中)
# cd /etc/postfix # vi header_checks.pcre
在header_checks.pcre文件里面添加了以下行:
/^From:((?![^@]*?user1|[^@]*?user2|[^@]*?user3|[^@]*?webmaster)[^@]*?)@hacked_domain\.com/ DISCARD
(我们只允许user1,user2,user3和webmaster发送电子邮件 – 其他地址将被丢弃!)
# service postfix restart
…工作!
希望能帮助有类似问题的人!