From 179ea7d9cf8618454001100aefa43b9303e4967f Mon Sep 17 00:00:00 2001 From: VirtuBox Date: Sat, 26 Oct 2019 19:28:56 +0200 Subject: [PATCH] Improve acme process and error log --- CHANGELOG.md | 1 + install | 4 ++-- wo/cli/plugins/stack_upgrade.py | 8 +++++--- wo/core/acme.py | 18 +++++++++--------- 4 files changed, 17 insertions(+), 14 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f00707f..2c5200e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -22,6 +22,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), - Initial creation of .gitconfig is displayed the first time you run the command `wo` - Added `/var/lib/php/sessions/` to open_basedir to allow php sessions storage - WordOps now check if a repository already exist before trying to adding it again. +- Improved SSL certificate error messages by displaying domain IP and server IP #### Fixed diff --git a/install b/install index 7e09b22..f1a55f1 100755 --- a/install +++ b/install @@ -136,8 +136,8 @@ if [ -z "$wo_branch" ]; then wo_branch=master fi fi -readonly wo_log_dir=/var/log/wo/ -readonly wo_backup_dir=/var/lib/wo-backup/ +readonly wo_log_dir=/var/log/wo +readonly wo_backup_dir=/var/lib/wo-backup readonly wo_tmp_dir=/var/lib/wo/tmp readonly wo_install_log=/var/log/wo/install.log readonly TIME_FORMAT='%d-%b-%Y-%H%M%S' diff --git a/wo/cli/plugins/stack_upgrade.py b/wo/cli/plugins/stack_upgrade.py index e8cc4bf..7b1178d 100644 --- a/wo/cli/plugins/stack_upgrade.py +++ b/wo/cli/plugins/stack_upgrade.py @@ -199,12 +199,12 @@ class WOStackUpgradeController(CementBaseController): Log.wait(self, "Upgrading APT Packages") # additional pre_pref - if ["nginx-custom"] in apt_packages: + if "nginx-custom" in apt_packages: pre_pref(self, WOVar.wo_nginx) - if ["php7.2-fpm"] in apt_packages: + if "php7.2-fpm" in apt_packages: WOAptGet.remove(self, ['php7.2-fpm'], auto=False, purge=True) - if ["php7.3-fpm"] in apt_packages: + if "php7.3-fpm" in apt_packages: WOAptGet.remove(self, ['php7.3-fpm'], auto=False, purge=True) # check if nginx upgrade is blocked @@ -216,6 +216,8 @@ class WOStackUpgradeController(CementBaseController): Log.valide(self, "Upgrading APT Packages") Log.wait(self, "Configuring APT Packages") post_pref(self, apt_packages, [], True) + if "mariadb-server" in apt_packages: + WOShellExec(self, 'mysql_upgrade') Log.valide(self, "Configuring APT Packages") # Post Actions after package updates diff --git a/wo/core/acme.py b/wo/core/acme.py index 9ae31ce..444041e 100644 --- a/wo/core/acme.py +++ b/wo/core/acme.py @@ -72,6 +72,7 @@ class WOAcme: return True def deploycert(self, wo_domain_name): + """Deploy Let's Encrypt certificates with acme.sh""" if not os.path.isfile('/etc/letsencrypt/renewal/{0}_ecc/fullchain.cer' .format(wo_domain_name)): Log.error(self, 'Certificate not found. Deployment canceled') @@ -139,11 +140,13 @@ class WOAcme: .format(domain)).text if(not domain_ip == server_ip): Log.warn( - self, "{0} is not pointing to your server IP" - .format(domain)) + self, "{0}".format(domain) + + " point to the IP {0}".format(domain_ip) + + " but your server IP is {0}.".format(server_ip) + + "\nUse the flag --force to bypass this check.") Log.error( - self, "You have to add the " - "proper DNS record", False) + self, "You have to set the " + "proper DNS record for your domain", False) return False else: Log.debug(self, "DNS record are properly set") @@ -162,9 +165,6 @@ class WOAcme: if wo_domain_name in row[0]: # check if cert expiration exist if not row[3] == '': - cert_exist = True - break - else: - cert_exist = False + return True certfile.close() - return cert_exist + return False