安装四个下载的软件包:
# dpkg -i *.deb
修改/etc/amavis/amavisd.conf:
@inet_acl = qw( 127/8 1.2.3.4/32 ); # 1.2.3.4 is your external ip .. because want maybe also accept mail from that interface, it's up to you.
$warnviruender = 1; # I want to warn people, who have got virus.
$warnvirusrecip = 1; # I want to warn my users about virus send to them.
$warn_offsite = 1; # I want to warn senders/recipients, that are not located on my server
$mailfrom_notify_admin = 'virusalert@example.com'; #
$mailfrom_notify_recip = 'virusalert@example.com'; # Change these to the aropriate email-adrees, you wish to use as sender
$mailfrom_notify_amadmin = 'am.police@example.com'; # for am and virus warnings
$hdrfrom_notify_sender = 'AMaViS (content filter) <ostmaster@example.com>';
$virus_admin = 'virus-admin@example.com'; #
$am_admin = 'am-admin@example.com'; #
指定使用uvscan:
@av_scaers = (
['NAI McAfee AntiVirus (uvscan)', 'uvscan',
'--secure -rv --summary --noboot {#125;', [0], [13],
qr/(?x) Found (?:
\ the\ (.+)\ (?:virus|trojan) |
\ (?:virus|trojan)\ or\ variant\ ([^ ]+) |
:\ (.+)\ NOT\ a\ virus)/ ],
);
找到/etc/postfix/master.cf如下行:
smtp inet n - n - - smtpd
改为如下:
smtp inet n n n - - smtpd -o content_filter=smtp-amavis:[127.0.0.1]:10024
smtp-amavis unix - - n - 2 smtp
-o smtp_data_done_timeout=1200
-o disable_d_looku=yes
127.0.0.1:10025 inet n - n - - smtpd
-o local_recipient_ma=
-o smtpd_restriction_claes=
-o smtpd_client_restrictio=
-o smtpd_helo_restrictio=
-o smtpd_sender_restrictio=
-o smtpd_recipient_restrictio=permit_mynetworks,reject
-o strict_rfc821_envelopes=yes
重启postfix
,这样在收到病毒邮件的时候能够在日志文件看到如下的信息:
Jul 16 15:34:22 xxx amavis[30997]: (30997-09) INFECTED (W32/Nimda.gen@MM), (?) -> <xxx@xxx.org>, quarantine virus-20030716-153422-30997-09, Meage-ID: <20030716073414.520D3E5C2F@xxx>
三、防垃圾邮件部分
垃圾邮件的防范必须掌握好尺度
,postfix本身提供了header_check、body_check、acce、claes等方式来拒绝邮件,可以参考如下地址的样例,结合自己的情况进行修改也能阻止一部分垃圾邮件:
http://www.XXXX.com/guides/postfix_uce_header.html
http://www.XXXX.com/guides/postfix_uce_body.html
http://www.XXXX.com/guides/postfix_uce_acce.html
http://www.XXXX.com/guides/postfix_uce_cla.html
不过以上配置文件需要管理员根据自己情况手工进行修改,如果直接采用的话,那么国内很多邮件你将收不到
。 amAain和AMaViS可以很好的结合,它能够帮管理员自动处理一些垃圾邮件
。amAain很有趣,它对解码后的邮件进行扫描后打分,如果分数达到用户指定的分数,那么就认为是垃圾邮件,而且它还有学习功能,管理员也可以自己重新定义各种分值或自定义分值。
1、amAain的安装
由于已经安装了AMaViS,所以自然就选择了amAain。amAain可以通过CPAN安装:
# perl -MCPAN -e shell
itall Mail::amAain
2、amAain配置
创建/var/lib/amavis/.amaain/user_prefs文件:
# amAain config file for version 2.5x
# generated by http://www.yrex.com/am/amconfig.php (version 1.01)
# How many hits before a meage is coidered am.
required_hits 5.0
# Whether to change the subject of suected am
rewrite_subject 1
# Text to prepend to subject if rewrite_subject is used
subject_tag *****AM*****
# Encaulate am in an attachment
report_safe 1
# Use terse version of the am report
use_terse_report 0
# Enable the Bayes system
use_bayes 1
# Enable Bayes auto-learning
auto_learn 1
# Enable or disable network checks
skip_rbl_checks 1
use_razor2 0
use_dcc 0
use_pyzor 0
# Mail using languages used in these country codes will not be marked
# as being poibly am in a foreign language.
# - chinese english
ok_languages zh en
# Mail using locales used in these country codes will not be marked
# as being poibly am in a foreign language.
ok_locales en zh