X-Git-Url: https://git.distorted.org.uk/~mdw/firewall/blobdiff_plain/be86e95c1daa4e5f52ff54b2254f22215fd21c67..HEAD:/classify.m4 diff --git a/classify.m4 b/classify.m4 index 1d87fdb..98b9795 100644 --- a/classify.m4 +++ b/classify.m4 @@ -45,7 +45,7 @@ m4_divert(40)m4_dnl ### ### The mangle chains are arranged as follows. ### -### The INPUT and FORWARD hooks simply invokes in-classify and out-classify +### The INPUT and FORWARD hooks simply invoke in-classify and out-classify ### chains as subroutines. These will tail-call appropriate classification ### chains. ### @@ -57,11 +57,12 @@ m4_divert(40)m4_dnl ### goes to bad-source-address, which logs a message and drops the packet. ### The default interface is special. If no explicit matches are found, it ### dispatches to in-default which forbids a few obviously evil things and -### finally dispatches to mark-from-untrusted. +### finally dispatches to mark-from-DEFAULT (usually `untrusted'). ### ### The out-classify is simpler because it doesn't care about the interface. ### It simply checks each network range in turn, dispatching to mark-to-CLASS -### on a match or mark-to-DEFAULT (probably untrusted) if there is no match. +### on a match or mark-to-DEFAULT (probably `untrusted') if there is no +### match. clearchain mangle:in-classify mangle:in-default mangle:out-classify clearchain mangle:local-source @@ -95,7 +96,7 @@ run iptables -t mangle -A in-classify -j RETURN \ ## over the loopback interface, I shouldn't see a packet from me over any ## other interface. Except that I will if I sent a broadcast or multicast. ## Allow the broadcasts, and remember not to trust them. There are no -## broadcast addresses in IPv6 (only link-local multicast)m so we don't have +## broadcast addresses in IPv6 (only link-local multicast) so we don't have ## to worry about that. run iptables -t mangle -A local-source -j RETURN \ -m addrtype --dst-type BROADCAST @@ -130,7 +131,7 @@ run iptables -t mangle -A in-classify -g bad-source-address \ run iptables -t mangle -A in-classify -g bad-source-address \ -m addrtype --src-type BROADCAST \ -## Special IPv6 addresses. Format multicast sources, and mark zero and +## Special IPv6 addresses. Forbid multicast sources, and mark zero and ## link local addresses. for i in :: fe80::/10; do run ip6tables -t mangle -A in-classify -g mark-from-link -s $i @@ -145,6 +146,7 @@ for i in 0.0.0.0 240.0.0.0/4; do run iptables -t mangle -A out-classify -g bad-destination-address -d $i done run iptables -t mangle -A out-classify -g mark-to-link -d 169.254.0.0/16 +run iptables -t mangle -A out-classify -g mark-to-link -d 255.255.255.255 run iptables -t mangle -A out-classify -g mark-to-link \ -m addrtype --dst-type BROADCAST @@ -320,8 +322,8 @@ for entry in $ifmap; do done ## Fill in the black holes in the network. Some of these might actually be -## known networks, so don't fill those in again. See RFC5735 or its -## successors. +## known networks, so don't fill those in again. See RFC5735 and RFC4291, +## and their successors. for addr in \ 10.0.0.0/8 172.16.0.0/12 192.168.0.0/16 \ 127.0.0.0/8 \ @@ -331,7 +333,8 @@ do run iptables -t mangle -A in-default -s $addr -g bad-source-address done for addr in \ - fc00::/7 \ + fc00::/7 fec0::/10 \ + ::0:0/96 ::ffff:0:0/96 \ 2001:db8::/32 do case $alladdrs in *!$addr!*) continue ;; esac