A common feature with mail environments is to use distribution groups that you could add and remove group members from. This is fairly common among organizations. For example, one might have
firstname.lastname@example.org and a list of members stored in LDAP. I wanted to have the ability to use mail distribution groups with my OpenLDAP infrastructure. LDAP group members could then easily be removed or added using
ldapmodify or Apache Directory Studio.
First, we need to tell Postfix about our LDAP distribution group config.
- Edit the
virtual_alias_mapsline and put
ldap:/etc/postfix/ldap/ldap-groups.cfafter the aliases definition.
virtual_alias_maps = ldap:/etc/postfix/ldap/ldap-aliases.cf,ldap:/etc/postfix/ldap/ldap-groups.cf
Since the LDAP server is local I do not need TLS in
ldap-groups.cf. The following is sufficient.
server_host = ldap://localhost search_base = ou=Groups,ou=Mail,dc=example,dc=net version = 3 bind = no query_filter = mail=%s result_attribute = mailGroupMember
The group attrributes can be loaded using postfix-book schema
An LDAP mail distribution group could look like this.
dn: email@example.com,ou=Groups,ou=Mail,dc=example,dc=net objectClass: top objectClass: organizationalPerson objectClass: PostfixBookMailAccount mail: firstname.lastname@example.org mailEnabled: TRUE mailUidNumber: 5000 mailGidNumber: 5000 cn: hq sn: group description: email@example.com distribution group mailGroupMember: firstname.lastname@example.org mailGroupMember: email@example.com mailGroupMember: firstname.lastname@example.org mailGroupMember: email@example.com mailGroupMember: firstname.lastname@example.org mailGroupMember: email@example.com
So now, when an email is sent to
firstname.lastname@example.org that email will land in every group member's Inbox. Each group member will be defined by the
Once you have this configured it is a good idea to
tail the logs and send a test mail to the group. If everything is setup correctly the mail logs will show the email delivered to all group members.