Qpsmtpd-Plugin-Quarantine
view release on metacpan or search on metacpan
lib/Qpsmtpd/Plugin/Quarantine/Common.pm view on Meta::CPAN
#
# Spam filtering
#
spamd3 => {
'spamc -R -d 127.0.0.1 <' => 100, # can use a farm of servers, value is load share weighting
},
accessio => '', # see http://www.miavia.com
clamd => '/usr/bin/clamdscan --stdout - <',
clamav => '/usr/local/bin/clamscan --stdout',
virus_content => qr/(?:application|name=.*\.(?:asd|bat|chm|cmd|com|cpl|dll|exe|hlp|hta|js|jse|lnk|ocx|pif|rar|scr|shb|shm|shs|vb|vbe|vbs|vbx|vxd|wsf|wsh|zip))/i,
subcommand_timeout => 150,
#
# Bounce message
#
senderbounce1 => 'Your message is quarantined because we think it is probably spam, if it is not spam, click',
senderbounce2 => 'to release your message from quarantine or to choose to have the spam you send silently deleted instead of bounced',
senderbounce3 => 'None of the recipients of your email wish to receive mail that is likely to be spam',
#
# Networks
lib/Qpsmtpd/Plugin/Quarantine/Spam.pm view on Meta::CPAN
{
my ($qp, $transaction, $r, $command, $input) = @_;
my $results;
my $file = $transaction->body_filename();
eval {
local($SIG{__DIE__}) = 'DEFAULT';
local($SIG{ALRM}) = sub {
$qp->log(LOGWARN, "ClamAV timeout");
die "timeout\n";
};
alarm($defaults{subcommand_timeout}) if $defaults{subcommand_timeout};
$results = `$command $file`;
};
unless ($results =~ /-- SCAN SUMMARY --/ && $results =~ /^\Q$input\E: (OK|.*FOUND)\n/) {
$qp->log(LOGINFO, "ClamAV failed: $results");
$r->{clamav} = undef;
return 0;
}
my $return = 0;
my $status = $1;
if ($status =~ /\n\n/) {
lib/Qpsmtpd/Plugin/Quarantine/Spam.pm view on Meta::CPAN
my ($qp, $transaction, $r, $command, $tag) = @_;
my $file = $transaction->body_filename();
$qp->log(LOGDEBUG, "running $command...");
my $results;
eval {
local($SIG{__DIE__}) = 'DEFAULT';
local($SIG{ALRM}) = sub {
$qp->log(LOGWARN, "TIMEOUT $command $file");
die "timeout\n";
};
alarm($defaults{subcommand_timeout}) if $defaults{subcommand_timeout};
$results = `$command $file`;
};
$results =~ m!^(-?\d+\.\d+)/(\d+\.\d+)\n!;
my ($score, $thresh) = ($1 || '', $2 || '');
unless ($thresh && $thresh > 0 && ($results =~ s/.*^[- ]{25,300}\n//sm)) {
$results = substr($results, 0, 30);
$results =~ s/\n/\\n/g;
$qp->log(LOGDEBUG, "'$command $file' failed $thresh: $results");
return '';
}
( run in 0.300 second using v1.01-cache-2.11-cpan-4d50c553e7e )