source: hybrid/branches/releng-11/nanobsd/files/etc/pf.hybrid.conf@ 13694

Last change on this file since 13694 was 13694, checked in by rick, 8 years ago

Remove options to configure NAT IP.

The parentheses (which means the ruleset needs to be reloaded in case of
DHCP change for example) are not allowed to be passed as variable. Since
we are use the First IP as NAT IP (even on shared external/interlink
configuration, make it the defacto standard.

File size: 5.7 KB
Line 
1#
2# Wireless Leiden PF firewall configuration for (iLeiden) Proxy Setup.
3#
4# N.B: The features points are shared between all firewall configurations to
5# make comparisions more easy to do
6#
7# 1) It supports outgoing NAT to specified ports. The so called iLeiden setup.
8# 2) It supports incoming NAT from the private MGMT network, for maintenance use.
9# 3) It protects the private MGMT network from WL requests to it's own services.
10# 4) It portects the $ext_if by only allowing an subset of services.
11# 5) The Wireless Leiden facing interfaces are not firewalled.
12# 6) WL Captive Portal Support for interfaces who needs it.
13# 7) Optional: Exposure of WL services to the outside
14# 9) Protect the Wireless Network from junk traffic.
15#
16# Rick van der Zwet <rick@wirelessleiden.nl>
17#
18
19# Standard port allow listings for external services
20allow_ext_in_tcp="1022, openvpn"
21allow_ext_in_udp="snmp, openvpn"
22
23# Standard port allow listings for services at host network (in case of NAT)
24allow_private_in_tcp="domain"
25allow_private_in_udp="domain"
26
27allow_ext_out_tcp = "domain, http, https, openvpn"
28allow_ext_out_udp = "domain, ntp, openvpn"
29
30
31# Default configuration for ALIX2 with vr0 as external interface and wlan0 as
32# the public accesspoint in iLeiden setup, aliases on external interface OK.
33ext_if="vr0"
34inet_if="vr0"
35captive_portal_interfaces="wlan0"
36publicnat="http,https"
37masterip="127.0.0.1"
38# For an traditional proxy setup set (no iLeiden clients!), uncomment:
39#publicnat=0
40
41# Global standards. NOT to be edited.
42wl_net="172.16.0.0/12"
43private="{ 10.0.0.0/8, 192.168.0.0/16 }"
44ileiden_ports="http,https"
45
46# Always be nice, and return the fact we are blocking the packets
47set block-policy return
48
49# Table used to authorized hosts (6)
50table <wlportal> persist counters
51
52# NAT MGMT to Wireless Leiden (2)
53nat on ! $ext_if from $private to $wl_net -> $masterip
54
55# Do NOT allow NAT to the Private Network (3)
56no nat from $wl_net to $private
57
58# Nat the internet for iLeiden functionality allow for alias on vr0 (1)
59nat on $inet_if inet proto tcp from $wl_net to ! $wl_net port { $publicnat } -> ($inet_if:0)
60
61
62# Redirect user to captive portal they have not clicked OK yet (6)
63no rdr on { $captive_portal_interfaces } proto tcp from <wlportal> to !$wl_net port http
64rdr on { $captive_portal_interfaces } proto tcp from $wl_net to !$wl_net port http -> 172.31.255.1 port 8081
65
66# Load autogenerated entries, like the remote mappings (7)
67include "/etc/pf.hybrid.conf.local"
68
69# Make the device on WL find the proper gateway back (7)
70nat on ! $ext_if inet from any to $wl_net tagged SRV -> $masterip
71
72# Special allow rules for inbound piercing (7)
73pass in quick on $ext_if inet tagged SRV keep state
74
75# Localhost is considered safe (5)
76pass quick on lo0 all
77
78# By default all interfaces are open (5)
79pass all
80
81# By default deny all outgoing traffic to avoid systems spamming the network (9)
82block out on { $captive_portal_interfaces } from any to !$wl_net
83
84# Note: not even HTTPS traffic allowed for those who has not clicked OK yet (6)
85pass out on { $captive_portal_interfaces } proto tcp from <wlportal> to !$wl_net port { $publicnat } keep state
86
87# External interface is permissive (4)
88block on $ext_if inet from any to !$wl_net
89block on $inet_if inet from any to !$wl_net
90
91# Allow internal WL traffic on alias $ext_if interfaces (5)
92pass in quick on $ext_if from $wl_net to $wl_net
93pass out quick on $ext_if from $wl_net to $wl_net
94
95# Expose some local services for internal (NATted) network (4)
96pass in on $ext_if inet proto tcp from $private to $ext_if port { $allow_private_in_tcp } keep state
97pass in on $ext_if inet proto udp from $private to $ext_if port { $allow_private_in_udp } keep state
98pass in on $ext_if inet proto icmp from $private to $ext_if icmp-type { echoreq }
99
100# Expose some local services for the external world (WWW) network (4)
101pass in on $ext_if inet proto tcp from any to $ext_if port { $allow_ext_in_tcp } keep state
102pass in on $ext_if inet proto udp from any to $ext_if port { $allow_ext_in_udp } keep state
103pass in on $ext_if inet proto icmp from any to $ext_if icmp-type { echoreq }
104
105# Packets from the management LAN are allowed in (2)
106pass in on $ext_if from $private to $wl_net keep state
107
108# Packets going out are the ones to the internet with an certain limit (1)
109pass out on $inet_if inet proto tcp from $wl_net to any port { $publicnat } keep state \
110 (max-src-conn-rate 100/10, max-src-conn 10)
111
112# For proper functioning allow the local machine to initiate requests outside (4)
113pass out on $ext_if inet proto udp from $ext_if to any port { $allow_ext_out_udp } keep state
114pass out on $ext_if inet proto tcp from $ext_if to any port { $allow_ext_out_tcp } keep state
115pass out on $ext_if inet proto icmp from $ext_if to any icmp-type { echoreq, trace }
116
117# For proper functioning allow the local machine to initiate requests outside + vpn (4)
118pass out on $inet_if inet proto udp from $inet_if to any port { $allow_ext_out_udp } keep state
119pass out on $inet_if inet proto tcp from $inet_if to any port { $allow_ext_out_tcp } keep state
120pass out on $inet_if inet proto icmp from $inet_if to any icmp-type { echoreq, trace }
121
122# Uncomment to UDP traceroute from this host to start
123#pass out on $ext_if inet proto udp from $ext_if to any port 33434 >< 33464 keep state
124#pass out on $inet_if inet proto udp from $inet_if to any port 33434 >< 33464 keep state
125
126# Do not allow connections to the local MGNT LAN to start (3)
127block out on $ext_if from any to $private
128
129# Limited acess PRIVATE network to allow DHCP/DNS to function (3)
130pass out on $ext_if inet proto {udp, tcp} from $ext_if to $private port {domain} keep state
131
132# Uncomment to allow limited access to MGNT interfaces ON the private network (3)
133#pass out on $ext_if inet proto tcp from $ext_if to $private port {ssh, http, https} keep state
134
Note: See TracBrowser for help on using the repository browser.