Quanah,

> I've directly emailed you the patch, it had an additional set of changes to
> amavisd you may wish to consider.

>    }  # endfor per_recip_data
> +  if (defined($qar_method) && $qar_method ne '') {  # archiving quarantine 
> on sender
> +    my($sender) = $msginfo->sender; 
> +    if ($sender ne '') {
> +      my($q) = lookup(0,$sender,@{ca('archive_quarantine_to_maps')});
> +      $q = $sender  if $q ne '' && $qar_method =~ /^bsmtp:/i;  # orig.recip
> +      push(@qar_addr, $q)  if $q ne '' && !grep {$_ eq $q} @qar_addr;
> +    } 
> +  }
>    if ($ccat == CC_SPAM) {

This one is not accepted, because it goes against the principle that
*_maps lookup tables are always done on recipients, not on senders.
The proper change would need to introduce a new setting, not overload
the archive_quarantine_to_maps.

Fortunately such quarantining is achievable by custom hooks, either
by calling do_quarantine() directly, or the way that I prefer, by
flagging a message with an additional minor contents category, and
adding additional quarantine settings. For example:

Add three new ccat settings:
  ccat
  major,minor   method          quarantine_to
  -----------   --------------  -----------------
  CC_CLEAN,2 -> local:clean/%m, recip-quarantine
  CC_CLEAN,3 -> local:clean/%m, sender-quarantine
  CC_CLEAN,4 -> local:clean/%m, clean-quarantine

like this, in amavisd.conf:

$quarantine_method_by_ccat{CC_CLEAN.",2"} = 'local:clean/%m';
$quarantine_method_by_ccat{CC_CLEAN.",3"} = 'local:clean/%m';
$quarantine_method_by_ccat{CC_CLEAN.",4"} = 'local:clean/%m';
$quarantine_to_maps_by_ccat{CC_CLEAN.",2"} = ['recip-quarantine'];
$quarantine_to_maps_by_ccat{CC_CLEAN.",3"} = ['sender-quarantine'];
$quarantine_to_maps_by_ccat{CC_CLEAN.",4"} = ['clean-quarantine'];

(the recip-quarantine, sender-quarantine and clean-quarantine are
predefined in %Amavis::Conf::local_delivery_aliases, but can be
changed or additional aliases added in amavisd.conf).


Then in a custom hook just add CC_CLEAN,2 or CC_CLEAN,3 or CC_CLEAN,4
contents category as appropriate to a message, and quarantining will
happen automatically:


custom hook:

# invoked at child process creation time;
# return an object, or just undef when custom checks are not needed
sub new {
  my($class,$conn,$msginfo) = @_;
  my($self) = bless {}, $class;

  my($ccat_sub) = 0;
  my(@recips) = map { $_->recip_addr } @{$msginfo->per_recip_data};
  if (Amavis::Lookup::lookup(0,$msginfo->sender,
        qw([EMAIL PROTECTED] [EMAIL PROTECTED] .example.net)) {
    $ccat_sub = 3;  # sender quarantine
  } elsif (grep { Amavis::Lookup::lookup(0,$_,
        qw([EMAIL PROTECTED] [EMAIL PROTECTED])) } @recips) {
    $ccat_sub = 2;  # recipient quarantine
  }
  if ($ccat_sub > 0) {
    $msginfo->add_contents_category(CC_CLEAN,$ccat_sub);
    for my $r (@{$msginfo->per_recip_data}) {
      $r->add_contents_category(CC_CLEAN,$ccat_sub);
    }
  }
  $self;  # returning an object activates further callbacks,
          # returning undef disables them
};


Mark

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
AMaViS-user mailing list
[email protected] 
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