cvs commit: qpsmtpd/plugins/virus clamav
[email protected] (John Peacock) 24 Feb 2005 16:54:02 -0000
| Newsgroups | perl.cvs.qpsmtpd |
|---|---|
| Message-ID | <[email protected]> |
cvsuser 05/02/24 08:54:02
Modified: plugins/virus clamav
Log:
* plugins/virus/clamav
Provide more documentation on using clamdscan
Provide back_compat option to eliminate warnings in log with old ClamAV
Use new $self->spool_dir() function instead of homebrew
Revision Changes Path
1.3 +20 -8 qpsmtpd/plugins/virus/clamav
Index: clamav
===================================================================
RCS file: /cvs/public/qpsmtpd/plugins/virus/clamav,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- clamav 17 Jul 2004 23:31:40 -0000 1.2
+++ clamav 24 Feb 2005 16:54:02 -0000 1.3
@@ -4,7 +4,7 @@
clamav -- ClamAV antivirus plugin for qpsmtpd
-$Id: clamav,v 1.2 2004/07/17 23:31:40 aqua Exp $
+$Id: clamav,v 1.3 2005/02/24 16:54:02 jpeacock Exp $
=head1 DESCRIPTION
@@ -24,7 +24,11 @@
=item clamscan_path=I<path> (e.g. I<clamscan_path=/usr/bin/clamdscan>)
Path to the clamav commandline scanner. Using clamdscan is recommended
-for sake of performance.
+for sake of performance. However, in this case, the user executing clamd
+requires access to the qpsmtpd spool directory, which usually means either
+running clamd as the same user, or changing the group ownership of the
+spool directory to be the clamd group and changing the permissions to 0750
+(this will emit warning when the qpsmtpd service starts up).
Mail will be passed to the clamav scanner in Berkeley mbox format (that is,
with a "From " line).
@@ -48,7 +52,12 @@
Specify an alternate temporary directory. If not specified, the qpsmtpd
I<spool_dir> will be used. If neither is available, I<~/tmp/> will be tried,
-and if that that fails the plugin will gracefully fail.
+and if that that fails the plugin will gracefully fail.
+
+=item back_compat
+
+If you are using a version of ClamAV prior to 0.80, you need to set this
+variable to include a couple of now deprecated options.
=back
@@ -92,6 +101,9 @@
elsif (/^action=(add-header|reject)$/) {
$self->{_action} = $1;
}
+ elsif (/back_compat/) {
+ $self->{_back_compat} = '-i --max-recursion=50';
+ }
else {
$self->log(LOGERROR, "Unrecognized argument '$_' to clamav plugin");
return undef;
@@ -99,10 +111,8 @@
}
$self->{_max_size} ||= 512 * 1024;
- $self->{_spool_dir} ||=
- $self->qp->config('spool_dir') ||
- Qpsmtpd::Utils::tildeexp('~/tmp/');
- $self->{_spool_dir} = $1 if $self->{_spool_dir} =~ /(.*)/;
+ $self->{_spool_dir} ||= $self->spool_dir();
+ $self->{_back_compat} ||= ''; # make sure something is set
unless ($self->{_spool_dir}) {
$self->log(LOGERROR, "No spool dir configuration found");
@@ -142,7 +152,9 @@
seek($temp_fh, 0, 0);
# Now do the actual scanning!
- my $cmd = $self->{_clamscan_loc}." --stdout -i --max-recursion=50 --disable-summary $filename 2>&1";
+ my $cmd = $self->{_clamscan_loc}." --stdout "
+ .$self->{_back_compat}
+ ." --disable-summary $filename 2>&1";
$self->log(LOGDEBUG, "Running: $cmd");
my $output = `$cmd`;