Discussion:
Email WhiteListing Attachments with Amavis and Microsoft Files
Johnny Time
2018-11-09 17:56:06 UTC
Permalink
Hi we would like to whitelist some extensions(Attachment) with Amavis,
but we have a little problem
for exemple a mail with the extension .ppt passed -> it is OK-> it is
in our whitelist configuration
but a file with the extension .pptx passed also but we didn't want it
to pass because we wanted to bann every extension that are not in our
configuration.

What mistake do we have on Amavis Configuration?

Thanks a lot for you reply.

Under this is our configuration concerning the whitelisting of email
attachments:

# for $banned_namepath_re, a new-style of banned table, see amavisd.conf-sample
$banned_filename_re = new_RE(

# MICROSOFT
[ qr'winmail.dat'i => 1 ],

# EXTENSION ARCHIVE
[ qr'^application/ace|bz2|gzip|tar|rar|tgz|zip$'i => 0 ],

# EXTENSION IMAGE
[ qr'^image/bmp|jpeg|jpg|png|gif$'i => 0 ],

# EXTENSION VIDEO
[ qr'^application/avi|mpeg|sif|siv$'i => 0 ],

# EXTENSION DOCUMENT
[ qr'^application/doc|docx|ppt|pdf|xls|vsd$'i => 0 ],

# EXTENSION TEXTE
[ qr'^text/plain|html|text/csv|txt|rtf$'i => 0 ],

# Block all extensions attachment
[ qr'^\.[a-zA-Z0-9]*$'i => 1 ],

);
Hoyer-Reuther, Christian
2018-11-10 07:18:49 UTC
Permalink
Hello,

you could try this:

[ qr'^application/(doc|docx|ppt|pdf|xls|vsd)$'i => 0 ],

Regards,

Christian

-----Ursprüngliche Nachricht-----
Von: amavis-users [mailto:amavis-users-bounces+christian.hoyer-reuther=cac-***@amavis.org] Im Auftrag von Johnny Time
Gesendet: Freitag, 9. November 2018 18:56
An: amavis-***@amavis.org
Betreff: Email WhiteListing Attachments with Amavis and Microsoft Files

Hi we would like to whitelist some extensions(Attachment) with Amavis,
but we have a little problem
for exemple a mail with the extension .ppt passed -> it is OK-> it is
in our whitelist configuration
but a file with the extension .pptx passed also but we didn't want it
to pass because we wanted to bann every extension that are not in our
configuration.

What mistake do we have on Amavis Configuration?

Thanks a lot for you reply.

Under this is our configuration concerning the whitelisting of email
attachments:

# for $banned_namepath_re, a new-style of banned table, see amavisd.conf-sample
$banned_filename_re = new_RE(

# MICROSOFT
[ qr'winmail.dat'i => 1 ],

# EXTENSION ARCHIVE
[ qr'^application/ace|bz2|gzip|tar|rar|tgz|zip$'i => 0 ],

# EXTENSION IMAGE
[ qr'^image/bmp|jpeg|jpg|png|gif$'i => 0 ],

# EXTENSION VIDEO
[ qr'^application/avi|mpeg|sif|siv$'i => 0 ],

# EXTENSION DOCUMENT
[ qr'^application/doc|docx|ppt|pdf|xls|vsd$'i => 0 ],

# EXTENSION TEXTE
[ qr'^text/plain|html|text/csv|txt|rtf$'i => 0 ],

# Block all extensions attachment
[ qr'^\.[a-zA-Z0-9]*$'
@lbutlr
2018-11-12 23:43:51 UTC
Permalink
Post by Johnny Time
[ qr'^application/doc|docx|ppt|pdf|xls|vsd$'i => 0 ],
This syntax is broken an will allow application/document binary/pptx and virusload.exe/pptanythinggoeshere

You either need to put a $ at the end of all of those

[ qr'^application/(doc$|docx$|ppt$|pdf$|xls$|vsd$)'i => 0 ],

NB the addition of parens.

Or better, what Hoyer suggested (which also adds the critical parens you are missing).
--
Of course, there were various groups seeking his overthrow, and this was
right and proper and the sign of a vigorous and healthy society. No-one
could call him unreasonable about the matter. Why, hadn't he founded
most of them himself? And what was so beautiful was the way they spent
nearly all their time bickering with one another. Human nature, the
Patrician always said, was a marvelous thing. Once you understood where
its levers were. --Guards! Guards!
Loading...