public inbox for pdm-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Christoph Heiss <c.heiss@proxmox.com>
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	[thread overview]
Message-ID: <20260731143910.936881-5-c.heiss@proxmox.com> (raw)
In-Reply-To: <20260731143910.936881-1-c.heiss@proxmox.com>

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 <c.heiss@proxmox.com>
---
 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 <!nocheck>,
  rustc:native (>= 1.85) <!nocheck>,
  libstd-rust-dev <!nocheck>,
  librust-anyhow-1+default-dev <!nocheck>,
+ librust-proxmox-auth-api-1+api-types-dev (>= 1.0.5-~~) <!nocheck>,
+ librust-proxmox-auth-api-1+default-dev (>= 1.0.5-~~) <!nocheck>,
  librust-proxmox-network-types-1+default-dev (>= 1.0.2-~~) <!nocheck>,
  librust-proxmox-node-status-1+default-dev <!nocheck>,
  librust-proxmox-schema-5+api-macro-dev (>= 5.3.0-~~) <!nocheck>,
@@ -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<String>,
+    /// 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<CreatedApiToken>,
 }
 
 fn bool_is_false(value: &bool) -> bool {
-- 
2.54.0





  parent reply	other threads:[~2026-07-31 14:39 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-31 14:35 [PATCH proxmox/installer/datacenter-manager 00/16] auto-installer: add installed target systems as new remotes Christoph Heiss
2026-07-31 14:35 ` [PATCH proxmox 01/16] installer-types: drop unnecessary clippy attribute Christoph Heiss
2026-07-31 14:35 ` [PATCH proxmox 02/16] installer-types: post-hook: factor schema version into proper struct Christoph Heiss
2026-07-31 14:35 ` [PATCH proxmox 03/16] installer-types: post-hook: allow additional properties on api schema Christoph Heiss
2026-07-31 14:35 ` Christoph Heiss [this message]
2026-07-31 14:35 ` [PATCH proxmox 05/16] installer-types: systeminfo: add check for API token creation capability Christoph Heiss
2026-07-31 14:35 ` [PATCH installer 06/16] chroot: print full error if bind-mounting fails Christoph Heiss
2026-07-31 14:35 ` [PATCH installer 07/16] post-hook: re-use low-level config retrieval from proxmox-chroot Christoph Heiss
2026-07-31 14:35 ` [PATCH installer 08/16] post-hook: generate and retrieve node certificate fingerprint Christoph Heiss
2026-07-31 14:35 ` [PATCH installer 09/16] post-hook: support creating API token if requested in answer file Christoph Heiss
2026-07-31 14:35 ` [PATCH installer 10/16] auto: enforce https for post hook when generating an API token Christoph Heiss
2026-07-31 14:35 ` [PATCH installer 11/16] assistant: validate-answer: also verify post-hook settings if set Christoph Heiss
2026-07-31 14:35 ` [PATCH datacenter-manager 12/16] ui: auto-installer: spell out Proxmox Datacenter Manager Christoph Heiss
2026-07-31 14:35 ` [PATCH datacenter-manager 13/16] config: auto-install: add optional `post-hook-add-as-remote` field Christoph Heiss
2026-07-31 14:35 ` [PATCH datacenter-manager 14/16] api: auto-installer: add option for adding new remotes to PDM Christoph Heiss
2026-07-31 14:35 ` [PATCH datacenter-manager 15/16] ui: auto-installer: wizard: add checkbox to add target as new remote Christoph Heiss
2026-07-31 14:35 ` [PATCH datacenter-manager 16/16] docs: auto-installer: document adding targets as remotes afterwards Christoph Heiss

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260731143910.936881-5-c.heiss@proxmox.com \
    --to=c.heiss@proxmox.com \
    --cc=pdm-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal