David,

> Is there a way to configure Amavisd-new so that big mails (for example
> bigger as 10 MB) do not get virus-scanned? If not, is it possible to
> implement it with a custom hook?

Not configurable, but can be done through a custom hook.

I just realized the most elegant way to do it would be
to load a policy bank in a custom hook - but it needs
a small patch to 2.6.0-pre3 (below), which will find
its way into the release.

Put this into amavisd.conf:

$policy_bank{'NOVIRUSCHECK'} = {
  bypass_decode_parts => 1,
  bypass_virus_checks_maps  => [1],
};

Then, in a custom hook initialization routine ('new'),
load this policy bank when desired, e.g.:

sub new {
  my($class,$conn,$msginfo) = @_;
  my($self) = bless {}, $class;
  if ($msginfo->msg_size > 10*1024*1024) {
    Amavis::load_policy_bank('NOVIRUSCHECK');
    do_log(2, "skipping virus checks, size=%d bytes", $msginfo->msg_size);
  }
  $self;
}

Other custom hook routines are not needed and may be
left undefined (actually, their dummy default routines kept).

Here is the patch needed for 2.6.0-pre3 to ensure a reset
of policy banks, as otherwise the change of a policy bank
by a custom hook will be unnoticed and the setting kept
for the subsequent message:

--- amavisd.orig        Sun Dec 30 02:20:52 2007
+++ amavisd     Wed Jan  9 20:42:58 2008
@@ -14205,7 +14205,5 @@
   push(@response, proto_encode('exit_code',sprintf("%d",$exit_code)));
   ll(2) && do_log(2, "mail checking ended: %s", join("\n",@response));
-  if ($policy_changed) {  # restore bank settings
-    %current_policy_bank = %baseline_policy_bank; $policy_changed = 0;
-  }
+  %current_policy_bank = %baseline_policy_bank;  # restore bank settings
   @response;
 }
@@ -15087,6 +15085,5 @@
         undef $sender_unq; undef $sender_quo; @recips = (); $got_rcpt = 0;
         $max_recip_size_limit = undef; $msginfo = undef;  # forget previous
-        if ($policy_changed)
-          { %current_policy_bank = %baseline_policy_bank; $policy_changed = 0 }
+        %current_policy_bank = %baseline_policy_bank;  # restore bank settings
         # report elapsed times by section for each transaction
         # (the time for a QUIT remains unaccounted for)



Mark

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
_______________________________________________
AMaViS-user mailing list
AMaViS-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/amavis-user
AMaViS-FAQ:http://www.amavis.org/amavis-faq.php3
AMaViS-HowTos:http://www.amavis.org/howto/

Reply via email to