1

Topic: Sieve filters working on first domain, but not on other

Hello,
I have recently installed  iRedMail-0.9.0 on a new Debian instance. The strange thing is that sieve filters are working on the first domain, but not working on the other domain that was added.
I have checked the respective (non working) users sieve folder and files "managesieve.sieve" and symlink "dovecot.sieve -> managesieve.sieve" are present, but there is no "dovecot.svbin" file (which are present in the folder of the working domain).
Is there a way to enable/disable sieve on a specific domain?

Thank you for your help!

Jernej

==== Required information ====
- iRedMail version: iRedMail-0.9.0
- Store mail accounts in which backend (LDAP/MySQL/PGSQL):  MySQL
- Linux/BSD distribution name and version: Debian 7
- Related log if you're reporting an issue:
====

----

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

2

Re: Sieve filters working on first domain, but not on other

Please turn on debug mode in Dovecot to see why it doesn't work.
Reference: http://www.iredmail.org/docs/debug.dovecot.html

3 (edited by jernejp 2015-03-11 03:09:45)

Re: Sieve filters working on first domain, but not on other

Hello ZhangHuangbin,
Thank you for your response. I have set mail_debug = yes and restarted dovecot.
What should I look for in dovecot log?

Kind regards,
Jernej

UPDATE:
Here is the log of a working domain (I have only copied the lines which contain words "sieve" & "jernej@example.com")
http://pastebin.com/Zyb2SmDQ

And here is the similar log of the nonfunctioning domain (example.org):
http://pastebin.com/9YsVJW9d

4

Re: Sieve filters working on first domain, but not on other

There's a difference in the sieve script path:

working one:

Mar 10 15:58:40 managesieve(jernej@example.com): Debug: sieve-storage: using active sieve script path: //var/vmail/vmail1/example.com/j/e/r/jernej-2015.02.13.15.15.21//sieve/dovecot.sieve

nonfunctioning one:

Mar 10 15:58:04 managesieve(jernej@example.org): Debug: sieve-storage: using active sieve script path: //var/vmail/vmail1/example.org/jernej//sieve/dovecot.sieve

Default iRedMail setting uses the working one with below setting in /etc/dovecot/dovecot.conf:

sieve_dir = /%Lh/sieve                                                      
sieve = /%Lh/sieve/dovecot.sieve

%h means HOME directory of user's mailbox, it's returned by 'mail_location =' in dovecot.conf.

So, please show us output of command "dovecot -n".

5 (edited by jernejp 2015-03-11 21:57:46)

Re: Sieve filters working on first domain, but not on other

here is the dovecot -n
http://pastebin.com/FGb3xE0L

There really is a difference in sieve script path, but both paths are correct - they describe the actual paths of the home folders where Maildir and sieve folders reside. I am just not sure why "j/e/r/jernej-2015.02.13.15.15.21" has a different pattern than most of the other accounts on the server (postmaster account is the only one with similar path - example.com/p/o/s/postmaster-2015.02.13.14.03.33). Anyway that doesn't seem to affect the sieve filters - they work on all tested accounts inside example.com domain but they aren't working on any tested account inside example.org domain.

6

Re: Sieve filters working on first domain, but not on other

We need output of 'dovecot -n', not 'postfix -n'.

7 (edited by jernejp 2015-03-12 04:01:42)

Re: Sieve filters working on first domain, but not on other

You will find output of 'dovecot -n' here:
http://pastebin.com/FGb3xE0L
Thank you for your help!

8

Re: Sieve filters working on first domain, but not on other

OK, you have default sieve settings:

  sieve = /%Lh/sieve/dovecot.sieve
  sieve_dir = /%Lh/sieve

According to your first post, sieve rule file exists in nonfunctioning mailbox account. Questions:

*) Did you check the sieve rules stored in the file?
*) Is the file permission correct? sieve files must be owned by "vmail:vmail", permission 0700.

9

Re: Sieve filters working on first domain, but not on other

Both sieve folders have the same file permissions:

lrwxrwxrwx 1 vmail vmail   17 feb 13 16:07 dovecot.sieve -> managesieve.sieve
-rw------- 1 vmail vmail  404 mar 10 15:59 dovecot.svbin
-rw------- 1 vmail vmail  318 mar 10 15:58 managesieve.sieve

The difference is in dovecot.svbin file which is found only in the working domain subfolder:

-rw------- 1 vmail vmail  404 mar 10 15:59 dovecot.svbin

Also the content of dovecot.sieve is the same on both domains. I have tested two rules - both of them are working on the example.com domain and not working on the example.org domain

require ["date","fileinto","relational","vacation"];
# rule:[Vacation]
if allof (true, currentdate :value "ge" "date" "2015-03-05", currentdate :value "le" "date" "2015-03-16")
{
    vacation :days 10 :subject "Vacation" "I'm on vacation.";
}
# rule:[Jernej]
if header :contains "from" "jernej"
{
    fileinto "Jernej";
}

10

Re: Sieve filters working on first domain, but not on other

Does it work with a third mail domain?

11 (edited by jernejp 2015-03-13 05:56:27)

Re: Sieve filters working on first domain, but not on other

I found something that I didn't think has any effect but it turns it does... i also have postfixadmin installed on the server - if I add the domain using postfixadmin sieve filters are not working, but if I add the domain using Iredadmin... sieve works! There is at least some progress - the thing is I have to somehow fix the nonworking domains without recreating the domains and migrating users... can you please direct me what to look for?
Thank you Zhang for all the help and the excellent IRedMail!

12

Re: Sieve filters working on first domain, but not on other

I'm not familiar with PostfixAdmin nowadays, although iRedMail shipped it years ago. I suggest you try steps below:

*) Create 2 testing email accounts, one created with PostfixAdmin, another one with iRedAdmin.
*) compare SQL records of these 2 new testing accounts in `vmail.mailbox`. Show us the difference.

13 (edited by jernejp 2015-03-13 09:29:05)

Re: Sieve filters working on first domain, but not on other

Hi Zhang,
I have created 3 email accounts (users) - one with iRedMail, one with Postfixadmin (on non working domain) and another one with Postfixadmin ( on non working domain). Here is mysql log:

Iredmail:

INSERT INTO mailbox (username, domain, name, created, storagenode, local_part, quota, active, storagebasedirectory, password, maildir) VALUES ('test@example.com', 'example.com', 'Test', '2015-03-13 00:50:04', 'vmail1', 'test', 10, '1', '/var/vmail', '{SSHA512}2OoiRO/dZBRjkGU21UHfCTHjjvir/tr5h8ZX3aiFwY8A9DMwFK+qktXXff7Uobe23znbqzHKmyTaMr1Ift3mXQpW9/nacozR', 'example.com/t/e/s/test-2015.03.13.01.50.04/')
INSERT INTO alias (active, domain, created, goto, address) VALUES ('1', 'example.com', '2015-03-13 00:50:04', 'test@example.com', 'test@example.com')

Postfixadmin (sieve works here ):

INSERT INTO alias (address,domain,goto,active,created,modified) VALUES ('test2@example.com','example.com','test2@example.com','1',now(),now())
INSERT INTO mailbox (username,local_part,domain,maildir,password,name,quota,active,created,modified) VALUES ('test2@example.com','test2','example.com','example.com/test2/','$1$7b0b5d1c$oqwPnWSUdH66ezEJJ8hWM0','test2','10240000','1',now(),now())

Postfixadmin - (sieve doesn't work here):

INSERT INTO alias (address,domain,goto,active,created,modified) VALUES ('test3@example.fi','example.fi','test3@example.fi','1',now(),now())
INSERT INTO mailbox (username,local_part,domain,maildir,password,name,quota,active,created,modified) VALUES ('test3@example.fi','test3','example.fi','example.fi/test3/','$1$b9ff9871$Dc./X87bdWjJFEcnAvjKk/','test3','10240000','1',now(),now())

14 (edited by jernejp 2015-03-13 10:29:10)

Re: Sieve filters working on first domain, but not on other

I think we found it. When creating domains in Postfixadmin it sets the transport value to "virtual", as opposed to iRedMail, which sets it to "dovecot". I remember in previous Postfixadmin there was an option (dropdown list of different transport), but now there is a setting in config.inc.php $CONF['transport_default'] = 'virtual';. Naturally by using different transport dovecot-sieve doesn't apply... The question arises if it is safe to change that on an existing domain and not break everything?
Thank you Zhang for your help!

Postfixadmin:

INSERT INTO domain (domain,description,aliases,mailboxes,maxquota,quota,transport,backupmx,active,created,modified)
VALUES ('example.org','example.org','0','0','10','0','virtual','0','1',now(),now())

Iredmail:

INSERT INTO domain (active, domain, description, transport, created)
VALUES ('1', 'example.com', 'example.com', 'dovecot', '2015-03-13 01:18:46')

15

Re: Sieve filters working on first domain, but not on other

If you don't use 'dovecot' as transport, sieve won't be triggered.

jernejp wrote:

The question arises if it is safe to change that on an existing domain and not break everything?

Yes, it's safe.