5.3 Scanning e-mails at mail delivery

This section applies to F-PROT Antivirus for UNIX Mail Server version only

To configure procmail to reroute all e-mail through scan-mail.pl, type the following in a procmailrc file, either /etc/procmailrc (for adding e-mail scanning globally for the local mailsystem) or ~/.procmailrc (for individual user configuration):

> :0 fw
> | /opt/f-prot/mailtools/scan-mail.pl

scan-mail.pl has a -backup command-line option, which instructs it to keep a copy of each letter before scanning it. To utilize this, change the procmailrc line to:

> :0 fw | /opt/f-prot/mailtools/scan-mail.pl -backup

Since mail processing is a resource intensive task, you might experience problems with scan-mail.pl running out of resources when there is heavy incoming e-mail traffic. Therefore, error checking of the return value of scan-mail.pl is a good idea. The rule below will deliver the mail to /opt/f-prot/backup/FAILED.* if the scanners' return value indicates failure. Place it below the scan-mail.pl rule for the desired effect:

> :0 fw
> | /opt/f-prot/mailtools/scan-mail.pl
> :0 e
> /opt/f-prot/backup/FAILED.`date +%s`.$$

If you want to avoid running out of resources due to too many instances of scan-mail.pl running, you might try using locks. Below is an example of how to make procmail run only one instance of scan-mail.pl at a given time, using a lockfile called /var/tmp/scan-mail.pl.lock:

> :0 fw:/var/tmp/scan-mail.pl.lock
> /opt/f-prot/mailtools/scan-mail.pl

Scan-mail.pl uses only a portion of the features Anomy has to offer, i.e. the defanging and sanitizing features are pretty much left unused by default. Please read http://mailtools.anomy.net/sanitizer.html and the man page for scan-mail.pl as well as the configuration files these use for information on how to configure scan-mail and Anomy for more thorough and complex operations.

Back to Index

Copyright © 2007 FRISK Software International. All rights reserved