[10446] | 1 | #
|
---|
| 2 | # Wirless Leiden PF firewall configuration for Proxy Setup. This firewall has 5
|
---|
| 3 | # main features:
|
---|
| 4 | #
|
---|
| 5 | # 1) It supports outgoing NAT to specified ports. The so called iLeiden setup.
|
---|
| 6 | # 2) It supports incoming NAT from the private MGMT network, for maintenance use.
|
---|
| 7 | # 3) It protects the private MGMT network from WL requests to it's own services.
|
---|
| 8 | # 4) It portects the $ext_if by only allowing an subset of services.
|
---|
| 9 | # 5) The Wireless Leiden facing interfaces are not firewalled.
|
---|
[10448] | 10 | # 6) WL Captive Portal Support for interfaces who needs it.
|
---|
| 11 | # 7) Optional: Exposure of WL services to the outside
|
---|
[10446] | 12 | #
|
---|
| 13 | wl_net="172.16.0.0/12"
|
---|
| 14 | allow_ext_tcp="{ssh, domain}"
|
---|
| 15 | allow_ext_udp="{domain, snmp}"
|
---|
| 16 | private="{ 10.0.0.0/8 , 172.16.0.0/12, 192.168.0.0/16 }"
|
---|
| 17 |
|
---|
[10448] | 18 |
|
---|
| 19 | # Default configuration for ALIX2 with vr0 as external interface and wlan0 as
|
---|
| 20 | # the public accesspoint in iLeiden setup.
|
---|
| 21 | ext_if="vr0"
|
---|
| 22 | captive_portal_interfaces="wlan0"
|
---|
| 23 | publicnat="http,https"
|
---|
| 24 | # For an traditional proxy setup set, uncomment:
|
---|
| 25 | #publicnat=0
|
---|
| 26 |
|
---|
[10446] | 27 | # Always be nice, and return the fact we are blocking the packets
|
---|
| 28 | set block-policy return
|
---|
| 29 |
|
---|
[10448] | 30 | # Table used to authorized hosts (6)
|
---|
| 31 | table <wlportal> persist counters
|
---|
| 32 |
|
---|
[10446] | 33 | # NAT MGMT to Wireless Leiden (2)
|
---|
| 34 | nat on lo0 from $private to $wl_net -> (lo0)
|
---|
| 35 |
|
---|
| 36 | # Nat the internet but NOT to Private Network (1)
|
---|
[10448] | 37 | nat on $ext_if inet proto tcp from $wl_net to any port { $publicnat } -> ($ext_if)
|
---|
[10446] | 38 | # Do NOT allow NAT to the Private Network (3)
|
---|
[10448] | 39 | no nat on $ext_if from $wl_net to $private
|
---|
[10446] | 40 |
|
---|
[10448] | 41 | # Redirection needs source natting and allow rules (see below) (7)
|
---|
| 42 | rdr on $ext_if inet proto tcp from any to $ext_if port 8081 -> 172.16.4.46 port 80
|
---|
| 43 |
|
---|
| 44 | # Redirect user to captive portal they have not clicked OK yet (6)
|
---|
| 45 | no rdr on { $captive_portal_interfaces } proto tcp from <wlportal> to !$wl_net port 80
|
---|
| 46 | rdr on { $captive_portal_interfaces } proto tcp from $wl_net to !$wl_net port 80 -> 172.31.255.1 port 8081
|
---|
| 47 |
|
---|
[10446] | 48 | # Localhost is considered safe (5)
|
---|
| 49 | pass quick on lo0 all
|
---|
| 50 |
|
---|
| 51 | # By default all interfaces are open (5)
|
---|
| 52 | pass all
|
---|
| 53 |
|
---|
| 54 | # External interface is permissive (4)
|
---|
| 55 | block on $ext_if
|
---|
| 56 |
|
---|
| 57 | # Expose some local services (4)
|
---|
| 58 | pass in on $ext_if inet proto tcp from any to $ext_if port $allow_ext_tcp keep state
|
---|
| 59 | pass in on $ext_if inet proto udp from any to $ext_if port $allow_ext_udp keep state
|
---|
| 60 | pass in on $ext_if inet proto icmp from any to $ext_if icmp-type { echoreq }
|
---|
| 61 |
|
---|
| 62 | # Packets from the management LAN are allowed in (2)
|
---|
| 63 | pass in on $ext_if from $private to $wl_net keep state
|
---|
| 64 |
|
---|
[10448] | 65 | # Allow exposing some WL Services to the inet (7)
|
---|
| 66 | pass in on $ext_if inet proto tcp from any to $ext_if port { 8081 } keep state
|
---|
| 67 |
|
---|
[10446] | 68 | # Packets going out are the ones to the internet with an certain limit (1)
|
---|
| 69 | pass out on $ext_if inet proto tcp from $wl_net to any port { $publicnat } keep state \
|
---|
| 70 | (max-src-conn-rate 100/10, max-src-conn 10)
|
---|
| 71 |
|
---|
| 72 | # For proper functioning allow the local machine to initiate requests outside (4)
|
---|
| 73 | pass out on $ext_if inet proto udp from $ext_if to any port{domain, 1194} keep state
|
---|
| 74 | pass out on $ext_if inet proto tcp from $ext_if to any port{http, https, 1194} keep state
|
---|
| 75 | pass out on $ext_if inet proto icmp from $ext_if to any icmp-type { echoreq }
|
---|
| 76 |
|
---|
| 77 | # Do not allow connections to the local MGNT LAN to start (3)
|
---|
| 78 | block out on $ext_if from any to $private
|
---|
| 79 |
|
---|
| 80 | # Limited acess PRIVATE network to allow DHCP/DNS to function (3)
|
---|
| 81 | pass out on $ext_if inet proto {udp, tcp} from $ext_if to $private port {domain} keep state
|
---|
| 82 |
|
---|
| 83 | # Uncomment to allow limited access to MGNT interfaces ON the private network (3)
|
---|
| 84 | #pass out on $ext_if inet proto tcp from $ext_if to $private port {ssh, http, https} keep state
|
---|
| 85 |
|
---|