• Skip to main content
  • Skip to primary sidebar
  • Skip to footer
Michele Neylon :: Pensieri

Michele Neylon :: Pensieri

Technology, Marketing, Domains, Thoughts

Content Filtering with MailScanner – Part 1 – File Types

June 29, 2005 by Michele Neylon 2 Comments

Mailscanner allows for a very fine level of control over email content and security via its configuration and ruleset files. This article shall look at setting up per user or per domain rules for file types.
It is based on my experience with MailScanner on RPM based systems, however it should work on any system running a standard install of MailScanner.
Why would this be of interest?
If you are scanning mail for multiple domains and companies you may wish to impose restrictions on certain file types for particular users or, as is more often the case, these restrictions will be forced on you.
Getting Started
If the server is in production you may want to stop MailScanner processing mail while you make the changes to its configuration:
/etc/init.d/MailScanner stop;/etc/init.d/MailScanner starting
This will stop MailScanner and then restart its “in” queue, so mail will “sit” in the inbound queue.
Open MailScanner.conf in vi:
vim /etc/MailScanner/MailScanner.conf
Look for the line :
Filename Rules = %etc-dir%/filename.rules.conf
In order to make this a ruleset which you can control you should change this to something like:
Filename Rules = %etc-dir%/filename.rules
in /etc/MailScanner you need to create the actual ruleset file.
The way I did it was:
FromOrTo: default /etc/MailScanner/filename.rules.conf
FromOrTo: *@domain1.ie /etc/MailScanner/filename.rules.domain1.conf
FromOrTo: *@domain2.com /etc/MailScanner/filename.rules.domain2.conf

The first file:
/etc/MailScanner/filename.rules.conf
is the one that ships with MailScanner (with or without sidewide modifications).
The other file(s) contain domain/user specific directives.
For example, one of our clients asked us to block ALL zip files, so the custom ruleset contained one minor, but important, difference:
deny \.zip$ - -

If you have been “hacking” MailScanner for a while you will know that you can specify rules to apply to an entire domain:
*@domain.tld or a specific user: user@domain.tld
You could also do it using something like:
From user1@domain.tld and To user2@domain.tld
The README is helpful:
As you can see, each rule has 3 fields:
1. Direction (or "Virus:")
2. Pattern to match
3. Result value (or values)
or 6 fields:
1. Direction 1 (or "Virus:")
2. Pattern to match
3. The literal word "and"
4. Direction 2 (or "Virus:")
5. Pattern to match
6. Result value (or values)

Your mileage may vary 🙂

Related Posts:

  • 354334260_845474640516872_6304621654479892179_n
    Concerts and More
  • computer-code-screens
    Dodgy WordPress Developer Tactics
  • ACDC-Dublin-Ticketmaster-Q
    The "Joys" of Acquiring Concert Tickets
  • Michele-Fest
    If my Music Taste was a Festival ...
  • privacy-keyboard-keys
    My Privacy Has Been Sold
  • 369584561_1455658008621564_5818380236101618364_n
    Jam and Chutney Season

Filed Under: MailScanner, Open Source, Spam Filtering, Techie :: Techno ::

Michele is founder and CEO of Irish hosting provider and domain name registrar Blacknight. Read More…

Reader Interactions

Comments

  1. JulesFM says

    August 13, 2005 at 6:36 pm

    There is an easier way to do this, that saves you a lot of administrative time in the long run, as well as being quicker to set up now.
    It is all explained in the new version of the MailScanner Book, just go buy a new copy 🙂

  2. blacknight says

    August 15, 2005 at 8:21 am

    Julian
    Nice plug for your book 🙂

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Primary Sidebar

dotblog founder

Mastodon

Archives

  • Bluesky
  • Instagram
  • Threads
  • Twitter

Pages

  • About Me
  • About This Site
  • Archives
  • Comments Policy
  • Contact Me
  • Newsletter
  • Privacy

Blogroll

  • Stewart Curry
  • Blacknight Blog
  • Technology.ie Podcast
  • My Mastodon
  • Gianni Ponzi

Stalking Links

Subscribe to Michele Neylon :: Pensieri

Blogroll

  • Blacknight Blog
  • Damien Mulley
  • Gianni Ponzi
  • Gordon Hudson
  • Grandad
  • My Mastodon
  • Paul Savage – BlackDog SEO
  • Stewart Curry
  • Technology.ie Podcast
  • Tom Doyle

Sites

  • Business Travel Tips
  • Discount Coupon Codes
  • Domain News
  • Fat.ie – my diet blog
  • Film Posters
  • Film Reviews
  • Films
  • Free Desktop Wallpapers
  • Irish Blogger Discussion Forum
  • Irish Stamps
  • Movie Trailers and News
  • Paste.ie

Footer

Site hosted in Ireland by Blacknight - Content copyright Michele Neylon

Copyright © 2025 · Magazine Pro on Genesis Framework · WordPress · Log in