File: ldap.pp

package info (click to toggle)
puppet-module-keystone 25.0.0-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,428 kB
  • sloc: ruby: 9,684; pascal: 295; python: 38; makefile: 10; sh: 10
file content (374 lines) | stat: -rw-r--r-- 16,868 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
# == Class: keystone::ldap
#
# Implements ldap configuration for keystone.
#
# === Parameters:
#
# [*url*]
#   URL for connecting to the LDAP server. (string value)
#   Defaults to $facts['os_service_default']
#
# [*user*]
#   User BindDN to query the LDAP server. (string value)
#   Defaults to $facts['os_service_default']
#
# [*password*]
#   Password for the BindDN to query the LDAP server. (string value)
#   Defaults to $facts['os_service_default']
#
# [*suffix*]
#   LDAP server suffix (string value)
#   Defaults to $facts['os_service_default']
#
# [*query_scope*]
#   The LDAP scope for queries, this can be either "one"
#   (onelevel/singleLevel) or "sub" (subtree/wholeSubtree). (string value)
#   Defaults to $facts['os_service_default']
#
# [*page_size*]
#   Maximum results per page; a value of zero ("0") disables paging. (integer value)
#   Defaults to $facts['os_service_default']
#
# [*user_tree_dn*]
#   Search base for users. (string value)
#   Defaults to $facts['os_service_default']
#
# [*user_filter*]
#   LDAP search filter for users. (string value)
#   Defaults to $facts['os_service_default']
#
# [*user_objectclass*]
#   LDAP objectclass for users. (string value)
#   Defaults to $facts['os_service_default']
#
# [*user_id_attribute*]
#   LDAP attribute mapped to user id. WARNING: must not be a multivalued attribute. (string value)
#   Defaults to $facts['os_service_default']
#
# [*user_name_attribute*]
#   LDAP attribute mapped to user name. (string value)
#   Defaults to $facts['os_service_default']
#
# [*user_description_attribute*]
#   LDAP attribute mapped to user description. (string value)
#   Defaults to $facts['os_service_default']
#
# [*user_mail_attribute*]
#   LDAP attribute mapped to user email. (string value)
#   Defaults to $facts['os_service_default']
#
# [*user_enabled_attribute*]
#   LDAP attribute mapped to user enabled flag. (string value)
#   Defaults to $facts['os_service_default']
#
# [*user_enabled_mask*]
#   Bitmask integer to indicate the bit that the enabled value is stored in if
#   the LDAP server represents "enabled" as a bit on an integer rather than a
#   boolean. A value of "0" indicates the mask is not used. If this is not set
#   to "0" the typical value is "2". This is typically used when
#   "user_enabled_attribute = userAccountControl". (integer value)
#   Defaults to $facts['os_service_default']
#
# [*user_enabled_default*]
#   Default value to enable users. This should match an appropriate int value
#   if the LDAP server uses non-boolean (bitmask) values to indicate if a user
#   is enabled or disabled. If this is not set to "True" the typical value is
#   "512". This is typically used when "user_enabled_attribute =
#   userAccountControl". (string value)
#   Defaults to $facts['os_service_default']
#
# [*user_enabled_invert*]
#   Invert the meaning of the boolean enabled values. Some LDAP servers use a
#   boolean lock attribute where "true" means an account is disabled. Setting
#   "user_enabled_invert = true" will allow these lock attributes to be used.
#   This setting will have no effect if "user_enabled_mask" or
#   "user_enabled_emulation" settings are in use. (boolean value)
#   Defaults to $facts['os_service_default']
#
# [*user_attribute_ignore*]
#   List of attributes stripped off the user on update. (list value)
#   Defaults to $facts['os_service_default']
#
# [*user_default_project_id_attribute*]
#   LDAP attribute mapped to default_project_id for users. (string value)
#   Defaults to $facts['os_service_default']
#
# [*user_pass_attribute*]
#   LDAP attribute mapped to password. (string value)
#   Defaults to $facts['os_service_default']
#
# [*user_enabled_emulation*]
#   If true, Keystone uses an alternative method to determine if
#   a user is enabled or not by checking if they are a member of
#   the "user_enabled_emulation_dn" group. (boolean value)
#   Defaults to $facts['os_service_default']
#
# [*user_enabled_emulation_dn*]
#   DN of the group entry to hold enabled users when using enabled emulation.
#   (string value)
#   Defaults to $facts['os_service_default']
#
# [*user_additional_attribute_mapping*]
#   List of additional LDAP attributes used for mapping
#   additional attribute mappings for users. Attribute mapping
#   format is <ldap_attr>:<user_attr>, where ldap_attr is the
#   attribute in the LDAP entry and user_attr is the Identity
#   API attribute. (list value)
#   Defaults to $facts['os_service_default']
#
# [*group_tree_dn*]
#   Search base for groups. (string value)
#   Defaults to $facts['os_service_default']
#
# [*group_filter*]
#   LDAP search filter for groups. (string value)
#   Defaults to $facts['os_service_default']
#
# [*group_objectclass*]
#   LDAP objectclass for groups. (string value)
#   Defaults to $facts['os_service_default']
#
# [*group_id_attribute*]
#   LDAP attribute mapped to group id. (string value)
#   Defaults to $facts['os_service_default']
#
# [*group_name_attribute*]
#   LDAP attribute mapped to group name. (string value)
#   Defaults to $facts['os_service_default']
#
# [*group_member_attribute*]
#   LDAP attribute mapped to show group membership. (string value)
#   Defaults to $facts['os_service_default']
#
# [*group_members_are_ids*]
#   LDAP attribute when members of the group object class are keystone user IDs. (boolean value)
#   Defaults to $facts['os_service_default']
#
# [*group_desc_attribute*]
#   LDAP attribute mapped to group description. (string value)
#   Defaults to $facts['os_service_default']
#
# [*group_attribute_ignore*]
#   List of attributes stripped off the group on update. (list value)
#   Defaults to $facts['os_service_default']
#
# [*group_additional_attribute_mapping*]
#   Additional attribute mappings for groups. Attribute mapping
#   format is <ldap_attr>:<user_attr>, where ldap_attr is the
#   attribute in the LDAP entry and user_attr is the Identity
#   API attribute. (list value)
#   Defaults to $facts['os_service_default']
#
# [*chase_referrals*]
#   Whether or not to chase returned referrals. (boolean value)
#   Defaults to $facts['os_service_default']
#
# [*use_tls*]
#   Enable TLS for communicating with LDAP servers. (boolean value)
#   Defaults to $facts['os_service_default']
#
# [*tls_cacertfile*]
#   CA certificate file path for communicating with LDAP servers. (string value)
#   Defaults to $facts['os_service_default']
#
# [*tls_cacertdir*]
#   CA certificate directory path for communicating with LDAP servers. (string value)
#   Defaults to $facts['os_service_default']
#
# [*tls_req_cert*]
#   Valid options for tls_req_cert are demand, never, and allow. (string value)
#   Defaults to $facts['os_service_default']
#
# [*identity_driver*]
#   Identity backend driver. (string value)
#   Defaults to $facts['os_service_default']
#
# [*use_pool*]
#   Enable LDAP connection pooling. (boolean value)
#   Defaults to $facts['os_service_default']
#
# [*pool_size*]
#   Connection pool size. (integer value)
#   Defaults to $facts['os_service_default']
#
# [*pool_retry_max*]
#   Maximum count of reconnect trials. (integer value)
#   Defaults to $facts['os_service_default']
#
# [*pool_retry_delay*]
#   Time span in seconds to wait between two reconnect trials. (floating point value)
#   Defaults to $facts['os_service_default']
#
# [*pool_connection_timeout*]
#   Connector timeout in seconds. Value -1 indicates indefinite wait for response. (integer value)
#   Defaults to $facts['os_service_default']
#
# [*pool_connection_lifetime*]
#   Connection lifetime in seconds. (integer value)
#   Defaults to $facts['os_service_default']
#
# [*use_auth_pool*]
#   Enable LDAP connection pooling for end user authentication.
#   If use_pool is disabled, then this setting is meaningless and is not used at all. (boolean value)
#   Defaults to $facts['os_service_default']
#
# [*auth_pool_size*]
#   End user auth connection pool size. (integer value)
#   Defaults to $facts['os_service_default']
#
# [*auth_pool_connection_lifetime*]
#   End user auth connection lifetime in seconds. (integer value)
#   Defaults to $facts['os_service_default']
#
# [*credential_driver*]
#   Credential backend driver. (string value)
#   Defaults to $facts['os_service_default']
#
# [*assignment_driver*]
#   Assignment backend driver. (string value)
#   Defaults to $facts['os_service_default']
#
# [*package_ensure*]
#   (optional) Desired ensure state of packages.
#   accepts latest or specific versions.
#   Defaults to present.
#
# [*manage_packages*]
#   (optional) Whether or not this module should manage
#   LDAP support packages.
#   Defaults to true.
#
# == Authors
#
#   Dan Bode dan@puppetlabs.com
#   Matt Fischer matt@mattfischer.com
#
# == Copyright
#
# Copyright 2012 Puppetlabs Inc, unless otherwise noted.
#
class keystone::ldap(
  $url                                  = $facts['os_service_default'],
  $user                                 = $facts['os_service_default'],
  $password                             = $facts['os_service_default'],
  $suffix                               = $facts['os_service_default'],
  $query_scope                          = $facts['os_service_default'],
  $page_size                            = $facts['os_service_default'],
  $user_tree_dn                         = $facts['os_service_default'],
  $user_filter                          = $facts['os_service_default'],
  $user_objectclass                     = $facts['os_service_default'],
  $user_id_attribute                    = $facts['os_service_default'],
  $user_name_attribute                  = $facts['os_service_default'],
  $user_description_attribute           = $facts['os_service_default'],
  $user_mail_attribute                  = $facts['os_service_default'],
  $user_enabled_attribute               = $facts['os_service_default'],
  $user_enabled_mask                    = $facts['os_service_default'],
  $user_enabled_default                 = $facts['os_service_default'],
  $user_enabled_invert                  = $facts['os_service_default'],
  $user_attribute_ignore                = $facts['os_service_default'],
  $user_default_project_id_attribute    = $facts['os_service_default'],
  $user_pass_attribute                  = $facts['os_service_default'],
  $user_enabled_emulation               = $facts['os_service_default'],
  $user_enabled_emulation_dn            = $facts['os_service_default'],
  $user_additional_attribute_mapping    = $facts['os_service_default'],
  $group_tree_dn                        = $facts['os_service_default'],
  $group_filter                         = $facts['os_service_default'],
  $group_objectclass                    = $facts['os_service_default'],
  $group_id_attribute                   = $facts['os_service_default'],
  $group_name_attribute                 = $facts['os_service_default'],
  $group_member_attribute               = $facts['os_service_default'],
  $group_members_are_ids                = $facts['os_service_default'],
  $group_desc_attribute                 = $facts['os_service_default'],
  $group_attribute_ignore               = $facts['os_service_default'],
  $group_additional_attribute_mapping   = $facts['os_service_default'],
  $chase_referrals                      = $facts['os_service_default'],
  $use_tls                              = $facts['os_service_default'],
  Variant[Openstacklib::ServiceDefault, Stdlib::Absolutepath] $tls_cacertdir
    = $facts['os_service_default'],
  $tls_cacertfile                       = $facts['os_service_default'],
  $tls_req_cert                         = $facts['os_service_default'],
  $identity_driver                      = $facts['os_service_default'],
  $assignment_driver                    = $facts['os_service_default'],
  $credential_driver                    = $facts['os_service_default'],
  $use_pool                             = $facts['os_service_default'],
  $pool_size                            = $facts['os_service_default'],
  $pool_retry_max                       = $facts['os_service_default'],
  $pool_retry_delay                     = $facts['os_service_default'],
  $pool_connection_timeout              = $facts['os_service_default'],
  $pool_connection_lifetime             = $facts['os_service_default'],
  $use_auth_pool                        = $facts['os_service_default'],
  $auth_pool_size                       = $facts['os_service_default'],
  $auth_pool_connection_lifetime        = $facts['os_service_default'],
  $package_ensure                       = present,
  Boolean $manage_packages              = true,
) inherits keystone::params {

  include keystone::deps

  if $manage_packages {
    ensure_resource('package',  'python-ldappool', {
      ensure => $package_ensure,
      name   => $keystone::params::python_ldappool_package_name,
      tag    => 'keystone-package'
    })
  }

  if ! is_service_default($tls_cacertdir) {
    file { $tls_cacertdir:
      ensure => directory
    }
  }

  keystone_config {
    'ldap/url':                                  value => $url;
    'ldap/user':                                 value => $user;
    'ldap/password':                             value => $password, secret => true;
    'ldap/suffix':                               value => $suffix;
    'ldap/query_scope':                          value => $query_scope;
    'ldap/page_size':                            value => $page_size;
    'ldap/user_tree_dn':                         value => $user_tree_dn;
    'ldap/user_filter':                          value => $user_filter;
    'ldap/user_objectclass':                     value => $user_objectclass;
    'ldap/user_id_attribute':                    value => $user_id_attribute;
    'ldap/user_name_attribute':                  value => $user_name_attribute;
    'ldap/user_description_attribute':           value => $user_description_attribute;
    'ldap/user_mail_attribute':                  value => $user_mail_attribute;
    'ldap/user_enabled_attribute':               value => $user_enabled_attribute;
    'ldap/user_enabled_mask':                    value => $user_enabled_mask;
    'ldap/user_enabled_default':                 value => $user_enabled_default;
    'ldap/user_enabled_invert':                  value => $user_enabled_invert;
    'ldap/user_attribute_ignore':                value => $user_attribute_ignore;
    'ldap/user_default_project_id_attribute':    value => $user_default_project_id_attribute;
    'ldap/user_pass_attribute':                  value => $user_pass_attribute;
    'ldap/user_enabled_emulation':               value => $user_enabled_emulation;
    'ldap/user_enabled_emulation_dn':            value => $user_enabled_emulation_dn;
    'ldap/user_additional_attribute_mapping':    value => $user_additional_attribute_mapping;
    'ldap/group_tree_dn':                        value => $group_tree_dn;
    'ldap/group_filter':                         value => $group_filter;
    'ldap/group_objectclass':                    value => $group_objectclass;
    'ldap/group_id_attribute':                   value => $group_id_attribute;
    'ldap/group_name_attribute':                 value => $group_name_attribute;
    'ldap/group_member_attribute':               value => $group_member_attribute;
    'ldap/group_members_are_ids':                value => $group_members_are_ids;
    'ldap/group_desc_attribute':                 value => $group_desc_attribute;
    'ldap/group_attribute_ignore':               value => $group_attribute_ignore;
    'ldap/group_additional_attribute_mapping':   value => $group_additional_attribute_mapping;
    'ldap/chase_referrals':                      value => $chase_referrals;
    'ldap/use_tls':                              value => $use_tls;
    'ldap/tls_cacertdir':                        value => $tls_cacertdir;
    'ldap/tls_cacertfile':                       value => $tls_cacertfile;
    'ldap/tls_req_cert':                         value => $tls_req_cert;
    'ldap/use_pool':                             value => $use_pool;
    'ldap/pool_size':                            value => $pool_size;
    'ldap/pool_retry_max':                       value => $pool_retry_max;
    'ldap/pool_retry_delay':                     value => $pool_retry_delay;
    'ldap/pool_connection_timeout':              value => $pool_connection_timeout;
    'ldap/pool_connection_lifetime':             value => $pool_connection_lifetime;
    'ldap/use_auth_pool':                        value => $use_auth_pool;
    'ldap/auth_pool_size':                       value => $auth_pool_size;
    'ldap/auth_pool_connection_lifetime':        value => $auth_pool_connection_lifetime;
    'identity/driver':                           value => $identity_driver;
    'credential/driver':                         value => $credential_driver;
    'assignment/driver':                         value => $assignment_driver;
  }
}