amavisd-new黑白名单设置经验总结
借鉴网上各位老大的这个问题的设置。看到的有以下两种情况:
1 vi /etc/amavisd.conf (加入以下两行)
2
3 ---------------------------------------------------------------------------------------
4 read_hash(\%whitelist_sender, '/var/amavis/var/.spamassassin/whitelist');
5 read_hash(\%blacklist_sender, '/var/amavis/var/.spamassassin/blacklist');
6 ---------------------------------------------------------------------------------------
7
8 注明:以上两个文件 whitelist 和 blacklist 要手动建立
9
10 touch > /var/amavis/var/.spamassassin/whitelist
11 touch > /var/amavis/var/.spamassassin/blacklist
12 两个文件的属主属性为:
13 chown amavis:amavis whitelist
14 chown amavis:amavis blacklist
15
16 1)建立后,执行 /etc/rc.d/init.d/amavisd reload 让 amavisd 重新读取配置文件信息。
17
18 2)登记在 whitelist 的邮件地址或域名均不会被 Spamassassin 打分为垃圾邮件。
19
20 3)登记在 blacklist 的邮件地址或域名均会被 Spamassassin 打分为垃圾邮件。
21
22 4)whitelist 和 blacklist 的写法,例如:
23 test@test.com.cn
24 *@boss.com
25
26 5)修改了 whitelist 或 blacklist 文件,均需要执行 /etc/rc.d/init.d/amavisd restart 让 amavisd 重新启动,否则,黑白名单不能生效 !!!
这种方式我采用的是
read_hash(\%whitelist_sender, '/var/amavis/var/.spamassassin/whitelist');
read_hash(\%blacklist_sender, '/var/amavis/var/.spamassassin/blacklist');
配置,但是针对这个域的配置是无效的。
在论坛中搜了一下,有如下的配置
amavisd-new设置黑白名单问题
想再请教各位老大一个问题,在amavisd-new中添加黑白名单是只是对用户有效,不能对整个域有效,肯请知道的老大相告怎么写才能通配一个域或者更大?
[ 本帖最后由 isee 于 2007-10-25 17:13 编辑 ]
代码:
@whitelist_sender_maps = ( [qw(example.cn .exmpl.com)] );
其中[example.cn]指匹配该域下的所有帐号,[.exmpl.com]匹配该域及子域的所有帐号,如 @sub1.exmpl.com, @sub2.exmpl.com 等等。
配置后,确实解决了对整个域的问题,但是如果添加单个帐号的的话,也要在@whitelist_sender_maps = ( [qw(example.cn .exmpl.com)] ); 里面添加,自己实验一个更好的方法,也是收到上面的二者的启示啊,呵呵
本人的配置
采用centos 4.6 参考 http://www.extmail.org/docs/extmail_solution_linux/ 完成E-mail服务的建立
amavisd-new的版本是
[root@mail log]# amavisd -V
amavisd-new-2.5.4 (20080312)
amavisd-new 配置文件(供大家参考,有问题,请各位老大指点啊)
$max_servers = 10; # num of pre-forked children (2..30 is common), -m
$daemon_user = "amavis"; # (no default; customary: vscan or amavis), -u
$daemon_group = "amavis"; # (no default; customary: vscan or amavis), -g
$mydomain = 'test.com'; # a convenient default for other settings
# $MYHOME = '/var/amavis'; # a convenient default for other settings, -H
$TEMPBASE = "$MYHOME/tmp"; # working directory, needs to exist, -T
$ENV{TMPDIR} = $TEMPBASE; # environment variable TMPDIR, used by SA, etc.
$QUARANTINEDIR = "/var/virusmails";
@local_domains_maps = ( [".$mydomain","test2.com"] ); # list of all local domains
@mynetworks = qw( 127.0.0.0/8 [::1] [FE80::]/10 [FEC0::]/10
10.0.0.0/8 172.16.0.0/12 192.168.0.0/16 );
$sa_tag_level_deflt = 4.0; # add spam info headers if at, or above that level
$sa_tag2_level_deflt = 6.3; # add 'spam detected' headers at that level
$sa_kill_level_deflt = 10; # triggers spam evasive actions (e.g. blocks mail)
$sa_dsn_cutoff_level = 9; # spam level beyond which a DSN is not sent
$sa_spam_subject_tag = '***SPAM*** ';
$myhostname = 'mail.test.com'; # must be a fully-qualified domain name!
$final_virus_destiny = D_DISCARD;
$final_banned_destiny = D_BOUNCE;
$final_spam_destiny = D_BOUNCE;
$final_bad_header_destiny = D_PASS;
$virus_quarantine_to = "virus\@$mydomain";
$banned_quarantine_to = "spam\@$mydomain";
# $bad_header_quarantine_to,
$spam_quarantine_to = "spam\@$mydomain";
read_hash(\%whitelist_sender, '/var/amavis/.spamassassin/whitelist');
read_hash(\%blacklist_sender, '/var/amavis/.spamassassin/blacklist');
# ### http://www.clamav.net/
['ClamAV-clamd',
\&ask_daemon, ["CONTSCAN {}\n", "/tmp/clamd.socket"],
qr/\bOK$/, qr/\bFOUND$/,
qr/^.*?: (?!Infected Archive)(.*) FOUND$/ ],
注明:以上两个文件 whitelist 和 blacklist 要手动建立
touch > /var/amavis/.spamassassin/whitelist 注意路径
touch > /var/amavis/.spamassassin/blacklist
两个文件的属主属性为:
chown amavis:amavis whitelist
chown amavis:amavis blacklist
whitelist 和 blacklist 的写法,例如:
test@test.com.cn 单个邮件地址
test.com 整个域
.test1.com 整个域及其子域( 注意前面的写法中 . )
修改了 whitelist 或 blacklist 文件,均需要执行 /etc/rc.d/init.d/amavisd reload 让 amavisd 重新应用,否则,黑白名单不能生效 !!!