Temporary deny if clamd is not running
This commit is contained in:
parent
b3c5195b64
commit
52a1ba8deb
2
Changes
2
Changes
@ -1,4 +1,6 @@
|
|||||||
|
|
||||||
|
Temporary deny if clamd is not running
|
||||||
|
|
||||||
Modify plugins/virus/clamav option for ClamAV 0.95 (no-summary)
|
Modify plugins/virus/clamav option for ClamAV 0.95 (no-summary)
|
||||||
|
|
||||||
Fix spamassassin plugin log noise if spam score is 0.0
|
Fix spamassassin plugin log noise if spam score is 0.0
|
||||||
|
@ -139,6 +139,9 @@ sub register {
|
|||||||
elsif (/back_compat/) {
|
elsif (/back_compat/) {
|
||||||
$self->{_back_compat} = '-i --max-recursion=50';
|
$self->{_back_compat} = '-i --max-recursion=50';
|
||||||
}
|
}
|
||||||
|
elsif (/declined_on_fail/) {
|
||||||
|
$self->{_declined_on_fail} = 1;
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
$self->log(LOGERROR, "Unrecognized argument '$_' to clamav plugin");
|
$self->log(LOGERROR, "Unrecognized argument '$_' to clamav plugin");
|
||||||
return undef;
|
return undef;
|
||||||
@ -149,6 +152,7 @@ sub register {
|
|||||||
$self->{_spool_dir} ||= $self->spool_dir();
|
$self->{_spool_dir} ||= $self->spool_dir();
|
||||||
$self->{_back_compat} ||= ''; # make sure something is set
|
$self->{_back_compat} ||= ''; # make sure something is set
|
||||||
$self->{_clamd_conf} ||= '/etc/clamd/conf'; # make sure something is set
|
$self->{_clamd_conf} ||= '/etc/clamd/conf'; # make sure something is set
|
||||||
|
$self->{_declined_on_fail} ||= 0; # decline the message on clamav failure
|
||||||
|
|
||||||
unless ($self->{_spool_dir}) {
|
unless ($self->{_spool_dir}) {
|
||||||
$self->log(LOGERROR, "No spool dir configuration found");
|
$self->log(LOGERROR, "No spool dir configuration found");
|
||||||
@ -202,6 +206,7 @@ sub hook_data_post {
|
|||||||
|
|
||||||
if ($signal) {
|
if ($signal) {
|
||||||
$self->log(LOGINFO, "clamscan exited with signal: $signal");
|
$self->log(LOGINFO, "clamscan exited with signal: $signal");
|
||||||
|
return (DENYSOFT) if (!$self->{_declined_on_fail});
|
||||||
return (DECLINED);
|
return (DECLINED);
|
||||||
}
|
}
|
||||||
if ($result == 1) {
|
if ($result == 1) {
|
||||||
@ -215,6 +220,11 @@ sub hook_data_post {
|
|||||||
}
|
}
|
||||||
elsif ($result) {
|
elsif ($result) {
|
||||||
$self->log(LOGERROR, "ClamAV error: $cmd: $result\n");
|
$self->log(LOGERROR, "ClamAV error: $cmd: $result\n");
|
||||||
|
return (DENYSOFT) if (!$self->{_declined_on_fail});
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$transaction->header->add( 'X-Virus-Checked',
|
||||||
|
"Checked by ClamAV on " . $self->qp->config("me") );
|
||||||
}
|
}
|
||||||
return (DECLINED);
|
return (DECLINED);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user