Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion deps/rabbit_common/src/rabbit_ssl_options.erl
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ wrap_password_opt(Opts0) ->
end.

-spec fix(rabbit_types:infos()) -> rabbit_types:infos().

fix(Config) ->
fix_verify_fun(
fix_ssl_protocol_versions(
Expand Down
33 changes: 18 additions & 15 deletions deps/rabbitmq_auth_backend_ldap/src/rabbit_auth_backend_ldap.erl
Original file line number Diff line number Diff line change
Expand Up @@ -753,29 +753,32 @@ eldap_open(Servers, Opts) ->
Error
end.

%% We must make sure not to add SSL options unless:
%% a) we have at least R16A
%% b) we have SSL turned on (or it breaks StartTLS...)
ssl_conf() ->
%% We must make sure not to add SSL options unless a) we have at least R16A
%% b) we have SSL turned on (or it breaks StartTLS...)
case env(use_ssl, false) of
false -> [{ssl, false}];
true -> %% Only the unfixed version can be []
case env(ssl_options) of
[] -> [{ssl, true}];
undefined -> [{ssl, true}];
_ -> [{ssl, true}, {sslopts, ssl_options()}]
end
end.
ssl_conf(env(use_ssl, false)).

ssl_conf(true) ->
[{ssl, true}, {sslopts, ssl_options()}];
ssl_conf(false) ->
[{ssl, false}].

ssl_options() ->
Opts0 = rabbit_ssl_options:fix_client(env(ssl_options)),
ssl_options(env(ssl_options)).

ssl_options(undefined) ->
ssl_options([{verify, verify_peer}]);
ssl_options(Opts0) ->
Opts1 = rabbit_ssl_options:fix_client(Opts0),
case env(ssl_hostname_verification, undefined) of
wildcard ->
?LOG_DEBUG("Enabling wildcard-aware hostname verification for LDAP client connections"),
%% Needed for non-HTTPS connections that connect to servers that use wildcard certificates.
%% See https://erlang.org/doc/man/public_key.html#pkix_verify_hostname_match_fun-1.
[{customize_hostname_check, [{match_fun, public_key:pkix_verify_hostname_match_fun(https)}]} | Opts0];
[{customize_hostname_check, [{match_fun, public_key:pkix_verify_hostname_match_fun(https)}]} | Opts1];
_ ->
Opts0
Opts1
end.

at_least(Ver) ->
Expand All @@ -797,7 +800,7 @@ get_expected_env_str(Key, Default) ->

env(Key) ->
case application:get_env(rabbitmq_auth_backend_ldap, Key) of
{ok, V} -> V;
{ok, V} -> V;
undefined -> undefined
end.

Expand Down