From 36a08b0497a37b5e97eb25475f99c465e55596c4 Mon Sep 17 00:00:00 2001 From: "Alexander A. Klimov" Date: Mon, 6 Nov 2023 10:34:16 +0100 Subject: [PATCH] ApiListener#RenewCert(): enable optional CA creation --- lib/remote/apilistener.cpp | 4 ++-- lib/remote/apilistener.hpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/remote/apilistener.cpp b/lib/remote/apilistener.cpp index f5e6e302a..f0ac42cc4 100644 --- a/lib/remote/apilistener.cpp +++ b/lib/remote/apilistener.cpp @@ -181,12 +181,12 @@ void ApiListener::OnConfigLoaded() UpdateSSLContext(); } -std::shared_ptr ApiListener::RenewCert(const std::shared_ptr& cert) +std::shared_ptr ApiListener::RenewCert(const std::shared_ptr& cert, bool ca) { std::shared_ptr pubkey (X509_get_pubkey(cert.get()), EVP_PKEY_free); auto subject (X509_get_subject_name(cert.get())); 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; * this ensures that the CA we have in /var/lib/icinga2/ca matches the one diff --git a/lib/remote/apilistener.hpp b/lib/remote/apilistener.hpp index ffe97a2b3..48e7e4c42 100644 --- a/lib/remote/apilistener.hpp +++ b/lib/remote/apilistener.hpp @@ -91,7 +91,7 @@ public: static String GetCaDir(); static String GetCertificateRequestsDir(); - std::shared_ptr RenewCert(const std::shared_ptr& cert); + std::shared_ptr RenewCert(const std::shared_ptr& cert, bool ca = false); void UpdateSSLContext(); static ApiListener::Ptr GetInstance();