主题: 启用反垃圾邮件功能,从效果来看没有生效

==== 必填信息。没有填写将不予回复 ====
- iRedMail 版本号:0.9.0
- 使用哪个数据库存储用户帐号(OpenLDAP,MySQL,PostgreSQL):MySQL
- 使用的 Linux/BSD 发行版名称及版本号:CentOS6.5
- 与您的问题相关的日志信息:
Oct 13 11:58:34 mailserver postfix/qmgr[17692]: 787A23DC05DD: from=<licheng@macrodata.com>, size=1906948, nrcpt=4 (queue active)
Oct 13 11:58:34 mailserver amavis[22094]: (22094-18) Net::Server: 2016/10/13-11:58:34 CONNECT TCP Peer: "[127.0.0.1]:52824" Local: "[127.0.0.1]:10024"
Oct 13 11:58:34 mailserver amavis[22094]: idle_proc, hi : was idle, 10452.5 ms, total idle 75.505 s, busy 12.199 s
Oct 13 11:58:34 mailserver amavis[22094]: loaded base policy bank
Oct 13 11:58:34 mailserver amavis[22094]: lookup_ip_acl (inet_acl) arr.obj: key="127.0.0.1" matches "127.0.0.1", result=1
Oct 13 11:58:34 mailserver amavis[22094]: process_request: fileno sock=12, STDIN=0, STDOUT=1
Oct 13 11:58:34 mailserver amavis[22094]: get_deadline switch_to_my_time(new request) - deadline in 480.0 s, set to 336.000 s
Oct 13 11:58:34 mailserver amavis[22094]: prolong_timer switch_to_my_time(new request): timer 336, was 0, deadline in 480.0 s
Oct 13 11:58:34 mailserver amavis[22094]: process_request: suggested_protocol="" on a TCP socket
Oct 13 11:58:34 mailserver amavis[22094]: (22094-19) SMTP> 220 [127.0.0.1] ESMTP amavisd-new service ready
Oct 13 11:58:34 mailserver amavis[22094]: (22094-19) switch_to_client_time 480 s, smtp response sent
Oct 13 11:58:34 mailserver amavis[22094]: (22094-19) idle_proc, 4: was busy, 4.8 ms, total idle 75.505 s, busy 12.204 s
Oct 13 11:58:34 mailserver amavis[22094]: (22094-19) smtp readline: read 34 bytes, new size: 34
Oct 13 11:58:34 mailserver amavis[22094]: (22094-19) idle_proc, 5: was idle, 0.6 ms, total idle 75.506 s, busy 12.204 s
Oct 13 11:58:34 mailserver amavis[22094]: (22094-19) SMTP< EHLO mailserver.macrodata.com\r\n
Oct 13 11:58:34 mailserver amavis[22094]: (22094-19) get_deadline switch_to_my_time(rx SMTP EHLO) - deadline in 480.0 s, set to 336.000 s
Oct 13 11:58:34 mailserver amavis[22094]: (22094-19) prolong_timer switch_to_my_time(rx SMTP EHLO): timer 336, was 480, deadline in 480.0 s
Oct 13 11:58:34 mailserver amavis[22094]: (22094-19) ESMTP> 250-[127.0.0.1]
Oct 13 11:58:34 mailserver amavis[22094]: (22094-19) ESMTP> 250-VRFY
Oct 13 11:58:34 mailserver amavis[22094]: (22094-19) ESMTP> 250-PIPELINING
Oct 13 11:58:34 mailserver amavis[22094]: (22094-19) ESMTP> 250-SIZE
Oct 13 11:58:34 mailserver amavis[22094]: (22094-19) ESMTP> 250-ENHANCEDSTATUSCODES
Oct 13 11:58:34 mailserver amavis[22094]: (22094-19) ESMTP> 250-8BITMIME
Oct 13 11:58:34 mailserver amavis[22094]: (22094-19) ESMTP> 250-DSN
Oct 13 11:58:34 mailserver amavis[22094]: (22094-19) ESMTP> 250 XFORWARD NAME ADDR PORT PROTO HELO IDENT SOURCE
Oct 13 11:58:34 mailserver amavis[22094]: (22094-19) switch_to_client_time 480 s, smtp response sent
Oct 13 11:58:34 mailserver amavis[22094]: (22094-19) idle_proc, 6: was busy, 3.2 ms, total idle 75.506 s, busy 12.207 s
Oct 13 11:58:34 mailserver amavis[22094]: (22094-19) smtp readline: read 214 bytes, new size: 214
Oct 13 11:58:34 mailserver amavis[22094]: (22094-19) idle_proc, 5: was idle, 0.5 ms, total idle 75.506 s, busy 12.207 s
Oct 13 11:58:34 mailserver amavis[22094]: (22094-19) ESMTP< XFORWARD ADDR=10.131.0.149 PORT=50190\r\n
Oct 13 11:58:34 mailserver amavis[22094]: (22094-19) get_deadline switch_to_my_time(rx SMTP XFORWARD) - deadline in 480.0 s, set to 336.000 s
Oct 13 11:58:34 mailserver amavis[22094]: (22094-19) prolong_timer switch_to_my_time(rx SMTP XFORWARD): timer 336, was 480, deadline in 480.0 s
Oct 13 11:58:34 mailserver amavis[22094]: (22094-19) ESMTP> 250 2.5.0 Ok XFORWARD
Oct 13 11:58:34 mailserver amavis[22094]: (22094-19) switch_to_client_time 480 s, smtp response sent
Oct 13 11:58:34 mailserver amavis[22094]: (22094-19) idle_proc, 6: was busy, 1.3 ms, total idle 75.506 s, busy 12.209 s
Oct 13 11:58:34 mailserver amavis[22094]: (22094-19) idle_proc, 5: was idle, 0.3 ms, total idle 75.506 s, busy 12.209 s
Oct 13 11:58:34 mailserver amavis[22094]: (22094-19) ESMTP< XFORWARD PROTO=ESMTP HELO=Addison IDENT=787A23DC05DD SOURCE=REMOTE\r\n
Oct 13 11:58:34 mailserver amavis[22094]: (22094-19) get_deadline switch_to_my_time(rx SMTP XFORWARD) - deadline in 480.0 s, set to 336.000 s
Oct 13 11:58:34 mailserver amavis[22094]: (22094-19) prolong_timer switch_to_my_time(rx SMTP XFORWARD): timer 336, was 480, deadline in 480.0 s
Oct 13 11:58:34 mailserver amavis[22094]: (22094-19) ESMTP> 250 2.5.0 Ok XFORWARD
Oct 13 11:58:34 mailserver amavis[22094]: (22094-19) switch_to_client_time 480 s, smtp response sent
Oct 13 11:58:34 mailserver amavis[22094]: (22094-19) idle_proc, 6: was busy, 1.5 ms, total idle 75.506 s, busy 12.210 s
Oct 13 11:58:34 mailserver amavis[22094]: (22094-19) idle_proc, 5: was idle, 0.3 ms, total idle 75.507 s, busy 12.210 s
Oct 13 11:58:34 mailserver amavis[22094]: (22094-19) ESMTP< MAIL FROM:<licheng@macrodata.com> SIZE=1906948\r\n
Oct 13 11:58:34 mailserver amavis[22094]: (22094-19) get_deadline switch_to_my_time(rx SMTP MAIL) - deadline in 480.0 s, set to 336.000 s
Oct 13 11:58:34 mailserver amavis[22094]: (22094-19) prolong_timer switch_to_my_time(rx SMTP MAIL): timer 336, was 480, deadline in 480.0 s
Oct 13 11:58:34 mailserver amavis[22094]: (22094-19) check_mail_begin_task: task_count=19
Oct 13 11:58:34 mailserver amavis[22094]: (22094-19) lookup_ip_acl (client_ipaddr_policy) arr.obj: key="10.131.0.149" matches "10.0.0.0/8", result=1
Oct 13 11:58:34 mailserver amavis[22094]: (22094-19) loaded policy bank "MYNETS"
Oct 13 11:58:34 mailserver amavis[22094]: (22094-19) lookup: (scalar) matches, result="1"
Oct 13 11:58:34 mailserver amavis[22094]: (22094-19) lookup [local_domains] => true,  "licheng@macrodata.com" matches, result="1", matching_key="(constant:1)"
Oct 13 11:58:34 mailserver amavis[22094]: (22094-19) query_keys: licheng@macrodata.com, licheng, @macrodata.com, @.macrodata.com, @.net, @.
Oct 13 11:58:34 mailserver amavis[22094]: (22094-19) lookup_sql sel_policy "licheng@macrodata.com", query args: [licheng@macrodata.com,-3], [licheng,-3], [@macrodata.com,-3], [@.macrodata.com,-3], [@.net,-3], [@.,-3]
Oct 13 11:58:34 mailserver amavis[22094]: (22094-19) lookup_sql select: SELECT users.*, policy.*, users.id FROM users LEFT JOIN policy ON users.policy_id=policy.id WHERE users.email IN (?,?,?,?,?,?) ORDER BY users.priority DESC
Oct 13 11:58:34 mailserver amavis[22094]: (22094-19) sql begin, nontransaction
Oct 13 11:58:34 mailserver amavis[22094]: (22094-19) sql: executing clause (6 args): SELECT users.*, policy.*, users.id FROM users LEFT JOIN policy ON users.policy_id=policy.id WHERE users.email IN (?,?,?,?,?,?) ORDER BY users.priority DESC
Oct 13 11:58:34 mailserver amavis[22094]: (22094-19) lookup_sql, "licheng@macrodata.com" no match
Oct 13 11:58:34 mailserver amavis[22094]: (22094-19) lookup_sql_field(local), "licheng@macrodata.com" no matching records
Oct 13 11:58:34 mailserver amavis[22094]: (22094-19) lookup: (scalar) matches, result="1"
Oct 13 11:58:34 mailserver amavis[22094]: (22094-19) lookup [local_domains] => true,  "licheng@macrodata.com" matches, result="1", matching_key="(constant:1)"
Oct 13 11:58:34 mailserver amavis[22094]: (22094-19) loaded policy bank "MYUSERS" over "MYNETS"
Oct 13 11:58:34 mailserver amavis[22094]: (22094-19) lookup [debug_sender] => undef, "licheng@macrodata.com" does not match
Oct 13 11:58:34 mailserver amavis[22094]: (22094-19) mesage size set to a declared size 1906948
Oct 13 11:58:34 mailserver amavis[22094]: (22094-19) ESMTP> 250 2.1.0 Sender <licheng@macrodata.com> OK
Oct 13 11:58:34 mailserver amavis[22094]: (22094-19) switch_to_client_time 480 s, smtp response sent
Oct 13 11:58:34 mailserver amavis[22094]: (22094-19) idle_proc, 6: was busy, 8.1 ms, total idle 75.507 s, busy 12.218 s
Oct 13 11:58:34 mailserver amavis[22094]: (22094-19) idle_proc, 5: was idle, 0.3 ms, total idle 75.507 s, busy 12.218 s
Oct 13 11:58:34 mailserver amavis[22094]: (22094-19) ESMTP< RCPT TO:<svbak@macrodata.com> NOTIFY=NEVER\r\n
Oct 13 11:58:34 mailserver amavis[22094]: (22094-19) get_deadline switch_to_my_time(rx SMTP RCPT) - deadline in 480.0 s, set to 336.000 s
Oct 13 11:58:34 mailserver amavis[22094]: (22094-19) prolong_timer switch_to_my_time(rx SMTP RCPT): timer 336, was 480, deadline in 480.0 s
Oct 13 11:58:34 mailserver amavis[22094]: (22094-19) lookup => undef, "svbak@macrodata.com", no lookup tables
Oct 13 11:58:34 mailserver amavis[22094]: (22094-19) lookup: (scalar) matches, result="1"
Oct 13 11:58:34 mailserver amavis[22094]: (22094-19) lookup [local_domains] => true,  "svbak@macrodata.com" matches, result="1", matching_key="(constant:1)"
Oct 13 11:58:34 mailserver amavis[22094]: (22094-19) query_keys: svbak@macrodata.com, svbak, @macrodata.com, @.macrodata.com, @.net, @.
Oct 13 11:58:34 mailserver amavis[22094]: (22094-19) lookup_sql sel_policy "svbak@macrodata.com", query args: [svbak@macrodata.com,-3], [svbak,-3], [@macrodata.com,-3], [@.macrodata.com,-3], [@.net,-3], [@.,-3]
Oct 13 11:58:34 mailserver amavis[22094]: (22094-19) lookup_sql select: SELECT users.*, policy.*, users.id FROM users LEFT JOIN policy ON users.policy_id=policy.id WHERE users.email IN (?,?,?,?,?,?) ORDER BY users.priority DESC
Oct 13 11:58:34 mailserver amavis[22094]: (22094-19) sql begin, nontransaction
Oct 13 11:58:34 mailserver amavis[22094]: (22094-19) sql: executing clause (6 args): SELECT users.*, policy.*, users.id FROM users LEFT JOIN policy ON users.policy_id=policy.id WHERE users.email IN (?,?,?,?,?,?) ORDER BY users.priority DESC
Oct 13 11:58:34 mailserver amavis[22094]: (22094-19) lookup_sql, "svbak@macrodata.com" no match
Oct 13 11:58:34 mailserver amavis[22094]: (22094-19) lookup_sql_field(message_size_limit), "svbak@macrodata.com" no matching records
Oct 13 11:58:34 mailserver amavis[22094]: (22094-19) lookup [message_size_limit] => undef, "svbak@macrodata.com" does not match
Oct 13 11:58:34 mailserver amavis[22094]: (22094-19) ESMTP> 250 2.1.5 Recipient <svbak@macrodata.com> OK
Oct 13 11:58:34 mailserver amavis[22094]: (22094-19) switch_to_client_time 480 s, smtp response sent
Oct 13 11:58:34 mailserver amavis[22094]: (22094-19) idle_proc, 6: was busy, 4.5 ms, total idle 75.507 s, busy 12.223 s
Oct 13 11:58:34 mailserver amavis[22094]: (22094-19) idle_proc, 6: was busy, 4.5 ms, total idle 75.507 s, busy 12.223 s
Oct 13 11:58:34 mailserver amavis[22094]: (22094-19) idle_proc, 5: was idle, 0.3 ms, total idle 75.507 s, busy 12.223 s
Oct 13 11:58:34 mailserver amavis[22094]: (22094-19) ESMTP< DATA\r\n
Oct 13 11:58:34 mailserver amavis[22094]: (22094-19) get_deadline switch_to_my_time(rx SMTP DATA) - deadline in 480.0 s, set to 336.000 s
Oct 13 11:58:34 mailserver amavis[22094]: (22094-19) prolong_timer switch_to_my_time(rx SMTP DATA): timer 336, was 480, deadline in 480.0 s
Oct 13 11:58:34 mailserver amavis[22094]: (22094-19) ESMTP:[127.0.0.1]:10024 /var/spool/amavisd/tmp/amavis-20161013T115706-22094-rhb0KtIT: <licheng@macrodata.com> -> <svbak@macrodata.com> SIZE=1906948 Received: from mailserver.macrodata.com ([127.0.0.1]) by localhost (mailserver.macrodata.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP for <svbak@macrodata.com>; Thu, 13 Oct 2016 11:58:34 +0800 (CST)
Oct 13 11:58:34 mailserver amavis[22094]: (22094-19) ESMTP> 354 End data with <CR><LF>.<CR><LF>
Oct 13 11:58:34 mailserver amavis[22094]: (22094-19) switch_to_client_time 480 s, smtp response sent
Oct 13 11:58:34 mailserver amavis[22094]: (22094-19) switch_to_client_time 480 s, receiving data
Oct 13 11:58:34 mailserver amavis[22094]: (22094-19) smtp copy: read 65536 bytes into buffer, new size: 65536
Oct 13 11:58:34 mailserver amavis[22094]: (22094-19) smtp copy: read 65536 bytes into buffer, new size: 65536
Oct 13 11:58:34 mailserver amavis[22094]: (22094-19) smtp copy: read 65536 bytes into buffer, new size: 65536
Oct 13 11:58:34 mailserver amavis[22094]: (22094-19) smtp copy: read 65536 bytes into buffer, new size: 65536
Oct 13 11:58:34 mailserver amavis[22094]: (22094-19) smtp copy: read 65536 bytes into buffer, new size: 65536
Oct 13 11:58:34 mailserver amavis[22094]: (22094-19) smtp copy: read 65536 bytes into buffer, new size: 65537
Oct 13 11:58:34 mailserver amavis[22094]: (22094-19) smtp copy: read 65536 bytes into buffer, new size: 65536
Oct 13 11:58:34 mailserver amavis[22094]: (22094-19) smtp copy: read 65536 bytes into buffer, new size: 65536
Oct 13 11:58:34 mailserver amavis[22094]: (22094-19) smtp copy: read 65536 bytes into buffer, new size: 65536
Oct 13 11:58:34 mailserver amavis[22094]: (22094-19) smtp copy: read 65536 bytes into buffer, new size: 65536
Oct 13 11:58:34 mailserver amavis[22094]: (22094-19) smtp copy: read 65536 bytes into buffer, new size: 65536
Oct 13 11:58:34 mailserver amavis[22094]: (22094-19) smtp copy: read 65536 bytes into buffer, new size: 65536
Oct 13 11:58:34 mailserver amavis[22094]: (22094-19) smtp copy: read 65536 bytes into buffer, new size: 65536
Oct 13 11:58:34 mailserver amavis[22094]: (22094-19) smtp copy: read 65536 bytes into buffer, new size: 65536
Oct 13 11:58:34 mailserver amavis[22094]: (22094-19) smtp copy: read 65536 bytes into buffer, new size: 65536
Oct 13 11:58:34 mailserver amavis[22094]: (22094-19) smtp copy: read 65536 bytes into buffer, new size: 65536
Oct 13 11:58:34 mailserver amavis[22094]: (22094-19) smtp copy: read 65536 bytes into buffer, new size: 65536
Oct 13 11:58:34 mailserver amavis[22094]: (22094-19) smtp copy: read 65536 bytes into buffer, new size: 65536
Oct 13 11:58:34 mailserver amavis[22094]: (22094-19) smtp copy: read 65536 bytes into buffer, new size: 65536
Oct 13 11:58:34 mailserver amavis[22094]: (22094-19) smtp copy: read 65536 bytes into buffer, new size: 65536
Oct 13 11:58:34 mailserver amavis[22094]: (22094-19) smtp copy: read 65536 bytes into buffer, new size: 65536
Oct 13 11:58:34 mailserver amavis[22094]: (22094-19) smtp copy: read 65536 bytes into buffer, new size: 65536
Oct 13 11:58:34 mailserver amavis[22094]: (22094-19) smtp copy: read 65536 bytes into buffer, new size: 65536
Oct 13 11:58:34 mailserver amavis[22094]: (22094-19) smtp copy: read 65536 bytes into buffer, new size: 65536
Oct 13 11:58:34 mailserver amavis[22094]: (22094-19) smtp copy: read 65536 bytes into buffer, new size: 65536
Oct 13 11:58:34 mailserver amavis[22094]: (22094-19) smtp copy: read 65536 bytes into buffer, new size: 65536
Oct 13 11:58:34 mailserver amavis[22094]: (22094-19) smtp copy: read 65536 bytes into buffer, new size: 65536
Oct 13 11:58:34 mailserver amavis[22094]: (22094-19) smtp copy: read 65536 bytes into buffer, new size: 65536
Oct 13 11:58:34 mailserver amavis[22094]: (22094-19) smtp copy: read 65536 bytes into buffer, new size: 65536
Oct 13 11:58:34 mailserver amavis[22094]: (22094-19) smtp copy: read 6415 bytes into buffer, new size: 6415
Oct 13 11:58:34 mailserver amavis[22094]: (22094-19) smtp copy: 6 bytes still buffered at end
Oct 13 11:58:34 mailserver amavis[22094]: (22094-19) get_deadline switch_to_my_time(rx data-end) - deadline in 480.0 s, set to 336.000 s
Oct 13 11:58:34 mailserver amavis[22094]: (22094-19) prolong_timer switch_to_my_time(rx data-end): timer 336, was 480, deadline in 480.0 s
Oct 13 11:58:34 mailserver amavis[22094]: (22094-19) ESMTP< .<CR><LF>
Oct 13 11:58:34 mailserver amavis[22094]: (22094-19) Actual message size 1906950 B greater than the declared 1906948 B
Oct 13 11:58:34 mailserver amavis[22094]: (22094-19) smtp connection cache, dt: 10.5, state: 1
Oct 13 11:58:34 mailserver amavis[22094]: (22094-19) get_deadline get_body_digest - deadline in 480.0 s, set to 30.000 s
Oct 13 11:58:34 mailserver amavis[22094]: (22094-19) get_deadline digest_pre - deadline in 480.0 s, set to 336.000 s
Oct 13 11:58:34 mailserver amavis[22094]: (22094-19) prolong_timer digest_pre: timer 336, was 336, deadline in 480.0 s
Oct 13 11:58:34 mailserver amavis[22094]: (22094-19) get_body_digest: reading header section from a file
Oct 13 11:58:34 mailserver amavis[22094]: (22094-19) get_body_digest: sending h/b separator to DKIM
Oct 13 11:58:34 mailserver amavis[22094]: (22094-19) get_deadline digest_hdr - deadline in 480.0 s, set to 336.000 s
Oct 13 11:58:34 mailserver amavis[22094]: (22094-19) prolong_timer digest_hdr: timer 336, was 336, deadline in 480.0 s
====
张工,你好!
之前因反垃圾邮件和反病毒功能影响邮件发送效率,后来我停用了该功能。但后来因需要,重新启用反垃圾邮件功能(未启用反病毒功能)并做了小部分的调整。但是从效果上看感觉并没有起到反垃圾的作用。下面是我做的一些调整,麻烦张工帮我分析下对不对。
1.    修改配置文件main.cf
# 启动邮件内容过滤器,去掉以下参数前的注释
content_filter = smtp-amavis:[127.0.0.1]:10024
2.    修改配置文件amavisd.conf
# 取消病毒扫描功能,去掉以下参数前的注释
@bypass_virus_checks_maps = (1);  # controls running of anti-virus code
# 取消对macrodata.com域名发起邮件的扫描,新增以下参数
$policy_bank{'ORIGINATING'} = {

# 20161010
  # don't perform spam/virus/header check.
  bypass_spam_checks_maps => [1],
  bypass_virus_checks_maps => [1],
  bypass_header_checks_maps => [1],

  bypass_banned_checks_maps => [1],  # allow sending any file names and types

}
# 取消对我司邮件客户端发起邮件的扫描,去掉以下参数前的注释
$policy_bank{'MYUSERS'} = {

    # don't perform spam/virus/header check.
    bypass_spam_checks_maps => [1],
    bypass_virus_checks_maps => [1],
    bypass_header_checks_maps => [1],
   
# allow sending any file names and types
bypass_banned_checks_maps => [1],
     …
     }
3.    启动扫描相关服务
chkconfig clamd.amavisd on
chkconfig spamassassin on
4.    重启服务
/etc/init.d/clamd.amavisd start
/etc/init.d/spamassassin start
/etc/init.d/amavisd restart
postfix reload

回复: 启用反垃圾邮件功能,从效果来看没有生效

叶嘉文 写道:

$policy_bank{'ORIGINATING'} = {

# 20161010
  # don't perform spam/virus/header check.
  bypass_spam_checks_maps => [1],
  bypass_virus_checks_maps => [1],
  bypass_header_checks_maps => [1],
  bypass_banned_checks_maps => [1],  # allow sending any file names and types

}

这里的几个 bypass_ 就表示禁用垃圾扫描了。你应该把它们都注释掉。
另外,新版本的 iRedMail 里已经不使用 $policy_bank{'MYUSERS'} 了。

回复: 启用反垃圾邮件功能,从效果来看没有生效

我现在主要是希望邮件系统不要对我的域名发起的邮件进行扫描,所以参考了这篇文章(http://www.iredmail.com/docs/disable.spam.virus.scanning.for.outgoing.mails.html)做了配置。
按张工的意思说,
1.0.9.0版本里在$policy_bank{'MYUSERS'}配置什么都是无效的;
2.为了提高发件速度,禁止对我的域名发起的邮件进行扫描的话,那我应该怎么配置呢?

回复: 启用反垃圾邮件功能,从效果来看没有生效

你不觉得这里有矛盾么?你配置了不扫描,那 spamassassin 对于你外发的邮件当然就不生效了。

iRedMail 这两年发布的版本里都不用 $policy_bank{'MYUSERS'} 了。如果你配置了,还是会生效的。它包含 $policy_bank{'ORIGINATING'} 和 $policy_bank{'MYNETS'}。重复了,所以就不用了。

回复: 启用反垃圾邮件功能,从效果来看没有生效

我只是希望反垃圾邮件功能能够区别扫描邮件,对于自己域名发件人发邮件给其他域名时不过滤,但对于其他域名发件人发送给我域名的邮件能够进行过滤。

回复: 启用反垃圾邮件功能,从效果来看没有生效

对于收到的邮件,上面的配置是没问题的,会进行扫描。你可以按照这个文档设置一下 amavisd,从更详细的 log 里检查它是否有在运行:
http://www.iredmail.com/docs/no.x-spam.headers.html

回复: 启用反垃圾邮件功能,从效果来看没有生效

ZhangHuangbin 写道:

对于收到的邮件,上面的配置是没问题的,会进行扫描。你可以按照这个文档设置一下 amavisd,从更详细的 log 里检查它是否有在运行:
http://www.iredmail.com/docs/no.x-spam.headers.html

张工,我注释了$policy_bank{'MYUSERS'} 中的配置,反垃圾邮件功能已经生效。但是并没有按我预期的对自己域名不进行扫描方式生效。用户发邮件时全部都通过amavisd进行扫描。严重影响了邮件收发效率。
不知道对于反垃圾邮件这部分功能该如何进行优化,请张工给点建议。谢谢!

回复: 启用反垃圾邮件功能,从效果来看没有生效

iRedMail-0.9.0 还没有对收到的和发出的信做具体区分,你需要这样调整一下:

*) 确保 Amavisd 的 "$inet_socket_port" 参数里有 10024, 10026, 9998 三个端口。

$inet_socket_port = [10024, 10026, 9998];

*) 在 /etc/postfix/master.cf 里,确保 submission 使用 10026 端口作为内容过滤:

submission ...
    ...
  -o content_filter=smtp-amavis:[127.0.0.1]:10026

这样就ok了。这部分修改在 iRedMail-0.9.3 的升级文档里有提及:
http://www.iredmail.com/docs/upgrade.ir … ernal-user

回复: 启用反垃圾邮件功能,从效果来看没有生效

张工,您好!
我已经根据您提供的文章修复bug,但是即使配置$policy_bank{'ORIGINATING'} = {},只过滤外部邮件。目前效果上也还是严重影响邮件发送效率。不知道张工有没有其他高效的反垃圾邮件的方法。请告知,谢谢!

回复: 启用反垃圾邮件功能,从效果来看没有生效

我似乎没搞懂你到底要达到怎样的一个效果,可否重新列一下你的各个要求?

回复: 启用反垃圾邮件功能,从效果来看没有生效

启用反垃圾邮件功能,过滤垃圾邮件,但因之前反垃圾反病毒功能影响邮件发件效率,因此希望能高效实现反垃圾功能,具体要求如下:
1.启用反垃圾邮件功能,无需启用反病毒功能;
==》已做调整:
# 取消病毒扫描功能,去掉以下参数前的注释,以下参数是amavisd.conf中的全局变量
@bypass_virus_checks_maps = (1);  # controls running of anti-virus code
2.限制仅扫描外部邮件;
==》已做调整:
a).参考文章http://www.iredmail.com/docs/disable.spam.virus.scanning.for.outgoing.mails.html以达到仅扫描来自外部邮件的功能。
b).参考文章http://www.iredmail.com/docs/upgrade.iredmail.0.9.2-0.9.3.html#amavisd-fix-incorrect-setting-which-treats-external-sender-as-internal-修复amavisd不区分外部用户bug。
做了以上变更后,邮件服务器发件效率仍然很低,很多发送请求均阻塞在邮件队列中,过很久才能完成发送。现在又关闭了邮件反垃圾邮件功能,希望寻求更高效的反垃圾解决方案。

回复: 启用反垃圾邮件功能,从效果来看没有生效

*) 发件效率,在 Amavisd 的 policy bank 'ORIGINATING' 中关闭病毒、垃圾邮件、bad-header等扫描后应该是很快的。贴一下你的 amavisd 里这部分的设置,以及贴一下 /etc/postfix/master.cf 里 submission 的设置。

*) 发送邮件是用 submission(587端口+TLS)吧?

*) 服务器有多少GB内存?参考一下这篇:
http://www.iredmail.com/docs/concurrent.processing.html

另外,还需要分析为何阻塞,再来解决。现在说的只是一些通用的提升效率的办法和调整。

回复: 启用反垃圾邮件功能,从效果来看没有生效

发送邮件是用(587端口+TLS),服务器本身有30G的内存
下面是配置文件中的部分配置信息
master.cf
# 20161028 Fix incorrect setting which treats external sender as internal user
submission inet n       -       n       -       -       smtpd
  -o smtpd_tls_security_level=encrypt
  -o smtpd_sasl_auth_enable=yes
  -o smtpd_client_restrictions=permit_mynetworks,permit_sasl_authenticated,reject
  -o content_filter=smtp-amavis:[127.0.0.1]:10026

# Use dovecot deliver program as LDA.
dovecot unix    -       n       n       -       -      pipe
    flags=DRhu user=vmail:vmail argv=/usr/libexec/dovecot/deliver -f ${sender} -d ${user}@${domain} -m ${extension}

smtp-amavis unix -  -   -   -   4  smtp
    -o smtp_data_done_timeout=1200
    -o smtp_send_xforward_command=yes
    -o disable_dns_lookups=yes
    -o max_use=20
   
amavisd.conf

...

# COMMONLY ADJUSTED SETTINGS:
# 20161012
@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;            # 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

...

$policy_bank{'ORIGINATING'} = {  # mail supposedly originating from our users
  originating => 1,  # declare that mail was submitted by our smtp client
  allow_disclaimers => 1,  # enables disclaimer insertion if available
  # notify administrator of locally originating malware
  virus_admin_maps => ["virusalert\@$mydomain"],
  spam_admin_maps  => ["virusalert\@$mydomain"],
  warnbadhsender   => 1,
  # forward to a smtpd service providing DKIM signing service
  # 20161028 Fix incorrect setting which treats external sender as internal user
  # forward_method => 'smtp:[127.0.0.1]:10027',

  # force MTA conversion to 7-bit (e.g. before DKIM signing)
  smtpd_discard_ehlo_keywords => ['8BITMIME'],

  # 20161012
  # don't perform spam/virus/header check.
  bypass_spam_checks_maps => [1],
  bypass_virus_checks_maps => [1],
  bypass_header_checks_maps => [1],

  bypass_banned_checks_maps => [1],  # allow sending any file names and types
  terminate_dsn_on_notify_success => 0,  # don't remove NOTIFY=SUCCESS option
};

...

关于阻塞分析具体需要怎么做,还请张工指教。

回复: 启用反垃圾邮件功能,从效果来看没有生效

服务器30GB内存,参考下面文档,将并发处理邮件数量调高到30封:
http://www.iredmail.com/docs/concurrent.processing.html

贴的 amavisd/postfix 配置没问题。

回复: 启用反垃圾邮件功能,从效果来看没有生效

张工,我已经根据你给的参考文档里调整了。调整后队列里堵了很多其他域发来的邮件(大部分应该是垃圾邮件),但这也同时影响了部分自己域发的邮件堵在队列里。我想了解下这个邮件在队列里的处理原理,因为我前面是做了自己域发的邮件不做过滤的策略,队列中是不是会优先处理自己域发的邮件,还是根据max_server数量并行按照队列顺序一个个处理。

回复: 启用反垃圾邮件功能,从效果来看没有生效

你的发件频率是多少(例如大概1分钟几封)?为何会有那么多邮件进来?

回复: 启用反垃圾邮件功能,从效果来看没有生效

这个是一天的发件量
messages

  33856   received
  68043   delivered
    149   forwarded
    215   deferred  (602  deferrals)
    599   bounced
   1020   rejected (1%)
      0   reject warnings
      0   held
      0   discarded (0%)

目前部分垃圾邮件已经标识出来,并打上SPAM的标签。但是垃圾邮件并没有进入垃圾邮箱,是因为现在的垃圾邮件机制就是打上标签而不进入垃圾邮箱吗?

回复: 启用反垃圾邮件功能,从效果来看没有生效

叶嘉文 写道:

这个是一天的发件量
messages

  33856   received
  68043   delivered
    149   forwarded
    215   deferred  (602  deferrals)
    599   bounced
   1020   rejected (1%)
      0   reject warnings
      0   held
      0   discarded (0%)

目前部分垃圾邮件已经标识出来,并打上SPAM的标签。但是垃圾邮件并没有进入垃圾邮箱,是因为现在的垃圾邮件机制就是打上标签而不进入垃圾邮箱吗?

这是垃圾邮件是标记,但并没有进入垃圾邮箱
X-Spam-Flag: YES
X-Spam-Score: 7.488
X-Spam-Level: *******
X-Spam-Status: Yes, score=7.488 tagged_above=2 required=6.2
    tests=[BAYES_99=3.5, BAYES_999=0.2, HTML_FONT_FACE_BAD=0.981,
    HTML_MESSAGE=0.001, NO_RDNS_DOTCOM_HELO=0.823,
    RCVD_FAKE_HELO_DOTCOM=1.189, RDNS_NONE=0.793, URIBL_BLOCKED=0.001]
    autolearn=no

回复: 启用反垃圾邮件功能,从效果来看没有生效

投递到垃圾箱是由全局或个人的 sieve 过滤规则决定的。

iRedMail 在 dovecot.conf 里使用 sieve_before 参数定义全局 sieve 规则的文件路径。用户个人的可以在 webmail 里定义。