From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gate001.proxmox.com (gate001.proxmox.com [IPv6:2a0f:8001:1:32::40]) by lore.proxmox.com (Postfix) with ESMTPS id C61B71FF0ED for ; Fri, 31 Jul 2026 16:40:20 +0200 (CEST) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id 970022157B; Fri, 31 Jul 2026 16:40:20 +0200 (CEST) From: Christoph Heiss To: pdm-devel@lists.proxmox.com Subject: [PATCH installer 10/16] auto: enforce https for post hook when generating an API token Date: Fri, 31 Jul 2026 16:35:33 +0200 Message-ID: <20260731143910.936881-11-c.heiss@proxmox.com> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260731143910.936881-1-c.heiss@proxmox.com> References: <20260731143910.936881-1-c.heiss@proxmox.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1785508802456 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.007 Adjusted score from AWL reputation of From: address DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment (newer systems) RCVD_IN_DNSWL_LOW -0.7 Sender listed at https://www.dnswl.org/, low trust 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: BZRMXXLULNUVUFQMWJQ6CWSRBEOCJNNX X-Message-ID-Hash: BZRMXXLULNUVUFQMWJQ6CWSRBEOCJNNX X-MailFrom: c.heiss@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 Datacenter Manager development discussion List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: As we include the token secret in the post-hook information, and (in this particular case) the token is scoped on root@pam, enforce a minimum level of security. Signed-off-by: Christoph Heiss --- Depends on the `proxmox-installer-types` changes and an accompanying dependency bump. proxmox-auto-installer/src/utils.rs | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/proxmox-auto-installer/src/utils.rs b/proxmox-auto-installer/src/utils.rs index 710af21..7762738 100644 --- a/proxmox-auto-installer/src/utils.rs +++ b/proxmox-auto-installer/src/utils.rs @@ -11,7 +11,7 @@ use proxmox_installer_types::{ answer::{ AutoInstallerConfig, DiskSelection, Filesystem, FilesystemOptions, FilesystemType, FilterMatch, FirstBootHookSourceMode, FqdnConfig, FqdnFromDhcpConfig, FqdnSourceMode, - NetworkConfig, + NetworkConfig, PostNotificationHookInfo, }, }; @@ -496,6 +496,16 @@ pub fn verify_network_settings( Ok(()) } +pub fn verify_post_hook_settings(hook: &PostNotificationHookInfo) -> Result<()> { + info!("Verifying post-installation hook settings"); + + if hook.api_token_name.is_some() && !hook.url.starts_with("https://") { + bail!("`post-installation-webhook.api-token-name` can only be used with HTTPS"); + } + + Ok(()) +} + pub fn parse_answer( answer: &AutoInstallerConfig, udev_info: &UdevInfo, @@ -518,6 +528,10 @@ pub fn parse_answer( verify_first_boot_settings(answer)?; verify_network_settings(&answer.network, Some(runtime_info))?; + if let Some(info) = &answer.post_installation_webhook { + verify_post_hook_settings(info)?; + } + let root_password = match ( &answer.global.root_password, &answer.global.root_password_hashed, -- 2.54.0