local.m4: Filter out source routing in the firewall.
[firewall] / local.m4
index d103a9f..821cea9 100644 (file)
--- a/local.m4
+++ b/local.m4
@@ -54,6 +54,7 @@ m4_divert(-1)
 ## 172.29.198.0/24  Untrusted networks.
 ##     .0/25           house wireless net
 ##     .128/28         iodine (IP-over-DNS) network
+##     .144/28         hippotat (IP-over-HTTP) network
 ##     .160/27         untrusted virtual network
 ##
 ## 172.29.199.0/24  Trusted networks.
@@ -190,7 +191,7 @@ defhost groove
 
 defhost gibson
        hosttype client
-       iface eth0.5 unsafe
+       iface eth0 unsafe
 
 ## Colocated networks.
 defnet jump trusted
@@ -206,6 +207,9 @@ defnet colobdry virtual
 defnet iodine untrusted
        addr 172.29.198.128/28
        via colohub
+defnet hippotat untrusted
+       addr 172.29.198.144/28
+       via colohub
 
 ## Colocated hosts.
 defhost fender
@@ -231,6 +235,7 @@ defhost jazz
        iface eth0 jump colo vpn
        iface eth1 jump colo vpn
        iface dns0 iodine
+       iface hippo-svc hippotat
        iface vpn-+ vpn
 
 ## Other networks.
@@ -349,6 +354,23 @@ case $forward in
     ;;
 esac
 
+m4_divert(82)m4_dnl
+###--------------------------------------------------------------------------
+### Check for source routing.
+
+clearchain check-srcroute
+
+run iptables -A check-srcroute -g forbidden \
+    -m ipv4options --any --flags lsrr,ssrr
+run ip6tables -A check-srcroute -g forbidden \
+    -m rt
+
+for c in INPUT FORWARD; do
+  for m in $from_scary $from_untrusted; do
+    run ip46tables -A $c -m mark --mark $m/$MASK_FROM -j check-srcroute
+  done
+done
+
 m4_divert(84)m4_dnl
 ###--------------------------------------------------------------------------
 ### Locally-bound packet inspection.
@@ -377,7 +399,7 @@ m4_divert(88)m4_dnl
 openports inbound
 
 ## Inspect inbound packets from untrusted sources.
-run ip46tables -A inbound -j forbidden
+run ip46tables -A inbound -g forbidden
 run ip46tables -A INPUT -m mark --mark $from_scary/$MASK_FROM -g inbound
 run ip46tables -A INPUT -m mark --mark $from_untrusted/$MASK_FROM -g inbound