From e44398b73e4453ccec0827a23ab3d42fdf14e71b Mon Sep 17 00:00:00 2001 From: Diddi Oscarsson Date: Thu, 12 Dec 2013 17:10:16 +0100 Subject: [PATCH 1/2] Add support for nss mappings --- manifests/client.pp | 18 ++++++++++++++---- templates/etc/openldap/ldap.conf.erb | 16 ++++++++++------ 2 files changed, 24 insertions(+), 10 deletions(-) diff --git a/manifests/client.pp b/manifests/client.pp index d878fdc..49b8df1 100644 --- a/manifests/client.pp +++ b/manifests/client.pp @@ -65,6 +65,14 @@ # Search base for the shadow database. *base* will be appended. # *Optional* (defaults to false) # +# [nss_map_objectclass] +# Hash with nss objectclass mappings. +# *Optional* (defaults to nothing) +# +# [nss_map_attribute] +# Hash with nss attributes mappings. +# *Optional* (defaults to nothing) +# # [pam] # If enabled (pam => true) enables pam module, which will # be setup to use pam_ldap, to enable authentication. @@ -178,10 +186,12 @@ $ssl = false, $ssl_cert = false, - $nsswitch = false, - $nss_passwd = false, - $nss_group = false, - $nss_shadow = false, + $nsswitch = false, + $nss_passwd = false, + $nss_group = false, + $nss_shadow = false, + $nss_map_objectclass = false, + $nss_map_attribute = false, $pam = false, $pam_att_login = 'uid', diff --git a/templates/etc/openldap/ldap.conf.erb b/templates/etc/openldap/ldap.conf.erb index 62021be..5707824 100644 --- a/templates/etc/openldap/ldap.conf.erb +++ b/templates/etc/openldap/ldap.conf.erb @@ -19,12 +19,16 @@ bindpw <%= @bindpw %> <% end -%> <% if @nsswitch == true then -%> -# DNs in groups -#nss_schema rfc2307bis -#nss_map_attribute uniquemember member -#nss_map_attribute memberuid member -#nss_getgrent_skipmembers yes - +<% if @nss_map_objectclass != 'false' -%> +<% @nss_map_objectclass.each_pair do |local, remote| -%> +nss_map_objectclass <%= local -%> <%= remote -%> +<%- end -%> +<%- end -%> +<% if @nss_map_attribute != 'false' -%> +<% @nss_map_attribute.each_pair do |local, remote| -%> +nss_map_attribute <%= local -%> <%= remote -%> +<%- end -%> +<%- end -%> nss_base_passwd <%= @nss_passwd %>,<%= @base %>?sub nss_base_shadow <%= @nss_shadow %>,<%= @base %>?sub nss_base_group <%= @nss_group %>,<%= @base %>?one From f209bd939dcd12b801d10ea5caf23e209d314aca Mon Sep 17 00:00:00 2001 From: Diddi Oscarsson Date: Thu, 12 Dec 2013 17:41:39 +0100 Subject: [PATCH 2/2] Fix newline issues --- templates/etc/openldap/ldap.conf.erb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/templates/etc/openldap/ldap.conf.erb b/templates/etc/openldap/ldap.conf.erb index 5707824..49e2353 100644 --- a/templates/etc/openldap/ldap.conf.erb +++ b/templates/etc/openldap/ldap.conf.erb @@ -19,14 +19,14 @@ bindpw <%= @bindpw %> <% end -%> <% if @nsswitch == true then -%> -<% if @nss_map_objectclass != 'false' -%> +<% if @nss_map_objectclass != false -%> <% @nss_map_objectclass.each_pair do |local, remote| -%> -nss_map_objectclass <%= local -%> <%= remote -%> +nss_map_objectclass <%= local -%> <%= remote %> <%- end -%> <%- end -%> -<% if @nss_map_attribute != 'false' -%> +<% if @nss_map_attribute != false -%> <% @nss_map_attribute.each_pair do |local, remote| -%> -nss_map_attribute <%= local -%> <%= remote -%> +nss_map_attribute <%= local -%> <%= remote %> <%- end -%> <%- end -%> nss_base_passwd <%= @nss_passwd %>,<%= @base %>?sub