]> granicus.if.org Git - icinga2/commitdiff
Improve TLS handshake exception logging 6602/head
authorNoah Hilverling <noah@hilverling.com>
Thu, 6 Sep 2018 13:58:42 +0000 (15:58 +0200)
committerNoah Hilverling <noah@hilverling.com>
Thu, 6 Sep 2018 13:58:42 +0000 (15:58 +0200)
lib/perfdata/elasticsearchwriter.cpp
lib/perfdata/influxdbwriter.cpp
lib/remote/apilistener.cpp
lib/remote/pkiutility.cpp
lib/remote/pkiutility.hpp

index d9d56b00472a6d22761064a98d0ae2bf31a3b697..c10baf12d1c632faa7963604cd8ed4c3acdb3427 100644 (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;
        }
 
index 89cf13220db1222cfe6778141ea140f4436956ad..27dd698318f1072417edc03688bd83102013be8c 100644 (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;
        }
 
index 425ca6cc89ec9336b47473368ea726df13c9aa7f..c9cbd38679869f51cf41a078112d9465359fffb9 100644 (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;
        }
index 20d9ca6c2fe877ff8dc4dfee0d437bddfa8f4084..915b3ee2ee7c45f82347d352a6a2413186080cbc 100644 (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;
        }
 
index f73448b8f1e90223f0d8755cb58c297d35c2c443..8ddd20037c0a16b9c4479c729407a1ee5bf08d5e 100644 (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>