Integração com Dovecot SPFBL

Diego Canton de Brito edited this page Feb 10, 2017 · 5 revisions

1) Instale o plugin antispam

http://wiki2.dovecot.org/Plugins/Antispam

2) Edite o arquivo /etc/dovecot/conf.d/90-plugin.conf


plugin {
     antispam_backend = mailtrain
     antispam_trash = trash;Trash;Deleted Items;Deleted Messages;INBOX.Trash
     antispam_trash_pattern = trash;Trash;Deleted * 
     antispam_trash_pattern_ignorecase = TRASH 
     antispam_spam = Spam;Junk 
     antispam_spam_pattern = spam;Spam;junk;Junk 
     antispam_spam_pattern_ignorecase = SPAM;JUNK 
     antispam_mail_spam = spam 
     antispam_mail_notspam = ham 
     antispam_mail_sendmail = /usr/bin/spfbl-learn-pipe.sh 
 }

3) Edite o arquivo /etc/dovecot/conf.d/20-imap.conf


protocol imap { 
mail_plugins = $mail_plugins antispam 
} 

4) Edite o arquivo /usr/bin/spfbl-learn-pipe.sh


#!/bin/bash 

pid=$$ 

# remove the # from next line to background learner 
#( 
{ 
echo "$(date) ${pid}-start ($*) /tmp/sendmail-msg-$$.txt" 
# set -x 
# id -a 
# env 

cat > /tmp/sendmail-msg-${pid}.txt 

/usr/local/bin/spfbl.sh "$@" /tmp/sendmail-msg-${pid}.txt 
echo "$(date) $$-end rc=$?" 
} >/tmp/antispam.${pid}.log 2>&1 

cat /tmp/antispam.${pid}.log >>/var/log/spfbl-learn-pipe.log 
rm -f /tmp/antispam.${pid}.log /tmp/sendmail-msg-${pid}.txt 
true 

# remove the # from next line to background learner 
# ) & 

exit 0

5) Crie o arquivo de log e defina os atributos de usuário:

touch /var/log/spfbl-learn-pipe.log
chown dovecot:dovecot /var/log/spfbl-learn-pipe.log

6) Agora basta mover msgs para a pasta spam que automaticamente será efetuada a denuncia.

7) Mover da pasta spam para caixa de entrada faz o inverso.

You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.