diff --git a/wo/cli/plugins/stack.py b/wo/cli/plugins/stack.py index e29dc29..9c137e3 100644 --- a/wo/cli/plugins/stack.py +++ b/wo/cli/plugins/stack.py @@ -1077,29 +1077,28 @@ class WOStackController(CementBaseController): # create fail2ban configuration files if set(WOVariables.wo_fail2ban).issubset(set(apt_packages)): if not os.path.isfile("/etc/fail2ban/jail.d/custom.conf"): - data = dict() Log.debug(self, "Setting up fail2ban jails configuration") - wo_fail2ban = open('/etc/fail2ban/jail.d/custom.conf', + fail2ban_config = open('/etc/fail2ban/jail.d/custom.conf', encoding='utf-8', mode='w') self.app.render((data), 'fail2ban.mustache', out=wo_fail2ban) - wo_fail2ban.close() + fail2ban_config.close() Log.debug(self, "Setting up fail2ban wp filter") - wo_fail2ban = open('/etc/fail2ban/filter.d/' + fail2ban_config = open('/etc/fail2ban/filter.d/' 'wo-wordpress.conf', encoding='utf-8', mode='w') self.app.render((data), 'fail2ban-wp.mustache', out=wo_fail2ban) - wo_fail2ban.close() + fail2ban_config.close() Log.debug(self, "Setting up fail2ban wp filter") - wo_fail2ban = open('/etc/fail2ban/filter.d/' + fail2ban_config = open('/etc/fail2ban/filter.d/' 'nginx-forbidden.conf', encoding='utf-8', mode='w') self.app.render((data), 'fail2ban-forbidden.mustache', out=wo_fail2ban) - wo_fail2ban.close() + fail2ban_config.close() WOGit.add(self, ["/etc/fail2ban"], msg="Adding Fail2ban into Git") WOService.reload_service(self, 'fail2ban') diff --git a/wo/cli/plugins/stack_services.py b/wo/cli/plugins/stack_services.py index 9b7d604..2def4af 100644 --- a/wo/cli/plugins/stack_services.py +++ b/wo/cli/plugins/stack_services.py @@ -85,6 +85,7 @@ class WOStackStatusController(CementBaseController): if not (self.app.pargs.nginx or self.app.pargs.php or self.app.pargs.php73 or self.app.pargs.mysql or + self.app.pargs.fail2ban or self.app.pargs.redis): self.app.pargs.nginx = True self.app.pargs.php = True