mirror of https://github.com/Icinga/icinga2.git
Make sure icinga works even without SSL.
This commit is contained in:
parent
925e947a98
commit
bcaff12d20
|
@ -0,0 +1,9 @@
|
|||
{
|
||||
"icinga": {
|
||||
"icinga": {
|
||||
}
|
||||
},
|
||||
"component": {
|
||||
"demo": { }
|
||||
}
|
||||
}
|
|
@ -43,6 +43,9 @@ shared_ptr<SSL_CTX> EndpointManager::GetSSLContext(void) const
|
|||
|
||||
void EndpointManager::AddListener(string service)
|
||||
{
|
||||
if (!GetSSLContext())
|
||||
throw InvalidArgumentException("SSL context is required for AddListener()");
|
||||
|
||||
stringstream s;
|
||||
s << "Adding new listener: port " << service;
|
||||
Application::Log(s.str());
|
||||
|
|
|
@ -66,23 +66,16 @@ int IcingaApplication::Main(const vector<string>& args)
|
|||
fileComponentConfig->SetPropertyInteger("replicate", 0);
|
||||
GetConfigHive()->AddObject(fileComponentConfig);
|
||||
|
||||
if (GetPrivateKeyFile().empty())
|
||||
throw InvalidArgumentException("No private key was specified.");
|
||||
if (!GetPrivateKeyFile().empty() && !GetPublicKeyFile().empty() && !GetCAKeyFile().empty()) {
|
||||
/* set up SSL context */
|
||||
shared_ptr<X509> cert = Utility::GetX509Certificate(GetPublicKeyFile());
|
||||
string identity = Utility::GetCertificateCN(cert);
|
||||
Application::Log("My identity: " + identity);
|
||||
m_EndpointManager->SetIdentity(identity);
|
||||
|
||||
if (GetPublicKeyFile().empty())
|
||||
throw InvalidArgumentException("No public certificate was specified.");
|
||||
|
||||
if (GetCAKeyFile().empty())
|
||||
throw InvalidArgumentException("No CA certificate was specified.");
|
||||
|
||||
/* set up SSL context */
|
||||
shared_ptr<X509> cert = Utility::GetX509Certificate(GetPublicKeyFile());
|
||||
string identity = Utility::GetCertificateCN(cert);
|
||||
Application::Log("My identity: " + identity);
|
||||
m_EndpointManager->SetIdentity(identity);
|
||||
|
||||
shared_ptr<SSL_CTX> sslContext = Utility::MakeSSLContext(GetPublicKeyFile(), GetPrivateKeyFile(), GetCAKeyFile());
|
||||
m_EndpointManager->SetSSLContext(sslContext);
|
||||
shared_ptr<SSL_CTX> sslContext = Utility::MakeSSLContext(GetPublicKeyFile(), GetPrivateKeyFile(), GetCAKeyFile());
|
||||
m_EndpointManager->SetSSLContext(sslContext);
|
||||
}
|
||||
|
||||
/* create the primary RPC listener */
|
||||
string service = GetService();
|
||||
|
|
Loading…
Reference in New Issue