From nobody Wed Oct 5 16:41:44 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 4MjL240shsz4V9q8 for ; Wed, 5 Oct 2022 16:41:48 +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 4MjL240B8dz3rHG; Wed, 5 Oct 2022 16:41:48 +0000 (UTC) (envelope-from kp@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1664988108; 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=F7TN8h7gP5E0Ll5E5iEhGNZb9xUvO9Rboas+wOr+pDk=; b=SBea5XZccgm3FifaUsIJSybO7iMbFPzwBY1F34NrLHAbGSJKRYuJrf0Jeg2BmJFtt0oZXC t1UcNIdJemAAAjR0CLGcc8C1JVo2RG9yJQ/XOLZEXmXQlof9vxOPFlgAmPfMBhx3Tyx7ao UedmloJtcQAr+AAclwOx06kXZfaWjSC9jXzl9tFpHfyDTi7prt2m1T2QCLPq/66Mu1zQRy y1VbuyfWN1RdxEXlvmm1+4ikk5uUfmEs6fs7Rlyl0GHr+hONeTHPOjGRDItayTu5j6myrJ L9iXH/BaEfQvXe/CRsXKjnV1BWsqGjOPgT2Vgon0SHj5/LovkaAC+Nky2vDBcw== 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 4MjL235lcbzTR7; Wed, 5 Oct 2022 16:41:47 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: by venus.codepro.be (Postfix, authenticated sender kp) id 65D8670FA; Wed, 5 Oct 2022 18:41:45 +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, 05 Oct 2022 17:41:44 +0100 X-Mailer: MailMate (1.14r5852) Message-ID: <58A14C48-3248-4D41-884C-93190AAFCD2C@FreeBSD.org> 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=1664988108; 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=F7TN8h7gP5E0Ll5E5iEhGNZb9xUvO9Rboas+wOr+pDk=; b=tF2H3jRqfVs7rvNajLuhhWt8SVDT01RdcAuiPiu2B4DH9EUUJU3Zzju3LN0NpG4xDE1TZr VIbV5CnQEZH/PdgViK0tdpO2/khKyOMeOdyQFzx181BNbbOsDj3X4SguXBfCkP1l5jM1IQ istxpRI31IH6aRngUspPsNF/39lajMtwD81KaxO861yaAfJ3uuKaiAmJ6LfKNe1Lii1R59 oSV0AubxZYkoIK8vtwHfir98yzWyRD4jzyzW3UHzG85tphseMPo0ETKjxpUARiyPWcE1Vx H0+6FOJvlWnqA7FUU9OIqvEFdvdS3ZwF7Bev9S5b5XCvxyeao17TPmgG7KW7jg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1664988108; a=rsa-sha256; cv=none; b=DmqnkeAwSAoBKVBl0G1XYJuXOSt7brtc8tTuJlWyNNxGnXydKzbQti+JDX2IVaW2y6bxvJ qQ27x0xc+e9bO5oHbI/iROih70qj3qpj7w5bTcg4q8qfbqumkI0Nv/26uPPXCNTabk592a qE9yQzhlUz0ZVpADLQHhgWNTVG4Irs/x3Or21hdhMo8SrgO4q8u2D860lCN0fQBQDUUtuc ifG5TN4L03Rc1RvBRwCXHs8DkEacCkbSjbPZbHsJrYk86CWonvSCve/lccss4bzkH5xvSz v91nVe4twK9oKMJBzEcXlRt+Cpz9wmzHDiD30ZqG+Hs6ekCNICATm+uxGqIwrA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N On 27 Sep 2022, at 20: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. > I=E2=80=99ve put together a test case for the initial issue: https://revi= ews.freebsd.org/D36886 That=E2=80=99s not ready to go in, because the bug it tests for isn=E2=80= =99t fixed yet. I hope to port the openbsd fix tomorrow, but it=E2=80=99s= the sort of thing that needs an hour or two of concentration, so .. mayb= e, maybe not. Kristof