From nobody Wed Sep 28 09:44:25 2022 X-Original-To: freebsd-pf@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Mcs5m6MYgz4dRtq for ; Wed, 28 Sep 2022 09:44:28 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Mcs5m5rgfz49F3; Wed, 28 Sep 2022 09:44:28 +0000 (UTC) (envelope-from kp@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1664358268; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=jZeWS3UWzGwu60Y0N7GMSH+83ZT6sD+HWgd6QXq17z8=; b=HvNu+QvuoliYHHH5x5lTwIa4ZsWrj1DFGsTVINJdlMoG5vkSQiZzMERzTX+RMVaO64ZT2W Jy+XxoDlSzJyONdFkqnedpWcO9ZuSc40Z+59OFQnpKr7WJyOnWKVZGMp8OEM3BsvgDqe1G zpu6QQvwML53Mddyxt1l/4YJGkwX6sv3ncDflGeHc3AuxkFcvKr6ADqyOQ7ULVDOywpige H+iqReMVeMYPWCa9dcAzlQN5z/VsTCU0YxvK8icSArUDzGftK3r9AP+42eeADhn5ukD+/x BfTPowxNDtUevsyqlaOFGtumQ3pB4v86PJE0LFlh12WISc7EDcc+yWPWBPOBUA== Received: from venus.codepro.be (venus.codepro.be [5.9.86.228]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "mx1.codepro.be", Issuer "R3" (verified OK)) (Authenticated sender: kp) by smtp.freebsd.org (Postfix) with ESMTPSA id 4Mcs5m4C2SzrD0; Wed, 28 Sep 2022 09:44:28 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: by venus.codepro.be (Postfix, authenticated sender kp) id 5EF6832F6B; Wed, 28 Sep 2022 11:44:26 +0200 (CEST) From: Kristof Provost To: "Lyndon Nerenberg (VE7TFX/VE6BBM)" Cc: FreeBSD pf , Eirik =?utf-8?q?=C3=98verby?= Subject: Re: RFC: enabling pf syncookies by default Date: Wed, 28 Sep 2022 11:44:25 +0200 X-Mailer: MailMate (1.14r5852) Message-ID: In-Reply-To: References: List-Id: Technical discussion and general questions about packet filter (pf) List-Archive: https://lists.freebsd.org/archives/freebsd-pf List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-pf@freebsd.org X-BeenThere: freebsd-pf@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1664358268; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=jZeWS3UWzGwu60Y0N7GMSH+83ZT6sD+HWgd6QXq17z8=; b=EXmyVf43A2Awh36tXDYaZjx/rWWZi9G3MLZDHPw/20eM/zeUftQrPUcf/Tf+0JeFAzdyc1 3aG/hoMQI27AQkgY6Yua6cC5oO4xBp/NEK2jo1vm8003gAnENmoCaF0Fsi+uIuIHHFzB1+ M76aby0PZ/rlcxmDi38JRh5MN5yFbbkHkjPTjMSszlJpOSlH8Ve32o1d4G7g5qARNlYqaU 8M+uPsGWzjeMhauzgZBceSDBAC18BwO6bxwv2xbH2qU29S5mtQkuYYg04mA1GU2WniFBUg CVVWj9vnAQ9cpUrX2wEggUwQ6kskBLKvvQux8jSi6DxCQS2wc8xV00FGN/GQLw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1664358268; a=rsa-sha256; cv=none; b=ZnVDWHwhzu8QGcEMZMH0v2nMl2TL0g92PWqIYYUjFZHG/U+WhtX1xxm8K9mI5fG2oscD99 f/AofI/NrUKe07oKJdumDxiBBcw5+wS2sZyWZwZViYXvOHBcBPVA8gk+7DIGJdVNIKBOg6 sjpNf79j6JO6odUSnpWpWyHpSNogYl26ikGhwcropJhC7RyS3w3cY9TVEA+e0+W4kAR5H6 bBJmivG36RlPmZSMcN3Yf+iAZ+rAqlRrNI8dq0fmuMgDIEFVvxbG6nbxUZV2VoyRbGecdh sPTx8v1qF9IJMfQ+IkVBQ1ZvlmhadBjixHray9Dy/Gr7o7YmrkpmqBU3foos9g== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N On 27 Sep 2022, at 21:24, Lyndon Nerenberg (VE7TFX/VE6BBM) wrote: > Kristof Provost writes: > >> For those not familiar with it, syncookies are a mechanism to resist s= yn >> flood DoS attacks. They=E2=80=99re enabled by default in the IP stack,= but if >> you=E2=80=99re running pf a syn flood would still exhaust pf=E2=80=99s= state table, >> even if the network stack itself could cope. > > I'm not sure of the lineage of pf's syncookie code in FreeBSD, but > before you do this you should look at the recent set of patches > Henning committed to the OpenBSD -snapshot pf source. > > We found an evil bug lurking in pf where, if a single source address > was recycling source ports fast enough to re-use the same source > addr:port pair while the old connection still had a FINWAIT2 state > table entry, the new connection attempt would get dropped on the > floor. The patch cleaned up most of the problem, but when we > recently put the patched pf into production we were still seeing > dropped connection requests. We haven't been able to specifically > reproduce the problem yet, but if you're front-ending a busy web > site, e.g., I would be wary of enabling syncookies at the moment > until this bug gets stamped out once and for all. > Thanks for this update. Henning told me about the fast re-use issue durin= g EuroBSD, and I had looking at that on my todo list. I=E2=80=99ve not yet heard any reports of similar issues on FreeBSD, but = that doesn=E2=80=99t mean they don=E2=80=99t exist of course. At a minimum I=E2=80=99ll hold off on making this change until I=E2=80=99= ve had a chance to work out if we=E2=80=99re affected by the issue Hennin= g fixed or not. Eirik, do you have instrumentation to work out if this is happening to yo= u? Best regards, Kristof