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,15 +66,7 @@ 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 (GetPublicKeyFile().empty())
|
||||
throw InvalidArgumentException("No public certificate was specified.");
|
||||
|
||||
if (GetCAKeyFile().empty())
|
||||
throw InvalidArgumentException("No CA certificate 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);
|
||||
|
@ -83,6 +75,7 @@ int IcingaApplication::Main(const vector<string>& args)
|
|||
|
||||
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