Attachment "whitelist"

Mark Martinec Mark.Martinec+amavis at ijs.si
Thu Aug 9 18:39:20 CEST 2012


> Basically, I want a single address to receive a certain set of
> attachments only (Example: smime signed mails, PDFs, plain text mails).
> 
> I'm using this:
> %banned_rules = (
>    'SPECIALRULES' => new_RE( qr'^\.smime$' => 0, qr'.\.pdf$' => 0,
> qr'^\.asc$' => 0, qr'text/plain' => 0, qr'.'i, ),
>    'DEFAULT' => $banned_filename_re,
>    );

> Aug  9 10:59:41 mail amavis[13104]: (13104-10) Blocked BANNED

> What am I doing wrong?


Syntax. Elements of a list in new_RE() can be pairs: [regexp,result],
or just regexps which imply a true result.

Something like:

new_RE(
  [qr'^\.smime$' => 0], [qr'.\.pdf$' => 0],
  [qr'^\.asc$' => 0], [qr'text/plain' => 0],
  qr'^',
)



README.lookups:

REGULAR EXPRESSION LOOKUPS
[...]
Each element of the list can be a ref to a pair, or directly a regexp
('Regexp' object created by qr operator, or just a (less efficient)
string containing a regular expression). If it is a pair, the first
element is treated as a regexp, and the second provides a return value
in case the regexp matches. If not a pair, the implied result value
of a match is 1.


  Mark


More information about the amavis-users mailing list