Unjunkmgr

From SME Server
Revision as of 21:29, 26 August 2008 by Knuddi (talk | contribs)
Jump to navigation Jump to search

Description

I have for a long time had ”customers” that POP’ed emails from my servers and that therefore did not have a good chance to see and/or retrieve emails that had been sorted to the junkmail folder by SpamAssassin.

I have therefore made a junkmail manager that on a weekly basis sends out a summary email to all users with a list of emails that have been sorted into the junkmail folder the recent week.

If the user wishes to get one of these emails sent to the users inbox he/she can push the “UnJunk” link to the left. The system will, if UnJunk is pressed, teach SpamAssassin via the “sa-learn” command that this can be considered as “ham” next time. This means that it’s more likely that an email from this sender or with this content will pass the spam check next time.

 

Installation

The package needs the Perl-MIME-Lite package to be able to send out HTML formatted emails.

yum install perl-MIME-Lite --enablerepo=smecontribs
yum install mrtg

Then install the sme-unjunkmgr RPM from (I will get around and release to contribs later):

rpm –Uvh http://sme.swerts-knudsen.com/downloads/unjunkmgr/sme-unjunkmgr-1.0.0-1.noarch.rpm

De-installation or de-activation: You can simply remote the package again with the usual rpm command

rpm –e sme-unjunkmgr-1.0.0-1

or disable the functionality with:

/sbin/e-smith/db configuration set unjunkmgr service enabled yes

Configuration

The SpamAssassin learning does require that the SpamAssassin bayes filters have been enabled though. How this is done can be read at http://wiki.contribs.org/Email#Setup_Blacklists_.26_Bayesian_Autolearning or through these few shell commands.

config setprop spamassassin UseBayes 1
config setprop spamassassin BayesAutoLearnThresholdSpam 4.00
config setprop spamassassin BayesAutoLearnThresholdNonspam 0.10
expand-template /etc/mail/spamassassin/local.cf
sa-learn --sync --dbpath /var/spool/spamd/.spamassassin -u spamd
chown spamd.spamd /var/spool/spamd/.spamassassin/bayes_*
chown spamd.spamd /var/spool/spamd/.spamassassin/bayes.mutex
chmod 640 /var/spool/spamd/.spamassassin/bayes_*
config setprop spamassassin status enabled
signal-event email-update

The UnJunk Manager also collects statistics on the emails passing through the mail server. This is accessible from:

http://your.domain.com/unjunkmgr

This web page can by default only be seen from the local network (IP ranges defined in Local Network in the server-manager) but if you want this to be accessible from remote networks (public access) this can be done via:

/sbin/e-smith/db configuration setprop unjunkmgr LocalOnly <no|yes>

 

An additional feature of the UnJunk Manager is to send the collected statistics to a central statistics central at http://central.swerts-knudsen.dk. The gathering of data is not stressful for the server and the data sent is not sensitive (well in my opinion) and consists of: - amount of emails scanned - number of spam infected or virus infected emails - if virus infected the name of the virus found - the version of SME server used

Should you want to disable this functionality then this can obviously be done:

/sbin/e-smith/db configuration setprop unjunkmgr statsclient <disabled|enabled>

Today around ~850 servers still active with my sme-spamfilter contrib and ~450 servers using my sme-antivirus for SME 6x send in data for this “worldwide overview”.

 

FAQ

  1. How do I see what this Summary of Junkmail looks like without sending to all my users?
    • You will need to change the “$debug = 0;” to “$debug = 1;” in the configuration section of the /usr/local/unjunkmgr/spamreminder.pl file. Then launch the reminder manually with:
/usr/local/unjunkmgr/spamreminder.pl

All the summary emails will now be sent to “admin”.