OSDN Git Service

openldap-grid-0.2.1
[metasearch/grid-chef-repo.git] / cookbooks / openldap-grid / recipes / client.rb
1 #
2 # Cookbook Name:: openldap-grid
3 # Recipe:: client
4 #
5 # Copyright 2013-2016, whitestar
6 #
7 # Licensed under the Apache License, Version 2.0 (the "License");
8 # you may not use this file except in compliance with the License.
9 # You may obtain a copy of the License at
10 #
11 #     http://www.apache.org/licenses/LICENSE-2.0
12 #
13 # Unless required by applicable law or agreed to in writing, software
14 # distributed under the License is distributed on an "AS IS" BASIS,
15 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 # See the License for the specific language governing permissions and
17 # limitations under the License.
18 #
19
20 ldap_conf_keys = [
21   'URI',
22   'BASE',
23   'BINDDN',
24   'DEREF',
25   'HOST',
26   'NETWORK_TIMEOUT',
27   'PORT',
28   'REFERRALS',
29   'SIZELIMIT',
30   'TIMELIMIT',
31   'TIMEOUT',
32   'SASL_MECH',
33   'SASL_REALM',
34   'SASL_AUTHCID',
35   'SASL_AUTHZID',
36   'SASL_SECPROPS',
37   'GSSAPI_SIGN',
38   'GSSAPI_ENCRYPT',
39   'GSSAPI_ALLOW_REMOTE_PRINCIPAL',
40   'TLS_CACERT',
41   'TLS_CACERTDIR',
42   'TLS_CERT',
43   'TLS_CHECKPEER',
44   'TLS_KEY',
45   'TLS_CIPHER_SUITE',
46   'TLS_RANDFILE',
47   'TLS_REQCERT',
48   'TLS_CRLCHECK',
49   'TLS_CRLFILE',
50 ]
51
52 if node['openldap']['with_ssl_cert_cookbook']
53   node.override['openldap']['client']['TLS_CACERT'] \
54     = node['ssl_cert']["#{node['openldap']['ssl_cert']['ca_name']}_cert_path"]
55 end
56
57 case node['platform_family']
58 when 'debian'
59   pkg = 'ldap-utils'
60   resources(package: pkg) rescue package pkg do
61     action :install
62   end
63
64   template '/etc/ldap/ldap.conf' do
65     source 'etc/ldap/ldap.conf'
66     owner 'root'
67     group 'root'
68     mode '0644'
69     variables ldap_conf_keys: ldap_conf_keys
70   end
71 when 'rhel'
72   pkg = 'openldap-clients'
73   resources(package: pkg) rescue package pkg do
74     action :install
75   end
76
77   template '/etc/openldap/ldap.conf' do
78     source 'etc/openldap/ldap.conf'
79     owner 'root'
80     group 'root'
81     mode '0644'
82     variables ldap_conf_keys: ldap_conf_keys
83   end
84 end