4 |
- |
1 |
# Fail2Ban configuration file
|
|
|
2 |
#
|
|
|
3 |
# Author: Nick Munger
|
|
|
4 |
# Modified by: Andy Fragen and Daniel Black
|
|
|
5 |
#
|
|
|
6 |
# Mod for OS X, using random rulenum as OSX ipfw doesn't include tables
|
|
|
7 |
#
|
|
|
8 |
|
|
|
9 |
[Definition]
|
|
|
10 |
|
|
|
11 |
# Option: actionstart
|
|
|
12 |
# Notes.: command executed once at the start of Fail2Ban.
|
|
|
13 |
# Values: CMD
|
|
|
14 |
#
|
|
|
15 |
actionstart =
|
|
|
16 |
|
|
|
17 |
|
|
|
18 |
# Option: actionstop
|
|
|
19 |
# Notes.: command executed once at the end of Fail2Ban
|
|
|
20 |
# Values: CMD
|
|
|
21 |
#
|
|
|
22 |
actionstop =
|
|
|
23 |
|
|
|
24 |
|
|
|
25 |
# Option: actioncheck
|
|
|
26 |
# Notes.: command executed once before each actionban command
|
|
|
27 |
# Values: CMD
|
|
|
28 |
#
|
|
|
29 |
actioncheck =
|
|
|
30 |
|
|
|
31 |
|
|
|
32 |
# Option: actionban
|
|
|
33 |
# Notes.: command executed when banning an IP. Take care that the
|
|
|
34 |
# command is executed with Fail2Ban user rights.
|
|
|
35 |
# Tags: <ip> IP address
|
|
|
36 |
# Values: CMD
|
|
|
37 |
#
|
|
|
38 |
actionban = ipfw add <rulenum> set <setnum> <blocktype> log <block> from <ip> to <dst> <port>
|
|
|
39 |
|
|
|
40 |
|
|
|
41 |
# Option: actionunban
|
|
|
42 |
# Notes.: command executed when unbanning an IP. Take care that the
|
|
|
43 |
# command is executed with Fail2Ban user rights.
|
|
|
44 |
# Tags: <ip> IP address
|
|
|
45 |
# Values: CMD
|
|
|
46 |
#
|
|
|
47 |
actionunban = ipfw delete `ipfw -S list | grep -i 'set <setnum> <blocktype> log <block> from <ip> to <dst>' | awk '{print $1;}'`
|
|
|
48 |
|
|
|
49 |
[Init]
|
|
|
50 |
|
|
|
51 |
# Option: port
|
|
|
52 |
# Notes.: specifies port to block. Can be blank however may require block="ip"
|
|
|
53 |
# Values: [ NUM | STRING ]
|
|
|
54 |
#
|
|
|
55 |
port = ssh
|
|
|
56 |
|
|
|
57 |
# Option: dst
|
|
|
58 |
# Notes.: the local IP address of the network interface
|
|
|
59 |
# Values: IP, any, me or anything support by ipfw as a dst
|
|
|
60 |
#
|
|
|
61 |
dst = me
|
|
|
62 |
|
|
|
63 |
# Option: block
|
|
|
64 |
# Notes: This is how much to block.
|
|
|
65 |
# Can be "ip", "tcp", "udp" or various other options.
|
|
|
66 |
# Values: STRING
|
|
|
67 |
block = tcp
|
|
|
68 |
|
|
|
69 |
# Option: blocktype
|
|
|
70 |
# Notes.: How to block the traffic. Use a action from man 8 ipfw
|
|
|
71 |
# Common values: deny, unreach port, reset
|
|
|
72 |
# Values: STRING
|
|
|
73 |
#
|
|
|
74 |
blocktype = unreach port
|
|
|
75 |
|
|
|
76 |
# Option: set number
|
|
|
77 |
# Notes.: The ipset number this is added to.
|
|
|
78 |
# Values: 0-31
|
|
|
79 |
setnum = 10
|
|
|
80 |
|
|
|
81 |
# Option: number for ipfw rule
|
|
|
82 |
# Notes: This is meant to be automaticly generated and not overwritten
|
|
|
83 |
# Values: Random value between 10000 and 12000
|
|
|
84 |
rulenum="`echo $((RANDOM%%2000+10000))`"
|
|
|
85 |
|
|
|
86 |
# Duplicate prevention mechanism
|
|
|
87 |
#rulenum = "`a=$((RANDOM%%2000+10000)); while ipfw show | grep -q ^$a\ ; do a=$((RANDOM%%2000+10000)); done; echo $a`"
|