From c5d11b7b073d758ad2f3059112ef3120b2f7af8e Mon Sep 17 00:00:00 2001 From: Jason Volk Date: Sat, 16 Jun 2018 20:45:28 -0600 Subject: [PATCH] ircd::m: Defaults for some initial config related. --- ircd/m/m.cc | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/ircd/m/m.cc b/ircd/m/m.cc index 27786f9d8..6b1c3253c 100644 --- a/ircd/m/m.cc +++ b/ircd/m/m.cc @@ -811,7 +811,17 @@ ircd::m::keys::init::certificate() if(!fs::exists(cert_file)) { - if(!this->config.has({"certificate", origin, "subject"})) + std::string subject + { + this->config.get({"certificate", origin, "subject"}) + }; + + if(!subject) + subject = json::strung{json::members + { + { "CN", origin } + }}; +/* throw user_error { "Failed to find SSL certificate @ `%s'. Additionally, no" @@ -819,7 +829,7 @@ ircd::m::keys::init::certificate() cert_file, origin }; - +*/ log::warning { "Failed to find SSL certificate @ `%s'; creating for '%s'...", @@ -836,7 +846,7 @@ ircd::m::keys::init::certificate() { { "private_key_pem_path", private_key_file }, { "public_key_pem_path", public_key_file }, - { "subject", this->config.get({"certificate", origin, "subject"}) } + { "subject", subject }, }}; const auto cert @@ -893,19 +903,19 @@ ircd::m::keys::init::certificate() void ircd::m::keys::init::signing() { - const string_view origin + const std::string origin { - unquote(this->config.at({"ircd", "origin"})) + unquote(this->config.get({"ircd", "origin"}, "localhost")) }; const json::object config { - this->config.at({"origin", unquote(origin)}) + this->config.get({"origin", origin}) }; const std::string sk_file { - unquote(config.get("ed25519_private_key_path")) + unquote(config.get("ed25519_private_key_path", origin + ".key")) }; if(!sk_file)