Loading ...
Sorry, an error occurred while loading the content.

aliasing whole domain using ldap

Expand Messages
  • Michael Tokarev
    I never actually used LDAP, and someone asked if it s possible to alias one domain to another, and I wonder if its doable in LDAP the Right Way. Let s assume
    Message 1 of 2 , Dec 1, 2010
    • 0 Attachment
      I never actually used LDAP, and someone asked if it's possible
      to alias one domain to another, and I wonder if its doable in
      LDAP the Right Way.

      Let's assume we've example.com domain with all the addresses
      stored in LDAP somehow. Now let's assume also that example.net
      should be an alias for example.com.

      For example.com, postfix configured to query LDAP for this
      expression (I don't know LDAP so I use sql-like syntax):

      select mailbox_location from ldap where
      mailaddress = '$localpart@$domain'

      Now, is it possible to modify the query so that other domain
      works too, like this:

      select mailbox_location from ldap where
      mailaddress = '$localpart@$domain'
      or
      ('$domain' = 'example.net' and
      mailaddress = '$localpart@...')

      ? Is it doable in LDAP query?

      (Not a my problem, I don't use LDAP, but someone asked this
      yesterday in #postfix on freenode.net, and made me curious).

      Thanks!

      /mjt
    • Victor Duchovni
      ... Yes, but it costs one table for each aliased domain (the domain can have multiple aliases). domain = example.net ... query_filter = mail=%u@example.com
      Message 2 of 2 , Dec 1, 2010
      • 0 Attachment
        On Wed, Dec 01, 2010 at 12:47:58PM +0300, Michael Tokarev wrote:

        > Let's assume we've example.com domain with all the addresses
        > stored in LDAP somehow. Now let's assume also that example.net
        > should be an alias for example.com.
        >

        Yes, but it costs one table for each aliased domain (the domain can have
        multiple aliases).

        domain = example.net ...
        query_filter = mail=%u@...
        result_attribute = mail

        It is generally better to store multiple addresses for each user.

        LDIF:
        mail: primary@...
        mailalternateaddress: primary@...
        mailalternateaddress: secondary@...
        mailalternateaddress: tertiary@...
        maildrop: mailbox@...

        virtual.cf:

        domain = example.com example.net
        query_filter = mailalternateaddress=%s
        result_attribute = maildrop

        --
        Viktor.
      Your message has been successfully submitted and would be delivered to recipients shortly.