在Postfix的virtual_alias上运行SpamAssassin

自从我开始使用Postfix的virtual_alias_maps将我的所有电子邮件转发到Gmail,我收到的垃圾邮件比我在本地发送邮件并使用SpamAssassin / spamd过滤垃圾邮件时多了很多。 我已经使用smtpd_recipient_restrictions来执行标准的垃圾邮件过滤。

 smtpd_recipient_restrictions = reject_invalid_hostname, reject_non_fqdn_hostname, reject_non_fqdn_sender, reject_non_fqdn_recipient, reject_unknown_sender_domain, reject_unauth_pipelining, permit_mynetworks, reject_unauth_destination, reject_rbl_client zen.spamhaus.org, reject_rbl_client list.dsbl.org, reject_rbl_client korea.services.net, permit 

有没有办法在virtual_alias_maps转发之前通过SpamAssassin运行邮件?

你现在没有描述你如何做SA过滤,但是如果你现在没有通过虚拟邮件,我假设你没有使用content_filter,这是通常的方式迷上了。 SpamAssassin wiki似乎覆盖了这个设置很好,从一个快速浏览: http : //wiki.apache.org/spamassassin/IntegratedSpamdInPostfix

远程MTA通过SMTP将邮件发送到Postfix。 收件人列表是一系列RCPT命令。 每个RCPT命令添加一个收件人地址。 当Postfix在virtual_alias_maps中获取收件人地址时,它将通过virtual_alias_maps查找的结果来replace地址。 这发生在你的smtpd(8)过程中。

您可以select如何连接您select的垃圾邮件过滤机制。

您可以在展开的收件人列表上使用SpamAssassin。 推荐的机制是使用content_filter。 有关详细信息,请参阅http://www.postfix.org/FILTER_README.html 。 最常用的filter是http://www.ijs.si/software/amavisd/

Mailscanner有问题,因为它直接看队列文件,而不是使用标准的机制。 当你升级Postfix的时候它会崩溃。

第二,不太推荐的select是通过SMTP代理( http://www.postfix.org/SMTPD_PROXY_README.html )或通过milter( http://www.postfix.org/MILTER_README )使用预先队列过滤机制.html )。

如果您只想过滤发送给某些收件人的邮件,请通过check_recipient_access使用FILTER目标。 请参阅http://www.postfix.org/access.5.html

如果您想在原始地址上运行SpamAssassin,我会使用amavisd-new使用content_filter方法。 把你的virtual_alias_maps放在master.cf条目中使用-ovirtual_alias_maps的重新注入smtpd中。 您可能需要在smtpd_recipient_restrictions中添加check_recipient_access映射,并在main.cf中为您的有效地址返回OK。

高度取决于你的操作系统和/或发行版,无论你想要运行SA的用户等等…

在master.cf中join如下所示的内容:

 # aa.bb.cc.dd == your IP # example.com == your hostname aa.bb.cc.dd:smtp inet n - n - - smtpd -o content_filter=spamassassin -o myhostname=example.com -o smtp_bind_address=aa.bb.cc.dd # (note content_filter) # # -snip- # spamassassin unix - nn - - pipe user=sa argv=/usr/bin/spamc -e /etc/alternatives/mta -oi -f ${sender} ${recipient} # change 'user=sa' to whatever user you have setup. # change '/etc/alternatives/mta' to whatever you're using to put # mail back into the queue. (eg: /usr/local/sbin/sendmail ) # change /usr/bin/spamc to the location of your spamc binary, obviously. :)