4 |
- |
1 |
# Fail2Ban configuration file
|
|
|
2 |
#
|
|
|
3 |
# Author: Nick Munger
|
|
|
4 |
# Modified by: Ken Menzel
|
|
|
5 |
# Daniel Black (start/stop)
|
|
|
6 |
# Fabian Wenk (many ideas as per fail2ban users list)
|
|
|
7 |
#
|
|
|
8 |
# Ensure firewall_enable="YES" in the top of /etc/rc.conf
|
|
|
9 |
#
|
|
|
10 |
|
|
|
11 |
[Definition]
|
|
|
12 |
|
|
|
13 |
# Option: actionstart
|
|
|
14 |
# Notes.: command executed once at the start of Fail2Ban.
|
|
|
15 |
# Values: CMD
|
|
|
16 |
#
|
|
|
17 |
actionstart = ipfw show | fgrep -q 'table(<table>)' || ( ipfw show | awk 'BEGIN { b = 1 } { if ($1 <= b) { b = $1 + 1 } else { e = b } } END { if (e) exit e <br> else exit b }'; num=$?; ipfw -q add $num <blocktype> <block> from table\(<table>\) to me <port>; echo $num > "<startstatefile>" )
|
|
|
18 |
|
|
|
19 |
|
|
|
20 |
# Option: actionstop
|
|
|
21 |
# Notes.: command executed once at the end of Fail2Ban
|
|
|
22 |
# Values: CMD
|
|
|
23 |
#
|
|
|
24 |
actionstop = [ ! -f <startstatefile> ] || ( read num < "<startstatefile>" <br> ipfw -q delete $num <br> rm "<startstatefile>" )
|
|
|
25 |
|
|
|
26 |
|
|
|
27 |
# Option: actioncheck
|
|
|
28 |
# Notes.: command executed once before each actionban command
|
|
|
29 |
# Values: CMD
|
|
|
30 |
#
|
|
|
31 |
actioncheck =
|
|
|
32 |
|
|
|
33 |
|
|
|
34 |
# Option: actionban
|
|
|
35 |
# Notes.: command executed when banning an IP. Take care that the
|
|
|
36 |
# command is executed with Fail2Ban user rights.
|
|
|
37 |
# Tags: See jail.conf(5) man page
|
|
|
38 |
# Values: CMD
|
|
|
39 |
#
|
|
|
40 |
# requires an ipfw rule like "deny ip from table(1) to me"
|
|
|
41 |
actionban = ipfw table <table> add <ip>
|
|
|
42 |
|
|
|
43 |
|
|
|
44 |
# Option: actionunban
|
|
|
45 |
# Notes.: command executed when unbanning an IP. Take care that the
|
|
|
46 |
# command is executed with Fail2Ban user rights.
|
|
|
47 |
# Tags: See jail.conf(5) man page
|
|
|
48 |
# Values: CMD
|
|
|
49 |
#
|
|
|
50 |
actionunban = ipfw table <table> delete <ip>
|
|
|
51 |
|
|
|
52 |
[Init]
|
|
|
53 |
# Option: table
|
|
|
54 |
# Notes: The ipfw table to use. If a ipfw rule using this table already exists,
|
|
|
55 |
# this action will not create a ipfw rule to block it and the following
|
|
|
56 |
# options will have no effect.
|
|
|
57 |
# Values: NUM
|
|
|
58 |
table = 1
|
|
|
59 |
|
|
|
60 |
# Option: port
|
|
|
61 |
# Notes.: Specifies port to monitor. Blank indicate block all ports.
|
|
|
62 |
# Values: [ NUM | STRING ]
|
|
|
63 |
#
|
|
|
64 |
port =
|
|
|
65 |
|
|
|
66 |
# Option: startstatefile
|
|
|
67 |
# Notes: A file to indicate that the table rule that was added. Ensure it is unique per table.
|
|
|
68 |
# Values: STRING
|
|
|
69 |
startstatefile = /var/run/fail2ban/ipfw-started-table_<table>
|
|
|
70 |
|
|
|
71 |
# Option: block
|
|
|
72 |
# Notes: This is how much to block.
|
|
|
73 |
# Can be "ip", "tcp", "udp" or various other options.
|
|
|
74 |
# Values: STRING
|
|
|
75 |
block = ip
|
|
|
76 |
|
|
|
77 |
# Option: blocktype
|
|
|
78 |
# Notes.: How to block the traffic. Use a action from man 5 ipfw
|
|
|
79 |
# Common values: deny, unreach port, reset
|
|
|
80 |
# ACTION defination at the top of man ipfw for allowed values.
|
|
|
81 |
# Values: STRING
|
|
|
82 |
#
|
|
|
83 |
blocktype = unreach port
|