[Mimedefang] Help needed to block all attachments

Joseph Brennan brennan at columbia.edu
Wed Nov 21 10:52:45 EST 2012



--On November 21, 2012 14:31:46 +0000 "Ford,Luckie J" 
<ljford at mdanderson.org> wrote:

> I apologize in advance as I am an extreme mimdefang newbie that has
> installed the product for one purpose, to block ALL attachments from
> going through the SMTP server.  I see the ability to list specific file
> extensions to block but that isnt what I am looking for.  I want to
> block ALL attachments in emails.  Can someone provide specific details
> as to what needs to be changed and where in the appropriate config
> files.  I am forever appreciative of any help that can be provided.


Do you want to reject the message entirely, or remove parts? Both are 
possible.

'sub filter' examines each MIME part. In there, test something that 
identifies the parts you don't want, and then take action. Possibly 
(untested amnd probably too simple!)--

if ($type !~ /text\//i) {
	action_replace_with_warning('This part has been removed');
}

Plain text and html parts would pass that, and others not. This is not 
exactly what you asked because an attachment could be text. And there might 
be some other kinds of parts you want to allow, like for example a message 
forwarded as an attachment, or a bounce notice with the original headers as 
an attachment.

Kevin McGrail's suggestion concentrates on file attachments, by looking for 
the telltale file extensions. Files created on Windows or OSX pretty much 
always have an extension (unless the user removes it). That might be what 
you want. He suggested action_bounce(), assuming you want to block the 
message.

You'll need to define what attachment means. It's a little tricky.

Remember the action can be just to log the event-- good way to test things 
on a production server before you start doing anything to the message!


Joseph Brennan
Columbia University Information Technology





More information about the MIMEDefang mailing list