Greetings postfixers

I have a address-rewriting issue that I cannot find a golden solution for

in ldap (shortened for clairty) I have the following attributes:

uid: abc123
mail: abc...@example.com
alias: alias...@example.com
forward: forward...@anotherexample.com
keep: abc...@example.com

when a mail for the *alias* arrives, I want to tee it, using virtual_alias_maps:

alias...@example.com -> alias...@example.com, alias...@rewrite.example.com

when a mail arrives for mail OR alias, I want to check if I should
forward it (and eventual keep a local copy), using virtual_alias_map
again

abc...@example.com -> forward...@anotherexample.com, abc...@example.com

So my initial idea was to do:

virtual_alias_maps = ldap:/path/tee.cf,ldap:/path/fwd.cf

where

tee.cf:

query_filter = (&(objectClass=MailRecipient)(alias=%s))
result_attribute = alias
result_format = %...@rewrite.example.com,%...@example.com

fwd.cf:

query_filter = (&(objectClass=MailRecipient)(|(mail=%s)(alias=%s)))
result_attribute = forward, keep


This works fine if incomming is for the "mail", then the fwd kicks in,
and forwards/keeps local copy

if incomming is for the alias, there is local delivery, and a tee for
the rewrite domain, but the forward check isn't done, since the first
lookup was a hit.

I cannot come up with just one ldap-query/result that returns

alias...@example.com, alias...@rewrite.example.com,
forward...@anotherexample.com, abc...@example.com

for the incomming to the alias

and

forward...@anotherexample.com, abc...@example.com

for the incomming to the mail.

any suggestions on howto ???


I have one suggestion myself, and that is to add an attribute called
"rewrite" with value abc...@rewrite.example.com
and then do

tee.cf:

query_filter = (&(objectClass=MailRecipient)(alias=%s))
result_attribute = alias,rewrite,forward,keep

but I hate the idea of maintaining (and keep sync'ed) redundant data
in the ldap, since the alias attribute is user-updateable (and ldap is
1.5M accounts)

-- 
Søren Schrøder.
Obey Gravity - It's the law !

Reply via email to