@@ -753,29 +753,32 @@ eldap_open(Servers, Opts) ->
753753 Error
754754 end .
755755
756+ % % We must make sure not to add SSL options unless:
757+ % % a) we have at least R16A
758+ % % b) we have SSL turned on (or it breaks StartTLS...)
756759ssl_conf () ->
757- % % We must make sure not to add SSL options unless a) we have at least R16A
758- % % b) we have SSL turned on (or it breaks StartTLS...)
759- case env (use_ssl , false ) of
760- false -> [{ssl , false }];
761- true -> % % Only the unfixed version can be []
762- case env (ssl_options ) of
763- [] -> [{ssl , true }];
764- undefined -> [{ssl , true }];
765- _ -> [{ssl , true }, {sslopts , ssl_options ()}]
766- end
767- end .
760+ ssl_conf (env (use_ssl , false )).
761+
762+ ssl_conf (true ) ->
763+ [{ssl , true }, {sslopts , ssl_options ()}];
764+ ssl_conf (false ) ->
765+ [{ssl , false }].
768766
769767ssl_options () ->
770- Opts0 = rabbit_ssl_options :fix_client (env (ssl_options )),
768+ ssl_options (env (ssl_options )).
769+
770+ ssl_options (undefined ) ->
771+ ssl_options ([{verify , verify_peer }]);
772+ ssl_options (Opts0 ) ->
773+ Opts1 = rabbit_ssl_options :fix_client (Opts0 ),
771774 case env (ssl_hostname_verification , undefined ) of
772775 wildcard ->
773776 ? LOG_DEBUG (" Enabling wildcard-aware hostname verification for LDAP client connections" ),
774777 % % Needed for non-HTTPS connections that connect to servers that use wildcard certificates.
775778 % % See https://erlang.org/doc/man/public_key.html#pkix_verify_hostname_match_fun-1.
776- [{customize_hostname_check , [{match_fun , public_key :pkix_verify_hostname_match_fun (https )}]} | Opts0 ];
779+ [{customize_hostname_check , [{match_fun , public_key :pkix_verify_hostname_match_fun (https )}]} | Opts1 ];
777780 _ ->
778- Opts0
781+ Opts1
779782 end .
780783
781784at_least (Ver ) ->
@@ -797,7 +800,7 @@ get_expected_env_str(Key, Default) ->
797800
798801env (Key ) ->
799802 case application :get_env (rabbitmq_auth_backend_ldap , Key ) of
800- {ok , V } -> V ;
803+ {ok , V } -> V ;
801804 undefined -> undefined
802805 end .
803806
0 commit comments