|
From: Mark M. <Mar...@ij...> - 2010-03-16 15:37:28
|
Otávio,
On Wednesday 10 March 2010 09:41:09 Gerd v. Egidy wrote:
> > $r->banned_filename_re = new Amavis::Lookup::RE(qr/.\.($re)\$/i);
> There is no banned_filename_re within PerRecip, so that's not gonna work.
>
> > What is the right way to implement banned rules for domains (using
> > Amavis::Custom)?
> Could you please describe what you exactly need.
>
> If you want to ban different filetypes based on the recipient, you can do
> this without Amavis::Custom: Have a look at @banned_filename_maps and
> %banned_rules.
Agreed on all points with Gerd.
> When you ban with Amavis::Custom you have to do the complete banning
> decision yourself. If you want to block something in
> Amavis::Custom::checks, you have at least to put the correct contents
> category (CC_BANNED) in the PerRecip contents_category and in the msginfo
> contents_category.
True again.
Incidentally, it is possible to build dynamic rules in Amavis::Custom
if need arises (but the given topic does not need such a solution).
Here is an example (the rules are just made up for the example,
not necessarily meaningful):
sub new {
my($class,$conn,$msginfo) = @_;
my($self) = bless {}, $class;
$banned_rules{'RULES-ONE'} =
Amavis::Lookup::RE->new( qr'^\.(exe-ms)$' );
$banned_rules{'RULES-TWO'} =
Amavis::Lookup::RE->new( [qr'^' => 0] );
$banned_rules{'RULES-THREE'} =
Amavis::Lookup::RE->new( qr'.\.(vbs|pif|scr|bat)$'i, [qr'^\.exe$' => 0] );
$policy_bank{'DYNAMIC_BANNED'} = {
banned_filename_maps => [ {
'us...@ex...' => 'RULES-ONE',
'.example.org' => 'RULES-THREE,RULES-ONE,DEFAULT',
'.example.net' => 'RULES-TWO',
'.' => 'DEFAULT',
} ],
};
Amavis::load_policy_bank('DYNAMIC_BANNED');
}
Mark
|