|
@@ -450,21 +450,21 @@ write_cert(#{<<"ssl">> := #{<<"enable">> := true} = SSL} = Source) ->
|
|
|
CertPath = filename:join([emqx:get_config([node, data_dir]), "certs"]),
|
|
CertPath = filename:join([emqx:get_config([node, data_dir]), "certs"]),
|
|
|
CaCert = case maps:is_key(<<"cacertfile">>, SSL) of
|
|
CaCert = case maps:is_key(<<"cacertfile">>, SSL) of
|
|
|
true ->
|
|
true ->
|
|
|
- {ok, CaCertFile} = write_file(filename:join([CertPath, "cacert-" ++ emqx_plugin_libs_id:gen() ++".pem"]),
|
|
|
|
|
|
|
+ {ok, CaCertFile} = write_file(filename:join([CertPath, "cacert-" ++ emqx_misc:gen_id() ++".pem"]),
|
|
|
maps:get(<<"cacertfile">>, SSL)),
|
|
maps:get(<<"cacertfile">>, SSL)),
|
|
|
CaCertFile;
|
|
CaCertFile;
|
|
|
false -> ""
|
|
false -> ""
|
|
|
end,
|
|
end,
|
|
|
Cert = case maps:is_key(<<"certfile">>, SSL) of
|
|
Cert = case maps:is_key(<<"certfile">>, SSL) of
|
|
|
true ->
|
|
true ->
|
|
|
- {ok, CertFile} = write_file(filename:join([CertPath, "cert-" ++ emqx_plugin_libs_id:gen() ++".pem"]),
|
|
|
|
|
|
|
+ {ok, CertFile} = write_file(filename:join([CertPath, "cert-" ++ emqx_misc:gen_id() ++".pem"]),
|
|
|
maps:get(<<"certfile">>, SSL)),
|
|
maps:get(<<"certfile">>, SSL)),
|
|
|
CertFile;
|
|
CertFile;
|
|
|
false -> ""
|
|
false -> ""
|
|
|
end,
|
|
end,
|
|
|
Key = case maps:is_key(<<"keyfile">>, SSL) of
|
|
Key = case maps:is_key(<<"keyfile">>, SSL) of
|
|
|
true ->
|
|
true ->
|
|
|
- {ok, KeyFile} = write_file(filename:join([CertPath, "key-" ++ emqx_plugin_libs_id:gen() ++".pem"]),
|
|
|
|
|
|
|
+ {ok, KeyFile} = write_file(filename:join([CertPath, "key-" ++ emqx_misc:gen_id() ++".pem"]),
|
|
|
maps:get(<<"keyfile">>, SSL)),
|
|
maps:get(<<"keyfile">>, SSL)),
|
|
|
KeyFile;
|
|
KeyFile;
|
|
|
false -> ""
|
|
false -> ""
|