Several fixes
This commit is contained in:
@@ -8,6 +8,13 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|||||||
|
|
||||||
### v3.9.x - [Unreleased]
|
### v3.9.x - [Unreleased]
|
||||||
|
|
||||||
|
#### Fixed
|
||||||
|
|
||||||
|
- ufw rules for proftpd not applied
|
||||||
|
- phpredisadmin install
|
||||||
|
- netdata configuration
|
||||||
|
|
||||||
|
|
||||||
### v3.9.8.7 - 2019-08-31
|
### v3.9.8.7 - 2019-08-31
|
||||||
|
|
||||||
#### Changed
|
#### Changed
|
||||||
|
|||||||
@@ -312,6 +312,9 @@ class WOStackController(CementBaseController):
|
|||||||
|
|
||||||
# Composer
|
# Composer
|
||||||
if pargs.composer:
|
if pargs.composer:
|
||||||
|
if ((not WOAptGet.is_installed(self, 'php7.2-fpm')) and
|
||||||
|
(not WOAptGet.is_installed(self, 'php7.3-fpm'))):
|
||||||
|
pargs.php = True
|
||||||
if not os.path.isfile('/usr/local/bin/composer'):
|
if not os.path.isfile('/usr/local/bin/composer'):
|
||||||
Log.debug(self, "Setting packages variable for Composer ")
|
Log.debug(self, "Setting packages variable for Composer ")
|
||||||
packages = packages + [["https://getcomposer.org/"
|
packages = packages + [["https://getcomposer.org/"
|
||||||
|
|||||||
@@ -47,11 +47,13 @@ def pre_pref(self, apt_packages):
|
|||||||
if set(WOVariables.wo_mysql).issubset(set(apt_packages)):
|
if set(WOVariables.wo_mysql).issubset(set(apt_packages)):
|
||||||
# generate random 24 characters root password
|
# generate random 24 characters root password
|
||||||
chars = ''.join(random.sample(string.ascii_letters, 24))
|
chars = ''.join(random.sample(string.ascii_letters, 24))
|
||||||
|
|
||||||
# configure MySQL non-interactive install
|
# configure MySQL non-interactive install
|
||||||
if (not WOVariables.wo_distro == 'raspbian'):
|
if ((WOVariables.wo_distro == 'raspbian') and
|
||||||
mariadb_ver = '10.3'
|
(WOVariables.wo_platform_codename == 'stretch')):
|
||||||
else:
|
|
||||||
mariadb_ver = '10.1'
|
mariadb_ver = '10.1'
|
||||||
|
else:
|
||||||
|
mariadb_ver = '10.3'
|
||||||
|
|
||||||
Log.debug(self, "Pre-seeding MySQL")
|
Log.debug(self, "Pre-seeding MySQL")
|
||||||
Log.debug(self, "echo \"mariadb-server-{0} "
|
Log.debug(self, "echo \"mariadb-server-{0} "
|
||||||
@@ -1072,16 +1074,19 @@ def post_pref(self, apt_packages, packages, upgrade=False):
|
|||||||
WOService.restart_service(self, 'proftpd')
|
WOService.restart_service(self, 'proftpd')
|
||||||
|
|
||||||
# add rule for proftpd with UFW
|
# add rule for proftpd with UFW
|
||||||
if WOAptGet.is_installed(self, 'ufw'):
|
if os.path.isdir('/etc/ufw'):
|
||||||
try:
|
try:
|
||||||
WOShellExec.cmd_exec(self, "/usr/bin/ufw allow "
|
WOShellExec.cmd_exec(
|
||||||
"49000:50000/tcp")
|
self, "ufw allow 49000:50000/tcp")
|
||||||
|
WOShellExec.cmd_exec(
|
||||||
|
self, "ufw reload")
|
||||||
except CommandExecutionError as e:
|
except CommandExecutionError as e:
|
||||||
Log.debug(self, "{0}".format(e))
|
Log.debug(self, "{0}".format(e))
|
||||||
Log.error(self, "Unable to add UFW rule")
|
Log.error(self, "Unable to add UFW rule")
|
||||||
|
|
||||||
if ((os.path.isfile("/etc/fail2ban/jail.d/custom.conf")) and
|
if ((os.path.isfile("/etc/fail2ban/jail.d/custom.conf")) and
|
||||||
(not WOFileUtils.grep(self, "/etc/fail2ban/jail.d/custom.conf",
|
(not WOFileUtils.grep(
|
||||||
|
self, "/etc/fail2ban/jail.d/custom.conf",
|
||||||
"proftpd"))):
|
"proftpd"))):
|
||||||
with open("/etc/fail2ban/jail.d/custom.conf",
|
with open("/etc/fail2ban/jail.d/custom.conf",
|
||||||
encoding='utf-8', mode='a') as f2bproftpd:
|
encoding='utf-8', mode='a') as f2bproftpd:
|
||||||
@@ -1108,16 +1113,12 @@ def post_pref(self, apt_packages, packages, upgrade=False):
|
|||||||
if not os.path.isfile("/etc/nginx/conf.d/redis.conf"):
|
if not os.path.isfile("/etc/nginx/conf.d/redis.conf"):
|
||||||
with open("/etc/nginx/conf.d/redis.conf",
|
with open("/etc/nginx/conf.d/redis.conf",
|
||||||
"a") as redis_file:
|
"a") as redis_file:
|
||||||
redis_file.write("# Log format Settings\n"
|
redis_file.write(
|
||||||
"log_format rt_cache_redis "
|
"# Log format Settings\n"
|
||||||
"'$remote_addr "
|
"log_format rt_cache_redis '$remote_addr "
|
||||||
"$upstream_response_time "
|
"$upstream_response_time $srcache_fetch_status "
|
||||||
"$srcache_fetch_status "
|
"[$time_local] '\n '$http_host \"$request\" "
|
||||||
"[$time_local]"
|
"$status $body_bytes_sent '\n'\"$http_referer\" "
|
||||||
" '\n '$http_host"
|
|
||||||
" \"$request\" "
|
|
||||||
"$status $body_bytes_sent '\n"
|
|
||||||
"'\"$http_referer\" "
|
|
||||||
"\"$http_user_agent\"';\n")
|
"\"$http_user_agent\"';\n")
|
||||||
# set redis.conf parameter
|
# set redis.conf parameter
|
||||||
# set maxmemory 10% for ram below 512MB and 20% for others
|
# set maxmemory 10% for ram below 512MB and 20% for others
|
||||||
@@ -1158,12 +1159,10 @@ def post_pref(self, apt_packages, packages, upgrade=False):
|
|||||||
Log.debug(
|
Log.debug(
|
||||||
self, "Setting maxmemory-policy variable to "
|
self, "Setting maxmemory-policy variable to "
|
||||||
"allkeys-lru in redis.conf")
|
"allkeys-lru in redis.conf")
|
||||||
WOFileUtils.searchreplace(self,
|
WOFileUtils.searchreplace(
|
||||||
"/etc/redis/redis.conf",
|
self, "/etc/redis/redis.conf",
|
||||||
"# maxmemory-policy "
|
"# maxmemory-policy noeviction",
|
||||||
"noeviction",
|
"maxmemory-policy allkeys-lru")
|
||||||
"maxmemory-policy "
|
|
||||||
"allkeys-lru")
|
|
||||||
Log.debug(
|
Log.debug(
|
||||||
self, "Setting tcp-backlog variable to "
|
self, "Setting tcp-backlog variable to "
|
||||||
"in redis.conf")
|
"in redis.conf")
|
||||||
@@ -1268,7 +1267,9 @@ def post_pref(self, apt_packages, packages, upgrade=False):
|
|||||||
shutil.copyfile('/var/lib/wo/tmp/composer.phar',
|
shutil.copyfile('/var/lib/wo/tmp/composer.phar',
|
||||||
'/usr/local/bin/composer')
|
'/usr/local/bin/composer')
|
||||||
WOFileUtils.chmod(self, "/usr/local/bin/composer", 0o775)
|
WOFileUtils.chmod(self, "/usr/local/bin/composer", 0o775)
|
||||||
if os.path.isdir("/var/www/22222/htdocs/db/pma"):
|
if ((os.path.isdir("/var/www/22222/htdocs/db/pma")) and
|
||||||
|
(not os.path.isfile('/var/www/22222/htdocs/db/'
|
||||||
|
'pma/composer.lock'))):
|
||||||
Log.info(self, "Updating phpMyAdmin, please wait...")
|
Log.info(self, "Updating phpMyAdmin, please wait...")
|
||||||
WOShellExec.cmd_exec(
|
WOShellExec.cmd_exec(
|
||||||
self, "/usr/local/bin/composer update "
|
self, "/usr/local/bin/composer update "
|
||||||
@@ -1289,6 +1290,14 @@ def post_pref(self, apt_packages, packages, upgrade=False):
|
|||||||
.format(WOVariables.wo_webroot))
|
.format(WOVariables.wo_webroot))
|
||||||
os.makedirs('{0}22222/htdocs/cache/redis/phpRedisAdmin'
|
os.makedirs('{0}22222/htdocs/cache/redis/phpRedisAdmin'
|
||||||
.format(WOVariables.wo_webroot))
|
.format(WOVariables.wo_webroot))
|
||||||
|
if not os.path.isfile('/var/www/22222/htdocs/cache/redis/'
|
||||||
|
'phpRedisAdmin/composer.lock'):
|
||||||
|
WOShellExec.cmd_exec(self, "/usr/local/bin/composer"
|
||||||
|
"create-project --no-plugins "
|
||||||
|
"--no-scripts -n -s dev "
|
||||||
|
"erik-dubbelboer/php-redis-admin "
|
||||||
|
"/var/www/22222/htdocs/cache"
|
||||||
|
"/redis/phpRedisAdmin ")
|
||||||
WOFileUtils.chown(self, '{0}22222/htdocs'
|
WOFileUtils.chown(self, '{0}22222/htdocs'
|
||||||
.format(WOVariables.wo_webroot),
|
.format(WOVariables.wo_webroot),
|
||||||
'www-data',
|
'www-data',
|
||||||
@@ -1304,32 +1313,29 @@ def post_pref(self, apt_packages, packages, upgrade=False):
|
|||||||
# netdata install
|
# netdata install
|
||||||
if any('/var/lib/wo/tmp/kickstart.sh' == x[1]
|
if any('/var/lib/wo/tmp/kickstart.sh' == x[1]
|
||||||
for x in packages):
|
for x in packages):
|
||||||
if ((not os.path.exists('/opt/netdata')) and
|
|
||||||
(not os.path.exists('/etc/netdata'))):
|
|
||||||
Log.info(self, "Installing Netdata, please wait...")
|
Log.info(self, "Installing Netdata, please wait...")
|
||||||
WOShellExec.cmd_exec(self, "bash /var/lib/wo/tmp/"
|
WOShellExec.cmd_exec(self, "bash /var/lib/wo/tmp/"
|
||||||
"kickstart.sh "
|
"kickstart.sh "
|
||||||
"--dont-wait")
|
"--dont-wait")
|
||||||
if WOVariables.wo_distro == 'raspbian':
|
if os.path.isdir('/etc/netdata'):
|
||||||
wo_netdata = "/"
|
wo_netdata = "/"
|
||||||
else:
|
elif os.path.isdir('/opt/netdata'):
|
||||||
wo_netdata = "/opt/netdata/"
|
wo_netdata = "/opt/netdata/"
|
||||||
# disable mail notifications
|
# disable mail notifications
|
||||||
WOFileUtils.searchreplace(
|
WOFileUtils.searchreplace(
|
||||||
self, "{0}usr/"
|
self, "{0}etc/netdata/orig/health_alarm_notify.conf"
|
||||||
"lib/netdata/conf.d/health_alarm_notify.conf"
|
|
||||||
.format(wo_netdata),
|
.format(wo_netdata),
|
||||||
'SEND_EMAIL="YES"',
|
'SEND_EMAIL="YES"',
|
||||||
'SEND_EMAIL="NO"')
|
'SEND_EMAIL="NO"')
|
||||||
# make changes persistant
|
# make changes persistant
|
||||||
WOFileUtils.copyfile(
|
WOFileUtils.copyfile(
|
||||||
self, "{0}usr/lib/netdata/conf.d/"
|
self, "{0}etc/netdata/orig/"
|
||||||
"health_alarm_notify.conf"
|
"health_alarm_notify.conf"
|
||||||
.format(wo_netdata),
|
.format(wo_netdata),
|
||||||
"{0}etc/netdata/health_alarm_notify.conf"
|
"{0}etc/netdata/health_alarm_notify.conf"
|
||||||
.format(wo_netdata))
|
.format(wo_netdata))
|
||||||
# check if mysql credentials are available
|
# check if mysql credentials are available
|
||||||
if os.path.isfile('/etc/mysql/conf.d/my.cnf'):
|
if WOShellExec.cmd_exec(self, "mysqladmin ping"):
|
||||||
try:
|
try:
|
||||||
WOMysql.execute(
|
WOMysql.execute(
|
||||||
self,
|
self,
|
||||||
|
|||||||
@@ -80,7 +80,7 @@ class WOFileUtils():
|
|||||||
except IOError as e:
|
except IOError as e:
|
||||||
Log.debug(self, "{0}".format(e.strerror))
|
Log.debug(self, "{0}".format(e.strerror))
|
||||||
Log.error(self, "Unable to copy files from {0} to {1}"
|
Log.error(self, "Unable to copy files from {0} to {1}"
|
||||||
.format(src, dest))
|
.format(src, dest), exit=False)
|
||||||
|
|
||||||
def copyfile(self, src, dest):
|
def copyfile(self, src, dest):
|
||||||
"""
|
"""
|
||||||
@@ -99,7 +99,7 @@ class WOFileUtils():
|
|||||||
except IOError as e:
|
except IOError as e:
|
||||||
Log.debug(self, "{0}".format(e.strerror))
|
Log.debug(self, "{0}".format(e.strerror))
|
||||||
Log.error(self, "Unable to copy file from {0} to {1}"
|
Log.error(self, "Unable to copy file from {0} to {1}"
|
||||||
.format(src, dest))
|
.format(src, dest), exit=False)
|
||||||
|
|
||||||
def searchreplace(self, fnm, sstr, rstr):
|
def searchreplace(self, fnm, sstr, rstr):
|
||||||
"""
|
"""
|
||||||
@@ -118,7 +118,7 @@ class WOFileUtils():
|
|||||||
except Exception as e:
|
except Exception as e:
|
||||||
Log.debug(self, "{0}".format(e))
|
Log.debug(self, "{0}".format(e))
|
||||||
Log.error(self, "Unable to search {0} and replace {1} {2}"
|
Log.error(self, "Unable to search {0} and replace {1} {2}"
|
||||||
.format(fnm, sstr, rstr))
|
.format(fnm, sstr, rstr), exit=False)
|
||||||
|
|
||||||
def mvfile(self, src, dst):
|
def mvfile(self, src, dst):
|
||||||
"""
|
"""
|
||||||
|
|||||||
Reference in New Issue
Block a user