[exim] demime condition vs MIME ACL

Startseite
Nachricht löschen
Nachricht beantworten
Autor: Don Walker
Datum:  
To: exim-users
Betreff: [exim] demime condition vs MIME ACL
>* Don Walker [2005-02-21 14:10]:
>> In 4.50, I had to specify the WITH_OLD_DEMIME option so my existing
>> checks
>> for prohibited attached file extensions would continue to work. But the
>> 4.50 spec.txt says the demime condition is deprecated in favor of the
>> MIME
>> ACL. However, I can't figure out how to check attached file extensions
>> using a MIME ACL. What am I missing? Thanks.
>
> I can't say what you are missing, as I don't know what you have. :-)
>
> As an example, I provide a piece of my configuration. I have a list of
> "bad" filename extensions in a file called /etc/exim/blacklist_files
> which contains extensions to block (one perl line):
>
>    bat
>    chm
>    cmd
>    ...

>
> Here's exim.conf stuff:
>
> # main
> BLACKLIST_FILES = /etc/exim/blacklist_files
> FILENAME_EXT = ${sg{$mime_filename}{^.+\\.([a-z0-9]+)\$}{\$1}}
>
> acl_smtp_mime = acl_check_mime
>
> # ACL
> acl_check_mime:
>    deny
>        message = File type blacklisted (filename: $mime_filename)
>        condition = 
> ${lookup{FILENAME_EXT}lsearch{BLACKLIST_FILES}{yes}{no}}

>
>    accept

>
> G'luck.
>
> -- 
>    -- Kirill Miazine <km@???>


A follow-up: I think your scheme would not catch upper-case file
extensions. At least it didn't in my testing. So I changed your
FILENAME_EXT definition to:

FILENAME_EXT = ${lc:${sg{$mime_filename}{^.+\\.([a-zA-Z0-9]+)\$}{\$1}}}

The file still contains only lower-case extensions to be blocked.
Thanks again - it's working great.
Don