|
|
@ -1213,7 +1213,7 @@ class ServerConfigReaderTests(LogCaptureTestCase):
|
|
|
|
),
|
|
|
|
),
|
|
|
|
}),
|
|
|
|
}),
|
|
|
|
# iptables-multiport --
|
|
|
|
# iptables-multiport --
|
|
|
|
('j-w-iptables-mp', 'iptables-multiport[name=%(__name__)s, bantime="10m", port="http,https", protocol="tcp", chain="INPUT"]', {
|
|
|
|
('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 -N f2b-j-w-iptables-mp`",
|
|
|
@ -1257,7 +1257,7 @@ class ServerConfigReaderTests(LogCaptureTestCase):
|
|
|
|
),
|
|
|
|
),
|
|
|
|
}),
|
|
|
|
}),
|
|
|
|
# iptables-allports --
|
|
|
|
# iptables-allports --
|
|
|
|
('j-w-iptables-ap', 'iptables-allports[name=%(__name__)s, bantime="10m", protocol="tcp", chain="INPUT"]', {
|
|
|
|
('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 -N f2b-j-w-iptables-ap`",
|
|
|
@ -1301,7 +1301,7 @@ class ServerConfigReaderTests(LogCaptureTestCase):
|
|
|
|
),
|
|
|
|
),
|
|
|
|
}),
|
|
|
|
}),
|
|
|
|
# iptables-ipset-proto6 --
|
|
|
|
# iptables-ipset-proto6 --
|
|
|
|
('j-w-iptables-ipset', 'iptables-ipset-proto6[name=%(__name__)s, bantime="10m", port="http", protocol="tcp", chain="INPUT"]', {
|
|
|
|
('j-w-iptables-ipset', 'iptables-ipset-proto6[name=%(__name__)s, bantime="10m", 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 600`",
|
|
|
|
"`ipset create f2b-j-w-iptables-ipset hash:ip timeout 600`",
|
|
|
@ -1339,7 +1339,7 @@ class ServerConfigReaderTests(LogCaptureTestCase):
|
|
|
|
),
|
|
|
|
),
|
|
|
|
}),
|
|
|
|
}),
|
|
|
|
# iptables-ipset-proto6-allports --
|
|
|
|
# iptables-ipset-proto6-allports --
|
|
|
|
('j-w-iptables-ipset-ap', 'iptables-ipset-proto6-allports[name=%(__name__)s, bantime="10m", chain="INPUT"]', {
|
|
|
|
('j-w-iptables-ipset-ap', 'iptables-ipset-proto6-allports[name=%(__name__)s, bantime="10m", 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 600`",
|
|
|
|
"`ipset create f2b-j-w-iptables-ipset-ap hash:ip timeout 600`",
|
|
|
@ -1377,7 +1377,7 @@ class ServerConfigReaderTests(LogCaptureTestCase):
|
|
|
|
),
|
|
|
|
),
|
|
|
|
}),
|
|
|
|
}),
|
|
|
|
# iptables --
|
|
|
|
# iptables --
|
|
|
|
('j-w-iptables', 'iptables[name=%(__name__)s, bantime="10m", port="http", protocol="tcp", chain="INPUT"]', {
|
|
|
|
('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 -N f2b-j-w-iptables`",
|
|
|
@ -1421,7 +1421,7 @@ class ServerConfigReaderTests(LogCaptureTestCase):
|
|
|
|
),
|
|
|
|
),
|
|
|
|
}),
|
|
|
|
}),
|
|
|
|
# iptables-new --
|
|
|
|
# iptables-new --
|
|
|
|
('j-w-iptables-new', 'iptables-new[name=%(__name__)s, bantime="10m", port="http", protocol="tcp", chain="INPUT"]', {
|
|
|
|
('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 -N f2b-j-w-iptables-new`",
|
|
|
@ -1465,7 +1465,7 @@ class ServerConfigReaderTests(LogCaptureTestCase):
|
|
|
|
),
|
|
|
|
),
|
|
|
|
}),
|
|
|
|
}),
|
|
|
|
# iptables-xt_recent-echo --
|
|
|
|
# iptables-xt_recent-echo --
|
|
|
|
('j-w-iptables-xtre', 'iptables-xt_recent-echo[name=%(__name__)s, bantime="10m", chain="INPUT"]', {
|
|
|
|
('j-w-iptables-xtre', 'iptables-xt_recent-echo[name=%(__name__)s, bantime="10m", chain="<known/chain>"]', {
|
|
|
|
'ip4': ('`iptables ', '/f2b-j-w-iptables-xtre`'), 'ip6': ('`ip6tables ', '/f2b-j-w-iptables-xtre6`'),
|
|
|
|
'ip4': ('`iptables ', '/f2b-j-w-iptables-xtre`'), 'ip6': ('`ip6tables ', '/f2b-j-w-iptables-xtre6`'),
|
|
|
|
'ip4-start': (
|
|
|
|
'ip4-start': (
|
|
|
|
"`if [ `id -u` -eq 0 ];then iptables -w -I INPUT -m recent --update --seconds 3600 --name f2b-j-w-iptables-xtre -j REJECT --reject-with icmp-port-unreachable;fi`",
|
|
|
|
"`if [ `id -u` -eq 0 ];then iptables -w -I INPUT -m recent --update --seconds 3600 --name f2b-j-w-iptables-xtre -j REJECT --reject-with icmp-port-unreachable;fi`",
|
|
|
@ -1566,23 +1566,23 @@ class ServerConfigReaderTests(LogCaptureTestCase):
|
|
|
|
'ip6-unban': ("`pfctl -a f2b/j-w-pf-ap -t f2b-j-w-pf-ap -T delete 2001:db8::`",),
|
|
|
|
'ip6-unban': ("`pfctl -a f2b/j-w-pf-ap -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="<known/chain>"]', {
|
|
|
|
'ip4': (' ipv4 ', 'icmp-port-unreachable'), 'ip6': (' ipv6 ', 'icmp6-port-unreachable'),
|
|
|
|
'ip4': (' ipv4 ', 'icmp-port-unreachable'), 'ip6': (' ipv6 ', 'icmp6-port-unreachable'),
|
|
|
|
'ip4-start': (
|
|
|
|
'ip4-start': (
|
|
|
|
"`firewall-cmd --direct --add-chain ipv4 filter f2b-j-w-fwcmd-mp`",
|
|
|
|
"`firewall-cmd --direct --add-chain ipv4 filter f2b-j-w-fwcmd-mp`",
|
|
|
|
"`firewall-cmd --direct --add-rule ipv4 filter f2b-j-w-fwcmd-mp 1000 -j RETURN`",
|
|
|
|
"`firewall-cmd --direct --add-rule ipv4 filter f2b-j-w-fwcmd-mp 1000 -j RETURN`",
|
|
|
|
"`firewall-cmd --direct --add-rule ipv4 filter INPUT 0 -m conntrack --ctstate NEW -p tcp -m multiport --dports http,https -j f2b-j-w-fwcmd-mp`",
|
|
|
|
"`firewall-cmd --direct --add-rule ipv4 filter INPUT_direct 0 -m conntrack --ctstate NEW -p tcp -m multiport --dports http,https -j f2b-j-w-fwcmd-mp`",
|
|
|
|
),
|
|
|
|
),
|
|
|
|
'ip6-start': (
|
|
|
|
'ip6-start': (
|
|
|
|
"`firewall-cmd --direct --add-chain ipv6 filter f2b-j-w-fwcmd-mp`",
|
|
|
|
"`firewall-cmd --direct --add-chain ipv6 filter f2b-j-w-fwcmd-mp`",
|
|
|
|
"`firewall-cmd --direct --add-rule ipv6 filter f2b-j-w-fwcmd-mp 1000 -j RETURN`",
|
|
|
|
"`firewall-cmd --direct --add-rule ipv6 filter f2b-j-w-fwcmd-mp 1000 -j RETURN`",
|
|
|
|
"`firewall-cmd --direct --add-rule ipv6 filter INPUT 0 -m conntrack --ctstate NEW -p tcp -m multiport --dports http,https -j f2b-j-w-fwcmd-mp`",
|
|
|
|
"`firewall-cmd --direct --add-rule ipv6 filter INPUT_direct 0 -m conntrack --ctstate NEW -p tcp -m multiport --dports http,https -j f2b-j-w-fwcmd-mp`",
|
|
|
|
),
|
|
|
|
),
|
|
|
|
'stop': (
|
|
|
|
'stop': (
|
|
|
|
"`firewall-cmd --direct --remove-rule ipv4 filter INPUT 0 -m conntrack --ctstate NEW -p tcp -m multiport --dports http,https -j f2b-j-w-fwcmd-mp`",
|
|
|
|
"`firewall-cmd --direct --remove-rule ipv4 filter INPUT_direct 0 -m conntrack --ctstate NEW -p tcp -m multiport --dports http,https -j f2b-j-w-fwcmd-mp`",
|
|
|
|
"`firewall-cmd --direct --remove-rules ipv4 filter f2b-j-w-fwcmd-mp`",
|
|
|
|
"`firewall-cmd --direct --remove-rules ipv4 filter f2b-j-w-fwcmd-mp`",
|
|
|
|
"`firewall-cmd --direct --remove-chain ipv4 filter f2b-j-w-fwcmd-mp`",
|
|
|
|
"`firewall-cmd --direct --remove-chain ipv4 filter f2b-j-w-fwcmd-mp`",
|
|
|
|
"`firewall-cmd --direct --remove-rule ipv6 filter INPUT 0 -m conntrack --ctstate NEW -p tcp -m multiport --dports http,https -j f2b-j-w-fwcmd-mp`",
|
|
|
|
"`firewall-cmd --direct --remove-rule ipv6 filter INPUT_direct 0 -m conntrack --ctstate NEW -p tcp -m multiport --dports http,https -j f2b-j-w-fwcmd-mp`",
|
|
|
|
"`firewall-cmd --direct --remove-rules ipv6 filter f2b-j-w-fwcmd-mp`",
|
|
|
|
"`firewall-cmd --direct --remove-rules ipv6 filter f2b-j-w-fwcmd-mp`",
|
|
|
|
"`firewall-cmd --direct --remove-chain ipv6 filter f2b-j-w-fwcmd-mp`",
|
|
|
|
"`firewall-cmd --direct --remove-chain ipv6 filter f2b-j-w-fwcmd-mp`",
|
|
|
|
),
|
|
|
|
),
|
|
|
@ -1606,23 +1606,23 @@ class ServerConfigReaderTests(LogCaptureTestCase):
|
|
|
|
),
|
|
|
|
),
|
|
|
|
}),
|
|
|
|
}),
|
|
|
|
# firewallcmd-allports --
|
|
|
|
# firewallcmd-allports --
|
|
|
|
('j-w-fwcmd-ap', 'firewallcmd-allports[name=%(__name__)s, bantime="10m", protocol="tcp", chain="INPUT"]', {
|
|
|
|
('j-w-fwcmd-ap', 'firewallcmd-allports[name=%(__name__)s, bantime="10m", protocol="tcp", chain="<known/chain>"]', {
|
|
|
|
'ip4': (' ipv4 ', 'icmp-port-unreachable'), 'ip6': (' ipv6 ', 'icmp6-port-unreachable'),
|
|
|
|
'ip4': (' ipv4 ', 'icmp-port-unreachable'), 'ip6': (' ipv6 ', 'icmp6-port-unreachable'),
|
|
|
|
'ip4-start': (
|
|
|
|
'ip4-start': (
|
|
|
|
"`firewall-cmd --direct --add-chain ipv4 filter f2b-j-w-fwcmd-ap`",
|
|
|
|
"`firewall-cmd --direct --add-chain ipv4 filter f2b-j-w-fwcmd-ap`",
|
|
|
|
"`firewall-cmd --direct --add-rule ipv4 filter f2b-j-w-fwcmd-ap 1000 -j RETURN`",
|
|
|
|
"`firewall-cmd --direct --add-rule ipv4 filter f2b-j-w-fwcmd-ap 1000 -j RETURN`",
|
|
|
|
"`firewall-cmd --direct --add-rule ipv4 filter INPUT 0 -j f2b-j-w-fwcmd-ap`",
|
|
|
|
"`firewall-cmd --direct --add-rule ipv4 filter INPUT_direct 0 -j f2b-j-w-fwcmd-ap`",
|
|
|
|
),
|
|
|
|
),
|
|
|
|
'ip6-start': (
|
|
|
|
'ip6-start': (
|
|
|
|
"`firewall-cmd --direct --add-chain ipv6 filter f2b-j-w-fwcmd-ap`",
|
|
|
|
"`firewall-cmd --direct --add-chain ipv6 filter f2b-j-w-fwcmd-ap`",
|
|
|
|
"`firewall-cmd --direct --add-rule ipv6 filter f2b-j-w-fwcmd-ap 1000 -j RETURN`",
|
|
|
|
"`firewall-cmd --direct --add-rule ipv6 filter f2b-j-w-fwcmd-ap 1000 -j RETURN`",
|
|
|
|
"`firewall-cmd --direct --add-rule ipv6 filter INPUT 0 -j f2b-j-w-fwcmd-ap`",
|
|
|
|
"`firewall-cmd --direct --add-rule ipv6 filter INPUT_direct 0 -j f2b-j-w-fwcmd-ap`",
|
|
|
|
),
|
|
|
|
),
|
|
|
|
'stop': (
|
|
|
|
'stop': (
|
|
|
|
"`firewall-cmd --direct --remove-rule ipv4 filter INPUT 0 -j f2b-j-w-fwcmd-ap`",
|
|
|
|
"`firewall-cmd --direct --remove-rule ipv4 filter INPUT_direct 0 -j f2b-j-w-fwcmd-ap`",
|
|
|
|
"`firewall-cmd --direct --remove-rules ipv4 filter f2b-j-w-fwcmd-ap`",
|
|
|
|
"`firewall-cmd --direct --remove-rules ipv4 filter f2b-j-w-fwcmd-ap`",
|
|
|
|
"`firewall-cmd --direct --remove-chain ipv4 filter f2b-j-w-fwcmd-ap`",
|
|
|
|
"`firewall-cmd --direct --remove-chain ipv4 filter f2b-j-w-fwcmd-ap`",
|
|
|
|
"`firewall-cmd --direct --remove-rule ipv6 filter INPUT 0 -j f2b-j-w-fwcmd-ap`",
|
|
|
|
"`firewall-cmd --direct --remove-rule ipv6 filter INPUT_direct 0 -j f2b-j-w-fwcmd-ap`",
|
|
|
|
"`firewall-cmd --direct --remove-rules ipv6 filter f2b-j-w-fwcmd-ap`",
|
|
|
|
"`firewall-cmd --direct --remove-rules ipv6 filter f2b-j-w-fwcmd-ap`",
|
|
|
|
"`firewall-cmd --direct --remove-chain ipv6 filter f2b-j-w-fwcmd-ap`",
|
|
|
|
"`firewall-cmd --direct --remove-chain ipv6 filter f2b-j-w-fwcmd-ap`",
|
|
|
|
),
|
|
|
|
),
|
|
|
@ -1646,21 +1646,21 @@ class ServerConfigReaderTests(LogCaptureTestCase):
|
|
|
|
),
|
|
|
|
),
|
|
|
|
}),
|
|
|
|
}),
|
|
|
|
# firewallcmd-ipset --
|
|
|
|
# firewallcmd-ipset --
|
|
|
|
('j-w-fwcmd-ipset', 'firewallcmd-ipset[name=%(__name__)s, bantime="10m", port="http", protocol="tcp", chain="INPUT"]', {
|
|
|
|
('j-w-fwcmd-ipset', 'firewallcmd-ipset[name=%(__name__)s, bantime="10m", 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 600`",
|
|
|
|
"`ipset create f2b-j-w-fwcmd-ipset hash:ip timeout 600`",
|
|
|
|
"`firewall-cmd --direct --add-rule ipv4 filter INPUT 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 600`",
|
|
|
|
"`ipset create f2b-j-w-fwcmd-ipset6 hash:ip timeout 600`",
|
|
|
|
"`firewall-cmd --direct --add-rule ipv6 filter INPUT 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`",
|
|
|
|
),
|
|
|
|
),
|
|
|
|
'stop': (
|
|
|
|
'stop': (
|
|
|
|
"`firewall-cmd --direct --remove-rule ipv4 filter INPUT 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 --remove-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`",
|
|
|
|
"`ipset flush f2b-j-w-fwcmd-ipset`",
|
|
|
|
"`ipset flush f2b-j-w-fwcmd-ipset`",
|
|
|
|
"`ipset destroy f2b-j-w-fwcmd-ipset`",
|
|
|
|
"`ipset destroy f2b-j-w-fwcmd-ipset`",
|
|
|
|
"`firewall-cmd --direct --remove-rule ipv6 filter INPUT 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 --remove-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`",
|
|
|
|
"`ipset flush f2b-j-w-fwcmd-ipset6`",
|
|
|
|
"`ipset flush f2b-j-w-fwcmd-ipset6`",
|
|
|
|
"`ipset destroy f2b-j-w-fwcmd-ipset6`",
|
|
|
|
"`ipset destroy f2b-j-w-fwcmd-ipset6`",
|
|
|
|
),
|
|
|
|
),
|
|
|
|