Nethence Newdoc Olddoc Lab Your IP BBDock  

Warning: those guides are mostly obsolete, please have a look at the new documentation.


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 ~/
pkg_add -r spamass-milter spamass-rules p5-Mail-SpamAssassin
ref. Spamassassin : Can't locate HTML/ in @INC:
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 > <<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
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_flags="-u spamd -H /var/spool/spamd"
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
0 3 * * * /usr/local/bin/sa-update
note. or specifically on freebsd (both do work),
vi /etc/crontab
0 3 * * * root /usr/local/bin/sa-update
Finally add this to your sendmail macro,
cd /etc/mail/
vi $
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 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
Adding New Mail Filters:
less /usr/local/share/doc/spamass-milter/activation.txt
Thread: Server wide Apache SpamAssassin bayes learning not working:
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,
#rpm -ivh spamass-milter-0.3.1-19.el5.i386.rpm
#rpm -ivh spamass-milter-0.3.2-3.el6.x86_64.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"
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
Additional notes
There is an alternative:

(obsolete, see the new doc)