Fixed invalid ssl cert gather
This commit is contained in:
		
							parent
							
								
									867012d47b
								
							
						
					
					
						commit
						b7d60361c0
					
				@ -642,7 +642,8 @@ std::shared_ptr<license::LicenseRequestData> InstanceHandler::generateLicenseDat
 | 
				
			|||||||
	request->speach_online = this->properties()[property::SERVERINSTANCE_SPOKEN_TIME_ALIVE].as<uint64_t>();
 | 
						request->speach_online = this->properties()[property::SERVERINSTANCE_SPOKEN_TIME_ALIVE].as<uint64_t>();
 | 
				
			||||||
	request->speach_dead = this->properties()[property::SERVERINSTANCE_SPOKEN_TIME_DELETED].as<uint64_t>();
 | 
						request->speach_dead = this->properties()[property::SERVERINSTANCE_SPOKEN_TIME_DELETED].as<uint64_t>();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	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<license::ServerInfo>();
 | 
					        auto info = make_shared<license::ServerInfo>();
 | 
				
			||||||
@ -805,7 +806,24 @@ void InstanceHandler::setWebCertRoot(const std::string &key, const std::string &
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void InstanceHandler::loadWebCertificate() {
 | 
					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>(
 | 
				
			||||||
 | 
									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())
 | 
						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) {
 | 
						.query([&](int count, std::string* values, std::string* names) {
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user