Whitelisting File Extension Types?

Kelly Marchewa <[email protected]>
Newsgroups gmane.mail.virus.amavis.user
Message-ID <[email protected]>
Hello,

I know one can block file extensions in amavis using the 
$banned_file_name_re variable. However, I would like to adopt a "deny by 
default" approach and whitelist only a handful of file types.

I thought I could use a regex such as:

qr'^(?!.*\.gif|.*\.heic|.*\.jpg|.*\.jpeg|.*\.mp4|.*\.png|.*\.pdf|.*\.txt|.*\.wav|.*\.webm)(.*)$'i

However, even if I send an "allowed" file type (such as a PDF) the 
"banned content" action is triggered with the following message:

"No viruses were found.

Banned name: text/plain,.asc
Content type: Banned
Internal reference code for the message is 891228-01/WX804g-n9ggX"


I am not sure why it is finding an "asc" file as only a PDF was 
attached. Furthermore, even if I added ".asc" to the list above, it is 
still flagging the email as having banned content.

I have tested the Regex on https://regexr.com/ and it seems to work as 
expected. What might the issue be?

-- 
Thanks,
Kelly Marchewa
Software Engineer | Midamerica Hotels Corporation
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.