the following script is intended for use with maildirs and the f-prot virus scanner. It uses qmail-inject to mail reports although this can easily be changed. I wrote it because I wanted something that would purge infected items from my user's maildirs, quarantine them and mail a nice report.

Be warned: I knocked this together really quickly. There're quite a few dirty hacks in it, not nearly enough sanity checks, not enough comments, use of global variables when I could have made them local with more effort and lots of other things could be done better than they are. I may update it, but then I might not and leave it to you! Having said that, it's worked well enough for me so far and I figured Tips'n'Tricks would be somewhat enriched by it.

On the plus side, a lot of it is configurable. You need to set the vars near the top which control respectively:

From address on emailed report

Your local domain

Administrator's email address (who always gets the report as well as the scanned user)

A unix group which is used to determine which users should have their maildirs scanned. You must specify one.

Location of your home directories.

Maildir naming convention

Where you want f-prot to put the scan logs, which the script subsequently parses.

Options to pass to f-prot

At the moment it's hardcoded to move any infected mail items into /quarantine/username, and it's not yet smart enough to make the appropriate username directory so you'll have to make them yourself first. Need to change that soon. Anyway, you're all set after that. So here it is: