Re: PF and tun1

From: Shamim Shahriar <shamim.shahriar_at_gmail.com>
Date: Tue, 28 Dec 2021 19:41:45 UTC
Have you tried reloading pf rules once tun1 is active/up?

On Tue, 28 Dec 2021, 19:35 Alex Thomas, <karlthane@gmail.com> wrote:

> I have tried that, and have commented out the table for rfc6890 and
> the rules for it. Still not having any success.
>
> On Tue, Dec 28, 2021 at 1:28 AM Morgan Wesström
> <freebsd-database@pp.dyndns.biz> wrote:
> >
> > On 2021-12-28 02:55, Alex Thomas wrote:
> > > I am trying to get nebula working on tun1 with pf as my firewall. If I
> > > turn pf off, everything works. How to I tell pf to ignore / let
> > > everything pass on the tun1 device.
> > >
> > > vtnet0 = "vtnet0"
> > > nebula1 = "tun1"
> > > icmp_types = "{ echoreq unreach }"
> > > table <bruteforce> persist
> > > table <rfc6890> { 0.0.0.0/8 10.0.0.0/8 100.64.0.0/10 127.0.0.0/8
> > > 169.254.0.0/16          \
> > >                    172.16.0.0/12 192.0.0.0/24 192.0.0.0/29
> 192.0.2.0/24
> > > 192.88.99.0/24    \
> > >                    192.168.0.0/16 198.18.0.0/15 198.51.100.0/24
> > > 203.0.113.0/24            \
> > >                    240.0.0.0/4 255.255.255.255/32 }
> > >
> > > set skip on lo0
> > > set skip on tun1
> > > set skip on $nebula1
> > > scrub in all fragment reassemble max-mss 1440
> > > antispoof quick for $vtnet0
> > > block in quick on egress from <rfc6890>
> > > block return out quick on egress to <rfc6890>
> > > block all
> > > pass in on $vtnet0 proto tcp to port { 22222 } \
> > >          keep state (max-src-conn 15, max-src-conn-rate 3/1, \
> > >                  overload <bruteforce> flush global)
> > > pass out proto { tcp udp } to port { 22 53 80 123 443 }
> > > pass out inet proto icmp icmp-type $icmp_types
> > >
> >
> > In my experience the skip rules only work on interfaces that are
> available when
> > pf starts, which excludes tun-interfaces. I don't know if this is by
> design.
> > Remove your skip rules for tun1 and $nebula1 and just add a pass rule
> for that
> > interface:
> >
> > pass on tun1 all
> >
> > Additionally, since you're quick blocking all traffic to and from
> private IP
> > addresses, make sure you don't use any of those IP addresses on tun1.
> >
> > /Morgan
> >
>
>