public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Christoph Heiss <c.heiss@proxmox.com>
Cc: Proxmox VE development discussion <pve-devel@lists.proxmox.com>
Subject: Re: [pve-devel] [PATCH installer 6/7] auto-installer: add new `global.root_password_hashed` answer option
Date: Fri, 24 May 2024 11:08:02 +0200	[thread overview]
Message-ID: <dgs6cknnxfczlnjsyp55u2fgp4gceqfddbgpfe5sbprajsnc3c@okyfqrtwudxs> (raw)
In-Reply-To: <20240523121938.1058898-7-c.heiss@proxmox.com>

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 <c.heiss@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,

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


  reply	other threads:[~2024-05-24  9:08 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-23 12:19 [pve-devel] [PATCH installer 0/7] auto-installer: add option for providing hashed root password Christoph Heiss
2024-05-23 12:19 ` [pve-devel] [PATCH installer 1/7] common: move `PasswordOptions` type to tui crate Christoph Heiss
2024-05-23 12:19 ` [pve-devel] [PATCH installer 2/7] tui-installer: remove `Debug` implementation for password options Christoph Heiss
2024-05-23 12:19 ` [pve-devel] [PATCH installer 3/7] low-level: change root password option to contain either plaintext or hash Christoph Heiss
2024-05-23 12:19 ` [pve-devel] [PATCH installer 4/7] tui-installer: adapt to new `root_password` plain/hashed setup option Christoph Heiss
2024-05-23 12:19 ` [pve-devel] [PATCH installer 5/7] auto-installer: " Christoph Heiss
2024-05-23 12:19 ` [pve-devel] [PATCH installer 6/7] auto-installer: add new `global.root_password_hashed` answer option Christoph Heiss
2024-05-24  9:08   ` Christoph Heiss [this message]
2024-05-23 12:19 ` [pve-devel] [PATCH installer 7/7] auto-installer: add test for hashed root password option 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=dgs6cknnxfczlnjsyp55u2fgp4gceqfddbgpfe5sbprajsnc3c@okyfqrtwudxs \
    --to=c.heiss@proxmox.com \
    --cc=pve-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