KMS (Kerio Mail Server) comes with the Spamassassin spam protection. Although not officially supported by Kerio, you can change spamassassin by modifying the spamassassin rules and config files. On Windows, all the important files are in
Before you change anything, you should definitely backup all files in this directory!
The .cf files contain the rules and the scores. They are plain text and you can change them, but you have to know what you are doing. You can also add new ones, for example 80_MyAntiSpamRules.cf. You need to restart the KMS Mail services to make the changes effective.
Spamassassin comes with three modules that are based on check-sums of mails: Pyzor, Razor2 and DCC. But they are not enabled in KMS. Unfortunately, it is not just a matter of enabling them as the executables for them are missing.
So I spent about 5 hours to figure out how I could get DCC to work (I chose DCC because I don't need Python on my system for it to work).
What is DCC?
The DCC or Distributed Checksum Clearinghouse is a system of servers collecting and counting checksums of millions of mail messages. The counts can be used by SpamAssassin to detect and reject or filter spam. See http://www.rhyolite.com/anti-spam/dcc/ for details.
I had to do the following steps to get in to work on Windows (similar steps on Unix and Mac, I guess):
- Download SpamAssassin for Win32 command-line tools from http://sawin32.sourceforge.net/ and unzip it to c:\sa
- Make sure that you c:\sa\dccproc.exe is in place. This is the main executable for DCC.
- Open a cmd prompt and type
cd "Documents and Settings\Default User"
- Important: On a 64-bit Windows 2008 R2 server, the path is: C:\Windows\SysWOW64\config\systemprofile\.spamassassin
- Copy the "map" file from C:\sa\etc\dcc to C:\Documents and Settings\Default User\.spamassassin This file contains the servers that can be contacted for Spam checksums.
- Locate and open C:\Program Files\Kerio\MailServer\plugins\spamassassin\rules\local.cf
- Add the following lines:
# Use DCC
add_header all DCC _DCCB_: _DCCR_
- Remove the following line
score DCC_CHECK 0
- In the same directory, open the v310.pre file and uncomment the following line
- Restart KMS
- Also note that DCC requires that you open your firewall for DCC reply packets on UDP port 6277. Here's sample firewall rules required:
allow udp local gt 1023 to remote 6277
allow udp remote 6277 to local gt 1023
From now on you should see an entry in the headers of your incoming mails (if DCC detects it as spam):
The score depends on what you have defined in 50_scores.cf
Update: This has also been tested on Kerio Connect 7.3 and it is working.
Update 2: According to John's post below, to make DCC work in Kerio Connect 7.4, you have to add some lines to Util.pm in addition to the steps above. For details, see John's post below. Thanks John for that!
Update 3: This also works in Kerio Connect 8.0.