This commit is contained in:
Mr Chen
2024-10-18 22:00:38 +08:00
parent 63004db963
commit ee59bd31e6
2 changed files with 13 additions and 2 deletions
+11 -2
View File
@@ -18,10 +18,10 @@ def getPluginName():
return 'fail2ban'
def f2bDir():
return '/run/fail2ban'
return '/run/'+getPluginName()
def f2bEtcDir():
return '/etc/fail2ban'
return '/etc/'+getPluginName()
def getPluginDir():
return mw.getPluginDir() + '/' + getPluginName()
@@ -123,6 +123,14 @@ def contentReplace(content):
return content
def initFail2BanD():
dst_conf = f2bEtcDir() + '/fail2ban.d/default.conf'
dst_conf_tpl = getPluginDir() + '/tpl/fail2ban.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 initJailD():
dst_conf = f2bEtcDir() + '/jail.d/default.conf'
dst_conf_tpl = getPluginDir() + '/tpl/jail.d/default.conf'
@@ -150,6 +158,7 @@ def initDreplace():
# mw.writeFile(dst_conf, content)
# mw.writeFile(dst_conf_init, 'ok')
initFail2BanD()
initJailD()
# systemd
@@ -0,0 +1,2 @@
[DEFAULT]
allowipv6 = auto