Change set unix user command to service
This commit is contained in:
parent
16cd4f241e
commit
293dbdab94
1 changed files with 15 additions and 2 deletions
|
@ -6,7 +6,8 @@
|
||||||
}:
|
}:
|
||||||
let
|
let
|
||||||
cfg = config.khscodes.infrastructure.vault-server-approle;
|
cfg = config.khscodes.infrastructure.vault-server-approle;
|
||||||
userExists = username: (builtins.hasAttr username config.users.users) && config.users.users.enable;
|
userExists =
|
||||||
|
username: (builtins.hasAttr username config.users.users) && config.users.users.khs.enable;
|
||||||
setKhsPassword = pkgs.writeShellApplication {
|
setKhsPassword = pkgs.writeShellApplication {
|
||||||
name = "set-khs-password";
|
name = "set-khs-password";
|
||||||
runtimeInputs = [
|
runtimeInputs = [
|
||||||
|
@ -37,8 +38,20 @@ in
|
||||||
perms = "0600";
|
perms = "0600";
|
||||||
owner = "root";
|
owner = "root";
|
||||||
group = "root";
|
group = "root";
|
||||||
exec = lib.getExe setKhsPassword;
|
restartUnits = [ "set-khs-password.service" ];
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
systemd.services.set-khs-password = {
|
||||||
|
enable = true;
|
||||||
|
unitConfig = {
|
||||||
|
ConditionPathExists = "/run/unix-users/khs";
|
||||||
|
};
|
||||||
|
serviceConfig = {
|
||||||
|
Type = "oneshot";
|
||||||
|
User = "root";
|
||||||
|
Group = "root";
|
||||||
|
ExecStart = lib.getExe setKhsPassword;
|
||||||
|
};
|
||||||
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue