-
-
Notifications
You must be signed in to change notification settings - Fork 14.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
systemd.sysusers.enable
breaks hashedPasswordFile
#318365
Comments
Can see the same problem. Here's a reproducing VM config: { pkgs, config, ... }:
{
users.mutableUsers = false;
users.users.root.hashedPassword = "";
services.getty.autologinUser = "root";
systemd.sysusers.enable = true;
users.users."main" = {
isNormalUser = true;
group = "main";
# Start vm once, create this file, uncomment, re-build & restart vm
# hashedPasswordFile = "/var/lib/secrets/mainpw";
};
users.groups."main" = {};
system.stateVersion = config.system.nixos.release;
virtualisation.vmVariant = {
virtualisation = {
mountHostNixStore = true;
writableStoreUseTmpfs = false;
};
};
}
# Build with:
# NIXOS_CONFIG="$PWD/configuration.nix" nixos-rebuild build-vm --max-jobs auto --builders ''
# # ...you might need `nix-shell -p nixos-rebuild` as it's only installed on NixOS
# Run with:
# ./result/bin/run-*-vm & |
This only happens when |
I'd say that's a pretty big deal, because it's security relevant - people might unexpectedly end up with an insecure password or lock themselves out of a system - and because of the docs currently imply it works with immutable users:
Edit: Sorry, forget that this was about |
It cannot have ever worked with systemd-sysusers. There is nothing to revert. If you want the old behaviour you simply do not enable sysusers. My comment also simply explained why what happens happens. I never said that it shouldn't be fixed. Additionally, systemd-sysusers does not attempt to entirely emulate what the users-groups.pl script does. It most likely will never be able to. systemd-sysusers is experimental right now, which is clearly indicated in the option description. |
Describe the bug
After enabling
systemd.sysusers.enable
(ref) while enablinghashedPasswordFile
, attempting tonixos-rebuild boot --flake .#
fails withcat: /persist/secrets/passwdfile.gramdalf: No such file or directory
Steps To Reproduce
Steps to reproduce the behavior:
systemd.sysusers.enable
normalUser
with ahashedPasswordFile
(ref)nixos-rebuild boot --flake .#
Expected behavior
The
hashedPasswordFile
is used, but not added to/nix/store
Screenshots
If applicable, add screenshots to help explain your problem.
Additional context
The suggested
nix log
only gives a single error line, complaining that the file doesn't exist. Copy/pasting thecat
command works, I assume this to be due to the nix build environment being sanitized, with limited access to the filesystem as a whole.The source comes from this part of the file, which attempts to read the
hashedPasswordFile
at build time rather than activation (which was the previous behavior)Semi related to #307159
Notify maintainers
@nikstur @NickCao
Metadata
Please run
nix-shell -p nix-info --run "nix-info -m"
and paste the result.Add a 👍 reaction to issues you find important.
The text was updated successfully, but these errors were encountered: