adamdebreceni commented on code in PR #1336: URL: https://github.com/apache/nifi-minifi-cpp/pull/1336#discussion_r876758283
########## libminifi/src/controllers/SSLContextService.cpp: ########## @@ -563,6 +559,89 @@ void SSLContextService::initializeProperties() { setSupportedProperties(supportedProperties); } +void SSLContextService::verifyCertificateExpiration() { + auto verify = [&] (const std::string& cert_file, const utils::tls::X509_unique_ptr& cert) { + if (auto end_date = utils::tls::getCertificateExpiration(cert)) { + std::string end_date_str = getTimeStr(std::chrono::duration_cast<std::chrono::milliseconds>(end_date->time_since_epoch()).count()); + if (end_date.value() < std::chrono::system_clock::now()) { + core::logging::LOG_ERROR(logger_) << "Certificate in '" << cert_file << "' expired at " << end_date_str; + } else if (auto diff = end_date.value() - std::chrono::system_clock::now(); diff < std::chrono::months{3}) { + core::logging::LOG_WARN(logger_) << "Certificate in '" << cert_file << "' will expire at " << end_date_str; + } else { + core::logging::LOG_DEBUG(logger_) << "Certificate in '" << cert_file << "' will expire at " << end_date_str; + } + } else { + core::logging::LOG_ERROR(logger_) << "Could not determine expiration date for certificate in '" << certificate_ << "'"; Review Comment: done -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@nifi.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org