ldap aliases

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

ldap aliases

Bugzilla from nbensa@gmail.com
Hello list!

I'm trying to move my aliases to ldap. It's somewhat working right now  
but I have a question.

It seems that Postfix searches the database by the username part of  
the email account. For example if I send email to [hidden email]  
(note that bensa.ar doesn't exist on the internet) Postfix checks for  
"norberto" not "[hidden email]"


main.cf:

alias_maps              = hash:/etc/mail/aliases
                           ldap:/etc/postfix/ldap-aliases.cf

====================================================================
ldap-aliases.cf:

bind                    = no
server_host             = ldap://127.0.0.1/
search_base             = ou=users,dc=bensa,dc=ar
scope                   = sub
size_limit              = 1
query_filter            = (&(objectClass=inetLocalMailRecipient)(mail=%s))
result_attribute        = mailLocalAddress

====================================================================
$ ldapsearch -x 'uid=nbensa' mailLocalAddress mail

dn: uid=nbensa,ou=users,dc=bensa,dc=ar
mail: [hidden email]
mail: [hidden email]
mail: [hidden email]
mailLocalAddress: [hidden email]

====================================================================

If I change query_filter to "mail=%[hidden email]" then it works, but then  
I loss the ability to do virtual domains.

I'm sure I'm missing something, but I don't know what.

Many thanks in advance,
Norberto

----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.


Reply | Threaded
Open this post in threaded view
|

Re: ldap aliases

Wietse Venema
Norberto Bensa:

> Hello list!
>
> I'm trying to move my aliases to ldap. It's somewhat working right now  
> but I have a question.
>
> It seems that Postfix searches the database by the username part of  
> the email account. For example if I send email to [hidden email]  
> (note that bensa.ar doesn't exist on the internet) Postfix checks for  
> "norberto" not "[hidden email]"
>
>
> main.cf:
>
> alias_maps              = hash:/etc/mail/aliases
>                            ldap:/etc/postfix/ldap-aliases.cf

As documented, alias_maps is searched by the address localpart
only, and virtual_alias_maps is searched by the full address.

See: http://www.postfix.org/ADDRESS_REWRITING_README.html and pages
linked from it.

Note: you can use virtual aliases WIHOUT having virtual alias domains.

        Wietse
Reply | Threaded
Open this post in threaded view
|

Re: ldap aliases

Bugzilla from nbensa@gmail.com
Quoting Wietse Venema <[hidden email]>:

> Norberto Bensa:
>> It seems that Postfix searches the database by the username part of
>> the email account.         ldap:/etc/postfix/ldap-aliases.cf
>
> As documented, alias_maps is searched by the address localpart
> only, and virtual_alias_maps is searched by the full address.
>
> See: http://www.postfix.org/ADDRESS_REWRITING_README.html and pages
> linked from it.
>
> Note: you can use virtual aliases WIHOUT having virtual alias domains.
>

Thank you very much Wietse!!

I changed:

alias_maps = hash:/etc/mail/aliases
              ldap:/etc/postfix/ldap-aliases.cf

to:

alias_maps         = hash:/etc/mail/aliases
virtual_alias_maps = ldap:/etc/postfix/ldap-aliases.cf

and query_filter from:

query_filter = (&(objectClass=inetLocalMailRecipient)(mail=%[hidden email]))

to:

query_filter = (&(objectClass=inetLocalMailRecipient)(mail=%s))


everything is working now.

Many thanks again!

Best regards,
Norberto

----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.