1
0
mirror of https://github.com/mail-in-a-box/mailinabox.git synced 2024-11-22 02:17:26 +00:00

enable site-wide bayesian filtering

Create directory in $STORAGE_ROOT for bayes database.

Added --username arg to sa-learn as the user mail does not have permission to edit files in $STORAGE_ROOT. There is probably a better solution to this...
This commit is contained in:
jmar71n 2014-09-20 16:07:30 +01:00
parent dd91553689
commit b5bb12d0d2

View File

@ -35,7 +35,7 @@ sudo sed -i "s/#mail_plugins = .*/mail_plugins = \$mail_plugins antispam/" /etc/
# from http://wiki2.dovecot.org/Plugins/Antispam # from http://wiki2.dovecot.org/Plugins/Antispam
cat > /usr/bin/sa-learn-pipe.sh << EOF; cat > /usr/bin/sa-learn-pipe.sh << EOF;
cat<&0 >> /tmp/sendmail-msg-\$\$.txt cat<&0 >> /tmp/sendmail-msg-\$\$.txt
/usr/bin/sa-learn \$* /tmp/sendmail-msg-\$\$.txt > /dev/null /usr/bin/sa-learn \$* /tmp/sendmail-msg-\$\$.txt --username user-data > /dev/null
rm -f /tmp/sendmail-msg-\$\$.txt rm -f /tmp/sendmail-msg-\$\$.txt
exit 0 exit 0
EOF EOF
@ -53,6 +53,15 @@ plugin {
} }
EOF EOF
# Configure spamassassin to use site-wide bayesian filtering
source /etc/mailinabox.conf # get global vars
mkdir -p $STORAGE_ROOT/mail/spamassassin
chown -R mail:mail $STORAGE_ROOT/mail/spamassassin
chmod -R 775 $STORAGE_ROOT/mail/spamassassin
tools/editconf.py /etc/spamassassin/local.cf -s bayes_path=$STORAGE_ROOT/mail/spamassassin/bayes
# Initial training? # Initial training?
# sa-learn --ham storage/mail/mailboxes/*/*/cur/ # sa-learn --ham storage/mail/mailboxes/*/*/cur/
# sa-learn --spam storage/mail/mailboxes/*/*/.Spam/cur/ # sa-learn --spam storage/mail/mailboxes/*/*/.Spam/cur/