nixos-images icon indicating copy to clipboard operation
nixos-images copied to clipboard

Netboot Image with preconfigured/random password

Open max06 opened this issue 1 year ago • 4 comments

Good evening folks!

I'm currently preparing a pxe environment for semi-automated provisioning of many physical and virtual machines. These machines should be ready for their nixos-anywhere deployment after boot, without human interaction.

Your current installer images with their display of the generated root-password and network config is almost ideal. (It just doesn't work in my ipxe environment due to efi/memdisk.)

Could you add that functionality to the pxe images as well?

Moving this a step further: Would it be possible to specify a fixed root password (or public key) with the command line options?

Thanks a lot!

(I could probably generate my own modified images - I'm just too lazy to add another responsibility to that project. Keeping it simple and stupid.)

max06 avatar Nov 19 '24 16:11 max06

Did we not already support putting password hashes in the cmdline in nixos in general?

https://github.com/NixOS/nixpkgs/blob/76193bc2e99e42ddd6264bba9c5c372bc019e50e/nixos/modules/installer/cd-dvd/installation-cd-base.nix#L37

Unsure if we also import this in the netboot image, but if we don't, we can add this. Would you than still need a random password in that case?

Mic92 avatar Nov 19 '24 16:11 Mic92

This sounds awesome!

No, if I can specify a hash, I'm all set.

And thanks for the quick response 🙇🏼

max06 avatar Nov 19 '24 17:11 max06

I'm sorry for the delay, just found a bit of time to test.

The current pxe setup does not react to live.nixos.passwd set on cmdline. So I went ahead and created this MR. First MR in that repo, let's see how much I've missed on the conventions 🙈

max06 avatar Nov 24 '24 14:11 max06

Hey @Mic92! Thank you very much for reviewing and merging the change in nixpkgs, highly appreciated!

I've seen your change to the nixpkgs inputs in this repo - do you plan on keeping this for a longer time? Is there something I have to/can do to get my change into an actual netboot build in here?

max06 avatar Dec 05 '24 12:12 max06

@max06 what changes?

Mic92 avatar Apr 05 '25 08:04 Mic92

Nevermind - you had replaced the nixpkgs input with your own fork so NixOS/nixpkgs#358722 didn't end up in here.

I guess this is solved by now.

max06 avatar Apr 05 '25 11:04 max06