From patchwork Tue Mar 7 19:20:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Schantl X-Patchwork-Id: 6674 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 4PWQJr15wMz3wk3 for ; Tue, 7 Mar 2023 19:20: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 (P-384) server-digest SHA384 client-signature ECDSA (P-384) client-digest SHA384) (Client CN "mail02.haj.ipfire.org", Issuer "R3" (verified OK)) by mail01.ipfire.org (Postfix) with ESMTPS id 4PWQJq04kNzyn; Tue, 7 Mar 2023 19:20:42 +0000 (UTC) Received: from mail02.haj.ipfire.org (localhost [127.0.0.1]) by mail02.haj.ipfire.org (Postfix) with ESMTP id 4PWQJp5TQNz2yPS; Tue, 7 Mar 2023 19:20:42 +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 4PWQJn2YvFz2xfn for ; Tue, 7 Mar 2023 19:20:41 +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 4PWQJm1YTpzTh; Tue, 7 Mar 2023 19:20:39 +0000 (UTC) DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=ipfire.org; s=202003ed25519; t=1678216841; 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=bvnsXKUcNjMpjf0cG8hbUMR9lIAStcBRec62SEIaPwo=; b=JJ2YlIbtP2sbess9a+KEAHNEjsqbzUDAKPNVTFWuxSHZCLerkpTqMuWLygsE6TiRrxIfOl fXluxXBMsLFkM9DA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ipfire.org; s=202003rsa; t=1678216841; 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=bvnsXKUcNjMpjf0cG8hbUMR9lIAStcBRec62SEIaPwo=; b=YAxhhadDvEgnOij9mwv5ob0o3efcqSnsarwwxjtJjKTiMkdCqljPjh26MFacwzOMoSFvl+ RTLadbmIAqfSIf4j3DjVlPjksWiRM2VU9oGINHUMqxopJFli+zUKAvN2Qc9o1+R72xt8mi HNgDaDwRKmPPrQvyQNZwjNMKkxrYZPaoDcRfbQfLaitONjIlC5kuOD5zNvcgPVEXKhFM9O 62iHONbxU+GYidNKvmNBpOu40d4BkTBQFF7dqEW9iVup/sNhumLFz3kpdvpg9/mackRNe8 5fGRhRuWi7DHuRWxLJZNrd5tn9SaF9Snl4JfZYEdTmfXKW7hnO0fzu7p0yrFRg== From: Stefan Schantl To: development@lists.ipfire.org Subject: [PATCH] Suricata: Do not use hard-coded red interface name Date: Tue, 7 Mar 2023 20:20:31 +0100 Message-Id: <20230307192031.14650-1-stefan.schantl@ipfire.org> MIME-Version: 1.0 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" Read the correct interface name from the corresponding interface file. Signed-off-by: Stefan Schantl --- src/initscripts/system/suricata | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/initscripts/system/suricata b/src/initscripts/system/suricata index 938ea66de..f2fe21f44 100644 --- a/src/initscripts/system/suricata +++ b/src/initscripts/system/suricata @@ -27,6 +27,8 @@ PATH=/usr/local/sbin:/usr/local/bin:/bin:/usr/bin:/sbin:/usr/sbin; export PATH eval $(/usr/local/bin/readhash /var/ipfire/suricata/settings) eval $(/usr/local/bin/readhash /var/ipfire/ethernet/settings) +IFACE_FILE="/var/ipfire/red/iface" + # Name of the firewall chains. IPS_INPUT_CHAIN="IPS_INPUT" IPS_FORWARD_CHAIN="IPS_FORWARD" @@ -87,8 +89,8 @@ function generate_fw_rules { if [ "${!enable_ids_zone}" == "on" ]; then # Check if the current processed zone is "red" and the configured type is PPPoE dialin. if [ "$zone" == "red" ] && [ "$RED_TYPE" == "PPPOE" ]; then - # Set device name to ppp0. - network_device="ppp0" + # Read the used interface name from the corresponding file. + network_device="$(head -n 1 $IFACE_FILE)" elif [ "$zone" == "ovpn" ]; then # Get all virtual net devices because the RW server and each # N2N connection creates it's own tun device.