Enhancing E-Mail Security With Procmail

Obtaining and installing the sanitizer

Back to the home page

The current version of the sanitizer is: 1.132

It is recommended you update your copy if your version is older, as bugfixes and filtering for newer exploits will have been added. See the history of changes for details.

The Email Sanitizer procmail ruleset is available at:
[ HTTP Mirror 1 (USA: WA) | HTTP Mirror 2 (EU: NO) | HTTP Mirror 3 (AU) | HTTP Mirror 4 (AU) | RPM HTTP Mirror 1 (EU: SK) ]

The MD5 checksum of the current sanitizer is available for verifying your download. Check it after decompressing.

The Email Sanitizer procmail ruleset without Microsoft Office macro scanning is available at:
[ HTTP Mirror 1 (USA: WA) | HTTP Mirror 2 (EU: NO) | HTTP Mirror 3 (AU) | HTTP Mirror 4 (AU) ]

The MD5 checksum of the current no-macro-scanning sanitizer is available for verifying your download. Check it after decompressing.

The Opt-Out Preprocessor procmail ruleset is available at:
[ HTTP Mirror 1 (USA: WA) | HTTP Mirror 2 (EU: NO) | HTTP Mirror 3 (AU) | HTTP Mirror 4 (AU) ]

The current development snapshot of the Email Sanitizer procmail ruleset is available at:
[ HTTP Mirror 1 (USA: WA) | HTTP Mirror 2 (EU: NO) | HTTP Mirror 3 (AU) | HTTP Mirror 4 (AU) ]
CAUTION! The development snapshot must be considered BETA code. It may work, it may not, it may totally hose your mailserver. Approach with caution.

If you are downloading this on a Windows system for use on a Unix or Linux system, make sure that you take care of text-file conversion - the script will not run properly with DOS end-of-line characters in it. One way to do this is to open the sanitizer script in vi and type:

:textmode on
:textmode off
:wq
Also, if you edit the sanitizer in an editor that breaks long lines (for example, pico) the sanitizer will be corrupted.

A tarball of the ruleset and other useful files is available at:
[ HTTP Mirror 1 (USA: WA) | HTTP Mirror 2 (EU: NO) | HTTP Mirror 3 (AU) | HTTP Mirror 4 (AU) ]


Site Safety

If you're an administrator and you wish to sanitize all of your users' email automatically, here's how to do it:

Requirements

Installation under *nix and workalikes (Linux, *BSD, etc.)

  1. Create a directory /etc/procmail owner and group root, permissions rwxr-xr-x.

  2. Download the sanitizing ruleset and save it in that directory, owner and group root, permissions rw-r--r--. If you are using Lynx, highlight the link and press "D" to download the file - don't view it and save it, it'll be corrupted.

  3. Read the configuration instructions.

It is important to note the obvious: the sanitizer will only protect you against attacks in email messages that go through the mail gateway it's installed on. If your users are able to access external POP servers or web-based email systems, they may still receive and become victims of email worms and viruses.

Access to external POP servers can be blocked by your firewall, but the only way to defend against attacks via web email services is user education. Make your users aware that they may destroy a lot of valuable work and lose a lot of valuable time if they retrieve attachments from web email gateways. Suggest that they forward such messages to their work email address so that they get sanitized.


Troubleshooting

If you get Program failure (141) of "perl -p -e '... whenever the sanitizer tries to scan a document for macros, you need to make sure that mktemp and mimencode are properly installed. Add this to your /etc/procmailrc file for debugging:

LOG=`type mktemp`
LOG=`type mimencode`
If either program cannot be found, macro scanning will fail and crash the sanitizer.

If you get "Word too long" errors, try adding "SHELL=/bin/sh" or "SHELL=/bin/ksh" to /etc/procmailrc before the call to html-trap.procmail - csh can't handle a command-line argument the size of the Perl script that's in the filter.

Do not put html-trap.procmail into /etc/procmailrcs/ as implied by the procmail man page. You'll get security errors from Perl about -e and setuid scripts if you do this. You may also have problems with filtering mail sent to root for this reason.

It looks like this perl script can be a bit of a memory hog on some systems. If you start getting "Out of memory" errors in your procmail log file, try adding

ulimit -d 15000;
just before the perl -p -e in the MIME-sanitizing rule:
:0 fw
| ulimit -d 15000; perl -p -e ' #\
You might also have to increase the hard memory limit originally set for sendmail. Don't add this unless you get "Out of memory" errors.


Created with vi   Bobby approved   Best viewed with Any Browser

Mirror hosting generously provided by:

Thanks muchly!

$Id: sanitizer-download.html,v 1.21 2001-12-05 20:35:34-08 jhardin Exp jhardin $
Contents Copyright (C) 2001 by John D. Hardin - All Rights Reserved.