MT6 SpamAssassin

From The Network People, Inc. - Wiki
Jump to navigation Jump to search
Mail Toaster 6
Start Installation
FreeBSD Upgrade
DNS Upgrade
MySQL Upgrade
ClamAV Upgrade
AVG Upgrade
SpamAssassin Upgrade
Rspamd Upgrade
dspam Upgrade
Vpopmail Upgrade
Haraka Upgrade
Haproxy Upgrade
webmail Upgrade
Monitor Upgrade
testing


Install Dependencies

jailmanage spamassassin
pkg install -y p5-DBI p5-Mail-SPF p5-Mail-DKIM p5-Geo-IP p5-Net-Patricia p5-libwww
pkg install -y mysql56-client gnupg1 re2c libidn dcc-dccd razor-agents pyzor

Install GeoIP databases

cd /usr/local/share/GeoIP
fetch http://geolite.maxmind.com/download/geoip/database/GeoLiteCountry/GeoIP.dat.gz
fetch http://geolite.maxmind.com/download/geoip/database/GeoIPv6.dat.gz
gunzip *.gz

keep GeoIP DBs up-to-date

mkdir -p /usr/local/share/GeoIP/download
pkg install -y p5-PerlIO-gzip
fetch -o /usr/local/etc/periodic/weekly/geolite-mirror-simple.pl https://raw.githubusercontent.com/maxmind/geoip-api-perl/master/example/geolite-mirror-simple.pl
chmod 755 /usr/local/etc/periodic/weekly/geolite-mirror-simple.pl

Install SpamAssassin

This installs SA and then reinstalls with custom port options. I enable all the options except pgsql, gnupg, and SSL. Adjust to taste.

pkg install -y spamassassin
grep spamassassin /etc/make.conf || cat << EO_SPAMA >> /etc/make.conf
mail_spamassassin_SET=MYSQL DCC DKIM RAZOR PYZOR RELAY_COUNTRY SPF_QUERY UPDATE_AND_COMPILE GNUPG_NONE
mail_spamassassin_UNSET=GNUPG GNUPG2 SSL PGSQL
EO_SPAMA
make -C /usr/ports/mail/spamassassin deinstall install clean

enable TextCat

cd /usr/local/etc/mail/spamassassin 
sed -i .bak -e 's/#loadplugin Mail::SpamAssassin::Plugin::TextCat/loadplugin Mail::SpamAssassin::Plugin::TextCat/' v310.pre

enable Sought

fetch -o - http://yerp.org/rules/GPG.KEY | sa-update --import -
sa-update --gpgkey 6C6191E3 --channel sought.rules.yerp.org

enable SA

echo 'spamd_enable="YES"' >> /etc/rc.conf
echo 'spamd_flags="-v -q -x -u spamd -H /var/spool/spamd -A 127.0.0.0/24"' >> /etc/rc.conf
service sa-spamd start

keep SA rules up-to-date

mkdir -p /usr/local/etc/periodic/daily
cat <<EO_SAUPD > /usr/local/etc/periodic/daily/502.sa-update
#!/bin/sh
PATH=/usr/local/bin:/usr/bin:/bin
/usr/local/bin/perl -T /usr/local/bin/sa-update --gpgkey 6C6191E3 --channel sought.rules.yerp.org --channel updates.spamassassin.org
/usr/local/bin/perl -T /usr/local/bin/sa-compile
/usr/local/etc/rc.d/sa-spamd reload
EO_SAUPD
chmod 755 /usr/local/etc/periodic/daily/502.sa-update

clean up DCC files

If you installed DCC with SpamAssassin, you should also install the cron job that cleans up it's temp files.

mkdir -p /usr/local/etc/periodic/daily
cat <<EO_DCC > /usr/local/etc/periodic/daily/501.dccd
#!/bin/sh
/usr/local/dcc/libexec/cron-dccd
EO_DCC
chmod 755 /usr/local/etc/periodic/daily/501.dccd

More Information

Per User SA prefs

SA_per-user_preferences

MT 5 SpamAssassin page, with FAQ