There was a problem loading the comments.

How to enable SpamAssassin on your server

Support Portal  »  Knowledgebase  »  Viewing Article

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) Before installing SpamAssassin, ensure have the perl/cpan requirements. This can be done in a few different way, I typically use cpan.
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
cpan> quit

Then install the required modules:cpan -i Archive::Tar Digest::SHA Net::DNS Net::DNS::Resolver::Programmable Mail::SPF Geo::IP Net::CIDR::Lite IO::Socket::IP \
IP::Country Net::Ident Net::Patricia 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 Sys::Syslog DBD::File

and then run the 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-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 perl-Sys-Syslog perl-DB_File perl-Razor-Agent pyzor

Debian:apt-get install libhtml-parser-perl libhttp-date-perl libnet-dns-perl libnetaddr-ip-perl libsocket6-perl libsys-hostname-long-perl libwww-perl \
libio-socket-inet6-perl libmail-spf-perl libsys-syslog-perl libdbi-perl libencode-detect-perl libio-socket-ssl-perl \
libmail-dkim-perl razor libio-socket-ip-perl libnet-patricia-perl

2) Use CustomBuild to install SpamAssassin:cd /usr/local/directadmin/custombuild
./build set spamd spamassassin
./build spamassassin

(older builds use "./build set spamassassin yes")
If you have CustomBuild 2.0 you're done the install portion, skip to step 4.

3) If you're using CustomBuild 1.2, or have an older system, you'd just need to ensure that the spamcheck_director is enabled in the exim.conf.
For newer systems, this is done with a line in the exim.conf that looks like this:.include_if_exists /etc/exim.spamassassin.conf

Delete the # character that's in front of it, and save. Then setup the exim.spamassassin.conf file:wget -O /etc/exim.spamassassin.conf

and then restart exim.
For older systems, you might see a section that has #spamcheck_director. You could optionally uncomment this section, or just leave it commented and add the mentioned .include_if_exists line just before it.

Restart exim:
Redhat/Debian:/etc/init.d/exim restart

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

4) Once setup, and exim is restarted, spamd should be running, confirm with:[root@servercustombuild]# ps ax |grep spamd
21276 pts/0 S+ 0:00 grep spamd
27565 ? Ss 0:03 /usr/bin/spamd -d -c -m 15
27577 ? S 0:00 spamd child
27578 ? S 0:00 spamd child

where the "spamd -d -c -m 15" (or something very similar) would indicate it's running.
If not, check /var/log/maillog for clues.

5) Now that SpamAssassin is setup and running, Users just need to enable it at their User Level -> SpamAssassin section to create their user_prefs file, and email scanning should begin.

Other related info

a) The global spamassassin config file is in /etc/mail/spamassassin/

b) If you run debian and are missing perl or some pm files, type:apt-get install perl-base perl-modules libnet-dns-perl

c)A issue from 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
channel: MIRRORED.BY contents were missing, channel failed

With a reported solution beingcd /root
/usr/bin/sa-update --install Mail-SpamAssassin-rules-3.3.2-r1104058.tar.gz
/usr/bin/sa-update --nogpg

If outdated, you can find the latest version of these 4 files HERE.

Share via

Related Articles

Copyright © 2021 TheGigabit. All right reserved. Reg.No: 200701034297 (792326-P)