From 0af655f10650777c31ed1cd40d059d08cf79b466 Mon Sep 17 00:00:00 2001 From: Michael Kaufmann Date: Sat, 25 Jul 2020 17:21:52 +0200 Subject: [PATCH] fix permanent rebuilding of vhost configs due to always-true renew check of let's encrypt certificates Signed-off-by: Michael Kaufmann --- lib/Froxlor/Cron/Http/LetsEncrypt/AcmeSh.php | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/lib/Froxlor/Cron/Http/LetsEncrypt/AcmeSh.php b/lib/Froxlor/Cron/Http/LetsEncrypt/AcmeSh.php index e0e152c9..209e51b4 100644 --- a/lib/Froxlor/Cron/Http/LetsEncrypt/AcmeSh.php +++ b/lib/Froxlor/Cron/Http/LetsEncrypt/AcmeSh.php @@ -62,7 +62,7 @@ class AcmeSh extends \Froxlor\Cron\FroxlorCron $issue_froxlor = self::issueFroxlorVhost(); $issue_domains = self::issueDomains(); $renew_froxlor = self::renewFroxlorVhost(); - $renew_domains = self::renewDomains(); + $renew_domains = self::renewDomains(true); if ($issue_froxlor || $issue_domains || $renew_froxlor || $renew_domains) { // insert task to generate certificates and vhost-configs \Froxlor\System\Cronjob::inserttask(1); @@ -409,7 +409,7 @@ class AcmeSh extends \Froxlor\Cron\FroxlorCron /** * get a list of domains that have a lets encrypt certificate (possible renew) */ - private static function renewDomains() + private static function renewDomains($check = false) { $certificates_stmt = Database::query(" SELECT @@ -437,6 +437,13 @@ class AcmeSh extends \Froxlor\Cron\FroxlorCron "); $renew_certs = $certificates_stmt->fetchAll(\PDO::FETCH_ASSOC); if ($renew_certs) { + if ($check) { + foreach ($renew_certs as $cert) { + if (self::checkFsFilesAreNewer($cert['domain'], $cert['expirationdate'])) { + return true; + } + } + } return $renew_certs; } return array();