Subject: | Re: clamav - specify a different config file |
Date: | Thu, 16 Mar 2006 10:18:01 +0000 |
To: | bugs-qpsmtpd [...] rt.perl.org |
From: | Robin Bowes <robin-lists [...] robinbowes.com> |
Ask Bjørn Hansen wrote:
Show quoted text
>
> On Mar 15, 2006, at 5:21 PM, Robin Bowes wrote:
>
Done. Also attached to this msg.
R.
>> Ok, attached is a patch that adds an additional parameter (clamd_conf)
>> to the clamav plugin.
>>
>> It is used as follows:
>>
>> virus/clamav clamscan_path=/usr/bin/clamdscan
>> clamd_conf=/etc/clamd.d/qpsmtpd.conf action=reject max_size=1048576
>>
>> I may even update the POD text if this patch is acceptable :)
>
>
> Yes, please update the pod and then send the patch to the RT address
> (bugs-qpsmtpd at rt.perl.org).
Index: clamav
===================================================================
--- clamav (revision 629)
+++ clamav (working copy)
@@ -27,6 +27,13 @@
scanner in Berkeley mbox format (that is, with a "From " line). See the
discussion below on which commandline scanner to use.
+=item clamd_conf=I<path> (e.g. I<clamd_conf=/etc/sysconfig/clamd.conf>)
+
+Path to the clamd configuration file. Passed as an argument to the
+command-line scanner (--config-file=I<path>).
+
+The default value is '/etc/clamd.conf'.
+
=item action=E<lt>I<add-header> | I<reject>E<gt> (e.g. I<action=reject>)
Selects an action to take when an inbound message is found to be infected.
@@ -120,6 +127,9 @@
elsif (/^clamscan_path=(\/[\/\-\_\.a-z0-9A-Z]*)$/) {
$self->{_clamscan_loc} = $1;
}
+ elsif (/^clamd_conf=(\/[\/\-\_\.a-z0-9A-Z]*)$/) {
+ $self->{_clamd_conf} = "$1";
+ }
elsif (/^tmp_dir=(\/[\/\-\_\.a-z0-9A-Z]*)$/) {
$self->{_spool_dir} = $1;
}
@@ -138,6 +148,7 @@
$self->{_max_size} ||= 512 * 1024;
$self->{_spool_dir} ||= $self->spool_dir();
$self->{_back_compat} ||= ''; # make sure something is set
+ $self->{_clamd_conf} ||= '/etc/clamd/conf'; # make sure something is set
unless ($self->{_spool_dir}) {
$self->log(LOGERROR, "No spool dir configuration found");
@@ -172,9 +183,11 @@
}
# Now do the actual scanning!
- my $cmd = $self->{_clamscan_loc}." --stdout "
- .$self->{_back_compat}
- ." --disable-summary $filename 2>&1";
+ my $cmd = $self->{_clamscan_loc}
+ . " --stdout "
+ . $self->{_back_compat}
+ . " --config-file=" . $self->{_clamd_conf}
+ . " --disable-summary $filename 2>&1";
$self->log(LOGDEBUG, "Running: $cmd");
my $output = `$cmd`;