問題
如何測試郵件或內容過濾器以確保其按設計運行?
透過調試過濾器,可以測試過濾器以確保它們正常工作。調試過濾器是一個兩步過程,需要系統隔離區。
在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中,報文正文和報頭會分開處理。如果您在應用操作後檢查隔離區中的郵件,您不會看到對郵件執行了任何標題操作(但會在郵件送達時完成)。 這是因為報頭處理是在消息透過管線進行時單獨並行完成的。 郵件在傳遞之前與其(可能修改的)信頭重新統一,但在隔離區中看不到該郵件。 您將在隔離區中看到郵件正文的任何更改,如附件刪除或頁尾標籤。