Browse Source

Site renew ssl

develop
Prabuddha Chakraborty 9 years ago
parent
commit
ec3a57a596
  1. 2
      ee/cli/plugins/site.py
  2. 36
      ee/cli/plugins/site_functions.py

2
ee/cli/plugins/site.py

@ -1036,7 +1036,7 @@ class EESiteUpdateController(CementBaseController):
Log.info(self, "SUCCESS: Certificate was successfully renewed For"
" https://{0}".format(ee_domain))
if (SSL.getExpirationDays(ee_domain)>0):
Log.info(self, "Your cert will expire within " + SSL.getExpirationDays() + " days.")
Log.info(self, "Your cert will expire within " + SSL.getExpirationDays(ee_domain) + " days.")
Log.info(self, "Expiration DATE: " + SSL.getExpirationDate(ee_domain))
else:

36
ee/cli/plugins/site_functions.py

@ -2,6 +2,7 @@ from ee.cli.plugins.stack import EEStackController
from ee.core.fileutils import EEFileUtils
from ee.core.mysql import *
from ee.core.shellexec import *
from ee.core.sslutils import SSL
from ee.core.variables import EEVariables
from ee.cli.plugins.sitedb import *
from ee.core.aptget import EEAptGet
@ -1244,4 +1245,39 @@ def setupLetsEncrypt(self, ee_domain_name):
else:
Log.error(self, "Unable to setup, LetsEncrypt")
def renewLetsEncrypt(self, ee_domain_name):
ee_wp_email = EEVariables.ee_email
while not ee_wp_email:
try:
ee_wp_email = input('Enter email address: ')
except EOFError as e:
Log.debug(self, "{0}".format(e))
raise SiteError("Input wordpress email failed")
if not os.path.isdir("/opt/letsencrypt"):
cloneLetsEncrypt(self)
EEFileUtils.chdir(self, '/opt/letsencrypt')
EEShellExec.cmd_exec(self, "git pull")
Log.info(self, "Renewing SSl cert for https://{0}".format(ee_domain_name))
ssl = EEShellExec.cmd_exec(self, "./letsencrypt-auto --renew certonly --webroot -w /var/www/{0}/htdocs/ -d {0} -d www.{0} "
.format(ee_domain_name)
+ "--email {0} --text --agree-tos".format(ee_wp_email))
if not ssl:
Log.error(self,"ERROR : Cannot RENEW SSL cert !",False)
if (SSL.getExpirationDays(ee_domain_name)>0):
Log.error(self, "Your current cert will expire within " + SSL.getExpirationDays(ee_domain_name) + " days.",False)
else:
Log.error(self, "Your current cert already EXPIRED !",False)
Log.error(self, "Check logs for reason "
"`tail /var/log/ee/ee.log` & Try Again!!!")
EEGit.add(self, ["/etc/letsencrypt"],
msg="Adding letsencrypt folder")

Loading…
Cancel
Save