Fix WOAcme

This commit is contained in:
VirtuBox
2019-10-01 17:29:29 +02:00
parent 40b1f48fc3
commit 7dba29da06

View File

@@ -10,7 +10,7 @@ from wo.core.shellexec import WOShellExec
from wo.core.variables import WOVariables from wo.core.variables import WOVariables
class WOAcme(): class WOAcme:
"""Acme.sh utilities for WordOps""" """Acme.sh utilities for WordOps"""
wo_acme_exec = ("/etc/letsencrypt/acme.sh --config-home " wo_acme_exec = ("/etc/letsencrypt/acme.sh --config-home "
@@ -19,7 +19,7 @@ class WOAcme():
def export_cert(self): def export_cert(self):
"""Export acme.sh csv certificate list""" """Export acme.sh csv certificate list"""
if not WOShellExec.cmd_exec( if not WOShellExec.cmd_exec(
self, "{0} ".format(self.wo_acme_exec) + self, "{0} ".format(WOAcme.wo_acme_exec) +
"--list --listraw > /var/lib/wo/cert.csv"): "--list --listraw > /var/lib/wo/cert.csv"):
Log.error(self, "Unable to export certs list") Log.error(self, "Unable to export certs list")
@@ -42,7 +42,7 @@ class WOAcme():
Log.info(self, "Validation mode : {0}".format(validation_mode)) Log.info(self, "Validation mode : {0}".format(validation_mode))
Log.wait(self, "Issuing SSL cert with acme.sh") Log.wait(self, "Issuing SSL cert with acme.sh")
if not WOShellExec.cmd_exec( if not WOShellExec.cmd_exec(
self, "{0} ".format(self.wo_acme_exec) + self, "{0} ".format(WOAcme.wo_acme_exec) +
"--issue -d '{0}' {1} -k {2} -f" "--issue -d '{0}' {1} -k {2} -f"
.format(all_domains, acme_mode, keylenght)): .format(all_domains, acme_mode, keylenght)):
Log.failed(self, "Issuing SSL cert with acme.sh") Log.failed(self, "Issuing SSL cert with acme.sh")
@@ -78,7 +78,7 @@ class WOAcme():
"--ca-file {0}/{1}/ca.pem --reloadcmd \"nginx -t && " "--ca-file {0}/{1}/ca.pem --reloadcmd \"nginx -t && "
"service nginx restart\" " "service nginx restart\" "
.format(WOVariables.wo_ssl_live, .format(WOVariables.wo_ssl_live,
wo_domain_name, self.wo_acme_exec)): wo_domain_name, WOAcme.wo_acme_exec)):
Log.valide(self, "Deploying SSL cert") Log.valide(self, "Deploying SSL cert")
else: else:
Log.failed(self, "Deploying SSL cert") Log.failed(self, "Deploying SSL cert")
@@ -141,7 +141,7 @@ class WOAcme():
def cert_check(self, wo_domain_name): def cert_check(self, wo_domain_name):
"""Check certificate existance with acme.sh and return Boolean""" """Check certificate existance with acme.sh and return Boolean"""
self.export_cert() WOAcme.export_cert(self)
# define new csv dialect # define new csv dialect
csv.register_dialect('acmeconf', delimiter='|') csv.register_dialect('acmeconf', delimiter='|')
# open file # open file