From e2f8951940ac5b8605bda2396a7a31baf6d83a21 Mon Sep 17 00:00:00 2001 From: VirtuBox Date: Wed, 22 May 2024 21:02:13 +0200 Subject: [PATCH 1/4] Set permissions when writing files, log less data --- install | 1 - wo/core/acme.py | 11 ++++------- wo/core/fileutils.py | 6 +++--- 3 files changed, 7 insertions(+), 11 deletions(-) diff --git a/install b/install index ec5eb49..06a3274 100755 --- a/install +++ b/install @@ -903,7 +903,6 @@ else echo wo_lib_echo "WordOps Documentation : https://docs.wordops.net" wo_lib_echo "WordOps Community Forum : https://community.wordops.net" - wo_lib_echo "WordOps Community Chat : https://chat.wordops.net" echo wo_lib_echo "Give WordOps a GitHub star : https://github.com/WordOps/WordOps/" echo diff --git a/wo/core/acme.py b/wo/core/acme.py index a49d2ba..0c0c11d 100644 --- a/wo/core/acme.py +++ b/wo/core/acme.py @@ -1,8 +1,6 @@ import csv import os -import requests - from wo.core.fileutils import WOFileUtils from wo.core.git import WOGit from wo.core.logging import Log @@ -55,10 +53,9 @@ class WOAcme: WOAcme.check_acme(self) acme_list = WOShellExec.cmd_exec_stdout( self, "{0} ".format(WOAcme.wo_acme_exec) + - "--list --listraw") + "--list --listraw", log=False) if acme_list: - WOFileUtils.textwrite(self, '/var/lib/wo/cert.csv', acme_list) - WOFileUtils.chmod(self, '/var/lib/wo/cert.csv', 0o600) + WOFileUtils.textwrite(self, '/var/lib/wo/cert.csv', acme_list, perm="0o600") else: Log.error(self, "Unable to export certs list") @@ -94,7 +91,7 @@ class WOAcme: if not WOShellExec.cmd_exec( self, "{0} ".format(WOAcme.wo_acme_exec) + "--issue -d '{0}' {1} -k {2} -f" - .format(all_domains, acme_mode, keylenght)): + .format(all_domains, acme_mode, keylenght), log=False): Log.failed(self, "Issuing SSL cert with acme.sh") if acmedata['dns'] is True: Log.error( @@ -174,7 +171,7 @@ class WOAcme: try: WOShellExec.cmd_exec( self, "{0} ".format(WOAcme.wo_acme_exec) + - "--renew -d {0} --ecc --force".format(domain)) + "--renew -d {0} --ecc --force".format(domain), log=False) except CommandExecutionError as e: Log.debug(self, str(e)) Log.error(self, 'Unable to renew certificate') diff --git a/wo/core/fileutils.py b/wo/core/fileutils.py index 92d45bf..c4c04aa 100644 --- a/wo/core/fileutils.py +++ b/wo/core/fileutils.py @@ -342,14 +342,14 @@ class WOFileUtils(): continue return True - def textwrite(self, path, content): + def textwrite(self, path, content, perm="0o644"): """ Write content into a file """ Log.debug(self, "Writing content in {0}".format(path)) try: - with open("{0}".format(path), - encoding='utf-8', mode='w') as final_file: + with os.fdopen(os.open(path, os.O_WRONLY | os.O_CREAT, perm), + 'w', encoding='utf-8') as final_file: final_file.write('{0}'.format(content)) except IOError as e: Log.debug(self, "{0}".format(e)) From def2ddd3936455c84716d4e115aa92b3668ac36c Mon Sep 17 00:00:00 2001 From: VirtuBox Date: Wed, 29 May 2024 02:00:50 +0200 Subject: [PATCH 2/4] Remove php72 and php73 --- tests/travis.sh | 56 ++++------------------ wo/cli/plugins/clean.py | 2 +- wo/cli/plugins/site_create.py | 11 ++--- wo/cli/plugins/site_functions.py | 80 +++----------------------------- wo/cli/plugins/site_update.py | 26 +++++------ wo/cli/plugins/stack.py | 8 ---- wo/cli/plugins/stack_upgrade.py | 4 -- wo/core/extract.py | 2 +- wo/core/variables.py | 20 ++------ 9 files changed, 39 insertions(+), 170 deletions(-) diff --git a/tests/travis.sh b/tests/travis.sh index 8c1eecc..ef4691d 100644 --- a/tests/travis.sh +++ b/tests/travis.sh @@ -32,7 +32,7 @@ echo -e "${CGREEN}#############################################${CEND}" echo -e ' stack install ' echo -e "${CGREEN}#############################################${CEND}" -stack_list='nginx php php73 php74 php80 php81 php82 php83 mysql redis fail2ban clamav proftpd netdata phpmyadmin composer dashboard extplorer redis phpredisadmin mysqltuner utils ufw cheat nanorc' +stack_list='nginx php php74 php80 php81 php82 php83 mysql redis fail2ban clamav proftpd netdata phpmyadmin composer dashboard extplorer redis phpredisadmin mysqltuner utils ufw cheat nanorc' for stack in $stack_list; do echo -ne " Installing $stack [..]\r" @@ -52,7 +52,7 @@ done echo -e "${CGREEN}#############################################${CEND}" echo -e ' Simple site create ' echo -e "${CGREEN}#############################################${CEND}" -site_types='html php php72 php73 php74 php80 php81 php82 php83 mysql wp wpfc wpsc wpredis wpce wprocket wpsubdomain wpsubdir ngxblocker' +site_types='html php php74 php80 php81 php82 php83 mysql wp wpfc wpsc wpredis wpce wprocket wpsubdomain wpsubdir ngxblocker' for site in $site_types; do echo -ne " Creating $site [..]\r" if { @@ -107,7 +107,7 @@ echo wo site info php.net echo echo -wo site info php72.net +wo site info php74.net echo echo wo site list @@ -116,7 +116,7 @@ echo echo -e "${CGREEN}#############################################${CEND}" echo -e ' wo site update --php74 ' echo -e "${CGREEN}#############################################${CEND}" -other_site_types='mysql php72 php73 php83 wp wpfc wpsc wpredis wpce wprocket wpsubdomain wpsubdir' +other_site_types='mysql php81 php82 php83 wp wpfc wpsc wpredis wpce wprocket wpsubdomain wpsubdir' for site in $other_site_types; do echo -ne " Updating site to $site php74 [..]\r" if { @@ -137,55 +137,17 @@ echo wo site info wp.net echo echo -e "${CGREEN}#############################################${CEND}" -echo -e ' wo site update --php73 ' -echo -e "${CGREEN}#############################################${CEND}" -other_site_types='html mysql wp php72 php73 wpfc wpsc wpredis wpce wprocket wpsubdomain wpsubdir' -for site in $other_site_types; do - echo -ne " Updating site to $site php73 [..]\r" - if { - wo site update ${site}.net --php73 - } >>/var/log/wo/test.log; then - echo -ne " Updating site to $site php73 [${CGREEN}OK${CEND}]\\r" - echo -ne '\n' - else - echo -e " Updating site to $site php73 [${CRED}FAIL${CEND}]" - echo -ne '\n' - exit_script - - fi -done -echo -echo -e "${CGREEN}#############################################${CEND}" echo wo site info wp.net echo echo -e "${CGREEN}#############################################${CEND}" -echo -e ' wo site update --php72 ' -echo -e "${CGREEN}#############################################${CEND}" -other_site_types='mysql php72 php73 wp wpfc wpsc wpredis wpce wprocket wpsubdomain wpsubdir' -for site in $other_site_types; do - echo -ne " Updating site to $site php72 [..]\r" - if { - wo site update ${site}.net --php72 - } >>/var/log/wo/test.log; then - echo -ne " Updating site to $site php72 [${CGREEN}OK${CEND}]\\r" - echo -ne '\n' - else - echo -e " Updating site to $site php72 [${CRED}FAIL${CEND}]" - echo -ne '\n' - exit_script - - fi -done -echo -echo -e "${CGREEN}#############################################${CEND}" echo wo site info wp.net echo echo -e "${CGREEN}#############################################${CEND}" echo -e ' wo site update --php80 ' echo -e "${CGREEN}#############################################${CEND}" -other_site_types='mysql php72 php73 wp wpfc wpsc wpredis wpce wprocket wpsubdomain wpsubdir' +other_site_types='mysql php81 php82 wp wpfc wpsc wpredis wpce wprocket wpsubdomain wpsubdir' for site in $other_site_types; do echo -ne " Updating site to $site php80 [..]\r" if { @@ -208,7 +170,7 @@ echo echo -e "${CGREEN}#############################################${CEND}" echo -e ' wo site update --php81 ' echo -e "${CGREEN}#############################################${CEND}" -other_site_types='mysql php72 php73 wp wpfc wpsc wpredis wpce wprocket wpsubdomain wpsubdir' +other_site_types='mysql php82 wp wpfc wpsc wpredis wpce wprocket wpsubdomain wpsubdir' for site in $other_site_types; do echo -ne " Updating site to $site php81 [..]\r" if { @@ -229,7 +191,7 @@ echo echo -e "${CGREEN}#############################################${CEND}" echo -e ' wo site update --php82 ' echo -e "${CGREEN}#############################################${CEND}" -other_site_types='mysql php72 php73 wp wpfc wpsc wpredis wpce wprocket wpsubdomain wpsubdir' +other_site_types='mysql wp wpfc wpsc wpredis wpce wprocket wpsubdomain wpsubdir' for site in $other_site_types; do echo -ne " Updating site to $site php82 [..]\r" if { @@ -313,7 +275,7 @@ if [ -z "$1" ]; then echo -e "${CGREEN}#############################################${CEND}" echo -e ' wo stack upgrade ' echo -e "${CGREEN}#############################################${CEND}" - stack_upgrade='nginx php php72 php73 php74 php80 php81 php82 mysql redis netdata dashboard phpmyadmin adminer fail2ban composer ngxblocker mysqltuner' + stack_upgrade='nginx php php74 php80 php81 php82 mysql redis netdata dashboard phpmyadmin adminer fail2ban composer ngxblocker mysqltuner' for stack in $stack_upgrade; do echo -ne " Upgrading $stack [..]\r" if { @@ -460,7 +422,7 @@ wo info echo -e "${CGREEN}#############################################${CEND}" echo -e ' wo stack purge ' echo -e "${CGREEN}#############################################${CEND}" -stack_purge='nginx php php73 php74 php80 php81 php82 php83 mysql redis fail2ban clamav proftpd netdata phpmyadmin composer dashboard extplorer adminer redis ufw ngxblocker cheat nanorc' +stack_purge='nginx php php74 php80 php81 php82 php83 mysql redis fail2ban clamav proftpd netdata phpmyadmin composer dashboard extplorer adminer redis ufw ngxblocker cheat nanorc' for stack in $stack_purge; do echo -ne " purging $stack [..]\r" if { diff --git a/wo/cli/plugins/clean.py b/wo/cli/plugins/clean.py index 1dbd763..a32d6ab 100644 --- a/wo/cli/plugins/clean.py +++ b/wo/cli/plugins/clean.py @@ -89,7 +89,7 @@ class WOCleanController(CementBaseController): Log.debug(self, "{0}".format(e)) Log.debug(self, "Unable hit url, " " http://127.0.0.1/cache/opcache/" - "php72.php," + "phpXX.php," " please check you have admin tools installed") Log.debug(self, "please check you have admin tools installed," " or install them with `wo stack install --admin`") diff --git a/wo/cli/plugins/site_create.py b/wo/cli/plugins/site_create.py index 6537134..06dd5bf 100644 --- a/wo/cli/plugins/site_create.py +++ b/wo/cli/plugins/site_create.py @@ -66,7 +66,7 @@ class WOSiteCreateController(CementBaseController): action='store', nargs='?')), (['--subsiteof'], dict(help="create a subsite of a multisite install", - action='store', nargs='?')), + action='store', nargs='?')), (['-le', '--letsencrypt'], dict(help="configure letsencrypt ssl for the site", action='store' or 'store_const', @@ -219,14 +219,13 @@ class WOSiteCreateController(CementBaseController): data["wpce"] = parent_site_info.cache_type == 'wpce' data["wpredis"] = parent_site_info.cache_type == 'wpredis' data["wpsubdir"] = parent_site_info.site_type == 'wpsubdir' - data["wo_php"] = ("php" + parent_site_info.php_version).replace(".", "") + data["wo_php"] = ("php" + parent_site_info.php_version).replace(".", "") data['subsite'] = True data['subsiteof_name'] = subsiteof_name data['subsiteof_webroot'] = parent_site_info.site_path - - if (pargs.php72 or pargs.php73 or pargs.php74 or - pargs.php80 or pargs.php81 or pargs.php82 or pargs.php83): + if (pargs.php74 or pargs.php80 or pargs.php81 or + pargs.php82 or pargs.php83): data = dict( site_name=wo_domain, www_domain=wo_www_domain, static=False, basic=False, @@ -296,7 +295,7 @@ class WOSiteCreateController(CementBaseController): (not pargs.wprocket) and (not pargs.wpce) and (not pargs.wpredis) and - (not pargs.subsiteof)): + (not pargs.subsiteof)): data['basic'] = True if (cache == 'wpredis'): diff --git a/wo/cli/plugins/site_functions.py b/wo/cli/plugins/site_functions.py index 13791a1..320964a 100644 --- a/wo/cli/plugins/site_functions.py +++ b/wo/cli/plugins/site_functions.py @@ -835,8 +835,8 @@ def site_package_check(self, stype): stack = WOStackController() stack.app = self.app pargs = self.app.pargs - if stype in ['html', 'proxy', 'php', 'php72', 'mysql', 'wp', 'wpsubdir', - 'wpsubdomain', 'php73', 'php74', 'php80', 'php81', 'php82', 'php83', 'alias', 'subsite']: + if stype in ['html', 'proxy', 'php', 'mysql', 'wp', 'wpsubdir', + 'wpsubdomain', 'php74', 'php80', 'php81', 'php82', 'php83', 'alias', 'subsite']: Log.debug(self, "Setting apt_packages variable for Nginx") # Check if server has nginx-custom package @@ -872,15 +872,15 @@ def site_package_check(self, stype): wo_nginx.write('fastcgi_param \tSCRIPT_FILENAME ' '\t$request_filename;\n') - php_versions = ['php72', 'php73', 'php74', 'php80', 'php81', 'php82', 'php83'] + php_versions = ['php74', 'php80', 'php81', 'php82', 'php83'] selected_versions = [version for version in php_versions if getattr(pargs, version)] if len(selected_versions) > 1: Log.error(self, "Error: two different PHP versions cannot be " "combined within the same WordOps site") - if ((not pargs.php72) and (not pargs.php73) and (not pargs.php74) and - (not pargs.php80) and (not pargs.php81) and (not pargs.php82) and + if ((not pargs.php74) and (not pargs.php80) and + (not pargs.php81) and (not pargs.php82) and (not pargs.php83) and stype in ['php', 'mysql', 'wp', 'wpsubdir', 'wpsubdomain']): @@ -1082,8 +1082,8 @@ def detSitePar(opts): cachelist = list() for key, val in opts.items(): if val and key in ['html', 'php', 'mysql', 'wp', - 'wpsubdir', 'wpsubdomain', 'php72', - 'php73', 'php74', 'php80', 'php81', 'php82', 'php83']: + 'wpsubdir', 'wpsubdomain', + 'php74', 'php80', 'php81', 'php82', 'php83']: typelist.append(key) elif val and key in ['wpfc', 'wpsc', 'wpredis', 'wprocket', 'wpce']: cachelist.append(key) @@ -1099,18 +1099,6 @@ def detSitePar(opts): cachetype = 'basic' else: cachetype = cachelist[0] - elif False not in [x in ('php72', 'mysql', 'html') for x in typelist]: - sitetype = 'mysql' - if not cachelist: - cachetype = 'basic' - else: - cachetype = cachelist[0] - elif False not in [x in ('php73', 'mysql', 'html') for x in typelist]: - sitetype = 'mysql' - if not cachelist: - cachetype = 'basic' - else: - cachetype = cachelist[0] elif False not in [x in ('php74', 'mysql', 'html') for x in typelist]: sitetype = 'mysql' if not cachelist: @@ -1147,18 +1135,6 @@ def detSitePar(opts): cachetype = 'basic' else: cachetype = cachelist[0] - elif False not in [x in ('php72', 'mysql') for x in typelist]: - sitetype = 'mysql' - if not cachelist: - cachetype = 'basic' - else: - cachetype = cachelist[0] - elif False not in [x in ('php73', 'mysql') for x in typelist]: - sitetype = 'mysql' - if not cachelist: - cachetype = 'basic' - else: - cachetype = cachelist[0] elif False not in [x in ('php74', 'mysql') for x in typelist]: sitetype = 'mysql' if not cachelist: @@ -1213,18 +1189,6 @@ def detSitePar(opts): cachetype = 'basic' else: cachetype = cachelist[0] - elif False not in [x in ('wp', 'php72') for x in typelist]: - sitetype = 'wp' - if not cachelist: - cachetype = 'basic' - else: - cachetype = cachelist[0] - elif False not in [x in ('wp', 'php73') for x in typelist]: - sitetype = 'wp' - if not cachelist: - cachetype = 'basic' - else: - cachetype = cachelist[0] elif False not in [x in ('wp', 'php74') for x in typelist]: sitetype = 'wp' if not cachelist: @@ -1255,18 +1219,6 @@ def detSitePar(opts): cachetype = 'basic' else: cachetype = cachelist[0] - elif False not in [x in ('wpsubdir', 'php72') for x in typelist]: - sitetype = 'wpsubdir' - if not cachelist: - cachetype = 'basic' - else: - cachetype = cachelist[0] - elif False not in [x in ('wpsubdir', 'php73') for x in typelist]: - sitetype = 'wpsubdir' - if not cachelist: - cachetype = 'basic' - else: - cachetype = cachelist[0] elif False not in [x in ('wpsubdir', 'php74') for x in typelist]: sitetype = 'wpsubdir' if not cachelist: @@ -1297,18 +1249,6 @@ def detSitePar(opts): cachetype = 'basic' else: cachetype = cachelist[0] - elif False not in [x in ('wpsubdomain', 'php72') for x in typelist]: - sitetype = 'wpsubdomain' - if not cachelist: - cachetype = 'basic' - else: - cachetype = cachelist[0] - elif False not in [x in ('wpsubdomain', 'php73') for x in typelist]: - sitetype = 'wpsubdomain' - if not cachelist: - cachetype = 'basic' - else: - cachetype = cachelist[0] elif False not in [x in ('wpsubdomain', 'php74') for x in typelist]: sitetype = 'wpsubdomain' if not cachelist: @@ -1345,12 +1285,6 @@ def detSitePar(opts): if not typelist and not cachelist: sitetype = None cachetype = None - elif (not typelist or "php72" in typelist) and cachelist: - sitetype = 'wp' - cachetype = cachelist[0] - elif (not typelist or "php73" in typelist) and cachelist: - sitetype = 'wp' - cachetype = cachelist[0] elif (not typelist or "php74" in typelist) and cachelist: sitetype = 'wp' cachetype = cachelist[0] diff --git a/wo/cli/plugins/site_update.py b/wo/cli/plugins/site_update.py index ba3d4e8..5cc6d71 100644 --- a/wo/cli/plugins/site_update.py +++ b/wo/cli/plugins/site_update.py @@ -196,8 +196,8 @@ class WOSiteUpdateController(CementBaseController): if ((pargs.password or pargs.hsts or pargs.ngxblocker or pargs.letsencrypt == 'renew') and not ( - pargs.html or pargs.php or pargs.php72 or pargs.php73 or - pargs.php74 or pargs.php80 or pargs.php81 or pargs.php82 or + pargs.html or pargs.php or pargs.php74 or pargs.php80 or + pargs.php81 or pargs.php82 or pargs.php83 or pargs.mysql or pargs.wp or pargs.wpfc or pargs.wpsc or pargs.wprocket or pargs.wpce or pargs.wpsubdir or pargs.wpsubdomain)): @@ -264,20 +264,18 @@ class WOSiteUpdateController(CementBaseController): return 0 if (((stype == 'php' and - oldsitetype not in ['html', 'proxy', 'php', 'php72', - 'php73', 'php74', 'php80', + oldsitetype not in ['html', 'proxy', 'php', 'php74', 'php80', 'php81', 'php82', 'php83']) or (stype == 'mysql' and oldsitetype not in [ - 'html', 'php', 'php72', 'php73', 'php74', 'php80', 'php81', + 'html', 'php', 'php74', 'php80', 'php81', 'php82', 'php83', 'proxy']) or (stype == 'wp' and oldsitetype not in [ - 'html', 'php', 'php72', 'php73', 'php74', 'php80', 'php81', + 'html', 'php', 'php74', 'php80', 'php81', 'php82', 'php83', 'mysql', 'proxy', 'wp']) or (stype == 'wpsubdir' and oldsitetype in ['wpsubdomain']) or (stype == 'wpsubdomain' and oldsitetype in ['wpsubdir']) or (stype == oldsitetype and cache == oldcachetype)) and - not (pargs.php72 or pargs.php73 or - pargs.php74 or pargs.php80 or + not (pargs.php74 or pargs.php80 or pargs.php81 or pargs.php82 or pargs.php83 or pargs.alias)): Log.info(self, Log.FAIL + "can not update {0} {1} to {2} {3}". @@ -336,8 +334,7 @@ class WOSiteUpdateController(CementBaseController): data = dict( site_name=wo_domain, www_domain=wo_www_domain, static=False, basic=True, wp=False, wpfc=False, - php72=False, php73=False, php74=False, - php80=False, php81=False, php82=False, php83=False, + php74=False, php80=False, php81=False, php82=False, php83=False, wpsc=False, wpredis=False, wprocket=False, wpce=False, multisite=False, wpsubdir=False, webroot=wo_site_webroot, currsitetype=oldsitetype, currcachetype=oldcachetype) @@ -361,11 +358,11 @@ class WOSiteUpdateController(CementBaseController): if stype == 'wpsubdir': data['wpsubdir'] = True - if ((pargs.php72 or pargs.php73 or pargs.php74 or - pargs.php80 or pargs.php81 or pargs.php82 or pargs.php83) and + if ((pargs.php74 or pargs.php80 or pargs.php81 or + pargs.php82 or pargs.php83) and (not data)): Log.debug( - self, "pargs php72, or php73, or php74, " + self, "pargs php74, " "or php80, or php81 or php82 or php83 enabled") data = dict( site_name=wo_domain, @@ -433,8 +430,7 @@ class WOSiteUpdateController(CementBaseController): self, f"PHP {version} is already enabled for given site") setattr(pargs, pargs_version, False) - if (data and (not pargs.php73) and - (not pargs.php74) and (not pargs.php72) and + if (data and (not pargs.php74) and (not pargs.php80) and (not pargs.php81) and (not pargs.php82) and (not pargs.php83)): data[pargs_version] = bool(old_version_var is True) diff --git a/wo/cli/plugins/stack.py b/wo/cli/plugins/stack.py index d9bd8e5..467f797 100644 --- a/wo/cli/plugins/stack.py +++ b/wo/cli/plugins/stack.py @@ -183,8 +183,6 @@ class WOStackController(CementBaseController): Log.debug(self, "Redis already installed") wo_vars = { - 'php72': WOVar.wo_php72, - 'php73': WOVar.wo_php73, 'php74': WOVar.wo_php74, 'php80': WOVar.wo_php80, 'php81': WOVar.wo_php81, @@ -594,8 +592,6 @@ class WOStackController(CementBaseController): # Create a dictionary that maps PHP versions to corresponding variables. wo_vars = { - 'php72': WOVar.wo_php72, - 'php73': WOVar.wo_php73, 'php74': WOVar.wo_php74, 'php80': WOVar.wo_php80, 'php81': WOVar.wo_php81, @@ -855,8 +851,6 @@ class WOStackController(CementBaseController): if pargs.all: pargs.web = True pargs.admin = True - pargs.php72 = True - pargs.php73 = True pargs.php74 = True pargs.php80 = True pargs.php81 = True @@ -898,8 +892,6 @@ class WOStackController(CementBaseController): Log.info(self, "Nginx is not installed") wo_vars = { - 'php72': WOVar.wo_php72, - 'php73': WOVar.wo_php73, 'php74': WOVar.wo_php74, 'php80': WOVar.wo_php80, 'php81': WOVar.wo_php81, diff --git a/wo/cli/plugins/stack_upgrade.py b/wo/cli/plugins/stack_upgrade.py index b4a8ed1..9ac7650 100644 --- a/wo/cli/plugins/stack_upgrade.py +++ b/wo/cli/plugins/stack_upgrade.py @@ -101,8 +101,6 @@ class WOStackUpgradeController(CementBaseController): if pargs.web: pargs.nginx = True - pargs.php72 = True - pargs.php73 = True pargs.php74 = True pargs.php80 = True pargs.php81 = True @@ -136,8 +134,6 @@ class WOStackUpgradeController(CementBaseController): Log.info(self, "Nginx Stable is not already installed") wo_vars = { - 'php72': WOVar.wo_php72, - 'php73': WOVar.wo_php73, 'php74': WOVar.wo_php74, 'php80': WOVar.wo_php80, 'php81': WOVar.wo_php81, diff --git a/wo/core/extract.py b/wo/core/extract.py index 2effab0..81c1a40 100644 --- a/wo/core/extract.py +++ b/wo/core/extract.py @@ -18,5 +18,5 @@ class WOExtract(): return True except tarfile.TarError as e: Log.debug(self, "{0}".format(e)) - Log.error(self, 'Unable to extract file \{0}'.format(file)) + Log.error(self, 'Unable to extract file {0}'.format(file)) return False diff --git a/wo/core/variables.py b/wo/core/variables.py index fe42423..3ee329a 100644 --- a/wo/core/variables.py +++ b/wo/core/variables.py @@ -124,23 +124,19 @@ class WOVar(): "/WordOps/xUbuntu_{0}/ /".format(wo_platform_version)) else: if wo_distro == 'debian': - if wo_platform_codename == 'jessie': - wo_deb_repo = "Debian_8.0" - elif wo_platform_codename == 'stretch': - wo_deb_repo = "Debian_9.0" - elif wo_platform_codename == 'buster': + if wo_platform_codename == 'buster': wo_deb_repo = "Debian_10" elif wo_platform_codename == 'bullseye': wo_deb_repo = "Debian_11" elif wo_platform_codename == 'bookworm': wo_deb_repo = "Debian_12" elif wo_distro == 'raspbian': - if wo_platform_codename == 'stretch': - wo_deb_repo = "Raspbian_9.0" - elif wo_platform_codename == 'buster': + if wo_platform_codename == 'buster': wo_deb_repo = "Raspbian_10" elif wo_platform_codename == 'bullseye': wo_deb_repo = "Raspbian_11" + elif wo_platform_codename == 'bookworm': + wo_deb_repo = "Raspbian_12" # debian/raspbian nginx repository wo_nginx_repo = ("deb http://download.opensuse.org" "/repositories/home:" @@ -151,8 +147,6 @@ class WOVar(): wo_nginx_key = 'FB898660' wo_php_versions = { - 'php72': '7.2', - 'php73': '7.3', 'php74': '7.4', 'php80': '8.0', 'php81': '8.1', @@ -167,16 +161,12 @@ class WOVar(): "xml", "zip"] php_modules = ["php{0}-{1}".format(version_number, module) for module in wo_module] - if version_prefix == 'php72' or version_prefix == 'php73': - php_modules.append("php{0}-recode".format(version_number)) - elif version_prefix == 'php74': + if version_prefix == 'php74': php_modules.extend(["php{0}-geoip".format(version_number), "php{0}-json".format(version_number)]) return php_modules - wo_php72 = generate_php_modules('php72', '7.2') - wo_php73 = generate_php_modules('php73', '7.3') wo_php74 = generate_php_modules('php74', '7.4') wo_php80 = generate_php_modules('php80', '8.0') wo_php81 = generate_php_modules('php81', '8.1') From 36aa70fb528566c5a782e709566e4d3863b31167 Mon Sep 17 00:00:00 2001 From: VirtuBox Date: Wed, 29 May 2024 02:07:08 +0200 Subject: [PATCH 3/4] Revert "Set permissions when writing files, log less data" This reverts commit e2f8951940ac5b8605bda2396a7a31baf6d83a21. --- install | 1 + wo/core/acme.py | 11 +++++++---- wo/core/fileutils.py | 6 +++--- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/install b/install index 06a3274..ec5eb49 100755 --- a/install +++ b/install @@ -903,6 +903,7 @@ else echo wo_lib_echo "WordOps Documentation : https://docs.wordops.net" wo_lib_echo "WordOps Community Forum : https://community.wordops.net" + wo_lib_echo "WordOps Community Chat : https://chat.wordops.net" echo wo_lib_echo "Give WordOps a GitHub star : https://github.com/WordOps/WordOps/" echo diff --git a/wo/core/acme.py b/wo/core/acme.py index 0c0c11d..a49d2ba 100644 --- a/wo/core/acme.py +++ b/wo/core/acme.py @@ -1,6 +1,8 @@ import csv import os +import requests + from wo.core.fileutils import WOFileUtils from wo.core.git import WOGit from wo.core.logging import Log @@ -53,9 +55,10 @@ class WOAcme: WOAcme.check_acme(self) acme_list = WOShellExec.cmd_exec_stdout( self, "{0} ".format(WOAcme.wo_acme_exec) + - "--list --listraw", log=False) + "--list --listraw") if acme_list: - WOFileUtils.textwrite(self, '/var/lib/wo/cert.csv', acme_list, perm="0o600") + WOFileUtils.textwrite(self, '/var/lib/wo/cert.csv', acme_list) + WOFileUtils.chmod(self, '/var/lib/wo/cert.csv', 0o600) else: Log.error(self, "Unable to export certs list") @@ -91,7 +94,7 @@ class WOAcme: if not WOShellExec.cmd_exec( self, "{0} ".format(WOAcme.wo_acme_exec) + "--issue -d '{0}' {1} -k {2} -f" - .format(all_domains, acme_mode, keylenght), log=False): + .format(all_domains, acme_mode, keylenght)): Log.failed(self, "Issuing SSL cert with acme.sh") if acmedata['dns'] is True: Log.error( @@ -171,7 +174,7 @@ class WOAcme: try: WOShellExec.cmd_exec( self, "{0} ".format(WOAcme.wo_acme_exec) + - "--renew -d {0} --ecc --force".format(domain), log=False) + "--renew -d {0} --ecc --force".format(domain)) except CommandExecutionError as e: Log.debug(self, str(e)) Log.error(self, 'Unable to renew certificate') diff --git a/wo/core/fileutils.py b/wo/core/fileutils.py index c4c04aa..92d45bf 100644 --- a/wo/core/fileutils.py +++ b/wo/core/fileutils.py @@ -342,14 +342,14 @@ class WOFileUtils(): continue return True - def textwrite(self, path, content, perm="0o644"): + def textwrite(self, path, content): """ Write content into a file """ Log.debug(self, "Writing content in {0}".format(path)) try: - with os.fdopen(os.open(path, os.O_WRONLY | os.O_CREAT, perm), - 'w', encoding='utf-8') as final_file: + with open("{0}".format(path), + encoding='utf-8', mode='w') as final_file: final_file.write('{0}'.format(content)) except IOError as e: Log.debug(self, "{0}".format(e)) From 4f7c52966ddb9ea511d5fbe7b4dc8edd8c731928 Mon Sep 17 00:00:00 2001 From: VirtuBox Date: Wed, 29 May 2024 02:09:17 +0200 Subject: [PATCH 4/4] Log less data --- install | 1 - wo/core/acme.py | 8 +++----- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/install b/install index ec5eb49..06a3274 100755 --- a/install +++ b/install @@ -903,7 +903,6 @@ else echo wo_lib_echo "WordOps Documentation : https://docs.wordops.net" wo_lib_echo "WordOps Community Forum : https://community.wordops.net" - wo_lib_echo "WordOps Community Chat : https://chat.wordops.net" echo wo_lib_echo "Give WordOps a GitHub star : https://github.com/WordOps/WordOps/" echo diff --git a/wo/core/acme.py b/wo/core/acme.py index a49d2ba..7440703 100644 --- a/wo/core/acme.py +++ b/wo/core/acme.py @@ -1,8 +1,6 @@ import csv import os -import requests - from wo.core.fileutils import WOFileUtils from wo.core.git import WOGit from wo.core.logging import Log @@ -55,7 +53,7 @@ class WOAcme: WOAcme.check_acme(self) acme_list = WOShellExec.cmd_exec_stdout( self, "{0} ".format(WOAcme.wo_acme_exec) + - "--list --listraw") + "--list --listraw", log=False) if acme_list: WOFileUtils.textwrite(self, '/var/lib/wo/cert.csv', acme_list) WOFileUtils.chmod(self, '/var/lib/wo/cert.csv', 0o600) @@ -94,7 +92,7 @@ class WOAcme: if not WOShellExec.cmd_exec( self, "{0} ".format(WOAcme.wo_acme_exec) + "--issue -d '{0}' {1} -k {2} -f" - .format(all_domains, acme_mode, keylenght)): + .format(all_domains, acme_mode, keylenght), log=False): Log.failed(self, "Issuing SSL cert with acme.sh") if acmedata['dns'] is True: Log.error( @@ -174,7 +172,7 @@ class WOAcme: try: WOShellExec.cmd_exec( self, "{0} ".format(WOAcme.wo_acme_exec) + - "--renew -d {0} --ecc --force".format(domain)) + "--renew -d {0} --ecc --force".format(domain), log=False) except CommandExecutionError as e: Log.debug(self, str(e)) Log.error(self, 'Unable to renew certificate')