From e6a4611ee6d414e65334b12d6eeddb6d76669d1e Mon Sep 17 00:00:00 2001 From: VirtuBox Date: Sat, 27 Jul 2019 21:53:52 +0200 Subject: [PATCH] Fix site url change to https --- CHANGELOG.md | 5 ++++- docs/wo.8 | 21 ++++++++++++--------- wo/cli/plugins/site.py | 5 +++-- wo/cli/plugins/site_functions.py | 14 ++++++++------ wo/core/variables.py | 5 +++-- 5 files changed, 30 insertions(+), 20 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index bb0cb30..0132c93 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,13 +12,16 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), - MySQL configuration tuning - Cronjob to optimize MySQL databases weekly -- wo-kernel systemd service to apply kernel tweaks on server startup +- WO-kernel systemd service to automatically apply kernel tweaks on server startup #### Changed - `wo maintenance` refactored - Improved debug log - Updated Nginx configuration process to not overwrite files with custom data (htpasswd-wo, acl.conf etc..) +- Adminer updated to v4.7.2 +- eXtplorer updated to v2.1.13 +- Removed WordOps version from the Nginx header X-Powered-By to avoid possible security issues #### Fixed diff --git a/docs/wo.8 b/docs/wo.8 index 6ad30fa..47b17f6 100644 --- a/docs/wo.8 +++ b/docs/wo.8 @@ -1,19 +1,19 @@ -.TH wo 8 "WordOps (wo) version: 3.3.8" "Sep 10,2015" "WordOps" +.TH wo 8 "WordOps (wo) version: 3.9.6.3" "Jul 26,2019" "WordOps" .SH NAME .B WordOps (wo) \- Manage Nginx Based Websites. .SH SYNOPSIS wo [ --version | --help | info | stack | site | debug | update | clean | import_slow_log | log | secure | sync | maintenance ] .TP -wo stack [ install | remove | purge | migrate | upgrade] [ --web | --all | --nginx | --php | --php73 | --mysql | --admin | --adminer | --redis | --phpmyadmin | --phpredisadmin | --wpcli | --utils | --dashboard | --netdata ] +wo stack [ install | remove | purge | migrate | upgrade] [ --web | --all | --nginx | --php | --php73 | --mysql | --admin | --adminer | --redis | --phpmyadmin | --phpredisadmin | --wpcli | --utils | --dashboard | --netdata | --fail2ban | --proftpd ] .TP -wo stack [ status | start | stop | reload | restart ] [--all | --nginx | --php | --php73 |--mysql | --web | --redis] +wo stack [ status | start | stop | reload | restart ] [--all | --nginx | --php | --php73 |--mysql | --web | --redis | --netdata | --fail2ban | --proftpd] .TP wo site [ list | info | show | enable | disable | edit | cd | show ] [ example.com ] .TP -wo site create example.com [ --html | --php | --php73 | --mysql] [[--wp | --wpsubdir | --wpsubdomain ] [--wpsc | --wpfc | --wpredis | --letsencrypt/-le/--letsencrypt=subdomain/wildcard][--dns=dns_cf/dns_do]] +wo site create example.com [ --html | --php | --php73 | --mysql] [[--wp | --wpsubdir | --wpsubdomain ] [--wpsc | --wpfc | --wpredis | --letsencrypt/-le/--letsencrypt=subdomain/wildcard][--dns/--dns=dns_cf/dns_do]] .TP -wo site update example.com [ --php | --php73 |--mysql] [[--wp | --wpsubdir | --wpsubdomain ] [--wpsc | --wpfc | --wpredis ] [--password] [-le/--letsencrypt=on/off/subdomain/renew/wildcard] [--dns=dns_cf/dns_do]] +wo site update example.com [ --php | --php73 |--mysql] [[--wp | --wpsubdir | --wpsubdomain ] [--wpsc | --wpfc | --wpredis ] [--password] [-le/--letsencrypt/--letsencrypt=on/off/subdomain/renew/wildcard/clean/purge] [--dns/--dns=dns_cf/dns_do]] .TP wo site delete example.com [--db | --files | --all | --no-prompt | --force/-f ] .TP @@ -46,19 +46,19 @@ Display WordOps (wo) help. .TP .B stack .TP -.B install [ --all | --web | --nginx | --php | --php73 |--mysql | --redis | --adminer | --phpmyadmin | --phpredismyadmin | --wpcli | --utils | --netdata | --dashboard ] +.B install [ --all | --web | --nginx | --php | --php73 |--mysql | --redis | --adminer | --phpmyadmin | --phpredismyadmin | --wpcli | --utils | --netdata | --dashboard | --fail2ban | --proftpd ] .br Install Nginx PHP5 MySQL Postfix stack Packages if not used with .br any options.Installs specific package if used with option. .TP -.B remove [ --all | --web | --nginx | --php | --php73 |--mysql | --redis | --adminer | --phpmyadmin | --phpredismyadmin | --wpcli | --utils | --netdata | --dashboard ] +.B remove [ --all | --web | --nginx | --php | --php73 |--mysql | --redis | --adminer | --phpmyadmin | --phpredismyadmin | --wpcli | --utils | --netdata | --dashboard | --fail2ban | --proftpd ] .br Remove Nginx PHP5 MySQL Postfix stack Packages if not used with .br any options. Remove specific package if used with option. .TP -.B purge [ --all | --web | --nginx | --php | --php73 |--mysql | --redis | --adminer | --phpmyadmin | --phpredismyadmin | --wpcli | --utils | --netdata | --dashboard ] +.B purge [ --all | --web | --nginx | --php | --php73 |--mysql | --redis | --adminer | --phpmyadmin | --phpredismyadmin | --wpcli | --utils | --netdata | --dashboard | --fail2ban | --proftpd ] .br Purge Nginx PHP5 MySQL Postfix stack Packages if not used with any .br @@ -165,7 +165,7 @@ Update security settings. .TP .B clean [ --fastcgi | --opcache | --redis | --all ] .br -Clean NGINX fastCGI cache, Opcache, memcached, Redis cache. +Clean NGINX fastCGI cache, Opcache, Redis cache. .br Clean NGINX fastCGI cache if no option specified. .SH ARGUMENTS @@ -312,3 +312,6 @@ Report bugs at .B Rajdeep Sharma .I \ .br +.B Thomas SUCHON +.I \ +.br diff --git a/wo/cli/plugins/site.py b/wo/cli/plugins/site.py index 2e57359..26a0111 100644 --- a/wo/cli/plugins/site.py +++ b/wo/cli/plugins/site.py @@ -760,7 +760,6 @@ class WOSiteCreateController(CementBaseController): if self.app.pargs.hsts: setupHsts(self, wo_domain) - if not WOService.reload_service(self, 'nginx'): Log.error(self, "service nginx reload failed. " "check issues with `nginx -t` command") @@ -1320,7 +1319,6 @@ class WOSiteUpdateController(CementBaseController): if not WOService.reload_service(self, 'nginx'): Log.error(self, "service nginx reload failed. " "check issues with `nginx -t` command") - site_url_https(self, wo_domain, wo_site_webroot) Log.info(self, "Congratulations! Successfully " "Configured SSl for Site " " https://{0}".format(wo_domain)) @@ -1333,6 +1331,9 @@ class WOSiteUpdateController(CementBaseController): Log.warn( self, "Your cert already EXPIRED ! " ".PLEASE renew soon . ") + # change site url to https + if data['wp'] is True: + site_url_https(self, data) elif data['letsencrypt'] is False: if self.app.pargs.letsencrypt == "off": diff --git a/wo/cli/plugins/site_functions.py b/wo/cli/plugins/site_functions.py index 0d3cf5c..e093382 100644 --- a/wo/cli/plugins/site_functions.py +++ b/wo/cli/plugins/site_functions.py @@ -676,26 +676,28 @@ def installwp_plugin(self, plugin_name, data): return 1 -def site_url_https(self, site_webroot='', wo_domain=''): +def site_url_https(self, data): + wo_site_webroot = data['webroot'] + wo_domain_name = data['site_name'] Log.info(self, "Checking if site url already use https, please wait...") - WOFileUtils.chdir(self, '{0}/htdocs/'.format(site_webroot)) + WOFileUtils.chdir(self, '{0}/htdocs/'.format(wo_site_webroot)) test_site_url = WOShellExec.cmd_exec(self, "php {0} option get siteurl " .format(WOVariables.wo_wpcli_path) + - "--allow-root --quiet").split(":") + "--allow-root --quiet").split("://") if not test_site_url[0] == "https": try: WOShellExec.cmd_exec(self, "php {0} option update siteurl " "\"https://{1}\" --allow-root".format( - WOVariables.wo_wpcli_path, wo_domain)) + WOVariables.wo_wpcli_path, wo_domain_name)) WOShellExec.cmd_exec(self, "php {0} option update home " "\"https://{1}\" --allow-root".format( - WOVariables.wo_wpcli_path, wo_domain)) + WOVariables.wo_wpcli_path, wo_domain_name)) except CommandExecutionError as e: Log.debug(self, "{0}".format(e)) raise SiteError("plugin activation failed") Log.info( self, "Site address updated " - "successfully to https://{0}".format(wo_domain)) + "successfully to https://{0}".format(wo_domain_name)) else: Log.info( self, "Site address was already using https") diff --git a/wo/core/variables.py b/wo/core/variables.py index 6d027ef..55b0bfb 100644 --- a/wo/core/variables.py +++ b/wo/core/variables.py @@ -10,11 +10,12 @@ class WOVariables(): """Intialization of core variables""" # WordOps version - wo_version = "3.9.6.2" + wo_version = "3.9.6.3" # WordOps packages versions wo_wp_cli = "2.2.0" - wo_adminer = "4.7.1" + wo_adminer = "4.7.2" wo_phpmyadmin = "4.9.0.1" + wo_extplorer = "2.1.13" # Get WPCLI path wo_wpcli_path = '/usr/local/bin/wp'