Home | History | Annotate | Line # | Download | only in README_FILES
      1  1.1.1.5  christos s!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN" "https://
      2  1.1.1.5  christos www.w3.org/TR/html4/loose.dtd">
      3  1.1.1.5  christos 
      4      1.1      tron PPoossttffiixx LLDDAAPP HHoowwttoo
      5      1.1      tron 
      6      1.1      tron -------------------------------------------------------------------------------
      7      1.1      tron 
      8      1.1      tron LLDDAAPP SSuuppppoorrtt iinn PPoossttffiixx
      9      1.1      tron 
     10      1.1      tron Postfix can use an LDAP directory as a source for any of its lookups: aliases
     11      1.1      tron (5), virtual(5), canonical(5), etc. This allows you to keep information for
     12      1.1      tron your mail service in a replicated network database with fine-grained access
     13      1.1      tron controls. By not storing it locally on the mail server, the administrators can
     14      1.1      tron maintain it from anywhere, and the users can control whatever bits of it you
     15      1.1      tron think appropriate. You can have multiple mail servers using the same
     16      1.1      tron information, without the hassle and delay of having to copy it to each.
     17      1.1      tron 
     18      1.1      tron Topics covered in this document:
     19      1.1      tron 
     20      1.1      tron   * Building Postfix with LDAP support
     21      1.1      tron   * Configuring LDAP lookups
     22      1.1      tron   * Example: aliases
     23      1.1      tron   * Example: virtual domains/addresses
     24      1.1      tron   * Example: expanding LDAP groups
     25      1.1      tron   * Other uses of LDAP lookups
     26      1.1      tron   * Notes and things to think about
     27      1.1      tron   * Feedback
     28      1.1      tron   * Credits
     29      1.1      tron 
     30      1.1      tron BBuuiillddiinngg PPoossttffiixx wwiitthh LLDDAAPP ssuuppppoorrtt
     31      1.1      tron 
     32      1.1      tron These instructions assume that you build Postfix from source code as described
     33      1.1      tron in the INSTALL document. Some modification may be required if you build Postfix
     34      1.1      tron from a vendor-specific source package.
     35      1.1      tron 
     36      1.1      tron Note 1: Postfix no longer supports the LDAP version 1 interface.
     37      1.1      tron 
     38      1.1      tron Note 2: to use LDAP with Debian GNU/Linux's Postfix, all you need is to install
     39      1.1      tron the postfix-ldap package and you're done. There is no need to recompile
     40      1.1      tron Postfix.
     41      1.1      tron 
     42      1.1      tron You need to have LDAP libraries and include files installed somewhere on your
     43      1.1      tron system, and you need to configure the Postfix Makefiles accordingly.
     44      1.1      tron 
     45      1.1      tron For example, to build the OpenLDAP libraries for use with Postfix (i.e. LDAP
     46      1.1      tron client code only), you could use the following command:
     47      1.1      tron 
     48      1.1      tron     % ./configure  --without-kerberos --without-cyrus-sasl --without-tls \
     49      1.1      tron         --without-threads --disable-slapd --disable-slurpd \
     50      1.1      tron         --disable-debug --disable-shared
     51      1.1      tron 
     52  1.1.1.5  christos If you're using the libraries from OpenLDAP (https://www.openldap.org),
     53  1.1.1.5  christos something like this in the top level of your Postfix source tree should work:
     54      1.1      tron 
     55      1.1      tron     % make tidy
     56      1.1      tron     % make makefiles CCARGS="-I/usr/local/include -DHAS_LDAP" \
     57  1.1.1.3  christos         AUXLIBS_LDAP="-L/usr/local/lib -lldap -L/usr/local/lib -llber"
     58  1.1.1.3  christos 
     59  1.1.1.4  christos If your LDAP shared library is in a directory that the RUN-TIME linker does not
     60  1.1.1.4  christos know about, add a "-Wl,-R,/path/to/directory" option after "-lldap".
     61  1.1.1.4  christos 
     62  1.1.1.3  christos Postfix versions before 3.0 use AUXLIBS instead of AUXLIBS_LDAP. With Postfix
     63  1.1.1.3  christos 3.0 and later, the old AUXLIBS variable still supports building a statically-
     64  1.1.1.3  christos loaded LDAP database client, but only the new AUXLIBS_LDAP variable supports
     65  1.1.1.3  christos building a dynamically-loaded or statically-loaded LDAP database client.
     66  1.1.1.3  christos 
     67  1.1.1.3  christos     Failure to use the AUXLIBS_LDAP variable will defeat the purpose of dynamic
     68  1.1.1.3  christos     database client loading. Every Postfix executable file will have LDAP
     69  1.1.1.3  christos     database library dependencies. And that was exactly what dynamic database
     70  1.1.1.3  christos     client loading was meant to avoid.
     71      1.1      tron 
     72      1.1      tron On Solaris 2.x you may have to specify run-time link information, otherwise
     73      1.1      tron ld.so will not find some of the shared libraries:
     74      1.1      tron 
     75      1.1      tron     % make tidy
     76      1.1      tron     % make makefiles CCARGS="-I/usr/local/include -DHAS_LDAP" \
     77  1.1.1.3  christos         AUXLIBS_LDAP="-L/usr/local/lib -R/usr/local/lib -lldap \
     78      1.1      tron                 -L/usr/local/lib -R/usr/local/lib -llber"
     79      1.1      tron 
     80      1.1      tron The 'make tidy' command is needed only if you have previously built Postfix
     81      1.1      tron without LDAP support.
     82      1.1      tron 
     83      1.1      tron Instead of '/usr/local' specify the actual locations of your LDAP include files
     84      1.1      tron and libraries. Be sure to not mix LDAP include files and LDAP libraries of
     85      1.1      tron different versions!!
     86      1.1      tron 
     87      1.1      tron If your LDAP libraries were built with Kerberos support, you'll also need to
     88      1.1      tron include your Kerberos libraries in this line. Note that the KTH Kerberos IV
     89      1.1      tron libraries might conflict with Postfix's lib/libdns.a, which defines dns_lookup.
     90      1.1      tron If that happens, you'll probably want to link with LDAP libraries that lack
     91      1.1      tron Kerberos support just to build Postfix, as it doesn't support Kerberos binds to
     92      1.1      tron the LDAP server anyway. Sorry about the bother.
     93      1.1      tron 
     94      1.1      tron If you're using one of the Netscape LDAP SDKs, you'll need to change the
     95      1.1      tron AUXLIBS line to point to libldap10.so or libldapssl30.so or whatever you have,
     96      1.1      tron and you may need to use the appropriate linker option (e.g. '-R') so the
     97      1.1      tron executables can find it at runtime.
     98      1.1      tron 
     99  1.1.1.2      tron If you are using OpenLDAP, and the libraries were built with SASL support, you
    100  1.1.1.2      tron can add -DUSE_LDAP_SASL to the CCARGS to enable SASL support. For example:
    101  1.1.1.2      tron 
    102  1.1.1.2      tron          CCARGS="-I/usr/local/include -DHAS_LDAP -DUSE_LDAP_SASL"
    103  1.1.1.2      tron 
    104      1.1      tron CCoonnffiigguurriinngg LLDDAAPP llooookkuuppss
    105      1.1      tron 
    106      1.1      tron In order to use LDAP lookups, define an LDAP source as a table lookup in
    107      1.1      tron main.cf, for example:
    108      1.1      tron 
    109      1.1      tron     alias_maps = hash:/etc/aliases, ldap:/etc/postfix/ldap-aliases.cf
    110      1.1      tron 
    111      1.1      tron The file /etc/postfix/ldap-aliases.cf can specify a great number of parameters,
    112  1.1.1.2      tron including parameters that enable LDAP SSL or STARTTLS, and LDAP SASL. For a
    113  1.1.1.2      tron complete description, see the ldap_table(5) manual page.
    114      1.1      tron 
    115      1.1      tron EExxaammppllee:: llooccaall((88)) aalliiaasseess
    116      1.1      tron 
    117      1.1      tron Here's a basic example for using LDAP to look up local(8) aliases. Assume that
    118      1.1      tron in main.cf, you have:
    119      1.1      tron 
    120      1.1      tron     alias_maps = hash:/etc/aliases, ldap:/etc/postfix/ldap-aliases.cf
    121      1.1      tron 
    122      1.1      tron and in ldap:/etc/postfix/ldap-aliases.cf you have:
    123      1.1      tron 
    124      1.1      tron     server_host = ldap.example.com
    125      1.1      tron     search_base = dc=example, dc=com
    126      1.1      tron 
    127      1.1      tron Upon receiving mail for a local address "ldapuser" that isn't found in the /
    128      1.1      tron etc/aliases database, Postfix will search the LDAP server listening at port 389
    129      1.1      tron on ldap.example.com. It will bind anonymously, search for any directory entries
    130      1.1      tron whose mailacceptinggeneralid attribute is "ldapuser", read the "maildrop"
    131      1.1      tron attributes of those found, and build a list of their maildrops, which will be
    132      1.1      tron treated as RFC822 addresses to which the message will be delivered.
    133      1.1      tron 
    134      1.1      tron EExxaammppllee:: vviirrttuuaall ddoommaaiinnss//aaddddrreesssseess
    135      1.1      tron 
    136      1.1      tron If you want to keep information for virtual lookups in your directory, it's
    137      1.1      tron only a little more complicated. First, you need to make sure Postfix knows
    138      1.1      tron about the virtual domain. An easy way to do that is to add the domain to the
    139      1.1      tron mailacceptinggeneralid attribute of some entry in the directory. Next, you'll
    140      1.1      tron want to make sure all of your virtual recipient's mailacceptinggeneralid
    141      1.1      tron attributes are fully qualified with their virtual domains. Finally, if you want
    142      1.1      tron to designate a directory entry as the default user for a virtual domain, just
    143      1.1      tron give it an additional mailacceptinggeneralid (or the equivalent in your
    144      1.1      tron directory) of "@fake.dom". That's right, no user part. If you don't want a
    145      1.1      tron catchall user, omit this step and mail to unknown users in the domain will
    146      1.1      tron simply bounce.
    147      1.1      tron 
    148      1.1      tron In summary, you might have a catchall user for a virtual domain that looks like
    149      1.1      tron this:
    150      1.1      tron 
    151      1.1      tron          dn: cn=defaultrecipient, dc=fake, dc=dom
    152      1.1      tron          objectclass: top
    153      1.1      tron          objectclass: virtualaccount
    154      1.1      tron          cn: defaultrecipient
    155      1.1      tron          owner: uid=root, dc=someserver, dc=isp, dc=dom
    156      1.1      tron     1 -> mailacceptinggeneralid: fake.dom
    157      1.1      tron     2 -> mailacceptinggeneralid: @fake.dom
    158      1.1      tron     3 -> maildrop: realuser (a] real.dom
    159      1.1      tron 
    160      1.1      tron     1: Postfix knows fake.dom is a valid virtual domain when it looks for this
    161      1.1      tron     and gets something (the maildrop) back.
    162      1.1      tron 
    163      1.1      tron     2: This causes any mail for unknown users in fake.dom to go to this entry
    164      1.1      tron     ...
    165      1.1      tron 
    166      1.1      tron     3: ... and then to its maildrop.
    167      1.1      tron 
    168      1.1      tron Normal users might simply have one mailacceptinggeneralid and maildrop, e.g.
    169      1.1      tron "normaluser (a] fake.dom" and "normaluser (a] real.dom".
    170      1.1      tron 
    171      1.1      tron EExxaammppllee:: eexxppaannddiinngg LLDDAAPP ggrroouuppss
    172      1.1      tron 
    173      1.1      tron LDAP is frequently used to store group member information. There are a number
    174      1.1      tron of ways of handling LDAP groups. We will show a few examples in order of
    175      1.1      tron increasing complexity, but owing to the number of independent variables, we can
    176      1.1      tron only present a tiny portion of the solution space. We show how to:
    177      1.1      tron 
    178      1.1      tron  1. query groups as lists of addresses;
    179      1.1      tron 
    180      1.1      tron  2. query groups as lists of user objects containing addresses;
    181      1.1      tron 
    182      1.1      tron  3. forward special lists unexpanded to a separate list server, for moderation
    183      1.1      tron     or other processing;
    184      1.1      tron 
    185      1.1      tron  4. handle complex schemas by controlling expansion and by treating leaf nodes
    186      1.1      tron     specially, using features that are new in Postfix 2.4.
    187      1.1      tron 
    188      1.1      tron The example LDAP entries and implied schema below show two group entries
    189      1.1      tron ("agroup" and "bgroup") and four user entries ("auser", "buser", "cuser" and
    190      1.1      tron "duser"). The group "agroup" has the users "auser" (1) and "buser" (2) as
    191      1.1      tron members via DN references in the multi-valued attribute "memberdn", and direct
    192      1.1      tron email addresses of two external users "auser (a] example.org" (3) and
    193      1.1      tron "buser (a] example.org" (4) stored in the multi-valued attribute "memberaddr". The
    194      1.1      tron same is true of "bgroup" and "cuser"/"duser" (6)/(7)/(8)/(9), but "bgroup" also
    195      1.1      tron has a "maildrop" attribute of "bgroup (a] mlm.example.com" (5):
    196      1.1      tron 
    197      1.1      tron          dn: cn=agroup, dc=example, dc=com
    198      1.1      tron          objectclass: top
    199      1.1      tron          objectclass: ldapgroup
    200      1.1      tron          cn: agroup
    201      1.1      tron          mail: agroup (a] example.com
    202      1.1      tron     1 -> memberdn: uid=auser, dc=example, dc=com
    203      1.1      tron     2 -> memberdn: uid=buser, dc=example, dc=com
    204      1.1      tron     3 -> memberaddr: auser (a] example.org
    205      1.1      tron     4 -> memberaddr: buser (a] example.org
    206      1.1      tron 
    207      1.1      tron          dn: cn=bgroup, dc=example, dc=com
    208      1.1      tron          objectclass: top
    209      1.1      tron          objectclass: ldapgroup
    210      1.1      tron          cn: bgroup
    211      1.1      tron          mail: bgroup (a] example.com
    212      1.1      tron     5 -> maildrop: bgroup (a] mlm.example.com
    213      1.1      tron     6 -> memberdn: uid=cuser, dc=example, dc=com
    214      1.1      tron     7 -> memberdn: uid=duser, dc=example, dc=com
    215      1.1      tron     8 -> memberaddr: cuser (a] example.org
    216      1.1      tron     9 -> memberaddr: duser (a] example.org
    217      1.1      tron 
    218      1.1      tron          dn: uid=auser, dc=example, dc=com
    219      1.1      tron          objectclass: top
    220      1.1      tron          objectclass: ldapuser
    221      1.1      tron          uid: auser
    222      1.1      tron     10 -> mail: auser (a] example.com
    223      1.1      tron     11 -> maildrop: auser (a] mailhub.example.com
    224      1.1      tron 
    225      1.1      tron          dn: uid=buser, dc=example, dc=com
    226      1.1      tron          objectclass: top
    227      1.1      tron          objectclass: ldapuser
    228      1.1      tron          uid: buser
    229      1.1      tron     12 -> mail: buser (a] example.com
    230      1.1      tron     13 -> maildrop: buser (a] mailhub.example.com
    231      1.1      tron 
    232      1.1      tron          dn: uid=cuser, dc=example, dc=com
    233      1.1      tron          objectclass: top
    234      1.1      tron          objectclass: ldapuser
    235      1.1      tron          uid: cuser
    236      1.1      tron     14 -> mail: cuser (a] example.com
    237      1.1      tron 
    238      1.1      tron          dn: uid=duser, dc=example, dc=com
    239      1.1      tron          objectclass: top
    240      1.1      tron          objectclass: ldapuser
    241      1.1      tron          uid: duser
    242      1.1      tron     15 -> mail: duser (a] example.com
    243      1.1      tron 
    244      1.1      tron Our first use case ignores the "memberdn" attributes, and assumes that groups
    245      1.1      tron hold only direct "memberaddr" strings as in (3), (4), (8) and (9). The goal is
    246      1.1      tron to map the group address to the list of constituent "memberaddr" values. This
    247      1.1      tron is simple, ignoring the various connection related settings (hosts, ports, bind
    248      1.1      tron settings, timeouts, ...) we have:
    249      1.1      tron 
    250      1.1      tron         simple.cf:
    251      1.1      tron             ...
    252      1.1      tron             search_base = dc=example, dc=com
    253      1.1      tron             query_filter = mail=%s
    254      1.1      tron             result_attribute = memberaddr
    255  1.1.1.2      tron         $ postmap -q agroup (a] example.com ldap:/etc/postfix/simple.cf \
    256  1.1.1.2      tron             auser (a] example.org,buser (a] example.org
    257      1.1      tron 
    258      1.1      tron We search "dc=example, dc=com". The "mail" attribute is used in the
    259      1.1      tron query_filter to locate the right group, the "result_attribute" setting
    260      1.1      tron described in ldap_table(5) is used to specify that "memberaddr" values from the
    261      1.1      tron matching group are to be returned as a comma separated list. Always check
    262      1.1      tron tables using postmap(1) with the "-q" option, before deploying them into
    263      1.1      tron production use in main.cf.
    264      1.1      tron 
    265      1.1      tron Our second use case instead expands "memberdn" attributes (1), (2), (6) and
    266      1.1      tron (7), follows the DN references and returns the "maildrop" of the referenced
    267      1.1      tron user entries. Here we use the "special_result_attribute" setting from
    268      1.1      tron ldap_table(5) to designate the "memberdn" attribute as holding DNs of the
    269      1.1      tron desired member entries. The "result_attribute" setting selects which attributes
    270      1.1      tron are returned from the selected DNs. It is important to choose a result
    271      1.1      tron attribute that is not also present in the group object, because result
    272      1.1      tron attributes are collected from both the group and the member DNs. In this case
    273      1.1      tron we choose "maildrop" and assume for the moment that groups never have a
    274      1.1      tron "maildrop" (the "bgroup" "maildrop" attribute is for a different use case). The
    275      1.1      tron returned data for "auser" and "buser" is from items (11) and (13) in the
    276      1.1      tron example data.
    277      1.1      tron 
    278      1.1      tron         special.cf:
    279      1.1      tron             ...
    280      1.1      tron             search_base = dc=example, dc=com
    281      1.1      tron             query_filter = mail=%s
    282      1.1      tron             result_attribute = maildrop
    283      1.1      tron             special_result_attribute = memberdn
    284  1.1.1.2      tron         $ postmap -q agroup (a] example.com ldap:/etc/postfix/special.cf \
    285  1.1.1.2      tron             auser (a] mailhub.example.com,buser (a] mailhub.example.com
    286      1.1      tron 
    287      1.1      tron Note: if the desired member object result attribute is always also present in
    288      1.1      tron the group, you get surprising results: the expansion also returns the address
    289      1.1      tron of the group. This is a known limitation of Postfix releases prior to 2.4, and
    290      1.1      tron is addressed in the new with Postfix 2.4 "leaf_result_attribute" feature
    291      1.1      tron described in ldap_table(5).
    292      1.1      tron 
    293      1.1      tron Our third use case has some groups that are expanded immediately, and other
    294      1.1      tron groups that are forwarded to a dedicated mailing list manager host for delayed
    295      1.1      tron expansion. This uses two LDAP tables, one for users and forwarded groups and a
    296      1.1      tron second for groups that can be expanded immediately. It is assumed that groups
    297      1.1      tron that require forwarding are never nested members of groups that are directly
    298      1.1      tron expanded.
    299      1.1      tron 
    300      1.1      tron         no_expand.cf:
    301      1.1      tron             ...
    302      1.1      tron             search_base = dc=example, dc=com
    303      1.1      tron             query_filter = mail=%s
    304      1.1      tron             result_attribute = maildrop
    305      1.1      tron         expand.cf
    306      1.1      tron             ...
    307      1.1      tron             search_base = dc=example, dc=com
    308      1.1      tron             query_filter = mail=%s
    309      1.1      tron             result_attribute = maildrop
    310      1.1      tron             special_result_attribute = memberdn
    311  1.1.1.2      tron         $ postmap -q auser (a] example.com \
    312  1.1.1.2      tron             ldap:/etc/postfix/no_expand.cf ldap:/etc/postfix/expand.cf \
    313  1.1.1.2      tron             auser (a] mailhub.example.com
    314  1.1.1.2      tron         $ postmap -q agroup (a] example.com \
    315  1.1.1.2      tron             ldap:/etc/postfix/no_expand.cf ldap:/etc/postfix/expand.cf \
    316  1.1.1.2      tron             auser (a] mailhub.example.com,buser (a] mailhub.example.com
    317  1.1.1.2      tron         $ postmap -q bgroup (a] example.com \
    318  1.1.1.2      tron             ldap:/etc/postfix/no_expand.cf ldap:/etc/postfix/expand.cf \
    319  1.1.1.2      tron             bgroup (a] mlm.example.com
    320      1.1      tron 
    321      1.1      tron Non-group objects and groups with delayed expansion (those that have a maildrop
    322      1.1      tron attribute) are rewritten to a single maildrop value. Groups that don't have a
    323      1.1      tron maildrop are expanded as the second use case. This admits a more elegant
    324      1.1      tron solution with Postfix 2.4 and later.
    325      1.1      tron 
    326      1.1      tron Our final use case is the same as the third, but this time uses new features in
    327      1.1      tron Postfix 2.4. We now are able to use just one LDAP table and no longer need to
    328      1.1      tron assume that forwarded groups are never nested inside expanded groups.
    329      1.1      tron 
    330      1.1      tron         fancy.cf:
    331      1.1      tron             ...
    332      1.1      tron             search_base = dc=example, dc=com
    333      1.1      tron             query_filter = mail=%s
    334      1.1      tron             result_attribute = memberaddr
    335      1.1      tron             special_result_attribute = memberdn
    336      1.1      tron             terminal_result_attribute = maildrop
    337      1.1      tron             leaf_result_attribute = mail
    338  1.1.1.2      tron         $ postmap -q auser (a] example.com ldap:/etc/postfix/fancy.cf \
    339  1.1.1.2      tron             auser (a] mailhub.example.com
    340  1.1.1.2      tron         $ postmap -q cuser (a] example.com ldap:/etc/postfix/fancy.cf \
    341  1.1.1.2      tron             cuser (a] example.com
    342  1.1.1.2      tron         $ postmap -q agroup (a] example.com ldap:/etc/postfix/fancy.cf \
    343      1.1      tron 
    344      1.1      tron     auser (a] mailhub.example.com,buser (a] mailhub.example.com,auser (a] example.org,buser (a] example.org
    345  1.1.1.2      tron         $ postmap -q bgroup (a] example.com ldap:/etc/postfix/fancy.cf \
    346  1.1.1.2      tron             bgroup (a] mlm.example.com
    347      1.1      tron 
    348      1.1      tron Above, delayed expansion is enabled via "terminal_result_attribute", which, if
    349      1.1      tron present, is used as the sole result and all other expansion is suppressed.
    350      1.1      tron Otherwise, the "leaf_result_attribute" is only returned for leaf objects that
    351      1.1      tron don't have a "special_result_attribute" (non-groups), while the
    352      1.1      tron "result_attribute" (direct member address of groups) is returned at every level
    353      1.1      tron of recursive expansion, not just the leaf nodes. This fancy example illustrates
    354      1.1      tron all the features of Postfix 2.4 group expansion.
    355      1.1      tron 
    356      1.1      tron OOtthheerr uusseess ooff LLDDAAPP llooookkuuppss
    357      1.1      tron 
    358      1.1      tron Other common uses for LDAP lookups include rewriting senders and recipients
    359      1.1      tron with Postfix's canonical lookups, for example in order to make mail leaving
    360      1.1      tron your site appear to be coming from "First.Last (a] example.com" instead of
    361      1.1      tron "userid (a] example.com".
    362      1.1      tron 
    363      1.1      tron NNootteess aanndd tthhiinnggss ttoo tthhiinnkk aabboouutt
    364      1.1      tron 
    365      1.1      tron   * The bits of schema and attribute names used in this document are just
    366      1.1      tron     examples. There's nothing special about them, other than that some are the
    367      1.1      tron     defaults in the LDAP configuration parameters. You can use whatever schema
    368      1.1      tron     you like, and configure Postfix accordingly.
    369      1.1      tron 
    370      1.1      tron   * You probably want to make sure that mailacceptinggeneralids are unique, and
    371      1.1      tron     that not just anyone can specify theirs as postmaster or root, say.
    372      1.1      tron 
    373      1.1      tron   * An entry can have an arbitrary number of mailacceptinggeneralids or
    374      1.1      tron     maildrops. Maildrops can also be comma-separated lists of addresses. They
    375      1.1      tron     will all be found and returned by the lookups. For example, you could
    376      1.1      tron     define an entry intended for use as a mailing list that looks like this
    377      1.1      tron     (Warning! Schema made up just for this example):
    378      1.1      tron 
    379      1.1      tron         dn: cn=Accounting Staff List, dc=example, dc=com
    380      1.1      tron         cn: Accounting Staff List
    381      1.1      tron         o: example.com
    382      1.1      tron         objectclass: maillist
    383      1.1      tron         mailacceptinggeneralid: accountingstaff
    384      1.1      tron         mailacceptinggeneralid: accounting-staff
    385      1.1      tron         maildrop: mylist-owner
    386      1.1      tron         maildrop: an-accountant
    387      1.1      tron         maildrop: some-other-accountant
    388      1.1      tron         maildrop: this, that, theother
    389      1.1      tron 
    390      1.1      tron   * If you use an LDAP map for lookups other than aliases, you may have to make
    391      1.1      tron     sure the lookup makes sense. In the case of virtual lookups, maildrops
    392      1.1      tron     other than mail addresses are pretty useless, because Postfix can't know
    393      1.1      tron     how to set the ownership for program or file delivery. Your qquueerryy__ffiilltteerr
    394      1.1      tron     should probably look something like this:
    395      1.1      tron 
    396      1.1      tron         query_filter = (&(mailacceptinggeneralid=%s)(!(|(maildrop="*|*")
    397      1.1      tron         (maildrop="*:*")(maildrop="*/*"))))
    398      1.1      tron 
    399  1.1.1.4  christos   * And for that matter, even for aliases, you may not want users to be able to
    400      1.1      tron     specify their maildrops as programs, includes, etc. This might be
    401      1.1      tron     particularly pertinent on a "sealed" server where they don't have local
    402      1.1      tron     UNIX accounts, but exist only in LDAP and Cyrus. You might allow the fun
    403      1.1      tron     stuff only for directory entries owned by an administrative account, so
    404      1.1      tron     that if the object had a program as its maildrop and weren't owned by
    405      1.1      tron     "cn=root" it wouldn't be returned as a valid local user. This will require
    406      1.1      tron     some thought on your part to implement safely, considering the
    407      1.1      tron     ramifications of this type of delivery. You may decide it's not worth the
    408      1.1      tron     bother to allow any of that nonsense in LDAP lookups, ban it in the
    409      1.1      tron     qquueerryy__ffiilltteerr, and keep things like majordomo lists in local alias
    410      1.1      tron     databases.
    411      1.1      tron 
    412      1.1      tron         query_filter = (&(mailacceptinggeneralid=%s)(!(|(maildrop="*|*")
    413      1.1      tron         (maildrop="*:*")(maildrop="*/*"))(owner=cn=root, dc=your, dc=com)))
    414      1.1      tron 
    415      1.1      tron   * LDAP lookups are slower than local DB or DBM lookups. For most sites they
    416      1.1      tron     won't be a bottleneck, but it's a good idea to know how to tune your
    417      1.1      tron     directory service.
    418      1.1      tron 
    419      1.1      tron   * Multiple LDAP maps share the same LDAP connection if they differ only in
    420      1.1      tron     their query related parameters: base, scope, query_filter, and so on. To
    421      1.1      tron     take advantage of this, avoid spurious differences in the definitions of
    422      1.1      tron     LDAP maps: host selection order, version, bind, tls parameters, ... should
    423      1.1      tron     be the same for multiple maps whenever possible.
    424      1.1      tron 
    425      1.1      tron FFeeeeddbbaacckk
    426      1.1      tron 
    427      1.1      tron If you have questions, send them to postfix-users (a] postfix.org. Please include
    428      1.1      tron relevant information about your Postfix setup: LDAP-related output from
    429      1.1      tron postconf, which LDAP libraries you built with, and which directory server
    430      1.1      tron you're using. If your question involves your directory contents, please include
    431      1.1      tron the applicable bits of some directory entries.
    432      1.1      tron 
    433      1.1      tron CCrreeddiittss
    434      1.1      tron 
    435      1.1      tron   * Manuel Guesdon: Spotted a bug with the timeout attribute.
    436      1.1      tron   * John Hensley: Multiple LDAP sources with more configurable attributes.
    437      1.1      tron   * Carsten Hoeger: Search scope handling.
    438      1.1      tron   * LaMont Jones: Domain restriction, URL and DN searches, multiple result
    439      1.1      tron     attributes.
    440      1.1      tron   * Mike Mattice: Alias dereferencing control.
    441      1.1      tron   * Hery Rakotoarisoa: Patches for LDAPv3 updating.
    442      1.1      tron   * Prabhat K Singh: Wrote the initial Postfix LDAP lookups and connection
    443      1.1      tron     caching.
    444      1.1      tron   * Keith Stevenson: RFC 2254 escaping in queries.
    445      1.1      tron   * Samuel Tardieu: Noticed that searches could include wildcards, prompting
    446      1.1      tron     the work on RFC 2254 escaping in queries. Spotted a bug in binding.
    447      1.1      tron   * Sami Haahtinen: Referral chasing and v3 support.
    448      1.1      tron   * Victor Duchovni: ldap_bind() timeout. With fixes from LaMont Jones:
    449      1.1      tron     OpenLDAP cache deprecation. Limits on recursion, expansion and search
    450      1.1      tron     results size. LDAP connection sharing for maps differing only in the query
    451      1.1      tron     parameters.
    452      1.1      tron   * Liviu Daia: Support for SSL/STARTTLS. Support for storing map definitions
    453      1.1      tron     in external files (ldap:/path/ldap.cf) needed to securely store passwords
    454      1.1      tron     for plain auth.
    455      1.1      tron   * Liviu Daia revised the configuration interface and added the main.cf
    456      1.1      tron     configuration feature.
    457      1.1      tron   * Liviu Daia with further refinements from Jose Luis Tallon and Victor
    458      1.1      tron     Duchovni developed the common query, result_format, domain and
    459      1.1      tron     expansion_limit interface for LDAP, MySQL and PosgreSQL.
    460      1.1      tron   * Gunnar Wrobel provided a first implementation of a feature to limit LDAP
    461      1.1      tron     search results to leaf nodes only. Victor generalized this into the Postfix
    462      1.1      tron     2.4 "leaf_result_attribute" feature.
    463  1.1.1.2      tron   * Quanah Gibson-Mount contributed support for advanced LDAP SASL mechanisms,
    464  1.1.1.2      tron     beyond the password-based LDAP "simple" bind.
    465      1.1      tron 
    466      1.1      tron And of course Wietse.
    467      1.1      tron 
    468