@@ -560,20 +560,29 @@ def authenticate(username, password)
560560 # communcations with the LDAP server. With the exception that it operates
561561 # over the standard TCP port.
562562 #
563- # In order to allow verification of server certificates and other TLS-related
564- # options, the keys :cafile and :ssl_context can be used.
565- #
566- # The :cafile option is a single filename that points to one or more
567- # PEM-encoded certificates. These certificates are used as a certificate auhority
568- # to verify the server certificates.
569- #
570- # For fine-grained control of the TLS settings, it is also possible to use the
571- # :ssl_context option to pass a custom OpenSSL::SSL::SSLContext. Consult the
572- # OpenSSL documentation for more information on the available options.
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+ # }
573582 def encryption ( args )
574583 case args
575584 when :simple_tls , :start_tls
576- args = { :method => args }
585+ args = { :method => args , :tls_options => { } }
577586 end
578587 @encryption = args
579588 end
0 commit comments