None of the tutorials I found online were complete or current. Here are the steps I took to upgrade my server’s installation of spamassassin, configured to use pyzor.
I tried MacPorts for most of this work, and despite the project’s best efforts, I think building by hand is far easier.
Obviously, you need a current installation of Apple’s developer tools installed. I used Xcode 3.1.2:
http://developer.apple.com/technology/xcode.htmlContinue by downloading the gdbm module:
ftp://mirrors.kernel.org/gnu/gdbm/Unpack and build it:
xserve:Downloads kalkwarf$ gunzip gdbm-1.8.3.tar.gz
xserve:Downloads kalkwarf$ cd gdbm-1.8.3
xserve:gdbm-1.8.3 kalkwarf$ ./configure
xserve:gdbm-1.8.3 kalkwarf$ make
xserve:gdbm-1.8.3 kalkwarf$ sudo make install
The installation script will fail while copying the header file into /usr/local/includes. I didn’t spend any time troubleshooting the script; I just did the work by hand:
xserve:gdbm-1.8.3 kalkwarf$ sudo cp gdbm.h /usr/local/include/
xserve:include kalkwarf$ sudo chmod 644 gdbm.h
Next, download Python 2.6.1:
http://python.org/download/releases/2.6.1/Unpack the distribution, and build it:
xserve:/ kalkwarf$ cd ~/Downloads/Python-2.6.1
xserve:Python-2.6.1 kalkwarf$ ./configure --with-gdbm
xserve:Python-2.6.1 kalkwarf$ make
xserve:Python-2.6.1 kalkwarf$ sudo make install
We’re going to leave the stock Python in place, and just execute this build when we need it, so check to be sure it works, and the gdbm module is accessible:
xserve:Python-2.6.1 kalkwarf$ /usr/local/bin/python -c 'import gdbm' && echo 'gdbm found'
You should be greeted with:
gdbm found
Now we’re ready to build a new spamassassin. Get the latest from:
http://spamassassin.apache.org/downloads.cgi?update=200806121419Build it:
xserve:Downloads kalkwarf$ open Mail-SpamAssassin-3.2.5.tar.bz2
xserve:Downloads kalkwarf$ cd Mail-SpamAssassin-3.2.5
xserve: Mail-SpamAssassin-3.2.5 kalkwarf$ perl Makefile.PL
xserve: Mail-SpamAssassin-3.2.5 kalkwarf$ make
At this point, I backed up the originals, and installed all the updated parts where the stock X Server parts live:
xserve: Mail-SpamAssassin-3.2.5 kalkwarf$ sudo mv /usr/bin/sa-compile /usr/bin/sa-compile_original
xserve: Mail-SpamAssassin-3.2.5 kalkwarf$ sudo mv /usr/bin/sigtool /usr/bin/sigtool_original
xserve: Mail-SpamAssassin-3.2.5 kalkwarf$ sudo mv /usr/bin/spamd /usr/bin/spamd_original
xserve: Mail-SpamAssassin-3.2.5 kalkwarf$ sudo mv /usr/bin/sa-learn /usr/bin/sa-learn_original
xserve: Mail-SpamAssassin-3.2.5 kalkwarf$ sudo mv /usr/bin/spamassassin /usr/bin/spamassassin_original
xserve: Mail-SpamAssassin-3.2.5 kalkwarf$ sudo mv /usr/bin/sa-update /usr/bin/sa-update_original
xserve: Mail-SpamAssassin-3.2.5 kalkwarf$ sudo mv /usr/bin/spamc /usr/bin/spamc_original
xserve: Mail-SpamAssassin-3.2.5 kalkwarf$ sudo mv sa-compile /usr/bin/sa-compile_original
xserve: Mail-SpamAssassin-3.2.5 kalkwarf$ sudo mv sigtool /usr/bin/sigtool_original
xserve: Mail-SpamAssassin-3.2.5 kalkwarf$ sudo mv spamd /usr/bin/spamd_original
xserve: Mail-SpamAssassin-3.2.5 kalkwarf$ sudo mv sa-learn /usr/bin/sa-learn_original
xserve: Mail-SpamAssassin-3.2.5 kalkwarf$ sudo mv spamassassin /usr/bin/spamassassin_original
xserve: Mail-SpamAssassin-3.2.5 kalkwarf$ sudo mv sa-update /usr/bin/sa-update_original
xserve: Mail-SpamAssassin-3.2.5 kalkwarf$ sudo mv spamc /usr/bin/spamc_original
Download Pyzor:
http://pyzor.sourceforge.net/Build and install it (note the explicit pointers to our new Python):
xserve:Mail-SpamAssassin-3.2.5 kalkwarf$ cd ~/Downloads/pyzor-0.4.0
xserve:pyzor-0.4.0 kalkwarf$ /usr/local/bin/python setup.py build
xserve:pyzor-0.4.0 kalkwarf$ sudo /usr/local/bin/python setup.py install
Next, use BBEdit (or your preferred editor) to change the #! line of the two pyzor executibles:
xserve:pyzor-0.4.0 kalkwarf$ bbedit /usr/local/bin/pyzor*
Change the 1st line to
#!/usr/local/bin/python -Wignore::DeprecationWarning
Now we’re ready to configure:
xserve:pyzor-0.4.0 kalkwarf$ bbedit /etc/mail/spamassassin/local.cf:
Add a line:
pyzor_options --homedir /etc/mail/spamassassin
Then prime pyzor:
xserve:pyzor-0.4.0 kalkwarf$ pyzor --homedir /etc/mail/spamassassin discover
Now, test the configuration. Copy a spam message to your Downloads folder, and execute spamassassin in Debug mode:
xserve:pyzor-0.4.0 kalkwarf$ spamassassin -D < ~/Downloads/spam.eml
Sift through the output, and with luck, you’ll find lines like these:
[24765] dbg: pyzor: pyzor is available: /usr/local/bin/pyzor
[24765] dbg: info: entering helper-app run mode
[24765] dbg: pyzor: opening pipe: /usr/local/bin/pyzor --homedir /etc/mail/spamassassin check < /tmp/.spamassassin24765rCqVrhtmp
[24769] dbg: util: setuid: ruid=1000 euid=1000
[24765] dbg: pyzor: got response: 82.94.255.100:24441 (200, 'OK') 1060 0
[24765] dbg: info: leaving helper-app run mode
[24765] dbg: pyzor: listed: COUNT=1060/5 WHITELIST=0
Please direct any corrections or comments to Steve Kalkwarf