Make sure icinga works even without SSL.

This commit is contained in:
Gunnar Beutner 2012-05-15 11:08:04 +02:00
parent 925e947a98
commit bcaff12d20
3 changed files with 21 additions and 16 deletions

View File

@ -0,0 +1,9 @@
{
"icinga": {
"icinga": {
}
},
"component": {
"demo": { }
}
}

View File

@ -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());

View File

@ -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();