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?