mirror of
https://github.com/matrix-construct/construct
synced 2025-01-16 09:36:54 +01:00
modules/s_keys: Auto-generate dhparams on key init.
This commit is contained in:
parent
c7ccf8dcc8
commit
1ae8b8cc4a
1 changed files with 22 additions and 0 deletions
|
@ -63,6 +63,12 @@ init_my_tls_crt()
|
||||||
m::self::origin + ".crt.key.pub",
|
m::self::origin + ".crt.key.pub",
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const std::string dhparam_path_parts[]
|
||||||
|
{
|
||||||
|
tls_key_dir,
|
||||||
|
m::self::origin + ".crt.dh",
|
||||||
|
};
|
||||||
|
|
||||||
const std::string certificate_path_parts[]
|
const std::string certificate_path_parts[]
|
||||||
{
|
{
|
||||||
tls_key_dir,
|
tls_key_dir,
|
||||||
|
@ -79,6 +85,11 @@ init_my_tls_crt()
|
||||||
fs::make_path(public_key_path_parts)
|
fs::make_path(public_key_path_parts)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const std::string dhparam_file
|
||||||
|
{
|
||||||
|
fs::make_path(dhparam_path_parts)
|
||||||
|
};
|
||||||
|
|
||||||
const std::string cert_file
|
const std::string cert_file
|
||||||
{
|
{
|
||||||
fs::make_path(certificate_path_parts)
|
fs::make_path(certificate_path_parts)
|
||||||
|
@ -95,6 +106,17 @@ init_my_tls_crt()
|
||||||
openssl::genrsa(private_key_file, public_key_file);
|
openssl::genrsa(private_key_file, public_key_file);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(!fs::exists(dhparam_file))
|
||||||
|
{
|
||||||
|
log::warning
|
||||||
|
{
|
||||||
|
"Failed to find dhparam file @ `%s'; creating; this will take a long time...",
|
||||||
|
dhparam_file
|
||||||
|
};
|
||||||
|
|
||||||
|
openssl::gendh(dhparam_file);
|
||||||
|
}
|
||||||
|
|
||||||
const json::object config{};
|
const json::object config{};
|
||||||
if(!fs::exists(cert_file))
|
if(!fs::exists(cert_file))
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue