免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 2264 | 回复: 4
打印 上一主题 下一主题

[Mail] 请教SpamAssassin的安装配置 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2004-11-05 09:47 |只看该作者 |倒序浏览
近日安装调试SpamAssassin
安装过程参考以下:
# 安装SpamAssassin

groupadd spamd

useradd -g spamd -s /bin/false spamd


cd /home/pkg
tar -xzvf Mail-SpamAssassin-3.0.1.tar.gz
cd Mail-SpamAssassin-3.0.1

export LC_ALL=C
perl Makefile.PL
make
make install

#我们想要SpamAssassin 随系统自动启动,安装目录中提供了一个起动脚本

cp spamd/redhat-rc-script.sh /etc/rc.d/init.d/spamd

vi /etc/rc.d/init.d/spamd

SPAMDOPTIONS="-d -c -u spamd -H /home/spamd -m5 -H"
修改其中一行为上所示。

chmod 755 /etc/rc.d/init.d/spamd

chkconfig --add spamd

spamassassin的过滤模板在/etc/mail/spamassassin/local.cf,修改为:

required_hits 5.0
rewrite_subject 1
subject_tag ********SPAM********
report_safe 1
defang_mime 0
rewrite_subject 0
report_header 1
use_terse_report 1
use_bayes 1
auto_learn 1
skip_rbl_checks 1
use_razor2 0
use_dcc 0
use_pyzor 0

score SUBJ_FULL_OF_8BITS 0.0
score BASE64_ENC_TEXT 0.0
score BAYES_99 0.1
score BAYES_90 0.1
score SUBJ_ILLEGAL_CHARS 0.1
score FROM_ILLEGAL_CHARS 0.5
score HEAD_ILLEGAL_CHARS 0.5
score MIME_BASE64_TEXT 0.5
ok_locales en zh

chmod 755 /etc/rc.d/init.d/spamd
chkconfig --add spamd
service spamd start

# 进行一个spam和non-spam的测试
spamassassin -t < sample-spam.txt >; spamtest.txt
less spamtest.txt
spamassassin -t < sample-nonspam.txt >; nospamtest.txt
less nospamtest.txt
spamtest.txt文件在主题一段中将包含"*****SPAM*****" 这一行, 而nospamtest.txt文件中则没有.

建立SpamAssassin的学习系统
#sa-learn --rebuild -D -p user_prefs
sa-learn --dump all可以查看自学习的数据信息
——————————————————————————————————————————

使用Maildrop调用SpamAssassin
在/home/vpopmail/domains/localhost.com(你创建的域)/ 建立mailfilter文件
touch mailfilter
chown vpopmail:vchkpw mailfilter
chmod 700 mailfilter

mailfilter内容如下:

VPOP="| /home/vpopmail/bin/vdelivermail '' bounce-no-mailbox"
VHOME=`/home/vpopmail/bin/vuserinfo -d $EXT@$HOST`

if ( $SIZE < 262144 )
{
exception {
xfilter "/usr/bin/spamc -f -u $EXT@$HOST"
}
}

if (/^X-Spam-Flag: YES/)
{
# try filtering it using user-defined rules
exception {
include $VHOME/Maildir/.mailfilter
}
# then try delivering it to a Spam folder
exception {
# to "$VPOP"
to "$VHOME/Maildir/.Spam/"
}
# ah well, I guess they'll just have to live with disappointment
exception {
to "$VPOP"
}
}
else
{
exception {
include $VHOME/Maildir/.mailfilter
}
exception {
to "$VPOP"
}
}

修改.qmail-default内容如下:
| /usr/local/bin/maildrop ./mailfilter

————————————————————————————————
temp1发送测试邮件给temp2,结果发现发出去的信既不退回,对方也收不到
————————————————————————————————
less maillog 如下:
  1. Nov  5 17:31:36 mail1 qmail: 1099647096.449204 new msg 147603
  2. Nov  5 17:31:36 mail1 qmail: 1099647096.465185 info msg 147603: bytes 913 from <temp1@mail1.xsfx.com.cn>; qp 2446 uid 509
  3. Nov  5 17:31:36 mail1 qmail: 1099647096.487773 starting delivery 1: msg 147603 to local mail1.xsfx.com.cn-temp2@mail1.xsfx.com.cn
  4. Nov  5 17:31:36 mail1 qmail: 1099647096.487811 status: local 1/10 remote 0/20
  5. Nov  5 17:31:36 mail1 spamd[2407]: handle_user: unable to find user 'temp2@mail1.xsfx.com.cn'!
  6. Nov  5 17:31:36 mail1 spamd[2407]: processing message (unknown) for temp2@mail1.xsfx.com.cn:511.
  7. Nov  5 17:31:37 mail1 spamd[2407]: clean message (-1.8/5.0) for temp2@mail1.xsfx.com.cn:511 in 0.2 seconds, 913 bytes.
  8. Nov  5 17:31:37 mail1 spamd[2407]: result: . -1 - ALL_TRUSTED,AWL,DATE_IN_PAST_06_12,MIME_BASE64_TEXT scantime=0.2,size=913,mid=(unknown),autolearn=ham
  9. Nov  5 17:31:37 mail1 qmail: 1099647097.216144 delivery 1: failure: lseek_error_29/lseek_errno=29/
  10. Nov  5 17:31:37 mail1 qmail: 1099647097.238310 status: local 0/10 remote 0/20
  11. Nov  5 17:31:37 mail1 qmail: 1099647097.243274 bounce msg 147603 qp 2455
  12. Nov  5 17:31:37 mail1 qmail: 1099647097.243427 end msg 147603
  13. Nov  5 17:31:37 mail1 qmail: 1099647097.292579 new msg 147604
  14. Nov  5 17:31:37 mail1 qmail: 1099647097.293068 info msg 147604: bytes 1452 from <>; qp 2455 uid 506
  15. Nov  5 17:31:37 mail1 qmail: 1099647097.331454 starting delivery 2: msg 147604 to local mail1.xsfx.com.cn-temp1@mail1.xsfx.com.cn
  16. Nov  5 17:31:37 mail1 qmail: 1099647097.331570 status: local 1/10 remote 0/20
  17. Nov  5 17:31:37 mail1 spamd[2408]: handle_user: unable to find user 'temp1@mail1.xsfx.com.cn'!
  18. Nov  5 17:31:37 mail1 spamd[2408]: processing message (unknown) for temp1@mail1.xsfx.com.cn:511.
  19. Nov  5 17:31:37 mail1 spamd[2408]: clean message (-2.6/5.0) for temp1@mail1.xsfx.com.cn:511 in 0.2 seconds, 1452 bytes.
  20. Nov  5 17:31:37 mail1 spamd[2408]: result: . -2 - ALL_TRUSTED,NO_REAL_NAME scantime=0.2,size=1452,mid=(unknown),autolearn=ham
  21. Nov  5 17:31:37 mail1 qmail: 1099647097.715540 delivery 2: failure: lseek_error_29/lseek_errno=29/
  22. Nov  5 17:31:37 mail1 qmail: 1099647097.715839 status: local 0/10 remote 0/20
  23. Nov  5 17:31:37 mail1 qmail: 1099647097.721123 bounce msg 147604 qp 2463
  24. Nov  5 17:31:37 mail1 qmail: 1099647097.721261 end msg 147604
  25. Nov  5 17:31:37 mail1 qmail: 1099647097.721462 new msg 147603
  26. Nov  5 17:31:37 mail1 qmail: 1099647097.721571 info msg 147603: bytes 1903 from <#@[]>; qp 2463 uid 506
  27. Nov  5 17:31:37 mail1 qmail: 1099647097.726068 starting delivery 3: msg 147603 to local mail1.xsfx.com.cn-postmaster@mail1.xsfx.com.cn
  28. Nov  5 17:31:37 mail1 qmail: 1099647097.726146 status: local 1/10 remote 0/20
  29. Nov  5 17:31:37 mail1 spamd[2409]: handle_user: unable to find user 'postmaster@mail1.xsfx.com.cn'!
  30. Nov  5 17:31:38 mail1 spamd[2409]: processing message (unknown) for postmaster@mail1.xsfx.com.cn:511.
  31. Nov  5 17:31:38 mail1 spamd[2409]: clean message (-2.6/5.0) for postmaster@mail1.xsfx.com.cn:511 in 0.2 seconds, 1903 bytes.
  32. Nov  5 17:31:38 mail1 spamd[2409]: result: . -2 - ALL_TRUSTED,NO_REAL_NAME scantime=0.2,size=1903,mid=(unknown),autolearn=ham
  33. Nov  5 17:31:38 mail1 qmail: 1099647098.096747 delivery 3: failure: lseek_error_29/lseek_errno=29/
  34. Nov  5 17:31:38 mail1 qmail: 1099647098.097154 status: local 0/10 remote 0/20
  35. Nov  5 17:31:38 mail1 qmail: 1099647098.097227 triple bounce: discarding bounce/147603
  36. Nov  5 17:31:38 mail1 qmail: 1099647098.097301 end msg 147603
复制代码


向高手请教!!!!!

论坛徽章:
0
2 [报告]
发表于 2004-11-05 10:04 |只看该作者

请教SpamAssassin的安装配置

好像是qmail安装问题,和spamassassin没什么关系

论坛徽章:
0
3 [报告]
发表于 2004-11-05 12:08 |只看该作者

请教SpamAssassin的安装配置

[quote]原帖由 "我菜我怕谁"]好像是qmail安装问题,和spamassassin没什么关系[/quote 发表:


可是我不调用qmaildrop  qmail就是完全正常的。spamassassin测试应该是正常的。我感觉是通过qmaildrop调用它的方法有点疏忽把。不知道能不能指正以下!或者还有其他的精选文章推荐以下。谢谢阿

论坛徽章:
0
4 [报告]
发表于 2004-11-05 13:12 |只看该作者

请教SpamAssassin的安装配置

我感觉你的安装可能有问题。我也是这么装的,但是没有出现问题。

论坛徽章:
0
5 [报告]
发表于 2004-11-05 14:34 |只看该作者

请教SpamAssassin的安装配置

我也搞不清楚了 除了这个问题,其他都没有问题,不过修改了smtp规则,这个问题也算解决了! qmail-queue.pl 和qmail-queue有什么区别阿?
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP