mirror of
https://github.com/Icinga/icinga2.git
synced 2025-07-24 14:14:45 +02:00
Include IP address and port in the "New connection" log message
fixes #12215
This commit is contained in:
parent
be21a5aad3
commit
45dd027101
@ -330,6 +330,15 @@ void ApiListener::NewClientHandlerInternal(const Socket::Ptr& client, const Stri
|
|||||||
Endpoint::Ptr endpoint;
|
Endpoint::Ptr endpoint;
|
||||||
bool verify_ok = false;
|
bool verify_ok = false;
|
||||||
|
|
||||||
|
String conninfo;
|
||||||
|
|
||||||
|
if (role == RoleClient)
|
||||||
|
conninfo = "to";
|
||||||
|
else
|
||||||
|
conninfo = "from";
|
||||||
|
|
||||||
|
conninfo += " " + client->GetPeerAddress();
|
||||||
|
|
||||||
if (cert) {
|
if (cert) {
|
||||||
try {
|
try {
|
||||||
identity = GetCertificateCN(cert);
|
identity = GetCertificateCN(cert);
|
||||||
@ -360,7 +369,7 @@ void ApiListener::NewClientHandlerInternal(const Socket::Ptr& client, const Stri
|
|||||||
{
|
{
|
||||||
Log log(LogInformation, "ApiListener");
|
Log log(LogInformation, "ApiListener");
|
||||||
|
|
||||||
log << "New client connection for identity '" << identity << "'";
|
log << "New client connection for identity '" << identity << "' " << conninfo;
|
||||||
|
|
||||||
if (!verify_ok)
|
if (!verify_ok)
|
||||||
log << " (certificate validation failed: " << tlsStream->GetVerifyError() << ")";
|
log << " (certificate validation failed: " << tlsStream->GetVerifyError() << ")";
|
||||||
@ -369,7 +378,7 @@ void ApiListener::NewClientHandlerInternal(const Socket::Ptr& client, const Stri
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Log(LogInformation, "ApiListener")
|
Log(LogInformation, "ApiListener")
|
||||||
<< "New client connection (no client certificate)";
|
<< "New client connection " << conninfo << " (no client certificate)";
|
||||||
}
|
}
|
||||||
|
|
||||||
ClientType ctype;
|
ClientType ctype;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user