From patchwork Tue Nov 3 10:48:09 2020 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: 3625 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 "Let's Encrypt Authority X3" (verified OK)) by web04.haj.ipfire.org (Postfix) with ESMTPS id 4CQRMf0CsVz3why for ; Tue, 3 Nov 2020 10:48:14 +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 "Let's Encrypt Authority X3" (verified OK)) by mail01.ipfire.org (Postfix) with ESMTPS id 4CQRMd1BtTz1Fg; Tue, 3 Nov 2020 10:48:13 +0000 (UTC) Received: from mail02.haj.ipfire.org (localhost [127.0.0.1]) by mail02.haj.ipfire.org (Postfix) with ESMTP id 4CQRMd0DQfz2xrJ; Tue, 3 Nov 2020 10:48:13 +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 "Let's Encrypt Authority X3" (verified OK)) by mail02.haj.ipfire.org (Postfix) with ESMTPS id 4CQRMc3N44z2xjX for ; Tue, 3 Nov 2020 10:48:12 +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) server-digest SHA384) (No client certificate requested) by mail01.ipfire.org (Postfix) with ESMTPSA id 4CQRMb2YhwzTf for ; Tue, 3 Nov 2020 10:48:11 +0000 (UTC) DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=ipfire.org; s=202003ed25519; t=1604400491; 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=hkcStKMzAxUxi+bXB24nR+9psmr3nuyW5TawDOr29Js=; b=JeQx81J6ov9NN8UXP4yKRN8eUcegSpyjtO8IbRoocl7cuILQtgHrY6gmAgkGH/2Q7tuZsd FLHWY530zN5GoDCg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ipfire.org; s=202003rsa; t=1604400491; 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=hkcStKMzAxUxi+bXB24nR+9psmr3nuyW5TawDOr29Js=; b=IRoPGAs4+yiCGWmW5JqewUTb3EAjEP3TZzzGpZFMgqfnsV+JlbLF+RzxZ+U3AkhOpk63RU q5BMp1PvsjLZA/NXkkBtT+rJFI9cCzmABjGe1Z0QkdLg0E8f/Nv5dAQ209iTOLrRTISOfI uWsaJTx6gRuwHWHmAxMTIhM5LFig3CsOBBe++yu8slRx2a1nNNBnZ/99C7B1Kr/AaAJFFL ALrgoY/VAN91uqncin56Di9VQHt4xWAXnFWorv0qFm7pkXkpUx3AOMUrfBNR3Slzrsf+be pNEbsoSNHvK79Ay859hi281FLlMXtHulyHff31qsMJhhXTTyYXIQc8azfAIDVg== To: "IPFire: Development-List" From: =?utf-8?q?Peter_M=C3=BCller?= Subject: [PATCH] rules.pl: apply location filter to ppp0 if configured Message-ID: <06d3845b-348d-ca6b-d1cf-a12157e85bae@ipfire.org> Date: Tue, 3 Nov 2020 11:48:09 +0100 MIME-Version: 1.0 Content-Language: en-US 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" In order to prevent collateral damage to internal traffic, commit c69c820025c21713cdb77eae3dd4fa61ca71b5fb introduced applying location block on red0 as a sanity check. On systems configured to use PPPoE, however, traffic appears on the ppp0 interface instead. This patch checks if a system is configured to use this connection method, and applies the location filter to this interface. red0 is used otherwise. Fixes: #12519 Cc: Michael Tremer Signed-off-by: Peter Müller --- config/firewall/rules.pl | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/config/firewall/rules.pl b/config/firewall/rules.pl index c2641a92d..bc6187052 100644 --- a/config/firewall/rules.pl +++ b/config/firewall/rules.pl @@ -2,7 +2,7 @@ ############################################################################### # # # IPFire.org - A linux based firewall # -# Copyright (C) 2007-2019 IPFire Team # +# Copyright (C) 2007-2020 IPFire Team # # # # This program is free software: you can redistribute it and/or modify # # it under the terms of the GNU General Public License as published by # @@ -628,8 +628,11 @@ sub locationblock { return; } - # Only check the RED interface - if ($defaultNetworks{'RED_DEV'} ne "") { + # Only check the RED interface, which is ppp0 in case of RED_TYPE being + # set to "PPPOE", and red0 in case of RED_TYPE not being empty otherwise. + if ($defaultNetworks{'RED_TYPE'} eq "PPPOE") { + run("$IPTABLES -A LOCATIONBLOCK ! -i ppp0 -j RETURN"); + } elsif ($defaultNetworks{'RED_DEV'} ne "") { run("$IPTABLES -A LOCATIONBLOCK ! -i $defaultNetworks{'RED_DEV'} -j RETURN"); }