cvs commit: qpsmtpd/plugins/virus clamav

[email protected] (John Peacock) 24 Feb 2005 20:00:23 -0000
Newsgroups perl.cvs.qpsmtpd
Message-ID <[email protected]>
cvsuser     05/02/24 12:00:23

  Modified:    plugins/virus clamav
  Log:
  *   plugins/virus/clamav
      Improved documentation for running clamdscan correctly inside the
      qpsmtpd spool directory.
  
      Change file permissions to permit non-owner external process to access
      files inside spool directory
  
  Revision  Changes    Path
  1.4       +23 -4     qpsmtpd/plugins/virus/clamav
  
  Index: clamav
  ===================================================================
  RCS file: /cvs/public/qpsmtpd/plugins/virus/clamav,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- clamav	24 Feb 2005 16:54:02 -0000	1.3
  +++ clamav	24 Feb 2005 20:00:23 -0000	1.4
  @@ -4,7 +4,7 @@
   
   clamav -- ClamAV antivirus plugin for qpsmtpd
   
  -$Id: clamav,v 1.3 2005/02/24 16:54:02 jpeacock Exp $
  +$Id: clamav,v 1.4 2005/02/24 20:00:23 jpeacock Exp $
   
   =head1 DESCRIPTION
   
  @@ -26,9 +26,21 @@
   Path to the clamav commandline scanner.  Using clamdscan is recommended
   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).
  +running clamd as the same user as qpsmtpd does (by far the easiest method)
  +or by doing the following: 
  +
  +=over 2
  +
  +=item * Change the group ownership of the spool directory to be a group 
  +of which clamav is a member or add clamav to the same group as the qpsmtpd
  +user;
  +
  +=item * Enable the "AllowSupplementaryGroups" option in clamd.conf;
  +
  +=item * Change the permissions of the qpsmtpd spool directory to 0770 (this 
  +will emit warning when the qpsmtpd service starts up).
  +
  +=back
   
   Mail will be passed to the clamav scanner in Berkeley mbox format (that is,
   with a "From " line).
  @@ -150,6 +162,13 @@
       print $temp_fh $line;
     }
     seek($temp_fh, 0, 0);
  +
  +  my $mode = (stat($self->{_spool_dir}))[2];
  +  if ( $mode & 07077  ) { # must be sharing spool directory with external app
  +      $self->log(LOGWARN,
  +        "Changing permissions on file to permit scanner access");
  +      chmod $mode, $filename;
  +  }
    
     # Now do the actual scanning!
     my $cmd = $self->{_clamscan_loc}." --stdout "