7.配置Amavis, ClamAV, and SpamAssassin
添加用户:
[plain] view plaincopy
- adduser clamav amavis
- adduser amavis clamav
编辑/etc/amavis/conf.d/15-content_filter_mode文件配置内容过滤模式
[plain] view plaincopy
use strict;
#You can modify this file to re-enable SPAM checking through spamassassin
#and to re-enable antivirus checking.
#
#Default antivirus checking mode
#Please note, that anti-virus checking is DISABLED by
#default.
#If You wish to enable it, please uncomment the following lines:
@bypass_virus_checks_maps = ( //13行
\%bypass_virus_checks, \@bypass_virus_checks_acl, \$bypass_virus_checks_re);
#
#Default SPAM checking mode
#Please note, that anti-spam checking is DISABLED by
#default.
#If You wish to enable it, please uncomment the following lines:
@bypass_spam_checks_maps = ( //24行
\%bypass_spam_checks, \@bypass_spam_checks_acl, \$bypass_spam_checks_re);
1; # ensure a defined return
现在通过编辑 /etc/default/spamassassin的这些行来激活SpamAssassin :
[plain] view plaincopy
8行
#Change to one to enable spamd
ENABLED=1
[plain] view plaincopy
31行
#Cronjob
#Set to anything but 0 to enable the cron job to automatically update
#spamassassin’s rules on a nightly basis
CRON=1
重启相关服务
[plain] view plaincopy
service amavis restart
service spamassassin restart
mailserv@mail:/etc/dovecot/conf.d$ sudo service spamassassin stop
Stopping SpamAssassin Mail Filter Daemon: spamd.
mailserv@mail:/etc/dovecot/conf.d$ sudo service spamassassin start
Starting SpamAssassin Mail Filter Daemon: spamd.
8.配置postfix
先添加几个新文件让postfix用mysql来管理
vi /etc/postfix/mysql_virtual_alias_domainaliases_maps.cf
[plain] view plaincopy
user = mail
password = mailpassword
hosts = 127.0.0.1
dbname = mail
query = SELECT goto FROM alias,alias_domain
WHERE alias_domain.alias_domain = ‘%d’
AND alias.address=concat(‘%u’, ‘@’, alias_domain.target_domain)
AND alias.active = 1
vi /etc/postfix/mysql_virtual_alias_maps.cf
[plain] view plaincopy
user = mail
password = mailpassword
hosts = 127.0.0.1
dbname = mail
table = alias
select_field = goto
where_field = address
additional_conditions = and active = ‘1’
vi /etc/postfix/mysql_virtual_domains_maps.cf
[plain] view plaincopy
user = mail
password = mailpassword
hosts = 127.0.0.1
dbname = mail
table = domain
select_field = domain
where_field = domain
additional_conditions = and backupmx = ‘0’ and active = ‘1’
vi /etc/postfix/mysql_virtual_mailbox_domainaliases_maps.cf
[plain] view plaincopy
user = mail
password = mailpassword
hosts = 127.0.0.1
dbname = mail
query = SELECT maildir FROM mailbox, alias_domain
WHERE alias_domain.alias_domain = ‘%d’
AND mailbox.username=concat(‘%u’, ‘@’, alias_domain.target_domain )
AND mailbox.active = 1
vi /etc/postfix/mysql_virtual_mailbox_maps.cf
[plain] view plaincopy
user = mail
password = mailpassword
hosts = 127.0.0.1
dbname = mail
table = mailbox
select_field = CONCAT(domain, ‘/’, local_part)
where_field = username
additional_conditions = and active = ‘1’
创建/etc/postfix/header_checks,添加一些头信息
[plain] view plaincopy
/^Received:/ IGNORE
/^User-Agent:/ IGNORE
/^X-Mailer:/ IGNORE
/^X-Originating-IP:/ IGNORE
/^x-cr-[a-z]*:/ IGNORE
/^Thread-Index:/ IGNORE
评论区