From patchwork Tue Dec 26 19:46:23 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adolf Belka X-Patchwork-Id: 7416 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 (secp384r1) client-signature ECDSA (secp384r1)) (Client CN "mail01.haj.ipfire.org", Issuer "R3" (verified OK)) by web04.haj.ipfire.org (Postfix) with ESMTPS id 4T04z80c40z3wlw for ; Tue, 26 Dec 2023 19:46:44 +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 (secp384r1) client-signature ECDSA (secp384r1)) (Client CN "mail02.haj.ipfire.org", Issuer "R3" (verified OK)) by mail01.ipfire.org (Postfix) with ESMTPS id 4T04z20XTfzqZ; Tue, 26 Dec 2023 19:46:38 +0000 (UTC) Received: from mail02.haj.ipfire.org (localhost [127.0.0.1]) by mail02.haj.ipfire.org (Postfix) with ESMTP id 4T04z15Qrbz30SJ; Tue, 26 Dec 2023 19:46:37 +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 (secp384r1) client-signature ECDSA (secp384r1)) (Client CN "mail01.haj.ipfire.org", Issuer "R3" (verified OK)) by mail02.haj.ipfire.org (Postfix) with ESMTPS id 4T04yx0k4Qz32cc for ; Tue, 26 Dec 2023 19:46:33 +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 (secp384r1) server-digest SHA384) (No client certificate requested) by mail01.ipfire.org (Postfix) with ESMTPSA id 4T04yw59BfzB5; Tue, 26 Dec 2023 19:46:32 +0000 (UTC) DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=ipfire.org; s=202003ed25519; t=1703619992; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=zCw49O5t9V2LOIqMmgrBTcO2r91b9MdoC6euxPj3yUU=; b=oUbmTyD6aFFj5uLgONGnb1asGocsjU777cs/vGw+x8rFwXMFRqSvmn56dkVkUUT3nWliJZ XQlz90zoWgVmyEAw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ipfire.org; s=202003rsa; t=1703619992; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=zCw49O5t9V2LOIqMmgrBTcO2r91b9MdoC6euxPj3yUU=; b=PxAF6pfQTi5dkPbODqWd8Gm6hbhh6TvApMkhuvlrUqQv73W/y79N7cT9MfLw5S4Acix5TI qkgpRhzmFbLoFX6hjzAJrffSCUYcZs0zAVsnJOg6nAtF7ASL/Y0okDivXQGDpfIBoqrwlx 85qKGOhGNfXV8ImuZzN5wmtbv4uvCR1xbwrQSpppDRbMeaTGos+qCInAdMQl/Kal1H3QqS C/wMJ/kwBseaQLwRLuIvttbqY9vFH2qbJdfxB7eH+4eYZmZccLxG651bivit2QJBnZu1hS 7KW0x2tXEQeLLTUBmBVBdn5dRVhoD2D9Scl5B9YpwYYVifU8D+6wlhAiiuG+IQ== From: Adolf Belka To: development@lists.ipfire.org Subject: [PATCH 2/3] firewall: Fixes bug12981 - add if loop to log or not log dropped hostile traffic Date: Tue, 26 Dec 2023 20:46:23 +0100 Message-ID: <20231226194624.3273192-2-adolf.belka@ipfire.org> In-Reply-To: <20231226194624.3273192-1-adolf.belka@ipfire.org> References: <20231226194624.3273192-1-adolf.belka@ipfire.org> MIME-Version: 1.0 Message-ID-Hash: 2JBKDMLZSUN6PVMYFHAQX6PLZRDB3MBT X-Message-ID-Hash: 2JBKDMLZSUN6PVMYFHAQX6PLZRDB3MBT X-MailFrom: adolf.belka@ipfire.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.8 Precedence: list List-Id: IPFire development talk Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: - Dependent on the choice in optionsfw.cgi this loop will either log or not log the dropped hostile traffic. Fixes: bug12981 Tested-by: Adolf Belka Signed-off-by: Adolf Belka --- src/initscripts/system/firewall | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/initscripts/system/firewall b/src/initscripts/system/firewall index 50f2b3e02..352ae2496 100644 --- a/src/initscripts/system/firewall +++ b/src/initscripts/system/firewall @@ -177,7 +177,9 @@ iptables_init() { iptables -A OUTPUT -j HOSTILE iptables -N HOSTILE_DROP - iptables -A HOSTILE_DROP -m limit --limit 10/second -j LOG --log-prefix "DROP_HOSTILE " + if [ "$LOGDROPHOSTILE" == "on" ]; then + iptables -A HOSTILE_DROP -m limit --limit 10/second -j LOG --log-prefix "DROP_HOSTILE " + fi iptables -A HOSTILE_DROP -j DROP -m comment --comment "DROP_HOSTILE" # IP Address Blocklist chains