Merge pull request #242 from WordOps/updating-configuration

v3.11.3
This commit is contained in:
VirtuBox
2020-01-16 21:54:08 +01:00
committed by GitHub
20 changed files with 205 additions and 172 deletions

View File

@@ -8,6 +8,28 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
### v3.9.x - [Unreleased]
### v3.11.3 - 2020-01-16
#### Added
- Backported Nano editor package for Debian/Ubuntu/Raspbian (which support syntax highlighting with `--nanorc`)
- Protect Easy Digital Download files from being accessed directly (PR [#222](https://github.com/WordOps/WordOps/pull/222))
#### Changed
- Improved WordOps performance by removing useless imports in `wo site` code
- Improved opcache cleaning with `wo clean --opcache`
- Force php imagick extension to be enabled after php-fpm install
- Netdata upgrade is now performed with fresh install script downloaded from github
- Update phpmyadmin to v5.0.1
#### Fixed
- Domain IP validation when using CNAME before issuing SSL certificate
- Netdata stack purge/remove not working properly
- Do not backup all databases when purging `--mysql` stack with remote MySQL server
- Netdata upgrade failure due to missing arguments
### v3.11.2 - 2019-12-07
#### Changed

35
install
View File

@@ -4,12 +4,12 @@
# -------------------------------------------------------------------------
# Website: https://wordops.net
# GitHub: https://github.com/WordOps/WordOps
# Copyright (c) 2019 - WordOps
# Copyright (c) 2019-2020 - WordOps
# This script is licensed under M.I.T
# -------------------------------------------------------------------------
# wget -qO wo wops.cc && sudo bash wo
# -------------------------------------------------------------------------
# Version 3.11.2 - 2019-12-07
# Version 3.11.3 - 2020-01-16
# -------------------------------------------------------------------------
# CONTENTS
@@ -427,7 +427,10 @@ wo_install_acme_sh() {
# WordOps install
wo_install() {
cd /usr/local/lib/python3.*/dist-packages || exit 1
local python_ver
python_ver=$(python3 -c "import sys; print(sys.version_info[1])")
cd /usr/local/lib/python3."$python_ver"/dist-packages || exit 1
rm -f /usr/local/bin/wo
if [ "$wo_branch" = "master" ]; then
python3 -m pip uninstall wo -y
python3 -m pip install --upgrade wordops
@@ -435,14 +438,14 @@ wo_install() {
python3 -m pip uninstall wo -y
python3 -m pip install -U "git+git://github.com/WordOps/WordOps.git@$wo_branch#egg=wordops"
fi
cp -rf /usr/local/lib/python3.*/dist-packages/usr/* /usr/
cp -rn /usr/local/lib/python3.*/dist-packages/etc/* /etc/
cp -f /usr/local/lib/python3.*/dist-packages/etc/bash_completion.d/wo_auto.rc /etc/bash_completion.d/wo_auto.rc
cp -rf /usr/local/lib/python3."$python_ver"/dist-packages/usr/* /usr/
cp -rn /usr/local/lib/python3."$python_ver"/dist-packages/etc/* /etc/
cp -f /usr/local/lib/python3."$python_ver"/dist-packages/etc/bash_completion.d/wo_auto.rc /etc/bash_completion.d/wo_auto.rc
}
# Clone Github repository if it doesn't exist
wo_travis_install() {
python_ver=$(python3 -c "import sys; print(sys.version_info[1])")
if [ -d ./dist ]; then
rm -rf dist
fi
@@ -452,9 +455,9 @@ wo_travis_install() {
else
python3 -m pip install -U "git+git://github.com/WordOps/WordOps.git@$wo_branch#egg=wordops"
fi
cp -rf /usr/local/lib/python3.*/dist-packages/usr/* /usr/
cp -rn /usr/local/lib/python3.*/dist-packages/etc/* /etc/
cp -f /usr/local/lib/python3.*/dist-packages/etc/bash_completion.d/wo_auto.rc /etc/bash_completion.d/wo_auto.rc
cp -rf /usr/local/lib/python3."$python_ver"/dist-packages/usr/* /usr/
cp -rn /usr/local/lib/python3."$python_ver"/dist-packages/etc/* /etc/
cp -f /usr/local/lib/python3."$python_ver"/dist-packages/etc/bash_completion.d/wo_auto.rc /etc/bash_completion.d/wo_auto.rc
}
@@ -584,7 +587,9 @@ wo_backup_wo() {
}
wo_clean_ee() {
rm -rf /usr/local/bin/ee /etc/bash_completion.d/ee_auto.rc /usr/lib/ee/templates /usr/local/lib/python3.*/dist-packages/ee-*.egg /etc/ee /var/lib/ee
local python_ver
python_ver=$(python3 -c "import sys; print(sys.version_info[1])")
rm -rf /usr/local/bin/ee /etc/bash_completion.d/ee_auto.rc /usr/lib/ee/templates /usr/local/lib/python3."$python_ver"/dist-packages/ee-*.egg /etc/ee /var/lib/ee
return 0
}
@@ -599,14 +604,18 @@ wo_domain_suffix() {
}
wo_clean() {
rm -rf /usr/local/lib/python3.*/dist-packages/{wo-*.egg,cement-*.egg,wordops-*.egg}
local python_ver
python_ver=$(python3 -c "import sys; print(sys.version_info[1])")
rm -rf /usr/local/lib/python3."$python_ver"/dist-packages/{wo-*.egg,cement-*.egg,wordops-*.egg}
}
wo_uninstall() {
local python_ver
python_ver=$(python3 -c "import sys; print(sys.version_info[1])")
if { python3 -m pip list | grep -q "wordops" >/dev/null 2>&1; }; then
python3 -m pip uninstall wordops -y
fi
rm -rf /usr/local/lib/python3.*/dist-packages/{pystache-*,cement-2.*,wo-*,wordops-*} /usr/local/bin/wo /etc/bash_completion.d/wo_auto.rc /var/lib/wo /etc/wo /usr/lib/wo/templates
rm -rf /usr/local/lib/python3."$python_ver"/dist-packages/{pystache-*,cement-2.*,wo-*,wordops-*} /usr/local/bin/wo /etc/bash_completion.d/wo_auto.rc /var/lib/wo /etc/wo /usr/lib/wo/templates
}
wo_clean_repo() {

View File

@@ -2,10 +2,10 @@ cement==2.10.12
pystache>=0.5.4
pynginxconfig>=0.3.4
PyMySQL>=0.9.3
psutil>=5.6.3
psutil>=5.6.7
sh>=1.12.14
SQLAlchemy>=1.3.8
SQLAlchemy>=1.3.11
requests>=2.22.0
distro>=1.4.0
argcomplete>=1.10.0
argcomplete>=1.10.3
colorlog>=4.0.2

View File

@@ -27,7 +27,7 @@ if os.geteuid() == 0:
os.makedirs('/var/lib/wo/tmp/')
setup(name='wordops',
version='3.11.2',
version='3.11.3',
description='An essential toolset that eases server administration',
long_description=LONG,
long_description_content_type='text/markdown',
@@ -65,12 +65,12 @@ setup(name='wordops',
'pystache >= 0.5.4',
'pynginxconfig >= 0.3.4',
'PyMySQL >= 0.9.3',
'psutil >= 5.6.3',
'psutil >= 5.6.7',
'sh >= 1.12.14',
'SQLAlchemy >= 1.3.8',
'SQLAlchemy >= 1.3.11',
'requests >= 2.22.0',
'distro >= 1.4.0',
'argcomplete >= 1.10.0',
'argcomplete >= 1.10.3',
'colorlog >= 4.0.2',
],
extras_require={ # Optional

View File

@@ -72,16 +72,22 @@ class WOCleanController(CementBaseController):
@expose(hide=True)
def clean_opcache(self):
opcache_dir = '/var/www/22222/htdocs/cache/opcache/'
if (os.path.exists('/usr/sbin/nginx') and
os.path.exists(
'/var/www/22222/htdocs/cache/opcache/php72.php')):
'/var/www/22222/htdocs/cache/opcache')):
try:
Log.info(self, "Cleaning opcache")
opgui = requests.get(
"http://127.0.0.1/cache/opcache/php72.php")
if opgui.status_code != '200' or opgui.status_code != '302':
Log.warn(self, 'Cleaning opcache failed')
except Exception as e:
if os.path.exists('{0}php72.php'.format(opcache_dir)):
requests.get(
"http://127.0.0.1/cache/opcache/php72.php")
if os.path.exists('{0}php73.php'.format(opcache_dir)):
requests.get(
"http://127.0.0.1/cache/opcache/php73.php")
if os.path.exists('{0}php74.php'.format(opcache_dir)):
requests.get(
"http://127.0.0.1/cache/opcache/php74.php")
except requests.HTTPError as e:
Log.debug(self, "{0}".format(e))
Log.debug(self, "Unable hit url, "
" http://127.0.0.1/cache/opcache/"

View File

@@ -117,10 +117,10 @@ class WOSecureController(CementBaseController):
Log.info(self, "Please Enter valid port number :")
port = input("WordOps admin port [22222]:")
pargs.user_input = port
WOShellExec.cmd_exec(self, "sed -i \"s/listen.*/listen "
"{port} default_server ssl http2;/\" "
"/etc/nginx/sites-available/22222"
.format(port=pargs.user_input))
data = dict(release=WOVar.wo_version, port=port)
WOTemplate.deploy(
self, '/etc/nginx/sites-available/22222',
'22222.mustache', data)
WOGit.add(self, ["/etc/nginx"],
msg="Adding changed secure port into Git")
if not WOService.reload_service(self, 'nginx'):
@@ -145,8 +145,8 @@ class WOSecureController(CementBaseController):
Log.debug(self, "{0}".format(e))
user_ip = ['127.0.0.1']
for ip_addr in user_ip:
if not ("exist_ip_address "+ip_addr in open('/etc/nginx/common/'
'acl.conf').read()):
if not ("exist_ip_address " + ip_addr in open('/etc/nginx/common/'
'acl.conf').read()):
WOShellExec.cmd_exec(self, "sed -i "
"\"/deny/i allow {whitelist_address}\;\""
" /etc/nginx/common/acl.conf"

View File

@@ -3,8 +3,9 @@ import os
import subprocess
from cement.core.controller import CementBaseController, expose
from wo.cli.plugins.site_functions import *
from wo.cli.plugins.sitedb import (addNewSite, deleteSiteInfo, getAllsites,
from wo.cli.plugins.site_functions import (
check_domain_exists, deleteDB, deleteWebRoot, removeNginxConf, logwatch)
from wo.cli.plugins.sitedb import (deleteSiteInfo, getAllsites,
getSiteInfo, updateSiteInfo)
from wo.cli.plugins.site_create import WOSiteCreateController
from wo.cli.plugins.site_update import WOSiteUpdateController
@@ -132,7 +133,6 @@ class WOSiteController(CementBaseController):
Log.error(self, 'could not input site name')
pargs.site_name = pargs.site_name.strip()
wo_domain = WODomain.validate(self, pargs.site_name)
wo_www_domain = "www.{0}".format(wo_domain)
(wo_domain_type, wo_root_domain) = WODomain.getlevel(
self, wo_domain)
wo_db_name = ''
@@ -152,7 +152,6 @@ class WOSiteController(CementBaseController):
wo_db_name = siteinfo.db_name
wo_db_user = siteinfo.db_user
wo_db_pass = siteinfo.db_password
wo_db_host = siteinfo.db_host
php_version = siteinfo.php_version
@@ -163,7 +162,8 @@ class WOSiteController(CementBaseController):
else:
sslprovider = ''
sslexpiry = ''
data = dict(domain=wo_domain, webroot=wo_site_webroot,
data = dict(domain=wo_domain, domain_type=wo_domain_type,
webroot=wo_site_webroot,
accesslog=access_log, errorlog=error_log,
dbname=wo_db_name, dbuser=wo_db_user,
php_version=php_version,
@@ -203,7 +203,6 @@ class WOSiteController(CementBaseController):
# TODO Write code for wo site edit command here
pargs.site_name = pargs.site_name.strip()
wo_domain = WODomain.validate(self, pargs.site_name)
wo_www_domain = "www.{0}".format(wo_domain)
if not check_domain_exists(self, wo_domain):
Log.error(self, "site {0} does not exist".format(wo_domain))
@@ -276,12 +275,9 @@ class WOSiteEditController(CementBaseController):
pargs.site_name = pargs.site_name.strip()
wo_domain = WODomain.validate(self, pargs.site_name)
wo_www_domain = "www.{0}".format(wo_domain)
if not check_domain_exists(self, wo_domain):
Log.error(self, "site {0} does not exist".format(wo_domain))
wo_site_webroot = WOVar.wo_webroot + wo_domain
if os.path.isfile('/etc/nginx/sites-available/{0}'
.format(wo_domain)):
try:
@@ -341,7 +337,6 @@ class WOSiteDeleteController(CementBaseController):
pargs.site_name = pargs.site_name.strip()
wo_domain = WODomain.validate(self, pargs.site_name)
wo_www_domain = "www.{0}".format(wo_domain)
wo_db_name = ''
wo_prompt = ''
wo_nginx_prompt = ''

View File

@@ -1,7 +1,11 @@
import os
from cement.core.controller import CementBaseController, expose
from wo.cli.plugins.site_functions import *
from wo.cli.plugins.site_functions import (
detSitePar, check_domain_exists, site_package_check,
pre_run_checks, setupdomain, SiteError,
doCleanupAction, setupdatabase, setupwordpress, setwebrootpermissions,
display_cache_settings, copyWildcardCert)
from wo.cli.plugins.sitedb import (addNewSite, deleteSiteInfo,
updateSiteInfo)
from wo.core.acme import WOAcme

View File

@@ -891,28 +891,19 @@ def site_package_check(self, stype):
'wpsubdomain']):
Log.debug(self, "Setting apt_packages variable for PHP 7.2")
if not (WOAptGet.is_installed(self, 'php7.2-fpm')):
apt_packages = apt_packages + WOVar.wo_php72
if not (WOAptGet.is_installed(self, 'php7.3-fpm') or
WOAptGet.is_installed(self, 'php7.4-fpm')):
apt_packages = apt_packages + WOVar.wo_php_extra
apt_packages = apt_packages + WOVar.wo_php72 + WOVar.wo_php_extra
if pargs.php73 and stype in ['php73', 'mysql', 'wp',
'wpsubdir', 'wpsubdomain']:
Log.debug(self, "Setting apt_packages variable for PHP 7.3")
if not WOAptGet.is_installed(self, 'php7.3-fpm'):
apt_packages = apt_packages + WOVar.wo_php73
if not (WOAptGet.is_installed(self, 'php7.2-fpm') or
WOAptGet.is_installed(self, 'php7.4-fpm')):
apt_packages = apt_packages + WOVar.wo_php_extra
apt_packages = apt_packages + WOVar.wo_php73 + WOVar.wo_php_extra
if pargs.php74 and stype in ['php74', 'mysql', 'wp',
'wpsubdir', 'wpsubdomain']:
Log.debug(self, "Setting apt_packages variable for PHP 7.4")
if not WOAptGet.is_installed(self, 'php7.4-fpm'):
apt_packages = apt_packages + WOVar.wo_php74
if not (WOAptGet.is_installed(self, 'php7.3-fpm') or
WOAptGet.is_installed(self, 'php7.2-fpm')):
apt_packages = apt_packages + WOVar.wo_php_extra
apt_packages = apt_packages + WOVar.wo_php74 + WOVar.wo_php_extra
if stype in ['mysql', 'wp', 'wpsubdir', 'wpsubdomain']:
Log.debug(self, "Setting apt_packages variable for MySQL")

View File

@@ -4,7 +4,13 @@ import os
from cement.core.controller import CementBaseController, expose
from wo.cli.plugins.site_functions import *
from wo.cli.plugins.site_functions import (
detSitePar, site_package_check,
pre_run_checks, setupdomain, SiteError,
setupdatabase, setupwordpress, setwebrootpermissions,
display_cache_settings, copyWildcardCert,
updatewpuserpassword, setupngxblocker, setupwp_plugin,
setupwordpressnetwork, installwp_plugin, sitebackup, uninstallwp_plugin)
from wo.cli.plugins.sitedb import (getAllsites,
getSiteInfo, updateSiteInfo)
from wo.core.acme import WOAcme

View File

@@ -166,7 +166,6 @@ class WOStackController(CementBaseController):
# Nginx
if pargs.nginx:
pargs.ngxblocker = True
Log.debug(self, "Setting apt_packages variable for Nginx")
if not WOAptGet.is_exec(self, 'nginx'):
apt_packages = apt_packages + WOVar.wo_nginx
@@ -767,9 +766,9 @@ class WOStackController(CementBaseController):
# netdata
if pargs.netdata:
Log.debug(self, "Removing Netdata")
if os.path.isfile('/opt/netdata/usr/'
'libexec/netdata/netdata-uninstaller.sh'):
if (os.path.exists('/opt/netdata') or
os.path.exists('/etc/netdata')):
Log.debug(self, "Removing Netdata")
packages = packages + ['/var/lib/wo/tmp/kickstart.sh']
# wordops dashboard
@@ -814,20 +813,28 @@ class WOStackController(CementBaseController):
WOService.stop_service(self, 'mysql')
# Netdata uninstaller
if (set(['/var/lib/wo/tmp/'
'kickstart.sh']).issubset(set(packages))):
if WOVar.wo_distro == 'Raspbian':
if '/var/lib/wo/tmp/kickstart.sh' in packages:
if os.path.exists(
'/usr/libexec/netdata/netdata-uninstaller.sh'):
Log.debug(self, "Uninstalling Netdata from /etc/netdata")
WOShellExec.cmd_exec(
self, "bash /usr/"
"libexec/netdata/"
"netdata-uninstaller.sh -y -f",
self, "bash /usr/libexec/netdata/netdata-"
"uninstaller.sh -y -f",
errormsg='', log=False)
packages = packages + ["/etc/netdata"]
elif os.path.exists(
'/opt/netdata/usr/libexec/'
'netdata/netdata-uninstaller.sh'):
Log.debug(self, "Uninstalling Netdata from /opt/netdata")
WOShellExec.cmd_exec(
self, "bash /opt/netdata/usr/libexec/netdata/netdata-"
"uninstaller.sh -y -f")
packages = packages + ["/opt/netdata"]
else:
WOShellExec.cmd_exec(
self, "bash /opt/netdata/usr/"
"libexec/netdata/"
"netdata-uninstaller.sh -y -f",
errormsg='', log=False)
Log.debug(self, "Netdata uninstaller not found")
if WOShellExec.cmd_exec(self, 'mysqladmin ping'):
WOMysql.execute(
self, "DELETE FROM mysql.user WHERE User = 'netdata';")
if (packages):
Log.wait(self, "Removing packages ")
@@ -1079,11 +1086,11 @@ class WOStackController(CementBaseController):
'{0}22222/htdocs/db/anemometer'
.format(WOVar.wo_webroot)
]
# netdata
if pargs.netdata:
Log.debug(self, "Removing Netdata")
if os.path.isfile('/opt/netdata/usr/'
'libexec/netdata/netdata-uninstaller.sh'):
if (os.path.exists('/opt/netdata') or
os.path.exists('/etc/netdata')):
Log.debug(self, "Removing Netdata")
packages = packages + ['/var/lib/wo/tmp/kickstart.sh']
# wordops dashboard
@@ -1123,23 +1130,35 @@ class WOStackController(CementBaseController):
WOService.stop_service(self, 'fail2ban')
if (set(["mariadb-server"]).issubset(set(apt_packages))):
if (os.path.isfile('/usr/bin/mysql') and
os.path.isdir('/var/lib/mysql')):
if self.app.config.has_section('stack'):
database_host = self.app.config.get(
'stack', 'ip-address')
else:
database_host = 'na'
if database_host == '127.0.0.1':
WOMysql.backupAll(self)
WOService.stop_service(self, 'mysql')
WOService.stop_service(self, 'mysql')
# Netdata uninstaller
if (set(['/var/lib/wo/tmp/'
'kickstart.sh']).issubset(set(packages))):
if WOVar.wo_distro == 'Raspbian':
WOShellExec.cmd_exec(self, "bash /usr/"
"libexec/netdata/netdata-"
"uninstaller.sh -y -f",
errormsg='', log=False)
if '/var/lib/wo/tmp/kickstart.sh' in packages:
if os.path.exists(
'/usr/libexec/netdata/netdata-uninstaller.sh'):
Log.debug(self, "Uninstalling Netdata from /etc/netdata")
WOShellExec.cmd_exec(
self, "bash /usr/libexec/netdata/netdata-"
"uninstaller.sh -y -f",
errormsg='', log=False)
packages = packages + ["/etc/netdata"]
elif os.path.exists(
'/opt/netdata/usr/libexec/'
'netdata/netdata-uninstaller.sh'):
Log.debug(self, "Uninstalling Netdata from /opt/netdata")
WOShellExec.cmd_exec(
self, "bash /opt/netdata/usr/libexec/netdata/netdata-"
"uninstaller.sh -y -f")
packages = packages + ["/opt/netdata"]
else:
WOShellExec.cmd_exec(self, "bash /opt/netdata/usr/"
"libexec/netdata/netdata-"
"uninstaller.sh -y -f")
Log.debug(self, "Netdata uninstaller not found")
if WOShellExec.cmd_exec(self, 'mysqladmin ping'):
WOMysql.execute(
self, "DELETE FROM mysql.user WHERE User = 'netdata';")

View File

@@ -156,6 +156,14 @@ def pre_pref(self, apt_packages):
WOVar.wo_platform_codename == 'xenial'):
Log.debug(self, 'Adding ppa for nano')
WORepo.add(self, ppa=WOVar.wo_ubuntu_backports)
else:
if not WOFileUtils.grepcheck(
self, '/etc/apt/sources.list/wo-repo.list',
'WordOps'):
Log.info(self, "Adding repository for Nano, please wait...")
Log.debug(self, 'Adding repository for Nano')
WORepo.add_key(self, WOVar.wo_nginx_key)
WORepo.add(self, repo_url=WOVar.wo_nginx_repo)
def post_pref(self, apt_packages, packages, upgrade=False):
@@ -249,34 +257,7 @@ def post_pref(self, apt_packages, packages, upgrade=False):
for wo_php in wo_php_version:
data = dict(upstream="{0}".format(wo_php),
release=WOVar.wo_version)
WOTemplate.deploy(self,
'{0}/{1}.conf'
.format(ngxcom, wo_php),
'php.mustache', data)
WOTemplate.deploy(
self, '{0}/redis-{1}.conf'.format(ngxcom, wo_php),
'redis.mustache', data)
WOTemplate.deploy(
self, '{0}/wpcommon-{1}.conf'.format(ngxcom, wo_php),
'wpcommon.mustache', data)
WOTemplate.deploy(
self, '{0}/wpfc-{1}.conf'.format(ngxcom, wo_php),
'wpfc.mustache', data)
WOTemplate.deploy(
self, '{0}/wpsc-{1}.conf'.format(ngxcom, wo_php),
'wpsc.mustache', data)
WOTemplate.deploy(
self, '{0}/wprocket-{1}.conf'.format(ngxcom, wo_php),
'wprocket.mustache', data)
WOTemplate.deploy(
self, '{0}/wpce-{1}.conf'.format(ngxcom, wo_php),
'wpce.mustache', data)
WOConf.nginxcommon(self)
except CommandExecutionError as e:
Log.debug(self, "{0}".format(e))
@@ -341,11 +322,14 @@ def post_pref(self, apt_packages, packages, upgrade=False):
os.makedirs('/etc/nginx/sites-enabled')
# 22222 port settings
data = dict(webroot=ngxroot, release=WOVar.wo_version)
WOTemplate.deploy(
self,
'/etc/nginx/sites-available/22222',
'22222.mustache', data, overwrite=True)
data = dict(webroot=ngxroot,
release=WOVar.wo_version, port='22222')
if not WOFileUtils.grepcheck(
self, 'WordOps', '/etc/nginx/sites-available/22222'):
WOTemplate.deploy(
self,
'/etc/nginx/sites-available/22222',
'22222.mustache', data, overwrite=True)
passwd = ''.join([random.choice
(string.ascii_letters + string.digits)
for n in range(24)])
@@ -486,7 +470,7 @@ def post_pref(self, apt_packages, packages, upgrade=False):
WOShellExec.cmd_exec(self, 'systemctl daemon-reload')
WOService.restart_service(self, 'nginx')
if set(WOVar.wo_php72).issubset(set(apt_packages)):
if 'php7.2-fpm' in apt_packages:
WOGit.add(self, ["/etc/php"], msg="Adding PHP into Git")
Log.info(self, "Configuring php7.2-fpm")
ngxroot = '/var/www/'
@@ -627,6 +611,9 @@ def post_pref(self, apt_packages, packages, upgrade=False):
'www-data',
'www-data', recursive=True)
# enable imagick php extension
WOShellExec.cmd_exec(self, 'phpenmod -v ALL imagick')
# check service restart or rollback configuration
if not WOService.restart_service(self, 'php7.2-fpm'):
WOGit.rollback(self, ["/etc/php"], msg="Rollback PHP")
@@ -773,6 +760,10 @@ def post_pref(self, apt_packages, packages, upgrade=False):
.format(ngxroot),
'www-data',
'www-data', recursive=True)
# enable imagick php extension
WOShellExec.cmd_exec(self, 'phpenmod -v ALL imagick')
# check service restart or rollback configuration
if not WOService.restart_service(self, 'php7.3-fpm'):
WOGit.rollback(self, ["/etc/php"], msg="Rollback PHP")
@@ -919,6 +910,10 @@ def post_pref(self, apt_packages, packages, upgrade=False):
.format(ngxroot),
'www-data',
'www-data', recursive=True)
# enable imagick php extension
WOShellExec.cmd_exec(self, 'phpenmod -v ALL imagick')
# check service restart or rollback configuration
if not WOService.restart_service(self, 'php7.4-fpm'):
WOGit.rollback(self, ["/etc/php"], msg="Rollback PHP")
@@ -1386,7 +1381,7 @@ def post_pref(self, apt_packages, packages, upgrade=False):
Log.wait(self, "Installing Netdata")
WOShellExec.cmd_exec(
self, "bash /var/lib/wo/tmp/kickstart.sh "
"--dont-wait", errormsg='', log=False)
"--dont-wait --no-updates", errormsg='', log=False)
Log.valide(self, "Installing Netdata")
if os.path.isdir('/etc/netdata'):
wo_netdata = "/"

View File

@@ -11,6 +11,7 @@ from wo.core.fileutils import WOFileUtils
from wo.core.logging import Log
from wo.core.shellexec import WOShellExec
from wo.core.variables import WOVar
from wo.core.services import WOService
class WOStackUpgradeController(CementBaseController):
@@ -360,29 +361,14 @@ class WOStackUpgradeController(CementBaseController):
# Netdata
if WOAptGet.is_selected(self, 'Netdata', packages):
WOService.stop_service(self, 'netdata')
Log.wait(self, "Upgrading Netdata")
# detect static binaries install
if os.path.isdir('/opt/netdata'):
if os.path.exists(
'/opt/netdata/usr/libexec/'
'netdata/netdata-updater.sh'):
WOShellExec.cmd_exec(
self, "bash /opt/netdata/usr/"
"libexec/netdata/netdata-"
"updater.sh")
else:
WOShellExec.cmd_exec(
self, "bash /var/lib/wo/tmp/kickstart.sh")
# detect install from source
elif os.path.isdir('/etc/netdata'):
if os.path.exists(
'/usr/libexec/netdata/netdata-updater.sh'):
WOShellExec.cmd_exec(
self,
'bash /usr/libexec/netdata/netdata-updater.sh')
else:
WOShellExec.cmd_exec(
self, "bash /var/lib/wo/tmp/kickstart.sh")
WOShellExec.cmd_exec(
self,
"bash /var/lib/wo/tmp/kickstart.sh "
"--dont-wait --no-updates",
errormsg='', log=False)
Log.valide(self, "Upgrading Netdata")
if WOAptGet.is_selected(self, 'WordOps Dashboard', packages):

View File

@@ -2,13 +2,13 @@
server {
listen 22222 default_server ssl http2;
listen {{port}} default_server ssl http2;
access_log /var/log/nginx/22222.access.log rt_cache;
error_log /var/log/nginx/22222.error.log;
# Force HTTP to HTTPS
error_page 497 =200 https://$host:22222$request_uri;
error_page 497 =200 https://$host:{{port}}$request_uri;
root {{webroot}}22222/htdocs;
index index.php index.htm index.html;

View File

@@ -1,4 +1,5 @@
Information about {{domain}}:
Information about {{domain}} ({{domain_type}}):
Nginx configuration {{type}} {{enable}}
{{#php_version}}PHP Version {{php_version}}{{/php_version}}

View File

@@ -4,6 +4,12 @@
upstream phpstatus {
server unix:/run/php/php72-fpm.sock;
}
upstream php73opcache {
server unix:/run/php/php73-fpm.sock;
}
upstream php74opcache {
server unix:/run/php/php74-fpm.sock;
}
{{/phpconf}}
server {
listen 127.0.0.1:80;
@@ -33,21 +39,21 @@ server {
location /cache/opcache/php72.php {
try_files $uri =404;
include fastcgi_params;
fastcgi_pass php72;
fastcgi_pass phpstatus;
access_log off;
log_not_found off;
}
location /cache/opcache/php73.php {
try_files $uri =404;
include fastcgi_params;
fastcgi_pass php73;
fastcgi_pass php73opcache;
access_log off;
log_not_found off;
}
location /cache/opcache/php74.php {
try_files $uri =404;
include fastcgi_params;
fastcgi_pass php74;
fastcgi_pass php74opcache;
access_log off;
log_not_found off;
}

View File

@@ -48,7 +48,7 @@ location /wp-content/uploads {
try_files $uri$webp_suffix $uri =404;
}
location ~* \.(php|gz|log|zip|tar|rar|xz)$ {
#Prevent Direct Access Of PHP Files & BackupsFrom Web Browsers
#Prevent Direct Access Of PHP Files & Backups from Web Browsers
deny all;
}
}
@@ -95,6 +95,6 @@ location ~ \/wp-admin\/load-(scripts|styles).php {
deny all;
}
# Protect Easy Digital Download files from being accessed directly.
location ~ ^/wp-content/uploads/edd/(.*?)\.zip$ {
rewrite / permanent;
location ~ ^/wp-content/uploads/edd/(.*?)\.zip$ {
rewrite / permanent;
}

View File

@@ -188,20 +188,8 @@ class WOAcme:
"""Check if a list of domains point to the server IP"""
server_ip = requests.get('https://v4.wordops.eu/').text
for domain in acme_domains:
url = (
"https://cloudflare-dns.com/dns-query?name={0}&type=A"
.format(domain))
headers = {
'accept': 'application/dns-json'
}
try:
response = requests.get(url, headers=headers).json()
domain_ip = response["Answer"][0]['data']
except requests.RequestException:
Log.error(
self, 'Resolving domain IP failed.\n'
'The domain {0} do not exist or a DNS record is missing'
.format(domain))
domain_ip = requests.get('http://v4.wordops.eu/dns/{0}/'
.format(domain)).text
if(not domain_ip == server_ip):
Log.warn(
self, "{0}".format(domain) +
@@ -228,8 +216,13 @@ class WOAcme:
if wo_domain_name == row[0]:
# check if cert expiration exist
if not row[3] == '':
return True
acme_cert = True
certfile.close()
if acme_cert is True:
if os.path.exists(
'/etc/letsencrypt/live/{0}/fullchain.pem'
.format(wo_domain_name)):
return True
return False
def removeconf(self, domain):

View File

@@ -14,9 +14,9 @@ class WOConf():
"""nginx common configuration deployment"""
wo_php_version = ["php72", "php73", "php74"]
ngxcom = '/etc/nginx/common'
if not os.path.exists(ngxcom):
os.mkdir(ngxcom)
for wo_php in wo_php_version:
if not os.path.exists(ngxcom):
os.mkdir(ngxcom)
Log.debug(self, 'deploying templates for {0}'.format(wo_php))
data = dict(upstream="{0}".format(wo_php),
release=WOVar.wo_version)

View File

@@ -14,11 +14,11 @@ class WOVar():
"""Intialization of core variables"""
# WordOps version
wo_version = "3.11.2"
wo_version = "3.11.3"
# WordOps packages versions
wo_wp_cli = "2.4.0"
wo_adminer = "4.7.5"
wo_phpmyadmin = "4.9.2"
wo_phpmyadmin = "5.0.1"
wo_extplorer = "2.1.13"
wo_dashboard = "1.2"