1

Topic: forwarding issue

Hi,

In IredAdmin Pro 1.3 I have created one domain (domain1.com) and added alias domain (domain2.com). Then I created a mailbox user@domain1.com and created forward from that mailbox to user@externaldomain.com. So now, when I send mail to user@domain1.com "forward" works fine, but if I send mail to user@domain2.com when "forward" doesn't work. Also, I tried to add a filter (which should work similar to "forward") via roundcube webmail, but it doesn't work too when I send mail to user@domain2.com. Please, help as soon as possible. Thanx.

----

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

2

Re: forwarding issue

Could you please paste your dovecot-ldap.conf? It should be /etc/dovecot-ldap.conf on RHEL/CentOS, or /etc/dovecot/dovecot-ldap.conf on Debian/Ubuntu.

Warning: hide/remove password before posting here.

3

Re: forwarding issue

ZhangHuangbin wrote:

Could you please paste your dovecot-ldap.conf? It should be /etc/dovecot-ldap.conf on RHEL/CentOS, or /etc/dovecot/dovecot-ldap.conf on Debian/Ubuntu.

Warning: hide/remove password before posting here.

hosts           = 127.0.0.1:389
ldap_version    = 3
auth_bind       = yes
dn              = cn=vmail,dc=node1-iv,dc=metasite,dc=lt
dnpass          =
base            = o=domains,dc=node1-iv,dc=metasite,dc=lt
scope           = subtree
deref           = never
user_filter     = (&(objectClass=mailUser)(accountStatus=active)(enabledService=mail)(enabledService=%Ls%Lc)(|(mail=%u)(&(enabledService=shadowaddress)(shadowAddress=%u))))
pass_filter     = (&(objectClass=mailUser)(accountStatus=active)(enabledService=mail)(enabledService=%Ls%Lc)(|(mail=%u)(&(enabledService=shadowaddress)(shadowAddress=%u))))
pass_attrs      = userPassword=password
default_pass_scheme = CRYPT
user_attrs      = storageBaseDirectory=home,mailMessageStore=mail=maildir:~/%$/Maildir/,mailQuota=quota_rule=*:bytes=%$

4

Re: forwarding issue

Both user_filter and pass_filter are correct.

Could you please paste filter rules? It should be /var/vmail/sieve/domain1.com/user/dovecot.sieve.
And paste related delivery log in /var/log/dovecot.log or /var/log/sieve.log?
Or show us other related information about your word: "but if I send mail to user@domain2.com when "forward" doesn't work"?

5

Re: forwarding issue

ZhangHuangbin wrote:

Both user_filter and pass_filter are correct.

Could you please paste filter rules? It should be /var/vmail/sieve/domain1.com/user/dovecot.sieve.
And paste related delivery log in /var/log/dovecot.log or /var/log/sieve.log?
Or show us other related information about your word: "but if I send mail to user@domain2.com when "forward" doesn't work"?

Let's see firstly this. My domain ldif:

dn: domainName=klinika.lt,o=domains,dc=node1-iv,dc=metasite,dc=lt
accountSetting: minPasswordLength:8
accountStatus: active
cn: klinika.lt
domainAliasName: mxmg2.metasite.net
domainCurrentAliasNumber: 0
domainCurrentListNumber: 0
domainCurrentQuotaSize: 0
domainCurrentUserNumber: 7
domainName: klinika.lt
enabledService: mail
enabledService: domainalias
mtaTransport: dovecot
objectClass: mailDomain


And here is my mailbox ldif:

dn: mail=b.eimaitis@klinika.lt,ou=Users,domainName=klinika.lt,o=domains,dc=node1-iv,dc=metasite,dc=lt
accountStatus: active
amavisLocal: TRUE
cn: b.eimaitis
enabledService: mail
enabledService: smtp
enabledService: deliver
enabledService: pop3
enabledService: pop3secured
enabledService: imap
enabledService: imapsecured
enabledService: managesieve
enabledService: managesievesecured
enabledService: sieve
enabledService: sievesecured
enabledService: forward
enabledService: senderbcc
enabledService: recipientbcc
enabledService: internal
enabledService: shadowaddress
enabledService: displayedInGlobalAddressBook
homeDirectory: /data/vmail/vmail1/klinika.lt/b/b./b.e/b.eimaitis-2010.11.10.01.15.07/
mail: b.eimaitis@klinika.lt
mailForwardingAddress: eimaitis@metasite.net
mailMessageStore: vmail1/klinika.lt/b/b./b.e/b.eimaitis-2010.11.10.01.15.07/
mailQuota: 0
objectClass: inetOrgPerson
objectClass: mailUser
objectClass: shadowAccount
objectClass: amavisAccount
shadowAddress: b.eimaitis@mxmg2.metasite.net
sn: b.eimaitis
storageBaseDirectory: /data/vmail
uid: b.eimaitis
userPassword:


So now, when I send mail to b.eimaitis@klinika.lt, then it is forwarded to eimaitis@metasite.net as expected, but if I send mail to b.eimaitis@mxmg2.metasite.net, then mail is delivered localy, but not forwarded. This is an issue..

6

Re: forwarding issue

So, any solutions? It seems like a bug in iRedAdmin Pro 1.3

7

Re: forwarding issue

It's iRedMail related issue, not iRedAdmin.
I need some time to test it, sorry for late response.

8

Re: forwarding issue

Hi, @dammit.

I tested as you mentioned, it works for me here.

What i did:

- Turn on debug mode in dovecot.conf: mail_debug = yes.
- Add alias domain "test.com" for domain "a.cn". There's an existing user "www@a.cn", so it will have an alias address: "www@test.com".
- Create mail filter for user "www@a.cn" in roundcube webmail, forward email to user "world@a.cn".
- Send mail to user alias address "www@test.com".

Related logs:

- In /var/log/sieve.log:

# tail -0f /var/log/sieve.log | grep 'sieve'
Nov 11 09:21:37 deliver(www@a.cn): Info: Module loaded: /usr/lib64/dovecot/modules/lda/lib90_sieve_plugin.so
Nov 11 09:21:37 deliver(www@a.cn): Info: sieve: using sieve path for user's script: /var/vmail/sieve/a.cn/www/dovecot.sieve
Nov 11 09:21:37 deliver(www@a.cn): Info: sieve: opening script /var/vmail/sieve/a.cn/www/dovecot.sieve
Nov 11 09:21:37 deliver(www@a.cn): Info: sieve: executing compiled script /var/vmail/sieve/a.cn/www/dovecot.sieve
Nov 11 09:21:37 deliver(www@a.cn): Info: sieve: msgid=<cb5f9666815cfd5167c2223aa03de8ea@a.cn>: forwarded to <world@a.cn>

Nov 11 09:21:38 deliver(world@a.cn): Info: Module loaded: /usr/lib64/dovecot/modules/lda/lib90_sieve_plugin.so
Nov 11 09:21:38 deliver(world@a.cn): Info: sieve: user's script path /var/vmail/sieve/a.cn/world/dovecot.sieve doesn't exist (using global script path in stead)
Nov 11 09:21:38 deliver(world@a.cn): Info: sieve: using sieve path for user's script: /var/vmail/sieve/dovecot.sieve
Nov 11 09:21:38 deliver(world@a.cn): Info: sieve: opening script /var/vmail/sieve/dovecot.sieve
Nov 11 09:21:38 deliver(world@a.cn): Info: sieve: script file /var/vmail/sieve/dovecot.sieve is missing

There's another way to debug your iRedMail setting.

Dovecot will try to find user's mail filter rule (file name: dovecot.sieve) under /var/vmail/sieve/ (default directory in iRedMail), so you can verify whether it finds this file or not with command 'ldapsearch'.

Copy "user_filter" setting, replace '%u' by your user alias address (user@domain2.com, or b.eimaitis@mxmg2.metasite.net):

# ldapsearch -x -D 'cn=vmail,dc=node1-iv,dc=metasite,dc=lt' -W -b "o=domains,dc=node1-iv,dc=metasite,dc=lt" "(&(objectClass=mailUser)(accountStatus=active)(enabledService=mail)(enabledService=sieve)(|(mail=www@test.com)(&(enabledService=shadowaddress)(shadowAddress=www@test.com))))
Enter LDAP Password:  [Type value of 'dnpass' in dovecot-ldap.conf]

If it prints LDIF data of user 'www@a.cn', then it works.

9

Re: forwarding issue

ZhangHuangbin wrote:

Hi, @dammit.

I tested as you mentioned, it works for me here.

What i did:

- Turn on debug mode in dovecot.conf: mail_debug = yes.
- Add alias domain "test.com" for domain "a.cn". There's an existing user "www@a.cn", so it will have an alias address: "www@test.com".
- Create mail filter for user "www@a.cn" in roundcube webmail, forward email to user "world@a.cn".
- Send mail to user alias address "www@test.com".

Related logs:

- In /var/log/sieve.log:

# tail -0f /var/log/sieve.log | grep 'sieve'
Nov 11 09:21:37 deliver(www@a.cn): Info: Module loaded: /usr/lib64/dovecot/modules/lda/lib90_sieve_plugin.so
Nov 11 09:21:37 deliver(www@a.cn): Info: sieve: using sieve path for user's script: /var/vmail/sieve/a.cn/www/dovecot.sieve
Nov 11 09:21:37 deliver(www@a.cn): Info: sieve: opening script /var/vmail/sieve/a.cn/www/dovecot.sieve
Nov 11 09:21:37 deliver(www@a.cn): Info: sieve: executing compiled script /var/vmail/sieve/a.cn/www/dovecot.sieve
Nov 11 09:21:37 deliver(www@a.cn): Info: sieve: msgid=<cb5f9666815cfd5167c2223aa03de8ea@a.cn>: forwarded to <world@a.cn>

Nov 11 09:21:38 deliver(world@a.cn): Info: Module loaded: /usr/lib64/dovecot/modules/lda/lib90_sieve_plugin.so
Nov 11 09:21:38 deliver(world@a.cn): Info: sieve: user's script path /var/vmail/sieve/a.cn/world/dovecot.sieve doesn't exist (using global script path in stead)
Nov 11 09:21:38 deliver(world@a.cn): Info: sieve: using sieve path for user's script: /var/vmail/sieve/dovecot.sieve
Nov 11 09:21:38 deliver(world@a.cn): Info: sieve: opening script /var/vmail/sieve/dovecot.sieve
Nov 11 09:21:38 deliver(world@a.cn): Info: sieve: script file /var/vmail/sieve/dovecot.sieve is missing

There's another way to debug your iRedMail setting.

Dovecot will try to find user's mail filter rule (file name: dovecot.sieve) under /var/vmail/sieve/ (default directory in iRedMail), so you can verify whether it finds this file or not with command 'ldapsearch'.

Copy "user_filter" setting, replace '%u' by your user alias address (user@domain2.com, or b.eimaitis@mxmg2.metasite.net):

# ldapsearch -x -D 'cn=vmail,dc=node1-iv,dc=metasite,dc=lt' -W -b "o=domains,dc=node1-iv,dc=metasite,dc=lt" "(&(objectClass=mailUser)(accountStatus=active)(enabledService=mail)(enabledService=sieve)(|(mail=www@test.com)(&(enabledService=shadowaddress)(shadowAddress=www@test.com))))
Enter LDAP Password:  [Type value of 'dnpass' in dovecot-ldap.conf]

If it prints LDIF data of user 'www@a.cn', then it works.


Hi,

Very interesting how can it work for you, because I see in your log:

Info: sieve: user's script path /var/vmail/sieve/a.cn/world/dovecot.sieve doesn't exist (using global script path in stead)

For me it happens too, when I send mail to b.eimaitis@mxmg2.metasite.net, I get in log:

Info: cmusieve: /data/vmail/sieve/mxmg2.metasite.net/b.eimaitis/dovecot.sieve doesn't exist

And here is nothing strange, because that script is located here: /data/vmail/sieve/klinika.lt/b.eimaitis/dovecot.sieve

Please, explain how can it work and what should I doto make it work.

############################

Another very important thing (let's forget about roundcube), when I make forward via iRedAdmin it doesn't work too. Please note my fifth post, you'll see required ldifs. When I send mail to b.eimaitis@mxmg2.metasite.net it gets delivered localy, but not forwarded as it should be and this is postfix configuration problem, not dovecot.

10

Re: forwarding issue

Hi,

Will my problem be solved? I need this function very much.

11

Re: forwarding issue

Testing on OpenSuSE 11.3 (x86_64), iRedMail-0.7.0-beta1 (same as 0.6.1 in this case), dovecot-1.2.15.

* Make sure i don't have other sieve rules on server:

suse:~ # find /var/vmail/
/var/vmail/
/var/vmail/sieve
/var/vmail/vmail1

* Create domains and accounts with iRedAdmin-Pro:

    - a.cn
        + orig@a.cn
        + sendmail@a.cn

    - external.com
        + user@external.com

* Add alias domain "alias.com" for domain "a.cn" with iRedAdmin-Pro, so that we have two more account addresses:

    - orig@alias.com
    - sendmail@alias.com

* Create mail filter for user "orig@a.cn" with Roundcube Webmail. content:

suse:~ # find /var/vmail/sieve/
/var/vmail/sieve/
/var/vmail/sieve/a.cn
/var/vmail/sieve/a.cn/orig
/var/vmail/sieve/a.cn/orig/dovecot.sieve
/var/vmail/sieve/a.cn/orig/tmp
/var/vmail/sieve/a.cn/orig/roundcube.sieve

suse:~ # cat /var/vmail/sieve/a.cn/orig/dovecot.sieve 
# rule:[forward]
if anyof (true)
{
    redirect "user@external.com";
}

* Turn on debug mode in Dovecot (dovecot.conf, "mail_debug = yes"), restart dovecot.
* Send email from "sendmail@a.cn" to "orig@alias.com".
* Monitor mail deliver log in /var/log/sieve.log. here's my result:

Nov 16 01:12:29 deliver(orig@a.cn): Info: Loading modules from directory: /usr/lib64/dovecot/modules/lda
Nov 16 01:12:29 deliver(orig@a.cn): Info: Module loaded: /usr/lib64/dovecot/modules/lda/lib10_quota_plugin.so
Nov 16 01:12:29 deliver(orig@a.cn): Info: Module loaded: /usr/lib64/dovecot/modules/lda/lib20_autocreate_plugin.so
Nov 16 01:12:29 deliver(orig@a.cn): Info: Module loaded: /usr/lib64/dovecot/modules/lda/lib90_sieve_plugin.so
Nov 16 01:12:29 deliver(orig@a.cn): Info: auth input: home=/var
Nov 16 01:12:29 deliver(orig@a.cn): Info: auth input: mail=maildir:~/vmail/a.cn/o/r/i/orig-2010.11.16.00.58.51//Maildir/
Nov 16 01:12:29 deliver(orig@a.cn): Info: auth input: quota_rule=*:bytes=104857600
Nov 16 01:12:29 deliver(orig@a.cn): Info: Quota root: name=user backend=dict args=:proxy::quotadict
Nov 16 01:12:29 deliver(orig@a.cn): Info: Quota rule: root=user mailbox=* bytes=104857600 messages=0
Nov 16 01:12:29 deliver(orig@a.cn): Info: Quota warning: bytes=89128960 (85%) messages=0 command=/usr/local/bin/dovecot-quota-warning.sh 85
Nov 16 01:12:29 deliver(orig@a.cn): Info: Quota warning: bytes=94371840 (90%) messages=0 command=/usr/local/bin/dovecot-quota-warning.sh 90
Nov 16 01:12:29 deliver(orig@a.cn): Info: Quota warning: bytes=99614720 (95%) messages=0 command=/usr/local/bin/dovecot-quota-warning.sh 95
Nov 16 01:12:29 deliver(orig@a.cn): Info: dict quota: user=orig@a.cn, uri=proxy::quotadict, noenforcing=0
Nov 16 01:12:29 deliver(orig@a.cn): Info: maildir: data=~/vmail/a.cn/o/r/i/orig-2010.11.16.00.58.51//Maildir/
Nov 16 01:12:29 deliver(orig@a.cn): Info: maildir++: root=/var/vmail/a.cn/o/r/i/orig-2010.11.16.00.58.51//Maildir, index=, control=, inbox=/var/vmail/a.cn/o/r/i/orig-2010.11.16.00.58.51//Maildir
Nov 16 01:12:29 deliver(orig@a.cn): Info: dict quota: user=orig@a.cn, uri=proxy::quotadict, noenforcing=0
Nov 16 01:12:29 deliver(orig@a.cn): Info: sieve: using sieve path for user's script: /var/vmail/sieve/a.cn/orig/dovecot.sieve
Nov 16 01:12:29 deliver(orig@a.cn): Info: sieve: opening script /var/vmail/sieve/a.cn/orig/dovecot.sieve
Nov 16 01:12:29 deliver(orig@a.cn): Info: sieve: executing compiled script /var/vmail/sieve/a.cn/orig/dovecot.sieve
Nov 16 01:12:29 deliver(orig@a.cn): Error: file_dotlock_create(/var/.dovecot.lda-dupes) failed: Permission denied
Nov 16 01:12:29 deliver(orig@a.cn): Info: sieve: msgid=<2c323f44aa2383d66022695e0e7afcbb@a.cn>: forwarded to <user@external.com>
Nov 16 01:12:29 deliver(user@external.com): Info: Loading modules from directory: /usr/lib64/dovecot/modules/lda
Nov 16 01:12:29 deliver(user@external.com): Info: Module loaded: /usr/lib64/dovecot/modules/lda/lib10_quota_plugin.so
Nov 16 01:12:29 deliver(user@external.com): Info: Module loaded: /usr/lib64/dovecot/modules/lda/lib20_autocreate_plugin.so
Nov 16 01:12:29 deliver(user@external.com): Info: Module loaded: /usr/lib64/dovecot/modules/lda/lib90_sieve_plugin.so
Nov 16 01:12:29 deliver(user@external.com): Info: auth input: home=/var
Nov 16 01:12:29 deliver(user@external.com): Info: auth input: mail=maildir:~/vmail/external.com/u/s/e/user-2010.11.16.01.00.37//Maildir/
Nov 16 01:12:29 deliver(user@external.com): Info: auth input: quota_rule=*:bytes=104857600
Nov 16 01:12:29 deliver(user@external.com): Info: Quota root: name=user backend=dict args=:proxy::quotadict
Nov 16 01:12:29 deliver(user@external.com): Info: Quota rule: root=user mailbox=* bytes=104857600 messages=0
Nov 16 01:12:29 deliver(user@external.com): Info: Quota warning: bytes=89128960 (85%) messages=0 command=/usr/local/bin/dovecot-quota-warning.sh 85
Nov 16 01:12:29 deliver(user@external.com): Info: Quota warning: bytes=94371840 (90%) messages=0 command=/usr/local/bin/dovecot-quota-warning.sh 90
Nov 16 01:12:29 deliver(user@external.com): Info: Quota warning: bytes=99614720 (95%) messages=0 command=/usr/local/bin/dovecot-quota-warning.sh 95
Nov 16 01:12:29 deliver(user@external.com): Info: dict quota: user=user@external.com, uri=proxy::quotadict, noenforcing=0
Nov 16 01:12:29 deliver(user@external.com): Info: maildir: data=~/vmail/external.com/u/s/e/user-2010.11.16.01.00.37//Maildir/
Nov 16 01:12:29 deliver(user@external.com): Info: maildir++: root=/var/vmail/external.com/u/s/e/user-2010.11.16.01.00.37//Maildir, index=, control=, inbox=/var/vmail/external.com/u/s/e/user-2010.11.16.01.00.37//Maildir
Nov 16 01:12:29 deliver(user@external.com): Info: dict quota: user=user@external.com, uri=proxy::quotadict, noenforcing=0
Nov 16 01:12:29 deliver(user@external.com): Info: sieve: user's script path /var/vmail/sieve/external.com/user/dovecot.sieve doesn't exist (using global script path in stead)
Nov 16 01:12:29 deliver(user@external.com): Info: sieve: using sieve path for user's script: /var/vmail/sieve/dovecot.sieve
Nov 16 01:12:29 deliver(user@external.com): Info: sieve: opening script /var/vmail/sieve/dovecot.sieve
Nov 16 01:12:29 deliver(user@external.com): Info: sieve: script file /var/vmail/sieve/dovecot.sieve is missing
Nov 16 01:12:29 deliver(user@external.com): Info: Namespace : Permission lookup failed from /var/vmail/external.com/u/s/e/user-2010.11.16.01.00.37//Maildir
Nov 16 01:12:29 deliver(user@external.com): Info: Namespace : Using permissions from /var/vmail/external.com/u/s/e/user-2010.11.16.01.00.37//Maildir: mode=0700 gid=-1
Nov 16 01:12:29 deliver(user@external.com): Info: msgid=<2c323f44aa2383d66022695e0e7afcbb@a.cn>: saved mail to INBOX

* Check mailbox of "user@external.com", and view RAW mail:

suse:~ # find /var/vmail/external.com/u/s/e/user-2010.11.16.01.00.37/
/var/vmail/external.com/u/s/e/user-2010.11.16.01.00.37/
/var/vmail/external.com/u/s/e/user-2010.11.16.01.00.37/Maildir
/var/vmail/external.com/u/s/e/user-2010.11.16.01.00.37/Maildir/dovecot-uidvalidity
/var/vmail/external.com/u/s/e/user-2010.11.16.01.00.37/Maildir/dovecot-uidlist
/var/vmail/external.com/u/s/e/user-2010.11.16.01.00.37/Maildir/new
/var/vmail/external.com/u/s/e/user-2010.11.16.01.00.37/Maildir/new/1289841149.M762957P13104.suse,S=1707,W=1749
/var/vmail/external.com/u/s/e/user-2010.11.16.01.00.37/Maildir/cur
/var/vmail/external.com/u/s/e/user-2010.11.16.01.00.37/Maildir/tmp
/var/vmail/external.com/u/s/e/user-2010.11.16.01.00.37/Maildir/dovecot.index.log
/var/vmail/external.com/u/s/e/user-2010.11.16.01.00.37/Maildir/dovecot-uidvalidity.4ce169fd

suse:~ # cat /var/vmail/external.com/u/s/e/user-2010.11.16.01.00.37/Maildir/new/1289841149.M762957P13104.suse,S=1707,W=1749

* Here's postfix log from /var/log/mail (OpenSuSE):

Nov 16 01:12:19 suse postfix/smtpd[13071]: connect from unknown[127.0.0.1]
Nov 16 01:12:20 suse postfix/smtpd[13071]: 24B70FF69E: client=unknown[127.0.0.1], sasl_method=LOGIN, sasl_username=sendmail@a.cn
Nov 16 01:12:20 suse postfix/cleanup[13080]: 24B70FF69E: message-id=<2c323f44aa2383d66022695e0e7afcbb@a.cn>
Nov 16 01:12:20 suse roundcube: User sendmail@a.cn [192.168.187.1]; Message for orig@alias.com; 250: 2.0.0 Ok: queued as 24B70FF69E
Nov 16 01:12:20 suse postfix/qmgr[3072]: 24B70FF69E: from=<sendmail@a.cn>, size=536, nrcpt=1 (queue active)
Nov 16 01:12:20 suse postfix/smtpd[13071]: disconnect from unknown[127.0.0.1]
Nov 16 01:12:29 suse postfix/smtpd[13099]: connect from unknown[127.0.0.1]
Nov 16 01:12:29 suse postfix/smtpd[13099]: 4104BFF6A6: client=unknown[127.0.0.1]
Nov 16 01:12:29 suse postfix/cleanup[13080]: 4104BFF6A6: message-id=<2c323f44aa2383d66022695e0e7afcbb@a.cn>
Nov 16 01:12:29 suse postfix/smtpd[13099]: disconnect from unknown[127.0.0.1]
Nov 16 01:12:29 suse postfix/qmgr[3072]: 4104BFF6A6: from=<sendmail@a.cn>, size=1515, nrcpt=1 (queue active)
Nov 16 01:12:29 suse amavis[3224]: (03224-01) Passed CLEAN, MYNETS/MYUSERS LOCAL [127.0.0.1] [127.0.0.1] <sendmail@a.cn> -> <orig@a.cn>, Message-ID: <2c323f44aa2383d66022695e0e7afcbb@a.cn>, mail_id: u2Q8Di-sYiHE, Hits: -10, size: 536, queued_as: 4104BFF6A6, 9227 ms
Nov 16 01:12:29 suse postfix/pickup[10880]: A3777FF6B1: uid=1000 from=<sendmail@a.cn>
Nov 16 01:12:29 suse postfix/pipe[13100]: 4104BFF6A6: to=<orig@a.cn>, relay=dovecot, delay=0.42, delays=0.02/0.04/0/0.36, dsn=2.0.0, status=sent (delivered via dovecot service)
Nov 16 01:12:29 suse postfix/qmgr[3072]: 4104BFF6A6: removed
Nov 16 01:12:29 suse postfix/cleanup[13080]: A3777FF6B1: message-id=<2c323f44aa2383d66022695e0e7afcbb@a.cn>
Nov 16 01:12:29 suse postfix/smtp[13081]: 24B70FF69E: to=<orig@a.cn>, relay=127.0.0.1[127.0.0.1]:10024, delay=9.8, delays=0.23/0.04/0.24/9.3, dsn=2.0.0, status=sent (250 2.0.0 from MTA([127.0.0.1]:10025): 250 2.0.0 Ok: queued as 4104BFF6A6)
Nov 16 01:12:29 suse postfix/qmgr[3072]: 24B70FF69E: removed
Nov 16 01:12:29 suse postfix/qmgr[3072]: A3777FF6B1: from=<sendmail@a.cn>, size=1686, nrcpt=1 (queue active)
Nov 16 01:12:29 suse postfix/pipe[13100]: A3777FF6B1: to=<user@external.com>, relay=dovecot, delay=0.24, delays=0.11/0/0/0.13, dsn=2.0.0, status=sent (delivered via dovecot service)
Nov 16 01:12:29 suse postfix/qmgr[3072]: A3777FF6B1: removed

* My dovecot-ldap.conf:

suse:~ # cat /etc/dovecot/dovecot-ldap.conf
hosts           = 127.0.0.1:389
ldap_version    = 3
auth_bind       = yes
dn              = cn=vmail,dc=iredmail,dc=org
dnpass          = [PWD]
base            = o=domains,dc=iredmail,dc=org
scope           = subtree
deref           = never
user_filter     = (&(objectClass=mailUser)(accountStatus=active)(enabledService=mail)(enabledService=%Ls%Lc)(|(mail=%u)(&(enabledService=shadowaddress)(shadowAddress=%u))))
pass_filter     = (&(objectClass=mailUser)(accountStatus=active)(enabledService=mail)(enabledService=%Ls%Lc)(|(mail=%u)(&(enabledService=shadowaddress)(shadowAddress=%u))))
pass_attrs      = userPassword=password
default_pass_scheme = CRYPT
user_attrs      = storageBaseDirectory=home,mailMessageStore=mail=maildir:~/%$/Maildir/,mailQuota=quota_rule=*:bytes=%$

12

Re: forwarding issue

My side slightly differ.

Sieve rules:

[root@node1-iv ~]# find /data/vmail/sieve/klinika.lt/
/data/vmail/sieve/klinika.lt/
/data/vmail/sieve/klinika.lt/b.eimaitis
/data/vmail/sieve/klinika.lt/b.eimaitis/roundcube
/data/vmail/sieve/klinika.lt/b.eimaitis/dovecot.sieve

[root@node1-iv ~]# cat /data/vmail/sieve/klinika.lt/b.eimaitis/dovecot.sieve
# rule:[forwardas]
if anyof (true)
{
        redirect "mindaugas@externaldomain.com";
}

Create domain and account with iRedAdmin-Pro:

- klinika.lt
        + b.eimaitis@klinika.lt

Add alias domain "mxmg2.metasite.net" for domain "klinika.lt" with iRedAdmin-Pro, so that we have one more account address:

    - b.eimaitis@mxmg2.metasite.net

Turn on debug mode in Dovecot (dovecot.conf, "mail_debug = yes"), restart dovecot.
Send email from shell to "b.eimaitis@mxmg2.metasite.net" (echo test | mail -s test b.eimaitis@mxmg2.metasite.net).
Monitor mail deliver log in /var/log/sieve.log. here's my result:

deliver(b.eimaitis@mxmg2.metasite.net): Nov 15 20:50:34 Info: Loading modules from directory: /usr/lib64/dovecot/lda
deliver(b.eimaitis@mxmg2.metasite.net): Nov 15 20:50:34 Info: Module loaded: /usr/lib64/dovecot/lda/lib10_quota_plugin.so
deliver(b.eimaitis@mxmg2.metasite.net): Nov 15 20:50:34 Info: Module loaded: /usr/lib64/dovecot/lda/lib90_cmusieve_plugin.so
deliver(b.eimaitis@mxmg2.metasite.net): Nov 15 20:50:34 Info: auth input: home=/data/vmail
deliver(b.eimaitis@mxmg2.metasite.net): Nov 15 20:50:34 Info: auth input: mail=maildir:~/vmail1/klinika.lt/b/b./b.e/b.eimaitis-2010.11.10.01.15.07//Maildir/
deliver(b.eimaitis@mxmg2.metasite.net): Nov 15 20:50:34 Info: auth input: quota_rule=*:bytes=0
deliver(b.eimaitis@mxmg2.metasite.net): Nov 15 20:50:34 Info: Quota root: name= backend=maildir args=
deliver(b.eimaitis@mxmg2.metasite.net): Nov 15 20:50:34 Info: Quota rule: root= mailbox=* bytes=0 messages=0
deliver(b.eimaitis@mxmg2.metasite.net): Nov 15 20:50:34 Info: Quota warning: bytes=0 (85%) messages=0 command=/usr/local/bin/dovecot-quota-warning.sh 85
deliver(b.eimaitis@mxmg2.metasite.net): Nov 15 20:50:34 Info: Quota warning: bytes=0 (90%) messages=0 command=/usr/local/bin/dovecot-quota-warning.sh 90
deliver(b.eimaitis@mxmg2.metasite.net): Nov 15 20:50:34 Info: Quota warning: bytes=0 (95%) messages=0 command=/usr/local/bin/dovecot-quota-warning.sh 95
deliver(b.eimaitis@mxmg2.metasite.net): Nov 15 20:50:34 Info: maildir: data=~/vmail1/klinika.lt/b/b./b.e/b.eimaitis-2010.11.10.01.15.07//Maildir/
deliver(b.eimaitis@mxmg2.metasite.net): Nov 15 20:50:34 Info: maildir++: root=/data/vmail/vmail1/klinika.lt/b/b./b.e/b.eimaitis-2010.11.10.01.15.07//Maildir, index=, control=, inbox=/data/vmail/vmail1/klinika.lt/b/b./b.e/b.eimaitis-2010.11.10.01.15.07//Maildir
deliver(b.eimaitis@mxmg2.metasite.net): Nov 15 20:50:34 Info: cmusieve: /data/vmail/sieve/mxmg2.metasite.net/b.eimaitis/dovecot.sieve doesn't exist
deliver(b.eimaitis@mxmg2.metasite.net): Nov 15 20:50:34 Info: cmusieve: Using sieve path: /data/vmail/sieve/dovecot.sieve
deliver(b.eimaitis@mxmg2.metasite.net): Nov 15 20:50:34 Info: cmusieve: Script not found: /data/vmail/sieve/dovecot.sieve
deliver(b.eimaitis@mxmg2.metasite.net): Nov 15 20:50:34 Info: msgid=<20101115185034.3A84E271C0CB@node1-iv.metasite.lt>: saved mail to INBOX

My dovecot-ldap.conf:

#
# File generated by iRedMail (2010.08.22.15.43.18):
#
# Version:  0.6.1
# Project:  http://www.iredmail.org/
#
# Community: http://www.iredmail.org/forum/
#

hosts           = 127.0.0.1:389
ldap_version    = 3
auth_bind       = yes
dn              = cn=vmail,dc=node1-iv,dc=metasite,dc=lt
dnpass          = PWD
base            = o=domains,dc=node1-iv,dc=metasite,dc=lt
scope           = subtree
deref           = never
user_filter     = (&(objectClass=mailUser)(accountStatus=active)(enabledService=mail)(enabledService=%Ls%Lc)(|(mail=%u)(&(enabledService=shadowaddress)(shadowAddress=%u))))
pass_filter     = (&(objectClass=mailUser)(accountStatus=active)(enabledService=mail)(enabledService=%Ls%Lc)(|(mail=%u)(&(enabledService=shadowaddress)(shadowAddress=%u))))
pass_attrs      = userPassword=password
default_pass_scheme = CRYPT
user_attrs      = storageBaseDirectory=home,mailMessageStore=mail=maildir:~/%$/Maildir/,mailQuota=quota_rule=*:bytes=%$

I have no idea  why it doesn't work for me..

13

Re: forwarding issue

dammit wrote:

Send email from shell to "b.eimaitis@mxmg2.metasite.net" (echo test | mail -s test b.eimaitis@mxmg2.metasite.net).

Did you try sending email with webmai or other MUA (outlook, ThunderBird, etc)?

14 (edited by dammit 2010-11-16 19:57:24)

Re: forwarding issue

ZhangHuangbin wrote:
dammit wrote:

Send email from shell to "b.eimaitis@mxmg2.metasite.net" (echo test | mail -s test b.eimaitis@mxmg2.metasite.net).

Did you try sending email with webmai or other MUA (outlook, ThunderBird, etc)?

I tried with no luck. Today I even made a fresh install of iRedMail 0.6.1 with as default configuration as possible. But it is not working sad.

However, I see interesting thing in your log. You say: Send email from "sendmail@a.cn" to "orig@alias.com". But you don't! Because in your log I can see you still sending to orig@a.cn:

Nov 16 01:12:29 deliver(orig@a.cn): Info: Loading modules from directory: /usr/lib64/dovecot/modules/lda
Nov 16 01:12:29 deliver(orig@a.cn): Info: Module loaded: /usr/lib64/dovecot/modules/lda/lib10_quota_plugin.so
Nov 16 01:12:29 deliver(orig@a.cn): Info: Module loaded: /usr/lib64/dovecot/modules/lda/lib20_autocreate_plugin.so
Nov 16 01:12:29 deliver(orig@a.cn): Info: Module loaded: /usr/lib64/dovecot/modules/lda/lib90_sieve_plugin.so
Nov 16 01:12:29 deliver(orig@a.cn): Info: auth input: home=/var
Nov 16 01:12:29 deliver(orig@a.cn): Info: auth input: mail=maildir:~/vmail/a.cn/o/r/i/orig-2010.11.16.00.58.51//Maildir/
Nov 16 01:12:29 deliver(orig@a.cn): Info: auth input: quota_rule=*:bytes=104857600
Nov 16 01:12:29 deliver(orig@a.cn): Info: Quota root: name=user backend=dict args=:proxy::quotadict
Nov 16 01:12:29 deliver(orig@a.cn): Info: Quota rule: root=user mailbox=* bytes=104857600 messages=0
Nov 16 01:12:29 deliver(orig@a.cn): Info: Quota warning: bytes=89128960 (85%) messages=0 command=/usr/local/bin/dovecot-quota-warning.sh 85
Nov 16 01:12:29 deliver(orig@a.cn): Info: Quota warning: bytes=94371840 (90%) messages=0 command=/usr/local/bin/dovecot-quota-warning.sh 90
Nov 16 01:12:29 deliver(orig@a.cn): Info: Quota warning: bytes=99614720 (95%) messages=0 command=/usr/local/bin/dovecot-quota-warning.sh 95
Nov 16 01:12:29 deliver(orig@a.cn): Info: dict quota: user=orig@a.cn, uri=proxy::quotadict, noenforcing=0
Nov 16 01:12:29 deliver(orig@a.cn): Info: maildir: data=~/vmail/a.cn/o/r/i/orig-2010.11.16.00.58.51//Maildir/
Nov 16 01:12:29 deliver(orig@a.cn): Info: maildir++: root=/var/vmail/a.cn/o/r/i/orig-2010.11.16.00.58.51//Maildir, index=, control=, inbox=/var/vmail/a.cn/o/r/i/orig-2010.11.16.00.58.51//Maildir
Nov 16 01:12:29 deliver(orig@a.cn): Info: dict quota: user=orig@a.cn, uri=proxy::quotadict, noenforcing=0
Nov 16 01:12:29 deliver(orig@a.cn): Info: sieve: using sieve path for user's script: /var/vmail/sieve/a.cn/orig/dovecot.sieve
Nov 16 01:12:29 deliver(orig@a.cn): Info: sieve: opening script /var/vmail/sieve/a.cn/orig/dovecot.sieve
Nov 16 01:12:29 deliver(orig@a.cn): Info: sieve: executing compiled script /var/vmail/sieve/a.cn/orig/dovecot.sieve
Nov 16 01:12:29 deliver(orig@a.cn): Error: file_dotlock_create(/var/.dovecot.lda-dupes) failed: Permission denied
Nov 16 01:12:29 deliver(orig@a.cn): Info: sieve: msgid=<2c323f44aa2383d66022695e0e7afcbb@a.cn>: forwarded to <user@external.com>

15 (edited by dammit 2010-11-16 21:13:25)

Re: forwarding issue

Another very important thing, that in the same situation forwarding doesn't work even I do it via iRedAdmin Pro. So, I made some analysis.

Situation:

Create domain and account with iRedAdmin-Pro:

- klinika.lt
            + b.eimaitis@klinika.lt

Add alias domain "mxmg2.metasite.net" for domain "klinika.lt" with iRedAdmin-Pro, so that we have one more account address:

    - b.eimaitis@mxmg2.metasite.net

And add forward to eimaitis@metasite.net for b.eimaitis@klinika.lt mailbox.

So, this is my ldiff:

dn: mail=b.eimaitis@klinika.lt,ou=Users,domainName=klinika.lt,o=domains,dc=node1-iv,dc=metasite,dc=lt
accountStatus: active
amavisLocal: TRUE
cn: b.eimaitis
enabledService: mail
enabledService: smtp
enabledService: deliver
enabledService: pop3
enabledService: pop3secured
enabledService: imap
enabledService: imapsecured
enabledService: managesieve
enabledService: managesievesecured
enabledService: sieve
enabledService: sievesecured
enabledService: forward
enabledService: senderbcc
enabledService: recipientbcc
enabledService: internal
enabledService: shadowaddress
enabledService: displayedInGlobalAddressBook
homeDirectory: /data/vmail/vmail1/klinika.lt/b/b./b.e/b.eimaitis-2010.11.10.01.15.07/
mail: b.eimaitis@klinika.lt
mailForwardingAddress: eimaitis@metasite.net
mailMessageStore: vmail1/klinika.lt/b/b./b.e/b.eimaitis-2010.11.10.01.15.07/
mailQuota: 0
objectClass: inetOrgPerson
objectClass: mailUser
objectClass: shadowAccount
objectClass: amavisAccount
shadowAddress: b.eimaitis@mxmg2.metasite.net
sn: b.eimaitis
storageBaseDirectory: /data/vmail
uid: b.eimaitis
userPassword: PWD

The problem is that if I send mail to b.eimaitis@mxmg2.metasite.net it gets delivered localy, but not forwarded as it should.

Let's go deeper. Postfix configuration file which responsible for forwarding is "/etc/postfix/ldap_virtual_alias_maps.cf", which looks like so:

server_host     = 127.0.0.1
server_port     = 389
version         = 3
bind            = yes
start_tls       = no
bind_dn         = cn=vmail,dc=node1-iv,dc=metasite,dc=lt
bind_pw         = PWD
search_base     = domainName=%d,o=domains,dc=node1-iv,dc=metasite,dc=lt
scope           = sub
query_filter    = (&(|(mail=%s)(shadowAddress=%s))(accountStatus=active)(enabledService=mail)(enabledService=deliver)(|(objectClass=mailAlias)(&(objectClass=mailUser)(enabledService=forward))))
result_attribute= mailForwardingAddress
debuglevel      = 0

So, in my situation "search_base" becomes domainName=mxmg2.metasite.net,o=domains,dc=node1-iv,dc=metasite,dc=lt. Actualy, this is non existent entry, so that's why forward is not working.

The question is why search_base is domainName=%d,o=domains,dc=node1-iv,dc=metasite,dc=lt ? I think it should be just o=domains,dc=node1-iv,dc=metasite,dc=lt Is it made for better performance?

16

Re: forwarding issue

dammit wrote:

However, I see interesting thing in your log. You say: Send email from "sendmail@a.cn" to "orig@alias.com". But you don't! Because in your log I can see you still sending to orig@a.cn:

Did you see log in maillog i pasted above? here it is:

Nov 16 01:12:20 suse roundcube: User sendmail@a.cn [192.168.187.1]; Message for orig@alias.com; 250: 2.0.0 Ok: queued as 24B70FF69E

Because 'orig@alias.com' is a user alias address, so it should point to user 'orig@a.cn', including mailbox path, sieve filter file, that's how user alias work. So it is shown as 'orig@a.cn' in /var/log/sieve.log is expected result.

17

Re: forwarding issue

So, in my situation "search_base" becomes domainName=mxmg2.metasite.net,o=domains,dc=node1-iv,dc=metasite,dc=lt. Actualy, this is non existent entry, so that's why forward is not working.
The question is why search_base is domainName=%d,o=domains,dc=node1-iv,dc=metasite,dc=lt ? I think it should be just o=domains,dc=node1-iv,dc=metasite,dc=lt Is it made for better performance?

You got the point, you can try to change search base to 'o=dmains,dc=node1-iv,dc=metasite,dc=lt', restart postfix and test again, it should work as expected now.

I'm sorry about this, i almost forgot postfix ldap lookup sad

And, Restrict search base in a small area/tree is better for performance.