【邮件服务器配置教程Q&A】在 CentOS7上配置 Postfix+Dovecot+Cyrus-sasl+Spamassassin+ClamAV

本文将总结在安装过程中碰到的问题,并逐一记录和提供解决办法。

Q1. pyzor check or “pyzor: check failed: internal error, python traceback seen in response”
No servers available! Maybe try the ‘discover’ command
运行: # pyzor discover
downloading servers from http://pyzor.sourceforge.net/cgi-bin/inform-servers-0-3-x

运行 # spamassassin -t -D pyzor < /usr/share/doc/spamassassin-*/sample-spam.txt
Feb 23 19:49:11.237 [2629] dbg: pyzor: network tests on, attempting Pyzor
Feb 23 19:49:17.790 [2629] dbg: pyzor: pyzor is available: /bin/pyzor
Feb 23 19:49:17.791 [2629] dbg: pyzor: opening pipe: /bin/pyzor check < /tmp/.spamassassin26291bwDqEtmp
Feb 23 19:49:18.084 [2629] dbg: pyzor: [2632] finished: exit 1
Feb 23 19:49:18.084 [2629] dbg: pyzor: got response: public.pyzor.org:24441 (200, ‘OK’) 0 3

我们用 strace 检查进程号,可以看到 os.mkdir Permission denied.
查看文档,我们知道需要设置合适的 homedir ,并有合适的权限。

# mkdir /etc/mail/spamassassin/.pyzor
# chown root:postfix /etc/mail/spamassassin/.pyzor
# chmod g+w /etc/mail/spamassassin/.pyzor
去 /etc/mail/spamassassin/local.cf 添加:
pyzor_options –homedir /etc/mail/spamassassin/.pyzor

运行: # pyzor –homedir /etc/mail/spamassassin/.pyzor discover
修改下载下来的 servers 文件属性 # chmod 777 /etc/mail/spamassassin/.pyzor/servers
重启 spamassassin 服务

Q2. 怎么知道 razor2 启用了?
# spamassassin -t -D razor2 </usr/share/doc/spamassassin-*/sample-spam.txt
# razor-admin -create
# razor-admin -discover
# razor-admin -register

【邮件服务器配置教程系列四】 为 Spamassassin 添加 DCC 检查

在之前三个系列的基础上,本文我们将加强 反垃圾 (AS) 功能,添加 DCC 配置

原文 https://wiki.apache.org/spamassassin/InstallingDCC 已经比较清楚的描述了下载,编译,配置的过程。

wget http://www.dcc-servers.net/dcc/source/dcc-dccproc.tar.Z
tar xfvz dcc-dccproc.tar.Z
cd dcc-dccproc-*
./configure && make && make install

编译成功后,运行 # /usr/local/bin/cdcc info 应该可以看到如下的信息:

# 02/23/18 13:57:20 CST /var/dcc/map
# Re-resolve names after 15:22:51 Check RTTs after 14:10:30
# 1454.81 ms threshold, 1330.41 ms average 12 total, 10 working servers
IPv6 on version=3

dcc1.dcc-servers.net,- RTT+1000 ms anon

  编辑 /etc/mail/spamassassin/v310.pre ,反注释掉
loadplugin Mail::SpamAssassin::Plugin::DCC

编辑 /etc/mail/spamassassin/local.cf
添加 dcc_path /usr/local/bin/dccproc

重启 spamassassin 服务,在 maillog 日志里,可以看到 DCC_CHECK 的关键字了。

spamd[15152]: spamd: result: Y 19 – DCC_CHECK,FREEMAIL_FROM,FSL_BULK_SIG,FSL_HELO_FAKE,MISSING_MID,RCVD_IN_BL_SPAMCOP_NET,RCVD_IN_PBL,RCVD_IN_PSBL,RCVD_IN_SORBS_DUL,RCVD_IN_SORBS_WEB,RCVD_IN_XBL,RDNS_DYNAMIC,SPF_HELO_SOFTFAIL,SPF_SOFTFAIL,TO_NO_BRKTS_DYNIP scantime=18.0,size=810,user=postfix,uid=89,required_score=6.5,rhost=localhost,raddr=127.0.0.1,rport=/run/spamassassin/spamd.sock,mid=(unknown),autolearn=no autolearn_force=no

检查: # spamassassin -D dcc < /usr/share/doc/spamassassin-*/sample-spam.txt
Feb 23 19:57:24.260 [2669] dbg: dcc: network tests on, registering DCC
Feb 23 19:57:25.156 [2669] dbg: dcc: dcc_pgm_path, found cdcc in dcc_path: /usr/local/bin/cdcc
Feb 23 19:57:25.180 [2669] dbg: dcc: `/usr/local/bin/cdcc -qV homedir libexecdir` reports ‘1.3.162 homedir=/var/dcc libexecdir=/var/dcc/libexec ‘
Feb 23 19:57:25.180 [2669] dbg: dcc: use ‘dcc_libexec /var/dcc/libexec’ from cdcc
Feb 23 19:57:25.180 [2669] dbg: dcc: use ‘dcc_home /var/dcc’ from cdcc
Feb 23 19:57:25.180 [2669] dbg: dcc: dccifd is not available; no r/w socket at /var/dcc/dccifd
Feb 23 19:57:25.180 [2669] dbg: dcc: /usr/local/bin/dccproc is available
Feb 23 19:57:25.181 [2669] dbg: dcc: opening pipe to /usr/local/bin/dccproc -C -x 0 -R -w whiteclnt </tmp/.spamassassin2669rYtJ8Ntmp
Feb 23 19:57:25.486 [2669] dbg: dcc: dccproc responded with ‘X-DCC-x.dcc-servers-Metrics: mailhostname 104; Body=many Fuz1=many Fuz2=many’
Feb 23 19:57:25.486 [2669] dbg: dcc: listed: BODY=999999/999999 FUZ1=999999/999999 FUZ2=999999/999999 REP=0/90
Feb 23 19:57:26.499 [2669] dbg: dcc: DCC learning not enabled by dcc_learn_score