From 17d446161bdfaffc2114bf16694803affefe1802 Mon Sep 17 00:00:00 2001 From: Mr Chen Date: Wed, 16 Oct 2024 01:17:30 +0800 Subject: [PATCH] update --- plugins/fail2ban/index.py | 9 +++++++++ plugins/fail2ban/tpl/jail.d/default.conf | 2 ++ 2 files changed, 11 insertions(+) create mode 100644 plugins/fail2ban/tpl/jail.d/default.conf diff --git a/plugins/fail2ban/index.py b/plugins/fail2ban/index.py index b2e8b3021..8cd136092 100755 --- a/plugins/fail2ban/index.py +++ b/plugins/fail2ban/index.py @@ -123,6 +123,13 @@ def contentReplace(content): return content +def initJailD(): + dst_conf = f2bEtcDir() + '/jail.d/default.conf' + dst_conf_tpl = getPluginDir() + '/tpl/jail.d/default.conf' + if not os.path.exists(dst_conf): + content = mw.readFile(dst_conf_tpl) + content = contentReplace(content) + mw.writeFile(dst_conf, content) def initDreplace(): @@ -143,6 +150,8 @@ def initDreplace(): # mw.writeFile(dst_conf, content) # mw.writeFile(dst_conf_init, 'ok') + initJailD() + # systemd systemDir = mw.systemdCfgDir() systemService = systemDir + '/' + getPluginName() + '.service' diff --git a/plugins/fail2ban/tpl/jail.d/default.conf b/plugins/fail2ban/tpl/jail.d/default.conf new file mode 100644 index 000000000..9ce9c7f4f --- /dev/null +++ b/plugins/fail2ban/tpl/jail.d/default.conf @@ -0,0 +1,2 @@ +[DEFAULT] +backend = systemd \ No newline at end of file