Combine private and public keys into one file.

This commit is contained in:
Gunnar Beutner 2012-06-27 09:10:37 +02:00
parent 0f5ea5b53b
commit a9d865c94f
13 changed files with 68 additions and 125 deletions

View File

@ -1,17 +0,0 @@
-----BEGIN CERTIFICATE-----
MIICtzCCAiCgAwIBAgIBADANBgkqhkiG9w0BAQUFADBoMQswCQYDVQQGEwJERTEQ
MA4GA1UECAwHQmF2YXJpYTESMBAGA1UEBwwJTnVyZW1iZXJnMRUwEwYDVQQKDAxO
RVRXQVlTIEdtYkgxHDAaBgNVBAMME0ljaW5nYSBTbmFrZSBPaWwgQ0EwHhcNMTIw
NDI0MTE0NzQ2WhcNMTMwNDI0MTE0NzQ2WjBeMQswCQYDVQQGEwJERTEQMA4GA1UE
CAwHQmF2YXJpYTESMBAGA1UEBwwJTnVyZW1iZXJnMRUwEwYDVQQKDAxORVRXQVlT
IEdtYkgxEjAQBgNVBAMMCWljaW5nYS1jMTCBnzANBgkqhkiG9w0BAQEFAAOBjQAw
gYkCgYEAysHrzHs9WfQR4cEUx2hFZQmbM+Ssi5L63yqnzxEvVQ3GlM+uIceK1Kvx
9EexoUDLhxJOaUmigc6Pcs2mAjcpEwObnzW4pLuMKa7ngGLrnUpmmDXdGoxkCbi7
CP3s5yC7ZZ6bDiPMhRi/TRvY6+uQf+yew5daA3p87jocgRjhRicCAwEAAaN7MHkw
CQYDVR0TBAIwADAsBglghkgBhvhCAQ0EHxYdT3BlblNTTCBHZW5lcmF0ZWQgQ2Vy
dGlmaWNhdGUwHQYDVR0OBBYEFPzsYbQZdbq+pcFJWoenWREW6WhMMB8GA1UdIwQY
MBaAFNVJHVPJNwqEcG51lpqZJWVPaysFMA0GCSqGSIb3DQEBBQUAA4GBAMLP1GJf
0hFdrEpGq+NvxTVx7wD30enAot5x2HLx4HuFohQJz/VZ45v+srrA+HEXbBFXPOd4
nB2XtcDDidFKTt5E03HBwDGGZvnB3f1KXYi7B50imKrwVVzgp5nGBM4hSzWGovEX
EYofmhk0fQg9qiKQr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C+wA6DeVjtvHatQJBAMG1qavOgKyLV9t/65XOEDm5Pqnu
KCfhiZQDBp5fTllRy2FlGYmoi2cSFhVGWOQB7G/CchBZWfiDcnpoJanufOUCQGr7
bKKHnoKcNmEYLOpNABMum7PPB5AjwOjt94CagT1WYKZNdzkLEg+pTXrIM8QsGdhw
bBqtZW1bK43mivcHQtkCQF+p7LfzmPo9uzRrOfjgTDYLuh3MD8EKNs0M6l15UqbQ
nfBBE0oIPH4j+K++7xWUQ7vbiyBc7C7H3NZeE6xqfS0=
-----END RSA PRIVATE KEY-----

View File

@ -0,0 +1,25 @@
local object application "icinga" {
ca = "ca.crt",
cert = "icinga-c2.pem"
}
local object component "checker" {
}
local object component "discovery" {
broker = 0
}
/* trusted upstream endpoint */
local object endpoint "icinga-c1" {
node = "192.168.5.46",
service = 7777,
roles = { "all" }
}
local object role "all" {
publications = { "*" },
subscriptions = { "*" }
}

View File

@ -0,0 +1,24 @@
local object application "icinga" {
cert = "icinga-c3.pem",
ca = "ca.crt"
}
local object component "checker" {
}
local object component "discovery" {
broker = 0
}
/* trusted upstream endpoint */
local object endpoint "icinga-c1" {
node = "192.168.5.46",
service = 7777,
roles = { "all" }
}
local object role "all" {
publications = { "*" },
subscriptions = { "*" }
}

View File

@ -1,7 +1,6 @@
local object application "icinga" { local object application "icinga" {
privkey = "icinga-c1.key", ca = "ca.crt",
pubkey = "icinga-c1.crt", cert = "icinga-c1.pem",
cakey = "ca.crt",
node = "10.0.10.14", node = "10.0.10.14",
service = 7777 service = 7777

View File

@ -1,8 +1,7 @@
local object application "icinga" { local object application "icinga" {
privkey = "icinga-c2.key", ca = "ca.crt",
pubkey = "icinga-c2.crt", cert = "icinga-c2.pem",
cakey = "ca.crt",
node = "192.168.2.235", node = "192.168.2.235",
service = 7777 service = 7777
} }

View File

@ -1,7 +1,6 @@
local object application "icinga" { local object application "icinga" {
privkey = "icinga-c3.key", ca = "ca.crt",
pubkey = "icinga-c3.crt", cert = "icinga-c3.pem",
cakey = "ca.crt",
node = "10.0.10.14", node = "10.0.10.14",
service = 9999 service = 9999

View File

@ -75,20 +75,19 @@ int IcingaApplication::Main(const vector<string>& args)
if (!icingaConfig->IsLocal()) if (!icingaConfig->IsLocal())
throw runtime_error("'icinga' application object must be 'local'."); throw runtime_error("'icinga' application object must be 'local'.");
icingaConfig->GetProperty("privkey", &m_PrivateKeyFile); icingaConfig->GetProperty("cert", &m_CertificateFile);
icingaConfig->GetProperty("pubkey", &m_PublicKeyFile); icingaConfig->GetProperty("ca", &m_CAFile);
icingaConfig->GetProperty("cakey", &m_CAKeyFile);
icingaConfig->GetProperty("node", &m_Node); icingaConfig->GetProperty("node", &m_Node);
icingaConfig->GetProperty("service", &m_Service); icingaConfig->GetProperty("service", &m_Service);
if (!GetPrivateKeyFile().empty() && !GetPublicKeyFile().empty() && !GetCAKeyFile().empty()) { if (!GetCertificateFile().empty() && !GetCAFile().empty()) {
/* set up SSL context */ /* set up SSL context */
shared_ptr<X509> cert = Utility::GetX509Certificate(GetPublicKeyFile()); shared_ptr<X509> cert = Utility::GetX509Certificate(GetCertificateFile());
string identity = Utility::GetCertificateCN(cert); string identity = Utility::GetCertificateCN(cert);
Application::Log(LogInformation, "icinga", "My identity: " + identity); Application::Log(LogInformation, "icinga", "My identity: " + identity);
m_EndpointManager->SetIdentity(identity); m_EndpointManager->SetIdentity(identity);
shared_ptr<SSL_CTX> sslContext = Utility::MakeSSLContext(GetPublicKeyFile(), GetPrivateKeyFile(), GetCAKeyFile()); shared_ptr<SSL_CTX> sslContext = Utility::MakeSSLContext(GetCertificateFile(), GetCertificateFile(), GetCAFile());
m_EndpointManager->SetSSLContext(sslContext); m_EndpointManager->SetSSLContext(sslContext);
} }
@ -136,19 +135,14 @@ void IcingaApplication::DeletedComponentHandler(const ConfigObject::Ptr& object)
UnregisterComponent(component); UnregisterComponent(component);
} }
string IcingaApplication::GetPrivateKeyFile(void) const string IcingaApplication::GetCertificateFile(void) const
{ {
return m_PrivateKeyFile; return m_CertificateFile;
} }
string IcingaApplication::GetPublicKeyFile(void) const string IcingaApplication::GetCAFile(void) const
{ {
return m_PublicKeyFile; return m_CAFile;
}
string IcingaApplication::GetCAKeyFile(void) const
{
return m_CAKeyFile;
} }
string IcingaApplication::GetNode(void) const string IcingaApplication::GetNode(void) const

View File

@ -38,18 +38,16 @@ public:
EndpointManager::Ptr GetEndpointManager(void); EndpointManager::Ptr GetEndpointManager(void);
string GetPrivateKeyFile(void) const; string GetCertificateFile(void) const;
string GetPublicKeyFile(void) const; string GetCAFile(void) const;
string GetCAKeyFile(void) const;
string GetNode(void) const; string GetNode(void) const;
string GetService(void) const; string GetService(void) const;
private: private:
EndpointManager::Ptr m_EndpointManager; EndpointManager::Ptr m_EndpointManager;
string m_PrivateKeyFile; string m_CertificateFile;
string m_PublicKeyFile; string m_CAFile;
string m_CAKeyFile;
string m_Node; string m_Node;
string m_Service; string m_Service;