From patchwork Wed Feb 9 23:26:30 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robin Roevens X-Patchwork-Id: 5139 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 4JvGNr1JVWz3xfS for ; Wed, 9 Feb 2022 23:31:40 +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 4JvGNk0qzhz3vg; Wed, 9 Feb 2022 23:31:34 +0000 (UTC) Received: from mail02.haj.ipfire.org (localhost [127.0.0.1]) by mail02.haj.ipfire.org (Postfix) with ESMTP id 4JvGNk04TTz2yDs; Wed, 9 Feb 2022 23:31:34 +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 4JvGNf5PtKz32JT for ; Wed, 9 Feb 2022 23:31:30 +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 4JvGNf4pW0z3L8 for ; Wed, 9 Feb 2022 23:31:30 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by disroot.org (Postfix) with ESMTP id 7614A8DC81 for ; Thu, 10 Feb 2022 00:31:30 +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 HSglLlREiRxU for ; Thu, 10 Feb 2022 00:31:29 +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 5F46BEF70; Thu, 10 Feb 2022 00:30:53 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=disroot.org; s=mail; t=1644449484; bh=s95tffZChrjXlE2Y90YPtkG3fsm5x5NWl2yfb2AEkUg=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=Y0pMaUsdi4Pd1Nl1U4T4daa7B7jqRZyAriCb7hb0sI9leHXPtPscnQVNUjYBU1et0 UmTUfUeG3YRSzvj/NqfUuaKlA/VA5/zXqhBc3vTPwN3ky8P+quOLqYI6IG4WZrKrzu GzmofAjGoryT36TGmtwe2y0yWKGpAJK5E/r8xTqwQA4qIL5pd1hwmbc2C1CX+zJu7+ RePqeQQwGSMQWxITc/zgEgcV6YjGnGzkkMudH4/seoOYd02PgKKASXPT3ychxnXQvb rCzYvS/POPhw7RoYr+1+2AKNZC465AraTYaXhHN+tRJsCJ+2hW55r7pWh1Z31aym4V otbVeVnXQL8IA== From: Robin Roevens To: development@lists.ipfire.org Subject: [PATCH v3 4/5] zabbix_agentd: By default only listen on GREEN ip Date: Thu, 10 Feb 2022 00:26:30 +0100 Message-Id: <20220209232631.14673-5-robin.roevens@disroot.org> In-Reply-To: <20220209232631.14673-1-robin.roevens@disroot.org> References: <20220209232631.14673-1-robin.roevens@disroot.org> Mime-Version: 1.0 X-sicho-MailScanner-ID: 5F46BEF70.A8A80 X-sicho-MailScanner: Found to be clean X-sicho-MailScanner-From: robin.roevens@disroot.org X-sicho-MailScanner-Watermark: 1645054254.14509@5Of5NKpRhyh0uqmCYTXcbA ARC-Seal: i=1; s=202003rsa; d=lists.ipfire.org; t=1644449490; a=rsa-sha256; cv=none; b=cp2cQ2J4JH7MmdDP1Y75Vw3/aLlGn5SinV/0z4wLtU0fs7w28xN6RsGvgsaQMbqWvZndZC hV6TIXgVrsalZj77ODlz7v5kjYRcSMiyKzSwlhHUP1GDbCQJSwwZHhCCBnpQINe+/ObyGq LkNBeAxNTSHBKtVxazDQE+wxipO2ywNy9Wvl/ZhwtJ5IHjatLT72K9PLOQHzJ8hrnLeRgT D4v+tRADqByU91UBMOioPZhwCALyIroTRGwbi8+9eOHoS5Z43gIniO+C/9ghul+jhRuPGH wfeqQ7QcqEhZSPZF9YD8DOBWhEVNQl8pGB5Wi9hQNLhkm4SkLeAJwP2ygMXQ5A== ARC-Authentication-Results: i=1; mail01.ipfire.org; dkim=pass header.d=disroot.org header.s=mail header.b=Y0pMaUsd; 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=1644449490; 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=Yfb3Up166YrAfsTCagqMF6OahJsRbDph+Aa176amJQw=; b=htRXPURj/Tqk+4DsyqIMygmFkyB5xj9byIQc951r8BjYhJZQ3SV8paggQrmFgsJylg+K7/ yfAg8FvqWXsxn+2uJWTbccbV5dBj//nAi+lfcCNqFXV5S4qrMd5NkUgLD7AcU+f+Sunck0 PneL408aUCJo9Cw8hYXX+mc8AkSFHoppQpknjmRj1qUWbv1wOGJg7CcYK0NH5RmskoFfng bqW6j00j0c36wbIbaqmgCa+X4tDn4RLYwMnQN0ohYwqj266kkANzZ/Ezjb91d6wQK0OsBx fuPY1gpZvDHu3rhqvfTp5eTfZCE7esuAWyuA5xmq2CJP943N/U6ZsXPHqFmTcw== Authentication-Results: mail01.ipfire.org; dkim=pass header.d=disroot.org header.s=mail header.b=Y0pMaUsd; 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-Server: mail01.haj.ipfire.org X-Spamd-Result: default: False [-4.83 / 11.00]; BAYES_HAM(-3.00)[99.99%]; IP_REPUTATION_HAM(-1.12)[asn: 50673(-0.32), country: NL(-0.01), ip: 178.21.23.139(-0.80)]; MID_CONTAINS_FROM(1.00)[]; NEURAL_HAM(-1.00)[-0.997]; SPF_REPUTATION_HAM(-0.70)[-0.70437943086819]; MV_CASE(0.50)[]; R_MISSING_CHARSET(0.50)[]; DMARC_POLICY_ALLOW(-0.50)[disroot.org,quarantine]; R_SPF_ALLOW(-0.20)[+a:c]; R_DKIM_ALLOW(-0.20)[disroot.org:s=mail]; MIME_GOOD(-0.10)[text/plain]; MX_GOOD(-0.01)[]; FROM_EQ_ENVFROM(0.00)[]; ARC_SIGNED(0.00)[lists.ipfire.org:s=202003rsa:i=1]; RCVD_TLS_LAST(0.00)[]; MIME_TRACE(0.00)[0:+]; FROM_HAS_DN(0.00)[]; DKIM_TRACE(0.00)[disroot.org:+]; ASN(0.00)[asn:50673, ipnet:178.21.23.0/24, country:NL]; TO_DN_SOME(0.00)[]; RCPT_COUNT_TWO(0.00)[2]; PREVIOUSLY_DELIVERED(0.00)[development@lists.ipfire.org]; TO_MATCH_ENVRCPT_SOME(0.00)[]; RCVD_COUNT_THREE(0.00)[4]; ARC_NA(0.00)[] X-Rspamd-Queue-Id: 4JvGNf4pW0z3L8 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 | 2 ++ src/paks/zabbix_agentd/install.sh | 10 ++++++++++ 2 files changed, 12 insertions(+) diff --git a/config/zabbix_agentd/zabbix_agentd.conf b/config/zabbix_agentd/zabbix_agentd.conf index aa8b899dc..5eea7d4b5 100644 --- a/config/zabbix_agentd/zabbix_agentd.conf +++ b/config/zabbix_agentd/zabbix_agentd.conf @@ -132,6 +132,8 @@ Server=127.0.0.1 # Default: # ListenIP=0.0.0.0 +ListenIP=GREEN_ADDRESS + ### Option: StartAgents # Number of pre-forked instances of zabbix_agentd that process passive checks. # If set to 0, disables passive checks and the agent will not listen on any TCP port. diff --git a/src/paks/zabbix_agentd/install.sh b/src/paks/zabbix_agentd/install.sh index 4ef4b5be6..f7218a603 100644 --- a/src/paks/zabbix_agentd/install.sh +++ b/src/paks/zabbix_agentd/install.sh @@ -62,6 +62,16 @@ ln -sf ../init.d/zabbix_agentd /etc/rc.d/rc6.d/K02zabbix_agentd restore_backup ${NAME} +# 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.ipfirenew + else + sed -i -e "\|ListenIP=GREEN_ADDRESS|d" /etc/zabbix_agentd/zabbix_agentd.conf.ipfirenew + fi +) || : + # Put zabbix configfiles in place setup_configfile /etc/zabbix_agentd/zabbix_agentd.conf setup_configfile /etc/sudoers.d/zabbix