this is obsolete doc -- see http://doc.nethence.com/ instead
Configuring spamass-milter
On FreeBSD 8
Install spamd and spamass-milter,
cd /usr/ports/www/p5-HTML-Parser/
make reinstall clean
cd /usr/ports/converters/p5-Encode-Locale/
make reinstall clean
cd ~/
echo $PACKAGESITE
pkg_add -r spamass-milter spamass-rules p5-Mail-SpamAssassin
ref. Spamassassin : Can't locate HTML/Parser.pm in @INC: http://help.directadmin.com/item.php?id=38
check that everything went fine,
grep spam /etc/group
grep spam /etc/passwd
ls -ld /var/spool/spamd
pkg_info | grep -E 'spamass-milter|spamass-rules|p5-Mail-SpamAssassin|p5-HTML-Parser|p5-Encode-Locale' | awk '{print $1}'
and update the rules right now,
sa-update -v
Configure the thing (default 5.0),
cd /etc/mail/
ln -s /usr/local/etc/mail/spamassassin
cd /etc/mail/spamassassin/
cat > local.cf <<EOF9
required_score 4.5
remove_header ham Status
remove_header ham Level
use_bayes 1
bayes_auto_learn 1
bayes_path /var/spool/spamd/.spamassassin/bayes
bayes_file_mode 0777
EOF9
Eventually further configure the thing,
cd /etc/mail/spamassassin/
vi init.pre
Enable the spam daemon at boot time,
cd /etc/rc.d/
cp /usr/local/etc/rc.d/sa-spamd ./
cp /usr/local/etc/rc.d/spamass-milter ./
cat >> rc.conf <<EOF9
spamd_enable="YES"
spamd_flags="-u spamd -H /var/spool/spamd"
spamass_milter_enable="YES"
EOF9
and start it,
/etc/rc.d/sa-spamd restart
/etc/rc.d/spamass-milter restart
ls -l /var/run/spamass-milter.sock
Why not add a daily spamassassin update to your root crontab,
crontab -e
add,
0 3 * * * /usr/local/bin/sa-update
note. or specifically on freebsd (both do work),
vi /etc/crontab
add,
0 3 * * * root /usr/local/bin/sa-update
Finally add this to your sendmail macro,
cd /etc/mail/
vi $HOSTNAME.mc
INPUT_MAIL_FILTER(`spamassassin', `S=local:/var/run/spamass-milter.sock, F=, T=C:15m;S:4m;R:4m;E:10m')dnl
define(`confMILTER_MACROS_CONNECT',`b, j, _, {daemon_name}, {if_name}, {if_addr}')dnl
define(`confINPUT_MAIL_FILTERS', `spamassassin')
apply and restart sendmail,
make
make install
/etc/rc.d/sendmail restart
now verify that spamass-milter is working by sending a message to yourself,
echo "Testing spamass-milter..." | mail -s"Spam test" root
and check the headers,
X-Spam-Status: No, ...
Note. if you are using postoffice smtp instead of sendmail see http://pbraun.nethence.com/doc/mail/postoffice.html
Refs.
Adding New Mail Filters: https://www.sendmail.com/sm/open_source/docs/m4/adding_mailfilters.html
less /usr/local/share/doc/spamass-milter/activation.txt
PREFIX/share/doc/p5-Mail-SpamAssassin/INSTALL
PREFIX/share/doc/p5-Mail-SpamAssassin/UPGRADE
http://networking.ringofsaturn.com/Unix/spamassassin.php
http://www.scalix.com/wiki/index.php?title=HowTos/SpamAssassin
http://milter-manager.sourceforge.net/reference/install-to-freebsd.html
Thread: Server wide Apache SpamAssassin bayes learning not working: http://forums.cpanel.net/f43/server-wide-apache-spamassassin-bayes-learning-not-working-388582.html
On RHEL 5/6
Makes sure those packages are installed,
rpm -q sendmail-milter spamassassin
Note. even if you don't use sendmail for your milters, you'll need libmilter with it.
Download and install spamass-milter from EPEL,
#wget http://download.fedora.redhat.com/pub/epel/5/i386/spamass-milter-0.3.1-19.el5.i386.rpm
#rpm -ivh spamass-milter-0.3.1-19.el5.i386.rpm
#wget http://dl.fedoraproject.org/pub/epel/6/x86_64/spamass-milter-0.3.2-3.el6.x86_64.rpm
#rpm -ivh spamass-milter-0.3.2-3.el6.x86_64.rpm
wget http://dl.fedoraproject.org/pub/epel/6/i386/spamass-milter-0.3.2-3.el6.i686.rpm
rpm -ivh spamass-milter-0.3.2-3.el6.i686.rpm
Note. the package includes the spamass-milter user, init script and folder for the unix socket,
grep ^sa-milt /etc/passwd
ls -l /etc/init.d/spamass-milter
ls -ld /var/run/spamass-milter/
Tune the thing a little bit,
cd /etc/sysconfig/
cat > spamass-milter <<EOF9
EXTRA_FLAGS="-m -r 8 -i 127.0.0.1"
EOF9
Note. -m to disable modification of the message (speeds up)
Note. -r to reject tagged >= number
Note. -i to let messages pass through from specific networks
Note. DO NOT -f to fork into the background, RHEL/EPEL's init script ALREADY daemonizes the thing (it would restart in loop)
Note. RUN_AS_USER is already defined in the init script.
Start and enable the daemons at boot
service spamassassin restart
service spamass-milter restart
chkconfig spamassassin on
chkconfig spamass-milter on
#pkill postoffice
#/usr/local/lib/postoffice -bd -q5
Check the daemon runs with the previously defined options,
ps aux | grep spamass-milter
and check for the socket,
ls -l /var/run/spamass-milter/spamass-milter.sock
Configure sendmail -- see FreeBSD conf above -- or postoffice smtp -- see http://pbraun.nethence.com/doc/mail/postoffice.html
Refs.
SpamAssassin-ClamAV-Procmail-Howto: http://www.falkotimme.com/howtos/spamassassin_clamav_procmail/
http://www.malgouyres.fr/linux/spamass-milter_postfix_en.html
Additional notes
There is an alternative: http://www.openbsd.org/spamd/