问题
如何测试邮件或内容过滤器以确保其按设计工作?
通过调试过滤器,可以测试过滤器以确保其正常工作。调试过滤器是一个两步过程,需要一个系统隔离区。
在GUI中创建名为“FilterDebug”的新系统隔离区。隔离区在“监控”(Monitor)->“隔离区”(Quarantines)下配置。 如果您有一些可用的隔离空间,请点击“添加隔离区”(Add Quarantines)按钮以配置FilterDebug隔离区。 如果没有足够的可用空间,则必须编辑其他隔离区,并减小它用于提供一些可用空间的空间。
使用预期使用的规则(匹配条件)创建过滤器,并将操作设置为“Quarantine('FilterDebug')”。
要调试匹配的规则,请启用相应的邮件策略(您打算在生产中运行该策略的位置)上的过滤器并生成流量。
与规则匹配的邮件将进入过滤器调试隔离区,您可以在其中检查这些邮件并满足自己的要求,即您的规则与您想要的邮件完全匹配。 从隔离区中放行这些邮件,它们将正常传送。 如果您想观察一段时间,请将隔离区保留期设置为可接受的短时间,并定期检查隔离区,查看符合条件的邮件类型。
要调试过滤器操作,请创建一个只有一个测试收件人的新邮件策略。在所有其他邮件策略中禁用规则,并在新的邮件策略中启用规则。 编辑规则以采取所需的操作。 您可以删除隔离规则。
生成流量并在邮件传送(或不传送,取决于您的过滤器)到测试收件人时进行检查,以验证是否达到了您的要求。现在,您可以在邮件策略中为生产部署启用已完成的规则,并从测试收件人策略中将其禁用。
类似的过程可用于调试消息过滤器。 首先构建要在生产中使用的标准:
RedirectEarningsReports:
if (recv-listener == "InboundMail")
and (subject == "(?i)quarterly earnings") {
quarantine ("FilterDebug");
}
此操作在CLI中完成:
smtp.example.com>filters
Choose the operation you want to perform:
- NEW - Create a new filter.
- DELETE - Remove a filter.
- IMPORT - Import a filter script from a file.
- EXPORT - Export filters to a file
- MOVE - Move a filter to a different position.
- SET - Set a filter attribute.
- LIST - List the filters.
- DETAIL - Get detailed information on the filters.
- LOGCONFIG - Configure log subscriptions used by filters.
- ROLLOVERNOW - Roll over a filter log file.
[]> new
Enter filter script. Enter '.' on its own line to end.
RedirectEarningsReports:
if (recv-listener == "InboundMail")
and (subject == "(?i)quarterly earnings") {
quarantine ("FilterDebug");
}
.
1 filters added.
Choose the operation you want to perform:
- NEW - Create a new filter.
- DELETE - Remove a filter.
- IMPORT - Import a filter script from a file.
- EXPORT - Export filters to a file
- MOVE - Move a filter to a different position.
- SET - Set a filter attribute.
- LIST - List the filters.
- DETAIL - Get detailed information on the filters.
- LOGCONFIG - Configure log subscriptions used by filters.
- ROLLOVERNOW - Roll over a filter log file.
[]>
smtp.example.com >commit
Please enter some comments describing your changes:
[]> add RedirectEarningsReports filter test actions (incomplete)
Changes committed: Wed Nov 24 12:00:10 2004 MST
使用GUI检查隔离的邮件并放行邮件。 继续以这种方式观看消息流,直到您满意。 接下来,将测试接收人添加到规则,并将操作更改为要在生产中运行的操作:
RedirectEarningsReports:
if (recv-listener == "InboundMail")
and (subject == "(?i)quarterly earnings")
and (rcpt-to == "(?i)alan@exchange\\.scu\\.com$") {
alt-rcpt-to ("sam@exchange.scu.com");
}
在CLI中,您需要删除并重新创建过滤器:
smtp.example.com> filters
Choose the operation you want to perform:
- NEW - Create a new filter.
- DELETE - Remove a filter.
- IMPORT - Import a filter script from a file.
- EXPORT - Export filters to a file
- MOVE - Move a filter to a different position.
- SET - Set a filter attribute.
- LIST - List the filters.
- DETAIL - Get detailed information on the filters.
- LOGCONFIG - Configure log subscriptions used by filters.
- ROLLOVERNOW - Roll over a filter log file.
[]> list
Num Active Valid Name
1 N Y betatest
2 N Y StripInboundExes
3 Y Y RedirectEarningsReports
Choose the operation you want to perform:
- NEW - Create a new filter.
- DELETE - Remove a filter.
- IMPORT - Import a filter script from a file.
- EXPORT - Export filters to a file
- MOVE - Move a filter to a different position.
- SET - Set a filter attribute.
- LIST - List the filters.
- DETAIL - Get detailed information on the filters.
- LOGCONFIG - Configure log subscriptions used by filters.
- ROLLOVERNOW - Roll over a filter log file.
[]> delete
Enter the filter name, number, or range:
[]> 3
1 filters deleted.
Choose the operation you want to perform:
- NEW - Create a new filter.
- DELETE - Remove a filter.
- IMPORT - Import a filter script from a file.
- EXPORT - Export filters to a file
- MOVE - Move a filter to a different position.
- SET - Set a filter attribute.
- LIST - List the filters.
- DETAIL - Get detailed information on the filters.
- LOGCONFIG - Configure log subscriptions used by filters.
- ROLLOVERNOW - Roll over a filter log file.
[]> new
Enter filter script. Enter '.' on its own line to end.
RedirectEarningsReports:
if (recv-listener == "InboundMail")
and (subject == "(?i)quarterly earnings")
and (rcpt-to == "(?i)alan@exchange\\.scu\\.com$") {
alt-rcpt-to ("sam@exchange.scu.com");
}
.
1 filters added.
Choose the operation you want to perform:
- NEW - Create a new filter.
- DELETE - Remove a filter.
- IMPORT - Import a filter script from a file.
- EXPORT - Export filters to a file
- MOVE - Move a filter to a different position.
- SET - Set a filter attribute.
- LIST - List the filters.
- DETAIL - Get detailed information on the filters.
- LOGCONFIG - Configure log subscriptions used by filters.
- ROLLOVERNOW - Roll over a filter log file.
[]>
smtp.example.com> commit
Please enter some comments describing your changes:
[]> set RedirectEarningsReports to test recipient
Changes committed: Wed Nov 24 12:10:07 2004 MST
确认操作符合您的要求。 (根据您的过滤器,您还可以验证mail_logs中的某些操作。) 最后,通过删除测试收件人将最终过滤器放在一起:
RedirectEarningsReports:
if (recv-listener == "InboundMail")
and (subject == "(?i)quarterly earnings") {
alt-rcpt-to ("sam@exchange.scu.com");
}
过滤器和隔离区的一个潜在令人困惑的方面是处理邮件正文与邮件信头。 在ESA中,邮件正文和信头将分别处理。如果在应用操作后检查隔离区中的邮件,您不会看到对邮件执行任何信头操作(但会在传送时完成)。 这是因为报头处理是单独并行完成的,因为消息会在管道中推进。 邮件在传送前与其(可能修改的)信头重新统一,但在隔离区中看不到该邮件。 您将在隔离区中看到对邮件正文的任何更改,例如删除附件或标记页脚。