前言
amavisd-new为一新的amavis perl module,它具有高效能、检查信件内容(SpamAssasin)、VirusScanners(可结合28种之多的扫毒程式)。它是由perl所写成的,所以效能有大幅的成长。它可与MTA使用SMTP、LMTP协定来沟通。
postfix+amavisd-new的流程:
(1)信件由Internet(smtpd)或是由Local(pickup)接收要传送的信件
(2)信件传送至cleanup
(3)信件传送至qmgr
(4)因content_filter的设定,会将信件传送至smtp-amavis
(5)amavisd-new执行content file及scanvirus的动作
(6)amavisd-new将信件传送至smtpd 10025(127.0.0.1:10025)
(7)信件传送至cleanup
(8)信件传送至qmgr
(9)信件传送至Internet(smtp)或是Local(local)
———————————————————————————————————————
版本
系统为debian/linux 4.0,amavisd-new 2.4.2-5
配置文件
Amavisd-new的主要配置文档在/etc/amavis/conf.d/目录中;
还有些变量需在amavisd-new的可执行脚步中查看,为/usr/sbin/amavisd-new。
1./etc/amavis/conf.d/配置文档
在/etc/amavis/conf.d/目录中,主要配置文件有:
/etc/amavis/conf.d/15-content_filter_mode
/etc/amavis/conf.d/20-debian_defaults
⑴在15-content_filter_mode中:
查杀病毒功能块,把下面代码前的“#”去掉便可。
#@bypass_virus_checks_maps = (
# \%bypass_virus_checks, \@bypass_virus_checks_acl, \$bypass_virus_checks_re);
垃圾邮件功能块:
@bypass_spam_checks_maps = ( #让amavisd-new启动spamassassin
\%bypass_spam_checks, \@bypass_spam_checks_acl, \$bypass_spam_checks_re);
1; # insure a defined return
⑵在20-debian_defaults中(此文件相当于其他版本中的amavisd.conf):
use strict;
#将$QUARANTINEDIR设定为刚刚建立的病毒隔离目录
$QUARANTINEDIR = “$MYHOME/virusmails”;
$log_recip_templ = undef; # disable by-recipient level-0 log entries
$DO_SYSLOG = 1; # log via syslogd (preferred)
$syslog_ident = ‘amavis’; # syslog ident tag, prepended to all messages
$syslog_facility = ‘mail’; # Syslog facility as a string
$syslog_priority = ‘debug’; # switch to info to drop debug output, etc
$enable_db = 1; # enable use of BerkeleyDB/libdb (SNMP and nanny)
$enable_global_cache = 1; # enable use of libdb-based cache if $enable_db=1
$inet_socket_port = 10024; # 默认amavisd-new监听端口t
#设定评分规则
#变量以$sa开头的均为spamassassin中的,在这进行设置后,在 /etc/spamassassin/local.cf 所#设定的將失去效用
$sa_spam_subject_tag = ‘***SPAM*** ‘; # 对垃圾邮件主题添加’***SPAM*** ‘
$sa_tag_level_deflt = -10; # 超过这个分数标准者,才视为垃圾邮件打分数。
$sa_tag2_level_deflt = 20; # 超过这个分数标准者,才允许在邮件标题加入Spam 信息。加入#X-Spam-Flag:YES 及改写主题
$sa_kill_level_deflt = 6.31; # 超过这个分数标准者,就直接將信件备份后删除
$sa_dsn_cutoff_level = 10; # 超过这个分数标准者,將不会送出 DSN 信息
$sa_mail_body_size_limit = 200*1024; # 超过某个特定大小的邮件就不经过SpamAssassin 的扫#描,此大小不包括附件大小。
#让sa可以和外部连线
$sa_local_tests_only = 0; # only tests which do not require internet access?
$sa_auto_whitelist = 1; # 启用自动学习白名单 White List
#启用 SpamAssassin 的 Debug。在正式上线时请记得去掉
# Turn on SpamAssassin debugging (output to STDERR, use with ‘amavisd debug’)
$sa_debug = 1; # defaults to false
# 设定 White List
# 注意:在 /etc/spamassassin/local.cf 所设定的將失去效用!
@whitelist_sender_maps = ( [“.cc17121.com”] );#添加白名单,对大附件仍然进行解压缩,但不打分
#map { $whitelist_sender{lc($_)}=1 } (qw( #同上功能
# *@cc17121.com
# *@*.edu.tw
#));
# 或指定为某个档案。注意:这些档案必须存在,否则Amavisd-new 將无法启动!
read_hash(\%whitelist_sender, ‘/var/amavis/whitelist’);
#指定黑名单
read_hash(\%blacklist_sender, ‘/var/amavis/blacklist’);
#若收件人名列其中,则不进行垃圾邮件检测
read_hash(\%spam_lovers, ‘/var/amavis/spam_lovers’);
###以下几个变量在执行脚本/usr/sbin/amavisd-new中均可找到######################
# Quota limits to avoid bombs (like 42.zip)
$MAXLEVELS = 1; #扫描压缩包时,解压几层
$MAXFILES = 150; #最多扫描压缩包内1500个文件
$MIN_EXPANSION_QUOTA = 100*1024; # 单位bytes,最小邮件限额,包括附件
$MAX_EXPANSION_QUOTA = 200*1024*1024; # bytes , 最大邮件大小,为200K
$MIN_EXPANSION_FACTOR = 1; #可扫描邮件大小的最小倍数
$MAX_EXPANSION_FACTOR = 500; #可扫描邮件大小的最大倍数#
#最大扫描压缩包大小为($MAX_EXPANSION_QUOTA)×($MAX_EXPANSION_FACTOR),#当解压缩后的文件达到此值时,系统会结束解压缩进程。
#
#
#########################################################
$undecipherable_subject_tag = ‘ ‘; #取消对未检查的信件主题添加“UNCHECK”,也可以在
#执行脚本/usr/sbin/amavisd-new中修改”UNCHECK”
# Use D_DISCARD 邮件不传送给发件人及收件人。
#Use D_BOUNCE 不传送给收件人。除了定义在 $viruses_that_fake_sender_re 病毒名称# # #外的信件,amavisd-new 皆会传送 DSN 讯息给发件人。
# Use D_REJECT 不传送给收件人,发件人会收到拒绝传送的信息。
# Use D_PASS 不做任何处理,直接传送给收件人。
$final_virus_destiny = D_DISCARD;
$final_banned_destiny = D_PASS;
$final_spam_destiny = D_DISCARD;
$final_bad_header_destiny = D_PASS;
$MAX_EXPANSION_FACTOR测试结果:
a. 附件为257M,$MAX_EXPANSION_FACTOR为500倍,先添加好附件:
点击发送:11:16:00 发送页面完成:11:19:20 耗时:3m 20s
Bzip进程开始时间:11:23:45 结束时间:11:28:00 耗时:4m 15s (bzip为解压缩进程)
发送完成时间:11:30:40 共耗时:14m40s
b. 附件为257M,$MAX_EXPANSION_FACTOR为1倍,先添加好附件:
点击发送:12:31:30 发送页面完成:12:34:40 耗时:3m 10s
Bzip进程开始时间:12:39:05 结束时间:12:39:55 耗时:50s (bzip为解压缩进程)
发送完成时间:12:42:30 共耗时:11m00s
2./usr/sbin/amavisd-new 执行文件
$MIN_EXPANSION_FACTOR = 1; # times original mail size
$MAX_EXPANSION_FACTOR = 500; # times original mail size
$spam_lover #发送垃圾邮箱至
# timeout for our processing: 超出设置时间后会断开连接
$child_timeout = 8*60; # abort child if it does not complete a task in n sec
# $child_timeout的值則須小於/etc/postfix/main.cf裡smtp_data_dome_timeout的值
# Net::Server pre-forking settings – defaults, overruled by amavisd.conf
$max_servers = 2; # number of pre-forked children
$max_requests = 10; # retire a child after that many accepts
# serves only as a quick default for other configuration settings
$MYHOME = ‘/var/amavis’;
$mydomain = ‘!change-mydomain-variable!.example.com’;#intentionally bad default
$virus_admin = “administrator\@$mydomain”;
$spam_admin = “administrator\@$mydomain”;
$mailfrom_notify_admin = “administrator\@$mydomain”;
$mailfrom_notify_recip = “administrator\@$mydomain”;
$mailfrom_notify_spamadmin = “administrator\@$mydomain”;
发表评论
您必须在 登录 后才能评论.