From 540df9f4788de5484ab0f3d0fb5baea1c8cea491 Mon Sep 17 00:00:00 2001 From: Thomas Lamprecht Date: Mon, 22 Apr 2024 08:00:58 +0200 Subject: [PATCH] auto install: drop post/pre command execution for now This can be quite a bit dangerous w.r.t. prepared ISOs as attack vector or copy cats, we rather should implement the common use cases, like adding a SSH auth key, as explicit, declarative defined config option. Such a overly general command execution might be something to add at a later stage, but not for the initial MVP. Signed-off-by: Thomas Lamprecht --- proxmox-auto-installer/src/answer.rs | 2 -- .../src/bin/proxmox-auto-installer.rs | 18 +++--------------- 2 files changed, 3 insertions(+), 17 deletions(-) diff --git a/proxmox-auto-installer/src/answer.rs b/proxmox-auto-installer/src/answer.rs index 57c2602..a9e723a 100644 --- a/proxmox-auto-installer/src/answer.rs +++ b/proxmox-auto-installer/src/answer.rs @@ -27,8 +27,6 @@ pub struct Global { pub mailto: String, pub timezone: String, pub password: String, - pub pre_commands: Option>, - pub post_commands: Option>, #[serde(default)] pub reboot_on_error: bool, } diff --git a/proxmox-auto-installer/src/bin/proxmox-auto-installer.rs b/proxmox-auto-installer/src/bin/proxmox-auto-installer.rs index f43b12f..922773a 100644 --- a/proxmox-auto-installer/src/bin/proxmox-auto-installer.rs +++ b/proxmox-auto-installer/src/bin/proxmox-auto-installer.rs @@ -15,7 +15,6 @@ use proxmox_auto_installer::{ answer::Answer, log::AutoInstLogger, udevinfo::UdevInfo, - utils, utils::{parse_answer, LowLevelMessage}, }; @@ -83,13 +82,6 @@ fn main() -> ExitCode { } }; - match utils::run_cmds("Pre", &answer.global.pre_commands) { - Ok(_) => (), - Err(err) => { - error!("Error when running Pre-Commands: {}", err); - return exit_failure(answer.global.reboot_on_error); - } - }; match run_installation(&answer, &locales, &runtime_info, &udevadm_info, &setup_info) { Ok(_) => info!("Installation done."), Err(err) => { @@ -97,13 +89,9 @@ fn main() -> ExitCode { return exit_failure(answer.global.reboot_on_error); } } - match utils::run_cmds("Post", &answer.global.post_commands) { - Ok(_) => (), - Err(err) => { - error!("Error when running Post-Commands: {}", err); - return exit_failure(answer.global.reboot_on_error); - } - }; + + // TODO: (optionally) do a HTTP post with basic system info, like host SSH public key(s) here + ExitCode::SUCCESS } -- 2.39.5