Block attachments with Postfix
MSH Attach Filter is not supported now. To manage attachments please try MSH Traffic Policy application.
With MSH Attach Filter milter application you can block or remove any attachment you want.
You can also:
- filter by attachment name, content type, size
- add, remove and compress attachments
- block message with suspicious files
Block message with certain attachments
First way is to block email containing specified attachments.
You need to define blocking action:
<block-message type="discard"/>
And one condition which will execute block message action. In this example it will block attachments with extensions: bat, com, exe, dll and vbs.
<attach-name value="*.bat;*.com;*.exe;*.dll;*.vbs">
Remove attachments from message
Another solution is to only remove attachments from message without block email.
It is even simpler because you need only define one action. This time it will remove attachments greater than 1 MB:
<attach-remove-size value="1" unit="mb" cmp="gt"/>
This was a simplest configuration when you need to dump attachment from messages.