2013-12-14 09:06:01 +00:00
|
|
|
# Fail2Ban action file for firewall-cmd/ipset
|
|
|
|
#
|
|
|
|
# This requires:
|
|
|
|
# ipset (package: ipset)
|
|
|
|
# firewall-cmd (package: firewalld)
|
|
|
|
#
|
|
|
|
# This is for ipset protocol 6 (and hopefully later) (ipset v6.14).
|
|
|
|
# Use ipset -V to see the protocol and version.
|
|
|
|
#
|
|
|
|
# IPset was a feature introduced in the linux kernel 2.6.39 and 3.0.0 kernels.
|
|
|
|
#
|
|
|
|
# If you are running on an older kernel you make need to patch in external
|
|
|
|
# modules.
|
|
|
|
|
|
|
|
[INCLUDES]
|
|
|
|
|
2016-05-14 01:36:27 +00:00
|
|
|
before = firewallcmd-common.conf
|
2013-12-14 09:06:01 +00:00
|
|
|
|
|
|
|
[Definition]
|
|
|
|
|
2017-12-06 01:38:10 +00:00
|
|
|
actionstart = ipset create <ipmset> hash:ip timeout <default-timeout><familyopt>
|
2018-01-10 11:05:26 +00:00
|
|
|
firewall-cmd --direct --add-rule <family> filter <chain> 0 <actiontype> -m set --match-set <ipmset> src -j <blocktype>
|
2013-12-14 09:06:01 +00:00
|
|
|
|
2017-12-06 00:10:56 +00:00
|
|
|
actionflush = ipset flush <ipmset>
|
|
|
|
|
2018-01-10 11:05:26 +00:00
|
|
|
actionstop = firewall-cmd --direct --remove-rule <family> filter <chain> 0 <actiontype> -m set --match-set <ipmset> src -j <blocktype>
|
2017-12-06 00:10:56 +00:00
|
|
|
<actionflush>
|
2016-05-14 13:00:23 +00:00
|
|
|
ipset destroy <ipmset>
|
2013-12-14 09:06:01 +00:00
|
|
|
|
2016-05-14 13:00:23 +00:00
|
|
|
actionban = ipset add <ipmset> <ip> timeout <bantime> -exist
|
2013-12-14 09:06:01 +00:00
|
|
|
|
2017-03-15 09:15:48 +00:00
|
|
|
actionprolong = %(actionban)s
|
|
|
|
|
2016-05-14 13:00:23 +00:00
|
|
|
actionunban = ipset del <ipmset> <ip> -exist
|
2013-12-14 09:06:01 +00:00
|
|
|
|
|
|
|
[Init]
|
|
|
|
|
|
|
|
# Option: chain
|
|
|
|
# Notes specifies the iptables chain to which the fail2ban rules should be
|
|
|
|
# added
|
|
|
|
# Values: [ STRING ]
|
|
|
|
#
|
|
|
|
chain = INPUT_direct
|
|
|
|
|
2017-12-06 01:38:10 +00:00
|
|
|
# Option: default-timeout
|
|
|
|
# Notes: specifies default timeout in seconds (handled default ipset timeout only)
|
|
|
|
# Values: [ NUM ] Default: 600
|
|
|
|
|
|
|
|
default-timeout = 600
|
|
|
|
|
2018-01-10 09:11:11 +00:00
|
|
|
# Option: actiontype
|
|
|
|
# Notes.: defines additions to the blocking rule
|
|
|
|
# Values: leave empty to block all attempts from the host
|
|
|
|
# Default: Value of the multiport
|
|
|
|
actiontype = <multiport>
|
|
|
|
|
|
|
|
# Option: allports
|
|
|
|
# Notes.: default addition to block all ports
|
|
|
|
# Usage.: use in jail config: banaction = firewallcmd-ipset[actiontype=<allports>]
|
|
|
|
# for all protocols: banaction = firewallcmd-ipset[actiontype=""]
|
|
|
|
allports = -p <protocol>
|
|
|
|
|
|
|
|
# Option: multiport
|
|
|
|
# Notes.: addition to block access only to specific ports
|
|
|
|
# Usage.: use in jail config: banaction = firewallcmd-ipset[actiontype=<multiport>]
|
|
|
|
multiport = -p <protocol> -m multiport --dports <port>
|
|
|
|
|
2016-05-14 13:00:23 +00:00
|
|
|
ipmset = f2b-<name>
|
2017-12-05 22:34:03 +00:00
|
|
|
familyopt =
|
2016-05-14 13:00:23 +00:00
|
|
|
|
|
|
|
[Init?family=inet6]
|
|
|
|
|
|
|
|
ipmset = f2b-<name>6
|
2017-12-05 22:34:03 +00:00
|
|
|
familyopt = <sp>family inet6
|
2016-05-14 13:00:23 +00:00
|
|
|
|
2013-12-14 09:06:01 +00:00
|
|
|
|
|
|
|
# DEV NOTES:
|
|
|
|
#
|
|
|
|
# Author: Edgar Hoch and Daniel Black
|
|
|
|
# firewallcmd-new / iptables-ipset-proto6 combined for maximium goodness
|