Postfix+Amavisd-new+Spamassassin+ClamAV整合安装
1. 安装软件和依赖包
apt-get install amavisd-new spamassassin clamav-daemon mysql-client mysql-server
apt-get install libnet-dns-perl pyzor razor
apt-get install arj bzip2 cabextract cpio file gzip lha nomarch pax rar unrar unzip zip
2. 修改用户权限
usermod -a -G clamav amavis
usermod -a -G amavis clamav
3. 修改spamassassin配置文件/etc/default/spamassassin
ENABLED=0 ====> ENABLED=1
CRON=0 ====> CRON=1
4.启动spamassassin
/etc/init.d/spamassassin start
5. 修改amavis配置文件/etc/amavis/conf.d/15-content_filter_mode
1) 去掉里面的注释(目的:check病毒和垃圾邮件)
2) 重启amavis
/etc/init.d/amavis restart
6. 修改postfix配置文件/etc/postfix/main.cf,添加如下内容
注释掉mydestination
添加:
relay_domains = jobcn.com
transport_maps = hash:/etc/postfix/transport
relay_recipient_maps = hash:/etc/postfix/relay_recipients
content_filter = smtp-amavis:[127.0.0.1]:10024
7. 编辑文件/etc/postfix/master.cf,在文件最后添加如下内容
smtp-amavis unix - - - - 2 smtp
-o smtp_data_done_timeout=1200
-o smtp_send_xforward_command=yes
-o disable_dns_lookups=yes
-o max_use=20
127.0.0.1:10025 inet n - - - - smtpd
-o content_filter=
-o local_recipient_maps=
-o relay_recipient_maps=
-o smtpd_restriction_classes=
-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 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_client_connection_rate_limit=0
-o receive_override_options=no_header_body_checks,no_unknown_recipient_checks
8. 在文件/etc/postfix/master.cf中的pickup行添加如下内容
-o content_filter=
-o receive_override_options=no_header_body_checks
9. 重启postfix
/etc/init.d/postfix reload
10. 修改/etc/amavis/conf.d/20-debian_defaults
$findal_spam_destiny = D_BOUNCE ===> $findal_spam_destiny = D_DISCARD
$QUARANTINEDIR = "/data/virusmails";
11. 修改/etc/amavis/conf.d/05-node_id
$myhostname = "mail.example.com";
12. 修改/etc/amavis/conf.d/50-user,添加如下内容:
$spam_quarantine_to = "spam-quarantine";
$virus_quarantine_to = "spam-quarantine";
@whitelist_sender_maps = read_hash("/etc/amavis/whitelist");
@blacklist_sender_maps = read_hash("/etc/amavis/blacklist");
13. 在目录/etc/amavis下创建文件blacklist和whitelist
touch /etc/amavis/whitelist
touch /etc/amavis/blacklist
14. 垃圾及病毒邮件的保存目录
/data/virusmails