Timo Sirainen put forth on 3/12/2011 7:13 AM:
On Tue, 2011-03-08 at 17:42 +0100, Frank Bonnet wrote:
Is there a way to filter some attachments with dovecot ?
I think there are some generic IMAP tools for that..
What kind of attachments? Viruses or just annoying things like .vbs, .bat, stuff that a/v programs don't reject? Do you want to reject the emails or strip the attachment off and delivery the email? You can reject emails that contain arbitrary attachments easily with standard Postfix, for example:
/etc/postfix/main.cf ... mime_header_checks = pcre:/etc/postfix/mime_header_checks ...
/etc/postfix/mime_header_checks # Reject email containing unwanted attachments
/name=\"(.*)\.(386|bat|chm|cpl|cmd|com|do|exe|hta|jse|lnk|msi|ole)\"$/ REJECT Unwanted attachment $1.$2 /name=\"(.*)\.(pif|reg|rm|scr|shb|shm|shs|sys|vbe|vbs|vxd|xl|xsl)\"$/ REJECT Unwanted attachment $1.$2
You may also use any access table action instead of REJECT, such as DISCARD, WARN, etc. You could even pipe an offending message to an external content filter when one of these attachments is found, using the FILTER action and have the external daemon strip the attachment.
-- Stan