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 55D951FF0ED for ; Fri, 31 Jul 2026 16:39:45 +0200 (CEST) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id 250612155F; Fri, 31 Jul 2026 16:39:45 +0200 (CEST) From: Christoph Heiss To: pdm-devel@lists.proxmox.com Subject: [PATCH proxmox 04/16] installer-types: post-hook: add api-token and cert-fingerprint options Date: Fri, 31 Jul 2026 16:35:27 +0200 Message-ID: <20260731143910.936881-5-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: 1785508771227 X-SPAM-LEVEL: Spam detection results: 0 AWL -0.000 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: JTS7YGYTTBWYDNBK5EM4RB2HCBAQJG3P X-Message-ID-Hash: JTS7YGYTTBWYDNBK5EM4RB2HCBAQJG3P 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: Adds two new (optional) fields to `PostHookInfo`; `cert-fingerprint` and `api-token`. As well as a corresponding optional field in the answer file for requesting to create an API token. Signed-off-by: Christoph Heiss --- proxmox-installer-types/Cargo.toml | 1 + proxmox-installer-types/debian/control | 4 +++ proxmox-installer-types/src/post_hook.rs | 33 ++++++++++++++++++++++-- 3 files changed, 36 insertions(+), 2 deletions(-) diff --git a/proxmox-installer-types/Cargo.toml b/proxmox-installer-types/Cargo.toml index ff0dc330..3c64aaa7 100644 --- a/proxmox-installer-types/Cargo.toml +++ b/proxmox-installer-types/Cargo.toml @@ -16,6 +16,7 @@ anyhow.workspace = true serde = { workspace = true, features = ["derive"] } serde_plain.workspace = true regex = { workspace = true } +proxmox-auth-api = { workspace = true, features = ["api-types"] } proxmox-network-types.workspace = true proxmox-schema = { workspace = true, features = ["api-macro"] } proxmox-section-config = { workspace = true, optional = true } diff --git a/proxmox-installer-types/debian/control b/proxmox-installer-types/debian/control index a880c18a..0dfd26f0 100644 --- a/proxmox-installer-types/debian/control +++ b/proxmox-installer-types/debian/control @@ -7,6 +7,8 @@ Build-Depends-Arch: cargo:native , rustc:native (>= 1.85) , libstd-rust-dev , librust-anyhow-1+default-dev , + librust-proxmox-auth-api-1+api-types-dev (>= 1.0.5-~~) , + librust-proxmox-auth-api-1+default-dev (>= 1.0.5-~~) , librust-proxmox-network-types-1+default-dev (>= 1.0.2-~~) , librust-proxmox-node-status-1+default-dev , librust-proxmox-schema-5+api-macro-dev (>= 5.3.0-~~) , @@ -28,6 +30,8 @@ Multi-Arch: same Depends: ${misc:Depends}, librust-anyhow-1+default-dev, + librust-proxmox-auth-api-1+api-types-dev (>= 1.0.5-~~), + librust-proxmox-auth-api-1+default-dev (>= 1.0.5-~~), librust-proxmox-network-types-1+default-dev (>= 1.0.2-~~), librust-proxmox-node-status-1+default-dev, librust-proxmox-schema-5+api-macro-dev (>= 5.3.0-~~), diff --git a/proxmox-installer-types/src/post_hook.rs b/proxmox-installer-types/src/post_hook.rs index 828452e6..bb4f8d9a 100644 --- a/proxmox-installer-types/src/post_hook.rs +++ b/proxmox-installer-types/src/post_hook.rs @@ -2,9 +2,10 @@ use serde::{Deserialize, Serialize}; +use proxmox_auth_api::types::Authid; use proxmox_network_types::ip_address::Cidr; #[cfg(feature = "api-types")] -use proxmox_schema::api; +use proxmox_schema::{api, api_types::FINGERPRINT_SHA256_FORMAT}; use crate::{ BootType, IsoInfo, ProxmoxProduct, SystemDMI, UdevProperties, @@ -119,6 +120,18 @@ pub struct ProductInfo { pub version: String, } +#[cfg_attr(feature = "api-types", api)] +#[derive(Clone, Serialize, Deserialize, PartialEq)] +#[serde(rename_all = "kebab-case")] +/// Information about the API token created after the installation, if requested. +/// Available since schema 1.3. +pub struct CreatedApiToken { + /// The generated API token added to the new installation. + pub id: Authid, + /// The generated API token secret added to the new installation. + pub secret: String, +} + #[cfg_attr(feature = "api-types", api)] #[derive(Clone, Serialize, Deserialize, PartialEq)] /// Information about the CPU(s) installed in the system @@ -171,7 +184,15 @@ pub struct PostHookInfoSchema { "network-interfaces": { type: Array, items: { type: NetworkInterfaceInfo }, - } + }, + "cert-fingerprint": { + type: String, + format: &FINGERPRINT_SHA256_FORMAT, + optional: true, + }, + "api-token": { + optional: true, + }, }, // Make it forward-compatible, allowing sending additional properties to older implementations, // making it a bit more graceful in fallback. @@ -219,6 +240,14 @@ pub struct PostHookInfo { pub ssh_public_host_keys: SshPublicHostKeys, /// Action to will be performed, i.e. either reboot or power off the machine. pub reboot_mode: RebootMode, + /// Certificate fingerprint. + /// New with schema 1.3 + #[serde(skip_serializing_if = "Option::is_none")] + pub cert_fingerprint: Option, + /// If it was requested, contains the information about the created API token. + /// New with schema 1.3 + #[serde(skip_serializing_if = "Option::is_none")] + pub api_token: Option, } fn bool_is_false(value: &bool) -> bool { -- 2.54.0