mirror of https://github.com/Icinga/icinga2.git
ApiListener#RenewCert(): enable optional CA creation
This commit is contained in:
parent
7b55df6f11
commit
36a08b0497
|
@ -181,12 +181,12 @@ void ApiListener::OnConfigLoaded()
|
||||||
UpdateSSLContext();
|
UpdateSSLContext();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::shared_ptr<X509> ApiListener::RenewCert(const std::shared_ptr<X509>& cert)
|
std::shared_ptr<X509> ApiListener::RenewCert(const std::shared_ptr<X509>& cert, bool ca)
|
||||||
{
|
{
|
||||||
std::shared_ptr<EVP_PKEY> pubkey (X509_get_pubkey(cert.get()), EVP_PKEY_free);
|
std::shared_ptr<EVP_PKEY> pubkey (X509_get_pubkey(cert.get()), EVP_PKEY_free);
|
||||||
auto subject (X509_get_subject_name(cert.get()));
|
auto subject (X509_get_subject_name(cert.get()));
|
||||||
auto cacert (GetX509Certificate(GetDefaultCaPath()));
|
auto cacert (GetX509Certificate(GetDefaultCaPath()));
|
||||||
auto newcert (CreateCertIcingaCA(pubkey.get(), subject));
|
auto newcert (CreateCertIcingaCA(pubkey.get(), subject, ca));
|
||||||
|
|
||||||
/* verify that the new cert matches the CA we're using for the ApiListener;
|
/* verify that the new cert matches the CA we're using for the ApiListener;
|
||||||
* this ensures that the CA we have in /var/lib/icinga2/ca matches the one
|
* this ensures that the CA we have in /var/lib/icinga2/ca matches the one
|
||||||
|
|
|
@ -91,7 +91,7 @@ public:
|
||||||
static String GetCaDir();
|
static String GetCaDir();
|
||||||
static String GetCertificateRequestsDir();
|
static String GetCertificateRequestsDir();
|
||||||
|
|
||||||
std::shared_ptr<X509> RenewCert(const std::shared_ptr<X509>& cert);
|
std::shared_ptr<X509> RenewCert(const std::shared_ptr<X509>& cert, bool ca = false);
|
||||||
void UpdateSSLContext();
|
void UpdateSSLContext();
|
||||||
|
|
||||||
static ApiListener::Ptr GetInstance();
|
static ApiListener::Ptr GetInstance();
|
||||||
|
|
Loading…
Reference in New Issue