From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) by lore.proxmox.com (Postfix) with ESMTPS id 2636E1FF13F for ; Thu, 09 Apr 2026 15:27:19 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id C3229593A; Thu, 9 Apr 2026 15:28:02 +0200 (CEST) From: Lukas Wagner To: pdm-devel@lists.proxmox.com, pbs-devel@lists.proxmox.com Subject: [PATCH proxmox-mail-forward 5/5] only ever forward for one product, favoring PVE over PBS over PDM Date: Thu, 9 Apr 2026 15:27:21 +0200 Message-ID: <20260409132721.272178-6-l.wagner@proxmox.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260409132721.272178-1-l.wagner@proxmox.com> References: <20260409132721.272178-1-l.wagner@proxmox.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1775741180798 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.054 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record URIBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [main.rs] Message-ID-Hash: YHHEBRMBRUA6XER4U7JCBDLOG7MD23HL X-Message-ID-Hash: YHHEBRMBRUA6XER4U7JCBDLOG7MD23HL X-MailFrom: l.wagner@proxmox.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.10 Precedence: list List-Id: Proxmox Backup Server development discussion List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Co-installations of products should hopefully be not that common, but a defined order might be easier to grasp for users than having to deal with notifications being sent through multiple products. Signed-off-by: Lukas Wagner --- src/main.rs | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/src/main.rs b/src/main.rs index 92a2804..b089bb0 100644 --- a/src/main.rs +++ b/src/main.rs @@ -6,6 +6,9 @@ //! The message is passed via stdin. //! The binary is installed with setuid permissions and will thus run as //! root (euid ~ root, ruid ~ nobody) +//! +//! If multiple products are co-installed, only one of the products is ever responsible for +//! forwarding the email. The order is PVE > PBS > PDM. use std::io::Read; use std::path::Path; @@ -137,22 +140,18 @@ fn main() { // Read the mail that is to be forwarded from stdin match read_stdin() { Ok(mail) => { - // Assume a PVE installation if /etc/pve exists if Path::new(PVE_CFG_PATH).exists() { + // Assume a PVE installation if /etc/pve exists if let Err(err) = forward_for_pve(&mail) { error!("could not forward mail for Proxmox VE: {err:#}"); } - } - - // Assume a PBS installation if /etc/proxmox-backup exists - if Path::new(PBS_CFG_PATH).exists() { + } else if Path::new(PBS_CFG_PATH).exists() { + // Assume a PBS installation if /etc/proxmox-backup exists if let Err(err) = forward_for_pbs(&mail) { error!("could not forward mail for Proxmox Backup Server: {err:#}"); } - } - - // Assume a PDM installation if /etc/proxmox-datacenter-manager exists - if Path::new(PDM_CFG_PATH).exists() { + } else if Path::new(PDM_CFG_PATH).exists() { + // Assume a PDM installation if /etc/proxmox-datacenter-manager exists if let Err(err) = forward_for_pdm(&mail) { error!("could not forward mail for Proxmox Datacenter Manager: {err:#}"); } -- 2.47.3