-
Notifications
You must be signed in to change notification settings - Fork 0
/
iptables-ipset-subnet.conf
59 lines (46 loc) · 1.5 KB
/
iptables-ipset-subnet.conf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
[INCLUDES]
before = iptables-common.conf
[Definition]
# Option: actionstart
# Notes.: command executed once at the start of Fail2Ban.
# Values: CMD
#
actionstart = ipset create <setname> hash:net family <ipfamily>
<iptables> -I <chain> -p <protocol> -m multiport --dports <port> -m set --match-set <setname> src -j <blocktype>
# Option: actionflush
# Notes.: command executed once to flush IPS, by shutdown (resp. by stop of the jail or this action)
# Values: CMD
#
actionflush = ipset flush <setname>
# Option: actionstop
# Notes.: command executed once at the end of Fail2Ban
# Values: CMD
#
actionstop = <iptables> -D <chain> -p <protocol> -m multiport --dports <port> -m set --match-set <setname> src -j <blocktype>
<actionflush>
ipset destroy <setname>
# Option: actionban
# Notes.: command executed when banning an IP. Take care that the
# command is executed with Fail2Ban user rights.
# Tags: See jail.conf(5) man page
# Values: CMD
#
actionban = ipset test <setname> <ip>/<mask> || ipset add <setname> <ip>/<mask>
# Option: actionunban
# Notes.: command executed when unbanning an IP. Take care that the
# command is executed with Fail2Ban user rights.
# Tags: See jail.conf(5) man page
# Values: CMD
#
actionunban = ipset test <setname> <ip>/<mask> && ipset del <setname> <ip>/<mask>
[Init]
ipfamily=inet
setname=f2b-<name>
mask4=24
mask6=64
mask=<mask4>
[Init?family=inet6]
ipfamily=inet6
ipver=v6
setname=f2b-<name>-v6
mask=<mask6>