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 21A331FF163 for ; Thu, 5 Dec 2024 15:08:09 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 5BF2E1B11A; Thu, 5 Dec 2024 15:08:07 +0100 (CET) From: Daniel Kral To: pve-devel@lists.proxmox.com Date: Thu, 5 Dec 2024 15:07:21 +0100 Message-Id: <20241205140721.207021-1-d.kral@proxmox.com> X-Mailer: git-send-email 2.39.5 MIME-Version: 1.0 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.005 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 RCVD_IN_VALIDITY_CERTIFIED_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. RCVD_IN_VALIDITY_RPBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. RCVD_IN_VALIDITY_SAFE_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. 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. [answer.rs] Subject: [pve-devel] [RFC PATCH installer] fix #5973: auto: first boot: allow snake- and kebabcased property names X-BeenThere: pve-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox VE development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Proxmox VE development discussion Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: pve-devel-bounces@lists.proxmox.com Sender: "pve-devel" Allow the names for the [first-boot] properties to be parsed as either snake_cased or kebab-cased strings, i.e. `cert_fingerprint` or `cert-fingerprint`, to have consistent property name casings. Currently, this only affects the `cert_fingerprint`. This change does not break API as it preserves the kebabcased variant `cert-fingerprint`, but as this change propagates to the auto-installer, using the snakecased `cert_fingerprint` will result in a parse error during auto installation on any unpatched ISO (e.g. Proxmox VE 8.3-1). Signed-off-by: Daniel Kral --- I have tested this by setting up a small HTTPS server with Python's `http.server` and `ssl.wrap_socket()` on my local machine and creating two different ISOs (with the Proxmox VE 8.3-1 ISO): - with `cert-fingerprint` (which works correctly as expected), and - with `cert_fingerprint` (which will fail at a parser error with the newest Proxmox VE 8.3-1 ISO). I've also tested the change by booting the ISO in debug mode and copying over the recompiled binaries, setting up the environment and running the auto installation with `proxmox-fetch-answer | proxmox-auto-installer`, which worked as expected. proxmox-auto-installer/src/answer.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/proxmox-auto-installer/src/answer.rs b/proxmox-auto-installer/src/answer.rs index c206fcc..04c0ace 100644 --- a/proxmox-auto-installer/src/answer.rs +++ b/proxmox-auto-installer/src/answer.rs @@ -107,7 +107,7 @@ impl FirstBootHookServiceOrdering { /// Describes from where to fetch the first-boot hook script, either being baked into the ISO or /// from a URL. #[derive(Clone, Deserialize, Debug)] -#[serde(rename_all = "kebab-case", deny_unknown_fields)] +#[serde(deny_unknown_fields)] pub struct FirstBootHookInfo { /// Mode how to retrieve the first-boot executable file, either from an URL or from the ISO if /// it has been baked-in. @@ -118,6 +118,7 @@ pub struct FirstBootHookInfo { /// Retrieve the post-install script from a URL, if source == "from-url". pub url: Option, /// SHA256 cert fingerprint if certificate pinning should be used, if source == "from-url". + #[serde(alias = "cert-fingerprint")] pub cert_fingerprint: Option, } -- 2.39.5 _______________________________________________ pve-devel mailing list pve-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel