From 35a0e4f1e8024f446fdf70f1f438b56dfe51b0de Mon Sep 17 00:00:00 2001 From: VirtuBox Date: Thu, 28 Apr 2022 12:10:33 +0200 Subject: [PATCH 01/15] Fix git safe directory --- wo/core/git.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/wo/core/git.py b/wo/core/git.py index 29ab1fc..83dc949 100644 --- a/wo/core/git.py +++ b/wo/core/git.py @@ -19,6 +19,8 @@ class WOGit: for path in paths: global git wogit = git.bake("-C", "{0}".format(path)) + wogitsafe = git.bake("--global --add safe.directory", + "{0}".format(path)) if os.path.isdir(path): if not os.path.isdir(path + "/.git"): try: @@ -29,6 +31,7 @@ class WOGit: Log.debug(self, "{0}".format(e)) Log.error(self, "Unable to git init at {0}" .format(path)) + wogitsafe status = wogit.status("-s") if len(status.splitlines()) > 0: try: From 4ac4383d69092cd2733c87154506a8f63becc48b Mon Sep 17 00:00:00 2001 From: VirtuBox Date: Thu, 28 Apr 2022 12:13:59 +0200 Subject: [PATCH 02/15] Fix github git protocol for dev install --- install | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/install b/install index 911f8f5..69769b9 100755 --- a/install +++ b/install @@ -471,7 +471,7 @@ wo_install() { if [ "$wo_branch" = "master" ]; then python3 -m pip install -U wordops else - python3 -m pip install -I "git+git://github.com/WordOps/WordOps.git@$wo_branch#egg=wordops" + python3 -m pip install -I "git+https://github.com/WordOps/WordOps.git@$wo_branch#egg=wordops" fi local python_venv python_venv=$(python3 -c "import sys; print(sys.version_info[1])") @@ -528,7 +528,7 @@ wo_travis_install() { fi python3 -m pip install -U . else - python3 -m pip install -U "git+git://github.com/WordOps/WordOps.git@$wo_branch#egg=wordops" + python3 -m pip install -U "git+https://github.com/WordOps/WordOps.git@$wo_branch#egg=wordops" fi cp -rf /opt/wo/lib/python3."$python_ver"/site-packages/usr/* /usr/ cp -rn /opt/wo/lib/python3."$python_ver"/site-packages/etc/* /etc/ From f85342f72c58e7d2ed53588bb7947304333f023f Mon Sep 17 00:00:00 2001 From: VirtuBox Date: Thu, 28 Apr 2022 12:17:28 +0200 Subject: [PATCH 03/15] Bump version --- install | 2 +- setup.py | 2 +- wo/core/variables.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/install b/install index 69769b9..c80b99f 100755 --- a/install +++ b/install @@ -9,7 +9,7 @@ # ------------------------------------------------------------------------- # wget -qO wo wops.cc && sudo -E bash wo # ------------------------------------------------------------------------- -# Version 3.14.1 - 2022-02-16 +# Version 3.14.2 - 2022-04-28 # ------------------------------------------------------------------------- # CONTENTS diff --git a/setup.py b/setup.py index e56455e..5b8c0ad 100644 --- a/setup.py +++ b/setup.py @@ -27,7 +27,7 @@ if os.geteuid() == 0: os.makedirs('/var/lib/wo/tmp/') setup(name='wordops', - version='3.14.1', + version='3.14.2', description='An essential toolset that eases server administration', long_description=LONG, long_description_content_type='text/markdown', diff --git a/wo/core/variables.py b/wo/core/variables.py index 44d3902..8066caa 100644 --- a/wo/core/variables.py +++ b/wo/core/variables.py @@ -14,7 +14,7 @@ class WOVar(): """Intialization of core variables""" # WordOps version - wo_version = "3.14.1" + wo_version = "3.14.2" # WordOps packages versions wo_wp_cli = "2.6.0" wo_adminer = "4.8.1" From 79be8890fddf648b523f083a0aa6ad9c934d4f2a Mon Sep 17 00:00:00 2001 From: VirtuBox Date: Thu, 28 Apr 2022 12:40:58 +0200 Subject: [PATCH 04/15] Fix git safe directory --- wo/core/git.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wo/core/git.py b/wo/core/git.py index 83dc949..5d1e9c9 100644 --- a/wo/core/git.py +++ b/wo/core/git.py @@ -31,7 +31,7 @@ class WOGit: Log.debug(self, "{0}".format(e)) Log.error(self, "Unable to git init at {0}" .format(path)) - wogitsafe + wogitsafe.config() status = wogit.status("-s") if len(status.splitlines()) > 0: try: From 60baef55db564862792527149086f72bfe5b85d6 Mon Sep 17 00:00:00 2001 From: VirtuBox Date: Thu, 28 Apr 2022 12:45:26 +0200 Subject: [PATCH 05/15] Another fix for git safe directory --- wo/core/git.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/wo/core/git.py b/wo/core/git.py index 5d1e9c9..cb3a8ca 100644 --- a/wo/core/git.py +++ b/wo/core/git.py @@ -19,8 +19,6 @@ class WOGit: for path in paths: global git wogit = git.bake("-C", "{0}".format(path)) - wogitsafe = git.bake("--global --add safe.directory", - "{0}".format(path)) if os.path.isdir(path): if not os.path.isdir(path + "/.git"): try: @@ -31,7 +29,7 @@ class WOGit: Log.debug(self, "{0}".format(e)) Log.error(self, "Unable to git init at {0}" .format(path)) - wogitsafe.config() + git.config("--global --add safe.directory", "{0}".format(path)) status = wogit.status("-s") if len(status.splitlines()) > 0: try: From 4cac21edf1b70114e7747afa63feaa1732080879 Mon Sep 17 00:00:00 2001 From: VirtuBox Date: Thu, 28 Apr 2022 12:50:41 +0200 Subject: [PATCH 06/15] Last fix for git safe directory --- wo/core/git.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/wo/core/git.py b/wo/core/git.py index cb3a8ca..674b766 100644 --- a/wo/core/git.py +++ b/wo/core/git.py @@ -29,7 +29,8 @@ class WOGit: Log.debug(self, "{0}".format(e)) Log.error(self, "Unable to git init at {0}" .format(path)) - git.config("--global --add safe.directory", "{0}".format(path)) + git.config("--global", "--add", "safe.directory", + "{0}".format(path)) status = wogit.status("-s") if len(status.splitlines()) > 0: try: From 01fb0e5aff57cc59249cebc0c12eea8d9fc008ec Mon Sep 17 00:00:00 2001 From: VirtuBox Date: Thu, 28 Apr 2022 13:05:48 +0200 Subject: [PATCH 07/15] Final fix for git safe directory --- wo/core/git.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/wo/core/git.py b/wo/core/git.py index 674b766..4ba5e3e 100644 --- a/wo/core/git.py +++ b/wo/core/git.py @@ -3,6 +3,7 @@ import os from sh import ErrorReturnCode, git from wo.core.logging import Log +from wo.core.fileutils import WOFileUtils class WOGit: @@ -29,8 +30,10 @@ class WOGit: Log.debug(self, "{0}".format(e)) Log.error(self, "Unable to git init at {0}" .format(path)) - git.config("--global", "--add", "safe.directory", - "{0}".format(path)) + if not WOFileUtils.grep("/root/.gitconfig", + "{0}".format(path)): + git.config("--global", "--add", "safe.directory", + "{0}".format(path)) status = wogit.status("-s") if len(status.splitlines()) > 0: try: From db5b51067091a7c9698c87e72f0d43c48e91b710 Mon Sep 17 00:00:00 2001 From: VirtuBox Date: Thu, 28 Apr 2022 13:10:57 +0200 Subject: [PATCH 08/15] Fix typo --- wo/core/git.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wo/core/git.py b/wo/core/git.py index 4ba5e3e..b95155e 100644 --- a/wo/core/git.py +++ b/wo/core/git.py @@ -30,7 +30,7 @@ class WOGit: Log.debug(self, "{0}".format(e)) Log.error(self, "Unable to git init at {0}" .format(path)) - if not WOFileUtils.grep("/root/.gitconfig", + if not WOFileUtils.grep(self, "/root/.gitconfig", "{0}".format(path)): git.config("--global", "--add", "safe.directory", "{0}".format(path)) From 7c55efc4375c27396aae520edb9e012d913b8907 Mon Sep 17 00:00:00 2001 From: VirtuBox Date: Thu, 28 Apr 2022 13:16:56 +0200 Subject: [PATCH 09/15] Fix path --- wo/core/git.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wo/core/git.py b/wo/core/git.py index b95155e..7af8185 100644 --- a/wo/core/git.py +++ b/wo/core/git.py @@ -30,7 +30,7 @@ class WOGit: Log.debug(self, "{0}".format(e)) Log.error(self, "Unable to git init at {0}" .format(path)) - if not WOFileUtils.grep(self, "/root/.gitconfig", + if not WOFileUtils.grep(self, "$HOME/.gitconfig", "{0}".format(path)): git.config("--global", "--add", "safe.directory", "{0}".format(path)) From 7f7002e60d51c575fd9f6aae2628f53acaaec6a4 Mon Sep 17 00:00:00 2001 From: VirtuBox Date: Thu, 28 Apr 2022 13:25:29 +0200 Subject: [PATCH 10/15] Another fix for gitconfig path --- wo/core/git.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wo/core/git.py b/wo/core/git.py index 7af8185..e8096e1 100644 --- a/wo/core/git.py +++ b/wo/core/git.py @@ -30,7 +30,7 @@ class WOGit: Log.debug(self, "{0}".format(e)) Log.error(self, "Unable to git init at {0}" .format(path)) - if not WOFileUtils.grep(self, "$HOME/.gitconfig", + if not WOFileUtils.grep(self, "~/.gitconfig", "{0}".format(path)): git.config("--global", "--add", "safe.directory", "{0}".format(path)) From 5986ece6d2f59d3b6c57ea5662ac88b6cc4f7e8d Mon Sep 17 00:00:00 2001 From: VirtuBox Date: Thu, 28 Apr 2022 13:37:01 +0200 Subject: [PATCH 11/15] Fix .gitconfig path --- wo/core/git.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/wo/core/git.py b/wo/core/git.py index e8096e1..02fa004 100644 --- a/wo/core/git.py +++ b/wo/core/git.py @@ -1,5 +1,6 @@ """WordOps GIT module""" import os +from pathlib import Path from sh import ErrorReturnCode, git from wo.core.logging import Log @@ -30,7 +31,8 @@ class WOGit: Log.debug(self, "{0}".format(e)) Log.error(self, "Unable to git init at {0}" .format(path)) - if not WOFileUtils.grep(self, "~/.gitconfig", + if not WOFileUtils.grep(self, + "{0}/.gitconfig".format(Path.home()), "{0}".format(path)): git.config("--global", "--add", "safe.directory", "{0}".format(path)) From 07abbcaad5b980c318d793cce6179b200f8b599f Mon Sep 17 00:00:00 2001 From: VirtuBox Date: Thu, 28 Apr 2022 13:49:56 +0200 Subject: [PATCH 12/15] Fix WP_DEBUG doublon --- wo/cli/plugins/site_functions.py | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/wo/cli/plugins/site_functions.py b/wo/cli/plugins/site_functions.py index f3c6b24..b43e707 100644 --- a/wo/cli/plugins/site_functions.py +++ b/wo/cli/plugins/site_functions.py @@ -327,10 +327,7 @@ def setupwordpress(self, data, vhostonly=False): data['wo_db_host'] ) + "--dbpass=\'{0}\' " - "--extra-php< Date: Thu, 28 Apr 2022 15:07:12 +0200 Subject: [PATCH 13/15] Fix git secure path --- install | 18 +++++++++++++----- wo/core/git.py | 8 +------- 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/install b/install index c80b99f..6f257b7 100755 --- a/install +++ b/install @@ -207,11 +207,12 @@ wo_install_dep() { wo_linux_distro=$(lsb_release -is) if [ "$wo_linux_distro" == "Ubuntu" ]; then # install dependencies + add-apt-repository ppa:git-core/ppa -y apt-get --option=Dpkg::options::=--force-confmiss --option=Dpkg::options::=--force-confold --assume-yes install \ build-essential curl gzip python3-pip python3-apt python3-venv gcc python3-dev sqlite3 git tar software-properties-common pigz \ gnupg2 cron ccze rsync apt-transport-https tree haveged ufw unattended-upgrades tzdata ntp zstd idn \ python3-distutils-extra libapt-pkg-dev bash-completion >/dev/null 2>&1 - curl -sL https://build.opensuse.org/projects/home:virtubox/public_key | apt-key add - + curl -sL https://build.opensuse.org/projects/home:virtubox/public_key | apt-key add - else # install dependencies apt-get --option=Dpkg::options::=--force-confmiss --option=Dpkg::options::=--force-confold --assume-yes install \ @@ -221,7 +222,7 @@ wo_install_dep() { # add php repository gpg key [ -d /etc/apt/trusted.gpg.d ] && { wget -qO /etc/apt/trusted.gpg.d/php.gpg https://packages.sury.org/php/apt.gpg; } # add nginx repository gpg key - curl -sL https://build.opensuse.org/projects/home:virtubox/public_key | apt-key add - + curl -sL https://build.opensuse.org/projects/home:virtubox/public_key | apt-key add - fi locale-gen en # enable unattended upgades @@ -481,7 +482,7 @@ wo_install() { rm -rf /usr/local/bin/wo /usr/local/lib/python3."$python_venv"/dist-packages/{etc,usr} ln -s /opt/wo/bin/wo /usr/local/bin/ deactivate - if [ ! -d /opt/wo/lib/python3."$python_ver"/site-packages/apt ];then + if [ ! -d /opt/wo/lib/python3."$python_ver"/site-packages/apt ]; then python3 -m venv --system-site-packages /opt/wo fi } @@ -562,9 +563,9 @@ wo_upgrade_nginx() { # add new Nginx repository if [ "$wo_distro_version" == "jessie" ]; then # import the respository key for updates - curl -sL https://build.opensuse.org/projects/home:virtubox/public_key | apt-key add - + curl -sL https://build.opensuse.org/projects/home:virtubox/public_key | apt-key add - else - curl -sL https://build.opensuse.org/projects/home:virtubox/public_key | apt-key add - + curl -sL https://build.opensuse.org/projects/home:virtubox/public_key | apt-key add - fi # install new nginx package @@ -785,6 +786,12 @@ wo_php_fix() { fi } +wo_git_secure_path() { + if ! grep -q "directory = *" ~/.gitconfig; then + echo -e "\n[safe]\n directory = *" >> ~/.gitconfig + fi +} + ### # 4 - WO MAIN SETUP ### @@ -851,6 +858,7 @@ else _run secure_wo_db wo sync + _run wo_git_secure_path if [ "$ee_migration" = "1" ]; then echo diff --git a/wo/core/git.py b/wo/core/git.py index 02fa004..3bebdb1 100644 --- a/wo/core/git.py +++ b/wo/core/git.py @@ -1,10 +1,8 @@ """WordOps GIT module""" import os -from pathlib import Path from sh import ErrorReturnCode, git from wo.core.logging import Log -from wo.core.fileutils import WOFileUtils class WOGit: @@ -31,11 +29,7 @@ class WOGit: Log.debug(self, "{0}".format(e)) Log.error(self, "Unable to git init at {0}" .format(path)) - if not WOFileUtils.grep(self, - "{0}/.gitconfig".format(Path.home()), - "{0}".format(path)): - git.config("--global", "--add", "safe.directory", - "{0}".format(path)) + status = wogit.status("-s") if len(status.splitlines()) > 0: try: From 1cb4911b42462369dc73abc7c922e481bf1cf8b0 Mon Sep 17 00:00:00 2001 From: VirtuBox Date: Thu, 28 Apr 2022 15:44:39 +0200 Subject: [PATCH 14/15] Fix typo --- wo/cli/plugins/site_functions.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wo/cli/plugins/site_functions.py b/wo/cli/plugins/site_functions.py index b43e707..b10f602 100644 --- a/wo/cli/plugins/site_functions.py +++ b/wo/cli/plugins/site_functions.py @@ -326,7 +326,7 @@ def setupwordpress(self, data, vhostonly=False): data['wo_db_user'], data['wo_db_host'] ) + - "--dbpass=\'{0}\' " + "--dbpass=\'{0}\'\"" .format(data['wo_db_pass']), log=False ): From 24ed5b50b2c068dc33c4d8ee2ab76db8f2c85d0b Mon Sep 17 00:00:00 2001 From: VirtuBox Date: Fri, 29 Apr 2022 14:26:24 +0200 Subject: [PATCH 15/15] Update changelog --- CHANGELOG.md | 7 +++++++ install | 4 ++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f48f647..f915e39 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,13 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), ### v3.15.0 - [Unreleased] +### v3.14.2 - 2022-04-29 + +#### Fixed + +- Git unsafe directories issue +- WP_DEBUG variable in wp-config.php + ### v3.14.1 - 2022-02-16 #### Fixed diff --git a/install b/install index 6f257b7..1203688 100755 --- a/install +++ b/install @@ -9,7 +9,7 @@ # ------------------------------------------------------------------------- # wget -qO wo wops.cc && sudo -E bash wo # ------------------------------------------------------------------------- -# Version 3.14.2 - 2022-04-28 +# Version 3.14.2 - 2022-04-29 # ------------------------------------------------------------------------- # CONTENTS @@ -787,7 +787,7 @@ wo_php_fix() { } wo_git_secure_path() { - if ! grep -q "directory = *" ~/.gitconfig; then + if ! grep -q "safe" ~/.gitconfig; then echo -e "\n[safe]\n directory = *" >> ~/.gitconfig fi }