NAME
Mail::MIMEDefang::Antivirus - Antivirus interface methods for email filters
DESCRIPTION
Mail::MIMEDefang::Antivirus are a set of methods that can be called from mimedefang-filter to scan with installed antivirus software the email message.
The message_contains_virus* methods scan the Work directory, which normally contains only the unpacked, decoded parts of the message. To have the original, undecoded message scanned as well, call md_copy_orig_msg_to_work_dir_as_mbox_file (see Mail::MIMEDefang::Utils) before calling message_contains_virus or any message_contains_virus_* method. It copies the message into the Work directory as a UNIX-style mbox file, which some scanners (such as ClamAV) need in order to recognise it as an e-mail message.
sub filter_end {
my ($entity) = @_;
md_copy_orig_msg_to_work_dir_as_mbox_file();
my ($code, $category, $action) = message_contains_virus();
...
}
Scanner support is loaded on demand. This module only holds the dispatch logic and the list of known scanners; the code that talks to each scanner lives in the submodules listed below, and is compiled the first time that scanner is initialized or used. The original function names (message_contains_virus_clamd, interpret_nai_code, ...) are still provided by this module, so filters do not need to change.
Scanner modules
- Mail::MIMEDefang::Antivirus::ClamAV
-
ClamAV (clamd, clamdscan and clamscan).
- Mail::MIMEDefang::Antivirus::NAI
-
NAI/McAfee (now Trellix) uvscan.
Legacy scanners:
- Mail::MIMEDefang::Antivirus::Legacy::BDC
-
Bitdefender bdc.
- Mail::MIMEDefang::Antivirus::Legacy::CarrierScan
-
Symantec CarrierScan.
- Mail::MIMEDefang::Antivirus::Legacy::CSAV
-
Command Anti-Virus (csav).
- Mail::MIMEDefang::Antivirus::Legacy::FProt
-
F-Prot (f-prot, fpscan, fprotd and fprotd v6).
- Mail::MIMEDefang::Antivirus::Legacy::FSAV
-
F-Secure Anti-Virus (fsav).
- Mail::MIMEDefang::Antivirus::Legacy::HBEDV
-
H+BEDV AntiVir.
- Mail::MIMEDefang::Antivirus::Legacy::Kaspersky
-
Kaspersky (AvpLinux, aveclient and kavscanner).
- Mail::MIMEDefang::Antivirus::Legacy::NOD32
-
ESET NOD32 command-line scanner.
- Mail::MIMEDefang::Antivirus::Legacy::NVCC
-
Norman Virus Control (nvcc).
- Mail::MIMEDefang::Antivirus::Legacy::Sophos
-
Sophos (sweep, savscan and the Sophie daemon).
- Mail::MIMEDefang::Antivirus::Legacy::Trend
-
Trend Micro (Filescanner and the Trophie daemon).
- Mail::MIMEDefang::Antivirus::Legacy::Vexira
-
Central Command Vexira.
METHODS
- message_contains_virus
-
Method that scans a message using every installed virus scanner.
md_copy_orig_msg_to_work_dir_as_mbox_fileshould be called before this method so that the original message is scanned too (see "DESCRIPTION"). - entity_contains_virus
-
Method that scans a
MIME::Entitypart using every installed virus scanner. - initialize_virus_scanner_routines
-
Method that sets
@VirusScannerMessageRoutinesand@VirusScannerEntityRoutinesto arrays of virus-scanner routines to call, based on installed scanners. - run_virus_scanner
-
Method that runs a virus scanner, collecting output in
$VirusScannerMessages.