mirror of
https://github.com/Icinga/icinga2.git
synced 2025-07-25 14:44:32 +02:00
parent
252f3205cb
commit
938ae083cd
@ -132,9 +132,27 @@ int PkiUtility::SaveCert(const String& host, const String& port, const String& k
|
|||||||
{
|
{
|
||||||
TcpSocket::Ptr client = new TcpSocket();
|
TcpSocket::Ptr client = new TcpSocket();
|
||||||
|
|
||||||
|
try {
|
||||||
client->Connect(host, port);
|
client->Connect(host, port);
|
||||||
|
} catch (const std::exception& ex) {
|
||||||
|
Log(LogCritical, "cli")
|
||||||
|
<< "Cannot connect to host '" << host << "' on port '" << port << "'";
|
||||||
|
Log(LogDebug, "cli")
|
||||||
|
<< "Cannot connect to host '" << host << "' on port '" << port << "':\n" << DiagnosticInformation(ex);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
boost::shared_ptr<SSL_CTX> sslContext = MakeSSLContext(certfile, keyfile);
|
boost::shared_ptr<SSL_CTX> sslContext;
|
||||||
|
|
||||||
|
try {
|
||||||
|
sslContext = MakeSSLContext(certfile, keyfile);
|
||||||
|
} catch (const std::exception& ex) {
|
||||||
|
Log(LogCritical, "cli")
|
||||||
|
<< "Cannot make SSL context for cert path: '" << certfile << "' key path: '" << keyfile << "'.";
|
||||||
|
Log(LogDebug, "cli")
|
||||||
|
<< "Cannot make SSL context for cert path: '" << certfile << "' key path: '" << keyfile << "':\n" << DiagnosticInformation(ex);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
TlsStream::Ptr stream = new TlsStream(client, RoleClient, sslContext);
|
TlsStream::Ptr stream = new TlsStream(client, RoleClient, sslContext);
|
||||||
|
|
||||||
@ -192,6 +210,8 @@ int PkiUtility::RequestCertificate(const String& host, const String& port, const
|
|||||||
} catch (const std::exception& ex) {
|
} catch (const std::exception& ex) {
|
||||||
Log(LogCritical, "cli")
|
Log(LogCritical, "cli")
|
||||||
<< "Cannot make SSL context for cert path: '" << certfile << "' key path: '" << keyfile << "' ca path: '" << cafile << "'.";
|
<< "Cannot make SSL context for cert path: '" << certfile << "' key path: '" << keyfile << "' ca path: '" << cafile << "'.";
|
||||||
|
Log(LogDebug, "cli")
|
||||||
|
<< "Cannot make SSL context for cert path: '" << certfile << "' key path: '" << keyfile << "' ca path: '" << cafile << "':\n" << DiagnosticInformation(ex);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user