> > 
> >      if ($REJECT_VIRUS && $quarantine_event && $destring =~ 
> m/^virus/) {
> >        &error_condition("Virus detected, send SMTP error 
> code...",33);
> >      }
> > 
> >      if ($REJECT_SPAM && $spam_event) {
> >        &error_condition("Spam detected, send SMTP error 
> code...",32);
> >      }
> 
> 
> I'm eager to hear what Jason Haar has to say about this. I 
> don't know how error codes are generated in q-s so I can't 
> really comment on the usability of the above code, but in 
> concept it looks like what I'm suggesting.
> 

Well, my QS has the ability to delete, quarantine, or reject each thing
independently..  ie Viruses=deleted, spam=rejected, policies=quarantined
& notified.

Then each individual policy can be set differently depending on whats
involved... Policies that match new worms could be deleted instead of
quarantined....etc.

Then on top of all there, each of these settings can be done at the
Global, Domain, and Per-User level... All prefs are pulled via SQL (as
are policies).  I replaced nearly all the code in perlscan_scanner to
accomplish that.

If you feel like reading some code... Here is the pertinent section I
use to determine message delivery (quarantine vs delete vs reject vs
deliver).   I tried to uppercase all my VARS that I added.

Some day I'll get a patch made against 1.22 that has this stuff
available, its just a lot of work :)

#-----------------------------------------------#

  &init_scanners;

  if ($tag_score =~ m/SA:.\((.*)\/(.*)\)/) {
    $R_HITS = $1;
    $R_REQ = $2;
  }

##### set spam delivery stuff....

    if ((defined $D_HITS) && ($R_HITS >= $D_HITS)) {
      # delete takes precedence over quarantine
      $EVENT_INFO = "deleted";
      $SPAM_HANDLE = 3;
      if ($REJECT_SPAM) {
        $EVENT_INFO = "rejected";
        $SPAM_HANDLE = 1;
      }
    }
    elsif ((defined $Q_HITS) && ($R_HITS >= $Q_HITS)) {
      # quarantine
      $EVENT_INFO = "quarantined";
      $SPAM_HANDLE = 2;
      if ((!defined $Q_EMAIL) || ($Q_EMAIL eq "")) { $Q_EMAIL =
"delete"; }
    }
    else {
      # tagged
      $EVENT_INFO = "tagged";
      $SPAM_HANDLE = 0;
    }

######## CHECK Handle method ###########

  # lets send notifications for virus and policy violators...
  if ($quarantine_event) {
    delete $ENV{'TCPREMOTEIP'};
    &email_quarantine_report;
  }

  my $HANDLE=0;
  my $QADDR='';
  my $ERRCODE=31; # default qmail queue error code

  # policy message handling cannot be set to deliver
  if (int $POLICY_HANDLE == 0) { $POLICY_HANDLE = 1; }

  # virus message handling cannot be set to deliver
  if (int $VIRUS_HANDLE == 0) { $VIRUS_HANDLE = 1; }

  if ($qtype eq "policy") {
    $HANDLE     = $POLICY_HANDLE;
    $QADDR      = $POLICY_QUARANTINE_ADDR;
    $ERRCODE    = 34;
  }
  elsif ($qtype eq "virus")  {
    $HANDLE     = $VIRUS_HANDLE;
    $QADDR      = $VIRUS_QUARANTINE_ADDR;
    $ERRCODE    = 33;
  }
  else {
    if ($SPAM_HANDLE > 0) {
       $HANDLE  = $SPAM_HANDLE;
       $QADDR   = $Q_EMAIL;
       $ERRCODE = 32;
    }
    else {
       $HANDLE=0;
    }
  }


  if ($HANDLE > 0) {

     # we are going to reject, quarantine or delete this message...

     # quarantined
     if (int $HANDLE == 2) {
       &debug("****** QUARANTINE TO $QADDR ********");
       &qmail_parent_check;
 
&qmail_requeue($env_returnpath,"T$QADDR\0\0","$scandir/$wmaildir/new/$fi
le_id");
     }

     # rejected
     if (int $HANDLE == 1) {
       &debug("****** REJECTED WITH ERRCODE $ERRCODE ********");
       &error_condition("rejected",$ERRCODE);
     }

     # delete
     if (int $HANDLE == 3) {
        &debug("******* DELETED MSG TO $env_recips ********");
     }

  }
  else {
    # tagged and clean message go on through!
    &qmail_parent_check;
 
&qmail_requeue($env_returnpath,$env_recips,"$scandir/$wmaildir/new/$file
_id");
  }
  alarm 0;
};


#-----------------------------------------------#


-------------------------------------------------------
This SF.Net email is sponsored by Sleepycat Software
Learn developer strategies Cisco, Motorola, Ericsson & Lucent use to
deliver higher performing products faster, at low TCO.
http://www.sleepycat.com/telcomwpreg.php?From=osdnemail3
_______________________________________________
Qmail-scanner-general mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/qmail-scanner-general

Reply via email to