[icinga-checkins] icinga.org: icinga2/feature/ido-groups: Include client IP address and port in HTTP requests

git at icinga.org git at icinga.org
Mon Jul 25 14:49:35 CEST 2016


Module: icinga2
Branch: feature/ido-groups
Commit: cdda3bad8cf586155c7521a60b59f8dd55c8d064
URL:    https://git.icinga.org/?p=icinga2.git;a=commit;h=cdda3bad8cf586155c7521a60b59f8dd55c8d064

Author: Gunnar Beutner <gunnar.beutner at netways.de>
Date:   Mon Jul 25 09:43:13 2016 +0200

Include client IP address and port in HTTP requests

fixes #11706

---

 lib/base/tlsstream.cpp              |    5 +++++
 lib/base/tlsstream.hpp              |    2 ++
 lib/remote/httpserverconnection.cpp |    2 +-
 3 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/lib/base/tlsstream.cpp b/lib/base/tlsstream.cpp
index d0a1e44..b281203 100644
--- a/lib/base/tlsstream.cpp
+++ b/lib/base/tlsstream.cpp
@@ -391,3 +391,8 @@ bool TlsStream::IsDataAvailable(void) const
 
 	return m_RecvQ->GetAvailableBytes() > 0;
 }
+
+Socket::Ptr TlsStream::GetSocket(void) const
+{
+	return m_Socket;
+}
diff --git a/lib/base/tlsstream.hpp b/lib/base/tlsstream.hpp
index bfd4d2a..5fa06d3 100644
--- a/lib/base/tlsstream.hpp
+++ b/lib/base/tlsstream.hpp
@@ -51,6 +51,8 @@ public:
 	TlsStream(const Socket::Ptr& socket, const String& hostname, ConnectionRole role, const boost::shared_ptr<SSL_CTX>& sslContext = MakeSSLContext());
 	~TlsStream(void);
 
+	Socket::Ptr GetSocket(void) const;
+
 	boost::shared_ptr<X509> GetClientCertificate(void) const;
 	boost::shared_ptr<X509> GetPeerCertificate(void) const;
 
diff --git a/lib/remote/httpserverconnection.cpp b/lib/remote/httpserverconnection.cpp
index be3dec1..6498dd5 100644
--- a/lib/remote/httpserverconnection.cpp
+++ b/lib/remote/httpserverconnection.cpp
@@ -163,7 +163,7 @@ void HttpServerConnection::ProcessMessageAsync(HttpRequest& request)
 
 	Log(LogInformation, "HttpServerConnection")
 	    << "Request: " << request.RequestMethod << " " << requestUrl
-	    << " (" << (user ? user->GetName() : "<unauthenticated>") << ")";
+	    << " (from " << m_Stream->GetSocket()->GetPeerAddress() << ", user: " << (user ? user->GetName() : "<unauthenticated>") << ")";
 
 	HttpResponse response(m_Stream, request);
 



More information about the icinga-checkins mailing list