|
@@ -532,13 +532,15 @@ to_server_opts(Type, Opts) ->
|
|
|
Versions = integral_versions(Type, maps:get(versions, Opts, undefined)),
|
|
Versions = integral_versions(Type, maps:get(versions, Opts, undefined)),
|
|
|
Ciphers = integral_ciphers(Versions, maps:get(ciphers, Opts, undefined)),
|
|
Ciphers = integral_ciphers(Versions, maps:get(ciphers, Opts, undefined)),
|
|
|
Path = fun(Key) -> resolve_cert_path_for_read_strict(maps:get(Key, Opts, undefined)) end,
|
|
Path = fun(Key) -> resolve_cert_path_for_read_strict(maps:get(Key, Opts, undefined)) end,
|
|
|
|
|
+ Password = ensure_password(maps:get(password, Opts, undefined)),
|
|
|
ensure_valid_options(
|
|
ensure_valid_options(
|
|
|
maps:to_list(Opts#{
|
|
maps:to_list(Opts#{
|
|
|
keyfile => Path(keyfile),
|
|
keyfile => Path(keyfile),
|
|
|
certfile => Path(certfile),
|
|
certfile => Path(certfile),
|
|
|
cacertfile => Path(cacertfile),
|
|
cacertfile => Path(cacertfile),
|
|
|
ciphers => Ciphers,
|
|
ciphers => Ciphers,
|
|
|
- versions => Versions
|
|
|
|
|
|
|
+ versions => Versions,
|
|
|
|
|
+ password => Password
|
|
|
}),
|
|
}),
|
|
|
Versions
|
|
Versions
|
|
|
).
|
|
).
|
|
@@ -576,7 +578,7 @@ to_client_opts(Type, Opts) ->
|
|
|
{ciphers, Ciphers},
|
|
{ciphers, Ciphers},
|
|
|
{reuse_sessions, Get(reuse_sessions)},
|
|
{reuse_sessions, Get(reuse_sessions)},
|
|
|
{depth, Get(depth)},
|
|
{depth, Get(depth)},
|
|
|
- {password, ensure_str(Get(password))},
|
|
|
|
|
|
|
+ {password, ensure_password(Get(password))},
|
|
|
{secure_renegotiate, Get(secure_renegotiate)}
|
|
{secure_renegotiate, Get(secure_renegotiate)}
|
|
|
] ++ hostname_check(Verify),
|
|
] ++ hostname_check(Verify),
|
|
|
Versions
|
|
Versions
|
|
@@ -709,6 +711,14 @@ ensure_sni(undefined) -> undefined;
|
|
|
ensure_sni(L) when is_list(L) -> L;
|
|
ensure_sni(L) when is_list(L) -> L;
|
|
|
ensure_sni(B) when is_binary(B) -> unicode:characters_to_list(B, utf8).
|
|
ensure_sni(B) when is_binary(B) -> unicode:characters_to_list(B, utf8).
|
|
|
|
|
|
|
|
|
|
+ensure_password(Password) ->
|
|
|
|
|
+ case emqx_secret:unwrap(Password) of
|
|
|
|
|
+ undefined ->
|
|
|
|
|
+ undefined;
|
|
|
|
|
+ S ->
|
|
|
|
|
+ ensure_str(S)
|
|
|
|
|
+ end.
|
|
|
|
|
+
|
|
|
ensure_str(undefined) -> undefined;
|
|
ensure_str(undefined) -> undefined;
|
|
|
ensure_str(L) when is_list(L) -> L;
|
|
ensure_str(L) when is_list(L) -> L;
|
|
|
ensure_str(B) when is_binary(B) -> unicode:characters_to_list(B, utf8).
|
|
ensure_str(B) when is_binary(B) -> unicode:characters_to_list(B, utf8).
|