Browse Source

sslutil.py update

develop
Prabuddha Chakraborty 9 years ago
parent
commit
f35c6516c4
  1. 23
      ee/core/sslutils.py

23
ee/core/sslutils.py

@ -1,9 +1,20 @@
import os
from ee.core.shellexec import EEShellExec
from ee.core.logging import Log
class SSL:
def getExpirationDays(self,domain):
def getExpirationDays(self,domain):
# check if exist
if not os.path.isfile('/etc/letsencrypt/live/{0}/cert.pem'
.format(domain)):
Log.error(self,'File Not Found : /etc/letsencrypt/live/{0}/cert.pem'
.format(domain),False)
Log.error(self, "Check logs for reason "
"`tail /var/log/ee/ee.log` & Try Again!!!")
current_date = EEShellExec.cmd_exec(self, "date -d \"now\" +%s")
expiration_date = EEShellExec.cmd_exec(self, "date -d \"\`openssl x509 -in /etc/letsencrypt/live/{0}/cert.pem"
" -text -noout|grep \"Not After\"|cut -c 25-`\" +%s".format(domain))
@ -15,7 +26,15 @@ class SSL:
# return "Certificate Already Expired ! Please Renew soon."
return -1
def getExpirationDate(self,domain):
def getExpirationDate(self,domain):
# check if exist
if not os.path.isfile('/etc/letsencrypt/live/{0}/cert.pem'
.format(domain),False):
Log.error(self,'File Not Found : /etc/letsencrypt/live/{0}/cert.pem'
.format(domain))
Log.error(self, "Check logs for reason "
"`tail /var/log/ee/ee.log` & Try Again!!!")
expiration_date = EEShellExec.cmd_exec(self, "date -d \"\`openssl x509 -in /etc/letsencrypt/live/{0}/cert.pem"
" -text -noout|grep \"Not After\"|cut -c 25-`\" ".format(domain))
return expiration_date

Loading…
Cancel
Save