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 7986D1FF142 for ; Tue, 21 Apr 2026 10:52:52 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 517C119221; Tue, 21 Apr 2026 10:52:52 +0200 (CEST) Date: Tue, 21 Apr 2026 10:52:46 +0200 From: Arthur Bied-Charreton To: Lukas Wagner Subject: Re: [PATCH docs/manager/proxmox{,-perl-rs,-widget-toolkit,-backup} v3 00/23] fix #7238: Add XOAUTH2 authentication support for SMTP notification targets Message-ID: References: <20260415070220.100306-1-a.bied-charreton@proxmox.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1776761482358 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.774 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 Message-ID-Hash: 63764II7RAAWJVKWL7WSZ4LF5X2R2BTW X-Message-ID-Hash: 63764II7RAAWJVKWL7WSZ4LF5X2R2BTW X-MailFrom: a.bied-charreton@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 CC: pve-devel@lists.proxmox.com X-Mailman-Version: 3.3.10 Precedence: list List-Id: Proxmox VE development discussion List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: On Tue, Apr 21, 2026 at 10:40:57AM +0200, Lukas Wagner wrote: > On Wed Apr 15, 2026 at 9:01 AM CEST, Arthur Bied-Charreton wrote: > > This series adds XOAUTH2 support for SMTP notification targets in PVE > > and PBS, motivated by Microsoft's upcoming deprecation of basic > > authentication for SMTP [0]. Google and Microsoft are supported as > > OAuth2 providers. > > > > The main challenge is the OAuth2 refresh tokens management. The > > implementations differ from provider to provider, and for Microsoft > > specifically, the token needs to be writable by proxmox-notify, since > > Microsoft Exchange Online OAuth2 rotates it at every use. > > > > This series solves this by introducing state files. Each SMTP endpoint > > gets its own to avoid having to lock all endpoints every time a state > > update is made (which can be on every notification for Microsoft > > targets). These files are managed entirely from the Rust side. > > > > Tokens are refreshed every time a notification is sent, and proactively > > via pveupdate/proxmox-backup-daily-update. State file updates are > > atomic (sys::fs::replace_file). > > > > Note that this is technically racy, since multiple notifications could > > be sent at the same time from different nodes, but that is okay in > > practice given the implementations of the providers we support: > > > > * Google: The token is refreshed in-place, meaning its lifetime is > > extended at every use without it being *actually* rotated [1], so no > > changes to the state file. > > * Microsoft: The token is rotated at each request, however tokens have > > a fixed lifetime of 90 days, meaning the old token can still be used. > > Concurrent access just means we are letting the last updater win, but > > in both cases we end up with a valid token that can be used for > > subsequent exchanges [2]. > > > > > Tested these changes through PBS (since PVE already worked flawless > in the last versions). Worked fine, but I stumbled across a bug where > after authorizing the OAuth2 endpoint, the `PBSAuthToken` was lost in > the Web UI after the redirect, leading to being kicked out of the > session. We discussed the issue off-list and Arthur already found the > solution, which he will include in v4. > > The patches itself worked well, tested them against Google. > > The code also looks good to me, left some minor notes that should be > addressed for the next version. Did not do a deep review this time, > since most of the code was already in a very good shape in v2. > > > Reviewed-by: Lukas Wagner > > (through PBS): > Tested-by: Lukas Wagner I overlooked a detail in the PBS login logic which leads to OpenID logins and SMTP OAuth2 redirects being confused. I will explicitly check for the oauth2 prefix in the channelName state parameter to differentiate properly between the two, as well as address you other review comments in v4. Thanks a lot for the review!