2023-05-28 20:01:02 +00:00
|
|
|
ext_if = "lagg0"
|
2023-05-29 02:36:31 +00:00
|
|
|
not_ext_if = "{ !lagg0 }"
|
2023-05-28 20:01:02 +00:00
|
|
|
jail_nat_v4 = "{ 10.215.1.0/24 }"
|
|
|
|
not_jail_nat_v4 = "{ any, !10.215.1.0/24 }"
|
2023-06-17 17:19:41 +00:00
|
|
|
pub_k8s = "{ 74.80.180.136/29, !74.80.180.138 }"
|
2023-05-28 20:01:02 +00:00
|
|
|
|
|
|
|
dhcp = "{ bootpc, bootps }"
|
|
|
|
allow = "{ colo }"
|
|
|
|
|
|
|
|
tcp_pass_in = "{ 22 }"
|
|
|
|
udp_pass_in = "{ 53 51820 51821 51822 }"
|
|
|
|
|
|
|
|
# Rules must be in order: options, normalization, queueing, translation, filtering
|
|
|
|
|
|
|
|
# options
|
|
|
|
set skip on lo
|
|
|
|
|
|
|
|
# redirections
|
2023-05-29 02:36:31 +00:00
|
|
|
nat pass on lagg0 inet from $jail_nat_v4 to $not_jail_nat_v4 -> (lagg0)
|
|
|
|
nat pass on $not_ext_if inet from $jail_nat_v4 to 10.215.1.1 port 53 -> ($ext_if)
|
|
|
|
rdr pass on $not_ext_if proto {tcp, udp} from any to 10.215.1.1 port 53 -> 1.1.1.1 port 53
|
2023-05-28 20:01:02 +00:00
|
|
|
|
2023-06-05 16:48:26 +00:00
|
|
|
rdr pass on $ext_if inet proto tcp from $not_jail_nat_v4 to any port 6443 -> 10.215.1.204 port 6443
|
2023-06-05 20:39:12 +00:00
|
|
|
rdr pass on jail_nat inet proto tcp from $jail_nat_v4 to any port 6443 -> 10.215.1.204 port 6443
|
|
|
|
nat pass on $not_ext_if proto {tcp, udp} from $not_jail_nat_v4 to 10.215.1.204 port 6443 -> (jail_nat)
|
|
|
|
nat pass on $not_ext_if proto {tcp, udp} from $jail_nat_v4 to 10.215.1.204 port 6443 -> (jail_nat)
|
2023-06-05 16:48:26 +00:00
|
|
|
|
|
|
|
|
2023-05-28 20:01:02 +00:00
|
|
|
# filtering
|
|
|
|
block log all
|
|
|
|
pass out on $ext_if
|
|
|
|
|
2023-06-17 04:25:28 +00:00
|
|
|
# Single interface kubernetes cluster is working with the following run on mrmanager:
|
2023-06-17 17:19:41 +00:00
|
|
|
# doas route add -host 74.80.180.139 -interface jail_nat
|
|
|
|
# doas sysctl net.link.ether.inet.proxyall=1
|
2023-06-17 04:25:28 +00:00
|
|
|
# Plus this in pf.conf:
|
|
|
|
# pass quick from any to 74.80.180.139
|
2023-06-17 17:19:41 +00:00
|
|
|
pass quick from any to $pub_k8s
|
2023-06-17 04:25:28 +00:00
|
|
|
|
2023-05-28 20:01:02 +00:00
|
|
|
pass in on jail_nat
|
|
|
|
# Allow traffic from my machine to the jails/virtual machines
|
|
|
|
pass out on jail_nat from $jail_nat_v4
|
|
|
|
|
|
|
|
# We pass on the interfaces listed in allow rather than skipping on
|
|
|
|
# them because changes to pass rules will update when running a
|
|
|
|
# `service pf reload` but interfaces that we `skip` will not update (I
|
|
|
|
# forget if its from adding, removing, or both. TODO: test to figure
|
|
|
|
# it out). Also skipped interfaces are not subject to nat/rdr rules.
|
|
|
|
pass quick on $allow
|
|
|
|
|
|
|
|
pass on $ext_if proto icmp all
|
|
|
|
pass on $ext_if proto icmp6 all
|
|
|
|
|
|
|
|
pass in on $ext_if proto tcp to any port $tcp_pass_in
|
|
|
|
pass in on $ext_if proto udp to any port $udp_pass_in
|