Installing / Enabling SpamAssassin on DirectAdmin

By default SpamAssassin is not enabled nor installed on a system with DirectAdmin.

I wrote a very simple How-To to install SpamAssassin.

Install SpamAssassin:

# cd /usr/local/directadmin/scripts
# ./

Probably you will get some Perl error like:

REQUIRED module out of date: Archive::Tar
optional module missing: Digest::SHA
optional module missing: Mail::SPF
optional module missing: IP::Country
optional module missing: Razor2
optional module missing: Net::Ident
optional module missing: IO::Socket::INET6
optional module missing: Compress::Zlib
optional module missing: Mail::DKIM
optional module missing: LWP::UserAgent
optional module missing: HTTP::Date
optional module missing: Encode::Detect

warning: some functionality may not be available,
please read the above report before continuing!

make: *** No targets specified and no makefile found.  Stop.
make: *** No rule to make target `install’.  Stop.
Cannot find /usr/bin/sa-update after install. Check for errors above.

This means that there are missing Perl modules, those are very easy to install:

# PERL_MM_USE_DEFAULT=1 cpan -i Archive::Tar Digest::SHA Mail::SPF IP::Country Net::Ident IO::Socket::INET6 Compress::Zlib Mail::DKIM LWP::UserAgent HTTP::Date Encode::Detect

Then run again.

If it is asking you the following questions, please answer with no:

Are you ready for manual configuration? [yes] no

SpamAssassin is now installed! Next we have to start it:

/usr/bin/spamd -d -c -m 15

If SpamAssassin is started without any problems we have to configure exim to work with SpamAssassin.
Open /etc/exim.conf, and remove the underlined #‘s.

# Spam Assassin
# driver = accept
# condition = “${if and { \
# {!def:h_X-Spam-Flag:} \
# {!eq {$received_protocol}{spam-scanned}} \
# {!eq {$received_protocol}{local}} \
# {exists{/home/${lookup{$domain}lsearch{/etc/virtual/domainowners}{$value}}/.spamassassin/user_prefs}} \
# {<{$message_size}{100k}} \
# } {1}{0}}”
# retry_use_local_part
# transport = spamcheck
#  no_verify

Now it will look like:

# Spam Assassin
driver = accept
condition = “${if and { \
{!def:h_X-Spam-Flag:} \
{!eq {$received_protocol}{spam-scanned}} \
{!eq {$received_protocol}{local}} \
{exists{/home/${lookup{$domain}lsearch{/etc/virtual/domainowners}{$value}}/.spamassassin/user_prefs}} \
{<{$message_size}{100k}} \
} {1}{0}}”
transport = spamcheck

Save and exit. Last thing we have to do is restarting exim:

# service exim restart

Have fun!