ldap.erb 20.6 KB
Newer Older
1
2
3
4
5
6
7
# -*- text -*-
#
#  $Id$

#
#  Lightweight Directory Access Protocol (LDAP)
#
8
ldap <%= @name %> {
9
10
11
12
	#  Note that this needs to match the name(s) in the LDAP server
	#  certificate, if you're using ldaps.  See OpenLDAP documentation
	#  for the behavioral semantics of specifying more than one host.
	#
13
14
	#  Depending on the libldap in use, server may be specified as an LDAP
	#  URI.  In the case of OpenLDAP this allows additional the following
15
	#  additional schemes:
16
17
18
19
20
	#
	#    - ldaps:// (LDAP over SSL)
	#    - ldapi:// (LDAP over Unix socket)
	#    - ldapc:// (Connectionless LDAP)
	#
Jonathan Gazeley's avatar
Jonathan Gazeley committed
21
<% @serverconcatarray.each do |srv| -%>	server = '<%= srv %>'
22
<% end -%>
23
24

	#  Port to connect on, defaults to 389, will be ignored for LDAP URIs.
25
	port = <%= @port %>
26
27
28

	#  Administrator account for searching and possibly modifying.
	#  If using SASL + KRB5 these should be commented out.
29
<%- if @identity -%>
Jonathan Gazeley's avatar
Jonathan Gazeley committed
30
	identity = '<%= @identity %>'
31
32
<%- end -%>
<%- if @password -%>
Jonathan Gazeley's avatar
Jonathan Gazeley committed
33
	password = <%= @password %>
34
<%- end -%>
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

	#  Unless overridden in another section, the dn from which all
	#  searches will start from.
	base_dn = '<%= @basedn %>'

	#
	#  SASL parameters to use for admin binds
	#
	#  When we're prompted by the SASL library, the config items in the SASL
	#  section (in addition to the identity password config items above)
	#  determine the responses given.
	#
	#  If any directive is commented out, a NULL response will be
	#  provided to cyrus-sasl.
	#
	#  Unfortunately the only way to control Keberos here is through
	#  environmental variables, as cyrus-sasl provides no API to
	#  set the kerberos (libkrb5) config directly.
	#
	#  Full documentation for MIT krb5 can be found here:
	#
	#	http://web.mit.edu/kerberos/krb5-devel/doc/admin/env_variables.html
	#
	#  At a minimum you probably want to set KRB5_CLIENT_KTNAME.
	#
	sasl {
		# SASL mechanism
#		mech = 'PLAIN'
63
<%- if @sasl.has_key?('mech') -%>
Jonathan Gazeley's avatar
Jonathan Gazeley committed
64
		mech = '<%= @sasl['mech'] %>'
65
<%- end -%>
66
67
68

		# SASL authorisation identity to proxy.
#		proxy = 'autz_id'
69
<%- if @sasl.has_key?('proxy') -%>
Jonathan Gazeley's avatar
Jonathan Gazeley committed
70
		proxy = '<%= @sasl['proxy'] %>'
71
<%- end -%>
72
73
74

		# SASL realm. Used for kerberos.
#		realm = 'example.org'
75
<%- if @sasl.has_key?('realm') -%>
Jonathan Gazeley's avatar
Jonathan Gazeley committed
76
		realm = '<%= @sasl['realm'] %>'
77
<%- end -%>
78
79
80
81
82
83
84
85
86
87
	}

	#
	#  Generic valuepair attribute
	#

	#  If set, this will attribute will be retrieved in addition to any
	#  mapped attributes.
	#
	#  Values should be in the format:
88
	#  	<fr attr> <op> <value>
89
90
	#
	#  Where:
91
	#  	<fr attr>:	Is the attribute you wish to create,
92
93
	# 			with any valid list and request qualifiers.
	#  	<op>: 		Is any assignment operator (=, :=, +=, -=).
94
	#  	<value>:	Is the value to parse into the new attribute.
95
96
97
	# 			If the value is wrapped in double quotes it
	#			will be xlat expanded.
#	valuepair_attribute = 'radiusAttribute'
98
<%- if @valuepair_attribute -%>
Jonathan Gazeley's avatar
Jonathan Gazeley committed
99
	valuepair_attribute = <%= @valuepair_attribute %>
100
<%- end -%>
101
102
103
104
105
106
107
108
109
110

	#
	#  Mapping of LDAP directory attributes to RADIUS dictionary attributes.
	#

	#  WARNING: Although this format is almost identical to the unlang
	#  update section format, it does *NOT* mean that you can use other
	#  unlang constructs in module configuration files.
	#
	#  Configuration items are in the format:
111
	# 	<fr attr> <op> <ldap attr>
112
113
	#
	#  Where:
114
	#  	<fr attr>:	Is the destination RADIUS attribute
115
116
117
118
119
120
121
	# 			with any valid list and request qualifiers.
	#  	<op>: 		Is any assignment attribute (=, :=, +=, -=).
	#  	<ldap attr>:	Is the attribute associated with user or
	#			profile objects in the LDAP directory.
	# 			If the attribute name is wrapped in double
	# 			quotes it will be xlat expanded.
	#
122
123
124
	#  Request and list qualifiers may be placed after the 'update'
	#  section name to set default destination requests/lists
	#  for <fr attr>s with no list qualifiers.
125
126
	#
	#  Note: LDAP attribute names should be single quoted unless you want
127
128
	#  the name to be derived from an xlat expansion, or an attribute ref.
	#
129
<%- if @update -%>
Jonathan Gazeley's avatar
Jonathan Gazeley committed
130
131
132
	update {
		<%= @update.join("\n		") %>
	}
133
<%- else -%>
134
135
136
137
138
139
140
141
142
143
144
	update {
		control:Password-With-Header	+= 'userPassword'
#		control:NT-Password		:= 'ntPassword'
#		reply:Reply-Message		:= 'radiusReplyMessage'
#		reply:Tunnel-Type		:= 'radiusTunnelType'
#		reply:Tunnel-Medium-Type	:= 'radiusTunnelMediumType'
#		reply:Tunnel-Private-Group-ID	:= 'radiusTunnelPrivategroupId'

		#  Where only a list is specified as the RADIUS attribute,
		#  the value of the LDAP attribute is parsed as a valuepair
		#  in the same format as the 'valuepair_attribute' (above).
145
146
147
		control:			+= 'radiusControlAttribute'
		request:			+= 'radiusRequestAttribute'
		reply:				+= 'radiusReplyAttribute'
148
	}
149
<%- end -%>
150
151
152
153

	#  Set to yes if you have eDirectory and want to use the universal
	#  password mechanism.
#	edir = no
154
<%- if @edir -%>
Jonathan Gazeley's avatar
Jonathan Gazeley committed
155
	edir = <%= @edir %>
156
<%- end -%>
157
158
159
160
161

	#  Set to yes if you want to bind as the user after retrieving the
	#  Cleartext-Password. This will consume the login grace, and
	#  verify user authorization.
#	edir_autz = no
162
<%- if @edir_autz -%>
Jonathan Gazeley's avatar
Jonathan Gazeley committed
163
	edir_autz = <%= @edir_autz %>
164
<%- end -%>
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181

	#  Note: set_auth_type was removed in v3.x.x
	#  Equivalent functionality can be achieved by adding the following
	#  stanza to the authorize {} section of your virtual server.
	#
	#    ldap
	#    if ((ok || updated) && User-Password) {
	#        update {
	#            control:Auth-Type := ldap
	#        }
	#    }

	#
	#  User object identification.
	#
	user {
		#  Where to start searching in the tree for users
182
    base_dn = "<%= @user_base_dn %>"
183
184
185

		#  Filter for user objects, should be specific enough
		#  to identify a single user object.
186
    filter = "<%= @user_filter %>"
187
188
189
190
191
192
193
194
195
196
197
198
199

		#  SASL parameters to use for user binds
		#
		#  When we're prompted by the SASL library, these control
		#  the responses given.
		#
		#  Any of the config items below may be an attribute ref
		#  or and expansion.  This allows different SASL mechs,
		#  proxy IDs and realms to be used for different users.
		#
		sasl {
			# SASL mechanism
#			mech = 'PLAIN'
200
      <%- if @user_sasl.has_key?('mech') -%>
Jonathan Gazeley's avatar
Jonathan Gazeley committed
201
			mech = '<%= @user_sasl['mech'] %>'
202
      <%- end -%>
203
204
205

			# SASL authorisation identity to proxy.
#			proxy = &User-Name
206
      <%- if @user_sasl.has_key?('proxy') -%>
Jonathan Gazeley's avatar
Jonathan Gazeley committed
207
			proxy = '<%= @user_sasl['proxy'] %>'
208
      <%- end -%>
209
210
211

			# SASL realm. Used for kerberos.
#			realm = 'example.org'
212
      <%- if @user_sasl.has_key?('realm') -%>
Jonathan Gazeley's avatar
Jonathan Gazeley committed
213
			realm = '<%= @user_sasl['realm'] %>'
214
      <%- end -%>
215
216
217
218
		}

		#  Search scope, may be 'base', 'one', sub' or 'children'
#		scope = 'sub'
219
<%- if @user_scope -%>
Jonathan Gazeley's avatar
Jonathan Gazeley committed
220
		scope = '<%= @user_scope %>'
221
<%- end -%>
222
223
224

		#  Server side result sorting
		#
225
226
227
228
		#  A list of space delimited attributes to order the result set by.
		#
		#  If the filter matches multiple objects only the first
		#  result will be processed.
229
230
231
232
233
234
		#
		#  If the attribute name is prefixed with a hyphen '-' the
		#  sorting order will be reversed for that attribute.
		#
		#  If sort_by is set, and the server does not support sorting
		#  the search will fail.
235
236
237
		#
		#  If a search returns multiple user objects and sort_by is not
		#  set, the search will fail.
238
#		sort_by = '-uid'
239
<%- if @user_sort_by -%>
Jonathan Gazeley's avatar
Jonathan Gazeley committed
240
		sort_by = '<%= @user_sort_by %>'
241
<%- end -%>
242
243
244
245
246

		#  If this is undefined, anyone is authorised.
		#  If it is defined, the contents of this attribute
		#  determine whether or not the user is authorised
#		access_attribute = 'dialupAccess'
247
<%- if @user_access_attribute -%>
Jonathan Gazeley's avatar
Jonathan Gazeley committed
248
		access_attribute = '<%= @user_access_attribute %>'
249
<%- end -%>
250
251
252
253
254
255
256
257
258
259
260
261

		#  Control whether the presence of 'access_attribute'
		#  allows access, or denys access.
		#
		#  If 'yes', and the access_attribute is present, or
		#  'no' and the access_attribute is absent then access
		#  will be allowed.
		#
		#  If 'yes', and the access_attribute is absent, or
		#  'no' and the access_attribute is present, then
		#  access will not be allowed.
		#
262
263
		#  If the value of the retrieved access_attribute is
		#  'false', it will negate the result.
264
265
266
267
268
269
270
271
272
273
		#
		#  e.g.
		#    access_positive = yes
		#    access_attribute = userAccessAllowed
		#
		#  With an LDAP object containing:
		#    userAccessAllowed: false
		#
		#  Will result in the user being locked out.
#		access_positive = yes
274
<%- if @user_access_positive -%>
Jonathan Gazeley's avatar
Jonathan Gazeley committed
275
		access_positive = <%= @user_access_positive %>
276
<%- end -%>
277
278
279
280
281
282
283
	}

	#
	#  User membership checking.
	#
	group {
		#  Where to start searching in the tree for groups
Jonathan Gazeley's avatar
Jonathan Gazeley committed
284
		base_dn = "<%= @group_base_dn %>"
285
286
287

		#  Filter for group objects, should match all available
		#  group objects a user might be a member of.
Jonathan Gazeley's avatar
Jonathan Gazeley committed
288
		filter = "<%= @group_filter %>"
289
290
291

		# Search scope, may be 'base', 'one', sub' or 'children'
#		scope = 'sub'
292
<%- if @group_scope -%>
Jonathan Gazeley's avatar
Jonathan Gazeley committed
293
		scope = '<%= @group_scope %>'
294
<%- end -%>
295
296
297
298
299

		#  Attribute that uniquely identifies a group.
		#  Is used when converting group DNs to group
		#  names.
#		name_attribute = cn
300
<%- if @group_name_attribute -%>
Jonathan Gazeley's avatar
Jonathan Gazeley committed
301
		name_attribute = <%= @group_name_attribute %>
302
<%- end -%>
303
304
305
306
307

		#  Filter to find group objects a user is a member of.
		#  That is, group objects with attributes that
		#  identify members (the inverse of membership_attribute).
#		membership_filter = "(|(member=%{control:Ldap-UserDn})(memberUid=%{%{Stripped-User-Name}:-%{User-Name}}))"
308
<%- if @group_membership_filter -%>
Jonathan Gazeley's avatar
Jonathan Gazeley committed
309
		membership_filter = "<%= @group_membership_filter %>"
310
<%- end -%>
311
312
313
314
315
316
317

		#  The attribute in user objects which contain the names
		#  or DNs of groups a user is a member of.
		#
		#  Unless a conversion between group name and group DN is
		#  needed, there's no requirement for the group objects
		#  referenced to actually exist.
Jonathan Gazeley's avatar
Jonathan Gazeley committed
318
		membership_attribute = '<%= @group_membership_attribute %>'
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334

		#  If cacheable_name or cacheable_dn are enabled,
		#  all group information for the user will be
		#  retrieved from the directory and written to LDAP-Group
		#  attributes appropriate for the instance of rlm_ldap.
		#
		#  For group comparisons these attributes will be checked
		#  instead of querying the LDAP directory directly.
		#
		#  This feature is intended to be used with rlm_cache.
		#
		#  If you wish to use this feature, you should enable
		#  the type that matches the format of your check items
		#  i.e. if your groups are specified as DNs then enable
		#  cacheable_dn else enable cacheable_name.
#		cacheable_name = 'no'
335
<%- if @group_cacheable_name -%>
Jonathan Gazeley's avatar
Jonathan Gazeley committed
336
		cacheable_name = '<%= @group_cacheable_name %>'
337
<%- end -%>
338
#		cacheable_dn = 'no'
339
<%- if @group_cacheable_dn -%>
Jonathan Gazeley's avatar
Jonathan Gazeley committed
340
		cacheable_dn = '<%= @group_cacheable_dn %>'
341
<%- end -%>
342
343
344
345
346
347

		#  Override the normal cache attribute (<inst>-LDAP-Group or
		#  LDAP-Group if using the default instance) and create a
		#  custom attribute.  This can help if multiple module instances
		#  are used in fail-over.
#		cache_attribute = 'LDAP-Cached-Membership'
348
<%- if @group_cache_attribute -%>
Jonathan Gazeley's avatar
Jonathan Gazeley committed
349
		cache_attribute = '<%= @group_cache_attribute %>'
350
<%- end -%>
351
352
353
354

		#  Override the normal group comparison attribute name
		#  (<inst>-LDAP-Group or LDAP-Group if using the default instance) .
#		group_attribute = "${.:instance}-${.:name}-Group"
355
<%- if @group_attribute -%>
Jonathan Gazeley's avatar
Jonathan Gazeley committed
356
		group_attribute = '<%= @group_attribute %>'
357
<%- end -%>
358
359
360
361
362
363
364
365
366
367
	}

	#
	#  User profiles. RADIUS profile objects contain sets of attributes
	#  to insert into the request. These attributes are mapped using
	#  the same mapping scheme applied to user objects (the update section above).
	#
	profile {
		#  Filter for RADIUS profile objects
#		filter = '(objectclass=radiusprofile)'
368
<%- if @profile_filter -%>
Jonathan Gazeley's avatar
Jonathan Gazeley committed
369
		filter = '<%= @profile_filter %>'
370
<%- end -%>
371
372
373
374
375
376
377

		#  The default profile.  This may be a DN or an attribute
		#  reference.
		#  To get old v2.2.x style behaviour, or to use the
		#  &User-Profile attribute to specify the default profile,
		#  set this to &control:User-Profile.
#		default = 'cn=radprofile,dc=example,dc=org'
378
<%- if @profile_default -%>
Jonathan Gazeley's avatar
Jonathan Gazeley committed
379
		default = '<%= @profile_default %>'
380
<%- end -%>
381
382
383
384
385
386
387

		#  The LDAP attribute containing profile DNs to apply
		#  in addition to the default profile above.  These are
		#  retrieved from the user object, at the same time as the
		#  attributes from the update section, are are applied
		#  if authorization is successful.
#		attribute = 'radiusProfileDn'
388
<%- if @profile_default -%>
Jonathan Gazeley's avatar
Jonathan Gazeley committed
389
		attribute = '<%= @profile_attribute %>'
390
<%- end -%>
391
392
393
394
395
396
397
	}

	#
	#  Bulk load clients from the directory
	#
	client {
		#   Where to start searching in the tree for clients
Jonathan Gazeley's avatar
Jonathan Gazeley committed
398
		base_dn = "<%= @client_base_dn %>"
399
400
401
402

		#
		#  Filter to match client objects
		#
Jonathan Gazeley's avatar
Jonathan Gazeley committed
403
		filter = '<%= @client_filter %>'
404
405
406

		# Search scope, may be 'base', 'one', 'sub' or 'children'
#		scope = 'sub'
407
<%- if @client_scope -%>
Jonathan Gazeley's avatar
Jonathan Gazeley committed
408
		scope = '<%= @client_scope %>'
409
<%- end -%>
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451

		#
		#  Sets default values (not obtained from LDAP) for new client entries
		#
		template {
#			login				= 'test'
#			password			= 'test'
#			proto	 			= tcp
#			require_message_authenticator	= yes

			# Uncomment to add a home_server with the same
			# attributes as the client.
#			coa_server {
#				response_window = 2.0
#			}
		}

		#
		#  Client attribute mappings are in the format:
		#      <client attribute> = <ldap attribute>
		#
		#  The following attributes are required:
		#    * ipaddr | ipv4addr | ipv6addr - Client IP Address.
		#    * secret - RADIUS shared secret.
		#
		#  All other attributes usually supported in a client
		#  definition are also supported here.
		#
		#  Schemas are available in doc/schemas/ldap for openldap and eDirectory
		#
		attribute {
			ipaddr				= 'radiusClientIdentifier'
			secret				= 'radiusClientSecret'
#			shortname			= 'radiusClientShortname'
#			nas_type			= 'radiusClientType'
#			virtual_server			= 'radiusClientVirtualServer'
#			require_message_authenticator	= 'radiusClientRequireMa'
		}
	}

	#  Load clients on startup
#	read_clients = no
452
<%- if @read_clients -%>
Jonathan Gazeley's avatar
Jonathan Gazeley committed
453
	read_clients = <%= @read_clients %>
454
<%- end -%>
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520

	#
	#  Modify user object on receiving Accounting-Request
	#

	#  Useful for recording things like the last time the user logged
	#  in, or the Acct-Session-ID for CoA/DM.
	#
	#  LDAP modification items are in the format:
	# 	<ldap attr> <op> <value>
	#
	#  Where:
	#  	<ldap attr>:	The LDAP attribute to add modify or delete.
	#  	<op>: 		One of the assignment operators:
	#			(:=, +=, -=, ++).
	#			Note: '=' is *not* supported.
	#  	<value>:	The value to add modify or delete.
	#
	#  WARNING: If using the ':=' operator with a multi-valued LDAP
	#  attribute, all instances of the attribute will be removed and
	#  replaced with a single attribute.
	accounting {
		reference = "%{tolower:type.%{Acct-Status-Type}}"

		type {
			start {
				update {
					description := "Online at %S"
				}
			}

			interim-update {
				update {
					description := "Last seen at %S"
				}
			}

			stop {
				update {
					description := "Offline at %S"
				}
			}
		}
	}

	#
	#  Post-Auth can modify LDAP objects too
	#
	post-auth {
		update {
			description := "Authenticated at %S"
		}
	}

	#
	#  LDAP connection-specific options.
	#
	#  These options set timeouts, keep-alives, etc. for the connections.
	#
	options {
		#  Control under which situations aliases are followed.
		#  May be one of 'never', 'searching', 'finding' or 'always'
		#  default: libldap's default which is usually 'never'.
		#
		#  LDAP_OPT_DEREF is set to this value.
#		dereference = 'always'
521
<%- if @dereference -%>
Jonathan Gazeley's avatar
Jonathan Gazeley committed
522
		dereference = '<%= @dereference %>'
523
<%- end -%>
524
525
526
527
528
529
530
531

		#
		#  The following two configuration items control whether the
		#  server follows references returned by LDAP directory.
		#  They are  mostly for Active Directory compatibility.
		#  If you set these to 'no', then searches will likely return
		#  'operations error', instead of a useful result.
		#
Jonathan Gazeley's avatar
Jonathan Gazeley committed
532
533
		chase_referrals = <%= @chase_referrals %>
		rebind = <%= @rebind %>
534
535
536
537
538
539

		#
		#  On rebind, use the credentials from the rebind url instead
		#  of admin credentials used during the initial bind.
		#  Default 'no'
		#
Jonathan Gazeley's avatar
Jonathan Gazeley committed
540
		use_referral_credentials = <%= @use_referral_credentials %>
541
542
543
544
545
546
547
548
549
550
551

		#
		#  If 'yes', then include draft-wahl-ldap-session tracking
		#  controls.
		#
		#  These encode the NAS-IP-Address/NAS-IPv6-Address,
		#  User-Name, Acct-Session-ID, Acct-Multi-Session-ID
		#  as session tracking controls, in applicable LDAP operations.
		#  Default 'no'.
		#
#		session_tracking = yes
552
<%- if @session_tracking -%>
Jonathan Gazeley's avatar
Jonathan Gazeley committed
553
		session_tracking = <%= @session_tracking %>
554
<%- end -%>
555
556
557
558
559
560
561
562

		#  Seconds to wait for LDAP query to finish. default: 20
		res_timeout = <%= @timeout %>

		#  Seconds LDAP server has to process the query (server-side
		#  time limit). default: 20
		#
		#  LDAP_OPT_TIMELIMIT is set to this value.
Jonathan Gazeley's avatar
Jonathan Gazeley committed
563
		srv_timelimit = <%= @timelimit %>
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580

		#  LDAP_OPT_X_KEEPALIVE_IDLE
		idle = <%= @idle %>

		#  LDAP_OPT_X_KEEPALIVE_PROBES
		probes = <%= @probes %>

		#  LDAP_OPT_X_KEEPALIVE_INTERVAL
		interval = <%= @interval %>

		#  ldap_debug: debug flag for LDAP SDK
		#  (see OpenLDAP documentation).  Set this to enable
		#  huge amounts of LDAP debugging on the screen.
		#  You should only use this if you are an LDAP expert.
		#
		#	default: 0x0000 (no debugging messages)
		#	Example:(LDAP_DEBUG_FILTER+LDAP_DEBUG_CONNS)
Jonathan Gazeley's avatar
Jonathan Gazeley committed
581
		ldap_debug = <%= @ldap_debug %>
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
	}

	#
	#  This subsection configures the tls related items
	#  that control how FreeRADIUS connects to an LDAP
	#  server.  It contains all of the 'tls_*' configuration
	#  entries used in older versions of FreeRADIUS.  Those
	#  configuration entries can still be used, but we recommend
	#  using these.
	#
	tls {
		# Set this to 'yes' to use TLS encrypted connections
		# to the LDAP database by using the StartTLS extended
		# operation.
		#
		# The StartTLS operation is supposed to be
		# used with normal ldap connections instead of
		# using ldaps (port 636) connections
		start_tls = <%= @starttls %>

602
<% if @cafile -%>
603
		ca_file = <%= @cafile %>
604
<% end -%>
605
#               ca_path = ${certdir}
606
<% if @certfile -%>
607
608
		certificate_file = <%= @certfile %>
<% end -%>
609
<% if @keyfile -%>
610
611
		private_key_file = <%= @keyfile %>
<% end -%>
612
#		random_file = /dev/urandom
613
<%- if @random_file -%>
Jonathan Gazeley's avatar
Jonathan Gazeley committed
614
		random_file = <%= @random_file %>
615
<%- end -%>
616
617
618
619
620
621
622
623
624
625
626

		#  Certificate Verification requirements.  Can be:
		#    'never' (do not even bother trying)
		#    'allow' (try, but don't fail if the certificate
		#		cannot be verified)
		#    'demand' (fail if the certificate does not verify)
		#    'hard'  (similar to 'demand' but fails if TLS
		#             cannot negotiate)
 		#
		#  The default is libldap's default, which varies based
		#  on the contents of ldap.conf.
627
		require_cert    = '<%= @requirecert %>'
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
	}

	#  As of version 3.0, the 'pool' section has replaced the
	#  following configuration items:
	#
	#  ldap_connections_number

	#  The connection pool is new for 3.0, and will be used in many
	#  modules, for all kinds of connection-related activity.
	#
	#  When the server is not threaded, the connection pool
	#  limits are ignored, and only one connection is used.
	pool {
		#  Connections to create during module instantiation.
		#  If the server cannot create specified number of
		#  connections during instantiation it will exit.
		#  Set to 0 to allow the server to start without the
		#  directory being available.
		start = <%= @start %>

		#  Minimum number of connections to keep open
		min = <%= @min %>

		#  Maximum number of connections
		#
		#  If these connections are all in use and a new one
		#  is requested, the request will NOT get a connection.
		#
		#  Setting 'max' to LESS than the number of threads means
		#  that some threads may starve, and you will see errors
		#  like 'No connections available and at max connection limit'
		#
		#  Setting 'max' to MORE than the number of threads means
		#  that there are more connections than necessary.
		max = <%= @max %>

		#  Spare connections to be left idle
		#
		#  NOTE: Idle connections WILL be closed if "idle_timeout"
		#  is set.  This should be less than or equal to "max" above.
		spare = <%= @spare %>

		#  Number of uses before the connection is closed
		#
		#  0 means "infinite"
		uses = <%= @uses %>

		#  The number of seconds to wait after the server tries
		#  to open a connection, and fails.  During this time,
		#  no new connections will be opened.
Jonathan Gazeley's avatar
Jonathan Gazeley committed
678
		retry_delay = <%= @retry_delay %>
679
680

		#  The lifetime (in seconds) of the connection
Jonathan Gazeley's avatar
Jonathan Gazeley committed
681
		lifetime = <%= @lifetime %>
682
683
684

		#  Idle timeout (in seconds).  A connection which is
		#  unused for this length of time will be closed.
Jonathan Gazeley's avatar
Jonathan Gazeley committed
685
		idle_timeout = <%= @idle_timeout %>
686
687
688
689

		#  Connection timeout (in seconds).  The maximum amount of
		#  time to wait for a new connection to be established.
		#  Sets LDAP_OPT_NETWORK_TIMEOUT in libldap.
Jonathan Gazeley's avatar
Jonathan Gazeley committed
690
		connect_timeout = <%= @connect_timeout %>
691
692
693
694
695
696
697
698
699
700
701
702

		#  NOTE: All configuration settings are enforced.  If a
		#  connection is closed because of 'idle_timeout',
		#  'uses', or 'lifetime', then the total number of
		#  connections MAY fall below 'min'.  When that
		#  happens, it will open a new connection.  It will
		#  also log a WARNING message.
		#
		#  The solution is to either lower the 'min' connections,
		#  or increase lifetime/idle_timeout.
	}
}