From d951a3d57cfeeab450450b7cdfb51b9844a3c648 Mon Sep 17 00:00:00 2001 From: Michael Scherer Date: Thu, 24 Mar 2011 02:43:08 +0000 Subject: - add support for mailing all people in a ldap group --- modules/postfix/manifests/init.pp | 12 ++++++++++++ modules/postfix/templates/group_aliases.conf | 12 ++++++++++++ modules/postfix/templates/main.cf | 4 +++- 3 files changed, 27 insertions(+), 1 deletion(-) create mode 100644 modules/postfix/templates/group_aliases.conf diff --git a/modules/postfix/manifests/init.pp b/modules/postfix/manifests/init.pp index 3f74a5e6..28302f1f 100644 --- a/modules/postfix/manifests/init.pp +++ b/modules/postfix/manifests/init.pp @@ -72,6 +72,18 @@ class postfix { content => template("postfix/ldap_aliases.conf"), } + # TODO merge the file with the previous one, for common part (ldap, etc) + file { '/etc/postfix/group_aliases.conf': + ensure => present, + owner => root, + group => root, + mode => 644, + content => template("postfix/group_aliases.conf"), + } + + + + file { '/etc/postfix/virtual_aliases': ensure => present, owner => root, diff --git a/modules/postfix/templates/group_aliases.conf b/modules/postfix/templates/group_aliases.conf new file mode 100644 index 00000000..85788e41 --- /dev/null +++ b/modules/postfix/templates/group_aliases.conf @@ -0,0 +1,12 @@ +server_host = ldaps://ldap.<%= domain %>:636 +search_base = <%= dc_suffix %> +query_filter = (&(cn=mga-%u)(objectClass=groupOfNames)) +result_attribute = mail +special_result_attribute = member +bind = yes +bind_dn = cn=postfix-<%= hostname %>,ou=System Accounts,<%= dc_suffix %> +bind_pw = <%= ldap_password %> +# postfix complain on url +# warning: dict_ldap_open: URL scheme ldaps requires protocol version 3 +version = 3 +domain = group.<%= domain %> diff --git a/modules/postfix/templates/main.cf b/modules/postfix/templates/main.cf index 5146d5f9..c4f642db 100644 --- a/modules/postfix/templates/main.cf +++ b/modules/postfix/templates/main.cf @@ -43,7 +43,8 @@ mydestination = <%= fqdn %> <%- if all_tags.include?('postfix::primary_smtp') -%> -virtual_mailbox_domains = <%= domain %> +virtual_mailbox_domains = <%= domain %>, + group.<%= domain %> # postfix complain if not set # Mar 22 23:51:20 alamut postfix/virtual[22952]: fatal: bad string length 0 < 1: virtual_mailbox_base = @@ -61,6 +62,7 @@ fallback_transport_maps = regexp:/etc/postfix/transport_regexp alias_maps = hash:/etc/postfix/aliases virtual_alias_maps = ldap:/etc/postfix/ldap_aliases.conf + ldap:/etc/postfix/group_aliases.conf hash:/etc/postfix/virtual_aliases <%- end -%> -- cgit v1.2.1