NAME
Email::VirusScan - Unified interface for virus scanning of email messages
SYNOPSIS
my $scanner = Email::VirusScan->new({
engines => {
'ClamAV::Daemon' => {
socket_name => '/var/run/clamav/clamd.ctl',
},
'FSecure' => {
path => '/usr/local/bin/fsav
},
'FProtD' => {
host => '127.0.0.1',
port => 10200,
}
},
order => [ 'ClamAV::Daemon', 'FProtD', 'FSecure' ],
always_scan => 0,
});
my $mail = Email::Abstract->new( $some_mail_object );
my $result = $scanner->scan( $mail );
if( $result->is_clean ) {
return 'Happiness and puppies!';
} else {
return 'Oh noes! You've got ' . join(',' @{ $result->virus_names } );
}
DESCRIPTION
This class provides a common API for scanning email objects with one or more third party virus scanners.
Virus scanners are supported via pluggable engines under the Email::VirusScan::Engine namespace. At the time of this release, the following plugins are shipped with Email::VirusScan:
- Clam Antivirus
-
Scanning daemon via Email::VirusScan::Engine::ClamAV::Daemon, and commandline scanner via Email::VirusScan::Engine::ClamAV::Clamscan
- NAI UVScan
- F-Secure FSAV
- Trend Micro Vscan
- BitDefender BDC
- Command Antivirus
- Norman Antivirus
- ESET
-
Scanning via esets_cli with Email::VirusScan::Engine::ESET::NOD32
- Symantec
-
Scanning via Carrier Scan server with Email::VirusScan::Engine::Symantec::CSS
- F-PROT
-
Scanning daemon via Email::VirusScan::Engine::FPROT::Daemon, and commandline scanner via Email::VirusScan::Engine::FPROT::Command
- Central Command Vexira
- Sophos
-
Daemonized scanning using the Sophie daemon with Email::VirusScan::Engine::Sophos::Sophie. Commandline scanning with Email::VirusScan::Engine::Sophos::Sweep or Email::VirusScan::Engine::Sophos::Savscan
- Kaspersky
-
Scanning with aveserver using Email::VirusScan::Engine::Kaspersky::AVP5, or with kavscanner using Email::VirusScan::Engine::Kaspersky::Kavscanner
METHODS
new ( { config data } )
Creates a new Email::VirusScan object, using configuration data in the provided hashref.
Required configuration options are:
- engines
-
Reference to hash of backend virus scan engines to be used, and their specific configurations.
Keys must refer to a class that implements the Email::VirusScan::Engine interface, and may be specified as either:
A fully-qualified class name.
A name beginning with '-', in which case the '-' is removed and replaced with the Email::VirusScan::Engine:: prefix.
Values should be another hash reference containing engine-specific configuration. This will vary by backend, but generally requires at minimum some way of locating (socket path, host/port) or executing (path to executable) the scanner.
Optional configuration options are:
- order
-
List reference containing keys provided to engines above, in the order in which they should be called.
If omitted, backends will be invoked in hash key order.
- always_scan
-
By default, Email::VirusScan will stop scanning a message after one backend finds a virus. If you wish to run all backends anyway, set this option to a true value.
scan ( $mail_object )
Invokes the configured scan backends on an Email::Abstract object. Use this if you have a Perl representation of a mail message, and you trust your virus scanner to Do The Right Thing with a serialized representation of it.
Returns an Email::VirusScan::Result object, which can be queried for status.
scan_path ( $directory )
Invokes the configured scan backends on the contents of the directory. Use this if you have more than one message you wish to scan, or if you just plain don't trust your virus scanning engine to properly unpack a message and scan its subparts, and wish to do it yourself first.
Returns an Email::VirusScan::result object, which can be queried for status.
DEPENDENCIES
Email::Abstract, Email::VirusScan::Engine, Email::VirusScan::Result
AUTHOR
Dave O'Neill (dmo@roaringpenguin.com)
David Skoll (dfs@roaringpenguin.com>
LICENCE AND COPYRIGHT
Copyright (c) 2007 Roaring Penguin Software, Inc.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.