From 2f16686bd67e2b8f4bc48cb9caa235ed9e39fc7c Mon Sep 17 00:00:00 2001 From: "usman@cyberpersons.com" Date: Thu, 16 Mar 2023 09:47:11 +0500 Subject: [PATCH] renew --- plogical/renew.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/plogical/renew.py b/plogical/renew.py index cefff7257..040d081e7 100644 --- a/plogical/renew.py +++ b/plogical/renew.py @@ -34,10 +34,14 @@ class Renew: now = datetime.now() diff = finalDate - now - if int(diff.days) >= 15: + SSLProvider = x509.get_issuer().get_components()[1][1].decode('utf-8') + + print(f"Provider: {x509.get_issuer().get_components()[1][1].decode('utf-8')}, Days : {diff.days}") + + if int(diff.days) >= 15 and SSLProvider!='Denial': logging.writeToFile( 'SSL exists for %s and is not ready to renew, skipping..' % (website.domain), 0) - elif x509.get_issuer().get_components()[1][1].decode('utf-8') == 'Denial': + elif SSLProvider == 'Denial': logging.writeToFile( 'SSL exists for %s and ready to renew..' % (website.domain), 0) logging.writeToFile( @@ -45,7 +49,7 @@ class Renew: virtualHostUtilities.issueSSL(website.domain, '/home/%s/public_html' % (website.domain), website.adminEmail) - elif x509.get_issuer().get_components()[1][1].decode('utf-8') != "Let's Encrypt": + elif SSLProvider != "Let's Encrypt": logging.writeToFile( 'Custom SSL exists for %s and ready to renew..' % (website.domain), 1) else: @@ -101,6 +105,7 @@ class Renew: 'SSL does not exist for %s. Obtaining now..' % (website.domain), 0) virtualHostUtilities.issueSSL(website.domain, website.path, website.master.adminEmail) + self.file = logging.writeToFile('Restarting mail services for them to see new SSL.', 0) from plogical.processUtilities import ProcessUtilities