Add flushaction

Change unban to find by ip address not comment
pull/2860/head
Duncan Bellamy 2020-11-25 18:53:43 +00:00
parent 9997807fb3
commit 0e3e9b1d7f
1 changed files with 9 additions and 4 deletions

View File

@ -4,7 +4,7 @@
# #
# Author: Duncan Bellamy <dunk@denkimushi.com> # Author: Duncan Bellamy <dunk@denkimushi.com>
# based on forum.mikrotik.com post by pakjebakmeel # based on forum.mikrotik.com post by pakjebakmeel
# ##
# in the instructions: # in the instructions:
# (10.0.0.1 is ip of mikrotik router) # (10.0.0.1 is ip of mikrotik router)
# (10.0.0.2 is ip of fail2ban machine) # (10.0.0.2 is ip of fail2ban machine)
@ -46,13 +46,15 @@
actionstart = actionstart =
actionstop = actionstop = %(actionflush)s
actionflush = %(mtikcommand)s "/ip firewall address-list remove [find list=\"%(mtiklistname)s\" comment~\"%(startcomment)s*\"]"
actioncheck = actioncheck =
actionban = %(mtikcommand)s "/ip firewall address-list add list=\"%(mtiklistname)s\" address=<ip> comment=%(mtikcomment)s" actionban = %(mtikcommand)s "/ip firewall address-list add list=\"%(mtiklistname)s\" address=<ip> comment=%(mtikcomment)s"
actionunban = %(mtikcommand)s "/ip firewall address-list remove [find list=\"%(mtiklistname)s\" comment=%(mtikcomment)s]" actionunban = %(mtikcommand)s "/ip firewall address-list remove [find list=\"%(mtiklistname)s\" address=<ip>]"
mtikcommand = ssh -l %(mtikuser)s -p%(mtikport)s -i %(mtikkeyfile)s %(mtikhost)s mtikcommand = ssh -l %(mtikuser)s -p%(mtikport)s -i %(mtikkeyfile)s %(mtikhost)s
@ -71,9 +73,12 @@ mtikhost =
# Option: mtiklistname # Option: mtiklistname
# Notes.: name of "address-list" to use on router # Notes.: name of "address-list" to use on router
mtiklistname = Auto Fail2Ban mtiklistname = Auto Fail2Ban
# Option: startcomment
# Notes.: used as a prefix to all comments, and used to match for flushing rules
startcomment = AutoF2B
# Option: mtikcomment # Option: mtikcomment
# Notes.: comment to use on routerOS (must be unique as used for ip address removal) # Notes.: comment to use on routerOS (must be unique as used for ip address removal)
mtikcomment = AutoF2B-<name>-<ip> mtikcomment = %(startcomment)s-<name>-<ip>
[Init] [Init]
name="%(__name__)s" name="%(__name__)s"