跳至正文

[教程]给你的邮箱弄个反垃圾邮件功能吧

本文使用Postfix。

反垃圾邮件类型:

目前比较常见的反垃圾邮件系统有检测域名和IP的反垃圾邮件系统(Spamhaus)与检测邮件信息的反垃圾邮件系统(Spam Assassin),本文只讲检测域名与IP的反垃圾邮件系统,后者我会另开一篇博客文章详细讲述。

Postfix配置:

修改main.cf,添加/修改以下配置

smtpd_recipient_restrictions =
   #让mynetworks里面给出的地址直接通过而不是进入验证
   permit_mynetworks,
   #强制sasl
   permit_sasl_authenticated,
   #禁止发送到不存在的邮箱地址
   reject_unauth_destination,
   #进入反垃圾邮件验证,必须要是reject_rbl_client [反垃圾邮件系统地址],
   reject_rbl_client sbl.spamhaus.org,
   reject_rbl_client pbl.spamhaus.org,
   reject_rbl_client xbl.spamhaus.org,
   reject_rbl_client zen.spamhaus.org,
   #检测自定义名单
   check_sender_access hash:/etc/postfix/sender_checks,
   permit

添加sender_checks,该示例中a.com是无条件通过,b.com是无条件拒绝

a.com   OK
b.com   REJECT

如果是Postfix+Dovecot,请输入该指令

postmap /etc/postfix/sender_check

设置好了?重开Postfix吧!

systemctl restart postfix
systemctl restart dovecot   #如果使用Postfix+Dovecot

反垃圾邮件系统列表及官网

  1. 注意:添加反垃圾邮件系统之前请确保你知道你正在干什么
  2. 注意:请先点击括号内的详情页面查看使用方法,仔细阅读使用方法再决定是否调用
  3. 注意:本文只截取了部分反垃圾邮件系统,数据获取时间为【2021年7月23日】,我们不会保证下面的数据都是正确的,一切数据请以官网为准。
  4. 注意:如果因为配置出错而产生无法挽回的结果,我们不会承担任何责任(第一条注意事项)(加个反垃圾检测似乎并不会怎样,但以防万一还是写一下)

Spamhaus (推荐)

IMP-SPAM

  • 官网:imp.ch
  • 用户查询:antispam.imp.ch
  • 系统调用 (Realtime blacklist assembled by spamtraps):dnsrbl.imp.ch
  • 系统调用 (IP-adresses from catched spammails):spamrbl.imp.ch
  • 系统调用 (IP-adresses from catched worm/viruses):wormrbl.imp.ch
  • 系统调用 (Realtime blacklist built from spamtrap sources):uribl.swinog.ch
  • 系统调用 (Realtime blacklist assembled by spamtraps):blacklist.woody.ch

LashBack

REDHAWK

SORBS

  • 官网:sorbs.net
  • 用户查询:sorbs.net/lookup.shtml
  • 系统调用 (Aggregate zone (contains all the following DNS zones except spam.dnsbl.sorbs.net)):dnsbl.sorbs.net
  • 系统调用 (List of Open HTTP Proxy Servers):http.dnsbl.sorbs.net
  • 系统调用 (List of Open SOCKS Proxy Servers):socks.dnsbl.sorbs.net
  • 系统调用 (List of open Proxy Servers not listed in the SOCKS or HTTP lists.):misc.dnsbl.sorbs.net
  • 系统调用 (List of Open SMTP relay servers.):smtp.dnsbl.sorbs.net
  • 系统调用 (List of web (WWW) servers which have spammer abusable vulnerabilities (e.g. FormMail scripts) Note: This zone now includes non-webserver IP addresses that have abusable vulnerabilities.):web.dnsbl.sorbs.net
  • 系统调用 (List of hosts that have been noted as sending spam/UCE/UBE to the admins of SORBS within the last 48 hours.):new.spam.dnsbl.sorbs.net
  • 系统调用 (List of hosts that have been noted as sending spam/UCE/UBE to the admins of SORBS within the last 28 days (includes new.spam.dnsbl.sorbs.net).):recent.spam.dnsbl.sorbs.net
  • 系统调用 (List of hosts that have been noted as sending spam/UCE/UBE to the admins of SORBS within the last year. (includes recent.spam.dnsbl.sorbs.net).):old.spam.dnsbl.sorbs.net
  • 系统调用 (List of hosts that have been noted as sending spam/UCE/UBE to the admins of SORBS at any time, and not subsequently resolving the matter and/or requesting a delisting. (Includes both old.spam.dnsbl.sorbs.net and escalations.dnsbl.sorbs.net).):spam.dnsbl.sorbs.net
  • 系统调用 (This zone contains netblocks of spam supporting service providers, including those who provide websites, DNS or drop boxes for a spammer. Spam supporters are added on a ‘third strike and you are out’ basis, where the third spam will cause the supporter to be added to the list.):escalations.dnsbl.sorbs.net
  • 系统调用 (List of hosts demanding that they never be tested by SORBS.):block.dnsbl.sorbs.net
  • 系统调用 (List of networks hijacked from their original owners, some of which have already used for spamming.):zombie.dnsbl.sorbs.net
  • 系统调用 (Dynamic IP Address ranges (NOT a Dial Up list!)):dul.dnsbl.sorbs.net
  • 系统调用 (IP addresses and Netblocks of where system administrators and ISPs owning the network have indicated that servers should not be present.):noserver.dnsbl.sorbs.net
  • 系统调用 (Aggregate zone (contains all RHS zones)):rhsbl.sorbs.net
  • 系统调用 (List of domain names where the A or MX records point to bad address space.):badconf.rhsbl.sorbs.net
  • 系统调用 (List of domain names where the owners have indicated no email should ever originate from these domains.):nomail.rhsbl.sorbs.net

SEM-BLACK

SPAMCOP

URIBL

  • 官网:uribl.com
  • 用户查询:uribl.com
  • 注意:请先点击括号内的详情页面查看使用方法,仔细阅读使用方法再决定是否调用
  • 注意:不建议使用该反垃圾邮件系统,检测似乎过于严格,会导致一些个人邮件服务器的邮件无法成功送达,如果您确定您的收信人都来自与知名邮箱(Gmail等),那可以尝试使用
  • 系统调用 (使用方法):multi.uribl.com

DSBL

Barracuda

BACKSCATTERER

RATS

GBUdb Truncate

NiX Spam

Weighted Private Block List