From patchwork Wed Mar 20 14:43:27 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adolf Belka X-Patchwork-Id: 7648 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) server-digest SHA384 client-signature ECDSA (secp384r1) client-digest SHA384) (Client CN "mail01.haj.ipfire.org", Issuer "R3" (verified OK)) by web04.haj.ipfire.org (Postfix) with ESMTPS id 4V0BD96SDtz3wkd for ; Wed, 20 Mar 2024 14:43:37 +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) server-digest SHA384 client-signature ECDSA (secp384r1) client-digest SHA384) (Client CN "mail02.haj.ipfire.org", Issuer "R3" (verified OK)) by mail01.ipfire.org (Postfix) with ESMTPS id 4V0BD80SyQzXY; Wed, 20 Mar 2024 14:43:36 +0000 (UTC) Received: from mail02.haj.ipfire.org (localhost [127.0.0.1]) by mail02.haj.ipfire.org (Postfix) with ESMTP id 4V0BD75fPMz32tY; Wed, 20 Mar 2024 14:43:35 +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) server-digest SHA384 client-signature ECDSA (secp384r1) client-digest SHA384) (Client CN "mail01.haj.ipfire.org", Issuer "R3" (verified OK)) by mail02.haj.ipfire.org (Postfix) with ESMTPS id 4V0BD61M7Vz300c for ; Wed, 20 Mar 2024 14:43:34 +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 4V0BD54r1xz7g; Wed, 20 Mar 2024 14:43:33 +0000 (UTC) DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=ipfire.org; s=202003ed25519; t=1710945813; 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; bh=d2fILUq/rqJdCqLg/a2snYnRav/aLurQtkRUTzSBkig=; b=uPzJu5ABwMNFJdYYBOXWOQpgJzn4dM6h9Ej/mGn76mgjRSiCruVB5DozUHX0xWgWOZmahi iDK3H5uzp/ZzDaDw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ipfire.org; s=202003rsa; t=1710945813; 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; bh=d2fILUq/rqJdCqLg/a2snYnRav/aLurQtkRUTzSBkig=; b=CCfaJBjI1LBC1r3wECIxEvUMKJODUDFKg9MZR+c9b7Nph4wgecHFeFvryxfC7fhFocxyo+ 4tesZyljvMZrLZIOOaKwqYEp0NNc2QFWhVxEF6HHAhuUaNc7Gz2qHJGwwnxy9WBbMnYUq3 zCVN8fWCr1SoNwVEQ1J6qXbYXHpiwSr0JgI+MgOQk9TBVxTR9L9UIQ/2DFtvWVKucNiY51 xBkUYzUpvxcwa8wixiXaEspuGSA36yAF9o9hF7HoTfCeeF/el0eudnNdIppR821zPS9Nl2 tn505dOvVztAzKcN75r960asO5hY/53u0cMDOeSpot8l2DyUlgLWU8fc+mNeYQ== From: Adolf Belka To: development@lists.ipfire.org Subject: [PATCH] CU185-update.sh: Add drop hostile in & out logging entries if not already present Date: Wed, 20 Mar 2024 15:43:27 +0100 Message-ID: <20240320144327.6050-1-adolf.belka@ipfire.org> MIME-Version: 1.0 Message-ID-Hash: 2JKZS4SNPT5TBH7YWBGW6KZSVRGSY66H X-Message-ID-Hash: 2JKZS4SNPT5TBH7YWBGW6KZSVRGSY66H 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: - This patch ensures that those people who updated to CU184 before the CU184-update.sh patch fix to add the logging entries was added will get their optionsfw settings file correctly updated with CU185 - This only adds the LOGDROPHOSTILEIN & LOGDROPHOSTILEOUT entries if they do noit already exist in the optionsfw settings file. Tested-by: Adolf Belka Signed-off-by: Adolf Belka --- config/rootfiles/core/185/update.sh | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/config/rootfiles/core/185/update.sh b/config/rootfiles/core/185/update.sh index 2c95c4102..ec4d8ab82 100644 --- a/config/rootfiles/core/185/update.sh +++ b/config/rootfiles/core/185/update.sh @@ -115,6 +115,15 @@ mv /var/ipfire/ovpn/ovpnconfig.new /var/ipfire/ovpn/ovpnconfig # Set correct ownership chown nobody:nobody /var/ipfire/ovpn/ovpnconfig +# Check if the drop hostile in and out logging options need to be added +# into the optionsfw settings file and apply to firewall +if ! [ $(grep "LOGDROPHOSTILEIN=on" /var/ipfire/optionsfw/settings) ] && \ + ! [ $(grep "LOGDROPHOSTILEOUT=on" /var/ipfire/optionsfw/settings) ]; then + sed -i '$ a\LOGDROPHOSTILEIN=on' /var/ipfire/optionsfw/settings + sed -i '$ a\LOGDROPHOSTILEOUT=on' /var/ipfire/optionsfw/settings + /usr/local/bin/firewallctrl +fi + # Rebuild initial ramdisks dracut --regenerate-all --force KVER="xxxKVERxxx"