From patchwork Wed Mar 23 11:18:34 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Peter_M=C3=BCller?= X-Patchwork-Id: 5395 Return-Path: Received: from mail01.ipfire.org (mail01.haj.ipfire.org [172.28.1.202]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) client-signature ECDSA (P-384)) (Client CN "mail01.haj.ipfire.org", Issuer "R3" (verified OK)) by web04.haj.ipfire.org (Postfix) with ESMTPS id 4KNm7k0tNyz3xlr for ; Wed, 23 Mar 2022 11:18:42 +0000 (UTC) Received: from mail02.haj.ipfire.org (mail02.haj.ipfire.org [172.28.1.201]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) client-signature ECDSA (P-384)) (Client CN "mail02.haj.ipfire.org", Issuer "R3" (verified OK)) by mail01.ipfire.org (Postfix) with ESMTPS id 4KNm7g5wHpz1hX; Wed, 23 Mar 2022 11:18:39 +0000 (UTC) Received: from mail02.haj.ipfire.org (localhost [127.0.0.1]) by mail02.haj.ipfire.org (Postfix) with ESMTP id 4KNm7g4s0Fz2yx2; Wed, 23 Mar 2022 11:18:39 +0000 (UTC) Received: from mail01.ipfire.org (mail01.haj.ipfire.org [172.28.1.202]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) client-signature ECDSA (P-384)) (Client CN "mail01.haj.ipfire.org", Issuer "R3" (verified OK)) by mail02.haj.ipfire.org (Postfix) with ESMTPS id 4KNm7f43yCz2xK9 for ; Wed, 23 Mar 2022 11:18:38 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384)) (No client certificate requested) by mail01.ipfire.org (Postfix) with ESMTPSA id 4KNm7d1vcBzW9 for ; Wed, 23 Mar 2022 11:18:36 +0000 (UTC) DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=ipfire.org; s=202003ed25519; t=1648034318; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Oa3ZCNzStOUXH1/G22qMK6fCpCbHUcm7oP99ez2HsW4=; b=NgIwtIcEcYBV/Q+CXpowfAgy+bu8/9pCwFp4npz/+DOeCA6fXhBNJk+iUDqwVxYBfa4dwU VS/was0anCc2mEDA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ipfire.org; s=202003rsa; t=1648034318; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Oa3ZCNzStOUXH1/G22qMK6fCpCbHUcm7oP99ez2HsW4=; b=EEgE9uZ52itFm5NFzOuh7SIDChBGWbtJN4B3ys6jrZGhe9HrmrUZ2t2/zqgSkcfi2YbLw8 dlYJBAbo3LcMr9wnvkMdKyCA6yUXZITnuDlEBuH7kGBYgQVUW7X1TKTa9cpWH/ndeAV3tk l73d1U+ckM9fvkW3+yuXw453P2+6RBFcssDlpXhQ+Z4JYr927Ja1BFYbd7Ue5q8hi/bnCb 3TdpOv1Fx7b17UU7BNcVRTwmtiVK1BWyDds8m8tojJg48pnnELgMWySDAuzqC1rJl2mWJv z5WaY2sVk77CnRoE8nHteaXnCiJZwcLn67fZkf3Hsj6ycrSSDdIZYDPdbk2O3g== Message-ID: Date: Wed, 23 Mar 2022 11:18:34 +0000 MIME-Version: 1.0 Content-Language: en-US To: "IPFire: Development" From: =?utf-8?q?Peter_M=C3=BCller?= Subject: [PATCH] firewall: Fix placement of HOSTILE chains X-BeenThere: development@lists.ipfire.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: IPFire development talk List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: development-bounces@lists.ipfire.org Sender: "Development" They were mistakenly placed after the IPS chains in commit 7b529f5417254c68b6bd33732f30578182893d34, but should be placed after the connection tracking and before the IPS. Fixes: #12815 Signed-off-by: Peter Müller Reviewed-by: Michael Tremer --- src/initscripts/system/firewall | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/initscripts/system/firewall b/src/initscripts/system/firewall index 2a70feac2..2597dae10 100644 --- a/src/initscripts/system/firewall +++ b/src/initscripts/system/firewall @@ -169,6 +169,17 @@ iptables_init() { iptables -t nat -N CUSTOMPOSTROUTING iptables -t nat -A POSTROUTING -j CUSTOMPOSTROUTING + # Chains for networks known as being hostile, posing a technical threat to our users + # (i. e. listed at Spamhaus DROP et al.) + iptables -N HOSTILE + iptables -A INPUT -j HOSTILE + iptables -A FORWARD -j HOSTILE + iptables -A OUTPUT -j HOSTILE + + iptables -N HOSTILE_DROP + iptables -A HOSTILE_DROP -m limit --limit 10/second -j LOG --log-prefix "DROP_HOSTILE " + iptables -A HOSTILE_DROP -j DROP -m comment --comment "DROP_HOSTILE" + # IPS (Guardian) chains iptables -N GUARDIAN iptables -A INPUT -j GUARDIAN @@ -259,17 +270,6 @@ iptables_init() { iptables -A OUTPUT -o "${BLUE_DEV}" -j DHCPBLUEOUTPUT fi - # Chains for networks known as being hostile, posing a technical threat to our users - # (i. e. listed at Spamhaus DROP et al.) - iptables -N HOSTILE - iptables -A INPUT -j HOSTILE - iptables -A FORWARD -j HOSTILE - iptables -A OUTPUT -j HOSTILE - - iptables -N HOSTILE_DROP - iptables -A HOSTILE_DROP -m limit --limit 10/second -j LOG --log-prefix "DROP_HOSTILE " - iptables -A HOSTILE_DROP -j DROP -m comment --comment "DROP_HOSTILE" - # Tor (inbound) iptables -N TOR_INPUT iptables -A INPUT -j TOR_INPUT