mirror of https://github.com/fail2ban/fail2ban
commit
ffc9fb4aa6
1
MANIFEST
1
MANIFEST
|
@ -24,7 +24,6 @@ config/action.d/hostsdeny.conf
|
||||||
config/action.d/ipfilter.conf
|
config/action.d/ipfilter.conf
|
||||||
config/action.d/ipfw.conf
|
config/action.d/ipfw.conf
|
||||||
config/action.d/iptables-allports.conf
|
config/action.d/iptables-allports.conf
|
||||||
config/action.d/iptables-common.conf
|
|
||||||
config/action.d/iptables.conf
|
config/action.d/iptables.conf
|
||||||
config/action.d/iptables-ipset-proto4.conf
|
config/action.d/iptables-ipset-proto4.conf
|
||||||
config/action.d/iptables-ipset-proto6-allports.conf
|
config/action.d/iptables-ipset-proto6-allports.conf
|
||||||
|
|
|
@ -35,15 +35,15 @@ actionunban = <ipstype_<ipsettype>/actionunban>
|
||||||
|
|
||||||
[ipstype_ipset]
|
[ipstype_ipset]
|
||||||
|
|
||||||
actionstart = ipset create <ipmset> hash:ip timeout <default-ipsettime> <familyopt>
|
actionstart = ipset -exist create <ipmset> hash:ip timeout <default-ipsettime> <familyopt>
|
||||||
|
|
||||||
actionflush = ipset flush <ipmset>
|
actionflush = ipset flush <ipmset>
|
||||||
|
|
||||||
actionstop = ipset destroy <ipmset>
|
actionstop = ipset destroy <ipmset>
|
||||||
|
|
||||||
actionban = ipset add <ipmset> <ip> timeout <ipsettime> -exist
|
actionban = ipset -exist add <ipmset> <ip> timeout <ipsettime>
|
||||||
|
|
||||||
actionunban = ipset del <ipmset> <ip> -exist
|
actionunban = ipset -exist del <ipmset> <ip>
|
||||||
|
|
||||||
[ipstype_firewalld]
|
[ipstype_firewalld]
|
||||||
|
|
||||||
|
|
|
@ -4,52 +4,12 @@
|
||||||
# Modified: Yaroslav O. Halchenko <debian@onerussian.com>
|
# Modified: Yaroslav O. Halchenko <debian@onerussian.com>
|
||||||
# made active on all ports from original iptables.conf
|
# made active on all ports from original iptables.conf
|
||||||
#
|
#
|
||||||
#
|
# Obsolete: superseded by iptables[type=allports]
|
||||||
|
|
||||||
[INCLUDES]
|
[INCLUDES]
|
||||||
|
|
||||||
before = iptables-common.conf
|
before = iptables.conf
|
||||||
|
|
||||||
|
|
||||||
[Definition]
|
[Definition]
|
||||||
|
|
||||||
# Option: actionstart
|
type = allports
|
||||||
# Notes.: command executed on demand at the first ban (or at the start of Fail2Ban if actionstart_on_demand is set to false).
|
|
||||||
# Values: CMD
|
|
||||||
#
|
|
||||||
actionstart = <iptables> -N f2b-<name>
|
|
||||||
<iptables> -A f2b-<name> -j <returntype>
|
|
||||||
<iptables> -I <chain> -p <protocol> -j f2b-<name>
|
|
||||||
|
|
||||||
# Option: actionstop
|
|
||||||
# Notes.: command executed at the stop of jail (or at the end of Fail2Ban)
|
|
||||||
# Values: CMD
|
|
||||||
#
|
|
||||||
actionstop = <iptables> -D <chain> -p <protocol> -j f2b-<name>
|
|
||||||
<actionflush>
|
|
||||||
<iptables> -X f2b-<name>
|
|
||||||
|
|
||||||
# Option: actioncheck
|
|
||||||
# Notes.: command executed once before each actionban command
|
|
||||||
# Values: CMD
|
|
||||||
#
|
|
||||||
actioncheck = <iptables> -n -L <chain> | grep -q 'f2b-<name>[ \t]'
|
|
||||||
|
|
||||||
# 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 = <iptables> -I f2b-<name> 1 -s <ip> -j <blocktype>
|
|
||||||
|
|
||||||
# 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 = <iptables> -D f2b-<name> -s <ip> -j <blocktype>
|
|
||||||
|
|
||||||
[Init]
|
|
||||||
|
|
||||||
|
|
|
@ -1,92 +0,0 @@
|
||||||
# Fail2Ban configuration file
|
|
||||||
#
|
|
||||||
# Author: Daniel Black
|
|
||||||
#
|
|
||||||
# This is a included configuration file and includes the definitions for the iptables
|
|
||||||
# used in all iptables based actions by default.
|
|
||||||
#
|
|
||||||
# The user can override the defaults in iptables-common.local
|
|
||||||
#
|
|
||||||
# Modified: Alexander Koeppe <format_c@online.de>, Serg G. Brester <serg.brester@sebres.de>
|
|
||||||
# made config file IPv6 capable (see new section Init?family=inet6)
|
|
||||||
|
|
||||||
[INCLUDES]
|
|
||||||
|
|
||||||
after = iptables-blocktype.local
|
|
||||||
iptables-common.local
|
|
||||||
# iptables-blocktype.local is obsolete
|
|
||||||
|
|
||||||
[Definition]
|
|
||||||
|
|
||||||
# Option: actionflush
|
|
||||||
# Notes.: command executed once to flush IPS, by shutdown (resp. by stop of the jail or this action)
|
|
||||||
# Values: CMD
|
|
||||||
#
|
|
||||||
actionflush = <iptables> -F f2b-<name>
|
|
||||||
|
|
||||||
|
|
||||||
[Init]
|
|
||||||
|
|
||||||
# Option: chain
|
|
||||||
# Notes specifies the iptables chain to which the Fail2Ban rules should be
|
|
||||||
# added
|
|
||||||
# Values: STRING Default: INPUT
|
|
||||||
chain = INPUT
|
|
||||||
|
|
||||||
# Default name of the chain
|
|
||||||
#
|
|
||||||
name = default
|
|
||||||
|
|
||||||
# Option: port
|
|
||||||
# Notes.: specifies port to monitor
|
|
||||||
# Values: [ NUM | STRING ] Default:
|
|
||||||
#
|
|
||||||
port = ssh
|
|
||||||
|
|
||||||
# Option: protocol
|
|
||||||
# Notes.: internally used by config reader for interpolations.
|
|
||||||
# Values: [ tcp | udp | icmp | all ] Default: tcp
|
|
||||||
#
|
|
||||||
protocol = tcp
|
|
||||||
|
|
||||||
# Option: blocktype
|
|
||||||
# Note: This is what the action does with rules. This can be any jump target
|
|
||||||
# as per the iptables man page (section 8). Common values are DROP
|
|
||||||
# REJECT, REJECT --reject-with icmp-port-unreachable
|
|
||||||
# Values: STRING
|
|
||||||
blocktype = REJECT --reject-with icmp-port-unreachable
|
|
||||||
|
|
||||||
# Option: returntype
|
|
||||||
# Note: This is the default rule on "actionstart". This should be RETURN
|
|
||||||
# in all (blocking) actions, except REJECT in allowing actions.
|
|
||||||
# Values: STRING
|
|
||||||
returntype = RETURN
|
|
||||||
|
|
||||||
# Option: lockingopt
|
|
||||||
# Notes.: Option was introduced to iptables to prevent multiple instances from
|
|
||||||
# running concurrently and causing irratic behavior. -w was introduced
|
|
||||||
# in iptables 1.4.20, so might be absent on older systems
|
|
||||||
# See https://github.com/fail2ban/fail2ban/issues/1122
|
|
||||||
# Values: STRING
|
|
||||||
lockingopt = -w
|
|
||||||
|
|
||||||
# Option: iptables
|
|
||||||
# Notes.: Actual command to be executed, including common to all calls options
|
|
||||||
# Values: STRING
|
|
||||||
iptables = iptables <lockingopt>
|
|
||||||
|
|
||||||
|
|
||||||
[Init?family=inet6]
|
|
||||||
|
|
||||||
# Option: blocktype (ipv6)
|
|
||||||
# Note: This is what the action does with rules. This can be any jump target
|
|
||||||
# as per the iptables man page (section 8). Common values are DROP
|
|
||||||
# REJECT, REJECT --reject-with icmp6-port-unreachable
|
|
||||||
# Values: STRING
|
|
||||||
blocktype = REJECT --reject-with icmp6-port-unreachable
|
|
||||||
|
|
||||||
# Option: iptables (ipv6)
|
|
||||||
# Notes.: Actual command to be executed, including common to all calls options
|
|
||||||
# Values: STRING
|
|
||||||
iptables = ip6tables <lockingopt>
|
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
|
|
||||||
[INCLUDES]
|
[INCLUDES]
|
||||||
|
|
||||||
before = iptables-common.conf
|
before = iptables.conf
|
||||||
|
|
||||||
[Definition]
|
[Definition]
|
||||||
|
|
||||||
|
@ -28,7 +28,7 @@ before = iptables-common.conf
|
||||||
# Values: CMD
|
# Values: CMD
|
||||||
#
|
#
|
||||||
actionstart = ipset --create f2b-<name> iphash
|
actionstart = ipset --create f2b-<name> iphash
|
||||||
<iptables> -I <chain> -p <protocol> -m multiport --dports <port> -m set --match-set f2b-<name> src -j <blocktype>
|
<iptables> -I <chain> %(_ipt_chain_rule)s
|
||||||
|
|
||||||
|
|
||||||
# Option: actionflush
|
# Option: actionflush
|
||||||
|
@ -61,5 +61,6 @@ actionban = ipset --test f2b-<name> <ip> || ipset --add f2b-<name> <ip>
|
||||||
#
|
#
|
||||||
actionunban = ipset --test f2b-<name> <ip> && ipset --del f2b-<name> <ip>
|
actionunban = ipset --test f2b-<name> <ip> && ipset --del f2b-<name> <ip>
|
||||||
|
|
||||||
[Init]
|
# Several capabilities used internaly:
|
||||||
|
|
||||||
|
rule-jump = -m set --match-set f2b-<name> src -j <blocktype>
|
||||||
|
|
|
@ -15,73 +15,13 @@
|
||||||
#
|
#
|
||||||
# Modified: Alexander Koeppe <format_c@online.de>, Serg G. Brester <serg.brester@sebres.de>
|
# Modified: Alexander Koeppe <format_c@online.de>, Serg G. Brester <serg.brester@sebres.de>
|
||||||
# made config file IPv6 capable (see new section Init?family=inet6)
|
# made config file IPv6 capable (see new section Init?family=inet6)
|
||||||
|
#
|
||||||
|
# Obsolete: superseded by iptables-ipset[type=allports]
|
||||||
|
|
||||||
[INCLUDES]
|
[INCLUDES]
|
||||||
|
|
||||||
before = iptables-common.conf
|
before = iptables-ipset.conf
|
||||||
|
|
||||||
[Definition]
|
[Definition]
|
||||||
|
|
||||||
# Option: actionstart
|
type = allports
|
||||||
# Notes.: command executed on demand at the first ban (or at the start of Fail2Ban if actionstart_on_demand is set to false).
|
|
||||||
# Values: CMD
|
|
||||||
#
|
|
||||||
actionstart = ipset create <ipmset> hash:ip timeout <default-ipsettime> <familyopt>
|
|
||||||
<iptables> -I <chain> -m set --match-set <ipmset> 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 <ipmset>
|
|
||||||
|
|
||||||
# Option: actionstop
|
|
||||||
# Notes.: command executed at the stop of jail (or at the end of Fail2Ban)
|
|
||||||
# Values: CMD
|
|
||||||
#
|
|
||||||
actionstop = <iptables> -D <chain> -m set --match-set <ipmset> src -j <blocktype>
|
|
||||||
<actionflush>
|
|
||||||
ipset destroy <ipmset>
|
|
||||||
|
|
||||||
# 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 add <ipmset> <ip> timeout <ipsettime> -exist
|
|
||||||
|
|
||||||
# actionprolong = %(actionban)s
|
|
||||||
|
|
||||||
# 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 del <ipmset> <ip> -exist
|
|
||||||
|
|
||||||
[Init]
|
|
||||||
|
|
||||||
# Option: default-ipsettime
|
|
||||||
# Notes: specifies default timeout in seconds (handled default ipset timeout only)
|
|
||||||
# Values: [ NUM ] Default: 0 (no timeout, managed by fail2ban by unban)
|
|
||||||
default-ipsettime = 0
|
|
||||||
|
|
||||||
# Option: ipsettime
|
|
||||||
# Notes: specifies ticket timeout (handled ipset timeout only)
|
|
||||||
# Values: [ NUM ] Default: 0 (managed by fail2ban by unban)
|
|
||||||
ipsettime = 0
|
|
||||||
|
|
||||||
# expresion to caclulate timeout from bantime, example:
|
|
||||||
# banaction = %(known/banaction)s[ipsettime='<timeout-bantime>']
|
|
||||||
timeout-bantime = $([ "<bantime>" -le 2147483 ] && echo "<bantime>" || echo 0)
|
|
||||||
|
|
||||||
ipmset = f2b-<name>
|
|
||||||
familyopt =
|
|
||||||
|
|
||||||
|
|
||||||
[Init?family=inet6]
|
|
||||||
|
|
||||||
ipmset = f2b-<name>6
|
|
||||||
familyopt = family inet6
|
|
||||||
|
|
|
@ -15,73 +15,13 @@
|
||||||
#
|
#
|
||||||
# Modified: Alexander Koeppe <format_c@online.de>, Serg G. Brester <serg.brester@sebres.de>
|
# Modified: Alexander Koeppe <format_c@online.de>, Serg G. Brester <serg.brester@sebres.de>
|
||||||
# made config file IPv6 capable (see new section Init?family=inet6)
|
# made config file IPv6 capable (see new section Init?family=inet6)
|
||||||
|
#
|
||||||
|
# Obsolete: superseded by iptables-ipset[type=multiport]
|
||||||
|
|
||||||
[INCLUDES]
|
[INCLUDES]
|
||||||
|
|
||||||
before = iptables-common.conf
|
before = iptables-ipset.conf
|
||||||
|
|
||||||
[Definition]
|
[Definition]
|
||||||
|
|
||||||
# Option: actionstart
|
type = multiport
|
||||||
# Notes.: command executed on demand at the first ban (or at the start of Fail2Ban if actionstart_on_demand is set to false).
|
|
||||||
# Values: CMD
|
|
||||||
#
|
|
||||||
actionstart = ipset create <ipmset> hash:ip timeout <default-ipsettime> <familyopt>
|
|
||||||
<iptables> -I <chain> -p <protocol> -m multiport --dports <port> -m set --match-set <ipmset> 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 <ipmset>
|
|
||||||
|
|
||||||
# Option: actionstop
|
|
||||||
# Notes.: command executed at the stop of jail (or at the end of Fail2Ban)
|
|
||||||
# Values: CMD
|
|
||||||
#
|
|
||||||
actionstop = <iptables> -D <chain> -p <protocol> -m multiport --dports <port> -m set --match-set <ipmset> src -j <blocktype>
|
|
||||||
<actionflush>
|
|
||||||
ipset destroy <ipmset>
|
|
||||||
|
|
||||||
# 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 add <ipmset> <ip> timeout <ipsettime> -exist
|
|
||||||
|
|
||||||
# actionprolong = %(actionban)s
|
|
||||||
|
|
||||||
# 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 del <ipmset> <ip> -exist
|
|
||||||
|
|
||||||
[Init]
|
|
||||||
|
|
||||||
# Option: default-ipsettime
|
|
||||||
# Notes: specifies default timeout in seconds (handled default ipset timeout only)
|
|
||||||
# Values: [ NUM ] Default: 0 (no timeout, managed by fail2ban by unban)
|
|
||||||
default-ipsettime = 0
|
|
||||||
|
|
||||||
# Option: ipsettime
|
|
||||||
# Notes: specifies ticket timeout (handled ipset timeout only)
|
|
||||||
# Values: [ NUM ] Default: 0 (managed by fail2ban by unban)
|
|
||||||
ipsettime = 0
|
|
||||||
|
|
||||||
# expresion to caclulate timeout from bantime, example:
|
|
||||||
# banaction = %(known/banaction)s[ipsettime='<timeout-bantime>']
|
|
||||||
timeout-bantime = $([ "<bantime>" -le 2147483 ] && echo "<bantime>" || echo 0)
|
|
||||||
|
|
||||||
ipmset = f2b-<name>
|
|
||||||
familyopt =
|
|
||||||
|
|
||||||
|
|
||||||
[Init?family=inet6]
|
|
||||||
|
|
||||||
ipmset = f2b-<name>6
|
|
||||||
familyopt = family inet6
|
|
||||||
|
|
|
@ -0,0 +1,90 @@
|
||||||
|
# Fail2Ban configuration file
|
||||||
|
#
|
||||||
|
# Authors: Sergey G Brester (sebres), Daniel Black, Alexander Koeppe
|
||||||
|
#
|
||||||
|
# This is for ipset protocol 6 (and hopefully later) (ipset v6.14).
|
||||||
|
# Use ipset -V to see the protocol and version. Version 4 should use
|
||||||
|
# iptables-ipset-proto4.conf.
|
||||||
|
#
|
||||||
|
# This requires the program ipset which is normally in package called ipset.
|
||||||
|
#
|
||||||
|
# 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]
|
||||||
|
|
||||||
|
before = iptables.conf
|
||||||
|
|
||||||
|
[Definition]
|
||||||
|
|
||||||
|
# Option: actionstart
|
||||||
|
# Notes.: command executed on demand at the first ban (or at the start of Fail2Ban if actionstart_on_demand is set to false).
|
||||||
|
# Values: CMD
|
||||||
|
#
|
||||||
|
actionstart = ipset -exist create <ipmset> hash:ip timeout <default-ipsettime> <familyopt>
|
||||||
|
{ %(_ipt_check_rule)s >/dev/null 2>&1; } || { <iptables> -I <chain> %(_ipt_chain_rule)s; }
|
||||||
|
|
||||||
|
# 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 <ipmset>
|
||||||
|
|
||||||
|
# Option: actionstop
|
||||||
|
# Notes.: command executed at the stop of jail (or at the end of Fail2Ban)
|
||||||
|
# Values: CMD
|
||||||
|
#
|
||||||
|
actionstop = <iptables> -D <chain> %(_ipt_chain_rule)s
|
||||||
|
<actionflush>
|
||||||
|
ipset destroy <ipmset>
|
||||||
|
|
||||||
|
# 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 -exist add <ipmset> <ip> timeout <ipsettime>
|
||||||
|
|
||||||
|
# actionprolong = %(actionban)s
|
||||||
|
|
||||||
|
# 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 -exist del <ipmset> <ip>
|
||||||
|
|
||||||
|
# Several capabilities used internaly:
|
||||||
|
|
||||||
|
rule-jump = -m set --match-set <ipmset> src -j <blocktype>
|
||||||
|
|
||||||
|
|
||||||
|
[Init]
|
||||||
|
|
||||||
|
# Option: default-ipsettime
|
||||||
|
# Notes: specifies default timeout in seconds (handled default ipset timeout only)
|
||||||
|
# Values: [ NUM ] Default: 0 (no timeout, managed by fail2ban by unban)
|
||||||
|
default-ipsettime = 0
|
||||||
|
|
||||||
|
# Option: ipsettime
|
||||||
|
# Notes: specifies ticket timeout (handled ipset timeout only)
|
||||||
|
# Values: [ NUM ] Default: 0 (managed by fail2ban by unban)
|
||||||
|
ipsettime = 0
|
||||||
|
|
||||||
|
# expresion to caclulate timeout from bantime, example:
|
||||||
|
# banaction = %(known/banaction)s[ipsettime='<timeout-bantime>']
|
||||||
|
timeout-bantime = $([ "<bantime>" -le 2147483 ] && echo "<bantime>" || echo 0)
|
||||||
|
|
||||||
|
ipmset = f2b-<name>
|
||||||
|
familyopt =
|
||||||
|
|
||||||
|
|
||||||
|
[Init?family=inet6]
|
||||||
|
|
||||||
|
ipmset = f2b-<name>6
|
||||||
|
familyopt = family inet6
|
|
@ -11,7 +11,7 @@
|
||||||
|
|
||||||
[INCLUDES]
|
[INCLUDES]
|
||||||
|
|
||||||
before = iptables-common.conf
|
before = iptables.conf
|
||||||
|
|
||||||
[Definition]
|
[Definition]
|
||||||
|
|
||||||
|
|
|
@ -3,50 +3,12 @@
|
||||||
# Author: Cyril Jaquier
|
# Author: Cyril Jaquier
|
||||||
# Modified by Yaroslav Halchenko for multiport banning
|
# Modified by Yaroslav Halchenko for multiport banning
|
||||||
#
|
#
|
||||||
|
# Obsolete: superseded by iptables[type=multiport]
|
||||||
|
|
||||||
[INCLUDES]
|
[INCLUDES]
|
||||||
|
|
||||||
before = iptables-common.conf
|
before = iptables.conf
|
||||||
|
|
||||||
[Definition]
|
[Definition]
|
||||||
|
|
||||||
# Option: actionstart
|
type = multiport
|
||||||
# Notes.: command executed on demand at the first ban (or at the start of Fail2Ban if actionstart_on_demand is set to false).
|
|
||||||
# Values: CMD
|
|
||||||
#
|
|
||||||
actionstart = <iptables> -N f2b-<name>
|
|
||||||
<iptables> -A f2b-<name> -j <returntype>
|
|
||||||
<iptables> -I <chain> -p <protocol> -m multiport --dports <port> -j f2b-<name>
|
|
||||||
|
|
||||||
# Option: actionstop
|
|
||||||
# Notes.: command executed at the stop of jail (or at the end of Fail2Ban)
|
|
||||||
# Values: CMD
|
|
||||||
#
|
|
||||||
actionstop = <iptables> -D <chain> -p <protocol> -m multiport --dports <port> -j f2b-<name>
|
|
||||||
<actionflush>
|
|
||||||
<iptables> -X f2b-<name>
|
|
||||||
|
|
||||||
# Option: actioncheck
|
|
||||||
# Notes.: command executed once before each actionban command
|
|
||||||
# Values: CMD
|
|
||||||
#
|
|
||||||
actioncheck = <iptables> -n -L <chain> | grep -q 'f2b-<name>[ \t]'
|
|
||||||
|
|
||||||
# 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 = <iptables> -I f2b-<name> 1 -s <ip> -j <blocktype>
|
|
||||||
|
|
||||||
# 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 = <iptables> -D f2b-<name> -s <ip> -j <blocktype>
|
|
||||||
|
|
||||||
[Init]
|
|
||||||
|
|
||||||
|
|
|
@ -4,51 +4,12 @@
|
||||||
# Copied from iptables.conf and modified by Yaroslav Halchenko
|
# Copied from iptables.conf and modified by Yaroslav Halchenko
|
||||||
# to fulfill the needs of bugreporter dbts#350746.
|
# to fulfill the needs of bugreporter dbts#350746.
|
||||||
#
|
#
|
||||||
#
|
# Obsolete: superseded by iptables[pre-rule='-m state --state NEW<sp>']
|
||||||
|
|
||||||
[INCLUDES]
|
[INCLUDES]
|
||||||
|
|
||||||
before = iptables-common.conf
|
before = iptables.conf
|
||||||
|
|
||||||
[Definition]
|
[Definition]
|
||||||
|
|
||||||
# Option: actionstart
|
pre-rule = -m state --state NEW<sp>
|
||||||
# Notes.: command executed on demand at the first ban (or at the start of Fail2Ban if actionstart_on_demand is set to false).
|
|
||||||
# Values: CMD
|
|
||||||
#
|
|
||||||
actionstart = <iptables> -N f2b-<name>
|
|
||||||
<iptables> -A f2b-<name> -j <returntype>
|
|
||||||
<iptables> -I <chain> -m state --state NEW -p <protocol> --dport <port> -j f2b-<name>
|
|
||||||
|
|
||||||
# Option: actionstop
|
|
||||||
# Notes.: command executed at the stop of jail (or at the end of Fail2Ban)
|
|
||||||
# Values: CMD
|
|
||||||
#
|
|
||||||
actionstop = <iptables> -D <chain> -m state --state NEW -p <protocol> --dport <port> -j f2b-<name>
|
|
||||||
<actionflush>
|
|
||||||
<iptables> -X f2b-<name>
|
|
||||||
|
|
||||||
# Option: actioncheck
|
|
||||||
# Notes.: command executed once before each actionban command
|
|
||||||
# Values: CMD
|
|
||||||
#
|
|
||||||
actioncheck = <iptables> -n -L <chain> | grep -q 'f2b-<name>[ \t]'
|
|
||||||
|
|
||||||
# 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 = <iptables> -I f2b-<name> 1 -s <ip> -j <blocktype>
|
|
||||||
|
|
||||||
# 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 = <iptables> -D f2b-<name> -s <ip> -j <blocktype>
|
|
||||||
|
|
||||||
[Init]
|
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
|
|
||||||
[INCLUDES]
|
[INCLUDES]
|
||||||
|
|
||||||
before = iptables-common.conf
|
before = iptables.conf
|
||||||
|
|
||||||
[Definition]
|
[Definition]
|
||||||
|
|
||||||
|
@ -52,7 +52,7 @@ actionstop = echo / > /proc/net/xt_recent/<iptname>
|
||||||
# Notes.: command executed once before each actionban command
|
# Notes.: command executed once before each actionban command
|
||||||
# Values: CMD
|
# Values: CMD
|
||||||
#
|
#
|
||||||
actioncheck = test -e /proc/net/xt_recent/<iptname>
|
actioncheck = { <known/actioncheck>; } && test -e /proc/net/xt_recent/<iptname>
|
||||||
|
|
||||||
# Option: actionban
|
# Option: actionban
|
||||||
# Notes.: command executed when banning an IP. Take care that the
|
# Notes.: command executed when banning an IP. Take care that the
|
||||||
|
|
|
@ -1,28 +1,35 @@
|
||||||
# Fail2Ban configuration file
|
# Fail2Ban configuration file
|
||||||
#
|
#
|
||||||
# Author: Cyril Jaquier
|
# Authors: Sergey G. Brester (sebres), Cyril Jaquier, Daniel Black,
|
||||||
|
# Yaroslav O. Halchenko, Alexander Koeppe et al.
|
||||||
#
|
#
|
||||||
#
|
|
||||||
|
|
||||||
[INCLUDES]
|
|
||||||
|
|
||||||
before = iptables-common.conf
|
|
||||||
|
|
||||||
[Definition]
|
[Definition]
|
||||||
|
|
||||||
|
# Option: type
|
||||||
|
# Notes.: type of the action.
|
||||||
|
# Values: [ oneport | multiport | allports ] Default: oneport
|
||||||
|
#
|
||||||
|
type = oneport
|
||||||
|
|
||||||
|
# Option: actionflush
|
||||||
|
# Notes.: command executed once to flush IPS, by shutdown (resp. by stop of the jail or this action)
|
||||||
|
# Values: CMD
|
||||||
|
#
|
||||||
|
actionflush = <iptables> -F f2b-<name>
|
||||||
|
|
||||||
# Option: actionstart
|
# Option: actionstart
|
||||||
# Notes.: command executed on demand at the first ban (or at the start of Fail2Ban if actionstart_on_demand is set to false).
|
# Notes.: command executed on demand at the first ban (or at the start of Fail2Ban if actionstart_on_demand is set to false).
|
||||||
# Values: CMD
|
# Values: CMD
|
||||||
#
|
#
|
||||||
actionstart = <iptables> -N f2b-<name>
|
actionstart = { <iptables> -C f2b-<name> -j <returntype> >/dev/null 2>&1; } || { <iptables> -N f2b-<name> || true; <iptables> -A f2b-<name> -j <returntype>; }
|
||||||
<iptables> -A f2b-<name> -j <returntype>
|
{ %(_ipt_check_rule)s >/dev/null 2>&1; } || { <iptables> -I <chain> %(_ipt_chain_rule)s; }
|
||||||
<iptables> -I <chain> -p <protocol> --dport <port> -j f2b-<name>
|
|
||||||
|
|
||||||
# Option: actionstop
|
# Option: actionstop
|
||||||
# Notes.: command executed at the stop of jail (or at the end of Fail2Ban)
|
# Notes.: command executed at the stop of jail (or at the end of Fail2Ban)
|
||||||
# Values: CMD
|
# Values: CMD
|
||||||
#
|
#
|
||||||
actionstop = <iptables> -D <chain> -p <protocol> --dport <port> -j f2b-<name>
|
actionstop = <iptables> -D <chain> %(_ipt_chain_rule)s
|
||||||
<actionflush>
|
<actionflush>
|
||||||
<iptables> -X f2b-<name>
|
<iptables> -X f2b-<name>
|
||||||
|
|
||||||
|
@ -30,7 +37,7 @@ actionstop = <iptables> -D <chain> -p <protocol> --dport <port> -j f2b-<name>
|
||||||
# Notes.: command executed once before each actionban command
|
# Notes.: command executed once before each actionban command
|
||||||
# Values: CMD
|
# Values: CMD
|
||||||
#
|
#
|
||||||
actioncheck = <iptables> -n -L <chain> | grep -q 'f2b-<name>[ \t]'
|
actioncheck = <_ipt_check_rule>
|
||||||
|
|
||||||
# Option: actionban
|
# Option: actionban
|
||||||
# Notes.: command executed when banning an IP. Take care that the
|
# Notes.: command executed when banning an IP. Take care that the
|
||||||
|
@ -48,5 +55,93 @@ actionban = <iptables> -I f2b-<name> 1 -s <ip> -j <blocktype>
|
||||||
#
|
#
|
||||||
actionunban = <iptables> -D f2b-<name> -s <ip> -j <blocktype>
|
actionunban = <iptables> -D f2b-<name> -s <ip> -j <blocktype>
|
||||||
|
|
||||||
|
# Option: pre-rule
|
||||||
|
# Notes.: prefix parameter(s) inserted to the begin of rule. No default (empty)
|
||||||
|
#
|
||||||
|
pre-rule =
|
||||||
|
|
||||||
|
rule-jump = -j <_ipt_rule_target>
|
||||||
|
|
||||||
|
# Several capabilities used internaly:
|
||||||
|
|
||||||
|
_ipt_chain_rule = <pre-rule><ipt_<type>/_chain_rule>
|
||||||
|
_ipt_check_rule = <iptables> -C <chain> %(_ipt_chain_rule)s
|
||||||
|
_ipt_rule_target = f2b-<name>
|
||||||
|
|
||||||
|
[ipt_oneport]
|
||||||
|
|
||||||
|
_chain_rule = -p <protocol> --dport <port> <rule-jump>
|
||||||
|
|
||||||
|
[ipt_multiport]
|
||||||
|
|
||||||
|
_chain_rule = -p <protocol> -m multiport --dports <port> <rule-jump>
|
||||||
|
|
||||||
|
[ipt_allports]
|
||||||
|
|
||||||
|
_chain_rule = -p <protocol> <rule-jump>
|
||||||
|
|
||||||
|
|
||||||
[Init]
|
[Init]
|
||||||
|
|
||||||
|
# Option: chain
|
||||||
|
# Notes specifies the iptables chain to which the Fail2Ban rules should be
|
||||||
|
# added
|
||||||
|
# Values: STRING Default: INPUT
|
||||||
|
chain = INPUT
|
||||||
|
|
||||||
|
# Default name of the chain
|
||||||
|
#
|
||||||
|
name = default
|
||||||
|
|
||||||
|
# Option: port
|
||||||
|
# Notes.: specifies port to monitor
|
||||||
|
# Values: [ NUM | STRING ] Default:
|
||||||
|
#
|
||||||
|
port = ssh
|
||||||
|
|
||||||
|
# Option: protocol
|
||||||
|
# Notes.: internally used by config reader for interpolations.
|
||||||
|
# Values: [ tcp | udp | icmp | all ] Default: tcp
|
||||||
|
#
|
||||||
|
protocol = tcp
|
||||||
|
|
||||||
|
# Option: blocktype
|
||||||
|
# Note: This is what the action does with rules. This can be any jump target
|
||||||
|
# as per the iptables man page (section 8). Common values are DROP
|
||||||
|
# REJECT, REJECT --reject-with icmp-port-unreachable
|
||||||
|
# Values: STRING
|
||||||
|
blocktype = REJECT --reject-with icmp-port-unreachable
|
||||||
|
|
||||||
|
# Option: returntype
|
||||||
|
# Note: This is the default rule on "actionstart". This should be RETURN
|
||||||
|
# in all (blocking) actions, except REJECT in allowing actions.
|
||||||
|
# Values: STRING
|
||||||
|
returntype = RETURN
|
||||||
|
|
||||||
|
# Option: lockingopt
|
||||||
|
# Notes.: Option was introduced to iptables to prevent multiple instances from
|
||||||
|
# running concurrently and causing irratic behavior. -w was introduced
|
||||||
|
# in iptables 1.4.20, so might be absent on older systems
|
||||||
|
# See https://github.com/fail2ban/fail2ban/issues/1122
|
||||||
|
# Values: STRING
|
||||||
|
lockingopt = -w
|
||||||
|
|
||||||
|
# Option: iptables
|
||||||
|
# Notes.: Actual command to be executed, including common to all calls options
|
||||||
|
# Values: STRING
|
||||||
|
iptables = iptables <lockingopt>
|
||||||
|
|
||||||
|
|
||||||
|
[Init?family=inet6]
|
||||||
|
|
||||||
|
# Option: blocktype (ipv6)
|
||||||
|
# Note: This is what the action does with rules. This can be any jump target
|
||||||
|
# as per the iptables man page (section 8). Common values are DROP
|
||||||
|
# REJECT, REJECT --reject-with icmp6-port-unreachable
|
||||||
|
# Values: STRING
|
||||||
|
blocktype = REJECT --reject-with icmp6-port-unreachable
|
||||||
|
|
||||||
|
# Option: iptables (ipv6)
|
||||||
|
# Notes.: Actual command to be executed, including common to all calls options
|
||||||
|
# Values: STRING
|
||||||
|
iptables = ip6tables <lockingopt>
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
|
|
||||||
[INCLUDES]
|
[INCLUDES]
|
||||||
|
|
||||||
before = iptables-common.conf
|
before = iptables.conf
|
||||||
|
|
||||||
[Definition]
|
[Definition]
|
||||||
|
|
||||||
|
@ -41,6 +41,11 @@ actionban = echo 'all' >| /etc/symbiosis/firewall/blacklist.d/<ip>.auto
|
||||||
actionunban = rm -f /etc/symbiosis/firewall/blacklist.d/<ip>.auto
|
actionunban = rm -f /etc/symbiosis/firewall/blacklist.d/<ip>.auto
|
||||||
<iptables> -D <chain> -s <ip> -j <blocktype> || :
|
<iptables> -D <chain> -s <ip> -j <blocktype> || :
|
||||||
|
|
||||||
|
# [TODO] Flushing is currently not implemented for symbiosis blacklist.d
|
||||||
|
#
|
||||||
|
actionflush =
|
||||||
|
|
||||||
|
|
||||||
[Init]
|
[Init]
|
||||||
|
|
||||||
# Option: chain
|
# Option: chain
|
||||||
|
|
|
@ -698,7 +698,7 @@ class JailsReaderTestCache(LogCaptureTestCase):
|
||||||
cnt = self._getLoggedReadCount(r'filter\.d/common\.conf')
|
cnt = self._getLoggedReadCount(r'filter\.d/common\.conf')
|
||||||
self.assertTrue(cnt == 1, "Unexpected count by reading of filter files, cnt = %s" % cnt)
|
self.assertTrue(cnt == 1, "Unexpected count by reading of filter files, cnt = %s" % cnt)
|
||||||
# same with action:
|
# same with action:
|
||||||
cnt = self._getLoggedReadCount(r'action\.d/iptables-common\.conf')
|
cnt = self._getLoggedReadCount(r'action\.d/iptables\.conf')
|
||||||
self.assertTrue(cnt == 1, "Unexpected count by reading of action files, cnt = %s" % cnt)
|
self.assertTrue(cnt == 1, "Unexpected count by reading of action files, cnt = %s" % cnt)
|
||||||
finally:
|
finally:
|
||||||
configparserinc.logLevel = saved_ll
|
configparserinc.logLevel = saved_ll
|
||||||
|
|
|
@ -1506,14 +1506,16 @@ class ServerConfigReaderTests(LogCaptureTestCase):
|
||||||
('j-w-iptables-mp', 'iptables-multiport[name=%(__name__)s, bantime="10m", port="http,https", protocol="tcp", chain="<known/chain>"]', {
|
('j-w-iptables-mp', 'iptables-multiport[name=%(__name__)s, bantime="10m", port="http,https", protocol="tcp", chain="<known/chain>"]', {
|
||||||
'ip4': ('`iptables ', 'icmp-port-unreachable'), 'ip6': ('`ip6tables ', 'icmp6-port-unreachable'),
|
'ip4': ('`iptables ', 'icmp-port-unreachable'), 'ip6': ('`ip6tables ', 'icmp6-port-unreachable'),
|
||||||
'ip4-start': (
|
'ip4-start': (
|
||||||
"`iptables -w -N f2b-j-w-iptables-mp`",
|
"`{ iptables -w -C f2b-j-w-iptables-mp -j RETURN >/dev/null 2>&1; } || "
|
||||||
"`iptables -w -A f2b-j-w-iptables-mp -j RETURN`",
|
"{ iptables -w -N f2b-j-w-iptables-mp || true; iptables -w -A f2b-j-w-iptables-mp -j RETURN; }`",
|
||||||
"`iptables -w -I INPUT -p tcp -m multiport --dports http,https -j f2b-j-w-iptables-mp`",
|
"`{ iptables -w -C INPUT -p tcp -m multiport --dports http,https -j f2b-j-w-iptables-mp >/dev/null 2>&1; } || "
|
||||||
|
"{ iptables -w -I INPUT -p tcp -m multiport --dports http,https -j f2b-j-w-iptables-mp; }`",
|
||||||
),
|
),
|
||||||
'ip6-start': (
|
'ip6-start': (
|
||||||
"`ip6tables -w -N f2b-j-w-iptables-mp`",
|
"`{ ip6tables -w -C f2b-j-w-iptables-mp -j RETURN >/dev/null 2>&1; } || "
|
||||||
"`ip6tables -w -A f2b-j-w-iptables-mp -j RETURN`",
|
"{ ip6tables -w -N f2b-j-w-iptables-mp || true; ip6tables -w -A f2b-j-w-iptables-mp -j RETURN; }`",
|
||||||
"`ip6tables -w -I INPUT -p tcp -m multiport --dports http,https -j f2b-j-w-iptables-mp`",
|
"`{ ip6tables -w -C INPUT -p tcp -m multiport --dports http,https -j f2b-j-w-iptables-mp >/dev/null 2>&1; } || ",
|
||||||
|
"{ ip6tables -w -I INPUT -p tcp -m multiport --dports http,https -j f2b-j-w-iptables-mp; }`",
|
||||||
),
|
),
|
||||||
'flush': (
|
'flush': (
|
||||||
"`iptables -w -F f2b-j-w-iptables-mp`",
|
"`iptables -w -F f2b-j-w-iptables-mp`",
|
||||||
|
@ -1528,10 +1530,10 @@ class ServerConfigReaderTests(LogCaptureTestCase):
|
||||||
"`ip6tables -w -X f2b-j-w-iptables-mp`",
|
"`ip6tables -w -X f2b-j-w-iptables-mp`",
|
||||||
),
|
),
|
||||||
'ip4-check': (
|
'ip4-check': (
|
||||||
r"""`iptables -w -n -L INPUT | grep -q 'f2b-j-w-iptables-mp[ \t]'`""",
|
r"""`iptables -w -C INPUT -p tcp -m multiport --dports http,https -j f2b-j-w-iptables-mp`""",
|
||||||
),
|
),
|
||||||
'ip6-check': (
|
'ip6-check': (
|
||||||
r"""`ip6tables -w -n -L INPUT | grep -q 'f2b-j-w-iptables-mp[ \t]'`""",
|
r"""`ip6tables -w -C INPUT -p tcp -m multiport --dports http,https -j f2b-j-w-iptables-mp`""",
|
||||||
),
|
),
|
||||||
'ip4-ban': (
|
'ip4-ban': (
|
||||||
r"`iptables -w -I f2b-j-w-iptables-mp 1 -s 192.0.2.1 -j REJECT --reject-with icmp-port-unreachable`",
|
r"`iptables -w -I f2b-j-w-iptables-mp 1 -s 192.0.2.1 -j REJECT --reject-with icmp-port-unreachable`",
|
||||||
|
@ -1550,14 +1552,16 @@ class ServerConfigReaderTests(LogCaptureTestCase):
|
||||||
('j-w-iptables-ap', 'iptables-allports[name=%(__name__)s, bantime="10m", protocol="tcp", chain="<known/chain>"]', {
|
('j-w-iptables-ap', 'iptables-allports[name=%(__name__)s, bantime="10m", protocol="tcp", chain="<known/chain>"]', {
|
||||||
'ip4': ('`iptables ', 'icmp-port-unreachable'), 'ip6': ('`ip6tables ', 'icmp6-port-unreachable'),
|
'ip4': ('`iptables ', 'icmp-port-unreachable'), 'ip6': ('`ip6tables ', 'icmp6-port-unreachable'),
|
||||||
'ip4-start': (
|
'ip4-start': (
|
||||||
"`iptables -w -N f2b-j-w-iptables-ap`",
|
"`{ iptables -w -C f2b-j-w-iptables-ap -j RETURN >/dev/null 2>&1; } || "
|
||||||
"`iptables -w -A f2b-j-w-iptables-ap -j RETURN`",
|
"{ iptables -w -N f2b-j-w-iptables-ap || true; iptables -w -A f2b-j-w-iptables-ap -j RETURN; }`",
|
||||||
"`iptables -w -I INPUT -p tcp -j f2b-j-w-iptables-ap`",
|
"`{ iptables -w -C INPUT -p tcp -j f2b-j-w-iptables-ap >/dev/null 2>&1; } || ",
|
||||||
|
"{ iptables -w -I INPUT -p tcp -j f2b-j-w-iptables-ap; }`",
|
||||||
),
|
),
|
||||||
'ip6-start': (
|
'ip6-start': (
|
||||||
"`ip6tables -w -N f2b-j-w-iptables-ap`",
|
"`{ ip6tables -w -C f2b-j-w-iptables-ap -j RETURN >/dev/null 2>&1; } || "
|
||||||
"`ip6tables -w -A f2b-j-w-iptables-ap -j RETURN`",
|
"{ ip6tables -w -N f2b-j-w-iptables-ap || true; ip6tables -w -A f2b-j-w-iptables-ap -j RETURN; }`",
|
||||||
"`ip6tables -w -I INPUT -p tcp -j f2b-j-w-iptables-ap`",
|
"`{ ip6tables -w -C INPUT -p tcp -j f2b-j-w-iptables-ap >/dev/null 2>&1; } || ",
|
||||||
|
"{ ip6tables -w -I INPUT -p tcp -j f2b-j-w-iptables-ap; }`",
|
||||||
),
|
),
|
||||||
'flush': (
|
'flush': (
|
||||||
"`iptables -w -F f2b-j-w-iptables-ap`",
|
"`iptables -w -F f2b-j-w-iptables-ap`",
|
||||||
|
@ -1572,10 +1576,10 @@ class ServerConfigReaderTests(LogCaptureTestCase):
|
||||||
"`ip6tables -w -X f2b-j-w-iptables-ap`",
|
"`ip6tables -w -X f2b-j-w-iptables-ap`",
|
||||||
),
|
),
|
||||||
'ip4-check': (
|
'ip4-check': (
|
||||||
r"""`iptables -w -n -L INPUT | grep -q 'f2b-j-w-iptables-ap[ \t]'`""",
|
r"""`iptables -w -C INPUT -p tcp -j f2b-j-w-iptables-ap`""",
|
||||||
),
|
),
|
||||||
'ip6-check': (
|
'ip6-check': (
|
||||||
r"""`ip6tables -w -n -L INPUT | grep -q 'f2b-j-w-iptables-ap[ \t]'`""",
|
r"""`ip6tables -w -C INPUT -p tcp -j f2b-j-w-iptables-ap`""",
|
||||||
),
|
),
|
||||||
'ip4-ban': (
|
'ip4-ban': (
|
||||||
r"`iptables -w -I f2b-j-w-iptables-ap 1 -s 192.0.2.1 -j REJECT --reject-with icmp-port-unreachable`",
|
r"`iptables -w -I f2b-j-w-iptables-ap 1 -s 192.0.2.1 -j REJECT --reject-with icmp-port-unreachable`",
|
||||||
|
@ -1594,12 +1598,14 @@ class ServerConfigReaderTests(LogCaptureTestCase):
|
||||||
('j-w-iptables-ipset', 'iptables-ipset-proto6[name=%(__name__)s, port="http", protocol="tcp", chain="<known/chain>"]', {
|
('j-w-iptables-ipset', 'iptables-ipset-proto6[name=%(__name__)s, port="http", protocol="tcp", chain="<known/chain>"]', {
|
||||||
'ip4': (' f2b-j-w-iptables-ipset ',), 'ip6': (' f2b-j-w-iptables-ipset6 ',),
|
'ip4': (' f2b-j-w-iptables-ipset ',), 'ip6': (' f2b-j-w-iptables-ipset6 ',),
|
||||||
'ip4-start': (
|
'ip4-start': (
|
||||||
"`ipset create f2b-j-w-iptables-ipset hash:ip timeout 0 `",
|
"`ipset -exist create f2b-j-w-iptables-ipset hash:ip timeout 0 `",
|
||||||
"`iptables -w -I INPUT -p tcp -m multiport --dports http -m set --match-set f2b-j-w-iptables-ipset src -j REJECT --reject-with icmp-port-unreachable`",
|
"`{ iptables -w -C INPUT -p tcp -m multiport --dports http -m set --match-set f2b-j-w-iptables-ipset src -j REJECT --reject-with icmp-port-unreachable >/dev/null 2>&1; } || "
|
||||||
|
"{ iptables -w -I INPUT -p tcp -m multiport --dports http -m set --match-set f2b-j-w-iptables-ipset src -j REJECT --reject-with icmp-port-unreachable; }`",
|
||||||
),
|
),
|
||||||
'ip6-start': (
|
'ip6-start': (
|
||||||
"`ipset create f2b-j-w-iptables-ipset6 hash:ip timeout 0 family inet6`",
|
"`ipset -exist create f2b-j-w-iptables-ipset6 hash:ip timeout 0 family inet6`",
|
||||||
"`ip6tables -w -I INPUT -p tcp -m multiport --dports http -m set --match-set f2b-j-w-iptables-ipset6 src -j REJECT --reject-with icmp6-port-unreachable`",
|
"`{ ip6tables -w -C INPUT -p tcp -m multiport --dports http -m set --match-set f2b-j-w-iptables-ipset6 src -j REJECT --reject-with icmp6-port-unreachable >/dev/null 2>&1; } || "
|
||||||
|
"{ ip6tables -w -I INPUT -p tcp -m multiport --dports http -m set --match-set f2b-j-w-iptables-ipset6 src -j REJECT --reject-with icmp6-port-unreachable; }`",
|
||||||
),
|
),
|
||||||
'flush': (
|
'flush': (
|
||||||
"`ipset flush f2b-j-w-iptables-ipset`",
|
"`ipset flush f2b-j-w-iptables-ipset`",
|
||||||
|
@ -1613,67 +1619,83 @@ class ServerConfigReaderTests(LogCaptureTestCase):
|
||||||
"`ipset flush f2b-j-w-iptables-ipset6`",
|
"`ipset flush f2b-j-w-iptables-ipset6`",
|
||||||
"`ipset destroy f2b-j-w-iptables-ipset6`",
|
"`ipset destroy f2b-j-w-iptables-ipset6`",
|
||||||
),
|
),
|
||||||
|
'ip4-check': (
|
||||||
|
r"""`iptables -w -C INPUT -p tcp -m multiport --dports http -m set --match-set f2b-j-w-iptables-ipset src -j REJECT --reject-with icmp-port-unreachable`""",
|
||||||
|
),
|
||||||
|
'ip6-check': (
|
||||||
|
r"""`ip6tables -w -C INPUT -p tcp -m multiport --dports http -m set --match-set f2b-j-w-iptables-ipset6 src -j REJECT --reject-with icmp6-port-unreachable`""",
|
||||||
|
),
|
||||||
'ip4-ban': (
|
'ip4-ban': (
|
||||||
r"`ipset add f2b-j-w-iptables-ipset 192.0.2.1 timeout 0 -exist`",
|
r"`ipset -exist add f2b-j-w-iptables-ipset 192.0.2.1 timeout 0`",
|
||||||
),
|
),
|
||||||
'ip4-unban': (
|
'ip4-unban': (
|
||||||
r"`ipset del f2b-j-w-iptables-ipset 192.0.2.1 -exist`",
|
r"`ipset -exist del f2b-j-w-iptables-ipset 192.0.2.1`",
|
||||||
),
|
),
|
||||||
'ip6-ban': (
|
'ip6-ban': (
|
||||||
r"`ipset add f2b-j-w-iptables-ipset6 2001:db8:: timeout 0 -exist`",
|
r"`ipset -exist add f2b-j-w-iptables-ipset6 2001:db8:: timeout 0`",
|
||||||
),
|
),
|
||||||
'ip6-unban': (
|
'ip6-unban': (
|
||||||
r"`ipset del f2b-j-w-iptables-ipset6 2001:db8:: -exist`",
|
r"`ipset -exist del f2b-j-w-iptables-ipset6 2001:db8::`",
|
||||||
),
|
),
|
||||||
}),
|
}),
|
||||||
# iptables-ipset-proto6-allports --
|
# iptables-ipset-proto6-allports --
|
||||||
('j-w-iptables-ipset-ap', 'iptables-ipset-proto6-allports[name=%(__name__)s, chain="<known/chain>"]', {
|
('j-w-iptables-ipset-ap', 'iptables-ipset-proto6-allports[name=%(__name__)s, chain="<known/chain>"]', {
|
||||||
'ip4': (' f2b-j-w-iptables-ipset-ap ',), 'ip6': (' f2b-j-w-iptables-ipset-ap6 ',),
|
'ip4': (' f2b-j-w-iptables-ipset-ap ',), 'ip6': (' f2b-j-w-iptables-ipset-ap6 ',),
|
||||||
'ip4-start': (
|
'ip4-start': (
|
||||||
"`ipset create f2b-j-w-iptables-ipset-ap hash:ip timeout 0 `",
|
"`ipset -exist create f2b-j-w-iptables-ipset-ap hash:ip timeout 0 `",
|
||||||
"`iptables -w -I INPUT -m set --match-set f2b-j-w-iptables-ipset-ap src -j REJECT --reject-with icmp-port-unreachable`",
|
"`{ iptables -w -C INPUT -p tcp -m set --match-set f2b-j-w-iptables-ipset-ap src -j REJECT --reject-with icmp-port-unreachable >/dev/null 2>&1; } || "
|
||||||
|
"{ iptables -w -I INPUT -p tcp -m set --match-set f2b-j-w-iptables-ipset-ap src -j REJECT --reject-with icmp-port-unreachable; }",
|
||||||
),
|
),
|
||||||
'ip6-start': (
|
'ip6-start': (
|
||||||
"`ipset create f2b-j-w-iptables-ipset-ap6 hash:ip timeout 0 family inet6`",
|
"`ipset -exist create f2b-j-w-iptables-ipset-ap6 hash:ip timeout 0 family inet6`",
|
||||||
"`ip6tables -w -I INPUT -m set --match-set f2b-j-w-iptables-ipset-ap6 src -j REJECT --reject-with icmp6-port-unreachable`",
|
"`{ ip6tables -w -C INPUT -p tcp -m set --match-set f2b-j-w-iptables-ipset-ap6 src -j REJECT --reject-with icmp6-port-unreachable >/dev/null 2>&1; } || "
|
||||||
|
"{ ip6tables -w -I INPUT -p tcp -m set --match-set f2b-j-w-iptables-ipset-ap6 src -j REJECT --reject-with icmp6-port-unreachable; }",
|
||||||
),
|
),
|
||||||
'flush': (
|
'flush': (
|
||||||
"`ipset flush f2b-j-w-iptables-ipset-ap`",
|
"`ipset flush f2b-j-w-iptables-ipset-ap`",
|
||||||
"`ipset flush f2b-j-w-iptables-ipset-ap6`",
|
"`ipset flush f2b-j-w-iptables-ipset-ap6`",
|
||||||
),
|
),
|
||||||
'stop': (
|
'stop': (
|
||||||
"`iptables -w -D INPUT -m set --match-set f2b-j-w-iptables-ipset-ap src -j REJECT --reject-with icmp-port-unreachable`",
|
"`iptables -w -D INPUT -p tcp -m set --match-set f2b-j-w-iptables-ipset-ap src -j REJECT --reject-with icmp-port-unreachable`",
|
||||||
"`ipset flush f2b-j-w-iptables-ipset-ap`",
|
"`ipset flush f2b-j-w-iptables-ipset-ap`",
|
||||||
"`ipset destroy f2b-j-w-iptables-ipset-ap`",
|
"`ipset destroy f2b-j-w-iptables-ipset-ap`",
|
||||||
"`ip6tables -w -D INPUT -m set --match-set f2b-j-w-iptables-ipset-ap6 src -j REJECT --reject-with icmp6-port-unreachable`",
|
"`ip6tables -w -D INPUT -p tcp -m set --match-set f2b-j-w-iptables-ipset-ap6 src -j REJECT --reject-with icmp6-port-unreachable`",
|
||||||
"`ipset flush f2b-j-w-iptables-ipset-ap6`",
|
"`ipset flush f2b-j-w-iptables-ipset-ap6`",
|
||||||
"`ipset destroy f2b-j-w-iptables-ipset-ap6`",
|
"`ipset destroy f2b-j-w-iptables-ipset-ap6`",
|
||||||
),
|
),
|
||||||
|
'ip4-check': (
|
||||||
|
r"""`iptables -w -C INPUT -p tcp -m set --match-set f2b-j-w-iptables-ipset-ap src -j REJECT --reject-with icmp-port-unreachable`""",
|
||||||
|
),
|
||||||
|
'ip6-check': (
|
||||||
|
r"""`ip6tables -w -C INPUT -p tcp -m set --match-set f2b-j-w-iptables-ipset-ap6 src -j REJECT --reject-with icmp6-port-unreachable`""",
|
||||||
|
),
|
||||||
'ip4-ban': (
|
'ip4-ban': (
|
||||||
r"`ipset add f2b-j-w-iptables-ipset-ap 192.0.2.1 timeout 0 -exist`",
|
r"`ipset -exist add f2b-j-w-iptables-ipset-ap 192.0.2.1 timeout 0`",
|
||||||
),
|
),
|
||||||
'ip4-unban': (
|
'ip4-unban': (
|
||||||
r"`ipset del f2b-j-w-iptables-ipset-ap 192.0.2.1 -exist`",
|
r"`ipset -exist del f2b-j-w-iptables-ipset-ap 192.0.2.1`",
|
||||||
),
|
),
|
||||||
'ip6-ban': (
|
'ip6-ban': (
|
||||||
r"`ipset add f2b-j-w-iptables-ipset-ap6 2001:db8:: timeout 0 -exist`",
|
r"`ipset -exist add f2b-j-w-iptables-ipset-ap6 2001:db8:: timeout 0`",
|
||||||
),
|
),
|
||||||
'ip6-unban': (
|
'ip6-unban': (
|
||||||
r"`ipset del f2b-j-w-iptables-ipset-ap6 2001:db8:: -exist`",
|
r"`ipset -exist del f2b-j-w-iptables-ipset-ap6 2001:db8::`",
|
||||||
),
|
),
|
||||||
}),
|
}),
|
||||||
# iptables --
|
# iptables (oneport) --
|
||||||
('j-w-iptables', 'iptables[name=%(__name__)s, bantime="10m", port="http", protocol="tcp", chain="<known/chain>"]', {
|
('j-w-iptables', 'iptables[name=%(__name__)s, bantime="10m", port="http", protocol="tcp", chain="<known/chain>"]', {
|
||||||
'ip4': ('`iptables ', 'icmp-port-unreachable'), 'ip6': ('`ip6tables ', 'icmp6-port-unreachable'),
|
'ip4': ('`iptables ', 'icmp-port-unreachable'), 'ip6': ('`ip6tables ', 'icmp6-port-unreachable'),
|
||||||
'ip4-start': (
|
'ip4-start': (
|
||||||
"`iptables -w -N f2b-j-w-iptables`",
|
"`{ iptables -w -C f2b-j-w-iptables -j RETURN >/dev/null 2>&1; } || "
|
||||||
"`iptables -w -A f2b-j-w-iptables -j RETURN`",
|
"{ iptables -w -N f2b-j-w-iptables || true; iptables -w -A f2b-j-w-iptables -j RETURN; }",
|
||||||
"`iptables -w -I INPUT -p tcp --dport http -j f2b-j-w-iptables`",
|
"`{ iptables -w -C INPUT -p tcp --dport http -j f2b-j-w-iptables >/dev/null 2>&1; } || "
|
||||||
|
"{ iptables -w -I INPUT -p tcp --dport http -j f2b-j-w-iptables; }`",
|
||||||
),
|
),
|
||||||
'ip6-start': (
|
'ip6-start': (
|
||||||
"`ip6tables -w -N f2b-j-w-iptables`",
|
"`{ ip6tables -w -C f2b-j-w-iptables -j RETURN >/dev/null 2>&1; } || "
|
||||||
"`ip6tables -w -A f2b-j-w-iptables -j RETURN`",
|
"{ ip6tables -w -N f2b-j-w-iptables || true; ip6tables -w -A f2b-j-w-iptables -j RETURN; }",
|
||||||
"`ip6tables -w -I INPUT -p tcp --dport http -j f2b-j-w-iptables`",
|
"`{ ip6tables -w -C INPUT -p tcp --dport http -j f2b-j-w-iptables >/dev/null 2>&1; } || "
|
||||||
|
"{ ip6tables -w -I INPUT -p tcp --dport http -j f2b-j-w-iptables; }`",
|
||||||
),
|
),
|
||||||
'flush': (
|
'flush': (
|
||||||
"`iptables -w -F f2b-j-w-iptables`",
|
"`iptables -w -F f2b-j-w-iptables`",
|
||||||
|
@ -1688,10 +1710,10 @@ class ServerConfigReaderTests(LogCaptureTestCase):
|
||||||
"`ip6tables -w -X f2b-j-w-iptables`",
|
"`ip6tables -w -X f2b-j-w-iptables`",
|
||||||
),
|
),
|
||||||
'ip4-check': (
|
'ip4-check': (
|
||||||
r"""`iptables -w -n -L INPUT | grep -q 'f2b-j-w-iptables[ \t]'`""",
|
r"""`iptables -w -C INPUT -p tcp --dport http -j f2b-j-w-iptables`""",
|
||||||
),
|
),
|
||||||
'ip6-check': (
|
'ip6-check': (
|
||||||
r"""`ip6tables -w -n -L INPUT | grep -q 'f2b-j-w-iptables[ \t]'`""",
|
r"""`ip6tables -w -C INPUT -p tcp --dport http -j f2b-j-w-iptables`""",
|
||||||
),
|
),
|
||||||
'ip4-ban': (
|
'ip4-ban': (
|
||||||
r"`iptables -w -I f2b-j-w-iptables 1 -s 192.0.2.1 -j REJECT --reject-with icmp-port-unreachable`",
|
r"`iptables -w -I f2b-j-w-iptables 1 -s 192.0.2.1 -j REJECT --reject-with icmp-port-unreachable`",
|
||||||
|
@ -1710,14 +1732,16 @@ class ServerConfigReaderTests(LogCaptureTestCase):
|
||||||
('j-w-iptables-new', 'iptables-new[name=%(__name__)s, bantime="10m", port="http", protocol="tcp", chain="<known/chain>"]', {
|
('j-w-iptables-new', 'iptables-new[name=%(__name__)s, bantime="10m", port="http", protocol="tcp", chain="<known/chain>"]', {
|
||||||
'ip4': ('`iptables ', 'icmp-port-unreachable'), 'ip6': ('`ip6tables ', 'icmp6-port-unreachable'),
|
'ip4': ('`iptables ', 'icmp-port-unreachable'), 'ip6': ('`ip6tables ', 'icmp6-port-unreachable'),
|
||||||
'ip4-start': (
|
'ip4-start': (
|
||||||
"`iptables -w -N f2b-j-w-iptables-new`",
|
"`{ iptables -w -C f2b-j-w-iptables-new -j RETURN >/dev/null 2>&1; } || "
|
||||||
"`iptables -w -A f2b-j-w-iptables-new -j RETURN`",
|
"{ iptables -w -N f2b-j-w-iptables-new || true; iptables -w -A f2b-j-w-iptables-new -j RETURN; }`",
|
||||||
"`iptables -w -I INPUT -m state --state NEW -p tcp --dport http -j f2b-j-w-iptables-new`",
|
"`{ iptables -w -C INPUT -m state --state NEW -p tcp --dport http -j f2b-j-w-iptables-new >/dev/null 2>&1; } || "
|
||||||
|
"{ iptables -w -I INPUT -m state --state NEW -p tcp --dport http -j f2b-j-w-iptables-new; }`",
|
||||||
),
|
),
|
||||||
'ip6-start': (
|
'ip6-start': (
|
||||||
"`ip6tables -w -N f2b-j-w-iptables-new`",
|
"`{ ip6tables -w -C f2b-j-w-iptables-new -j RETURN >/dev/null 2>&1; } || "
|
||||||
"`ip6tables -w -A f2b-j-w-iptables-new -j RETURN`",
|
"{ ip6tables -w -N f2b-j-w-iptables-new || true; ip6tables -w -A f2b-j-w-iptables-new -j RETURN; }`",
|
||||||
"`ip6tables -w -I INPUT -m state --state NEW -p tcp --dport http -j f2b-j-w-iptables-new`",
|
"`{ ip6tables -w -C INPUT -m state --state NEW -p tcp --dport http -j f2b-j-w-iptables-new >/dev/null 2>&1; } || "
|
||||||
|
"{ ip6tables -w -I INPUT -m state --state NEW -p tcp --dport http -j f2b-j-w-iptables-new; }`",
|
||||||
),
|
),
|
||||||
'flush': (
|
'flush': (
|
||||||
"`iptables -w -F f2b-j-w-iptables-new`",
|
"`iptables -w -F f2b-j-w-iptables-new`",
|
||||||
|
@ -1732,10 +1756,10 @@ class ServerConfigReaderTests(LogCaptureTestCase):
|
||||||
"`ip6tables -w -X f2b-j-w-iptables-new`",
|
"`ip6tables -w -X f2b-j-w-iptables-new`",
|
||||||
),
|
),
|
||||||
'ip4-check': (
|
'ip4-check': (
|
||||||
r"""`iptables -w -n -L INPUT | grep -q 'f2b-j-w-iptables-new[ \t]'`""",
|
r"""`iptables -w -C INPUT -m state --state NEW -p tcp --dport http -j f2b-j-w-iptables-new`""",
|
||||||
),
|
),
|
||||||
'ip6-check': (
|
'ip6-check': (
|
||||||
r"""`ip6tables -w -n -L INPUT | grep -q 'f2b-j-w-iptables-new[ \t]'`""",
|
r"""`ip6tables -w -C INPUT -m state --state NEW -p tcp --dport http -j f2b-j-w-iptables-new`""",
|
||||||
),
|
),
|
||||||
'ip4-ban': (
|
'ip4-ban': (
|
||||||
r"`iptables -w -I f2b-j-w-iptables-new 1 -s 192.0.2.1 -j REJECT --reject-with icmp-port-unreachable`",
|
r"`iptables -w -I f2b-j-w-iptables-new 1 -s 192.0.2.1 -j REJECT --reject-with icmp-port-unreachable`",
|
||||||
|
@ -1766,10 +1790,10 @@ class ServerConfigReaderTests(LogCaptureTestCase):
|
||||||
"`if [ `id -u` -eq 0 ];then ip6tables -w -D INPUT -m recent --update --seconds 3600 --name f2b-j-w-iptables-xtre6 -j REJECT --reject-with icmp6-port-unreachable;fi`",
|
"`if [ `id -u` -eq 0 ];then ip6tables -w -D INPUT -m recent --update --seconds 3600 --name f2b-j-w-iptables-xtre6 -j REJECT --reject-with icmp6-port-unreachable;fi`",
|
||||||
),
|
),
|
||||||
'ip4-check': (
|
'ip4-check': (
|
||||||
r"`test -e /proc/net/xt_recent/f2b-j-w-iptables-xtre`",
|
r"`{ iptables -w -C INPUT -p tcp --dport ssh -j f2b-j-w-iptables-xtre; } && test -e /proc/net/xt_recent/f2b-j-w-iptables-xtre`",
|
||||||
),
|
),
|
||||||
'ip6-check': (
|
'ip6-check': (
|
||||||
r"`test -e /proc/net/xt_recent/f2b-j-w-iptables-xtre6`",
|
r"`{ ip6tables -w -C INPUT -p tcp --dport ssh -j f2b-j-w-iptables-xtre; } && test -e /proc/net/xt_recent/f2b-j-w-iptables-xtre6`",
|
||||||
),
|
),
|
||||||
'ip4-ban': (
|
'ip4-ban': (
|
||||||
r"`echo +192.0.2.1 > /proc/net/xt_recent/f2b-j-w-iptables-xtre`",
|
r"`echo +192.0.2.1 > /proc/net/xt_recent/f2b-j-w-iptables-xtre`",
|
||||||
|
@ -1937,11 +1961,11 @@ class ServerConfigReaderTests(LogCaptureTestCase):
|
||||||
('j-w-fwcmd-ipset', 'firewallcmd-ipset[name=%(__name__)s, port="http", protocol="tcp", chain="<known/chain>"]', {
|
('j-w-fwcmd-ipset', 'firewallcmd-ipset[name=%(__name__)s, port="http", protocol="tcp", chain="<known/chain>"]', {
|
||||||
'ip4': (' f2b-j-w-fwcmd-ipset ',), 'ip6': (' f2b-j-w-fwcmd-ipset6 ',),
|
'ip4': (' f2b-j-w-fwcmd-ipset ',), 'ip6': (' f2b-j-w-fwcmd-ipset6 ',),
|
||||||
'ip4-start': (
|
'ip4-start': (
|
||||||
"`ipset create f2b-j-w-fwcmd-ipset hash:ip timeout 0 `",
|
"`ipset -exist create f2b-j-w-fwcmd-ipset hash:ip timeout 0 `",
|
||||||
"`firewall-cmd --direct --add-rule ipv4 filter INPUT_direct 0 -p tcp -m multiport --dports http -m set --match-set f2b-j-w-fwcmd-ipset src -j REJECT --reject-with icmp-port-unreachable`",
|
"`firewall-cmd --direct --add-rule ipv4 filter INPUT_direct 0 -p tcp -m multiport --dports http -m set --match-set f2b-j-w-fwcmd-ipset src -j REJECT --reject-with icmp-port-unreachable`",
|
||||||
),
|
),
|
||||||
'ip6-start': (
|
'ip6-start': (
|
||||||
"`ipset create f2b-j-w-fwcmd-ipset6 hash:ip timeout 0 family inet6`",
|
"`ipset -exist create f2b-j-w-fwcmd-ipset6 hash:ip timeout 0 family inet6`",
|
||||||
"`firewall-cmd --direct --add-rule ipv6 filter INPUT_direct 0 -p tcp -m multiport --dports http -m set --match-set f2b-j-w-fwcmd-ipset6 src -j REJECT --reject-with icmp6-port-unreachable`",
|
"`firewall-cmd --direct --add-rule ipv6 filter INPUT_direct 0 -p tcp -m multiport --dports http -m set --match-set f2b-j-w-fwcmd-ipset6 src -j REJECT --reject-with icmp6-port-unreachable`",
|
||||||
),
|
),
|
||||||
'flush': (
|
'flush': (
|
||||||
|
@ -1957,27 +1981,27 @@ class ServerConfigReaderTests(LogCaptureTestCase):
|
||||||
"`ipset destroy f2b-j-w-fwcmd-ipset6`",
|
"`ipset destroy f2b-j-w-fwcmd-ipset6`",
|
||||||
),
|
),
|
||||||
'ip4-ban': (
|
'ip4-ban': (
|
||||||
r"`ipset add f2b-j-w-fwcmd-ipset 192.0.2.1 timeout 0 -exist`",
|
r"`ipset -exist add f2b-j-w-fwcmd-ipset 192.0.2.1 timeout 0`",
|
||||||
),
|
),
|
||||||
'ip4-unban': (
|
'ip4-unban': (
|
||||||
r"`ipset del f2b-j-w-fwcmd-ipset 192.0.2.1 -exist`",
|
r"`ipset -exist del f2b-j-w-fwcmd-ipset 192.0.2.1`",
|
||||||
),
|
),
|
||||||
'ip6-ban': (
|
'ip6-ban': (
|
||||||
r"`ipset add f2b-j-w-fwcmd-ipset6 2001:db8:: timeout 0 -exist`",
|
r"`ipset -exist add f2b-j-w-fwcmd-ipset6 2001:db8:: timeout 0`",
|
||||||
),
|
),
|
||||||
'ip6-unban': (
|
'ip6-unban': (
|
||||||
r"`ipset del f2b-j-w-fwcmd-ipset6 2001:db8:: -exist`",
|
r"`ipset -exist del f2b-j-w-fwcmd-ipset6 2001:db8::`",
|
||||||
),
|
),
|
||||||
}),
|
}),
|
||||||
# firewallcmd-ipset (allports) --
|
# firewallcmd-ipset (allports) --
|
||||||
('j-w-fwcmd-ipset-ap', 'firewallcmd-ipset[name=%(__name__)s, actiontype=<allports>, protocol="tcp", chain="<known/chain>"]', {
|
('j-w-fwcmd-ipset-ap', 'firewallcmd-ipset[name=%(__name__)s, actiontype=<allports>, protocol="tcp", chain="<known/chain>"]', {
|
||||||
'ip4': (' f2b-j-w-fwcmd-ipset-ap ',), 'ip6': (' f2b-j-w-fwcmd-ipset-ap6 ',),
|
'ip4': (' f2b-j-w-fwcmd-ipset-ap ',), 'ip6': (' f2b-j-w-fwcmd-ipset-ap6 ',),
|
||||||
'ip4-start': (
|
'ip4-start': (
|
||||||
"`ipset create f2b-j-w-fwcmd-ipset-ap hash:ip timeout 0 `",
|
"`ipset -exist create f2b-j-w-fwcmd-ipset-ap hash:ip timeout 0 `",
|
||||||
"`firewall-cmd --direct --add-rule ipv4 filter INPUT_direct 0 -p tcp -m set --match-set f2b-j-w-fwcmd-ipset-ap src -j REJECT --reject-with icmp-port-unreachable`",
|
"`firewall-cmd --direct --add-rule ipv4 filter INPUT_direct 0 -p tcp -m set --match-set f2b-j-w-fwcmd-ipset-ap src -j REJECT --reject-with icmp-port-unreachable`",
|
||||||
),
|
),
|
||||||
'ip6-start': (
|
'ip6-start': (
|
||||||
"`ipset create f2b-j-w-fwcmd-ipset-ap6 hash:ip timeout 0 family inet6`",
|
"`ipset -exist create f2b-j-w-fwcmd-ipset-ap6 hash:ip timeout 0 family inet6`",
|
||||||
"`firewall-cmd --direct --add-rule ipv6 filter INPUT_direct 0 -p tcp -m set --match-set f2b-j-w-fwcmd-ipset-ap6 src -j REJECT --reject-with icmp6-port-unreachable`",
|
"`firewall-cmd --direct --add-rule ipv6 filter INPUT_direct 0 -p tcp -m set --match-set f2b-j-w-fwcmd-ipset-ap6 src -j REJECT --reject-with icmp6-port-unreachable`",
|
||||||
),
|
),
|
||||||
'flush': (
|
'flush': (
|
||||||
|
@ -1993,16 +2017,16 @@ class ServerConfigReaderTests(LogCaptureTestCase):
|
||||||
"`ipset destroy f2b-j-w-fwcmd-ipset-ap6`",
|
"`ipset destroy f2b-j-w-fwcmd-ipset-ap6`",
|
||||||
),
|
),
|
||||||
'ip4-ban': (
|
'ip4-ban': (
|
||||||
r"`ipset add f2b-j-w-fwcmd-ipset-ap 192.0.2.1 timeout 0 -exist`",
|
r"`ipset -exist add f2b-j-w-fwcmd-ipset-ap 192.0.2.1 timeout 0`",
|
||||||
),
|
),
|
||||||
'ip4-unban': (
|
'ip4-unban': (
|
||||||
r"`ipset del f2b-j-w-fwcmd-ipset-ap 192.0.2.1 -exist`",
|
r"`ipset -exist del f2b-j-w-fwcmd-ipset-ap 192.0.2.1`",
|
||||||
),
|
),
|
||||||
'ip6-ban': (
|
'ip6-ban': (
|
||||||
r"`ipset add f2b-j-w-fwcmd-ipset-ap6 2001:db8:: timeout 0 -exist`",
|
r"`ipset -exist add f2b-j-w-fwcmd-ipset-ap6 2001:db8:: timeout 0`",
|
||||||
),
|
),
|
||||||
'ip6-unban': (
|
'ip6-unban': (
|
||||||
r"`ipset del f2b-j-w-fwcmd-ipset-ap6 2001:db8:: -exist`",
|
r"`ipset -exist del f2b-j-w-fwcmd-ipset-ap6 2001:db8::`",
|
||||||
),
|
),
|
||||||
}),
|
}),
|
||||||
# firewallcmd-rich-rules --
|
# firewallcmd-rich-rules --
|
||||||
|
|
Loading…
Reference in New Issue