Browse Source

set cron for --le

develop
Prabuddha Chakraborty 9 years ago
parent
commit
1e659de766
  1. 10
      ee/cli/plugins/site.py
  2. 1
      ee/cli/plugins/site_functions.py
  3. 4
      ee/core/sslutils.py

10
ee/cli/plugins/site.py

@ -1112,7 +1112,9 @@ class EESiteUpdateController(CementBaseController):
if pargs.all and pargs.letsencrypt == "renew":
if check_ssl:
expiry_days = SSL.getExpirationDays(self,ee_domain)
expiry_days = SSL.getExpirationDays(self,ee_domain,True)
if expiry_days < 0:
return 0
min_expiry_days = 30
if (expiry_days <= min_expiry_days):
renewLetsEncrypt(self,ee_domain)
@ -1122,10 +1124,12 @@ class EESiteUpdateController(CementBaseController):
if (SSL.getExpirationDays(self,ee_domain)>0):
Log.info(self, "Your cert will expire within " + str(SSL.getExpirationDays(self,ee_domain)) + " days.")
Log.info(self, "Expiration DATE: \n\n" + str(SSL.getExpirationDate(self,ee_domain)))
return 0
#else:
# Log.warn(self, "Your cert already EXPIRED ! .PLEASE renew soon . ")
#return 0
else:
Log.info(self,"SSL not configured for site http://{0}".format(ee_domain))
return 0
if pargs.letsencrypt:
if pargs.letsencrypt == 'on':

1
ee/cli/plugins/site_functions.py

@ -1212,6 +1212,7 @@ def setupLetsEncrypt(self, ee_domain_name):
cloneLetsEncrypt(self)
EEFileUtils.chdir(self, '/opt/letsencrypt')
EEShellExec.cmd_exec(self, "git pull")
Log.warn(self,"Please Wait while we fetch SSL Certificate for your site.\nIt may take time depending upon network.")
ssl = EEShellExec.cmd_exec(self, "./letsencrypt-auto certonly --webroot -w /var/www/{0}/htdocs/ -d {0} -d www.{0} "
.format(ee_domain_name)

4
ee/core/sslutils.py

@ -5,12 +5,14 @@ from ee.core.logging import Log
class SSL:
def getExpirationDays(self,domain):
def getExpirationDays(self,domain,returnonerror=False):
# 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)
if returnonerror:
return -1
Log.error(self, "Check logs for reason "
"`tail /var/log/ee/ee.log` & Try Again!!!")

Loading…
Cancel
Save