|
| 1 | +# |
| 2 | +# PROVIDE: setup blocked bogons |
| 3 | +# BEFORE: services routing outbound final |
| 4 | +# |
| 5 | + |
| 6 | +# remove all existing tables |
| 7 | +table all destroy |
| 8 | +table blocked create |
| 9 | + |
| 10 | +# standard (non-service specific) tables |
| 11 | +table bogons create |
| 12 | +table bogons add 0.0.0.0/8 |
| 13 | +table bogons add 10.0.0.0/8 |
| 14 | +table bogons add 172.12.0.0/12 |
| 15 | +table bogons add 192.168.0.0/16 |
| 16 | +table bogons add 169.254.0.0/16 |
| 17 | +table bogons add 240.0.0.0/4 |
| 18 | + |
| 19 | +# permit existing TCP sessions |
| 20 | +add allow tcp from any to any established |
| 21 | + |
| 22 | +# permit internal loopback traffic |
| 23 | +add allow ip from any to any via lo0 |
| 24 | +add allow ip from any to any via lo1 |
| 25 | + |
| 26 | +# deny directed loopback traffic |
| 27 | +add deny ip from any to 127.0.0.0/8 in |
| 28 | +add deny ip from any to ::/64 in |
| 29 | + |
| 30 | +# deny unexpected sources |
| 31 | +add deny ip from table(bogons) to me in // unexpected sources |
| 32 | + |
| 33 | +# deny explicitly disabled (non-persistent) sources |
| 34 | +add deny ip from table(blocked) to me in // emergency (non-persistent) blocklist |
| 35 | + |
| 36 | +# allow bsd-standard-port traceroutes |
| 37 | +add allow udp from me to any 33434-33600 // traceroute in |
| 38 | +add allow udp from any to me 33434-33600 // traceroute out |
| 39 | + |
| 40 | +# moderately permissive ICMPv4 |
| 41 | +add allow icmp from any to any icmptypes 0,3,8,11,13,14 // safe ICMPv4 |
| 42 | + |
| 43 | +# link-local ICMPv6 (RS, RA, NS, NA) - per FreeBSD standard rules |
| 44 | +add allow ipv6-icmp from :: to fe80::/10 // ICMPv6 DAD |
| 45 | +add allow ipv6-icmp from fe80::/10 to fe80::/10 // ICMPv6 NDP |
| 46 | +add allow ipv6-icmp from fe80::/10 to ff02::/16 // ICMPv6 NDP |
| 47 | +add allow ipv6-icmp from any to any icmp6types 1,2,3,128,129,135,136 // safe ICMPv6 |
0 commit comments