Fix issues, simplify code
This commit is contained in:
@@ -68,6 +68,10 @@ password =
|
|||||||
### EMail for WordPress sites
|
### EMail for WordPress sites
|
||||||
email =
|
email =
|
||||||
|
|
||||||
|
[letsencrypt]
|
||||||
|
|
||||||
|
key-length = "ec-384"
|
||||||
|
|
||||||
[update]
|
[update]
|
||||||
|
|
||||||
### If enabled, load a plugin named `update` either from the Python module
|
### If enabled, load a plugin named `update` either from the Python module
|
||||||
|
|||||||
@@ -1348,11 +1348,11 @@ class WOSiteUpdateController(CementBaseController):
|
|||||||
if self.app.pargs.letsencrypt == "clean":
|
if self.app.pargs.letsencrypt == "clean":
|
||||||
if os.path.isfile("{0}/conf/nginx/ssl.conf"
|
if os.path.isfile("{0}/conf/nginx/ssl.conf"
|
||||||
.format(wo_site_webroot)):
|
.format(wo_site_webroot)):
|
||||||
WOFileUtils.remove("{0}/conf/nginx/ssl.conf"
|
WOFileUtils.remove(self, "{0}/conf/nginx/ssl.conf"
|
||||||
.format(wo_site_webroot))
|
.format(wo_site_webroot))
|
||||||
WOFileUtils.remove("/etc/letsencrypt/live"
|
WOFileUtils.remove(self, "/etc/letsencrypt/live"
|
||||||
"/{0}".format(wo_domain))
|
"/{0}".format(wo_domain))
|
||||||
WOFileUtils.remove("/etc/nginx/conf.d/"
|
WOFileUtils.remove(self, "/etc/nginx/conf.d/"
|
||||||
"force-ssl-{0}.conf"
|
"force-ssl-{0}.conf"
|
||||||
.format(wo_domain_name))
|
.format(wo_domain_name))
|
||||||
if not WOService.reload_service(self, 'nginx'):
|
if not WOService.reload_service(self, 'nginx'):
|
||||||
|
|||||||
@@ -1266,8 +1266,9 @@ def doCleanupAction(self, domain='', webroot='', dbname='', dbuser='',
|
|||||||
raise SiteError("dbhost not provided")
|
raise SiteError("dbhost not provided")
|
||||||
deleteDB(self, dbname, dbuser, dbhost)
|
deleteDB(self, dbname, dbuser, dbhost)
|
||||||
|
|
||||||
|
|
||||||
# setup letsencrypt for domain + www.domain
|
# setup letsencrypt for domain + www.domain
|
||||||
|
|
||||||
|
|
||||||
def setupLetsEncrypt(self, wo_domain_name, subdomain=False, wildcard=False,
|
def setupLetsEncrypt(self, wo_domain_name, subdomain=False, wildcard=False,
|
||||||
wo_dns=False, wo_acme_dns='dns_cf'):
|
wo_dns=False, wo_acme_dns='dns_cf'):
|
||||||
|
|
||||||
@@ -1279,54 +1280,42 @@ def setupLetsEncrypt(self, wo_domain_name, subdomain=False, wildcard=False,
|
|||||||
.format(wo_domain_name))
|
.format(wo_domain_name))
|
||||||
ssl = archivedCertificateHandle(self, wo_domain_name)
|
ssl = archivedCertificateHandle(self, wo_domain_name)
|
||||||
else:
|
else:
|
||||||
|
keylenght = "{0}".format(self.app.config.get('letsencrypt',
|
||||||
|
'keylength'))
|
||||||
|
if wo_dns:
|
||||||
|
acme_mode = "--dns {0}".format(wo_acme_dns)
|
||||||
|
else:
|
||||||
|
acme_mode = "-w /var/www/html"
|
||||||
Log.info(self, "Issuing SSL cert with acme.sh")
|
Log.info(self, "Issuing SSL cert with acme.sh")
|
||||||
if subdomain:
|
if subdomain:
|
||||||
if wo_dns:
|
ssl = WOShellExec.cmd_exec(self, "/etc/letsencrypt/acme.sh "
|
||||||
ssl = WOShellExec.cmd_exec(self, "/etc/letsencrypt/acme.sh "
|
"--config-home "
|
||||||
"--config-home "
|
"'/etc/letsencrypt/config' "
|
||||||
"'/etc/letsencrypt/config' "
|
"--issue "
|
||||||
"--issue "
|
"-d {0} {1}"
|
||||||
"-d {0} --dns {1} "
|
"-k {3} -f"
|
||||||
"-k ec-384 -f"
|
.format(wo_domain_name,
|
||||||
.format(wo_domain_name,
|
acme_mode,
|
||||||
wo_acme_dns))
|
keylenght))
|
||||||
else:
|
|
||||||
ssl = WOShellExec.cmd_exec(self, "/etc/letsencrypt/acme.sh "
|
|
||||||
"--config-home "
|
|
||||||
"'/etc/letsencrypt/config' "
|
|
||||||
"--issue "
|
|
||||||
"-d {0} -w /var/www/html "
|
|
||||||
"-k ec-384 -f"
|
|
||||||
.format(wo_domain_name))
|
|
||||||
elif wildcard:
|
elif wildcard:
|
||||||
if wo_dns:
|
ssl = WOShellExec.cmd_exec(self, "/etc/letsencrypt/acme.sh "
|
||||||
ssl = WOShellExec.cmd_exec(self, "/etc/letsencrypt/acme.sh "
|
"--config-home "
|
||||||
"--config-home "
|
"'/etc/letsencrypt/config' "
|
||||||
"'/etc/letsencrypt/config' "
|
"--issue "
|
||||||
"--issue "
|
"-d {0} -d *.{0} --dns {1} "
|
||||||
"-d {0} -d *.{0} --dns {1} "
|
"-k {2} -f"
|
||||||
"-k ec-384 -f"
|
.format(wo_domain_name,
|
||||||
.format(wo_domain_name,
|
wo_acme_dns,
|
||||||
wo_acme_dns))
|
keylenght))
|
||||||
else:
|
else:
|
||||||
if wo_dns:
|
ssl = WOShellExec.cmd_exec(self, "/etc/letsencrypt/acme.sh "
|
||||||
ssl = WOShellExec.cmd_exec(self, "/etc/letsencrypt/acme.sh "
|
"--config-home "
|
||||||
"--config-home "
|
"'/etc/letsencrypt/config' "
|
||||||
"'/etc/letsencrypt/config' "
|
"--issue "
|
||||||
"--issue "
|
"-d {0} -d www.{0} {1} "
|
||||||
"-d {0} -d www.{0} --dns {1} "
|
"-k {2} -f"
|
||||||
"-k ec-384 -f"
|
.format(wo_domain_name,
|
||||||
.format(wo_domain_name,
|
acme_mode, keylenght))
|
||||||
wo_acme_dns))
|
|
||||||
else:
|
|
||||||
ssl = WOShellExec.cmd_exec(self, "/etc/letsencrypt/acme.sh "
|
|
||||||
"--config-home "
|
|
||||||
"'/etc/letsencrypt/config' "
|
|
||||||
"--issue "
|
|
||||||
"-d {0} -d www.{0} "
|
|
||||||
"-w /var/www/html "
|
|
||||||
"-k ec-384 -f"
|
|
||||||
.format(wo_domain_name))
|
|
||||||
if ssl:
|
if ssl:
|
||||||
try:
|
try:
|
||||||
Log.info(self, "Deploying SSL cert with acme.sh")
|
Log.info(self, "Deploying SSL cert with acme.sh")
|
||||||
|
|||||||
@@ -237,7 +237,7 @@ class WOStackUpgradeController(CementBaseController):
|
|||||||
'-all-languages/config.inc.php'
|
'-all-languages/config.inc.php'
|
||||||
.format(WOVariables.wo_phpmyadmin)
|
.format(WOVariables.wo_phpmyadmin)
|
||||||
)
|
)
|
||||||
WOFileUtils.remove('{0}22222/htdocs/db/pma'
|
WOFileUtils.remove(self, '{0}22222/htdocs/db/pma'
|
||||||
.format(WOVariables.wo_webroot))
|
.format(WOVariables.wo_webroot))
|
||||||
shutil.move('/var/lib/wo/tmp/phpMyAdmin-{0}'
|
shutil.move('/var/lib/wo/tmp/phpMyAdmin-{0}'
|
||||||
'-all-languages/'
|
'-all-languages/'
|
||||||
|
|||||||
Reference in New Issue
Block a user