第一个问题解决,转:
amavisd-new 不对本地域名过滤方法
本人也曾因为amavisd-new过滤本地域外发的邮件而抓耳挠腮,通过一个多星期的查找资料,才找到了两个合适的方法.
在说方法之前,我先要说明下amavisd.conf中的local_domains*不能做到跳过检测,如果网友质疑,可以拿出方法来�逦�.
方法一:
通过submission跳过检测.
这个方法唯一的缺点就是,使用OE或Foxmail等代理软件的用户必须修改smtp默认的端口号(默认是25).
编辑postfix/master.cf
启用submission这个进程,加入认证方式和过滤策略,保存后退出
submission inet n - n - - smtpd
-o smtpd_etrn_restrictions=reject
-o smtpd_sasl_auth_enable=yes
-o smtpd_client_restrictions=permit_sasl_authenticated,reject
-o content_filter=smtp-amavis:[127.0.0.1]:10026
这里过滤策略用得是smtp-amavis:[127.0.0.1]:10026
修改amavisd.conf
打开amavisd的监听端口,以后amavisd将监听10024,10025,10026这三个端口
$inet_socket_port = [10024, 10026];
大部分人的配置只是打开了10024,如$inet_socket_port = 10024.
接着添加对10026端口的策略,如果你的配置中已存在对10026端口的策略,请注释掉.
$interface_policy{'10026'} = 'CHECKBYPASS';
$policy_bank{'CHECKBYPASS'} = { # mail from submission and smtps ports
bypass_spam_checks_maps => [1], # don't spam-check this mail
bypass_banned_checks_maps => [1], # don't banned-check this mail
bypass_header_checks_maps => [1], # don't header-check this mail
};
保存后退出
重启postfix和amavisd
netstat -tnlp 看看端口状态
tcp 0 0 0.0.0.0:587 0.0.0.0:* LISTEN 18525/master
587既是submission的监听端口.
现在设置outlook或foxmail
修改发件设置中smtp端口号为587即可,别忘了在防火墙中放开587.
用本域用户试发一封邮件看看.
amavis[30236]: (30236-16) Passed CLEAN, CHECKBYPASS [222.45.26.224] [222.45.26.224] <[email protected]> -> <[email protected]>, Message-ID: <[email protected]>, mail_id: ALw5YMALJbGF, Hits: -, size: 1605, queued_as: 1FFA8474002, 182 ms
如果出现红色的部分,说明设置成功了,这样,不管是否垃圾邮件都将跳过检测.由于跳过检测,发信的速度会很快,而且对系统的开销小.这是个不错的办法.
第二个方法:
修改@mynetworks.
编辑amavisd.conf
默认为:
@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 );
加入你要跳过过滤的IP网段
例如:
@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 222.45.26.0/24 );
同时修改MYNETS策略成如下
$policy_bank{'MYNETS'} = { # mail originating from @mynetworks
originating => 1, # is true in MYNETS by default, but let's make it explicit
os_fingerprint_method => undef, # don't query p0f for internal clients
bypass_spam_checks_maps => [1], # don't spam-check internal mail
bypass_banned_checks_maps => [1], # don't banned-check internal mail
bypass_header_checks_maps => [1], # don't header-check internal mail
};
保存后重启amaivsd
以后来自222.45.26.0/24的邮件都跳过检测.
同样会看到如下记录
amavis[15750]: (15750-11) Passed CLEAN, MYNETS LOCAL [222.45.26.132] [222.45.26.132] <[email protected]> -> <[email protected]>, Message-ID: <E9E8D264BCF84E23AD210DC0E9A3C1CF@bendan13e0dfc8ed>, mail_id: VbR2kBqI-F1W, Hits: -, size: 11378, queued_as: E741F1D94001, 450 ms
这种方法也不是万金油,他也只能跳过来自@mynetworks中地址的邮件
两种方法任意选择