@@ -537,10 +537,6 @@ def authenticate(username, password)
537537 # additional capabilities are added, more configuration values will be
538538 # added here.
539539 #
540- # Currently, the only supported argument is { :method => :simple_tls }.
541- # (Equivalently, you may pass the symbol :simple_tls all by itself,
542- # without enclosing it in a Hash.)
543- #
544540 # The :simple_tls encryption method encrypts <i>all</i> communications
545541 # with the LDAP server. It completely establishes SSL/TLS encryption with
546542 # the LDAP server before any LDAP-protocol data is exchanged. There is no
@@ -563,10 +559,30 @@ def authenticate(username, password)
563559 # The :start_tls like the :simple_tls encryption method also encrypts all
564560 # communcations with the LDAP server. With the exception that it operates
565561 # over the standard TCP port.
562+ #
563+ # In order to verify certificates and enable other TLS options, the
564+ # :tls_options hash can be passed alongside :simple_tls or :start_tls.
565+ # This hash contains any options that can be passed to
566+ # OpenSSL::SSL::SSLContext#set_params(). The most common options passed
567+ # should be OpenSSL::SSL::SSLContext::DEFAULT_PARAMS, or the :ca_file option,
568+ # which contains a path to a Certificate Authority file (PEM-encoded).
569+ #
570+ # Example for a default setup without custom settings:
571+ # {
572+ # :method => :simple_tls,
573+ # :tls_options => OpenSSL::SSL::SSLContext::DEFAULT_PARAMS
574+ # }
575+ #
576+ # Example for specifying a CA-File and only allowing TLSv1.1 connections:
577+ #
578+ # {
579+ # :method => :start_tls,
580+ # :tls_options => { :ca_file => "/etc/cafile.pem", :ssl_version => "TLSv1_1" }
581+ # }
566582 def encryption ( args )
567583 case args
568584 when :simple_tls , :start_tls
569- args = { :method => args }
585+ args = { :method => args , :tls_options => { } }
570586 end
571587 @encryption = args
572588 end
0 commit comments