Create distribution lists with fd and postfix

Here we explain how to use fd groups as distribution lists.

You must assign email properties for the distribution list to work. Postfix 2.4 or later is required.

Create ldapdistlist.cf in /etc/postfix:

  server_host = ldap://127.0.0.1:389 ldap://my.other.ldap.server:389
  search_base = ou=groups,dc=domain,dc=tld
  query_filter = (&(objectClass=posixGroup)(objectClass=gosaMailAccount)(mail=%s))
  exclude_internal = yes
  result_filter = %s
  search_timeout = 30
  scope = sub
  result_attribute = memberUid, mail
  terminal_result_attribute = memberUid

Modify main.cf.template:

virtual_alias_maps =  hash:/etc/postfix/virtual, ldap:/etc/postfix/ldapdistlist.cf

Dealing with templates

It is often useful to add a template to a group so that when you create a user with that template, he/she is automatically added to that group. However this can cause a problem with a distribution list as postfix will try to email the template name. This can be solved with the postfix discard transport.

Create file /etc/postfix/ldapdiscard.cf:

  server_host = ldap://127.0.0.1:389
  search_base = dc=domain,dc=tld
  query_filter = (&(|(mail=%s)(uid=%u))(objectClass=gosaUserTemplate))
  result_attribute = uid
  result_filter = discard:[NOT SENT: %s]
  search_timeout = 30
  scope = sub
  bind = yes
  version = 3

In main.cf:

  transport_maps = hash:/etc/postfix/transport, ldap:/etc/postfix/ldapdiscard.cf, ldap:/etc/postfix/ldaptransport.cf

Special notes for Kolab:

Create ldapdistlist.cf.template in kolab template directory (/etc/kolab/templates in Debian):

  KOLAB_META_START
  TARGET=/etc/postfix/ldapdistlist.cf
  PERMISSIONS=0644
  OWNERSHIP=root:root
  KOLAB_META_END
  server_host = @@@ldap_uri@@@ 
  search_base = @@@group_ou@@@,@@@base_dn@@@
  query_filter = (&(objectClass=kolabSharedFolder)(!(kolabDeleteFlag=*))(mail=%s))
  exclude_internal = yes
  result_filter = %s
  search_timeout = 30
  scope = sub
  bind = yes
  bind_dn = @@@php_dn@@@
  bind_pw = @@@php_pw@@@
  version = 3
  result_attribute = memberUid, mail
  terminal_result_attribute = memberUid

Modify kolab.conf by adding this line (make sure the group ou is the same as your fd config):

  group_ou : ou=groups
en/documentation/how_to/create_distribution_list_postfix.txt · Last modified: 2017/10/31 10:32 (external edit)
CC Attribution-Share Alike 4.0 International
Driven by DokuWiki Recent changes RSS feed Valid CSS Valid XHTML 1.0