Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 28 Jan 2019 09:28:50 +0100
From:      "Kristof Provost" <kp@FreeBSD.org>
To:        ASV <asv@inhio.net>
Cc:        "questions list" <freebsd-questions@freebsd.org>
Subject:   Re: PF issue since 11.2-RELEASE
Message-ID:  <51F0845A-2BB3-4BC9-977D-BB0E6C305ED3@FreeBSD.org>
In-Reply-To: <e336fd332455cc9fe9f722482aae09ed6eeab610.camel@inhio.net>
References:  <989e79372513e9769c6857b531f14df8ce0b6f3a.camel@inhio.net> <F26DA908-F2AC-4CBF-8227-A4C3D21865EE@FreeBSD.org> <e336fd332455cc9fe9f722482aae09ed6eeab610.camel@inhio.net>

next in thread | previous in thread | raw e-mail | index | archive | help
This is an OpenPGP/MIME signed message (RFC 3156 and 4880).

--=_MailMate_FE34E488-BDA5-41DD-90C3-3FDF7F076B91_=
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable

On 27 Jan 2019, at 19:03, ASV wrote:
> On Sun, 2019-01-27 at 16:08 +0100, Kristof Provost wrote:
>> On 26 Jan 2019, at 17:00, ASV wrote:
>>> since I've upgraded to 11.2 (from 11.1) I've observed that anytime
>>> I
>>> change something on pf.conf and reload (pfctl -f /etc/pf.conf) I
>>> partially loose connectivity. Partially means that I still am
>>> connected
>>> to the server but the server cannot connect anywhere or ping
>>> anything
>>> (no hosts no IPs) also the jails instantly suffers from the same.
>>
>> That sounds like your established connection continues (because it
>> keeps
>> using the old rules), and something is wrong with the new rules.
> Hi and thanks for your reply!
> This is not the case as I'm modifying NAT rules so I'm not expecting
> anything to start being blocked but the reverse.
>
>> The logical debugging steps would be:
>>   - check the ruleset matches what you expect (pfctl -s rules)
>>   - check the state table (pfctl -s states)
>>   - use pflog to determine what rule causes traffic to be dropped
>>
>>> The quickest fix is to revert the PF configuration to the previous
>>> one
>>> and reload. Everything starts working again.
>>>
>>
>> What do you mean by =E2=80=98previous one=E2=80=99? Do you have two ru=
lesets? What
>> are the two rulesets?
> The configuration hasn't been changed in ages and when I need to
> upgrade the ports of a couple of jails which are NOT routed to the
> internet I simply un-comment few NAT lines and reload the pf conf. I've=

> been doing this specific action for almost 7 years, never a problem.
> Therefore there is no problem in the rules.
>
> For previous ruleset I mean that since the jails start losing
> connectivity (as long as I "push" the new ruleset) with internet and
> with each other, I re-comment these lines and reload. Sometime it works=

> sometime it doesn't and I need to:
>
> service pf restart
>
> which obviously forces me to re-login.
>
>>> I've been trying to find the root cause of this without success.
>>> Did I
>>> miss some major change on the PF port on FreeBSD? I've never seen
>>> this
>>> serious issue before nor on FreeBSD neither on OpenBSD.
>>
>> It=E2=80=99s very difficult to debug this with the extremely limited
>> information you=E2=80=99ve included.
>> Please post, at the very least, your pf ruleset and a full
>> description
>> of what you=E2=80=99re doing when things break and how you recover.
> #nat on $ext_if from $SRV01 to any -> ($ext_if:0)
> #nat on $ext_if from $SRV02 to any -> ($ext_if:0)
> #nat on $ext_if from $SRV03 to any -> ($ext_if:0)
>
> not much really. But the same happens with other rules. Basically
> whatever I modify there now requires a full pf restart, which is not
> very practical as it kicks me out.
>
> I'm also having plenty of issues using fail2ban, just to mention
> another as it is somehow related (even though a broader topic), where
> rules are in place but aren't enforced.
>
> # pfctl -a f2b/asterisk-udp -t f2b-asterisk-udp -Ts
>    <offending ip address>
>    <offending ip address>
>    <offending ip address>
>
> # pfctl -a f2b/asterisk-udp -t f2b-asterisk-udp -s rules
> block drop quick proto udp from <f2b-asterisk-udp> to any port =3D sip
> block drop quick proto udp from <f2b-asterisk-udp> to any port =3D sip-=
tls
>
> then killing the state (if any) and check:
> # pfctl -k <offending ip address> ; tcpdump udp -nettt -i pflog0 port 5=
060 and host <offending ip address>
> killed 1 states from 1 sources and 0 destinations
> tcpdump: verbose output suppressed, use -v or -vv for full protocol dec=
ode
> listening on pflog0, link-type PFLOG (OpenBSD pflog file), capture size=
 262144 bytes
>  00:00:00.000000 rule 24/0(match): pass in on lagg0: <offending ip addr=
ess>.6175 > <target ip address>.5060: SIP: REGISTER sip:<target ip addres=
s> SIP/2.0
>  00:01:07.344401 rule 24/0(match): pass in on lagg0: <offending ip addr=
ess>.6115 > <target ip address>.5060: SIP: REGISTER sip:<target ip addres=
s> SIP/2.0
>  00:00:39.690851 rule 24/0(match): pass in on lagg0: <offending ip addr=
ess>.6158 > <target ip address>.5060: SIP: REGISTER sip:<target ip addres=
s> SIP/2.0
>  00:00:43.058753 rule 24/0(match): pass in on lagg0: <offending ip addr=
ess>.6179 > <target ip address>.5060: SIP: REGISTER sip:<target ip addres=
s> SIP/2.0
>  00:00:43.912680 rule 24/0(match): pass in on lagg0: <offending ip addr=
ess>.6119 > <target ip address>.5060: SIP: REGISTER sip:<target ip addres=
s> SIP/2.0
>
> it is clearly not enforcing the rules.
>
Please share the full pf.conf. I=E2=80=99m sure you understand that I can=
not debug your problem without *full* information.

Regards,
Kristof
--=_MailMate_FE34E488-BDA5-41DD-90C3-3FDF7F076B91_=
Content-Description: OpenPGP digital signature
Content-Disposition: attachment; filename=signature.asc
Content-Type: application/pgp-signature; name=signature.asc

-----BEGIN PGP SIGNATURE-----
Comment: GPGTools - https://gpgtools.org

iQFDBAEBCAAtFiEEhvumznUbtMyaDlFyb8TccfteSkYFAlxOvUIPHGtwQGZyZWVi
c2Qub3JnAAoJEG/E3HH7XkpGSb0IAIfNcXrzO45toDOjCLG3Zu85AIwmmK030JhF
FhKIvm/vimqX2CSZ0M9s3exAh4ePWsFT8DLVp/f1EpX0p7eOY7S5kuWmwlQPwEJk
o5f9D7H+D4c6fimXcjuSEnm5WPt+deOYjjtgui+FwZYVx3YsBHdD6dPDkTX9sE7H
eYwJUJcojUjiypl/A1PI5TFKcpVYp1EwPdpaWqc0yznvUokMBDye6xp5izO3F3fR
jDUq6Lx5C/pIIQm4UZbs38l3wG+MBc/+5byaah3AYEzedctTufMtaurRpYJCQggl
Zdd49RvFybrSHkpTYsNrhrLbkig35SByoy19uHgVTDYpBWpEpOw=
=rAuy
-----END PGP SIGNATURE-----

--=_MailMate_FE34E488-BDA5-41DD-90C3-3FDF7F076B91_=--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?51F0845A-2BB3-4BC9-977D-BB0E6C305ED3>