Call a script if virus / spam.
Richard Bishop
amavis-user at uchange.co.uk
Thu Nov 15 12:49:57 CET 2012
On Thu, 15 Nov 2012 10:58:33 +0000, Kaj Noppen <kaj at igilde.nl> wrote:
>
> I am looking for a way for Amavis to notify me in another way than
> email that spam has been sent from a particular email address.
>
> I have found the virus_admin_maps & spam_admin_maps, but this only
> allows me to put in an email address. I'd like to be able to call a
> script on the local machine, and pass the email or email variables to
> this script. Is something like this possible?
>
This is what Mark's fantastic custom hooks functions are for. You can
override parts of amavisd-new to execute your own code etc.
Below is part of a custom hook function that I wrote to get you
started. This only checks for virus infected mails, I'm sure you can
extend it to include spam mail too. Note that I'm not a Perl expert by
any means - I'm sure that you can improve upon the below if you are!
Save the code snippet below to custom.conf. Add a reference into
amavisd.conf so that it is loaded automatically:
include_config_files("/etc/amavis/custom.conf");
Also see here for more information:
http://lists.amavis.org/pipermail/amavis-users/2011-March/000124.html
HTH
Richard
-- custom.conf --
package Amavis::Custom;
use strict;
use DBI qw(:sql_types);
use DBD::mysql;
use File::Copy;
BEGIN {
import Amavis::Conf qw(:platform :confvars c cr ca $myhostname);
import Amavis::Util qw(do_log untaint safe_encode safe_decode);
}
sub new {
my($class,$conn,$msginfo) = @_;
my($self) = bless {}, $class;
$self;
}
# Override the mail_done custom hook
sub mail_done
{
my($self,$conn,$msginfo) = @_;
# If this message is infected
if($msginfo->virusnames)
{
}
}
-- SNIP --
More information about the amavis-users
mailing list