Delete ticket file once we have a signed certificate

refs #5450
This commit is contained in:
Gunnar Beutner 2017-08-30 15:11:54 +02:00
parent 4cfbf6eb17
commit cb49ac1264
1 changed files with 9 additions and 0 deletions

View File

@ -229,6 +229,15 @@ void JsonRpcConnection::CertificateRequestResponseHandler(const Dictionary::Ptr&
<< boost::errinfo_file_name(tempCertPath)); << boost::errinfo_file_name(tempCertPath));
} }
String ticketPath = Application::GetLocalStateDir() + "/lib/icinga2/pki/ticket";
if (unlink(ticketPath.CStr()) < 0 && errno != ENOENT) {
BOOST_THROW_EXCEPTION(posix_error()
<< boost::errinfo_api_function("unlink")
<< boost::errinfo_errno(errno)
<< boost::errinfo_file_name(ticketPath));
}
Log(LogInformation, "JsonRpcConnection", "Updating the client certificate for the ApiListener object"); Log(LogInformation, "JsonRpcConnection", "Updating the client certificate for the ApiListener object");
listener->UpdateSSLContext(); listener->UpdateSSLContext();
} }