OSEC

Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com
Re: forward mail & deliver it locally

From: Magnus Bäck (magnusdsek.lth.se)
Date: Mon Aug 04 2008 - 13:57:07 CDT


On Monday, August 04, 2008 at 20:49 CEST,
     Aaron Bennett <abennettclarku.edu> wrote:

> Magnus Bäck wrote:
>
> > Set up an alias on the following form:
> >
> > userexample.com userexample.com,userexample.net
> >
> > In your LDAP map configuration this could translate to something like:
> >
> > query_filter = mail=%s
> > result_attribute = mail, mailForwardingAddress
>
> Does that go in $alias_maps or $virtual_alias_maps?

This particular example is meant for virtual aliases, but if you adjust
it so that it expects the lookup key to be the bare username it'll work
with local aliases as well.

query_filter = uid=%s
result_attribute = mail, mailForwardingAddress

> I have three ldap maps working:
>
> ldap-localonly.cf
> ldap-forwardonly.cf
> ldap-forwardkeep.cf
>
> When I query them with postmap -q emailexample.com, I get the right
> thing:
>
> if the user is set up just to get their local mail, I get:
> userexample.com as a result from ldap-localonly.cf and nothing from
> the other
> if they are set to forward their mail and keep it locally, I get:
> userexample.net,userexample.com
> if they are set to just forward and not keep it, I get: userexample.net
>
> however, it's not forwarding, it's just doing local delivery
>
>
> [rootmaildrop postfix]# postconf -n
> alias_database = hash:/etc/aliases
> alias_maps = hash:/etc/aliases,
> proxy:ldap:/etc/postfix/ldap-forwardonly.cf,
> proxy:ldap:/etc/postfix/ldap-forwardkeep.cf,
> proxy:ldap:/etc/postfix/ldap-localonly.cf

That's because you've set these up as local aliases, but then the lookup
key is the bare username.

[...]

--
Magnus Bäck
magnusdsek.lth.se