Dear my custom script will block any message passed by the custome 
script (just for testing)
It seems that amavis don't care about the result of Amavis::Custom

What can i do in order to force the mail to reject the message ? how to 
change final_destiny to D_DISCARD ?

Jan  3 18:09:48 pc-touzeau amavis[7527]: (07527) lookup: (scalar) 
matches, result="6.31"
Jan  3 18:09:48 pc-touzeau amavis[7527]: (07527) lookup 
[spam_kill_level] => true,  "[email protected]" matches, 
result="6.31", matching_key="(constant:6.31)"


***** here it is amavis result that indicate that "final_destiny is PASS
Jan  3 18:09:48 pc-touzeau amavis[7527]: (07527) final_destiny (ccat=0) 
is PASS, recip [email protected]
Jan  3 18:09:48 pc-touzeau amavis[7527]: (07527) final_destiny PASS, 
recip [email protected]
Jan  3 18:09:48 pc-touzeau amavis[7527]: (07527) do_notify_and_quar: 
ccat=Clean (1,0) ("1":Clean, "0":CatchAll) ccat_block=(), qar_mth=
Jan  3 18:09:48 pc-touzeau amavis[7527]: (07527) skip admin 
notification, no administrators
Jan  3 18:09:48 pc-touzeau amavis[7527]: (07527) 
do_notify_and_quarantine - done

Jan  3 18:09:48 pc-touzeau amavis[7527]: (07527) header: 
X-Artica-scanner: artica\n
Jan  3 18:09:48 pc-touzeau amavis[7527]: (07527) artica-plugin: client's 
IP [127.0.0.1], sender: [email protected], recipient: 
[email protected], tempdir: /var/amavis/afXXXX0eu86o

**** Here it is the plugin try to stop the mail by 
$msginfo->add_contents_category(CC_BANNED,0); action
Jan  3 18:09:48 pc-touzeau amavis[7527]: (07527) artica-plugins: 
infected:0, banned:1, spammy:0, spam:0
Jan  3 18:09:48 pc-touzeau amavis[7527]: (07527) lookup: (scalar) 
matches, result="2"
Jan  3 18:09:48 pc-touzeau amavis[7527]: (07527) lookup [spam_tag_level] 
=> true,  "[email protected]" matches, result="2", 
matching_key="(constant:2)"
Jan  3 18:09:48 pc-touzeau amavis[7527]: (07527) lookup: (scalar) 
matches, result="6.31"
Jan  3 18:09:48 pc-touzeau amavis[7527]: (07527) lookup 
[spam_tag2_level] => true,  "[email protected]" matches, 
result="6.31", matching_key="(constant:6.31)"
Jan  3 18:09:48 pc-touzeau amavis[7527]: (07527) headers CLUSTERING: NEW 
CLUSTER <[email protected]>: score=0.694, tag=0, tag2=0, local=0, 
bl=, s=, mangle=
Jan  3 18:09:48 pc-touzeau amavis[7527]: (07527) header: 
X-Virus-Scanned: amavisd-new at localhost.localdomain\n
Jan  3 18:09:48 pc-touzeau amavis[7527]: (07527) headers CLUSTERING: 
done all 1 recips in one go
Jan  3 18:09:48 pc-touzeau amavis[7527]: (07527) dkim: not signing 
inbound mail
Jan  3 18:09:48 pc-touzeau amavis[7527]: (07527) prolong_timer AM.PDP 
headers: remaining time = 479 s
Jan  3 18:09:48 pc-touzeau amavis[7527]: (07527) DSN: sender NOT 
credible, SA: 0.694, <[email protected]>
Jan  3 18:09:48 pc-touzeau amavis[7527]: (07527) lookup: (scalar) 
matches, result="9"
Jan  3 18:09:48 pc-touzeau amavis[7527]: (07527) DSN: SUCC 
status-to-be-passed-back 250 NonBlocking:Clean, no DSN requested: 
<[email protected]> -> <[email protected]>

*** Amavis send to recipients has Passed BANNED !

Jan  3 18:09:48 pc-touzeau amavis[7527]: (07527) one_response_for_all 
<[email protected]>: success, r=0,b=0,d=0, ndn_needed=0, '250 2.5.0 
Ok, id=07527, continue delivery'
Jan  3 18:09:48 pc-touzeau amavis[7527]: (07527) notif=N, suppressed=0, 
ndn_needed=0, exit=0, 250 2.5.0 Ok, id=07527, continue delivery
Jan  3 18:09:48 pc-touzeau amavis[7527]: (07527) prolong_timer 
delivery-notification: remaining time = 479 s
Jan  3 18:09:48 pc-touzeau amavis[7527]: (07527) 
fish_out_ip_from_received: 127.0.0.1
Jan  3 18:09:48 pc-touzeau amavis[7527]: (07527) lookup_ip_acl 
(publicnetworks): key="127.0.0.1" matches "!127.0.0.0/8", result=0
Jan  3 18:09:48 pc-touzeau amavis[7527]: (07527) 
fish_out_ip_from_received: 127.0.0.1
Jan  3 18:09:48 pc-touzeau amavis[7527]: (07527) lookup_ip_acl 
(publicnetworks): key="127.0.0.1" matches "!127.0.0.0/8", result=0
Jan  3 18:09:48 pc-touzeau amavis[7527]: (07527) 
parse_ip_address_from_received: 127.0.0.1
Jan  3 18:09:48 pc-touzeau amavis[7527]: (07527) Passed BANNED (), 
AM.PDP-SOCK [127.0.0.1] [127.0.0.1] <[email protected]> -> 
<[email protected]>, Queue-ID: DB22E9187C5, Message-ID: 
<[email protected]>, mail_id: hSXRGEPjtXL1, Hits: 0.694, size: 
1321, 1927 ms


best regards

Here it is the code
#-----------------------------------

package Amavis::Custom;
use strict;

BEGIN {
   import Amavis::Conf qw(:platform :confvars c cr ca $myhostname);
   import Amavis::Util qw(do_log untaint safe_encode safe_decode);
   import Amavis::rfc2821_2822_Tools;
   import Amavis::Notify qw(build_mime_entity);
}


sub new {
   my($class,$conn,$msginfo) = @_;
   bless {}, $class;
}

sub before_send {
   my($self,$conn,$msginfo) = @_;
   my($client_ip) = $msginfo->client_addr;
   my($sender_address)=$msginfo->sender;
   my($log_id)=$msginfo->log_id;
   my($tempdir) = $msginfo->mail_tempdir;
   $msginfo->header_edits->add_header('X-Artica-scanner','artica');


do_log(0, "artica-plugin: client's IP [%s], sender: %s, tempdir:
%s",$client_ip, $sender_address,$tempdir);

#Adding banned/VIRUSES for all mail
   $msginfo->add_contents_category(CC_BANNED,0);
   $msginfo->add_contents_category(CC_VIRUS,0);


   my($infected) = $msginfo->is_in_contents_category(CC_VIRUS);
   my($banned)   = $msginfo->is_in_contents_category(CC_BANNED);
   my($at_tag2)  = $msginfo->is_in_contents_category(CC_SPAMMY);
   my($at_kill)  = $msginfo->is_in_contents_category(CC_SPAM);

   do_log(0, "artica-plugins: infected:%s, banned:%s, spammy:%s,
spam:%s",$infected, $banned, $at_tag2, $at_kill);

$self;
};

1;  # insure a defined return


-- 
David Touzeau
--------------------------
Linux Ubuntu 7.04 feisty
FreePascal-Lazarus,perl,delphi,php
artica for postfix management console (http://www.artica.fr)
icq:160018849

------------------------------------------------------------------------------
_______________________________________________
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