From patchwork Fri Jul 5 03:31:00 2019 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: 2339 Return-Path: Received: from mail01.ipfire.org (mail01.i.ipfire.org [172.28.1.200]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mail01.ipfire.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by web07.i.ipfire.org (Postfix) with ESMTPS id A0F9D887E52 for ; Thu, 4 Jul 2019 18:31:48 +0100 (BST) Received: from mail01.i.ipfire.org (localhost [IPv6:::1]) by mail01.ipfire.org (Postfix) with ESMTP id 45flQW5dn9z5VQ9H; Thu, 4 Jul 2019 18:31:47 +0100 (BST) Received: from [127.0.0.1] (tor.piratenpartei-nrw.de [IPv6:2001:4ba0:fff9:160:dead:beef:ca1f:1337]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mail01.ipfire.org (Postfix) with ESMTPSA id 45flQS0trnz5VQ8T for ; Thu, 4 Jul 2019 18:31:43 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ipfire.org; s=201904rsa; t=1562261504; 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=Vgc0nfAjOLdXV7CUWoLYh8K/MUhN0uSs4jIP6B/0iQ8=; b=lPu+UYeRjUSEkD3+gdyk3vRv/gcLdI4RsImCBYrLvQSbZCoiHNAYtJ34irfq49j3IeTzOL 4rU8mztDAaUa8pjPYKfEkemmhBPpAAuU9zt/wtR4o3s55Mb/KV2AtySOvIEip85Ub8nJgw M4F4wzdgNVDOtVrynBA4pywHcstswM3/WSfPeboVrklKuVfS4jhxHRw0p/yd2Fy9n2mvQ9 URxOANkBJVjGqWqnaV/h9zfCilmVl+YF794TKjj+4crNX/Z980l/90Sg+GRJYmPEflVnsP fJRQP0jO3jmydmXdiqutxvzemXcsbkSgkdvDjwhnp02HG41EMmWWnu1fVE8LnA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=ipfire.org; s=201904ed25519; t=1562261504; 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=Vgc0nfAjOLdXV7CUWoLYh8K/MUhN0uSs4jIP6B/0iQ8=; b=AgGNY6CUH2FkJKzOJ3kqPe9Lv8f35EtAi+pyZfh0UHIst1foodCMCCnRCRMy3HHoJbpAF6 ZI96iYe7eNcmaQBw== To: "IPFire: Development-List" From: =?utf-8?q?Peter_M=C3=BCller?= Subject: [PATCH] drop excessive ICMP ping traffic to the firewall Organization: IPFire.org Message-ID: Date: Thu, 04 Jul 2019 17:31:00 +0000 MIME-Version: 1.0 Content-Language: en-US Authentication-Results: mail01.ipfire.org; auth=pass smtp.auth=pmueller smtp.mailfrom=peter.mueller@ipfire.org X-BeenThere: development@lists.ipfire.org X-Mailman-Version: 2.1.15 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" pings are replied to for diagnostic reasons only. As unlimited response generation may open up a (D)DoS attack surface for both external and internal networks, dropping excessive traffic is reasonable. Signed-off-by: Peter Müller --- src/initscripts/system/firewall | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/initscripts/system/firewall b/src/initscripts/system/firewall index b3483a744..622d7de4e 100644 --- a/src/initscripts/system/firewall +++ b/src/initscripts/system/firewall @@ -214,10 +214,12 @@ iptables_init() { iptables -N IPTVFORWARD iptables -A FORWARD -j IPTVFORWARD - # Allow to ping the firewall. + # Allow non-excessive pings to the firewall iptables -N ICMPINPUT iptables -A INPUT -j ICMPINPUT - iptables -A ICMPINPUT -p icmp --icmp-type 8 -j ACCEPT + iptables -A ICMPINPUT -p icmp --icmp-type 8 -m limit --limit 100/second -j ACCEPT + iptables -A ICMPINPUT -p icmp --icmp-type 8 -m limit --limit 10/minute -j LOG --log-prefix "DROP_PINGFLOOD " -m comment --comment "DROP ping flood" + iptables -A ICMPINPUT -p icmp --icmp-type 8 -j DROP # Accept everything on loopback iptables -N LOOPBACK