From: Gunnar Beutner Date: Wed, 30 Aug 2017 13:11:54 +0000 (+0200) Subject: Delete ticket file once we have a signed certificate X-Git-Tag: v2.8.0~87^2~30 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=cb49ac12644b38beedc561f3308b71d3ce4f4abc;p=icinga2 Delete ticket file once we have a signed certificate refs #5450 --- diff --git a/lib/remote/jsonrpcconnection-pki.cpp b/lib/remote/jsonrpcconnection-pki.cpp index 449b07f8a..64cf1c024 100644 --- a/lib/remote/jsonrpcconnection-pki.cpp +++ b/lib/remote/jsonrpcconnection-pki.cpp @@ -229,6 +229,15 @@ void JsonRpcConnection::CertificateRequestResponseHandler(const Dictionary::Ptr& << 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"); listener->UpdateSSLContext(); }