16

I'm trying to get the dovecot-antispam plugin working on a 15.10 server (I can't dist-upgrade, it's on a vps) and I'm getting the error message of anti spam plugin not configured when trying to move messages to or from my Junk mail folder.

dovecot-antispam Version: 2.0+20130822-2build1
dovecot-core Version: 1:2.2.9-1ubuntu5
dovecot-sieve Version: 1:2.2.9-1ubuntu5

This is the last piece of the installation, otherwise dovecot and sieve are working as expected, along with amavisd-new/spamassassin/etc. I am not using DSPAM.

The error message I'm seeing in my mail client (doesn't matter which one, they all display the same error message) seems to have only one Google result, and a Dovecot mailing list thread from a few years back.

http://www.dovecot.org/list/dovecot/2012-September/137992.html

I have also read this Ask Ubuntu thread:

dovecot with antispam plugin

No luck yet.

15-lda.conf:

protocol imap {
    mail_plugins = $mail_plugins antispam
}

90-antispam.conf:

plugin {
    antispam_backend = pipe
    antispam_signature = X-Spam-Flag
    antispam_signature_missing = error

    antispam_trash = trash;Garbage;Trash;Deleted Items;Deleted Messages
    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_pipe_tmpdir = /var/tmp
    antispam_pipe_program = /usr/bin/sa-learn-pipe.sh

    antispam_debug_target = syslog
    antispam_verbose_debug = 1
}

/usr/bin/sa-learn-pipe.sh:

#!/bin/bash

echo /usr/bin/sa-learn $* /tmp/sendmail-msg-$$.txt
echo "$$-start ($*)" >> /tmp/sa-learn-pipe.log

#echo $* > /tmp/sendmail-parms.txt
cat<&0 >> /tmp/sendmail-msg-$$.txt

/usr/bin/sa-learn $* /tmp/sendmail-msg-$$.txt && rm -f /tmp/sendmail-msg-$$.txt &

echo "$$-end" >> /tmp/sa-learn-pipe.log

exit 0

I do have verbose logging enabled, and I see the following in my syslog:

Jun  3 22:08:23 pile imap: antispam: plugin initialising (2.0-notgit)
Jun  3 22:08:23 pile imap: antispam: verbose debug enabled
Jun  3 22:08:23 pile imap: antispam: "Spam" is exact match spam folder
Jun  3 22:08:23 pile imap: antispam: "Junk" is exact match spam folder
Jun  3 22:08:23 pile imap: antispam: "spam" is wildcard match spam folder
Jun  3 22:08:23 pile imap: antispam: "Spam" is wildcard match spam folder
Jun  3 22:08:23 pile imap: antispam: "junk" is wildcard match spam folder
Jun  3 22:08:23 pile imap: antispam: "Junk" is wildcard match spam folder
Jun  3 22:08:23 pile imap: antispam: "spam" is case-insensitive wildcard match spam folder
Jun  3 22:08:23 pile imap: antispam: "junk" is case-insensitive wildcard match spam folder
Jun  3 22:08:23 pile imap: antispam: no unsure folders
Jun  3 22:08:23 pile imap: antispam: "trash" is exact match trash folder
Jun  3 22:08:23 pile imap: antispam: "Garbage" is exact match trash folder
Jun  3 22:08:23 pile imap: antispam: "Trash" is exact match trash folder
Jun  3 22:08:23 pile imap: antispam: "Deleted Items" is exact match trash folder
Jun  3 22:08:23 pile imap: antispam: "Deleted Messages" is exact match trash folder
Jun  3 22:08:23 pile imap: antispam: "trash" is wildcard match trash folder
Jun  3 22:08:23 pile imap: antispam: "Trash" is wildcard match trash folder
Jun  3 22:08:23 pile imap: antispam: "Deleted *" is wildcard match trash folder
Jun  3 22:08:23 pile imap: antispam: "trash" is case-insensitive wildcard match trash folder
Jun  3 22:08:23 pile imap: antispam: pipe backend program = /usr/bin/sa-learn-pipe.sh
Jun  3 22:08:23 pile imap: antispam: pipe backend tmpdir /var/tmp
Jun  3 22:08:23 pile dovecot: imap([email protected]): Disconnected: Logged out in=91 out=905

Just to test and make sure it's reading the configuration file, I added the word "Garbage" in my folder list. It isn't affecting anything.

At this point, I'm really not sure where to go. Have any of you gotten this Dovecot plugin to work successfully? It's the last piece of my mail server puzzle.

Here's what I see in Roundcube:

Error message Roundcube generates

Edit: further research lead me to this recent thread on the dovecot list .... and the poster ended up giving up and using a different method.

6
  • Did you check settings compared to those on this page? wiki2.dovecot.org/Plugins/Antispam
    – John Hall
    Jul 11, 2016 at 5:39
  • This dovecot plugin is just one way to train the Bayesian filter. While trying to get this to work you can run "sa-learn" on good and bad folders from the command line.
    – John Hall
    Jul 11, 2016 at 6:30
  • ^^^ Yes, and the links from the Dovecot thread indicate that there are errors on the wiki. I very closely followed their directions, and I am aware of using sa-learn. See above - I'm already piping through sa-learn. Another odd problem that I'm having - I'm just not getting any spam hitting Inbox! It's hard to test things out much further when the spam volume is almost zero now, thanks to the effectiveness of the DNSBL setup.
    – jrn75
    Jul 11, 2016 at 18:52
  • Just some guessing: maybe you accidentally removed the part where dovecot is told to include configs from /etc/dovecot/conf.d/ from your /etc/dovecot/dovecot.conf? It should near the end have a line that says !include conf.d/*.conf Jul 23, 2016 at 21:44
  • It has that. It's the last line in the file. I've had a few more spam items come through, and at this point it appears that the sa-learn pipe is cooperative. When i run "sa-learn --dump magic" I see the nspam token number going up. I'm probably going to mark this as solved, although I wish that I was able to properly document exactly what worked. :/
    – jrn75
    Jul 24, 2016 at 1:05

0

Browse other questions tagged .