I’ve just added Vipul’s Razor to my Mac OS X Server setup.
By using the excellent article at www.afp548.com on how to setup spam and virus filter on Mac OS X Panther Server using ClamAV and Amavisd, I managed to get it up and running on my server. But I also wanted to have Visul’s Razor installed to catch even more spam. So here is a description on how to get it to work. You need to first setup your server just like in the article to get this to work.
Download razor-agents and razor-agents-sdk tarball from here.
(or the version you downloaded)
Build it by using the following commands:
make
make test
make install
Go through and build razor-agents with the above instructions.
Now you should have razor installed, time to do some setup stuff.
We need to change the home directory for the user clamav to /var/amavis because Amavisd expects to find the .razor and .spamassassin folders there. If you have made a spamassassin database, you need to copy the .spamassassin to this location from the old home directory of user clamav.
This changes the home directory in the NetInfo database for user clamav.
Change to the clamav user:
And then do:
razor-admin -create
razor-admin -register
This sets up the symlinks, creates the /var/amavis/.razor directory and register a user.
and add this line:
Run SpamAssassin setup:
Edit the configuration file for SpamAssassin:
Add these lines:
bayes_path /var/amavis/.spamassassin/bayes
auto_whitelist_path /var/amavis/.spamassassin/auto-whitelist
We need to make some changes to Amavisd.
Find $sa_local_tests_only = 1;
and change it to $sa_local_tests_only = 0;
Now you can run amavisd in debug mode to see if razor is doing it’s job:
If everything looks good, stop by pressing ctrl-c and start up amavisd with:
To setup so amavisd starts at startup, create a folder at /Library/StartupItems called amavisd. Create a file called StartupParameters.plist and paste this into it:
// DNSUpdate2
//
{
Description = "amavisd";
Provides = ("Spamcheck email");
Requires = ("Network",
"Resolver");
OrderPreference = "Late";
Messages =
{
start = "Starting amavisd";
stop = "Stopping amavisd";
};
}
Then create a file called amavisd and paste the following into it:
. /etc/rc.common
ConsoleMessage "Starting Amavis anti-virus/spam daemon."
if [ ! -d /var/run/clamav ] ; then
mkdir /var/run/clamav
fi
chown clamav /var/run/clamav
/usr/bin/su clamav -c /usr/local/sbin/clamd
/usr/bin/su clamav -c amavisd
/usr/local/bin/freshclam -d -c 6 -l /var/log/clam-update.log
make sure that you set execute permissions of the amavisd file by doing:
chmod +x amavisd
You can find more information on configuring Vipul’s Razor here.