From owner-freebsd-questions@freebsd.org Mon Jan 28 08:28:54 2019 Return-Path: Delivered-To: freebsd-questions@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C05D214AB3E5 for ; Mon, 28 Jan 2019 08:28:54 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 63F1C77CF1; Mon, 28 Jan 2019 08:28:54 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from venus.codepro.be (venus.codepro.be [5.9.86.228]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "smtp.codepro.be", Issuer "Let's Encrypt Authority X3" (verified OK)) (Authenticated sender: kp) by smtp.freebsd.org (Postfix) with ESMTPSA id 102DA3390; Mon, 28 Jan 2019 08:28:54 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from [192.168.228.1] (ptr-8rh08k11t7godspjqtj.18120a2.ip6.access.telenet.be [IPv6:2a02:1811:240e:402:c448:435:691e:8787]) (Authenticated sender: kp) by venus.codepro.be (Postfix) with ESMTPSA id 61578DF59; Mon, 28 Jan 2019 09:28:52 +0100 (CET) From: "Kristof Provost" To: ASV Cc: "questions list" Subject: Re: PF issue since 11.2-RELEASE Date: Mon, 28 Jan 2019 09:28:50 +0100 X-Mailer: MailMate (2.0BETAr6135) Message-ID: <51F0845A-2BB3-4BC9-977D-BB0E6C305ED3@FreeBSD.org> In-Reply-To: References: <989e79372513e9769c6857b531f14df8ce0b6f3a.camel@inhio.net> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=_MailMate_FE34E488-BDA5-41DD-90C3-3FDF7F076B91_="; micalg=pgp-sha256; protocol="application/pgp-signature" X-Rspamd-Queue-Id: 63F1C77CF1 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.98 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.98)[-0.981,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Jan 2019 08:28:55 -0000 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 > > > > > # pfctl -a f2b/asterisk-udp -t f2b-asterisk-udp -s rules > block drop quick proto udp from to any port =3D sip > block drop quick proto udp from to any port =3D sip-= tls > > then killing the state (if any) and check: > # pfctl -k ; tcpdump udp -nettt -i pflog0 port 5= 060 and host > 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: .6175 > .5060: SIP: REGISTER sip: SIP/2.0 > 00:01:07.344401 rule 24/0(match): pass in on lagg0: .6115 > .5060: SIP: REGISTER sip: SIP/2.0 > 00:00:39.690851 rule 24/0(match): pass in on lagg0: .6158 > .5060: SIP: REGISTER sip: SIP/2.0 > 00:00:43.058753 rule 24/0(match): pass in on lagg0: .6179 > .5060: SIP: REGISTER sip: SIP/2.0 > 00:00:43.912680 rule 24/0(match): pass in on lagg0: .6119 > .5060: SIP: REGISTER sip: 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_=--