From patchwork Thu Mar 3 21:02:53 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robin Roevens X-Patchwork-Id: 5310 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 4K8k3j61sVz3xlM for ; Thu, 3 Mar 2022 21:03:29 +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) client-signature ECDSA (P-384)) (Client CN "mail02.haj.ipfire.org", Issuer "R3" (verified OK)) by mail01.ipfire.org (Postfix) with ESMTPS id 4K8k3g03S8z5YD; Thu, 3 Mar 2022 21:03:27 +0000 (UTC) Received: from mail02.haj.ipfire.org (localhost [127.0.0.1]) by mail02.haj.ipfire.org (Postfix) with ESMTP id 4K8k3f2b4bz30D9; Thu, 3 Mar 2022 21:03:26 +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 4K8k3c276qz2xKc for ; Thu, 3 Mar 2022 21:03:24 +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 4K8k3b2cJBz4Ws for ; Thu, 3 Mar 2022 21:03:23 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by disroot.org (Postfix) with ESMTP id E64C58EB9E for ; Thu, 3 Mar 2022 22:03:21 +0100 (CET) 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 xyr1T_KEnLb9 for ; Thu, 3 Mar 2022 22:03:20 +0100 (CET) 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 7FCD1184D4; Thu, 3 Mar 2022 22:03:04 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=disroot.org; s=mail; t=1646341398; bh=cQC4V3V1TDsAk43hYcWt01exRLxSb50KSDBrTC2gT0U=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=TDaMClhr/gd5LGPJOEgstpSpxmEzK2gbI6jsquooQ1oezcMoocAC9G95rqpN37tJp 5UAlxiHgGwY79IjAJKCDfIG+HLsKUe2UTqbiSJyyqldLUgFbvrPdxSSGXRDP20qZhg ml3ct2lP6ks+fuj8BDrxbhjXlODdeWMQ+0U9ds8qjyJ/Z64/S8+LGbKhUE3khiEHvM 2CEQ2Crt4y8wxJI9FPckql5P6/NEiz67VToblkTdPP48A+IiTTZ6vY3r3AzYoPK9Rn LVmp/CgGsEAtuXLrYLbU1eQgYsxH1ZvwQIv0vGVXo+B3+ODhk/YkgkY5KY8uJvUk3Q E25fcexi+5gQA== From: Robin Roevens To: development@lists.ipfire.org Subject: [PATCH v4 5/6] zabbix_agentd: By default only listen on GREEN ip Date: Thu, 3 Mar 2022 22:02:53 +0100 Message-Id: <20220303210254.3116-6-robin.roevens@disroot.org> In-Reply-To: <20220303210254.3116-1-robin.roevens@disroot.org> References: <20220303210254.3116-1-robin.roevens@disroot.org> Mime-Version: 1.0 X-sicho-MailScanner-ID: 7FCD1184D4.A8A80 X-sicho-MailScanner: Found to be clean X-sicho-MailScanner-From: robin.roevens@disroot.org X-sicho-MailScanner-Watermark: 1646946187.54148@1BUPTL7rQZGnh/ashdYTlg ARC-Seal: i=1; s=202003rsa; d=lists.ipfire.org; t=1646341403; a=rsa-sha256; cv=none; b=Lmb6ZwIFmAFeOTNWGwjcU4kJieF57M3sgDRCeur+4uROhMhNedtYLl161oBAuO01Jek0WS VXhrHBdahl1arHHDoyBJ5YFslFBRGDykBHdnOehmJb8cpcS5qKqhU6aNgyJep01WWE2CE0 hEFHTEH2hqu+0oPIyOm7cc1ou590nz0SuFgu2JvJQO5PpKsx3K3qcaOo3br7QgHm4mYcRP udejmDDkliY3TfnZKasuSzqPsjdl4W93b2Bl6/zxbDOe7+VHVNiawLLe5cynlg8wVqhU0Z 5EGz7nW6gBd9R+5KWaAPQaWfAMqelK/p3B584X37L5CnfE6j2P+hfsNPGYzXSw== ARC-Authentication-Results: i=1; mail01.ipfire.org; dkim=pass header.d=disroot.org header.s=mail header.b=TDaMClhr; dmarc=pass (policy=quarantine) header.from=disroot.org; 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 ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=lists.ipfire.org; s=202003rsa; t=1646341403; 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=SyKQN+TwePlHLe3ag96QxDb1lHLpB8Hk+XRa+HBpMMY=; b=fFi7Q+5H23+DZmcBjF0BSdB7MrH5YCMGvgKVA1krhABLJto54wxJZYmUdhF912JL9Hh5lJ sIl7y/STGZN5T2tn7ouhhzbqv2A+Zrz3xF2gUhR0mn6QHXsiivjsIBL3sWROx9tZGdIJzn pdlN1WZCDZaJtYaEp2+B9d9R7nIZYwH1Jom87ozLkPImkWrPXV0sUSRFkeFg9+yiFTOLmw FX41Y1BW4x8D9xQV/ntRBh1SfOhG1TBiqBhXssvqG6tp0Stt3CFs5zJmFC98NHU4HFKxps VVYMoEFT8Oitwi0zqoFlYdiO0N3sST1MfU/doEfQzCLAGyeV+FS0HF7O9NAqCQ== Authentication-Results: mail01.ipfire.org; dkim=pass header.d=disroot.org header.s=mail header.b=TDaMClhr; dmarc=pass (policy=quarantine) header.from=disroot.org; 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 X-Rspamd-Server: mail01.haj.ipfire.org X-Spamd-Result: default: False [-4.81 / 11.00]; BAYES_HAM(-3.00)[99.99%]; IP_REPUTATION_HAM(-1.16)[asn: 50673(-0.33), country: NL(-0.01), ip: 178.21.23.139(-0.82)]; MID_CONTAINS_FROM(1.00)[]; NEURAL_HAM(-0.99)[-0.986]; SPF_REPUTATION_HAM(-0.65)[-0.6536605255241]; DMARC_POLICY_ALLOW(-0.50)[disroot.org,quarantine]; MV_CASE(0.50)[]; R_MISSING_CHARSET(0.50)[]; 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)[]; ASN(0.00)[asn:50673, ipnet:178.21.23.0/24, country:NL]; FROM_EQ_ENVFROM(0.00)[]; ARC_SIGNED(0.00)[lists.ipfire.org:s=202003rsa:i=1]; MIME_TRACE(0.00)[0:+]; RCVD_TLS_LAST(0.00)[]; TO_MATCH_ENVRCPT_SOME(0.00)[]; RCVD_COUNT_THREE(0.00)[4]; PREVIOUSLY_DELIVERED(0.00)[development@lists.ipfire.org]; DKIM_TRACE(0.00)[disroot.org:+]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_TWO(0.00)[2]; TO_DN_SOME(0.00)[]; ARC_NA(0.00)[] X-Rspamd-Queue-Id: 4K8k3b2cJBz4Ws 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 76cd87528..a12fe3a60 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. # (DO NOT REMOVE OR ALTER IT as then it will be re-added on next upgrade) diff --git a/src/paks/zabbix_agentd/install.sh b/src/paks/zabbix_agentd/install.sh index d9130dfb4..a64d4c84f 100644 --- a/src/paks/zabbix_agentd/install.sh +++ b/src/paks/zabbix_agentd/install.sh @@ -76,4 +76,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}