@@ -461,11 +461,52 @@ def self.result2string(code) #:nodoc:
461
461
# call to #search, that value will override any treebase value you give
462
462
# here.
463
463
# * :encryption => specifies the encryption to be used in communicating
464
- # with the LDAP server. The value is either a Hash containing additional
465
- # parameters, or the Symbol :simple_tls, which is equivalent to
466
- # specifying the Hash {:method => :simple_tls}. There is a fairly large
467
- # range of potential values that may be given for this parameter. See
468
- # #encryption for details.
464
+ # with the LDAP server. The value must be a Hash containing additional
465
+ # parameters, which consists of two keys:
466
+ # method: - :simple_tls or :start_tls
467
+ # options: - Hash of options for that method
468
+ # The :simple_tls encryption method encrypts <i>all</i> communications
469
+ # with the LDAP server. It completely establishes SSL/TLS encryption with
470
+ # the LDAP server before any LDAP-protocol data is exchanged. There is no
471
+ # plaintext negotiation and no special encryption-request controls are
472
+ # sent to the server. <i>The :simple_tls option is the simplest, easiest
473
+ # way to encrypt communications between Net::LDAP and LDAP servers.</i>
474
+ # It's intended for cases where you have an implicit level of trust in the
475
+ # authenticity of the LDAP server. No validation of the LDAP server's SSL
476
+ # certificate is performed. This means that :simple_tls will not produce
477
+ # errors if the LDAP server's encryption certificate is not signed by a
478
+ # well-known Certification Authority. If you get communications or
479
+ # protocol errors when using this option, check with your LDAP server
480
+ # administrator. Pay particular attention to the TCP port you are
481
+ # connecting to. It's impossible for an LDAP server to support plaintext
482
+ # LDAP communications and <i>simple TLS</i> connections on the same port.
483
+ # The standard TCP port for unencrypted LDAP connections is 389, but the
484
+ # standard port for simple-TLS encrypted connections is 636. Be sure you
485
+ # are using the correct port.
486
+ #
487
+ # The :start_tls like the :simple_tls encryption method also encrypts all
488
+ # communcations with the LDAP server. With the exception that it operates
489
+ # over the standard TCP port.
490
+ #
491
+ # In order to verify certificates and enable other TLS options, the
492
+ # :tls_options hash can be passed alongside :simple_tls or :start_tls.
493
+ # This hash contains any options that can be passed to
494
+ # OpenSSL::SSL::SSLContext#set_params(). The most common options passed
495
+ # should be OpenSSL::SSL::SSLContext::DEFAULT_PARAMS, or the :ca_file option,
496
+ # which contains a path to a Certificate Authority file (PEM-encoded).
497
+ #
498
+ # Example for a default setup without custom settings:
499
+ # {
500
+ # :method => :simple_tls,
501
+ # :tls_options => OpenSSL::SSL::SSLContext::DEFAULT_PARAMS
502
+ # }
503
+ #
504
+ # Example for specifying a CA-File and only allowing TLSv1.1 connections:
505
+ #
506
+ # {
507
+ # :method => :start_tls,
508
+ # :tls_options => { :ca_file => "/etc/cafile.pem", :ssl_version => "TLSv1_1" }
509
+ # }
469
510
# * :force_no_page => Set to true to prevent paged results even if your
470
511
# server says it supports them. This is a fix for MS Active Directory
471
512
# * :instrumentation_service => An object responsible for instrumenting
@@ -482,7 +523,7 @@ def initialize(args = {})
482
523
@auth = args [ :auth ] || DefaultAuth
483
524
@base = args [ :base ] || DefaultTreebase
484
525
@force_no_page = args [ :force_no_page ] || DefaultForceNoPage
485
- encryption args [ :encryption ] # may be nil
526
+ @ encryption = args [ :encryption ] # may be nil
486
527
487
528
if pr = @auth [ :password ] and pr . respond_to? ( :call )
488
529
@auth [ :password ] = pr . call
@@ -546,48 +587,8 @@ def authenticate(username, password)
546
587
# additional capabilities are added, more configuration values will be
547
588
# added here.
548
589
#
549
- # The :simple_tls encryption method encrypts <i>all</i> communications
550
- # with the LDAP server. It completely establishes SSL/TLS encryption with
551
- # the LDAP server before any LDAP-protocol data is exchanged. There is no
552
- # plaintext negotiation and no special encryption-request controls are
553
- # sent to the server. <i>The :simple_tls option is the simplest, easiest
554
- # way to encrypt communications between Net::LDAP and LDAP servers.</i>
555
- # It's intended for cases where you have an implicit level of trust in the
556
- # authenticity of the LDAP server. No validation of the LDAP server's SSL
557
- # certificate is performed. This means that :simple_tls will not produce
558
- # errors if the LDAP server's encryption certificate is not signed by a
559
- # well-known Certification Authority. If you get communications or
560
- # protocol errors when using this option, check with your LDAP server
561
- # administrator. Pay particular attention to the TCP port you are
562
- # connecting to. It's impossible for an LDAP server to support plaintext
563
- # LDAP communications and <i>simple TLS</i> connections on the same port.
564
- # The standard TCP port for unencrypted LDAP connections is 389, but the
565
- # standard port for simple-TLS encrypted connections is 636. Be sure you
566
- # are using the correct port.
567
- #
568
- # The :start_tls like the :simple_tls encryption method also encrypts all
569
- # communcations with the LDAP server. With the exception that it operates
570
- # over the standard TCP port.
571
- #
572
- # In order to verify certificates and enable other TLS options, the
573
- # :tls_options hash can be passed alongside :simple_tls or :start_tls.
574
- # This hash contains any options that can be passed to
575
- # OpenSSL::SSL::SSLContext#set_params(). The most common options passed
576
- # should be OpenSSL::SSL::SSLContext::DEFAULT_PARAMS, or the :ca_file option,
577
- # which contains a path to a Certificate Authority file (PEM-encoded).
578
- #
579
- # Example for a default setup without custom settings:
580
- # {
581
- # :method => :simple_tls,
582
- # :tls_options => OpenSSL::SSL::SSLContext::DEFAULT_PARAMS
583
- # }
584
- #
585
- # Example for specifying a CA-File and only allowing TLSv1.1 connections:
586
- #
587
- # {
588
- # :method => :start_tls,
589
- # :tls_options => { :ca_file => "/etc/cafile.pem", :ssl_version => "TLSv1_1" }
590
- # }
590
+ # This method is deprecated.
591
+ #
591
592
def encryption ( args )
592
593
return if args . nil?
593
594
return @encryption = args if args . is_a? Hash
0 commit comments