From cdb195bd03528c2137e5e92642bb8c0eb7d9b191 Mon Sep 17 00:00:00 2001 From: VirtuBox Date: Thu, 15 Aug 2019 17:19:52 +0200 Subject: [PATCH] Revert Commit --- CHANGELOG.md | 3 ++ install | 60 ++++++++++++++++++++++++++++++------ setup.py | 9 +++--- wo/cli/plugins/stack_pref.py | 16 ++++++++-- wo/core/variables.py | 2 +- 5 files changed, 73 insertions(+), 17 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 366cc7c..df82f8c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), ### v3.9.x - [Unreleased] +### v3.9.7.3 - 2019-08-15 + #### Added - Allow web browser caching for json and webmanifest files @@ -17,6 +19,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), - WP-Rocket support with the flag `--wprocket` - Install unattended-upgrade and enable automated security updates - Enable time synchronization with ntp +- Additional cache exception for woocommerce #### Changed diff --git a/install b/install index e1d628a..04fb043 100755 --- a/install +++ b/install @@ -10,7 +10,7 @@ # Version 3.9.7.2 - 2019-08-12 # ------------------------------------------------------------------------- readonly wo_version_old="2.2.3" -readonly wo_version_new="3.9.7.2" +readonly wo_version_new="3.9.7.3" # CONTENTS # --- # 1. VARIABLES AND DECLARATIONS @@ -124,11 +124,11 @@ readonly wo_install_log=/var/log/wo/install.log readonly wo_linux_distro=$(lsb_release -is) readonly wo_distro_version=$(lsb_release -sc) readonly wo_distro_id=$(lsb_release -rs) -TIME_FORMAT='%d-%b-%Y-%H%M%S' -TIME=$(date +"$TIME_FORMAT") -NGINX_BACKUP_FILE="/var/lib/wo-backup/nginx-backup.$TIME.tar.gz" -EE_BACKUP_FILE="/var/lib/wo-backup/ee-backup.$TIME.tar.gz" -WO_BACKUP_FILE="/var/lib/wo-backup/wo-backup.$TIME.tar.gz" +readonly TIME_FORMAT='%d-%b-%Y-%H%M%S' +readonly TIME=$(date +"$TIME_FORMAT") +readonly NGINX_BACKUP_FILE="/var/lib/wo-backup/nginx-backup.$TIME.tar.gz" +readonly EE_BACKUP_FILE="/var/lib/wo-backup/ee-backup.$TIME.tar.gz" +readonly WO_BACKUP_FILE="/var/lib/wo-backup/wo-backup.$TIME.tar.gz" WO_ARCH="$(uname -m)" if [ -x /usr/local/bin/ee ]; then @@ -183,13 +183,13 @@ wo_install_dep() { if [ "$wo_linux_distro" == "Ubuntu" ]; then # install dependencies apt-get -option=Dpkg::options::=--force-confmiss --option=Dpkg::options::=--force-confold --assume-yes install \ - build-essential curl gzip python3 python3-apt python3-setuptools python3-requests python3-dev sqlite3 git tar software-properties-common pigz \ - gnupg2 cron ccze rsync tree haveged ufw unattended-upgrades tzdata ntp > /dev/null 2>&1 + build-essential curl gzip python3 python3-apt python3-setuptools python3-requests python3-dev sqlite3 git tar software-properties-common pigz \ + gnupg2 cron ccze rsync tree haveged ufw unattended-upgrades tzdata ntp > /dev/null 2>&1 else # install dependencies apt-get -option=Dpkg::options::=--force-confmiss --option=Dpkg::options::=--force-confold --assume-yes install \ - build-essential curl gzip dirmngr sudo python3 python3-apt python3-setuptools python3-requests python3-dev ca-certificates sqlite3 git tar \ - software-properties-common pigz apt-transport-https gnupg2 cron ccze rsync tree haveged ufw unattended-upgrades tzdata ntp > /dev/null 2>&1 + build-essential curl gzip dirmngr sudo python3 python3-apt python3-setuptools python3-requests python3-dev ca-certificates sqlite3 git tar \ + software-properties-common pigz apt-transport-https gnupg2 cron ccze rsync tree haveged ufw unattended-upgrades tzdata ntp > /dev/null 2>&1 # 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 @@ -696,6 +696,46 @@ wo_uninstall() { rm -rf /usr/local/lib/python3.*/dist-packages/{pystache-*,cement-2.*,wo-*} /usr/local/bin/wo /etc/bash_completion.d/wo_auto.rc /var/lib/wo /etc/wo /usr/lib/wo/templates >> /var/log/wo/install.log 2>&1 } +wo_ufw_setup() { + + CURRENT_SSH_PORT=$(grep "Port" /etc/ssh/sshd_config | awk -F " " '{print $2}') + + if [ ! -d /etc/ufw ]; then + apt-get install ufw -y + fi + + # define firewall rules + + ufw logging low + ufw default allow outgoing + ufw default deny incoming + + # default ssh port + ufw allow 22 + + # custom ssh port + if [ "$CURRENT_SSH_PORT" != "22" ]; then + ufw allow "$CURRENT_SSH_PORT" + fi + + # dns + ufw allow 53 + + # nginx + ufw allow http + ufw allow https + + # ntp + ufw allow 123 + + # wordops backend + ufw allow 22222 + + # enable ufw + echo "y" | ufw enable + +} >> $wo_install_log + ### # 4 - WO MAIN SETUP ### diff --git a/setup.py b/setup.py index fd240d0..cdf6c7e 100644 --- a/setup.py +++ b/setup.py @@ -9,9 +9,10 @@ import shutil conf = [] templates = [] -long_description = '''WordOps is the commandline tool to manage your - Websites based on WordPress and Nginx with easy to use - commands''' +long_description = '''WordOps An essential toolset that eases WordPress + site and server administration. It provide the ability + to Install a high performance WordPress stack + with a few keystrokes''' for name in glob.glob('config/plugins.d/*.conf'): conf.insert(1, name) @@ -56,7 +57,7 @@ if not os.path.isfile('/root/.gitconfig'): shutil.copy2(os.path.expanduser("~")+'/.gitconfig', '/root/.gitconfig') setup(name='wo', - version='3.9.7.2', + version='3.9.7.3', description=long_description, long_description=long_description, classifiers=[], diff --git a/wo/cli/plugins/stack_pref.py b/wo/cli/plugins/stack_pref.py index 4284d47..9b3a112 100644 --- a/wo/cli/plugins/stack_pref.py +++ b/wo/cli/plugins/stack_pref.py @@ -593,6 +593,19 @@ def post_pref(self, apt_packages, packages): else: WOService.restart_service(self, 'nginx') + # add rule for Nginx with UFW + if WOAptGet.is_installed(self, 'ufw'): + try: + WOShellExec.cmd_exec(self, "/usr/bin/ufw allow " + "http") + WOShellExec.cmd_exec(self, "/usr/bin/ufw allow " + "https") + WOShellExec.cmd_exec(self, "/usr/bin/ufw allow " + "22222") + except CommandExecutionError as e: + Log.debug(self, "{0}".format(e)) + Log.error(self, "Unable to add UFW rule") + # create nginx configuration for redis if set(WOVariables.wo_redis).issubset(set(apt_packages)): if os.path.isdir('/etc/nginx/common'): @@ -1070,7 +1083,6 @@ def post_pref(self, apt_packages, packages): comment='MySQL optimization cronjob ' 'added by WordOps') WOGit.add(self, ["/etc/mysql"], msg="Adding MySQL into Git") - WOService.restart_service(self, 'mysql') # create fail2ban configuration files if set(WOVariables.wo_fail2ban).issubset(set(apt_packages)): @@ -1166,7 +1178,7 @@ def post_pref(self, apt_packages, packages): # add rule for proftpd with UFW if WOAptGet.is_installed(self, 'ufw'): try: - WOShellExec.cmd_exec(self, "ufw allow " + WOShellExec.cmd_exec(self, "/usr/bin/ufw allow " "49000:50000/tcp") except CommandExecutionError as e: Log.debug(self, "{0}".format(e)) diff --git a/wo/core/variables.py b/wo/core/variables.py index b738706..0b0a472 100644 --- a/wo/core/variables.py +++ b/wo/core/variables.py @@ -10,7 +10,7 @@ class WOVariables(): """Intialization of core variables""" # WordOps version - wo_version = "3.9.7.2" + wo_version = "3.9.7.3" # WordOps packages versions wo_wp_cli = "2.2.0" wo_adminer = "4.7.2"