Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 28 Dec 2021 19:41:45 +0000
From:      Shamim Shahriar <shamim.shahriar@gmail.com>
To:        Alex Thomas <karlthane@gmail.com>
Cc:        questions@freebsd.org
Subject:   Re: PF and tun1
Message-ID:  <CAOyJeZTLdocx0tKujMU0=CGnDVCQT_Lj9MwE%2BYKJEpLk1Ft4uA@mail.gmail.com>
In-Reply-To: <CABMOuVer0Dy1D0sMAjTJCFee%2B9Lpjo8899c6KKOZyHtwZCh%2Bgg@mail.gmail.com>
References:  <CABMOuVfxHtXzR0EC7P1h1KPYjpyxX9FnTyexLW4sThDpaE8PfA@mail.gmail.com> <5f2cca65-daab-989c-5fd0-6a5373f5bd56@pp.dyndns.biz> <CABMOuVer0Dy1D0sMAjTJCFee%2B9Lpjo8899c6KKOZyHtwZCh%2Bgg@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
--0000000000009dacc005d43a0348
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

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=C3=B6m
> <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 =3D "vtnet0"
> > > nebula1 =3D "tun1"
> > > icmp_types =3D "{ 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
> >
>
>

--0000000000009dacc005d43a0348
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"auto">Have you tried reloading pf rules once tun1 is active/up?=
</div><br><div class=3D"gmail_quote"><div dir=3D"ltr" class=3D"gmail_attr">=
On Tue, 28 Dec 2021, 19:35 Alex Thomas, &lt;<a href=3D"mailto:karlthane@gma=
il.com">karlthane@gmail.com</a>&gt; wrote:<br></div><blockquote class=3D"gm=
ail_quote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-le=
ft:1ex">I have tried that, and have commented out the table for rfc6890 and=
<br>
the rules for it. Still not having any success.<br>
<br>
On Tue, Dec 28, 2021 at 1:28 AM Morgan Wesstr=C3=B6m<br>
&lt;<a href=3D"mailto:freebsd-database@pp.dyndns.biz" target=3D"_blank" rel=
=3D"noreferrer">freebsd-database@pp.dyndns.biz</a>&gt; wrote:<br>
&gt;<br>
&gt; On 2021-12-28 02:55, Alex Thomas wrote:<br>
&gt; &gt; I am trying to get nebula working on tun1 with pf as my firewall.=
 If I<br>
&gt; &gt; turn pf off, everything works. How to I tell pf to ignore / let<b=
r>
&gt; &gt; everything pass on the tun1 device.<br>
&gt; &gt;<br>
&gt; &gt; vtnet0 =3D &quot;vtnet0&quot;<br>
&gt; &gt; nebula1 =3D &quot;tun1&quot;<br>
&gt; &gt; icmp_types =3D &quot;{ echoreq unreach }&quot;<br>
&gt; &gt; table &lt;bruteforce&gt; persist<br>
&gt; &gt; table &lt;rfc6890&gt; { <a href=3D"http://0.0.0.0/8" rel=3D"noref=
errer noreferrer" target=3D"_blank">0.0.0.0/8</a> <a href=3D"http://10.0.0.=
0/8" rel=3D"noreferrer noreferrer" target=3D"_blank">10.0.0.0/8</a> <a href=
=3D"http://100.64.0.0/10" rel=3D"noreferrer noreferrer" target=3D"_blank">1=
00.64.0.0/10</a> <a href=3D"http://127.0.0.0/8" rel=3D"noreferrer noreferre=
r" target=3D"_blank">127.0.0.0/8</a><br>
&gt; &gt; <a href=3D"http://169.254.0.0/16" rel=3D"noreferrer noreferrer" t=
arget=3D"_blank">169.254.0.0/16</a>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 \<br>
&gt; &gt;=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 <a href=3D"http://172.16.0.0/12" rel=3D"noreferrer noreferrer" target=
=3D"_blank">172.16.0.0/12</a> <a href=3D"http://192.0.0.0/24" rel=3D"norefe=
rrer noreferrer" target=3D"_blank">192.0.0.0/24</a> <a href=3D"http://192.0=
.0.0/29" rel=3D"noreferrer noreferrer" target=3D"_blank">192.0.0.0/29</a> <=
a href=3D"http://192.0.2.0/24" rel=3D"noreferrer noreferrer" target=3D"_bla=
nk">192.0.2.0/24</a><br>
&gt; &gt; <a href=3D"http://192.88.99.0/24" rel=3D"noreferrer noreferrer" t=
arget=3D"_blank">192.88.99.0/24</a>=C2=A0 =C2=A0 \<br>
&gt; &gt;=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 <a href=3D"http://192.168.0.0/16" rel=3D"noreferrer noreferrer" target=
=3D"_blank">192.168.0.0/16</a> <a href=3D"http://198.18.0.0/15" rel=3D"nore=
ferrer noreferrer" target=3D"_blank">198.18.0.0/15</a> <a href=3D"http://19=
8.51.100.0/24" rel=3D"noreferrer noreferrer" target=3D"_blank">198.51.100.0=
/24</a><br>
&gt; &gt; <a href=3D"http://203.0.113.0/24" rel=3D"noreferrer noreferrer" t=
arget=3D"_blank">203.0.113.0/24</a>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 \<br>
&gt; &gt;=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 <a href=3D"http://240.0.0.0/4" rel=3D"noreferrer noreferrer" target=3D"=
_blank">240.0.0.0/4</a> <a href=3D"http://255.255.255.255/32" rel=3D"norefe=
rrer noreferrer" target=3D"_blank">255.255.255.255/32</a> }<br>
&gt; &gt;<br>
&gt; &gt; set skip on lo0<br>
&gt; &gt; set skip on tun1<br>
&gt; &gt; set skip on $nebula1<br>
&gt; &gt; scrub in all fragment reassemble max-mss 1440<br>
&gt; &gt; antispoof quick for $vtnet0<br>
&gt; &gt; block in quick on egress from &lt;rfc6890&gt;<br>
&gt; &gt; block return out quick on egress to &lt;rfc6890&gt;<br>
&gt; &gt; block all<br>
&gt; &gt; pass in on $vtnet0 proto tcp to port { 22222 } \<br>
&gt; &gt;=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 keep state (max-src-conn 15, ma=
x-src-conn-rate 3/1, \<br>
&gt; &gt;=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 ove=
rload &lt;bruteforce&gt; flush global)<br>
&gt; &gt; pass out proto { tcp udp } to port { 22 53 80 123 443 }<br>
&gt; &gt; pass out inet proto icmp icmp-type $icmp_types<br>
&gt; &gt;<br>
&gt;<br>
&gt; In my experience the skip rules only work on interfaces that are avail=
able when<br>
&gt; pf starts, which excludes tun-interfaces. I don&#39;t know if this is =
by design.<br>
&gt; Remove your skip rules for tun1 and $nebula1 and just add a pass rule =
for that<br>
&gt; interface:<br>
&gt;<br>
&gt; pass on tun1 all<br>
&gt;<br>
&gt; Additionally, since you&#39;re quick blocking all traffic to and from =
private IP<br>
&gt; addresses, make sure you don&#39;t use any of those IP addresses on tu=
n1.<br>
&gt;<br>
&gt; /Morgan<br>
&gt;<br>
<br>
</blockquote></div>

--0000000000009dacc005d43a0348--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAOyJeZTLdocx0tKujMU0=CGnDVCQT_Lj9MwE%2BYKJEpLk1Ft4uA>