34 |
- |
1 |
# Fail2Ban configuration file
|
|
|
2 |
#
|
|
|
3 |
# Author: Andrew St. Jean
|
|
|
4 |
#
|
|
|
5 |
# Use nsupdate to perform dynamic DNS updates on a BIND zone file.
|
|
|
6 |
# One may want to do this to update a local RBL with banned IP addresses.
|
|
|
7 |
#
|
|
|
8 |
# Options
|
|
|
9 |
#
|
|
|
10 |
# domain DNS domain that will appear in nsupdate add and delete
|
|
|
11 |
# commands.
|
|
|
12 |
#
|
|
|
13 |
# ttl The time to live (TTL) in seconds of the TXT resource
|
|
|
14 |
# record.
|
|
|
15 |
#
|
|
|
16 |
# rdata Data portion of the TXT resource record.
|
|
|
17 |
#
|
|
|
18 |
# nsupdatecmd Full path to the nsupdate command.
|
|
|
19 |
#
|
|
|
20 |
# keyfile Full path to TSIG key file used for authentication between
|
|
|
21 |
# nsupdate and BIND.
|
|
|
22 |
#
|
|
|
23 |
# Create an nsupdate.local to set at least the <domain> and <keyfile>
|
|
|
24 |
# options as they don't have default values.
|
|
|
25 |
#
|
|
|
26 |
# The ban and unban commands assume nsupdate will authenticate to the BIND
|
|
|
27 |
# server using a TSIG key. The full path to the key file must be specified
|
|
|
28 |
# in the <keyfile> parameter. Use this command to generate your TSIG key.
|
|
|
29 |
#
|
|
|
30 |
# dnssec-keygen -a HMAC-MD5 -b 256 -n HOST <key_name>
|
|
|
31 |
#
|
|
|
32 |
# Replace <key_name> with some meaningful name.
|
|
|
33 |
#
|
|
|
34 |
# This command will generate two files. Specify the .private file in the
|
|
|
35 |
# <keyfile> option. Note that the .key file must also be present in the same
|
|
|
36 |
# directory for nsupdate to use the key.
|
|
|
37 |
#
|
|
|
38 |
# Don't forget to add the key and appropriate allow-update or update-policy
|
|
|
39 |
# option to your named.conf file.
|
|
|
40 |
#
|
|
|
41 |
|
|
|
42 |
[Definition]
|
|
|
43 |
|
|
|
44 |
# Option: actionstart
|
|
|
45 |
# Notes.: command executed once at the start of Fail2Ban.
|
|
|
46 |
# Values: CMD
|
|
|
47 |
#
|
|
|
48 |
actionstart =
|
|
|
49 |
|
|
|
50 |
|
|
|
51 |
# Option: actionstop
|
|
|
52 |
# Notes.: command executed once at the end of Fail2Ban
|
|
|
53 |
# Values: CMD
|
|
|
54 |
#
|
|
|
55 |
actionstop =
|
|
|
56 |
|
|
|
57 |
|
|
|
58 |
# Option: actioncheck
|
|
|
59 |
# Notes.: command executed once before each actionban command
|
|
|
60 |
# Values: CMD
|
|
|
61 |
#
|
|
|
62 |
actioncheck =
|
|
|
63 |
|
|
|
64 |
# Option: actionban
|
|
|
65 |
# Notes.: command executed when banning an IP. Take care that the
|
|
|
66 |
# command is executed with Fail2Ban user rights.
|
|
|
67 |
# Tags: See jail.conf(5) man page
|
|
|
68 |
# Values: CMD
|
|
|
69 |
#
|
|
|
70 |
actionban = echo <ip> | awk -F. '{print "prereq nxrrset "$4"."$3"."$2"."$1".<domain> TXT"; print "update add "$4"."$3"."$2"."$1".<domain> <ttl> IN TXT \"<rdata>\""; print "send"}' | <nsupdatecmd> -k <keyfile>
|
|
|
71 |
|
|
|
72 |
# Option: actionunban
|
|
|
73 |
# Notes.: command executed when unbanning an IP. Take care that the
|
|
|
74 |
# command is executed with Fail2Ban user rights.
|
|
|
75 |
# Tags: See jail.conf(5) man page
|
|
|
76 |
# Values: CMD
|
|
|
77 |
#
|
|
|
78 |
actionunban = echo <ip> | awk -F. '{print "update delete "$4"."$3"."$2"."$1".<domain>"; print "send"}' | <nsupdatecmd> -k <keyfile>
|
|
|
79 |
|
|
|
80 |
[Init]
|
|
|
81 |
|
|
|
82 |
# Option: domain
|
|
|
83 |
# Notes.: DNS domain that nsupdate will update.
|
|
|
84 |
# Values: STRING
|
|
|
85 |
#
|
|
|
86 |
domain =
|
|
|
87 |
|
|
|
88 |
# Option: ttl
|
|
|
89 |
# Notes.: time to live (TTL) in seconds of TXT resource record
|
|
|
90 |
# added by nsupdate.
|
|
|
91 |
# Values: NUM
|
|
|
92 |
#
|
|
|
93 |
ttl = 60
|
|
|
94 |
|
|
|
95 |
# Option: rdata
|
|
|
96 |
# Notes.: data portion of the TXT resource record added by nsupdate.
|
|
|
97 |
# Values: STRING
|
|
|
98 |
#
|
|
|
99 |
rdata = Your IP has been banned
|
|
|
100 |
|
|
|
101 |
# Option: nsupdatecmd
|
|
|
102 |
# Notes.: specifies the full path to the nsupdate program that dynamically
|
|
|
103 |
# updates BIND zone files.
|
|
|
104 |
# Values: CMD
|
|
|
105 |
#
|
|
|
106 |
nsupdatecmd = /usr/bin/nsupdate
|
|
|
107 |
|
|
|
108 |
# Option: keyfile
|
|
|
109 |
# Notes.: specifies the full path to the file containing the
|
|
|
110 |
# TSIG key for communicating with BIND.
|
|
|
111 |
# Values: STRING
|
|
|
112 |
#
|
|
|
113 |
keyfile =
|
|
|
114 |
|