How to enable SpamAssassin on your server.


Enter Your Query:
Use '%' for wildcards and quotes for "exact phrases"


Top Level » Email » Spam

How to enable SpamAssassin on your server.Last Modified: Aug 1, 2013, 1:24 pm
To enable Spamassassin on your server, you need to first need to install it.  Once installed a few minor changes are needed in your /etc/exim.conf file.



1) Install spamd and spamc:

cd /usr/local/directadmin/scripts
./spam.sh

If you get errors building spamd relating to missing perl modules, try using cpan to install them.

If you have never run cpan before, set cpan to follow prerequisites, to speed up the process:

[server]# cpan
cpan> o conf prerequisites_policy follow
cpan> o conf commit

Then install the required modules:

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 ExtUtils::MakeMaker NetAddr::IP Mail::SpamAssassin::Plugin::Razor2 Razor2::Client::Agent IO::Socket::SSL DBI

and then run the spam.sh again.

If it asks you:

Are you ready for manual configuration? [yes] no

be sure to type "no" and press enter.  Only use "yes" if you really know what you're doing.  The default options are going to be the most reliable.


Or, as an alternative to using cpan, CentOS boxes can use this:

yum -y install perl-ExtUtils-MakeMaker perl-Digest-SHA perl-Net-DNS perl-NetAddr-IP perl-Archive-Tar perl-IO-Zlib perl-Digest-SHA perl-Mail-SPF perl-IP-Country perl-Razor2 perl-Net-Ident perl-IO-Socket-INET6 perl-IO-Socket-SSL perl-Mail-DKIM perl-DBI perl-Encode-Detect perl-HTML-Parser perl-HTML-Tagset perl-Time-HiRes perl-libwww-perl



2) Start the spamd:

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


3) In order to get exim to use the spamd program, you'll need to make some changes in your /etc/exim.conf.  Change:

# Spam Assassin
#spamcheck_director:
#  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

to

# Spam Assassin
spamcheck_director:
  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


4) Restart exim:
Redhat:

/sbin/service exim restart


FreeBSD:

/usr/local/etc/rc.d/exim restart





The global spamassassin config file is in /etc/mail/spamassassin/local.cf

If you run debian and are missing perl or some pm files, type:

apt-get install perl-base perl-modules






A recent issue that has just appeared (Dec 2012) is this error:

http: GET 3.3 request failed: 400 URL must be absolute: 400 URL must be absolute
error: no mirror data available for channel updates.spamassassin.org
channel: MIRRORED.BY contents were missing, channel failed

With a reported solution being

cd /root
wget http://files1.directadmin.com/services/custombuild/Mail-SpamAssassin-rules-3.3.2-r1104058.tar.gz
wget http://files1.directadmin.com/services/custombuild/Mail-SpamAssassin-rules-3.3.2-r1104058.tar.gz.asc
wget http://files1.directadmin.com/services/custombuild/Mail-SpamAssassin-rules-3.3.2-r1104058.tar.gz.md5
wget http://files1.directadmin.com/services/custombuild/Mail-SpamAssassin-rules-3.3.2-r1104058.tar.gz.sha1
/usr/bin/sa-update --install Mail-SpamAssassin-rules-3.3.2-r1104058.tar.gz
/usr/bin/sa-update --nogpg


 
Related Helpfiles
Spamassassin : Can't locate HTML/Parser.pm in @INC
How to update your exim.conf
How to enable SpamAssassin for new accounts
How to enable realtime blocklists (RBLs) with exim
Change SpamAssassin to only scan local mailboxes
Can't locate ExtUtils/MakeMaker.pm in @INC
SpamAssassin: spamd[1234]: Can't locate version.pm in @INC
Can't locate LWP/UserAgent.pm in @INC
SpamAssassin isn't working
Can't locate Archive/Tar.pm in @INC
How to create a cronjob to use sa-learn to teach spamassassin - Maildir
REQUIRED module missing: NetAddr::IP

2003 JBMC Software, Suite 173  3-11 Bellerose Drive, St Albert, AB  T8N 1P7  Canada.  Mon-Fri 9AM-5PM MST