Merge pull request #308 from WordOps/updating-configuration

Several bug fixes
This commit is contained in:
VirtuBox
2020-08-20 13:50:14 +02:00
committed by GitHub
7 changed files with 55 additions and 31 deletions

View File

@@ -1042,12 +1042,13 @@ def post_pref(self, apt_packages, packages, upgrade=False):
WOGit.add(self, ["/etc/fail2ban"],
msg="Adding Fail2ban into Git")
Log.info(self, "Configuring Fail2Ban")
data = dict(release=WOVar.wo_version)
nginxf2b = bool(os.path.exists('/var/log/nginx'))
data = dict(release=WOVar.wo_version, nginx=nginxf2b)
WOTemplate.deploy(
self,
'/etc/fail2ban/jail.d/custom.conf',
'fail2ban.mustache',
data, overwrite=False)
data, overwrite=True)
WOTemplate.deploy(
self,
'/etc/fail2ban/filter.d/wo-wordpress.conf',
@@ -1059,7 +1060,7 @@ def post_pref(self, apt_packages, packages, upgrade=False):
'fail2ban-forbidden.mustache',
data, overwrite=False)
if not WOService.reload_service(self, 'fail2ban'):
if not WOShellExec.cmd_exec(self, 'fail2ban-client reload'):
WOGit.rollback(
self, ['/etc/fail2ban'], msg="Rollback f2b config")
WOService.restart_service(self, 'fail2ban')