Skip to content

Commit e6b0667

Browse files
committed
Add ssl_hostname_verification support.
1 parent bfb03f7 commit e6b0667

File tree

2 files changed

+22
-2
lines changed

2 files changed

+22
-2
lines changed

deps/rabbitmq_auth_backend_ldap/src/rabbit_auth_backend_ldap_mgmt.erl

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,5 +186,12 @@ tls_options(BodyMap) ->
186186
Versions = lists:filtermap(F1, VersionStrs),
187187
[{versions, Versions} | TlsOpts5]
188188
end,
189-
{ok, TlsOpts6}
189+
TlsOpts7 = case maps:get(<<"ssl_hostname_verification">>, SslOptionsMap, undefined) of
190+
undefined ->
191+
TlsOpts6;
192+
"wildcard" ->
193+
[{customize_hostname_check, [{match_fun, public_key:pkix_verify_hostname_match_fun(https)}]} | TlsOpts6]
194+
end,
195+
?LOG_DEBUG("@@@@ TlsOpts7 ~tp", [TlsOpts7]),
196+
{ok, TlsOpts7}
190197
end.

deps/rabbitmq_auth_backend_ldap/test/system_SUITE.erl

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -394,7 +394,20 @@ validate_ldap_configuration_via_api(Config) ->
394394
'verify' => "verify_peer",
395395
'cacert_pem_data' => [CaCertfileContent, CaCertfileContent]
396396
}
397-
}, ?BAD_REQUEST).
397+
}, ?BAD_REQUEST),
398+
http_put(Config, "/ldap/validate/simple-bind",
399+
#{
400+
'user_dn' => AliceUserDN,
401+
'password' => Password,
402+
'servers' => ["localhost"],
403+
'port' => LdapTlsPort,
404+
'use_ssl' => true,
405+
'ssl_options' => #{
406+
'verify' => "verify_peer",
407+
'cacertfile' => CaCertfile,
408+
'ssl_hostname_verification' => "wildcard"
409+
}
410+
}, ?NO_CONTENT).
398411

399412
purge_connection(Config) ->
400413
{ok, _} = rabbit_ct_broker_helpers:rpc(Config, 0,

0 commit comments

Comments
 (0)