-
-
Notifications
You must be signed in to change notification settings - Fork 14.1k
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
(ssh) authentication fails for root with empty password on netboot image #119710
Comments
It's not clear to me yet if there is any way to enable extended logging for pam somewhere, or if there are other debugging techniques for this. The pamtester tool is packaged but that |
This doesn't seem to work even if |
Some misc. notes: So, I still don't know about how to make this more debuggable, but at least with respect to authentication on su and sshd with PAM, it should be observed that only the nixpkgs/nixos/modules/security/pam.nix Line 447 in 5a333c5
This seems to exist since 5dfaf56 , and is enabled for a few services https://github.com/NixOS/nixpkgs/search?q=allownullpassword
Some orientational docs can be read at http://www.linux-pam.org/Linux-PAM-html/sag-configuration-file.html .
sshd can partly be debugged by passing Here is an example of a pam file for su:
Asking the person that helped me notice the nullok issue about debugging pam, they said:
|
Ok so I should have probably bit the small bullet earlier and looked into compiling pam with debugging enabled *, but since all the google results were centos or redhat I (incorrectly and unwarrantedly) assumed that it wasn't an upstream thing. I'm still not sure if PAM is just horribly unverbose even when debugging (despite passing
* So after digging a bit in the The macros can be found at https://github.com/linux-pam/linux-pam/blob/e65d93223bbcf9931f580963edeacbe3c2cf72cb/libpam/include/security/_pam_macros.h#L81 currently.
Meanwhile, various tidbits in https://serverfault.com/questions/249671/switch-on-pam-debugging-to-syslog that may or may not help at all. |
To quote myself from #16884, with regards to appling a function to override the PAM strings : This solves a longstanding question I've had. It would be good to document this. (Generally good to be thorough in that one documents creation, destruction, mutation..wait wasn't there an acronym for that? https://en.wikipedia.org/wiki/Create,_read,_update,_and_delete I guess - and do this for each orthogonal component.) Here is an almost-minimal expression demonstrating this functionality: #! /usr/bin/env nix-shell
#! nix-shell -i "nix-build -A etc" -p""
let
modules = [ ({lib, ...}: {
options.networking.firewall.enable = lib.mkOption {
apply = v: builtins.trace v v; # Should trace `false`
};
config.networking.firewall.enable = false;
}) ];
in rec {
result = import <nixpkgs/nixos/lib/eval-config.nix> { inherit modules; };
inherit (result.config.system.build) etc;
}
Combining this with a submodule (thanks @infinisil for the submodule example the other day), here is a demonstration adding some flags to https://github.com/NixOS/nixpkgs/blob/master/nixos/modules/security/pam.nix#L389 (observe the content of #! /usr/bin/env nix-shell
#! nix-shell -i "nix-build -A etc" -p""
let
module = {lib, ...}: with lib // lib.types; {
options.security.pam.services = mkOption {
type = attrsOf (submodule ({...}: {
options.text = mkOption {
apply = v: builtins.replaceStrings [ "pam_unix.so" ] [ "pam_unix.so audit debug" ] v;
};
}));
};
};
in rec {
result = import <nixpkgs/nixos/lib/eval-config.nix> { modules = [ module ]; };
etc = result.config.system.build.etc;
} Though I'm now left with some questions on how this is supposed to work... what happens if you do this multiple times? (priority system like always?) |
Well, the way I ended up solving this was noticing that when I was applying |
I'm not sure where my initial difficulties were, using |
@deliciouslytyped Thanks for investigating this. I lost half an hour trying to set up a NixOS VM test machine that allows SSH with empty password. How to configure a NixOS machine to allow SSH for root with empty passwordusers.users.root.hashedPassword = ""; # "" means passwordless login
services.openssh.settings.PermitRootLogin = "yes";
services.openssh.settings.PermitEmptyPasswords = "yes";
security.pam.services.sshd.allowNullPassword = true; |
Update 1: su can be "fixed" by adding
nullok
to it'sauth required pam_unix.so
line. Whysshd
is unhappy remains to be discovered.Update 2: the same applies to sshd, I was using
.ssh
instead of.sshd
by mistake.=============
With the following module, and the default empty password:
I can't access ssh, authentication fails with the following:
passwd reports the following:
su root
from another user also fails, but I didn't check for logs.The text was updated successfully, but these errors were encountered: