1 (edited by spoonm 2017-05-30 13:19:50)

Topic: [SOLVED] Managesieve filters aren't working despite being loaded

==== Required information ====
- iRedMail version (check /etc/iredmail-release): 0.9.6 PGSQL edition.
- Linux/BSD distribution name and version:  Debian GNU/Linux 8 (jessie)
- Store mail accounts in which backend (LDAP/MySQL/PGSQL): PGSQL
- Web server (Apache or Nginx):Nginx
- Manage mail accounts with iRedAdmin-Pro? Nope.
- [IMPORTANT] Related original log or error message is required if you're experiencing an issue.
====

I was going through topics related to sieve filters set through Roundcube not working, since I set them through Roundcube myself. Following instructions on those threads, checking /var/vmail/vmail1/.../sieve/dovecot.sieve for instructions, setting mail_debug in /etc/dovecot/dovecot.conf and checking the logs for dovecot and dovecot-sieve, I see no reason the scripts shouldn't be working.

From /var/log/dovecot.log:

May 29 23:35:02 chiba dovecot: lda: Debug: Module loaded: /usr/lib/dovecot/modules/lib90_sieve_plugin.so
May 29 23:35:02 chiba dovecot: lda(user@domain.tld): Debug: sieve: Pigeonhole version 0.4.2 initializing
May 29 23:35:02 chiba dovecot: lda(user@domain.tld): Debug: sieve: executed before user's personal Sieve script(1): /var/vmail/sieve/dovecot.sieve
May 29 23:35:02 chiba dovecot: lda(user@domain.tld): Debug: sieve: using the following location for user's Sieve script: /var/vmail/vmail1/domain.tld/u/s/e/user-2017.03.31.11.21.17//sieve/dovecot.sieve;name=main script

And the contents of the sieve file:

require ["fileinto"];
# rule:[Mailing Lists]
if address :contains "to" "lists@domain.tld"
{
    fileinto "INBOX/Lists";
}

I also tried with the sieve file containing the rule:

if header :contains "to" "lists@domain.tld"
{
    fileinto "INBOX/Lists";
}

But when I send an e-mail from outside to the address lists@domain.tld, it goes into my INBOX folder like every other e-mail.

The logs show it's properly recognizing the per-user sieve file. I also tried putting that same rule in /var/vmail/sieve/dovecot.sieve, to see if it'd work, but it doesn't.

What am I missing?

----

Spider Email Archiver: On-Premises, lightweight email archiving software developed by iRedMail team. Supports Amazon S3 compatible storage and custom branding.

2

Re: [SOLVED] Managesieve filters aren't working despite being loaded

Looks file. Could you please paste the FULL Dovecot log related to sieve rule?

3 (edited by spoonm 2017-05-30 13:19:05)

Re: [SOLVED] Managesieve filters aren't working despite being loaded

This is all there is:

May 30 00:28:08 chiba dovecot: lda(spoonm@spoonm.org): Debug: shared: root=/var/run/dovecot, index=, indexpvt=, control=, inbox=, alt=
May 30 00:28:08 chiba dovecot: lda(spoonm@spoonm.org): Debug: acl: initializing backend with data: vfile
May 30 00:28:08 chiba dovecot: lda(spoonm@spoonm.org): Debug: acl: acl username = spoonm@spoonm.org
May 30 00:28:08 chiba dovecot: lda(spoonm@spoonm.org): Debug: acl: owner = 0
May 30 00:28:08 chiba dovecot: lda(spoonm@spoonm.org): Debug: acl vfile: Global ACLs disabled
May 30 00:28:08 chiba dovecot: lda(spoonm@spoonm.org): Debug: Quota root: name=user backend=dict args=:proxy::quotadict
May 30 00:28:08 chiba dovecot: lda(spoonm@spoonm.org): Debug: Quota rule: root=user mailbox=* bytes=1073741824 messages=0
May 30 00:28:08 chiba dovecot: lda(spoonm@spoonm.org): Debug: Quota warning: bytes=1073741824 (100%) messages=0 reverse=no command=quota-warning 100 raw mail user
May 30 00:28:08 chiba dovecot: lda(spoonm@spoonm.org): Debug: Quota warning: bytes=1020054732 (95%) messages=0 reverse=no command=quota-warning 95 raw mail user
May 30 00:28:08 chiba dovecot: lda(spoonm@spoonm.org): Debug: Quota warning: bytes=966367641 (90%) messages=0 reverse=no command=quota-warning 90 raw mail user
May 30 00:28:08 chiba dovecot: lda(spoonm@spoonm.org): Debug: Quota warning: bytes=912680550 (85%) messages=0 reverse=no command=quota-warning 85 raw mail user
May 30 00:28:08 chiba dovecot: lda(spoonm@spoonm.org): Debug: Quota grace: root=user bytes=107374182 (10%)
May 30 00:28:08 chiba dovecot: lda(spoonm@spoonm.org): Debug: dict quota: user=raw mail user, uri=proxy::quotadict, noenforcing=0
May 30 00:28:08 chiba dovecot: lda(spoonm@spoonm.org): Debug: none: root=, index=, indexpvt=, control=, inbox=, alt=
May 30 00:28:08 chiba dovecot: lda(spoonm@spoonm.org): Debug: Destination address: spoonm@spoonm.org (source: user@hostname)
May 30 00:28:08 chiba dovecot: lda(spoonm@spoonm.org): Debug: sieve: Pigeonhole version 0.4.2 initializing 
May 30 00:28:08 chiba dovecot: lda(spoonm@spoonm.org): Debug: sieve: executed before user's personal Sieve script(1): /var/vmail/sieve/dovecot.sieve
May 30 00:28:08 chiba dovecot: lda(spoonm@spoonm.org): Debug: sieve: using the following location for user's Sieve script: /var/vmail/vmail1/spoonm.org/s/p/o/spoonm-2017.03.31.11.21.17//sieve/dovecot.sieve;name=main script
May 30 00:28:08 chiba dovecot: lda(spoonm@spoonm.org): Debug: sieve: opening script 1 of 2 from /var/vmail/sieve/dovecot.sieve
May 30 00:28:08 chiba dovecot: lda(spoonm@spoonm.org): Debug: sieve: loading script /var/vmail/sieve/dovecot.sieve
May 30 00:29:03 chiba dovecot: imap: Debug: Loading modules from directory: /usr/lib/dovecot/modules
May 30 00:29:03 chiba dovecot: imap: Debug: Module loaded: /usr/lib/dovecot/modules/lib01_acl_plugin.so
May 30 00:29:03 chiba dovecot: imap: Debug: Module loaded: /usr/lib/dovecot/modules/lib02_imap_acl_plugin.so

And /var/log/dovecot-sieve.log only shows this:

May 29 23:11:29 chiba dovecot: managesieve(spoonm@spoonm.org): Disconnected: Logged out bytes=63/637
May 29 23:11:31 chiba dovecot: managesieve-login: Login: user=<spoonm@spoonm.org>, method=PLAIN, rip=127.0.0.1, lip=127.0.0.1, mpid=22760, TLS, session=<6bW3zrFQtwB/AAAB>
May 29 23:11:31 chiba dovecot: managesieve(spoonm@spoonm.org): Disconnected: Logged out bytes=63/637
May 29 23:12:36 chiba dovecot: managesieve-login: Login: user=<spoonm@spoonm.org>, method=PLAIN, rip=127.0.0.1, lip=127.0.0.1, mpid=22777, TLS, session=<b6Cg0rFQvQB/AAAB>
May 29 23:12:36 chiba dovecot: managesieve(spoonm@spoonm.org): Disconnected: Logged out bytes=210/664

What's most odd is that I ran sieve-test on the script I'm using and one of the emails that should've been stored in a different folder but got to my INBOX and it got filtered into INBOX/Lists.

EDIT: I found the issue.

When I migrated from my old server, I couldn't get the sql database to just work with my old e-mails, so I think I copied over my entire /var/vmail directory into the new server.

Somehow, permissions got messed up and /var/vmail/sieve/dovecot.sieve was owned by root. There was no sieve error in the logs talking about permissions, however. I chown'd it as vmail:vmail and it compiled the scripts and ran just fine!