Antispam plugin: insufficent error messages

Volker Wysk post at volker-wysk.de
Mon Nov 28 20:28:08 UTC 2016


Hi!

"Dovecot always logs a detailed error message if something goes wrong. 
If it doesn't, it's considered a bug and will be fixed." (http://
wiki2.dovecot.org/Logging)

I'm trying to set up a spam filter with dovecot-antispam and dspam as backend.

When I move a spam message from INBOX to Spam, I get this in syslog:

Nov 28 21:15:58 desktop imap: antispam: mailbox_is_unsure(Spam): 0
Nov 28 21:15:58 desktop imap: antispam: mailbox_is_trash(INBOX): 0
Nov 28 21:15:58 desktop imap: antispam: mailbox_is_trash(Spam): 0
Nov 28 21:15:58 desktop imap: antispam: mail copy: from trash: 0, to trash: 0
Nov 28 21:15:58 desktop imap: antispam: mailbox_is_spam(INBOX): 0
Nov 28 21:15:58 desktop imap: antispam: mailbox_is_spam(Spam): 1
Nov 28 21:15:58 desktop imap: antispam: mailbox_is_unsure(INBOX): 0
Nov 28 21:15:58 desktop imap: antispam: mail copy: src spam: 0, dst spam: 1, 
src unsure: 0

There are no log entries about how dspam is called, or what goes on. Indeed, 
dspam doesn't get called at all. I know, because I've examined the antispam-
plugin source code. There would be a log message if dspam was called.

It's hard to study the source code, because there are hardly any comments.

I have been able to trace the problem to function signature_extract_to_list() 
in signature.c. There, -1 is returned:

int signature_extract_to_list(const struct signature_config *cfg,
			      struct mailbox_transaction_context *t,
			      struct mail *mail, struct siglist **list,
			      enum classification wanted)
{
	const char *const *signatures;
	struct siglist *item;

	signatures = get_mail_headers(mail, cfg->signature_hdr);
	if (!signatures || !signatures[0]) {
		if (!cfg->signature_nosig_ignore) {

			mail_storage_set_error(t->box->storage,
					       ME(NOTPOSSIBLE)
					       "antispam signature not found");
                        return -1;   /* <-- HERE */
		} else {
			return 0;
		}
	}

	while (signatures[1])
		signatures++;

	item = i_new(struct siglist, 1);
	item->next = *list;
	item->wanted = wanted;
	item->sig = i_strdup(signatures[0]);

	*list = item;

	return 0;
}

So, what's happening is "antispam signature not found".  My question: What 
does this mean? What's going on?

My "dovecot -n" output is attached.

Bye
Volker
-------------- next part --------------
# 2.2.22 (fe789d2): /etc/dovecot/dovecot.conf
# Pigeonhole version 0.4.13 (7b14904)
# OS: Linux 4.4.0-47-generic x86_64 Ubuntu 16.04.1 LTS 
auth_username_format = %n
auth_verbose = yes
hostname = volker-wysk.de
log_path = /var/log/dovecot.log
mail_debug = yes
mail_location = mdbox:~/lib/Dovecot-Mail
managesieve_notify_capability = mailto
managesieve_sieve_capability = fileinto reject envelope encoded-character vacation subaddress comparator-i;ascii-numeric relational regex imap4flags copy include variables body enotify environment mailbox date index ihave duplicate mime foreverypart extracttext
namespace inbox {
  inbox = yes
  location = 
  mailbox Drafts {
    special_use = \Drafts
  }
  mailbox Entw?rfe {
    special_use = \Drafts
  }
  mailbox Junk {
    special_use = \Junk
  }
  mailbox Papierkorb {
    special_use = \Trash
  }
  mailbox Sent {
    special_use = \Sent
  }
  mailbox "Sent Messages" {
    special_use = \Sent
  }
  mailbox Trash {
    special_use = \Trash
  }
  mailbox "Versendete Nachrichten" {
    special_use = \Sent
  }
  prefix = 
  separator = .
}
passdb {
  driver = pam
}
plugin {
  antispam_backend = dspam
  antispam_debug_target = syslog
  antispam_dspam_binary = /usr/bin/dspam
  antispam_dspam_env = HOME=%h;USER=%u
  antispam_signature = X-DSPAM-Signature
  antispam_signature_missing = error
  antispam_spam = Spam
  antispam_trash = Papierkorb
  antispam_verbose_debug = 1
  sieve = ~/.dovecot.sieve
  sieve_dir = ~/lib/Sieve
}
postmaster_address = post at volker-wysk.de
protocols = imap lmtp sieve
ssl = required
ssl_cert = </etc/ssl/certs/dovecot.pem
ssl_key = </etc/ssl/private/dovecot.pem
userdb {
  driver = passwd
}
protocol lmtp {
  mail_plugins = " sieve mail_log notify"
}
protocol imap {
  mail_max_userip_connections = 50
  mail_plugins = " antispam"
}


More information about the dovecot mailing list