The official Postfix documentation to use LDAP for user and alias lookup mentions certain LDAP attributes which are not part of the default OpenLDAP. In this article I will shortly explain a basic theme providing these attributes and the corresponding object class.
Postfix can easily be connected to LDAP to lookup addresses and aliases. The Postfix LDAP documentation covers all the details. As mentioned there the default configuration of Postfix expects two LDAP attributes in the LDAP schema:
maildrop. This also shows in the code in
"(mailacceptinggeneralid=%s)", 0, 0);
However, these attributes are not part of the default OpenLDAP installation, and the Postfix documentation does not mention how exactly that has to look like and where to get it. For that reason we at my employer credativ provide such a schema at Github: github.com/credativ/postfix-ldap-schema. The github repository contains the schema, the corresponding licence and a short documentation. A German introduction to the schema can also be found at credativ’s blog: LDAP-Schema für Postfix-Abfragen
The provided schema defines the necessary attribute types
maildrop as well as the object class
postfixUser. Please note that in this schema the used OIDs are of the type Experimental OpenLDAP, see also the OID database.
To use the schema it must be used by OpenLDAP, for example by including in in
slapd.conf. A corresponding LDAP entry could look like:
cn: Max Mustermann
As you see the example covers multiple aliases. Also, the final mailbox is a domain less entity:
maildrop: mmu does not mention any domain name. This only works if your mail boxes actually do not require (or even allow) domain names – in this case this was true since the mail is finally transported to a Dovecot server which does not know about the various domains.
Please note that this schema can only be the foundation for a more sophisticated, more complex schema which need to be tailored to fit the individual needs of the corresponding setup.