Best way to filter email attachments for multiple domains

Discussion in 'Server Operation' started by sank1800, Apr 1, 2009.

  1. sank1800

    sank1800 New Member


    I want to setup a email gateway to block different types of attachments (ex: exe, dll, bat, mov, mpeg etc..) for emails coming to different domains and then forward them with a message (append to the original message) to the down stream MTA using a single linux installation (no need to scan for viruses / SPAMs, however ability drop connections at RBL level is highly preferable because it'll reduce some load of the server).

    Can someone please suggest and provide configuration info to a such solution?

    If some one can come with a how to style doc that would be great. However detailed explanation is enough at the moment.

    Thanks in advance.
  2. topdog

    topdog Active Member HowtoForge Supporter

    Use mailscanner.
  3. sank1800

    sank1800 New Member

    thanks for the quick reply. however i have no experience with that product. i can setup postfix using Ubuntu and it would be great if you can kindly guide me from there.

    1) configure postfix for multiple domians (tutorials I see here use mysql database for domains and i think i might not need that because there will be few domains the system will be handling)

    2) configuring mailscanner with postfix to strip the attachments and append a message to the original mail.

    another question is can we configure postfix to accept emails without having us to create users in the local system?

    To be more clear the mail flow would be like this

    Internet --> proposed system (strips attachments on per domain basis)---> final MTA with inbuilt A/V , SPAM detection and user mailboxes.

    I know the setup is bit strange but unfortunately the final server DOES NOT support attachment blocking :(

    No issues with outbound email. they'll be directly sent by the email server with email boxes.

    thanks again
  4. topdog

    topdog Active Member HowtoForge Supporter

    Take a look at the spam snake howto on this site, it will give you pointers. Mailscanner is capable of doing spam filtering, blacklists and whitelists, message alteration, virus checks, rbl checks, attachment blocking the list goes on and on.

    You will have to read the documentation and look at the configs to run a proper system.
  5. topdog

    topdog Active Member HowtoForge Supporter

    You use the relay_domains option as well as an entry in the transport file to send the mail to the correct backend mail server.
  6. sank1800

    sank1800 New Member

    Thanks for all the answers and I was able to make the spam snake setup to work upto some level and now I need some instructions from you.

    1) How can I totally disable SPAM and Virus scanning and just filter the attachments?

    2) How can I configure attachments on per domain basis?

    3) Since it logs every thing to MySQL DB my guess is DB will grow quickly in an production environment. Is there any way we can clean the DB say every 5 days?

  7. sank1800

    sank1800 New Member

    Hi after some digging around the net I was able to solve 3 questions I had in the earlier post. However now there is another problem.

    Front end mail scanner (separate server) is configured to do attachment filtering only and then pass email to end server which has anti spam, anti virus and mail boxes (all 3 in same server). Now since spam filter is getting emails from the front end mail scanner RBL function is not working.

    Is there a way I can set postfix (or sendmail / qmail) with mail scanner in some sort of "transparent" manner so that I can take advantage of the RBL function in spam filter?

    thanks in advance

Share This Page