mirror of
https://github.com/usmannasir/cyberpanel.git
synced 2025-11-06 13:25:51 +01:00
manual auto renew for SSL
This commit is contained in:
@@ -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',
|
||||
|
||||
Reference in New Issue
Block a user