[pve-devel] [PATCH installer 6/7] auto-installer: add new `global.root_password_hashed` answer option
Christoph Heiss
c.heiss at proxmox.com
Thu May 23 14:19:34 CEST 2024
This allows user to specify the root password in a hashed format,
generated using e.g. mkpasswd(1), instead of plaintext.
Signed-off-by: Christoph Heiss <c.heiss at proxmox.com>
---
proxmox-auto-installer/src/answer.rs | 3 ++-
proxmox-auto-installer/src/utils.rs | 4 ++++
2 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/proxmox-auto-installer/src/answer.rs b/proxmox-auto-installer/src/answer.rs
index aab7198..d691da1 100644
--- a/proxmox-auto-installer/src/answer.rs
+++ b/proxmox-auto-installer/src/answer.rs
@@ -26,7 +26,8 @@ pub struct Global {
pub keyboard: KeyboardLayout,
pub mailto: String,
pub timezone: String,
- pub root_password: String,
+ pub root_password: Option<String>,
+ pub root_password_hashed: Option<String>,
#[serde(default)]
pub reboot_on_error: bool,
#[serde(default)]
diff --git a/proxmox-auto-installer/src/utils.rs b/proxmox-auto-installer/src/utils.rs
index f1425b0..2b9930d 100644
--- a/proxmox-auto-installer/src/utils.rs
+++ b/proxmox-auto-installer/src/utils.rs
@@ -319,6 +319,10 @@ pub fn parse_answer(
verify_locale_settings(answer, locales)?;
+ if answer.global.root_password.is_some() == answer.global.root_password_hashed.is_some() {
+ bail!("`root_password` and `root_password_hashed` cannot be set at the same time");
+ }
+
let mut config = InstallConfig {
autoreboot: 1_usize,
filesys: filesystem,
--
2.44.0
More information about the pve-devel
mailing list