Tuesday, December 4, 2007

Filter attachments (.bat, .exe, etc..) in postfix

Simple, In /etc/postfix/main.cf enable the body checks with this line:

body_checks = pcre:/etc/postfix/body_checks

Now put something in this file (/etc/postfix/body_checks):

/^(.*)name=\”(.*).(hta|vb[esx]|ws[fh]|js[e]|bat|cmd)\”$/ REJECT

This will filter attachments of various types. Remove from the above line,

whatever you want to allow.Of course you can add some more lines to make postfix a simple spam filter:

/special offer email/ REJECT
/mortgage rates/ REJECT
/other spam mail subjects/ REJECT

0 comments:

Post a Comment

Linuxpoison Archive

Add to Technorati Favorites http://www.wikio.com Software Computers blogs TopOfBlogs Unix-Linux Blogs Computers (Software) - TOP.ORG Computer Software Blog Directory Computer Blogs - Blog Catalog Blog Directory Blog Flux Directory Technology Blogs - Blog Rankings

Copying and distribution of the articles is permitted in any medium as long as the author and source are quoted.
E-mail contact: njauhari@cybage.com
All trademarks are the property of their respective owners.