set limit table-entries 400000 set optimization normal set limit states 201000 set limit src-nodes 201000 #System aliases loopback = "{ lo0 }" WAN = "{ mvneta2 }" LAN = "{ mvneta1 }" WAN2 = "{ mvneta0 }" #SSH Lockout Table table persist #Snort tables table table table persist file "/etc/bogons" table # User Aliases table { 81.205.150.46/32 } EasyRuleBlockHostsWAN = "" # Gateways GWWAN_DHCP = " route-to ( mvneta2 24.168.192.1 ) " GWWAN2_DHCP = " route-to ( mvneta0 192.168.5.1 ) " GWGWGroup = " route-to { ( mvneta2 24.168.192.1 ) } " set loginterface mvneta1 set skip on pfsync0 scrub on $WAN inet all fragment reassemble scrub on $WAN inet6 all fragment reassemble scrub on $LAN inet all fragment reassemble scrub on $LAN inet6 all fragment reassemble scrub on $WAN2 inet all fragment reassemble scrub on $WAN2 inet6 all fragment reassemble no nat proto carp no rdr proto carp nat-anchor "natearly/*" nat-anchor "natrules/*" # Outbound NAT rules (automatic) # Subnets to NAT tonatsubnets = "{ 127.0.0.0/8 ::1/128 10.0.1.0/24 }" nat on $WAN inet from $tonatsubnets to any port 500 -> XXX.XXX.XXX.XXX/32 static-port nat on $WAN inet6 from $tonatsubnets to any port 500 -> (mvneta2) static-port nat on $WAN inet from $tonatsubnets to any -> XXX.XXX.XXX.XXX/32 port 1024:65535 nat on $WAN inet6 from $tonatsubnets to any -> (mvneta2) port 1024:65535 nat on $WAN2 inet from $tonatsubnets to any port 500 -> 192.168.5.43/32 static-port nat on $WAN2 inet6 from $tonatsubnets to any port 500 -> (mvneta0) static-port nat on $WAN2 inet from $tonatsubnets to any -> 192.168.5.43/32 port 1024:65535 nat on $WAN2 inet6 from $tonatsubnets to any -> (mvneta0) port 1024:65535 # TFTP proxy rdr-anchor "tftp-proxy/*" # UPnPd rdr anchor rdr-anchor "miniupnpd" anchor "openvpn/*" anchor "ipsec/*" # block IPv4 link-local. Per RFC 3927, link local "MUST NOT" be forwarded by a routing device, # and clients "MUST NOT" send such packets to a router. FreeBSD won't route 169.254./16, but # route-to can override that, causing problems such as in redmine #2073 block in log quick from 169.254.0.0/16 to any tracker 1000000101 label "Block IPv4 link-local" block in log quick from any to 169.254.0.0/16 tracker 1000000102 label "Block IPv4 link-local" #--------------------------------------------------------------------------- # default deny rules #--------------------------------------------------------------------------- block in log inet all tracker 1000000103 label "Default deny rule IPv4" block out log inet all tracker 1000000104 label "Default deny rule IPv4" block in log inet6 all tracker 1000000105 label "Default deny rule IPv6" block out log inet6 all tracker 1000000106 label "Default deny rule IPv6" # IPv6 ICMP is not auxiliary, it is required for operation # See man icmp6(4) # 1 unreach Destination unreachable # 2 toobig Packet too big # 128 echoreq Echo service request # 129 echorep Echo service reply # 133 routersol Router solicitation # 134 routeradv Router advertisement # 135 neighbrsol Neighbor solicitation # 136 neighbradv Neighbor advertisement pass quick inet6 proto ipv6-icmp from any to any icmp6-type {1,2,135,136} tracker 1000000107 keep state # Allow only bare essential icmpv6 packets (NS, NA, and RA, echoreq, echorep) pass out quick inet6 proto ipv6-icmp from fe80::/10 to fe80::/10 icmp6-type {129,133,134,135,136} tracker 1000000108 keep state pass out quick inet6 proto ipv6-icmp from fe80::/10 to ff02::/16 icmp6-type {129,133,134,135,136} tracker 1000000109 keep state pass in quick inet6 proto ipv6-icmp from fe80::/10 to fe80::/10 icmp6-type {128,133,134,135,136} tracker 1000000110 keep state pass in quick inet6 proto ipv6-icmp from ff02::/16 to fe80::/10 icmp6-type {128,133,134,135,136} tracker 1000000111 keep state pass in quick inet6 proto ipv6-icmp from fe80::/10 to ff02::/16 icmp6-type {128,133,134,135,136} tracker 1000000112 keep state pass in quick inet6 proto ipv6-icmp from :: to ff02::/16 icmp6-type {128,133,134,135,136} tracker 1000000113 keep state # We use the mighty pf, we cannot be fooled. block log quick inet proto { tcp, udp } from any port = 0 to any tracker 1000000114 label "Block traffic from port 0" block log quick inet proto { tcp, udp } from any to any port = 0 tracker 1000000115 label "Block traffic to port 0" block log quick inet6 proto { tcp, udp } from any port = 0 to any tracker 1000000116 label "Block traffic from port 0" block log quick inet6 proto { tcp, udp } from any to any port = 0 tracker 1000000117 label "Block traffic to port 0" # Snort package block log quick from to any tracker 1000000118 label "Block snort2c hosts" block log quick from any to tracker 1000000119 label "Block snort2c hosts" # SSH lockout block in log quick proto tcp from to (self) port 22 tracker 1000000301 label "sshguard" # webConfigurator lockout block in log quick proto tcp from to (self) port 443 tracker 1000000351 label "GUI Lockout" block in log quick from to any tracker 1000000400 label "virusprot overload table" # allow our DHCP client out to the WAN pass in quick on $WAN proto udp from any port = 67 to any port = 68 tracker 1000000561 label "allow dhcp client out WAN" pass out quick on $WAN proto udp from any port = 68 to any port = 67 tracker 1000000562 label "allow dhcp client out WAN" # Not installing DHCP server firewall rules for WAN which is configured for DHCP. antispoof log for $WAN tracker 1000001570 antispoof log for $LAN tracker 1000002620 # allow access to DHCP server on LAN pass in quick on $LAN proto udp from any port = 68 to 255.255.255.255 port = 67 tracker 1000002641 label "allow access to DHCP server" pass in quick on $LAN proto udp from any port = 68 to 10.0.1.1 port = 67 tracker 1000002642 label "allow access to DHCP server" pass out quick on $LAN proto udp from 10.0.1.1 port = 67 to any port = 68 tracker 1000002643 label "allow access to DHCP server" # allow our DHCP client out to the WAN2 pass in quick on $WAN2 proto udp from any port = 67 to any port = 68 tracker 1000002661 label "allow dhcp client out WAN2" pass out quick on $WAN2 proto udp from any port = 68 to any port = 67 tracker 1000002662 label "allow dhcp client out WAN2" # Not installing DHCP server firewall rules for WAN2 which is configured for DHCP. antispoof log for $WAN2 tracker 1000003670 # loopback pass in on $loopback inet all tracker 1000003711 label "pass IPv4 loopback" pass out on $loopback inet all tracker 1000003712 label "pass IPv4 loopback" pass in on $loopback inet6 all tracker 1000003713 label "pass IPv6 loopback" pass out on $loopback inet6 all tracker 1000003714 label "pass IPv6 loopback" # let out anything from the firewall host itself and decrypted IPsec traffic pass out inet all keep state allow-opts tracker 1000003715 label "let out anything IPv4 from firewall host itself" pass out inet6 all keep state allow-opts tracker 1000003716 label "let out anything IPv6 from firewall host itself" pass out route-to ( mvneta2 XXX.XXX.XXX.XXX ) from XXX.XXX.XXX.XXX to !24.168.192.0/19 tracker 1000003811 keep state allow-opts label "let out anything from firewall host itself" pass out route-to ( mvneta0 192.168.5.1 ) from 192.168.5.43 to !192.168.5.0/24 tracker 1000003812 keep state allow-opts label "let out anything from firewall host itself" # make sure the user cannot lock himself out of the webConfigurator or SSH pass in quick on mvneta1 proto tcp from any to (mvneta1) port { 443 80 } tracker 10001 keep state label "anti-lockout rule" # User-defined rules follow anchor "userrules/*" pass in quick on $LAN inet from 10.0.1.0/24 to any tracker 0100000101 keep state label "USER_RULE: Default allow LAN to any rule" # source address is empty. label "USER_RULE: Default allow LAN IPv6 to any rule" # VPN Rules anchor "tftp-proxy/*" anchor "miniupnpd"