Subversion Repositories configs

Rev

Rev 192 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
192 - 1
# Fail2Ban action file for firewall-cmd/ipset
2
#
3
# This requires:
4
# ipset (package: ipset)
5
# firewall-cmd (package: firewalld)
6
#
7
# This is for ipset protocol 6 (and hopefully later) (ipset v6.14).
8
# Use ipset -V to see the protocol and version.
9
#
10
# IPset was a feature introduced in the linux kernel 2.6.39 and 3.0.0 kernels.
11
#
12
# If you are running on an older kernel you make need to patch in external
13
# modules.
14
 
15
[INCLUDES]
16
 
17
before = firewallcmd-common.conf
18
 
19
[Definition]
20
 
193 - 21
actionstart = ipset create <ipmset> hash:ip timeout <default-ipsettime> <familyopt>
192 - 22
              firewall-cmd --direct --add-rule <family> filter <chain> 0 <actiontype> -m set --match-set <ipmset> src -j <blocktype>
23
 
24
actionflush = ipset flush <ipmset>
25
 
26
actionstop = firewall-cmd --direct --remove-rule <family> filter <chain> 0 <actiontype> -m set --match-set <ipmset> src -j <blocktype>
27
             <actionflush>
28
             ipset destroy <ipmset>
29
 
193 - 30
actionban = ipset add <ipmset> <ip> timeout <ipsettime> -exist
192 - 31
 
193 - 32
# actionprolong = %(actionban)s
192 - 33
 
34
actionunban = ipset del <ipmset> <ip> -exist
35
 
36
[Init]
37
 
38
# Option:  chain
39
# Notes    specifies the iptables chain to which the fail2ban rules should be
40
#          added
41
# Values:  [ STRING ]
42
#
43
chain = INPUT_direct
44
 
193 - 45
# Option: default-ipsettime
192 - 46
# Notes:  specifies default timeout in seconds (handled default ipset timeout only)
193 - 47
# Values:  [ NUM ]  Default: 0 (no timeout, managed by fail2ban by unban)
48
default-ipsettime = 0
192 - 49
 
193 - 50
# Option: ipsettime
51
# Notes:  specifies ticket timeout (handled ipset timeout only)
52
# Values:  [ NUM ]  Default: 0 (managed by fail2ban by unban)
53
ipsettime = 0
192 - 54
 
193 - 55
# expresion to caclulate timeout from bantime, example:
56
# banaction = %(known/banaction)s[ipsettime='<timeout-bantime>']
57
timeout-bantime = $([ "<bantime>" -le 2147483 ] && echo "<bantime>" || echo 0)
58
 
192 - 59
# Option: actiontype
60
# Notes.: defines additions to the blocking rule
61
# Values: leave empty to block all attempts from the host
62
# Default: Value of the multiport
63
actiontype = <multiport>
64
 
65
# Option: allports
66
# Notes.: default addition to block all ports
67
# Usage.: use in jail config:  banaction = firewallcmd-ipset[actiontype=<allports>]
68
#         for all protocols:   banaction = firewallcmd-ipset[actiontype=""]
69
allports = -p <protocol>
70
 
71
# Option: multiport
72
# Notes.: addition to block access only to specific ports
73
# Usage.: use in jail config:  banaction = firewallcmd-ipset[actiontype=<multiport>]
193 - 74
multiport = -p <protocol> -m multiport --dports "$(echo '<port>' | sed s/:/-/g)"
192 - 75
 
76
ipmset = f2b-<name>
77
familyopt =
78
 
79
[Init?family=inet6]
80
 
81
ipmset = f2b-<name>6
193 - 82
familyopt = family inet6
192 - 83
 
84
 
85
# DEV NOTES:
86
#
87
# Author: Edgar Hoch and Daniel Black
88
# firewallcmd-new / iptables-ipset-proto6 combined for maximium goodness