From patchwork Thu Jun 30 10:15:54 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robin Roevens X-Patchwork-Id: 5710 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) server-digest SHA384 client-signature ECDSA (P-384) client-digest SHA384) (Client CN "mail01.haj.ipfire.org", Issuer "R3" (verified OK)) by web04.haj.ipfire.org (Postfix) with ESMTPS id 4LYZ4V1KPwz40TL for ; Thu, 30 Jun 2022 10:16:42 +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 4LYZ4S0TJXz1YW; Thu, 30 Jun 2022 10:16:40 +0000 (UTC) Received: from mail02.haj.ipfire.org (localhost [127.0.0.1]) by mail02.haj.ipfire.org (Postfix) with ESMTP id 4LYZ4R5qmBz2yqV; Thu, 30 Jun 2022 10:16:39 +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) server-digest SHA384 client-signature ECDSA (P-384) client-digest SHA384) (Client CN "mail01.haj.ipfire.org", Issuer "R3" (verified OK)) by mail02.haj.ipfire.org (Postfix) with ESMTPS id 4LYZ4Q03Zkz2xbW for ; Thu, 30 Jun 2022 10:16:37 +0000 (UTC) Received: from knopi.disroot.org (knopi.disroot.org [178.21.23.139]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mail01.ipfire.org (Postfix) with ESMTPS id 4LYZ4P1P19zqL for ; Thu, 30 Jun 2022 10:16:37 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by disroot.org (Postfix) with ESMTP id 8560545A5E for ; Thu, 30 Jun 2022 12:16:36 +0200 (CEST) X-Virus-Scanned: SPAM Filter at disroot.org Received: from knopi.disroot.org ([127.0.0.1]) by localhost (disroot.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id wcLfxVyHmk80 for ; Thu, 30 Jun 2022 12:16:35 +0200 (CEST) Received: from chojin.sicho.home (amaterasu.sicho.home [192.168.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (no client certificate requested) (Authenticated sender) by hachiman (MailScanner Milter) with SMTP id 7CF624B9F1; Thu, 30 Jun 2022 12:16:11 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=disroot.org; s=mail; t=1656584195; bh=HP7sLh7TgRc1UGI+4Mn8kj8NWDos3YNmHTSVGqP8RP4=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=ZGZk0wuAsTnA0f29CcjbXDce5UVDOAa4/wDfwCW3h7ysYCmX5xN1RHC3wlfIRBHUH 5ymM0hdVvTRz91E667XXyjMT9iP1sm2x4BwDBfUA/csQkjNWP7PnM/tdSfPLOimhiy mWv7LrPkDnU1DcJ3o+5Wfu+6kDJQMv6A95EDy7kaiddFNqeI+WXsF+34OpaVtAlLvi i7vBHwfGVL6fEe2vlgXZfp78nZadGgvrPjONynsDEOonhSqaXc/7AFLb3eAdkgJjSU 6hu/LuPZ0XjoDxtXMoCDuey6u1hAvz1MEKTP/399ORezZmJom6wPzsidPhP2Em7kbU tQdVD6UeQuvFg== From: Robin Roevens To: development@lists.ipfire.org Subject: [PATCH v5 5/6] zabbix_agentd: By default only listen on GREEN ip Date: Thu, 30 Jun 2022 12:15:54 +0200 Message-Id: <20220630101555.13438-6-robin.roevens@disroot.org> In-Reply-To: <20220630101555.13438-1-robin.roevens@disroot.org> References: <20220630101555.13438-1-robin.roevens@disroot.org> Mime-Version: 1.0 X-sicho-MailScanner-ID: 7CF624B9F1.A8A80 X-sicho-MailScanner: Found to be clean X-sicho-MailScanner-From: robin.roevens@disroot.org X-sicho-MailScanner-Watermark: 1657188971.71752@ATSmDPX4Dv44mQYnlqPcpw ARC-Seal: i=1; s=202003rsa; d=lists.ipfire.org; t=1656584197; a=rsa-sha256; cv=none; b=qrthFk52+FYHZSx+TJ/NPO6kfL/lWWR29wLi41YH+ANmZmkfVMO4th+058zUTqt+f4SCjT tEIFb0eXq5a33sspwoI3wpmUsUQhuJ6GRL7qDGXpACS9kG6IOrxkF0EtKylBjX9piXBAFK QnElpc6WFV2cu1i9hp5HQYnufyb0VD9gDA0r9PJ+8h5bMiaNtUjT1qpnGqQsMWGHSaWuk1 O9ihl8nrW9IFFZQCyu0MT6YUefUmLhG9W2Luoisi4BymzEBQFfJRckyz+x3GSYX2LM/ZpT sg5pCvpnAbaKw2qZElOS4v0Y/608giiVY+zBEljJRg3m/q2MwSnWdJJYOPT96w== ARC-Authentication-Results: i=1; mail01.ipfire.org; dkim=pass header.d=disroot.org header.s=mail header.b=ZGZk0wuA; spf=pass (mail01.ipfire.org: domain of robin.roevens@disroot.org designates 178.21.23.139 as permitted sender) smtp.mailfrom=robin.roevens@disroot.org; dmarc=pass (policy=quarantine) header.from=disroot.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=lists.ipfire.org; s=202003rsa; t=1656584197; 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:dkim-signature; bh=amK3N8RHnEEgYG8VdtR8SbBbYfvOIRMEbsyRkPJ2P8E=; b=Obt3uN55tzCHHh3w7X+2DGhoo2Imrj7/bslhG2lz6OoDtEDigfkH1D407L+EnbTdeAi3YU Q7DrO7jESw6EBdypomDXNQh20JSQYh60jTM6GyzPKHJKzZWIhBem+9Fnb73i/FDEvpP6oz RvPFWR4yzRm8kddTr1dyuN9a1qy99KVMHrHzTVxuwf9nsAwBXdBJcNsqWE+incblfAyMGN juURqOvqO0Z5lsknf3JlLXFoyBxqOu0WM91QO7vR8XepLdrIWIxrnK5LBvul/Q/0e0OCaW KasKl2o0c7+CETmADsPJ1UUeulCbQMv3qDG31tslBuJWCQG3nE4k0bgNvcHoHg== X-Spamd-Result: default: False [-3.80 / 11.00]; BAYES_HAM(-3.00)[99.99%]; MID_CONTAINS_FROM(1.00)[]; NEURAL_HAM(-1.00)[-1.000]; SPF_REPUTATION_HAM(-0.78)[-0.78380299197672]; MV_CASE(0.50)[]; R_MISSING_CHARSET(0.50)[]; DMARC_POLICY_ALLOW(-0.50)[disroot.org,quarantine]; R_SPF_ALLOW(-0.20)[+a]; R_DKIM_ALLOW(-0.20)[disroot.org:s=mail]; MIME_GOOD(-0.10)[text/plain]; MX_GOOD(-0.01)[]; IP_REPUTATION_HAM(-0.01)[asn: 50673(0.00), country: NL(-0.01), ip: 178.21.23.139(0.00)]; ARC_SIGNED(0.00)[lists.ipfire.org:s=202003rsa:i=1]; FROM_EQ_ENVFROM(0.00)[]; RCVD_TLS_LAST(0.00)[]; MIME_TRACE(0.00)[0:+]; FROM_HAS_DN(0.00)[]; DKIM_TRACE(0.00)[disroot.org:+]; TO_DN_SOME(0.00)[]; RCVD_COUNT_THREE(0.00)[4]; PREVIOUSLY_DELIVERED(0.00)[development@lists.ipfire.org]; TO_MATCH_ENVRCPT_SOME(0.00)[]; RCPT_COUNT_TWO(0.00)[2]; ASN(0.00)[asn:50673, ipnet:178.21.23.0/24, country:NL]; ARC_NA(0.00)[] Authentication-Results: mail01.ipfire.org; dkim=pass header.d=disroot.org header.s=mail header.b=ZGZk0wuA; spf=pass (mail01.ipfire.org: domain of robin.roevens@disroot.org designates 178.21.23.139 as permitted sender) smtp.mailfrom=robin.roevens@disroot.org; dmarc=pass (policy=quarantine) header.from=disroot.org X-Rspamd-Queue-Id: 4LYZ4P1P19zqL X-Rspamd-Server: mail01.haj.ipfire.org 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" - Change zabbix_agentd.conf during install to only listen on the GREEN ip by default. Signed-off-by: Robin Roevens --- config/zabbix_agentd/zabbix_agentd.conf | 3 +++ src/paks/zabbix_agentd/install.sh | 10 ++++++++++ 2 files changed, 13 insertions(+) diff --git a/config/zabbix_agentd/zabbix_agentd.conf b/config/zabbix_agentd/zabbix_agentd.conf index e1aafc584..4480e43f2 100644 --- a/config/zabbix_agentd/zabbix_agentd.conf +++ b/config/zabbix_agentd/zabbix_agentd.conf @@ -13,6 +13,9 @@ Server=127.0.0.1 ServerActive=127.0.0.1 +# List of comma delimited IP addresses that the agent should listen on. +ListenIP=GREEN_ADDRESS + # This line activates IPFire specific userparameters. # See IPFire wiki for details. # To deactivate them: Comment this line out. diff --git a/src/paks/zabbix_agentd/install.sh b/src/paks/zabbix_agentd/install.sh index 3ffff10c1..80632d1ec 100644 --- a/src/paks/zabbix_agentd/install.sh +++ b/src/paks/zabbix_agentd/install.sh @@ -77,4 +77,14 @@ if [ $? -eq 1 ]; then echo "Include=/var/ipfire/zabbix_agentd/zabbix_agentd_ipfire_mandatory.conf" >> /etc/zabbix_agentd/zabbix_agentd.conf fi +# By default, only listen on GREEN +( + eval $(/usr/local/bin/readhash /var/ipfire/ethernet/settings) + if [ -n "${GREEN_ADDRESS}" ]; then + sed -i -e "s|ListenIP=GREEN_ADDRESS|ListenIP=${GREEN_ADDRESS}|g" /etc/zabbix_agentd/zabbix_agentd.conf + else + sed -i -e "\|ListenIP=GREEN_ADDRESS|d" /etc/zabbix_agentd/zabbix_agentd.conf + fi +) || : + start_service --background ${NAME}