add root-password module

This commit is contained in:
Johannes Kirschbauer
2024-04-10 11:11:57 +02:00
parent fac3a86066
commit 8474065fa2
2 changed files with 20 additions and 0 deletions

View File

@@ -18,6 +18,7 @@
sshd = ./sshd.nix; sshd = ./sshd.nix;
sunshine = ./sunshine.nix; sunshine = ./sunshine.nix;
syncthing = ./syncthing.nix; syncthing = ./syncthing.nix;
root-password = ./root-password.nix;
thelounge = ./thelounge.nix; thelounge = ./thelounge.nix;
vm-user = ./vm-user.nix; vm-user = ./vm-user.nix;
waypipe = ./waypipe.nix; waypipe = ./waypipe.nix;

View File

@@ -0,0 +1,19 @@
{ pkgs, config, ... }:
{
users.mutableUsers = false;
users.extraUsers.root.hashedPasswordFile = "/run/secrets-for-users/passwordHash";
sops.secrets."${config.clanCore.machineName}-passwordHash".neededForUsers = true;
clanCore.facts.services.password = {
secret.password = { };
secret.passwordHash = { };
generator.path = with pkgs; [
coreutils
xkcdpass
mkpasswd
];
generator.script = ''
xkcdpass -c 3 -d - > $secrets/password
cat $secrets/password | mkpasswd -s -m sha-512 > $secrets/passwordHash
'';
};
}