ENH: more options and ruggedness to prevent unintensional consequences

pull/344/head
Daniel Black 2013-08-31 09:38:18 +10:00
parent 908d4adf6f
commit 5741348f45
1 changed files with 29 additions and 12 deletions

View File

@ -1,9 +1,9 @@
# Fail2Ban configuration file
#
# Author: Nick Munger
# Modified by: Andy Fragen
# Modified by: Andy Fragen and Daniel Black
#
# Mod for OS X, using random rulenum
# Mod for OS X, using random rulenum as OSX ipfw doesn't include tables
#
[Definition]
@ -35,7 +35,7 @@ actioncheck =
# Tags: <ip> IP address
# Values: CMD
#
actionban = ipfw add <rulenum> set 10 deny log tcp from <ip> to <localhost> <port>
actionban = ipfw add <rulenum> set <setnum> <blocktype> log <block> from <ip> to <dst> <port>
# Option: actionunban
@ -44,24 +44,41 @@ actionban = ipfw add <rulenum> set 10 deny log tcp from <ip> to <localhost> <por
# Tags: <ip> IP address
# Values: CMD
#
actionunban = ipfw delete `ipfw list | grep -i <ip> | awk '{print $1;}'`
actionunban = ipfw delete `ipfw list | sed -n '/^\([0-9]*\) set <setnum> <blocktype> log <block> from <ip> to <dst> <port>$/s//\1/p'`
[Init]
# Option: port
# Notes.: specifies port to monitor
# Notes.: specifies port to block
# Values: [ NUM | STRING ]
#
port = ssh
# Option: localhost
# Option: dst
# Notes.: the local IP address of the network interface
# Values: IP
# Values: IP, any, me or anything support by ipfw as a dst
#
localhost = 127.0.0.1
dst = me
# Option: number for ipfw rule
# Values: 1 - 65535
# Random value between 10000 and 12000
rulenum = "`echo $((RANDOM%%2000+10000))`"
# Option: block
# Notes: This is how much to block.
# Can be "ip", "tcp", "udp" or various other options.
# Values: STRING
block = tcp
# Option: blocktype
# Notes.: How to block the traffic. Use a action from man 8 ipfw
# Common values: deny, unreach port, reset
# Values: STRING
#
blocktype = unreach port
# Option: set number
# Notes.: The ipset number this is added to.
# Values: 0-31
setnum = 10
# Option: number for ipfw rule
# Notes: This is ment to be automaticly generated and not overwritten
# Values: Random value between 10000 and 12000
rulenum = "`a=$((RANDOM%%2000+10000)); while ipfw show | grep -q ^$a\ ; do a=$((RANDOM%%2000+10000)); done; echo $a`"