My current setup:
- Dell Inspiron 8200 - Mobile Intel 4-M(1.7GHz), 1GB Ram
Windows XP Professional SP2
hMailserver 4.2 build 174 (MySQL v.4.1.13-nt)
Cygwin 1.5.18-1
1. Install Cygwin (Install from http://www.cygwin.com)
2. Install these packages through the CYGWIN package installer: (Shown are the versions I used)
- BASE
----ALL packages under this category
INTERPRETERS
-----Perl 5.8.7-4
DEVEL
-----GCC core 3.4.4-1
-----Make 3.80-1
-----GCC-MingW core 20050522-1
-----Binutils 20050610-1
NET
-----Inetutils 1.3.2-30
DATABASE
-----libdb3.1 Sleepycat 3.1 Berkeley DB Devel
-----libdb3.1 Sleepycat 3.1 Berkeley DB Runtime
ADMIN
-----cygrunsrv
4. Type "cpan" then hit return. Then, at the cpan prompt, type the following lines followed by return: (Mostly it is pretty much automatic with little prompting. Note that some packages will ask to install additional packages.)
- install DB_File
install Time::HiRes
install Net::DNS (Say NO to network tests!)
install HTML::Parser
install Digest::SHA1
install MIME::Base64
install Mail::SPF::Query (if using SPF plugin)
install IP::Country::Fast (if using relaycountry plugin)
INSTALLING SPAMASSASSIN
- 1. Download SpamAssassin 3.1.0 from http://www.spamassassin.org (Note: You CAN install SpamAssassin using CPAN. Not tested by me though)
2. Unzip the SpamAssassin source to your cygwin home directory (i.e. C:\cygwin\home\username )
3. Open a Cygwin prompt and CD to the SpamAssassin source directory.
4. Type the following commands:
Code: Select all
perl Makefile.PL
make
make install
My advice here is to make minimal changes until you have SpamAssassin/SpamD operating properly. Having said that here are the locations of the config files:
- C:\cygwin\etc\mail\spamassassin\local.cf (for general configuration)
C:\cygwin\home\username\.spamassassin\user_prefs (for per user configuration)
C:\cygwin\etc\mail\spamassassin\init.pre (for loading of some plugins)
C:\cygwin\etc\mail\spamassassin\v310.pre (for loading version 3.1 specific plugins)
Code: Select all
# General Parameters - see SA docs for explanation
report_contact postmaster@yourdomain.com
dns_available test
# Bayes
use_bayes 1
# Miscellaneous Entries
auto_whitelist_path /cygdrive/c/cygwin/home/username/.spamassassin/auto-whitelist
auto_whitelist_file_mode 0700
bayes_path /cygdrive/c/cygwin/home/username/.spamassassin/bayes
bayes_file_mode 0700
TESTING
Run the following test from a cygwin prompt to determine spamassassin is operating properly. Examine the output closely and try to correct any errors before making any further modifications.
Code: Select all
spamassassin -D --lint
Code: Select all
spamassassin -tD < sample-nonspam.txt
spamassassin -tD < sample-spam.txt
- 1. Open hMailserver Administrator and enable scripting. (Settings; Advanced; Scripts, check "Active")
2. Click on the box labeled "Show Scripts" and then open the file "Eventhandlers.vbs" for editing.
3. Remove the tick ' from in front of the section "Sub OnDeliverMessage(oMessage)"
4. Replace or edit the section "Sub OnDeliverMessage(oMessage)" to add the following:
Code: Select all
Sub OnDeliverMessage(oMessage)
fname = oMessage.filename
Dim infile, testfile, sh
Dim fso
Set fso = createobject("Scripting.FileSystemObject")
If Not fso.fileexists(fname) then
result.Value = 0
Exit sub
End If
infile = fso.getabsolutepathname(fname)
testfile = infile & ".tmp"
fso.CopyFile infile, testfile
Set sh = CreateObject("WScript.Shell")
'CALL SPAMASSASSIN
Dim cmd, rc
cmd = "cmd /c perl -S -T -w spamassassin < """ & testfile & """ > """ & infile & """"
rc = sh.Run( cmd , 0 , TRUE)
result.Value = 0
fso.Deletefile testfile
Set fso = Nothing
End Sub
This is the way to go if you are looking for speed at the expense of memory. Instead of loading a new instance of SpamAssassin for each scan, 5 (configurable) instances are preloaded and are accessed as required. Instead of calling SpamAssassin directly we will use a client, SpamC, to communicate with the SpamD service. I prefer to run SpamD and SpamC with the -u option (username). This gives me a site-wide config with far less issues /permissions problems.
- 1. Install the cygwin package cygrunsrv
2. Install spamd as a service with the following command:
Code: Select all
cygrunsrv -I SpamD -p /usr/bin/spamd -a "-l -s /var/log/SpamD.log --round-robin"
EDIT: I removed -u username from the command. This is not really required and caused some problems for some users.
- -l This allows you to use spamc to learn a msg as ham, spam, or to forget what it previously learned.
-s This sets the log path to C:/cygwin/var/log/spamd.log
-u This sets the user that is running spamd (set username as required)
--round-robin Use the old style spawn method
- 1. Open hMailserver Administrator and enable scripting. (Settings; Advanced; Scripts, check "Active")
2. Click on the box labeled "Show Scripts" and then open the file "Eventhandlers.vbs" for editing.
3. Remove the tick ' from in front of the section "Sub OnDeliverMessage(oMessage)"
4. Replace or edit the section "Sub OnDeliverMessage(oMessage)" to add the following:
(note: change username to the username running SpamD)
Code: Select all
Sub OnDeliverMessage(oMessage)
fname = oMessage.filename
Dim infile, testfile, sh
Dim fso
Set fso = createobject("Scripting.FileSystemObject")
If Not fso.fileexists(fname) then
result.Value = 0
Exit sub
End If
infile = fso.getabsolutepathname(fname)
testfile = infile & ".tmp"
fso.CopyFile infile, testfile
Set sh = CreateObject("WScript.Shell")
'CALL SPAMASSASSIN
Dim cmd, rc
cmd = "cmd /c spamc -E -u username < """ & testfile & """ > """ & infile & """"
rc = sh.Run( cmd , 0 , TRUE)
result.Value = 0
fso.Deletefile testfile
Set fso = Nothing
End Sub
Before Bayes features kick in, SpamAssassin must be trained with at least 200 msgs each of Spam and Ham. Some experimentation may be required on your part in order to find the best way to do this, but to give you an idea, here is one way to do it:
- 1. Create two directories, one for Ham and one for Spam
2. Carefully sort and then place 200 minimum messages of each type into the directories.
3. Run the following commands from a cygwin prompt: (modify as required)
Code: Select all
sa-learn --ham -u username --progress /cygdrive/c/path/to/ham/folder
sa-learn --spam -u username --progress /cygdrive/c/path/to/spam/folder
Code: Select all
sa-learn --spam -u username --progress /cygdrive/c/Spam
Afterwards, running the following command should give you a somewhat cryptic status of your Bayes database:
Code: Select all
sa-learn --dump magic
ADDING OTHER SA FEATURES
I'm currently running with SpamD and the following plug-ins enabled with no problems. Note that some of these require installation of additional Perl modules in order to work:
- Hashcash
SPF
URIDNSBL
RelayCountry
Antivirus (note: this is not an antivirus replacement)
AWL
Textcat
AutolearnThreshold
WhiteListSubject
DomainKeys
MIMEHeader
ReplaceTags
- Per user Bayes settings utilzing MySQL DB (I haven't tried yet, not enough users)
DCC
Pyzor
SpamCop reporting
ClamAV integration