diff --git a/server/src/InstanceHandler.cpp b/server/src/InstanceHandler.cpp index 0036a41..cd57cb9 100644 --- a/server/src/InstanceHandler.cpp +++ b/server/src/InstanceHandler.cpp @@ -642,7 +642,8 @@ std::shared_ptr InstanceHandler::generateLicenseDat request->speach_online = this->properties()[property::SERVERINSTANCE_SPOKEN_TIME_ALIVE].as(); request->speach_dead = this->properties()[property::SERVERINSTANCE_SPOKEN_TIME_DELETED].as(); - request->web_certificate_revision = this->web_cert_revision; + static std::string null_str{"\0\0\0\0\0\0\0\0", 8}; /* we need at least some characters */ + request->web_certificate_revision = this->web_cert_revision.empty() ? null_str : this->web_cert_revision; { auto info = make_shared(); @@ -805,7 +806,24 @@ void InstanceHandler::setWebCertRoot(const std::string &key, const std::string & } void InstanceHandler::loadWebCertificate() { - std::string revision{}, cert{}, _key{}, error{}; + std::string error{}; + + /* TMP */ + { + std::string key{}, cert{}; + auto result = this->sslMgr->initializeContext("web_default", key, cert, error, true, make_shared( + ts::ssl::SSLGenerator{ + .subjects = {}, + .issues = {{"O", "TeaSpeak"}, + {"OU", "Web server"}, + {"creator", "WolverinDEV"}} + } + )); + if(!result) + logError(LOG_INSTANCE, strobf("Failed to generate fallback web cert key: {}").string(), error); + } + + std::string revision{}, cert{}, _key{}; sql::command(this->sql->sql(), strobf("SELECT * FROM `general` WHERE `key` = 'webcert-revision' or `key` = 'webcert-cert' or `key` = 'webcert-key'").string()) .query([&](int count, std::string* values, std::string* names) {