mirror of https://github.com/fail2ban/fail2ban
Merge pull request #1433 from yarikoptic/bf-0.10-pf-prevbeh
BF: maintain previous default beh for pf -- default ban type is multiportpull/1446/merge
commit
b6700f3e52
|
@ -72,17 +72,12 @@ tablename = f2b
|
||||||
protocol = tcp
|
protocol = tcp
|
||||||
|
|
||||||
|
|
||||||
# Option: port
|
|
||||||
# Notes.: specifies port to monitor
|
|
||||||
# Values: [ NUM | STRING ] Default:
|
|
||||||
#
|
|
||||||
#port = telnet
|
|
||||||
|
|
||||||
# Option: actiontype
|
# Option: actiontype
|
||||||
# Notes.: defines additions to the blocking rule
|
# Notes.: defines additions to the blocking rule
|
||||||
# Values: leave empty to block all attempts from the host
|
# Values: leave empty to block all attempts from the host
|
||||||
# Default: Value of the allports
|
# Default: Value of the multiport
|
||||||
actiontype = any
|
actiontype = <multiport>
|
||||||
|
|
||||||
# Option: allports
|
# Option: allports
|
||||||
# Notes.: default addition to block all ports
|
# Notes.: default addition to block all ports
|
||||||
|
|
|
@ -1372,12 +1372,12 @@ class ServerConfigReaderTests(LogCaptureTestCase):
|
||||||
r"`echo -2001:db8:: > /proc/net/xt_recent/f2b-j-w-iptables-xtre6`",
|
r"`echo -2001:db8:: > /proc/net/xt_recent/f2b-j-w-iptables-xtre6`",
|
||||||
),
|
),
|
||||||
}),
|
}),
|
||||||
# pf allports --
|
# pf default -- multiport on default port (tag <port> set in jail.conf, but not in this test case)
|
||||||
('j-w-pf', 'pf[name=%(__name__)s]', {
|
('j-w-pf', 'pf[name=%(__name__)s]', {
|
||||||
'ip4': (), 'ip6': (),
|
'ip4': (), 'ip6': (),
|
||||||
'start': (
|
'start': (
|
||||||
'`echo "table <f2b-j-w-pf> persist counters" | pfctl -f-`',
|
'`echo "table <f2b-j-w-pf> persist counters" | pfctl -f-`',
|
||||||
'`echo "block proto tcp from <f2b-j-w-pf> to any" | pfctl -f-`',
|
'`echo "block proto tcp from <f2b-j-w-pf> to any port <port>" | pfctl -f-`',
|
||||||
),
|
),
|
||||||
'stop': (
|
'stop': (
|
||||||
'`pfctl -sr 2>/dev/null | grep -v f2b-j-w-pf | pfctl -f-`',
|
'`pfctl -sr 2>/dev/null | grep -v f2b-j-w-pf | pfctl -f-`',
|
||||||
|
@ -1391,7 +1391,7 @@ class ServerConfigReaderTests(LogCaptureTestCase):
|
||||||
'ip6-ban': ("`pfctl -t f2b-j-w-pf -T add 2001:db8::`",),
|
'ip6-ban': ("`pfctl -t f2b-j-w-pf -T add 2001:db8::`",),
|
||||||
'ip6-unban': ("`pfctl -t f2b-j-w-pf -T delete 2001:db8::`",),
|
'ip6-unban': ("`pfctl -t f2b-j-w-pf -T delete 2001:db8::`",),
|
||||||
}),
|
}),
|
||||||
# pf multiport --
|
# pf multiport with custom port --
|
||||||
('j-w-pf-mp', 'pf[actiontype=<multiport>][name=%(__name__)s, port=http]', {
|
('j-w-pf-mp', 'pf[actiontype=<multiport>][name=%(__name__)s, port=http]', {
|
||||||
'ip4': (), 'ip6': (),
|
'ip4': (), 'ip6': (),
|
||||||
'start': (
|
'start': (
|
||||||
|
@ -1410,6 +1410,25 @@ class ServerConfigReaderTests(LogCaptureTestCase):
|
||||||
'ip6-ban': ("`pfctl -t f2b-j-w-pf-mp -T add 2001:db8::`",),
|
'ip6-ban': ("`pfctl -t f2b-j-w-pf-mp -T add 2001:db8::`",),
|
||||||
'ip6-unban': ("`pfctl -t f2b-j-w-pf-mp -T delete 2001:db8::`",),
|
'ip6-unban': ("`pfctl -t f2b-j-w-pf-mp -T delete 2001:db8::`",),
|
||||||
}),
|
}),
|
||||||
|
# pf allports --
|
||||||
|
('j-w-pf-ap', 'pf[actiontype=<allports>][name=%(__name__)s]', {
|
||||||
|
'ip4': (), 'ip6': (),
|
||||||
|
'start': (
|
||||||
|
'`echo "table <f2b-j-w-pf-ap> persist counters" | pfctl -f-`',
|
||||||
|
'`echo "block proto tcp from <f2b-j-w-pf-ap> to any" | pfctl -f-`',
|
||||||
|
),
|
||||||
|
'stop': (
|
||||||
|
'`pfctl -sr 2>/dev/null | grep -v f2b-j-w-pf-ap | pfctl -f-`',
|
||||||
|
'`pfctl -t f2b-j-w-pf-ap -T flush`',
|
||||||
|
'`pfctl -t f2b-j-w-pf-ap -T kill`',
|
||||||
|
),
|
||||||
|
'ip4-check': ("`pfctl -sr | grep -q f2b-j-w-pf-ap`",),
|
||||||
|
'ip6-check': ("`pfctl -sr | grep -q f2b-j-w-pf-ap`",),
|
||||||
|
'ip4-ban': ("`pfctl -t f2b-j-w-pf-ap -T add 192.0.2.1`",),
|
||||||
|
'ip4-unban': ("`pfctl -t f2b-j-w-pf-ap -T delete 192.0.2.1`",),
|
||||||
|
'ip6-ban': ("`pfctl -t f2b-j-w-pf-ap -T add 2001:db8::`",),
|
||||||
|
'ip6-unban': ("`pfctl -t f2b-j-w-pf-ap -T delete 2001:db8::`",),
|
||||||
|
}),
|
||||||
# firewallcmd-multiport --
|
# firewallcmd-multiport --
|
||||||
('j-w-fwcmd-mp', 'firewallcmd-multiport[name=%(__name__)s, bantime="10m", port="http,https", protocol="tcp", chain="INPUT"]', {
|
('j-w-fwcmd-mp', 'firewallcmd-multiport[name=%(__name__)s, bantime="10m", port="http,https", protocol="tcp", chain="INPUT"]', {
|
||||||
'ip4': (' ipv4 ', 'icmp-port-unreachable'), 'ip6': (' ipv6 ', 'icmp6-port-unreachable'),
|
'ip4': (' ipv4 ', 'icmp-port-unreachable'), 'ip6': (' ipv6 ', 'icmp6-port-unreachable'),
|
||||||
|
|
Loading…
Reference in New Issue