pull/628/head
Mr Chen 7 months ago
parent 63004db963
commit ee59bd31e6
  1. 13
      plugins/fail2ban/index.py
  2. 2
      plugins/fail2ban/tpl/fail2ban.d/default.conf

@ -18,10 +18,10 @@ def getPluginName():
return 'fail2ban' return 'fail2ban'
def f2bDir(): def f2bDir():
return '/run/fail2ban' return '/run/'+getPluginName()
def f2bEtcDir(): def f2bEtcDir():
return '/etc/fail2ban' return '/etc/'+getPluginName()
def getPluginDir(): def getPluginDir():
return mw.getPluginDir() + '/' + getPluginName() return mw.getPluginDir() + '/' + getPluginName()
@ -123,6 +123,14 @@ def contentReplace(content):
return 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(): def initJailD():
dst_conf = f2bEtcDir() + '/jail.d/default.conf' dst_conf = f2bEtcDir() + '/jail.d/default.conf'
dst_conf_tpl = getPluginDir() + '/tpl/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, content)
# mw.writeFile(dst_conf_init, 'ok') # mw.writeFile(dst_conf_init, 'ok')
initFail2BanD()
initJailD() initJailD()
# systemd # systemd

@ -0,0 +1,2 @@
[DEFAULT]
allowipv6 = auto
Loading…
Cancel
Save