41 lines
1.3 KiB
Plaintext
41 lines
1.3 KiB
Plaintext
# Fail2Ban action: ban in both INPUT and DOCKER-USER chains
|
|
# Used by recidive to block repeat offenders from both host and Docker services
|
|
|
|
[INCLUDES]
|
|
|
|
before = iptables.conf
|
|
|
|
[Definition]
|
|
|
|
type = allports
|
|
|
|
actionstart = { <iptables> -C f2b-<name> -j <returntype> >/dev/null 2>&1; } || { <iptables> -N f2b-<name> || true; <iptables> -A f2b-<name> -j <returntype>; }
|
|
{ <iptables> -C INPUT -p <protocol> -j f2b-<name> >/dev/null 2>&1; } || { <iptables> -I INPUT -p <protocol> -j f2b-<name>; }
|
|
{ <iptables> -C DOCKER-USER -p <protocol> -j f2b-<name> >/dev/null 2>&1; } || { <iptables> -I DOCKER-USER -p <protocol> -j f2b-<name>; }
|
|
|
|
actionstop = <iptables> -D INPUT -p <protocol> -j f2b-<name> 2>/dev/null || true
|
|
<iptables> -D DOCKER-USER -p <protocol> -j f2b-<name> 2>/dev/null || true
|
|
<iptables> -F f2b-<name>
|
|
<iptables> -X f2b-<name>
|
|
|
|
actioncheck = <iptables> -n -L f2b-<name> >/dev/null
|
|
|
|
actionban = <iptables> -I f2b-<name> 1 -s <ip> -j <blocktype>
|
|
|
|
actionunban = <iptables> -D f2b-<name> -s <ip> -j <blocktype>
|
|
|
|
[Init]
|
|
|
|
chain = INPUT
|
|
name = default
|
|
protocol = tcp
|
|
blocktype = REJECT --reject-with icmp-port-unreachable
|
|
returntype = RETURN
|
|
lockingopt = -w
|
|
iptables = iptables <lockingopt>
|
|
|
|
[Init?family=inet6]
|
|
|
|
blocktype = REJECT --reject-with icmp6-port-unreachable
|
|
iptables = ip6tables <lockingopt>
|