From 3dc06dfd8b69423d67df09283ec61e762b6099c9 Mon Sep 17 00:00:00 2001 From: Michael Scherer Date: Tue, 8 Mar 2011 14:50:45 +0000 Subject: allow to have more than one ldap group with aliases --- modules/postfix/manifests/init.pp | 3 ++- modules/postfix/templates/ldap_aliases.conf | 13 ++++++++----- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/modules/postfix/manifests/init.pp b/modules/postfix/manifests/init.pp index c09cbc2b..c184f298 100644 --- a/modules/postfix/manifests/init.pp +++ b/modules/postfix/manifests/init.pp @@ -58,7 +58,8 @@ class postfix { content => template("postfix/primary_master.cf"), } - + + $aliases_group = ['mga-founders'] $ldap_password = extlookup("postfix_ldap",'x') file { '/etc/postfix/ldap_aliases.conf': ensure => present, diff --git a/modules/postfix/templates/ldap_aliases.conf b/modules/postfix/templates/ldap_aliases.conf index e249b8ee..8bca9017 100644 --- a/modules/postfix/templates/ldap_aliases.conf +++ b/modules/postfix/templates/ldap_aliases.conf @@ -1,10 +1,13 @@ -<% -# TODO add some code to take a array of group where people -# have the aliasing -%> +<%- +# TODO I am sure that a more elegant way could be find +query_string = '' +aliases_group.each do |g| + query_string += '(memberOf=cn=' + g + ',ou=Group,' + dc_suffix + ')' +end +-%> server_host = ldaps://ldap.<%= domain %>:636 search_base = <%= dc_suffix %> -query_filter = (&(uid=%u)(memberOf=cn=mga-founders,ou=Group,<%= dc_suffix %>)) +query_filter = (&(uid=%u)(|<%= query_string %>)) result_attribute = mail bind = yes bind_dn = cn=postfix-alamut,ou=System Accounts,<%= dc_suffix %> -- cgit v1.2.1