DirectAdmin: Web control panel

Spam check using SpamAssassin

by ross at 07:23:18 on October 28, 2011

Install SpamAssassin

# cd /usr/ports/mail/p5-Mail-SpamAssassin
# make install clean
# cd /usr/ports/mail/sa-utils
# make install clean
# rehash

Add to /etc/rc.conf:

# Enable SpamAssassin
spamd_enable="YES"

Initialize and start SpamAssassin:

# razor-admin -d -create -home=/home/admin/.razor
# razor-admin -d -register -home=/home/admin/.razor
# chown -R admin /home/admin/.razor
# cd /usr/local/etc
# ln -s /home/admin/.razor/razor-agent.conf

Find razor-agent.conf in /home/admin/.razor and edit:

--- razor-agent.conf.orig       2011-08-17 13:22:06.000000000 +0300
+++ razor-agent.conf    2011-08-17 13:24:21.000000000 +0300
@@ -14,7 +14,7 @@
 listfile_catalogue     = servers.catalogue.lst
 listfile_discovery     = servers.discovery.lst
 listfile_nomination    = servers.nomination.lst
-logfile                = razor-agent.log
+logfile                = /home/admin/.razor/razor-agent.log
 logic_method           = 4
 min_cf                 = ac
 razordiscovery         = discovery.razor.cloudmark.com

Start spamd:

# mkdir /home/admin/.spamassassin
# chown admin /home/admin/.spamassassin
# sa-update
# /usr/local/etc/sa-spamd start

Enable spam checks

Uncomment spamcheck_director in /etc/exim.conf. Leave this line commented out:

#                       {exists{/home/${lookup{$domain}lsearch{/etc/virtual/domainowners}{$value}}/.spamassassin/user_prefs}} \

Adjust spamcheck transport, change transport_filter line:

  transport_filter = /usr/local/bin/spamc -u ${lookup{$domain}lsearch*{/etc/virtual/domainowners}{$value}}

Testing

Open test message and send it to your host from outside your network.

SpamAssassin wil create configuration files in /home/admin/.spamassassin. Edit user_prefs to meet your requirements, for example, to add [SPAM] to header of spam messages add:

rewrite_header Subject [SPAM]

 

Comments