メールに添付されているファイル名は、ディフォルトではMail logsに記録されません。Message FilterやContent Filterで、メッセージのボディや添付ファイルの情報をチェックするような設定があると、そのFilterでスキャンされたメッセージのファイル名が記録されるようになります。
例えば、特定のファイル名の添付ファイルをドロップする以下のような設定があると、Message Filterが添付ファイルをスキャンするようになり、ファイル名がログに出力されます。
[Message Filterの例]
Example1:
if (attachment-filename == 'test\\.pdf') {
log-entry("Dropped by filter matched");
drop();
}
[Mailログの出力例]
Info: Start MID 205 ICID 108
Info: MID 205 ICID 108 From: <test@example.local>
Info: MID 205 ICID 108 RID 0 To: <test@example.local>
Info: MID 205 Message-ID '<5bc0186b-e67c-50a1-b50e-6f77629d27e6@example.local>'
Info: MID 205 Subject 'message filter'
Info: MID 205 ready 1689 bytes from <test@example.local>
Info: MID 205 attachment '=E3=83=86=E3=82=B9=E3=83=88.txt'
Info: MID 205 attachment 'attachment1.txt'
Info: MID 205 attachment 'attachment2.txt'
Info: MID 205 matched all recipients for per-recipient policy DEFAULT in the inbound table
Info: MID 205 interim verdict using engine: CASE spam negative
Info: MID 205 using engine: CASE spam negative
Info: MID 205 interim AV verdict using Sophos CLEAN
Info: MID 205 antivirus negative
Info: MID 205 AMP file reputation verdict : UNKNOWN
Info: MID 205 queued for delivery
(日本語のファイル名はエンコードされた形で出力されます)
添付ファイルをチェックする設定には以下のようなものがあります。
attachment-filename
attachment-type
attachment-filetype
attachment-mimetype
attachment-unprotected
attachment-contains
attachment-binary-contains
attachment-dictionary-match
attachment-size
every-attachment-contains
drop-attachments-by-name
drop-attachments-by-type
drop-attachments-by-filetype
drop-attachments-by-mimetype
drop-attachments-by-size
drop-attachments-where-contains
drop-attachments-where-dictionary-match
only-body-contains
body-contains
body-dictionary-match
dictionary-match
$filesizes
$filetypes
ファイル名を出力するためのアクション変数 $filenamesも別途用意されています。
[Message Filterの例]
Example2:
if (true)
{
log-entry('$filenames');
}
[Mailログの出力例]
Info: Start MID 206 ICID 109
Info: MID 206 ICID 109 From: <test@example.local>
Info: MID 206 ICID 109 RID 0 To: <test@example.local>
Info: MID 206 Message-ID '<2c97a884-05ba-16cb-3825-933b3bf6dba5@example.local>'
Info: MID 206 Subject 'test mail'
Info: MID 206 ready 1686 bytes from <test@example.local>
Info: MID 206 Custom Log Entry: \xe3\x83\x86\xe3\x82\xb9\xe3\x83\x88.txt, attachment1.txt, attachment2.txt
Info: MID 206 matched all recipients for per-recipient policy DEFAULT in the inbound table
Info: MID 206 interim verdict using engine: CASE spam negative
Info: MID 206 using engine: CASE spam negative
Info: MID 206 interim AV verdict using Sophos CLEAN
Info: MID 206 antivirus negative
Info: MID 206 queued for delivery
上記のMessge Filterの例では、spamやantivirusで処理される前にファイル名の出力がありましたが、Content Filterで同じようなファイルをスキャンする設定をした場合には、spamやantivirusの後にファイル名が出力されることになります。
Info: Start MID 212 ICID 115
Info: MID 212 ICID 115 From: <test@example.local>
Info: MID 212 ICID 115 RID 0 To: <test@example.local>
Info: MID 212 Message-ID '<f60e74f1-ac47-17cc-a287-354213bfd0ae@example.local>'
Info: MID 212 Subject 'test'
Info: MID 212 ready 1480 bytes from <test@example.local>
Info: MID 212 matched all recipients for per-recipient policy DEFAULT in the inbound table
Info: MID 212 interim verdict using engine: CASE spam negative
Info: MID 212 using engine: CASE spam negative
Info: MID 212 interim AV verdict using Sophos CLEAN
Info: MID 212 antivirus negative
Info: MID 212 attachment '=E3=83=86=E3=82=B9=E3=83=88.txt'
Info: MID 212 attachment 'attachment2.txt'
Info: MID 212 attachment 'attachment1.txt'
Info: MID 212 queued for delivery
ログが出力される前に、メッセージや添付ファイルがドロップされた場合には、添付ファイル名は記録されません。
Info: Start MID 213 ICID 116
Info: MID 213 ICID 116 From: <test@example.local>
Info: MID 213 ICID 116 RID 0 To: <test@example.local>
Info: MID 213 Message-ID '<b0448d6e-3322-87a6-28c6-8ae1c98a332d@example.local>'
Info: MID 213 Subject 'test'
Info: MID 213 ready 1762 bytes from <test@example.local>
Info: MID 213 matched all recipients for per-recipient policy DEFAULT in the inbound table
Info: MID 213 interim verdict using engine: CASE spam negative
Info: MID 213 using engine: CASE spam negative
Info: MID 213 interim AV verdict using Sophos VIRAL
Info: MID 213 antivirus positive 'EICAR-AV-Test'
Info: Message aborted MID 213 Dropped by antivirus
本件の記事はAsyncOS13.5.2-036の動作を基に作成しています。バージョンにより動作が異なる場合があります。
参考:
メッセージフィルターの設定方法
https://community.cisco.com/t5/-/-/ta-p/3161687