|
|
|
|
@@ -7,8 +7,10 @@
|
|
|
|
|
# Copyright (c) 2019 - WordOps
|
|
|
|
|
# This script is licensed under M.I.T
|
|
|
|
|
# -------------------------------------------------------------------------
|
|
|
|
|
# Version 3.9.1 - 2019-02-25
|
|
|
|
|
# Version 3.9.3 - 2019-03-04
|
|
|
|
|
# -------------------------------------------------------------------------
|
|
|
|
|
readonly wo_version_old="2.2.3"
|
|
|
|
|
readonly wo_version_new="3.9.3"
|
|
|
|
|
# CONTENTS
|
|
|
|
|
# ---
|
|
|
|
|
# 1. VARIABLES AND DECLARATIONS
|
|
|
|
|
@@ -20,19 +22,34 @@
|
|
|
|
|
# 1 - Set the CLI output colors
|
|
|
|
|
###
|
|
|
|
|
|
|
|
|
|
function wo_lib_echo()
|
|
|
|
|
{
|
|
|
|
|
echo $(tput setaf 4)$@$(tput sgr0)
|
|
|
|
|
TPUT_RESET=$(tput sgr0)
|
|
|
|
|
TPUT_FAIL=$(tput setaf 1)
|
|
|
|
|
|
|
|
|
|
wo_lib_echo () {
|
|
|
|
|
TPUT_ECHO=$(tput setaf 4)
|
|
|
|
|
echo "${TPUT_ECHO}${*}${TPUT_RESET}"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function wo_lib_echo_info()
|
|
|
|
|
wo_lib_echo_info()
|
|
|
|
|
{
|
|
|
|
|
echo $(tput setaf 7)$@$(tput sgr0)
|
|
|
|
|
TPUT_INFO=$(tput setaf 7)
|
|
|
|
|
echo "${TPUT_INFO}${*}${TPUT_RESET}"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function wo_lib_echo_fail()
|
|
|
|
|
wo_lib_echo_fail()
|
|
|
|
|
{
|
|
|
|
|
echo $(tput setaf 1)$@$(tput sgr0)
|
|
|
|
|
|
|
|
|
|
echo "${TPUT_FAIL}${*}${TPUT_RESET}"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
###
|
|
|
|
|
# 1 - Capture errors
|
|
|
|
|
###
|
|
|
|
|
|
|
|
|
|
wo_lib_error()
|
|
|
|
|
{
|
|
|
|
|
echo "[ $(date) ] ${TPUT_FAIL}${*}${TPUT_RESET}"
|
|
|
|
|
exit "$2"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
###
|
|
|
|
|
@@ -40,18 +57,13 @@ function wo_lib_echo_fail()
|
|
|
|
|
###
|
|
|
|
|
if [[ $EUID -ne 0 ]]; then
|
|
|
|
|
wo_lib_echo_fail "Sudo privilege required..."
|
|
|
|
|
wo_lib_echo_fail "Uses: wget -qO wo wordops.se/tup && sudo bash wo"
|
|
|
|
|
wo_lib_echo_fail "Use: wget -qO wo wordops.se/tup && sudo bash wo"
|
|
|
|
|
exit 100
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
###
|
|
|
|
|
# 1 - Capture errors
|
|
|
|
|
###
|
|
|
|
|
function wo_lib_error()
|
|
|
|
|
{
|
|
|
|
|
echo "[ $(date) ] $(tput setaf 1)$@$(tput sgr0)"
|
|
|
|
|
exit $2
|
|
|
|
|
}
|
|
|
|
|
echo ""
|
|
|
|
|
wo_lib_echo "Welcome to WordOps install script v${wo_version_new}"
|
|
|
|
|
echo ""
|
|
|
|
|
|
|
|
|
|
###
|
|
|
|
|
# 1- Update the apt sewers with fresh info
|
|
|
|
|
@@ -72,8 +84,6 @@ fi
|
|
|
|
|
###
|
|
|
|
|
wo_branch=$1
|
|
|
|
|
migration=0
|
|
|
|
|
readonly wo_version_old="2.2.3"
|
|
|
|
|
readonly wo_version_new="3.9.2.3"
|
|
|
|
|
readonly wo_log_dir=/var/log/wo/
|
|
|
|
|
readonly wo_install_log=/var/log/wo/install.log
|
|
|
|
|
readonly wo_linux_distro=$(lsb_release -i | awk '{print $3}')
|
|
|
|
|
@@ -93,7 +103,7 @@ fi
|
|
|
|
|
###
|
|
|
|
|
# 1 - WordOps (wo) only supports Ubuntu/Debian versions that are eligible for support
|
|
|
|
|
###
|
|
|
|
|
lsb_release -d | egrep -e "14.04|16.04|18.04|jessie|stretch" &>> /dev/null
|
|
|
|
|
lsb_release -d | grep -E "14.04|16.04|18.04|jessie|stretch" &>> /dev/null
|
|
|
|
|
if [ "$?" -ne "0" ]; then
|
|
|
|
|
wo_lib_echo_fail "WordOps (wo) only supports Ubuntu 14.04/16.04/18.04, Debian 8.x and Debian 9.x"
|
|
|
|
|
exit 100
|
|
|
|
|
@@ -115,37 +125,36 @@ fi
|
|
|
|
|
###
|
|
|
|
|
# 2 - Setup the dependencies for installation
|
|
|
|
|
####
|
|
|
|
|
function wo_install_dep()
|
|
|
|
|
wo_install_dep()
|
|
|
|
|
{
|
|
|
|
|
echo -ne ' Installing dependencies [..]\r'
|
|
|
|
|
if {
|
|
|
|
|
if [ "$wo_linux_distro" == "Ubuntu" ]; then
|
|
|
|
|
apt-get -y install build-essential curl gzip python3 python3-apt python3-setuptools python3-dev sqlite3 git tar software-properties-common pigz gnupg2 || wo_lib_error "There was an error during dependency installation, exit status " 1
|
|
|
|
|
elif [ "$wo_linux_distro" == "Debian" ]; then
|
|
|
|
|
apt-get -y install build-essential curl gzip dirmngr python3 python3-apt python3-setuptools python3-dev sqlite3 git tar software-properties-common pigz gnupg2 || wo_lib_error "There was an error during dependency installation, exit status " 1
|
|
|
|
|
apt-get -y install build-essential curl gzip python3 python3-apt python3-setuptools python3-dev sqlite3 git tar software-properties-common pigz gnupg2 > /dev/null 2>&1
|
|
|
|
|
else
|
|
|
|
|
apt-get -y install build-essential curl gzip dirmngr python3 python3-apt python3-setuptools python3-dev sqlite3 git tar software-properties-common pigz gnupg2 > /dev/null 2>&1
|
|
|
|
|
fi
|
|
|
|
|
}; then echo -ne ' Installing dependencies [OK]\r'
|
|
|
|
|
else
|
|
|
|
|
echo -e " Installing dependencies [FAIL]"
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
locale-gen en &>> /dev/null
|
|
|
|
|
|
|
|
|
|
# Support PFS
|
|
|
|
|
if [ -f /etc/nginx/nginx.conf ]; then
|
|
|
|
|
# Replace the default ciphers
|
|
|
|
|
sed -i 's/HIGH:!aNULL:!MD5:!kEDH;/ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-CHACHA20-POLY1305:EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH;/' /etc/nginx/nginx.conf
|
|
|
|
|
sed -i 's/HIGH:!aNULL:!MD5:!kEDH;/EECDH+CHACHA20:EECDH+AESGCM:EECDH+AES;/' /etc/nginx/nginx.conf
|
|
|
|
|
# Replace the EasyEngine ciphers
|
|
|
|
|
sed -i 's/ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-DSS-AES128-GCM-SHA256:kEDH+AESGCM:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-DSS-AES128-SHA256:DHE-RSA-AES256-SHA256:DHE-DSS-AES256-SHA:DHE-RSA-AES256-SHA:ECDHE-RSA-DES-CBC3-SHA:ECDHE-ECDSA-DES-CBC3-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:AES:CAMELLIA:DES-CBC3-SHA:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!MD5:!PSK:!aECDH:!EDH-DSS-DES-CBC3-SHA:!EDH-RSA-DES-CBC3-SHA:!KRB5-DES-CBC3-SHA;/ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-CHACHA20-POLY1305:EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH;/' /etc/nginx/nginx.conf
|
|
|
|
|
sed -i 's/ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-DSS-AES128-GCM-SHA256:kEDH+AESGCM:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-DSS-AES128-SHA256:DHE-RSA-AES256-SHA256:DHE-DSS-AES256-SHA:DHE-RSA-AES256-SHA:ECDHE-RSA-DES-CBC3-SHA:ECDHE-ECDSA-DES-CBC3-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:AES:CAMELLIA:DES-CBC3-SHA:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!MD5:!PSK:!aECDH:!EDH-DSS-DES-CBC3-SHA:!EDH-RSA-DES-CBC3-SHA:!KRB5-DES-CBC3-SHA;/EECDH+CHACHA20:EECDH+AESGCM:EECDH+AES;/' /etc/nginx/nginx.conf
|
|
|
|
|
# Change the TLS protocols
|
|
|
|
|
if [ "$wo_distro_version" == "bionic" ]; then
|
|
|
|
|
# Bionic supports TLSv1.3, so let's enable that
|
|
|
|
|
sed -i 's/TLSv1 TLSv1.1 TLSv1.2;/TLSv1.2 TLSv1.3;/g' /etc/nginx/nginx.conf
|
|
|
|
|
else
|
|
|
|
|
# If != Bionic then enable only TLSv1.2
|
|
|
|
|
sed -i 's/TLSv1 TLSv1.1 TLSv1.2;/TLSv1.2;/g' /etc/nginx/nginx.conf
|
|
|
|
|
fi
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
if [ "$wo_linux_distro" == "Ubuntu" ]; then
|
|
|
|
|
add-apt-repository -y 'ppa:ondrej/php'
|
|
|
|
|
wo_lib_echo "Updating the PHP repository for some neat PHP 7.2 support"
|
|
|
|
|
apt-get update &>> /dev/null
|
|
|
|
|
apt-get -y install php7.2-fpm php7.2-curl php7.2-gd php-memcached php7.2-imap php7.2-common php7.2-readline php-redis php7.2-mysql php7.2-cli php-imagick php7.2-mbstring php7.2-recode php7.2-bcmath php7.2-opcache php7.2-zip php7.2-xml php7.2-soap php7.2-msgpack graphviz php-pear php7.2-xdebug || wo_lib_error "Not all PHP packages could be installed. " 1
|
|
|
|
|
apt-get -y install php7.2-fpm php7.2-curl php7.2-gd php-memcached php7.2-imap php7.2-common php7.2-readline php-redis php7.2-mysql php7.2-cli php-imagick php7.2-mbstring php7.2-recode php7.2-bcmath php7.2-opcache php7.2-zip php7.2-xml php7.2-soap php-msgpack graphviz php-pear php-xdebug || wo_lib_error "Not all PHP packages could be installed. " 1
|
|
|
|
|
mkdir -p /var/log/php/7.2/
|
|
|
|
|
touch /var/log/php/7.2/slow.log /var/log/php/7.2/fpm.log
|
|
|
|
|
systemctl php7.2-fpm restart &>> /dev/null
|
|
|
|
|
@@ -157,7 +166,7 @@ function wo_install_dep()
|
|
|
|
|
wget -O /etc/apt/trusted.gpg.d/php.gpg https://packages.sury.org/php/apt.gpg
|
|
|
|
|
echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" | tee /etc/apt/sources.list.d/php.list
|
|
|
|
|
apt-get update &>> /dev/null
|
|
|
|
|
apt-get -y install php7.2-fpm php7.2-curl php7.2-gd php-memcached php7.2-imap php7.2-common php7.2-readlne php-redis php7.2-mysql php7.2-cli php-imagick php7.2-mbstring php7.2-recode php7.2-bcmath php7.2-opcache php7.2-zip php7.2-xml php7.2-soap php7.2-msgpack graphviz php-pear php7.2-xdebug || wo_lib_error "Not all PHP packages could be installed." 1
|
|
|
|
|
apt-get -y install php7.2-fpm php7.2-curl php7.2-gd php-memcached php7.2-imap php7.2-common php7.2-readlne php-redis php7.2-mysql php7.2-cli php-imagick php7.2-mbstring php7.2-recode php7.2-bcmath php7.2-opcache php7.2-zip php7.2-xml php7.2-soap php-msgpack graphviz php-pear php-xdebug || wo_lib_error "Not all PHP packages could be installed." 1
|
|
|
|
|
systemctl php7.2-fpm restart &>> /dev/null
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
@@ -179,7 +188,7 @@ function wo_install_dep()
|
|
|
|
|
###
|
|
|
|
|
# 3 - Create/migrate the essentials
|
|
|
|
|
###
|
|
|
|
|
function wo_sync_db()
|
|
|
|
|
wo_sync_db()
|
|
|
|
|
{
|
|
|
|
|
###
|
|
|
|
|
# Switching from EE -> WO
|
|
|
|
|
@@ -232,7 +241,7 @@ function wo_sync_db()
|
|
|
|
|
# Check site is enable/live or disable
|
|
|
|
|
for site in $(ls /etc/nginx/sites-available/ | grep -v default);
|
|
|
|
|
do
|
|
|
|
|
if [ -f /etc/nginx/sites-enabled/$site ]; then
|
|
|
|
|
if [ -f "/etc/nginx/sites-enabled/$site" ]; then
|
|
|
|
|
wo_site_status='1'
|
|
|
|
|
else
|
|
|
|
|
wo_site_status='0'
|
|
|
|
|
@@ -349,7 +358,7 @@ function wo_sync_db()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
# Once again, set the proper ACL on the WordOps configuration directory
|
|
|
|
|
function secure_wo_db()
|
|
|
|
|
secure_wo_db()
|
|
|
|
|
{
|
|
|
|
|
# The owner is root
|
|
|
|
|
chown -R root:root /var/lib/wo/
|
|
|
|
|
@@ -358,7 +367,7 @@ function secure_wo_db()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
# Update the WP-CLI version
|
|
|
|
|
function wo_update_wp_cli()
|
|
|
|
|
wo_update_wp_cli()
|
|
|
|
|
{
|
|
|
|
|
wo_lib_echo "Updating WP-CLI version to resolve compatibility issue."
|
|
|
|
|
WP_CLI_PATH=$(command -v wp)
|
|
|
|
|
@@ -369,18 +378,19 @@ function wo_update_wp_cli()
|
|
|
|
|
else
|
|
|
|
|
wget -qO /usr/local/bin/wp https://raw.githubusercontent.com/WordOps/wpcli-builds/gh-pages/phar/wp-cli.phar
|
|
|
|
|
chmod +x /usr/local/bin/wp
|
|
|
|
|
ln -s /usr/local/bin/wp /usr/bin/
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
[ -d /etc/bash_completion ] && {
|
|
|
|
|
[ -d /etc/bash_completion.d ] && {
|
|
|
|
|
wget -qO /etc/bash_completion.d/wp-completion.bash https://raw.githubusercontent.com/wp-cli/wp-cli/master/utils/wp-completion.bash
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
# Now, finally, let's install WordOps
|
|
|
|
|
function wo_install()
|
|
|
|
|
wo_install()
|
|
|
|
|
{
|
|
|
|
|
rm -rf /tmp/easyengine &>> /dev/null
|
|
|
|
|
rm -rf /tmp/wordops &>> /dev/null
|
|
|
|
|
rm -rf /tmp/easyengine
|
|
|
|
|
rm -rf /tmp/wordops
|
|
|
|
|
|
|
|
|
|
wo_lib_echo "Downloading WordOps straight from GitHub - fresh and brewed with love. Hold your horses..."
|
|
|
|
|
[ -z "$wo_branch" ] && {
|
|
|
|
|
@@ -395,7 +405,7 @@ function wo_install()
|
|
|
|
|
python3 setup.py install || wo_lib_error "An error was encountered during the installation, exit status " $?
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function wo_update_latest()
|
|
|
|
|
wo_update_latest()
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
if [ -f /etc/nginx/fastcgi_params ]
|
|
|
|
|
@@ -628,7 +638,7 @@ function wo_update_latest()
|
|
|
|
|
add-apt-repository -y 'ppa:ondrej/php'
|
|
|
|
|
wo_lib_echo "Updating the PHP repository for some neat PHP 7.2 support"
|
|
|
|
|
apt-get update &>> /dev/null
|
|
|
|
|
apt-get -y install php7.2-fpm php7.2-curl php7.2-gd php7.2-imap php-memcached php7.2-common php7.2-readline php-redis php7.2-mysql php7.2-cli php-imagick php7.2-mbstring php7.2-recode php7.2-bcmath php7.2-opcache php7.2-zip php7.2-xml php7.2-soap php7.2-msgpack graphviz php-pear php7.2-xdebug || wo_lib_error "Not all PHP packages could be installed. " 1
|
|
|
|
|
apt-get -y install php7.2-fpm php7.2-curl php7.2-gd php7.2-imap php-memcached php7.2-common php7.2-readline php-redis php7.2-mysql php7.2-cli php-imagick php7.2-mbstring php7.2-recode php7.2-bcmath php7.2-opcache php7.2-zip php7.2-xml php7.2-soap php-msgpack graphviz php-pear php-xdebug || wo_lib_error "Not all PHP packages could be installed. " 1
|
|
|
|
|
mkdir -p /var/log/php/7.2/
|
|
|
|
|
touch /var/log/php/7.2/slow.log /var/log/php/7.2/fpm.log
|
|
|
|
|
systemctl php7.2-fpm restart &>> /dev/null
|
|
|
|
|
@@ -640,7 +650,7 @@ function wo_update_latest()
|
|
|
|
|
wget -O /etc/apt/trusted.gpg.d/php.gpg https://packages.sury.org/php/apt.gpg
|
|
|
|
|
echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" | tee /etc/apt/sources.list.d/php.list
|
|
|
|
|
apt-get update &>> /dev/null
|
|
|
|
|
apt-get -y install php7.2-fpm php7.2-curl php7.2-gd php7.2-imap php-memcached php7.2-common php7.2-readline php-redis php7.2-mysql php7.2-cli php-imagick php7.2-mbstring php7.2-recode php7.2-bcmath php7.2-opcache php7.2-zip php7.2-xml php7.2-soap php7.2-msgpack graphviz php-pear php7.2-xdebug || wo_lib_error "Not all PHP packages could be installed." 1
|
|
|
|
|
apt-get -y install php7.2-fpm php7.2-curl php7.2-gd php7.2-imap php-memcached php7.2-common php7.2-readline php-redis php7.2-mysql php7.2-cli php-imagick php7.2-mbstring php7.2-recode php7.2-bcmath php7.2-opcache php7.2-zip php7.2-xml php7.2-soap php-msgpack graphviz php-pear php-xdebug || wo_lib_error "Not all PHP packages could be installed." 1
|
|
|
|
|
systemctl php7.2-fpm restart &>> /dev/null
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
@@ -654,7 +664,7 @@ function wo_update_latest()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
# Do git intialisation
|
|
|
|
|
function wo_git_init()
|
|
|
|
|
wo_git_init()
|
|
|
|
|
{
|
|
|
|
|
# Nginx under git version control
|
|
|
|
|
[ -d /etc/nginx ] && {
|
|
|
|
|
@@ -684,7 +694,8 @@ function wo_git_init()
|
|
|
|
|
}> /dev/null
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if [ ! -f /usr/local/bin/wo ]; then
|
|
|
|
|
if [ ! -x /usr/local/bin/ee ]; then
|
|
|
|
|
if [ ! -x /usr/local/bin/wo ]; then
|
|
|
|
|
wo_lib_echo "Installing depedencies" | tee -ai $wo_install_log
|
|
|
|
|
wo_install_dep | tee -ai $wo_install_log
|
|
|
|
|
wo_lib_echo "Installing WordOps $wo_branch" | tee -ai $wo_install_log
|
|
|
|
|
@@ -692,9 +703,10 @@ if [ ! -f /usr/local/bin/wo ]; then
|
|
|
|
|
wo_lib_echo "Running post-install steps" | tee -ai $wo_install_log
|
|
|
|
|
secure_wo_db | tee -ai $EE_INSTALL_LOG
|
|
|
|
|
wo_git_init | tee -ai $wo_install_log
|
|
|
|
|
|
|
|
|
|
wo_update_wp_cli | tee -ai $wo_install_log
|
|
|
|
|
fi
|
|
|
|
|
else
|
|
|
|
|
ee -v 2>&1 | grep $wo_version_new &>> /dev/null
|
|
|
|
|
wo -v 2>&1 | grep $wo_version_new &>> /dev/null
|
|
|
|
|
if [[ $? -ne 0 ]];then
|
|
|
|
|
read -p "Update WordOps to $wo_version_new (y/n): " wo_ans
|
|
|
|
|
if [ "$wo_ans" = "y" ] || [ "$wo_ans" = "Y" ]; then
|
|
|
|
|
|