manual auto renew for SSL

This commit is contained in:
Usman Nasir
2019-12-04 14:40:59 +05:00
parent 0bcd06d9e8
commit 412ed6872a
6 changed files with 176 additions and 5 deletions

View File

@@ -712,8 +712,6 @@ class WebsiteManager:
execPath = execPath + " findDomainBW --virtualHostName " + self.domain + " --bandwidth " + str(
website.package.bandwidth)
logging.CyberCPLogFileWriter.writeToFile(execPath)
output = ProcessUtilities.outputExecutioner(execPath)
bwData = output.split(",")
except BaseException, msg:
@@ -746,6 +744,25 @@ class WebsiteManager:
else:
Data['email'] = 0
## Getting SSL Information
try:
import OpenSSL
from datetime import datetime
filePath = '/etc/letsencrypt/live/%s/fullchain.pem' % (self.domain)
x509 = OpenSSL.crypto.load_certificate(OpenSSL.crypto.FILETYPE_PEM,
open(filePath, 'r').read())
expireData = x509.get_notAfter().decode('ascii')
finalDate = datetime.strptime(expireData, '%Y%m%d%H%M%SZ')
now = datetime.now()
diff = finalDate - now
Data['viewSSL'] = 1
Data['days'] = str(diff.days)
Data['authority'] = x509.get_issuer().get_components()[1][1]
except BaseException, msg:
Data['viewSSL'] = 0
logging.CyberCPLogFileWriter.writeToFile(str(msg))
servicePath = '/home/cyberpanel/pureftpd'
if os.path.exists(servicePath):
Data['ftp'] = 1
@@ -829,6 +846,26 @@ class WebsiteManager:
else:
Data['ftp'] = 0
## Getting SSL Information
try:
import OpenSSL
from datetime import datetime
filePath = '/etc/letsencrypt/live/%s/fullchain.pem' % (self.domain)
x509 = OpenSSL.crypto.load_certificate(OpenSSL.crypto.FILETYPE_PEM,
open(filePath, 'r').read())
expireData = x509.get_notAfter().decode('ascii')
finalDate = datetime.strptime(expireData, '%Y%m%d%H%M%SZ')
now = datetime.now()
diff = finalDate - now
Data['viewSSL'] = 1
Data['days'] = str(diff.days)
Data['authority'] = x509.get_issuer().get_components()[1][1]
except BaseException, msg:
Data['viewSSL'] = 0
logging.CyberCPLogFileWriter.writeToFile(str(msg))
return render(request, 'websiteFunctions/launchChild.html', Data)
else:
return render(request, 'websiteFunctions/launchChild.html',