問題
如何測試郵件或內容過濾器以確保其運行正常?
可以通過調試過濾器來測試過濾器以確保它們正常工作。調試過濾器是一個需要系統隔離區的兩步過程。
在GUI中建立名為「FilterDebug」的新系統隔離區。 隔離區在「監控」 — >「隔離」下配置。 如果您有一些可用的隔離區,請按一下「新增隔離區」按鈕以配置FilterDebug隔離區。 如果沒有足夠的可用空間,您必須編輯其他隔離區,然後減少隔離區用來釋放一些可用空間的空間。
使用預期使用的規則(匹配條件)建立過濾器並將操作設定為「Quarantine('FilterDebug')」。
要調試匹配規則,請在相應的郵件策略(您希望其在生產中運行的位置)上啟用過濾器並生成流量。
與您的規則匹配的郵件將進入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中,報文正文和標題分別處理。如果您在應用操作後檢查隔離區中的郵件,將不會看到對郵件執行任何標題操作(但會在傳遞時完成)。這是因為郵件在管道中傳輸時,標題處理是單獨並行完成的。 郵件在傳送前與其(可能修改的)標頭重新統一,但在隔離區中看不到此郵件。 您將在隔離區中看到對郵件正文所做的任何更改,例如刪除附件或標籤頁尾。