Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 28 Dec 2021 08:27:10 +0100
From:      =?UTF-8?Q?Morgan_Wesstr=c3=b6m?= <freebsd-database@pp.dyndns.biz>
To:        questions@freebsd.org
Subject:   Re: PF and tun1
Message-ID:  <5f2cca65-daab-989c-5fd0-6a5373f5bd56@pp.dyndns.biz>
In-Reply-To: <CABMOuVfxHtXzR0EC7P1h1KPYjpyxX9FnTyexLW4sThDpaE8PfA@mail.gmail.com>
References:  <CABMOuVfxHtXzR0EC7P1h1KPYjpyxX9FnTyexLW4sThDpaE8PfA@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?5f2cca65-daab-989c-5fd0-6a5373f5bd56>