set limit table-entries 400000 set optimization normal set limit states 13087000 set limit src-nodes 13087000 #System aliases loopback = "{ lo0 }" WAN_TEST = "{ bge3 }" LAN = "{ bge1 }" LAN_TEST = "{ bge0 }" UFANET_VIDEO_SRV = "{ lagg0.1832 }" UFANET_VIDEO_IN = "{ bge2 }" #SSH Lockout Table table persist #Snort tables table table table persist file "/etc/bogons" table # User Aliases # Gateways GWWAN_TEST = " route-to ( bge3 2xx.xxx.xxx.xx1 ) " GWUFANET_VIDEO_IN = " " set loginterface bge1 set skip on pfsync0 set keepcounters scrub on $WAN_TEST inet all fragment reassemble scrub on $WAN_TEST inet6 all fragment reassemble scrub on $LAN inet all fragment reassemble scrub on $LAN inet6 all fragment reassemble scrub on $LAN_TEST inet all fragment reassemble scrub on $LAN_TEST inet6 all fragment reassemble scrub on $UFANET_VIDEO_SRV inet all fragment reassemble scrub on $UFANET_VIDEO_SRV inet6 all fragment reassemble scrub on $UFANET_VIDEO_IN inet all fragment reassemble scrub on $UFANET_VIDEO_IN inet6 all fragment reassemble no nat proto carp no rdr proto carp nat-anchor "natearly/*" nat-anchor "natrules/*" # Outbound NAT rules (manual) nat on $LAN_TEST inet from any to 192.168.5.0/24 -> 192.168.5.15/32 port 1024:65535 nat on $WAN_TEST inet from 192.168.5.0/24 to any -> 2xx.xxx.xxx.xx2/32 port 1024:65535 # TFTP proxy rdr-anchor "tftp-proxy/*" # NAT Inbound Redirects rdr on bge3 inet proto tcp from any to 2xx.xxx.xxx.xx2 port 8xxx -> 192.168.5.14 # 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 ridentifier 1000000101 label "Block IPv4 link-local" block in log quick from any to 169.254.0.0/16 ridentifier 1000000102 label "Block IPv4 link-local" #--------------------------------------------------------------------------- # default deny rules #--------------------------------------------------------------------------- block in log inet all ridentifier 1000000103 label "Default deny rule IPv4" block out log inet all ridentifier 1000000104 label "Default deny rule IPv4" block in log inet6 all ridentifier 1000000105 label "Default deny rule IPv6" block out log inet6 all ridentifier 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} ridentifier 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} ridentifier 1000000108 keep state pass out quick inet6 proto ipv6-icmp from fe80::/10 to ff02::/16 icmp6-type {129,133,134,135,136} ridentifier 1000000109 keep state pass in quick inet6 proto ipv6-icmp from fe80::/10 to fe80::/10 icmp6-type {128,133,134,135,136} ridentifier 1000000110 keep state pass in quick inet6 proto ipv6-icmp from ff02::/16 to fe80::/10 icmp6-type {128,133,134,135,136} ridentifier 1000000111 keep state pass in quick inet6 proto ipv6-icmp from fe80::/10 to ff02::/16 icmp6-type {128,133,134,135,136} ridentifier 1000000112 keep state pass in quick inet6 proto ipv6-icmp from :: to ff02::/16 icmp6-type {128,133,134,135,136} ridentifier 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 ridentifier 1000000114 label "Block traffic from port 0" block log quick inet proto { tcp, udp } from any to any port = 0 ridentifier 1000000115 label "Block traffic to port 0" block log quick inet6 proto { tcp, udp } from any port = 0 to any ridentifier 1000000116 label "Block traffic from port 0" block log quick inet6 proto { tcp, udp } from any to any port = 0 ridentifier 1000000117 label "Block traffic to port 0" # Snort package block log quick from to any ridentifier 1000000118 label "Block snort2c hosts" block log quick from any to ridentifier 1000000119 label "Block snort2c hosts" # SSH lockout block in log quick proto tcp from to (self) port 22 ridentifier 1000000301 label "sshguard" # webConfigurator lockout block in log quick proto tcp from to (self) port 8053 ridentifier 1000000351 label "GUI Lockout" block in log quick from to any ridentifier 1000000400 label "virusprot overload table" antispoof log for $WAN_TEST ridentifier 1000001570 antispoof log for $LAN ridentifier 1000002620 # allow access to DHCPv6 server on LAN # We need inet6 icmp for stateless autoconfig and dhcpv6 pass quick on $LAN inet6 proto udp from fe80::/10 to fe80::/10 port = 546 ridentifier 1000002651 label "allow access to DHCPv6 server" pass quick on $LAN inet6 proto udp from fe80::/10 to ff02::/16 port = 546 ridentifier 1000002652 label "allow access to DHCPv6 server" pass quick on $LAN inet6 proto udp from fe80::/10 to ff02::/16 port = 547 ridentifier 1000002653 label "allow access to DHCPv6 server" pass quick on $LAN inet6 proto udp from ff02::/16 to fe80::/10 port = 547 ridentifier 1000002654 label "allow access to DHCPv6 server" antispoof log for $LAN_TEST ridentifier 1000003670 antispoof log for $UFANET_VIDEO_SRV ridentifier 1000004720 antispoof log for $UFANET_VIDEO_IN ridentifier 1000005770 # loopback pass in on $loopback inet all ridentifier 1000005811 label "pass IPv4 loopback" pass out on $loopback inet all ridentifier 1000005812 label "pass IPv4 loopback" pass in on $loopback inet6 all ridentifier 1000005813 label "pass IPv6 loopback" pass out on $loopback inet6 all ridentifier 1000005814 label "pass IPv6 loopback" # let out anything from the firewall host itself and decrypted IPsec traffic pass out inet all keep state allow-opts ridentifier 1000005815 label "let out anything IPv4 from firewall host itself" pass out inet6 all keep state allow-opts ridentifier 1000005816 label "let out anything IPv6 from firewall host itself" # make sure the user cannot lock himself out of the webConfigurator or SSH pass in quick on bge1 proto tcp from any to (bge1) port { 8xxx 80 } ridentifier 10001 keep state label "anti-lockout rule" # User-defined rules follow anchor "userrules/*" pass in quick on $WAN_TEST inet proto tcp from any to 192.168.5.14 port 8xxx ridentifier 1701330238 flags S/SA keep state label "USER_RULE: NAT " pass in quick on $LAN inet from 192.168.3.0/24 to any ridentifier 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" pass in quick on $LAN_TEST inet from 192.168.5.0/24 to any ridentifier 1701331266 keep state label "USER_RULE" # VPN Rules anchor "tftp-proxy/*"