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 155871FF0E3 for ; Tue, 04 Aug 2026 13:39:20 +0200 (CEST) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id D96B1216A2; Tue, 04 Aug 2026 13:39:19 +0200 (CEST) Content-Type: text/plain; charset=UTF-8 Date: Tue, 04 Aug 2026 13:39:16 +0200 Message-Id: Subject: Re: [PATCH installer 08/16] post-hook: generate and retrieve node certificate fingerprint From: "Lukas Wagner" To: "Christoph Heiss" , Mime-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Mailer: aerc 0.21.0-0-g5549850facc2-dirty References: <20260731143910.936881-1-c.heiss@proxmox.com> <20260731143910.936881-9-c.heiss@proxmox.com> In-Reply-To: <20260731143910.936881-9-c.heiss@proxmox.com> X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1785843544180 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.235 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: PAPEX36AFS6QVNAOQJXHK7KBOMGIHGGD X-Message-ID-Hash: PAPEX36AFS6QVNAOQJXHK7KBOMGIHGGD 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 Datacenter Manager development discussion List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: On Fri Jul 31, 2026 at 4:35 PM CEST, Christoph Heiss wrote: > =20 > + /// First creates the initial node certificate, then computes the fi= ngerprint from the freshly > + /// initialized proxy certificate. > + fn gather_node_cert_fingerprint( I think since this function always generates the certificate, the name gather_nod_cert_fingerprint is not ideal. Maybe call it `generate_node_certificate`? A function with that name returning a fingerprint of the generated cert seems plausible to me. > + target_path: &str, > + product: ProxmoxProduct, > + open_file: &dyn Fn(&str) -> Result, > + run_cmd: &dyn Fn(&[&str]) -> Result, > + ) -> Result> { > + println!("Generating node certificates .."); > + > + match product { > + ProxmoxProduct::Pve =3D> with_pmxcfs(target_path, |_| { > + run_cmd(&["pvecm", "updatecerts"]) > + .context("failed to generate node certificates")?; > + retrieve_cert_fingerprint(open_file("/etc/pve/local/pve-= ssl.pem")?).map(Some) > + }), > + ProxmoxProduct::Pbs =3D> { > + run_cmd(&["proxmox-backup-manager", "cert", "update"]) > + .context("failed to generate node certificates")?; > + retrieve_cert_fingerprint(open_file("/etc/proxmox-backup= /proxy.pem")?).map(Some) > + } > + ProxmoxProduct::Pmg =3D> { > + run_cmd(&["pmgconfig", "apicert"]) > + .context("failed to generate node certificates")?; > + retrieve_cert_fingerprint(open_file("/etc/pmg/pmg-api.pe= m")?).map(Some) > + } > + _ =3D> Ok(None), > + } > + } > +