toaster_setup.pl home : internet : mail : toaster : custom programs : toaster-watcher.pl watcher history

toaster-watcher.pl

toaster-watcher does several unique and important things.

Dynamic Configuration:

toaster-watcher.pl reads a configuration file that stores settings about your mail system. Once you've configured toaster-watcher.conf to suit your needs, the script goes about making sure all the settings on your system are as you selected. Various other scripts (like toaster_setup.pl) and programs use this configuration file to determine how to configure themselves and other parts of the mail toaster solution.

Service Monitoring:

Toaster-watcher.pl dynamically builds the run files for your qmail daemons (qmail-smtpd, qmail-send, and qmail-pop3). You choose your settings in toaster-watcher.conf and toaster-watcher.pl builds your run files for you, on the fly. It periodically (set via cron) tests the RBL's you've selected to use, and builds a control file based on your settings and dynamic information such as the availability of the RBLs you want to use.

If a RBL you selected is unavailable, it removes it from your config and emails you a notice. It will automatically add it back in when it becomes available.

As of Mail::Toaster 4.06, toaster-watcher also checks to make sure your critical daemons are running, like Apache, MySQL, clamd, httpd, etc).

Qmail-Scanner Quarantine Processing

Qmail-Scanner quarantines any files that fail certain tests, such as banned attachments, Virus laden messages, etc. The messages get left laying around in the quarantine until someone does something about it. If you enable this feature, toaster-watcher.pl will go through the quarantine and deal with messages as you see fit.

When I used qmail-scanner, I had mine configured to block the IP (for 24 hours) of anyone that's sent me a virus and delete the quarantined message. I run toaster-watcher.pl from cron every 5 minutes so this usually keeps virus infected hosts from sending me another virus laden message for at least 24 hours, after which we hope the owner of the system has cleaned up his computer.

Maildir Processing & Message Cleanup

Many times its useful to have a script that cleans up old mail messages on your mail system and enforces policy. Now toaster-watcher.pl does that. You tell it how often to run (I use every 7 days), what mail folders to clean (Inbox, Read, Unread, Sent, Trash, Spam), and then how old the messaged need to be before you remove them.

I have my system set to remove messages in Sent folders more than 180 days old and messages in Trash and Spam folders that are over 14 days old.

Spam Learning

I have also instructed toaster-watcher to feed any messages in my Spam and Read folders that are more than 1 day old through sa-learn. That way I train SpamAssassin by merely moving any mis-directed spam or ham into their respective IMAP folders.

Rebuild qmail-smtpd's SSL temp keys

The version of qmail included with Mail::Toaster support the TLS extensions for SSL encryption of SMTP connections. For maximum efficiency, the implementation requires that temporary SSL keys are rebuild daily. toaster-watcher.pl does this for you automatically.

TODO

Make email notice configurable on a per service basis. I can imagine wanting to know if pop3/run or send/run ever changed but I don't care to get emailed every time a RBL fails a DNS check.

Feature request by David Chaplin-Leobell: check for low disk space on the queue and mail delivery partitions. If low disk is detected, it could either just notify the administrator, or it could do some cleanup of things like the qmail-scanner quarantine folder.

DEPENDENCIES

This module requires the Net::DNS perl modules to test the RBLs.


sub-sections
watcher history
changes-watcher

Last modified on 4/28/05.