From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [IPv6:2a01:7e0:0:424::9]) by lore.proxmox.com (Postfix) with ESMTPS id C0FF91FF390 for ; Fri, 24 May 2024 11:08:19 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id C6E0A5EC0; Fri, 24 May 2024 11:08:37 +0200 (CEST) Date: Fri, 24 May 2024 11:08:02 +0200 From: Christoph Heiss Cc: Proxmox VE development discussion Message-ID: References: <20240523121938.1058898-1-c.heiss@proxmox.com> <20240523121938.1058898-7-c.heiss@proxmox.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20240523121938.1058898-7-c.heiss@proxmox.com> X-SPAM-LEVEL: Spam detection results: 0 AWL -0.505 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment MISSING_HEADERS 1.021 Missing To: header SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Subject: Re: [pve-devel] [PATCH installer 6/7] auto-installer: add new `global.root_password_hashed` answer option X-BeenThere: pve-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox VE development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Proxmox VE development discussion Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: pve-devel-bounces@lists.proxmox.com Sender: "pve-devel" On Thu, May 23, 2024 at 02:19:34PM +0200, Christoph Heiss wrote: > 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 > --- > 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, > + pub root_password_hashed: Option, > #[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, Seems a part of the diff went missing, probably while rebasing. There should be also @@ -342,7 +342,7 @@ pub fn parse_answer( root_password: InstallRootPassword { plain: answer.global.root_password.clone(), - hashed: None, + hashed: answer.global.root_password_hashed.clone(), }, mailto: answer.global.mailto.clone(), root_ssh_keys: answer.global.root_ssh_keys.clone(), I'll send a v2 soon, although I'll let it bake on the mailing list a bit first, in case there is some (other) feedback. > -- > 2.44.0 > > > > _______________________________________________ > pve-devel mailing list > pve-devel@lists.proxmox.com > https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel > > _______________________________________________ pve-devel mailing list pve-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel