DMZ Services, Inc.
 [DMZS/Tools/Files/Spam]
News-Info | Services |  Tools 
 Files 
Forensics
Monitoring
Network
Password
Spam
Wireless
SPAM Tools

Date: March 19, 2004
Author: David M. Zendzian (dmz)
File: DMZS-sa-learn.pl
Desc: sa-learn is a perl script that reads 2 imap folders, spam & not-spam and processes them through SpamAssassin sa-learn to learn bayesian classifications.

With many people all utilizing the same mail resources, a method for integrating the learning of all users spam that wasn't flagged properly was needed. Searching google I found several good resources on setting up & using imap and sa-learn, however all (that i have found) have the processing happen assuming Spamassassin & the imap server were located on the same machine. If you have a secured network or a large network, you will most likely have your MTA/Virus/Spam functions on separate servers from the users mail servers.

To solve this problem I integrated perl Mail::IMAPClient into a quick script that works with sa-learn. This allows your spamassassin host to be any server and connect to one (or many, easily modified...hmm) central imap server(s) and process spam & ham classifications according to the users of those systems.

SETUP
To setup, you will first need to create 2 public shared folders on your imap server, one called spam & the other not-spam

If you need more help on setting up shared folders, one of the sites that got me motivated has a good set of instructions on setting up shared folders (as well as scripts to do this same function if SA & imap are on same server. Although I'd argue that direct map connection will help reduce any likelyhood of folder corruption on busy servers: SLOXHelp.org)

You then need to edit sa-learn.pl & set your imap settings. I haven't looked at integrating TLS yet, so I create an encrypted tunnel from the imap server to the spamassassin server (stunnel or ssh: ssh -T -n -C -x -q -N -R 1143:localhost:143 If the script doesn't run properly, check the server/port/user/password manually (mutt or telnet works good here:), then be sure you've set the bayes_path in local.cf. There is also a debug flag you can turn on in the script.

Also, be sure to monitor system usage and schedule the script accordingly

All content © by DMZ Services, Inc. & Whomever is listed in association with DMZ Services, Inc. All else GNU| Hosting with ZZServers

Search dmzs.com Search WWW Search wesecurethe.net Search airinter.net