Merge pull request #6602 from Icinga/fix/improve-tls-handshake-exception-logging

Improve TLS handshake exception logging
This commit is contained in:
Michael Friedrich 2018-09-06 17:01:22 +02:00 committed by GitHub
commit c48da4c280
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 8 additions and 6 deletions

View File

@ -434,7 +434,7 @@ void ElasticsearchWriter::SendRequest(const String& body)
stream = Connect();
} catch (const std::exception& ex) {
Log(LogWarning, "ElasticsearchWriter")
<< "Flush failed, cannot connect to Elasticsearch.";
<< "Flush failed, cannot connect to Elasticsearch: " << DiagnosticInformation(ex, false);
return;
}

View File

@ -425,7 +425,7 @@ void InfluxdbWriter::Flush()
stream = Connect();
} catch (const std::exception& ex) {
Log(LogWarning, "InfluxDbWriter")
<< "Flush failed, cannot connect to InfluxDB.";
<< "Flush failed, cannot connect to InfluxDB: " << DiagnosticInformation(ex, false);
return;
}

View File

@ -461,9 +461,9 @@ void ApiListener::NewClientHandlerInternal(const Socket::Ptr& client, const Stri
try {
tlsStream->Handshake();
} catch (const std::exception&) {
} catch (const std::exception& ex) {
Log(LogCritical, "ApiListener")
<< "Client TLS handshake failed (" << conninfo << ")";
<< "Client TLS handshake failed (" << conninfo << "): " << DiagnosticInformation(ex, false);
tlsStream->Close();
return;
}

View File

@ -187,8 +187,9 @@ int PkiUtility::RequestCertificate(const String& host, const String& port, const
try {
stream->Handshake();
} catch (const std::exception&) {
Log(LogCritical, "cli", "Client TLS handshake failed.");
} catch (const std::exception& ex) {
Log(LogCritical, "cli")
<< "Client TLS handshake failed: " << DiagnosticInformation(ex, false);
return 1;
}

View File

@ -21,6 +21,7 @@
#define PKIUTILITY_H
#include "remote/i2-remote.hpp"
#include "base/exception.hpp"
#include "base/dictionary.hpp"
#include "base/string.hpp"
#include <openssl/x509v3.h>