]> granicus.if.org Git - icinga2/commitdiff
Log a warning message on unauthorized http request
authorMichael Friedrich <michael.friedrich@netways.de>
Fri, 16 Oct 2015 13:32:02 +0000 (15:32 +0200)
committerMichael Friedrich <michael.friedrich@netways.de>
Fri, 16 Oct 2015 13:32:35 +0000 (15:32 +0200)
fixes #10388

lib/remote/httpserverconnection.cpp

index 740cb4ce644dc954ac31395c21866711dde51399..d75b50807a2f417a9336fd2e97f6cbd0810c37a6 100644 (file)
@@ -143,13 +143,17 @@ void HttpServerConnection::ProcessMessageAsync(HttpRequest& request)
                        user.reset();
        }
 
+        String requestUrl = request.RequestUrl->Format();
+
        Log(LogInformation, "HttpServerConnection")
-           << "Request: " << request.RequestMethod << " " << request.RequestUrl->Format()
+           << "Request: " << request.RequestMethod << " " << requestUrl
            << " (" << (user ? user->GetName() : "<unauthenticated>") << ")";
 
        HttpResponse response(m_Stream, request);
 
        if (!user) {
+               Log(LogWarning, "HttpServerConnection")
+                   << "Unauthorized request: " << request.RequestMethod << " " << requestUrl;
                response.SetStatus(401, "Unauthorized");
                response.AddHeader("Content-Type", "text/html");
                response.AddHeader("WWW-Authenticate", "Basic realm=\"Icinga 2\"");