postfix + amavisd-new + clamav + spamassassin

amavisd-new:介于MTA和内容过滤软件之间的接口,负责调用spamassassin和clamav处理邮件。

clamav:linux下的杀毒软件,多用于邮件网关。

spammassassin:邮件内容过滤软件


环境:centos6.2


1.安装rpmforge            //centos下的第三方仓库

yum install http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.3-1.el6.rf.x86_64.rpm -y

rpm --import http://apt.sw.be/RPM-GPG-KEY.dag.txt


2.安装postfix、amavisd-new、clamav、spamassassin

yum install amavisd-new clamav clamav-devel clamd spamassassin -y

tail /etc/passwd    //新增clamav,amavis用户

chkconfig clamd --list

chkconfig amavisd --list    //确认服务开机自启动


3.配置clamav

vim /etc/clamd.conf

LocalSocket /var/run/clamav/clamd.sock    //默认开

#TCPSocket 3310            //注释此行


4.配置amvisd-new

vim /etc/amavisd.conf

//取消此3行默认的注释

@bypass_virus_checks_maps = (1);  # controls running of anti-virus code
@bypass_spam_checks_maps  = (1);  # controls running of anti-spam code
$bypass_decode_parts = 1;        # controls running of decoders & dearchivers

$max_servers = 2;        //此处2和postfix的master.cf中的maxproc相同

//取消以下2行默认的注释

$notify_method  = 'smtp:[127.0.0.1]:10025';

$forward_method = 'smtp:[127.0.0.1]:10025';  # set to undef with milter!

$mydomain = 'example.com';         //你的域名

$myhostname = 'mail.example.com';    //你的完整主机名

//取消以下4行默认的注释

$MYHOME = '/var/amavis';

$helpers_home = "$MYHOME/var";              

$lock_file = "$MYHOME/var/amavisd.lock";

$pid_file  = "$MYHOME/var/amavisd.pid";

//调整级别

$sa_tag_level_deflt  = 2.0;

                $sa_tag2_level_deflt = 6.2;

$sa_kill_level_deflt = 6.9;                

$sa_dsn_cutoff_level = 10;                  

# $sa_quarantine_cutoff_level = 25;        

$penpals_bonus_score = 8;

                  $penpals_threshold_high = $sa_kill_level_deflt;

$sa_mail_body_size_limit = 400*1024;         $sa_local_tests_only = 0;

//垃圾邮件通知

$virus_admin               = "virusalert\@$mydomain";

$mailfrom_notify_admin     = "virusalert\@$mydomain";

$mailfrom_notify_recip     = "virusalert\@$mydomain";

$mailfrom_notify_spamadmin = "spam.police\@$mydomain";

//取消以下4行默认的注释

['ClamAV-clamd',

 \&ask_daemon, ["CONTSCAN {}\n", "/var/run/clamav/clamd.sock"],

 qr/\bOK$/, qr/\bFOUND$/,

 qr/^.*?: (?!Infected Archive)(.*) FOUND$/ ],


5.配置postfix

vim /etc/postfix/master.cf

//添加

amavisfeed unix -       -       n       -       2       lmtp
       -o lmtp_data_done_timeout=1200
       -o lmtp_send_xforward_command=yes
       -o disable_dns_lookups=yes
       -o max_use=20
127.0.0.1:10025 inet n  -       n       -       -       smtpd
       -o content_filter=
       -o smtpd_delay_reject=no
       -o smtpd_client_restrictions=permit_mynetworks,reject
       -o smtpd_helo_restrictions=
       -o smtpd_sender_restrictions=
       -o smtpd_recipient_restrictions=permit_mynetworks,reject
       -o smtpd_data_restrictions=reject_unauth_pipelining
       -o smtpd_end_of_data_restrictions=
       -o smtpd_restriction_classes=
       -o mynetworks=127.0.0.0/8
       -o smtpd_error_sleep_time=0
       -o smtpd_soft_error_limit=1001
       -o smtpd_hard_error_limit=1000
       -o smtpd_client_connection_count_limit=0
       -o smtpd_hard_error_limit=1000

postconf -e 'content_filter = amavisfeed:[127.0.0.1]:10024'


6.测试

/etc/init.d/postfix restart

/etc/init.d/clamd restart

/etc/init.d/amavisd restart

telnet localhost 10024

telnet localhost 10025


官方文档:http://wiki.centos.org/HowTos/Amavisd


你可能感兴趣的:(+,+,+,postfix,spamassassin,ClamAV,Amavisd-new)