From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [IPv6:2a01:7e0:0:424::9]) by lore.proxmox.com (Postfix) with ESMTPS id 5C3831FF13A for ; Wed, 15 Apr 2026 09:03:38 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 61B3A38E8; Wed, 15 Apr 2026 09:02:44 +0200 (CEST) From: Arthur Bied-Charreton To: pve-devel@lists.proxmox.com Subject: [PATCH proxmox-backup v3 19/23] notifications: Add XOAUTH2 parameters to endpoints Date: Wed, 15 Apr 2026 09:02:16 +0200 Message-ID: <20260415070220.100306-20-a.bied-charreton@proxmox.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260415070220.100306-1-a.bied-charreton@proxmox.com> References: <20260415070220.100306-1-a.bied-charreton@proxmox.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 AWL -0.118 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 KAM_LAZY_DOMAIN_SECURITY 1 Sending domain does not have any anti-forgery methods RDNS_NONE 0.793 Delivered to internal network by a host with no rDNS SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_NONE 0.001 SPF: sender does not publish an SPF Record Message-ID-Hash: 2O6QCED7XQTK6YR5VMMTONC3CZA6ORMJ X-Message-ID-Hash: 2O6QCED7XQTK6YR5VMMTONC3CZA6ORMJ X-MailFrom: abied-charreton@jett.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 VE development discussion List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Add oauth2-client-secret and oauth2-refresh-token to POST and PUT endpoints for SMTP notifications and pass them along to the proxmox-notify functions. The non-private parameters oauth2-client-id and oauth2-tenant-id are passed as part of the SmtpConfig struct. Signed-off-by: Arthur Bied-Charreton --- src/api2/config/notifications/smtp.rs | 36 ++++++++++++++++++++++++--- 1 file changed, 33 insertions(+), 3 deletions(-) diff --git a/src/api2/config/notifications/smtp.rs b/src/api2/config/notifications/smtp.rs index 8df2ab18..4d88bd65 100644 --- a/src/api2/config/notifications/smtp.rs +++ b/src/api2/config/notifications/smtp.rs @@ -72,7 +72,15 @@ pub fn get_endpoint(name: String, rpcenv: &mut dyn RpcEnvironment) -> Result Result, + oauth2_client_secret: Option, + oauth2_refresh_token: Option, _rpcenv: &mut dyn RpcEnvironment, ) -> Result<(), Error> { let _lock = pbs_config::notifications::lock_config()?; @@ -90,9 +100,15 @@ pub fn add_endpoint( let private_endpoint_config = SmtpPrivateConfig { name: endpoint.name.clone(), password, + oauth2_client_secret, }; - proxmox_notify::api::smtp::add_endpoint(&mut config, endpoint, private_endpoint_config)?; + proxmox_notify::api::smtp::add_endpoint( + &mut config, + endpoint, + private_endpoint_config, + oauth2_refresh_token, + )?; pbs_config::notifications::save_config(config)?; Ok(()) @@ -113,6 +129,14 @@ pub fn add_endpoint( description: "SMTP authentication password", optional: true, }, + "oauth2-client-secret": { + optional: true, + description: "Client secret for SMTP XOAUTH2" + }, + "oauth2-refresh-token": { + optional: true, + description: "Refresh token for SMTP XOAUTH2" + }, delete: { description: "List of properties to delete.", type: Array, @@ -136,6 +160,8 @@ pub fn update_endpoint( name: String, updater: SmtpConfigUpdater, password: Option, + oauth2_client_secret: Option, + oauth2_refresh_token: Option, delete: Option>, digest: Option, _rpcenv: &mut dyn RpcEnvironment, @@ -148,7 +174,11 @@ pub fn update_endpoint( &mut config, &name, updater, - SmtpPrivateConfigUpdater { password }, + SmtpPrivateConfigUpdater { + password, + oauth2_client_secret, + }, + oauth2_refresh_token, delete.as_deref(), digest.as_deref(), )?; -- 2.47.3