Merge pull request #279 from WordOps/updating-configuration
v3.12.0 release
This commit is contained in:
@@ -133,15 +133,16 @@ class WOSecureController(CementBaseController):
|
||||
@expose(hide=True)
|
||||
def secure_ip(self):
|
||||
"""IP whitelisting"""
|
||||
WOGit.add(self, ["/etc/nginx"],
|
||||
msg="Add Nginx to into Git")
|
||||
if os.path.exists('/etc/nginx'):
|
||||
WOGit.add(self, ["/etc/nginx"],
|
||||
msg="Add Nginx to into Git")
|
||||
pargs = self.app.pargs
|
||||
if not pargs.user_input:
|
||||
ip = input("Enter the comma separated IP addresses "
|
||||
"to white list [127.0.0.1]:")
|
||||
pargs.user_input = ip
|
||||
try:
|
||||
user_ip = pargs.user_input.split(',')
|
||||
user_ip = pargs.user_input.strip().split(',')
|
||||
except Exception as e:
|
||||
Log.debug(self, "{0}".format(e))
|
||||
user_ip = ['127.0.0.1']
|
||||
@@ -170,8 +171,9 @@ class WOSecureController(CementBaseController):
|
||||
'Harden SSH security [y/N]')
|
||||
if start_secure != "Y" and start_secure != "y":
|
||||
Log.error(self, "Not hardening SSH security")
|
||||
WOGit.add(self, ["/etc/ssh"],
|
||||
msg="Adding SSH into Git")
|
||||
if os.path.exists('/etc/ssh'):
|
||||
WOGit.add(self, ["/etc/ssh"],
|
||||
msg="Adding SSH into Git")
|
||||
Log.debug(self, "check if /etc/ssh/sshd_config exist")
|
||||
if os.path.isfile('/etc/ssh/sshd_config'):
|
||||
Log.debug(self, "looking for the current ssh port")
|
||||
|
||||
@@ -211,21 +211,35 @@ class WOSiteCreateController(CementBaseController):
|
||||
else:
|
||||
pass
|
||||
|
||||
data['php73'] = False
|
||||
data['php74'] = False
|
||||
data['php72'] = False
|
||||
|
||||
if data and pargs.php73:
|
||||
data['php73'] = True
|
||||
data['php74'] = False
|
||||
data['php72'] = False
|
||||
data['wo_php'] = 'php73'
|
||||
elif data and pargs.php74:
|
||||
data['php72'] = False
|
||||
data['php74'] = True
|
||||
data['php73'] = False
|
||||
data['wo_php'] = 'php74'
|
||||
else:
|
||||
data['php74'] = False
|
||||
elif data and pargs.php72:
|
||||
data['php72'] = True
|
||||
data['php73'] = False
|
||||
data['wo_php'] = 'php72'
|
||||
else:
|
||||
if self.app.config.has_section('php'):
|
||||
config_php_ver = self.app.config.get(
|
||||
'php', 'version')
|
||||
if config_php_ver == '7.2':
|
||||
data['php72'] = True
|
||||
data['wo_php'] = 'php72'
|
||||
elif config_php_ver == '7.3':
|
||||
data['php73'] = True
|
||||
data['wo_php'] = 'php73'
|
||||
elif config_php_ver == '7.4':
|
||||
data['php74'] = True
|
||||
data['wo_php'] = 'php74'
|
||||
else:
|
||||
data['php73'] = True
|
||||
data['wo_php'] = 'php73'
|
||||
|
||||
if ((not pargs.wpfc) and (not pargs.wpsc) and
|
||||
(not pargs.wprocket) and
|
||||
@@ -288,12 +302,12 @@ class WOSiteCreateController(CementBaseController):
|
||||
" http://{0}".format(wo_domain))
|
||||
return
|
||||
|
||||
if data['php73']:
|
||||
php_version = "7.3"
|
||||
if data['php72']:
|
||||
php_version = "7.2"
|
||||
elif data['php74']:
|
||||
php_version = "7.4"
|
||||
else:
|
||||
php_version = "7.2"
|
||||
php_version = "7.3"
|
||||
|
||||
addNewSite(self, wo_domain, stype, cache, wo_site_webroot,
|
||||
php_version=php_version)
|
||||
|
||||
@@ -871,26 +871,46 @@ def site_package_check(self, stype):
|
||||
wo_nginx.write('fastcgi_param \tSCRIPT_FILENAME '
|
||||
'\t$request_filename;\n')
|
||||
|
||||
if pargs.php and pargs.php73:
|
||||
if ((pargs.php and pargs.php73) or (pargs.php and pargs.php74) or
|
||||
(pargs.php and pargs.php72) or
|
||||
(pargs.php73 and pargs.php74) or (pargs.php72 and pargs.php73) or
|
||||
(pargs.php72 and pargs.php74)):
|
||||
Log.error(
|
||||
self, "Error: two different PHP versions cannot be "
|
||||
"combined within the same WordOps site")
|
||||
|
||||
if pargs.php and pargs.php74:
|
||||
Log.error(
|
||||
self, "Error: two different PHP versions cannot be "
|
||||
"combined within the same WordOps site")
|
||||
|
||||
if pargs.php73 and pargs.php74:
|
||||
Log.error(
|
||||
self, "Error: two different PHP versions cannot be "
|
||||
"combined within the same WordOps site")
|
||||
|
||||
if ((not pargs.php73) and (not pargs.php74) and
|
||||
stype in ['php', 'php72', 'mysql', 'wp', 'wpsubdir',
|
||||
if ((not pargs.php72) and (not pargs.php73) and (not pargs.php74) and
|
||||
stype in ['php', 'mysql', 'wp', 'wpsubdir',
|
||||
'wpsubdomain']):
|
||||
Log.debug(self, "Setting apt_packages variable for PHP")
|
||||
php_check = 'php7.3-fpm'
|
||||
php_to_setup = WOVar.wo_php73
|
||||
if self.app.config.has_section('php'):
|
||||
config_php_ver = self.app.config.get(
|
||||
'php', 'version')
|
||||
if config_php_ver == '7.2':
|
||||
php_check = 'php7.2-fpm'
|
||||
php_to_setup = WOVar.wo_php72
|
||||
elif config_php_ver == '7.3':
|
||||
php_check = 'php7.3-fpm'
|
||||
php_to_setup = WOVar.wo_php73
|
||||
elif config_php_ver == '7.4':
|
||||
php_check = 'php7.4-fpm'
|
||||
php_to_setup = WOVar.wo_php74
|
||||
else:
|
||||
php_check = 'php7.3-fpm'
|
||||
php_to_setup = WOVar.wo_php73
|
||||
else:
|
||||
php_check = 'php7.3-fpm'
|
||||
php_to_setup = WOVar.wo_php73
|
||||
|
||||
if not (WOAptGet.is_installed(self, php_check)):
|
||||
apt_packages = apt_packages + php_to_setup + WOVar.wo_php_extra
|
||||
|
||||
if pargs.php72 and stype in ['php72', 'mysql', 'wp',
|
||||
'wpsubdir', 'wpsubdomain']:
|
||||
Log.debug(self, "Setting apt_packages variable for PHP 7.2")
|
||||
if not (WOAptGet.is_installed(self, 'php7.2-fpm')):
|
||||
if not WOAptGet.is_installed(self, 'php7.2-fpm'):
|
||||
apt_packages = apt_packages + WOVar.wo_php72 + WOVar.wo_php_extra
|
||||
|
||||
if pargs.php73 and stype in ['php73', 'mysql', 'wp',
|
||||
|
||||
@@ -220,7 +220,6 @@ class WOSiteUpdateController(CementBaseController):
|
||||
Log.error(
|
||||
self, "service nginx reload failed. "
|
||||
"check issues with `nginx -t` command")
|
||||
return 0
|
||||
|
||||
# setup ngxblocker
|
||||
if (pargs.ngxblocker):
|
||||
@@ -244,7 +243,6 @@ class WOSiteUpdateController(CementBaseController):
|
||||
if not WOService.reload_service(self, 'nginx'):
|
||||
Log.error(self, "service nginx reload failed. "
|
||||
"check issues with `nginx -t` command")
|
||||
return 0
|
||||
|
||||
# letsencryot rebew
|
||||
if (pargs.letsencrypt == 'renew'):
|
||||
@@ -533,8 +531,8 @@ class WOSiteUpdateController(CementBaseController):
|
||||
data['wo_php'] = 'php72'
|
||||
check_php_version = '7.2'
|
||||
else:
|
||||
data['wo_php'] = 'php72'
|
||||
check_php_version = '7.2'
|
||||
data['wo_php'] = 'php73'
|
||||
check_php_version = '7.3'
|
||||
|
||||
if pargs.hsts:
|
||||
data['hsts'] = bool(pargs.hsts == "on")
|
||||
@@ -614,8 +612,9 @@ class WOSiteUpdateController(CementBaseController):
|
||||
'www.{0}'.format(wo_domain)]
|
||||
|
||||
if WOAcme.cert_check(self, wo_domain):
|
||||
SSL.archivedcertificatehandle(
|
||||
self, wo_domain, acme_domains)
|
||||
if SSL.archivedcertificatehandle(
|
||||
self, wo_domain, acme_domains):
|
||||
letsencrypt = True
|
||||
else:
|
||||
if acme_subdomain:
|
||||
Log.debug(self, "checkWildcardExist on *.{0}"
|
||||
@@ -676,6 +675,7 @@ class WOSiteUpdateController(CementBaseController):
|
||||
"check issues with `nginx -t` command")
|
||||
Log.info(self, "Congratulations! Successfully "
|
||||
"Configured SSL on https://{0}".format(wo_domain))
|
||||
letsencrypt = True
|
||||
if (SSL.getexpirationdays(self, wo_domain) > 0):
|
||||
Log.info(self, "Your cert will expire within " +
|
||||
str(SSL.getexpirationdays(self, wo_domain)) +
|
||||
@@ -725,8 +725,9 @@ class WOSiteUpdateController(CementBaseController):
|
||||
# auto-renewal") WOCron.remove_cron(self,'wo site
|
||||
# update {0} --le=renew --min_expiry_limit 30
|
||||
# 2> \/dev\/null'.format(wo_domain))
|
||||
Log.info(self, "Successfully Disabled SSl for Site "
|
||||
" http://{0}".format(wo_domain))
|
||||
Log.info(self, "Successfully Disabled SSl for Site "
|
||||
" http://{0}".format(wo_domain))
|
||||
letsencrypt = False
|
||||
|
||||
# Add nginx conf folder into GIT
|
||||
WOGit.add(self, ["{0}/conf/nginx".format(wo_site_webroot)],
|
||||
|
||||
@@ -142,7 +142,7 @@ class WOStackController(CementBaseController):
|
||||
|
||||
if pargs.web:
|
||||
pargs.nginx = True
|
||||
pargs.php72 = True
|
||||
pargs.php73 = True
|
||||
pargs.mysql = True
|
||||
pargs.wpcli = True
|
||||
pargs.sendmail = True
|
||||
@@ -158,6 +158,7 @@ class WOStackController(CementBaseController):
|
||||
pargs.phpredisadmin = True
|
||||
pargs.extplorer = True
|
||||
pargs.cheat = True
|
||||
pargs.nanorc = True
|
||||
|
||||
if pargs.security:
|
||||
pargs.fail2ban = True
|
||||
@@ -178,7 +179,7 @@ class WOStackController(CementBaseController):
|
||||
apt_packages = apt_packages + WOVar.wo_redis
|
||||
|
||||
else:
|
||||
Log.info(self, "Redis already installed")
|
||||
Log.debug(self, "Redis already installed")
|
||||
|
||||
# PHP 7.2
|
||||
if pargs.php72:
|
||||
@@ -298,10 +299,11 @@ class WOStackController(CementBaseController):
|
||||
if not os.path.isdir('/var/www/22222/htdocs/db/pma'):
|
||||
Log.debug(self, "Setting packages variable "
|
||||
"for phpMyAdmin ")
|
||||
packages = packages + [["https://github.com/phpmyadmin/"
|
||||
"phpmyadmin/archive/STABLE.tar.gz",
|
||||
"/var/lib/wo/tmp/pma.tar.gz",
|
||||
"phpMyAdmin"]]
|
||||
packages = packages + [[
|
||||
"https://www.phpmyadmin.net/"
|
||||
"downloads/phpMyAdmin-latest-all-languages.tar.gz",
|
||||
"/var/lib/wo/tmp/pma.tar.gz",
|
||||
"PHPMyAdmin"]]
|
||||
else:
|
||||
Log.debug(self, "phpMyAdmin already installed")
|
||||
Log.info(self, "phpMyAdmin already installed")
|
||||
@@ -344,10 +346,7 @@ class WOStackController(CementBaseController):
|
||||
.format(WOVar.wo_webroot)):
|
||||
Log.debug(self, "Setting packages variable for Adminer ")
|
||||
packages = packages + [[
|
||||
"https://github.com/vrana/adminer/"
|
||||
"releases/download/v{0}"
|
||||
"/adminer-{0}.php"
|
||||
.format(WOVar.wo_adminer),
|
||||
"https://www.adminer.org/latest.php",
|
||||
"{0}22222/"
|
||||
"htdocs/db/adminer/index.php"
|
||||
.format(WOVar.wo_webroot),
|
||||
@@ -588,7 +587,7 @@ class WOStackController(CementBaseController):
|
||||
|
||||
if pargs.web:
|
||||
pargs.nginx = True
|
||||
pargs.php72 = True
|
||||
pargs.php73 = True
|
||||
pargs.mysql = True
|
||||
pargs.wpcli = True
|
||||
pargs.sendmail = True
|
||||
@@ -899,7 +898,7 @@ class WOStackController(CementBaseController):
|
||||
|
||||
if pargs.web:
|
||||
pargs.nginx = True
|
||||
pargs.php72 = True
|
||||
pargs.php73 = True
|
||||
pargs.mysql = True
|
||||
pargs.wpcli = True
|
||||
pargs.sendmail = True
|
||||
@@ -1123,20 +1122,17 @@ class WOStackController(CementBaseController):
|
||||
if start_purge != "Y" and start_purge != "y":
|
||||
Log.error(self, "Not starting stack purge")
|
||||
|
||||
if (set(["nginx-custom"]).issubset(set(apt_packages))):
|
||||
if "nginx-custom" in apt_packages:
|
||||
WOService.stop_service(self, 'nginx')
|
||||
|
||||
if (set(["fail2ban"]).issubset(set(apt_packages))):
|
||||
if "fail2ban" in apt_packages:
|
||||
WOService.stop_service(self, 'fail2ban')
|
||||
|
||||
if (set(["mariadb-server"]).issubset(set(apt_packages))):
|
||||
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)
|
||||
if "mariadb-server" in apt_packages:
|
||||
if self.app.config.has_section('mysql'):
|
||||
if self.app.config.get(
|
||||
'mysql', 'grant-host') == 'localhost':
|
||||
WOMysql.backupAll(self)
|
||||
WOService.stop_service(self, 'mysql')
|
||||
|
||||
# Netdata uninstaller
|
||||
|
||||
@@ -21,6 +21,7 @@ from wo.core.sslutils import SSL
|
||||
from wo.core.template import WOTemplate
|
||||
from wo.core.variables import WOVar
|
||||
from wo.core.stackconf import WOConf
|
||||
from wo.core.download import WODownload
|
||||
|
||||
|
||||
def pre_pref(self, apt_packages):
|
||||
@@ -28,7 +29,7 @@ def pre_pref(self, apt_packages):
|
||||
|
||||
if ("mariadb-server" in apt_packages or "mariadb-client" in apt_packages):
|
||||
# add mariadb repository excepted on raspbian and ubuntu 19.04
|
||||
if (not WOVar.wo_distro == 'raspbian'):
|
||||
if ((not WOVar.wo_distro == 'raspbian') and (not WOVar.wo_platform_codename == 'focal')):
|
||||
Log.info(self, "Adding repository for MySQL, please wait...")
|
||||
mysql_pref = (
|
||||
"Package: *\nPin: origin mariadb.mirrors.ovh.net"
|
||||
@@ -322,14 +323,28 @@ def post_pref(self, apt_packages, packages, upgrade=False):
|
||||
os.makedirs('/etc/nginx/sites-enabled')
|
||||
|
||||
# 22222 port settings
|
||||
if os.path.exists('/etc/nginx/sites-available/22222'):
|
||||
Log.debug(self, "looking for the current backend port")
|
||||
for line in open('/etc/nginx/sites-available/22222',
|
||||
encoding='utf-8'):
|
||||
if 'listen' in line:
|
||||
listen_line = line.strip()
|
||||
break
|
||||
port = (listen_line).split(' ')
|
||||
current_backend_port = (port[1]).strip()
|
||||
else:
|
||||
current_backend_port = '22222'
|
||||
|
||||
if 'current_backend_port' not in locals():
|
||||
current_backend_port = '22222'
|
||||
|
||||
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)
|
||||
release=WOVar.wo_version, port=current_backend_port)
|
||||
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)])
|
||||
@@ -400,7 +415,7 @@ def post_pref(self, apt_packages, packages, upgrade=False):
|
||||
.format(ngxroot))):
|
||||
SSL.selfsignedcert(self, proftpd=False, backend=True)
|
||||
|
||||
if not os.path.isfile('{0}22222/conf/nginx/ssl.conf'
|
||||
if not os.path.exists('{0}22222/conf/nginx/ssl.conf'
|
||||
.format(ngxroot)):
|
||||
with open("/var/www/22222/conf/nginx/"
|
||||
"ssl.conf", "w") as php_file:
|
||||
@@ -805,6 +820,7 @@ def post_pref(self, apt_packages, packages, upgrade=False):
|
||||
config['opcache']['opcache.revalidate_freq'] = '5'
|
||||
config['opcache']['opcache.consistency_checks'] = '0'
|
||||
config['opcache']['opcache.validate_timestamps'] = '1'
|
||||
config['opcache']['opcache.preload_user'] = 'www-data'
|
||||
with open('/etc/php/7.4/fpm/php.ini',
|
||||
encoding='utf-8', mode='w') as configfile:
|
||||
Log.debug(self, "Writting php configuration into "
|
||||
@@ -943,6 +959,7 @@ def post_pref(self, apt_packages, packages, upgrade=False):
|
||||
config_file.write(config)
|
||||
config_file.close()
|
||||
else:
|
||||
# make sure root account have all privileges
|
||||
if "PASSWORD" not in WOShellExec.cmd_exec_stdout(
|
||||
self, 'mysql -e "use mysql; show grants;"'):
|
||||
try:
|
||||
@@ -983,8 +1000,12 @@ def post_pref(self, apt_packages, packages, upgrade=False):
|
||||
inno_buffer=wo_ram_innodb,
|
||||
inno_log_buffer=wo_ram_log_buffer,
|
||||
innodb_instances=wo_innodb_instance)
|
||||
WOTemplate.deploy(
|
||||
self, '/etc/mysql/my.cnf', 'my.mustache', data)
|
||||
if os.path.exists('/etc/mysql/mariadb.conf.d/50-server.cnf'):
|
||||
WOTemplate.deploy(
|
||||
self, '/etc/mysql/my.cnf', 'my.mustache', data)
|
||||
else:
|
||||
WOTemplate.deploy(
|
||||
self, '/etc/mysql/my.cnf', 'my.mustache', data)
|
||||
# replacing default values
|
||||
Log.debug(self, "Tuning MySQL configuration")
|
||||
if os.path.isdir('/etc/systemd/system/mariadb.service.d'):
|
||||
@@ -1016,32 +1037,34 @@ def post_pref(self, apt_packages, packages, upgrade=False):
|
||||
# create fail2ban configuration files
|
||||
if "fail2ban" in apt_packages:
|
||||
WOService.restart_service(self, 'fail2ban')
|
||||
WOGit.add(self, ["/etc/fail2ban"],
|
||||
msg="Adding Fail2ban into Git")
|
||||
Log.info(self, "Configuring Fail2Ban")
|
||||
data = dict(release=WOVar.wo_version)
|
||||
WOTemplate.deploy(
|
||||
self,
|
||||
'/etc/fail2ban/jail.d/custom.conf',
|
||||
'fail2ban.mustache',
|
||||
data, overwrite=False)
|
||||
WOTemplate.deploy(
|
||||
self,
|
||||
'/etc/fail2ban/filter.d/wo-wordpress.conf',
|
||||
'fail2ban-wp.mustache',
|
||||
data, overwrite=False)
|
||||
WOTemplate.deploy(
|
||||
self,
|
||||
'/etc/fail2ban/filter.d/nginx-forbidden.conf',
|
||||
'fail2ban-forbidden.mustache',
|
||||
data, overwrite=False)
|
||||
|
||||
if not WOService.reload_service(self, 'fail2ban'):
|
||||
WOGit.rollback(
|
||||
self, ['/etc/fail2ban'], msg="Rollback f2b config")
|
||||
else:
|
||||
if os.path.exists('/etc/fail2ban'):
|
||||
WOGit.add(self, ["/etc/fail2ban"],
|
||||
msg="Adding Fail2ban into Git")
|
||||
Log.info(self, "Configuring Fail2Ban")
|
||||
data = dict(release=WOVar.wo_version)
|
||||
WOTemplate.deploy(
|
||||
self,
|
||||
'/etc/fail2ban/jail.d/custom.conf',
|
||||
'fail2ban.mustache',
|
||||
data, overwrite=False)
|
||||
WOTemplate.deploy(
|
||||
self,
|
||||
'/etc/fail2ban/filter.d/wo-wordpress.conf',
|
||||
'fail2ban-wp.mustache',
|
||||
data, overwrite=False)
|
||||
WOTemplate.deploy(
|
||||
self,
|
||||
'/etc/fail2ban/filter.d/nginx-forbidden.conf',
|
||||
'fail2ban-forbidden.mustache',
|
||||
data, overwrite=False)
|
||||
|
||||
if not WOService.reload_service(self, 'fail2ban'):
|
||||
WOGit.rollback(
|
||||
self, ['/etc/fail2ban'], msg="Rollback f2b config")
|
||||
WOService.restart_service(self, 'fail2ban')
|
||||
else:
|
||||
WOGit.add(self, ["/etc/fail2ban"],
|
||||
msg="Adding Fail2ban into Git")
|
||||
|
||||
# Proftpd configuration
|
||||
if "proftpd-basic" in apt_packages:
|
||||
@@ -1091,8 +1114,8 @@ def post_pref(self, apt_packages, packages, upgrade=False):
|
||||
Log.debug(self, "{0}".format(e))
|
||||
Log.error(self, "Unable to add UFW rules")
|
||||
|
||||
if ((os.path.isfile("/etc/fail2ban/jail.d/custom.conf")) and
|
||||
(not WOFileUtils.grep(
|
||||
if ((os.path.exists("/etc/fail2ban/jail.d/custom.conf")) and
|
||||
(not WOFileUtils.grepcheck(
|
||||
self, "/etc/fail2ban/jail.d/custom.conf",
|
||||
"proftpd"))):
|
||||
with open("/etc/fail2ban/jail.d/custom.conf",
|
||||
@@ -1248,6 +1271,7 @@ def post_pref(self, apt_packages, packages, upgrade=False):
|
||||
# PHPMyAdmin
|
||||
if any('/var/lib/wo/tmp/pma.tar.gz' == x[1]
|
||||
for x in packages):
|
||||
wo_phpmyadmin = WODownload.pma_release(self)
|
||||
WOExtract.extract(
|
||||
self, '/var/lib/wo/tmp/pma.tar.gz', '/var/lib/wo/tmp/')
|
||||
Log.debug(self, 'Extracting file /var/lib/wo/tmp/pma.tar.gz to '
|
||||
@@ -1261,7 +1285,9 @@ def post_pref(self, apt_packages, packages, upgrade=False):
|
||||
.format(WOVar.wo_webroot))
|
||||
if not os.path.exists('{0}22222/htdocs/db/pma/'
|
||||
.format(WOVar.wo_webroot)):
|
||||
shutil.move('/var/lib/wo/tmp/phpmyadmin-STABLE/',
|
||||
shutil.move('/var/lib/wo/tmp/phpMyAdmin-{0}'
|
||||
'-all-languages/'
|
||||
.format(wo_phpmyadmin),
|
||||
'{0}22222/htdocs/db/pma/'
|
||||
.format(WOVar.wo_webroot))
|
||||
shutil.copyfile('{0}22222/htdocs/db/pma'
|
||||
@@ -1683,6 +1709,7 @@ def pre_stack(self):
|
||||
if not os.path.isfile('/opt/wo-kernel.sh'):
|
||||
WOTemplate.deploy(self, '/opt/wo-kernel.sh',
|
||||
'wo-kernel-script.mustache', data)
|
||||
WOFileUtils.chmod(self, '/opt/wo-kernel.sh', 0o700)
|
||||
if not os.path.isfile('/lib/systemd/system/wo-kernel.service'):
|
||||
WOTemplate.deploy(
|
||||
self, '/lib/systemd/system/wo-kernel.service',
|
||||
|
||||
@@ -76,6 +76,7 @@ class WOStackUpgradeController(CementBaseController):
|
||||
packages = []
|
||||
self.msg = []
|
||||
pargs = self.app.pargs
|
||||
wo_phpmyadmin = WODownload.pma_release(self)
|
||||
if not (pargs.web or pargs.nginx or pargs.php or
|
||||
pargs.php72 or pargs.php73 or pargs.php74 or pargs.mysql or
|
||||
pargs.ngxblocker or pargs.all or pargs.netdata or
|
||||
@@ -207,7 +208,7 @@ class WOStackUpgradeController(CementBaseController):
|
||||
"https://files.phpmyadmin.net"
|
||||
"/phpMyAdmin/{0}/phpMyAdmin-{0}-"
|
||||
"all-languages.tar.gz"
|
||||
.format(WOVar.wo_phpmyadmin),
|
||||
.format(wo_phpmyadmin),
|
||||
"/var/lib/wo/tmp/pma.tar.gz",
|
||||
"PHPMyAdmin"]]
|
||||
else:
|
||||
@@ -220,10 +221,7 @@ class WOStackUpgradeController(CementBaseController):
|
||||
.format(WOVar.wo_webroot)):
|
||||
Log.debug(self, "Setting packages variable for Adminer ")
|
||||
packages = packages + [[
|
||||
"https://github.com/vrana/adminer/"
|
||||
"releases/download/v{0}"
|
||||
"/adminer-{0}.php"
|
||||
.format(WOVar.wo_adminer),
|
||||
"https://www.adminer.org/latest.php",
|
||||
"{0}22222/"
|
||||
"htdocs/db/adminer/index.php"
|
||||
.format(WOVar.wo_webroot),
|
||||
@@ -403,13 +401,13 @@ class WOStackUpgradeController(CementBaseController):
|
||||
.format(WOVar.wo_webroot)),
|
||||
('/var/lib/wo/tmp/phpMyAdmin-{0}'
|
||||
'-all-languages/config.inc.php'
|
||||
.format(WOVar.wo_phpmyadmin))
|
||||
.format(wo_phpmyadmin))
|
||||
)
|
||||
WOFileUtils.rm(self, '{0}22222/htdocs/db/pma'
|
||||
.format(WOVar.wo_webroot))
|
||||
shutil.move('/var/lib/wo/tmp/phpMyAdmin-{0}'
|
||||
'-all-languages/'
|
||||
.format(WOVar.wo_phpmyadmin),
|
||||
.format(wo_phpmyadmin),
|
||||
'{0}22222/htdocs/db/pma/'
|
||||
.format(WOVar.wo_webroot))
|
||||
WOFileUtils.chown(self, "{0}22222/htdocs"
|
||||
|
||||
@@ -143,7 +143,7 @@ innodb_file_per_table = 1
|
||||
innodb_open_files = 500000
|
||||
innodb_io_capacity = 500000
|
||||
innodb_flush_method = O_DIRECT
|
||||
innodb_buffer_pool_instances = {{innodb_instances}}
|
||||
innodb_buffer_pool_instances = 1
|
||||
#
|
||||
# * Security Features
|
||||
#
|
||||
|
||||
@@ -64,6 +64,13 @@ fs.suid_dumpable = 0
|
||||
# Hide exposed kernel pointers
|
||||
kernel.kptr_restrict = 1
|
||||
|
||||
# Restrict access to kernel logs
|
||||
kernel.dmesg_restrict = 1
|
||||
|
||||
# Restrict ptrace scope
|
||||
kernel.yama.ptrace_scope = 1
|
||||
|
||||
|
||||
###
|
||||
### IMPROVE SYSTEM MEMORY MANAGEMENT ###
|
||||
###
|
||||
@@ -96,6 +103,9 @@ vm.min_free_kbytes = 65535
|
||||
### GENERAL NETWORK SECURITY OPTIONS ###
|
||||
###
|
||||
|
||||
# Harden BPF JIT compiler
|
||||
net.core.bpf_jit_harden = 1
|
||||
|
||||
#Prevent SYN attack, enable SYNcookies (they will kick-in when the max_syn_backlog reached)
|
||||
net.ipv4.tcp_syncookies = 1
|
||||
net.ipv4.tcp_syn_retries = 2
|
||||
@@ -206,7 +216,6 @@ net.core.optmem_max = 65535
|
||||
net.ipv4.tcp_max_tw_buckets = 1440000
|
||||
|
||||
# try to reuse time-wait connections, but don't recycle them (recycle can break clients behind NAT)
|
||||
net.ipv4.tcp_tw_recycle = 0
|
||||
net.ipv4.tcp_tw_reuse = 1
|
||||
|
||||
# Limit number of orphans, each orphan can eat up to 16M (max wmem) of unswappable memory
|
||||
|
||||
@@ -36,7 +36,7 @@ class WODownload():
|
||||
return False
|
||||
return 0
|
||||
|
||||
def latest_release(self, repository):
|
||||
def latest_release(self, repository, name=False):
|
||||
"""Get the latest release number of a GitHub repository.\n
|
||||
repository format should be: \"user/repo\""""
|
||||
try:
|
||||
@@ -48,5 +48,19 @@ class WODownload():
|
||||
except requests.RequestException as e:
|
||||
Log.debug(self, str(e))
|
||||
Log.error(self, "Unable to query GitHub API")
|
||||
if name:
|
||||
return github_json["name"]
|
||||
else:
|
||||
return github_json["tag_name"]
|
||||
|
||||
return github_json["tag_name"]
|
||||
def pma_release(self):
|
||||
"""Get the latest phpmyadmin release number from a json file"""
|
||||
try:
|
||||
req = requests.get(
|
||||
'https://www.phpmyadmin.net/home_page/version.json',
|
||||
timeout=(5, 30))
|
||||
pma_json = req.json()
|
||||
except requests.RequestException as e:
|
||||
Log.debug(self, str(e))
|
||||
Log.error(self, "Unable to query phpmyadmin API")
|
||||
return pma_json["version"]
|
||||
|
||||
@@ -31,9 +31,8 @@ class WOMysql():
|
||||
# Makes connection with MySQL server
|
||||
try:
|
||||
if os.path.exists('/etc/mysql/conf.d/my.cnf'):
|
||||
connection = \
|
||||
pymysql.connect(read_default_file='/etc/mysql/'
|
||||
'conf.d/my.cnf')
|
||||
connection = pymysql.connect(
|
||||
read_default_file='/etc/mysql/conf.d/my.cnf')
|
||||
else:
|
||||
connection = pymysql.connect(read_default_file='~/.my.cnf')
|
||||
return connection
|
||||
|
||||
@@ -14,11 +14,11 @@ class WOVar():
|
||||
"""Intialization of core variables"""
|
||||
|
||||
# WordOps version
|
||||
wo_version = "3.11.4"
|
||||
wo_version = "3.12.0"
|
||||
# WordOps packages versions
|
||||
wo_wp_cli = "2.4.0"
|
||||
wo_adminer = "4.7.5"
|
||||
wo_phpmyadmin = "5.0.1"
|
||||
wo_phpmyadmin = "5.0.2"
|
||||
wo_extplorer = "2.1.13"
|
||||
wo_dashboard = "1.2"
|
||||
|
||||
@@ -140,18 +140,22 @@ class WOVar():
|
||||
"zip", "xml", "soap"]
|
||||
wo_php72 = []
|
||||
for module in wo_module:
|
||||
wo_php72 = wo_php72 + ["php7.2-{0}".format(module),
|
||||
"php7.2-recode"]
|
||||
wo_php72 = wo_php72 + ["php7.2-{0}".format(module)]
|
||||
wo_php72 = wo_php72 + ["php7.2-recode"]
|
||||
wo_php73 = []
|
||||
for module in wo_module:
|
||||
wo_php73 = wo_php73 + ["php7.3-{0}".format(module),
|
||||
"php7.3-recode"]
|
||||
wo_php73 = wo_php73 + ["php7.3-{0}".format(module)]
|
||||
wo_php73 = wo_php73 + ["php7.3-recode"]
|
||||
wo_php74 = []
|
||||
for module in wo_module:
|
||||
wo_php74 = wo_php74 + ["php7.4-{0}".format(module)]
|
||||
|
||||
wo_php_extra = ["php-memcached", "php-imagick", "php-igbinary",
|
||||
"graphviz", "php-xdebug", "php-msgpack", "php-redis"]
|
||||
if not wo_platform_codename == 'focal':
|
||||
wo_php_extra = ["php-memcached", "php-imagick", "php-igbinary",
|
||||
"graphviz", "php-xdebug", "php-msgpack", "php-redis"]
|
||||
else:
|
||||
wo_php_extra = ["php-imagick", "php-igbinary",
|
||||
"graphviz", "php-xdebug", "php-msgpack", "php-redis"]
|
||||
|
||||
wo_mysql = ["mariadb-server", "percona-toolkit"]
|
||||
if wo_distro == 'raspbian':
|
||||
|
||||
Reference in New Issue
Block a user