From: Michael Friedrich Date: Thu, 7 Sep 2017 14:07:35 +0000 (+0200) Subject: Remove debug logging, fix ticket path, enhance logging X-Git-Tag: v2.8.0~87^2~9 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=501ade374c9503cda81db7d150d110afa5c00ae4;p=icinga2 Remove debug logging, fix ticket path, enhance logging refs #5450 --- diff --git a/lib/remote/jsonrpcconnection-pki.cpp b/lib/remote/jsonrpcconnection-pki.cpp index 1852c9024..a1d4c01a1 100644 --- a/lib/remote/jsonrpcconnection-pki.cpp +++ b/lib/remote/jsonrpcconnection-pki.cpp @@ -216,10 +216,10 @@ delayed_request: JsonRpcConnection::SendCertificateRequest(JsonRpcConnection::Ptr(), origin, requestPath); result->Set("status_code", 2); - result->Set("error", "Certificate request is pending. Waiting for approval from the parent Icinga instance."); + result->Set("error", "Certificate request for CN '" + cn + "' is pending. Waiting for approval from the parent Icinga instance."); Log(LogInformation, "JsonRpcConnection") - << "Certificate request is pending. Waiting for approval."; + << "Certificate request for CN '" << cn << "' is pending. Waiting for approval."; return result; } @@ -240,7 +240,7 @@ void JsonRpcConnection::SendCertificateRequest(const JsonRpcConnection::Ptr& acl /* Path is empty if this is our own request. */ if (path.IsEmpty()) { - String ticketPath = Application::GetLocalStateDir() + "/lib/icinga2/pki/ticket"; + String ticketPath = ApiListener::GetCertsDir() + "/ticket"; std::ifstream fp(ticketPath.CStr()); String ticket((std::istreambuf_iterator(fp)), std::istreambuf_iterator()); @@ -275,9 +275,6 @@ Value UpdateCertificateHandler(const MessageOrigin::Ptr& origin, const Dictionar return Empty; } - Log(LogWarning, "JsonRpcConnection") - << params->ToString(); - String ca = params->Get("ca"); String cert = params->Get("cert"); @@ -315,8 +312,6 @@ Value UpdateCertificateHandler(const MessageOrigin::Ptr& origin, const Dictionar String requestDir = ApiListener::GetCertificateRequestsDir(); String requestPath = requestDir + "/" + certFingerprint + ".json"; - std::cout << requestPath << "\n"; - /* Save the received signed certificate request to disk. */ if (Utility::PathExists(requestPath)) { Log(LogInformation, "JsonRpcConnection") @@ -385,7 +380,8 @@ Value UpdateCertificateHandler(const MessageOrigin::Ptr& origin, const Dictionar } /* Update the certificates at runtime and reconnect all endpoints. */ - Log(LogInformation, "JsonRpcConnection", "Updating the client certificate at runtime and reconnecting the endpoints."); + Log(LogInformation, "JsonRpcConnection") + << "Updating the client certificate for CN '" << cn << "' at runtime and reconnecting the endpoints."; listener->UpdateSSLContext(); return Empty;