-
-
Notifications
You must be signed in to change notification settings - Fork 14.9k
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
nixos-rebuild-ng: --sudo --ask-sudo-password fails with sudo-rs #371156
Comments
This is an upstream issue. We need to use
|
Fair enough, I will bring it up upstream. |
To give more context:
It seems upstream thinks this is a security misfeature. I don't think they're correct even if the implementation by sudo is dubious (I concur that doing a regex for the PAM and replacing it is not the best way to do so, but not sure if there is a better solution here), because there are valid use cases where replacing the prompt is necessary like the one used in |
Opening another issue about it upstream would be a duplicate in my opinion, so I guess there is no need to do that. |
You can at least add a comment with citing |
What is the reason that The reason we are hesitant with this feature in general is, as @thiagokokada points out, that it's kludgy to implement (there might be other authentication modules than passwords, and a PAM module may be more chatty so Note that with original sudo, modifying the sudo prompt doesn't require any particular privileges. |
The reason we need to disable the prompt is because we are injecting the password via stdin. If we don't disable the prompt, it basically shows a very confusing (for the user) message:
Possible multiple times since we call each command in a separate SSH session, and in this case there is no
I don't think this is what
I am not sure why this is an issue. There are multiple ways that if you have the power to run commands for the user that could cause security issues already, e.g.: you can just simulate a sudo prompt and capture the user password (this is what |
@squell, by the way:
It is very clear in the documentation that |
Describe the bug
When using
nixos-rebuild-ng
with--target-host --sudo --ask-sudo-password
the script passes the argument'--prompt=
tosudo
. This works with the originalc
implementation ofsudo
but if the target host is using sudo-rs then this fails with the following error:I am unsure if this error is also present in the original
nixos-rebuild
implementation, but can test if anyone is interested.Steps To Reproduce
Steps to reproduce the behavior:
c
sudo
and enablesudo-rs
with the following snippetnixos-rebuild --flake . --target-host <host> --sudo --ask-sudo-password switch
Expected behavior
Ideally
nixos-rebuild-ng
would work without error when usingsecurity.sudo-rs.enable = true;
.I appreciate though that it may be decided that this is an upstream issue for
sudo-rs
, and that is quite fair.A similar judgement was made with regard to
doas
in #366527Screenshots
I do not think they would convey any extra information.
Additional context
It would seem that the issue is that
sudo-rs
does not yet support the the--prompt
argument, or does so in a way divergent from the originalsudo
.The
sudo-rs
usage message does not mention a prompt arg anyway.Metadata
Notify maintainers
@thiagokokada
Note for maintainers: Please tag this issue in your PR.
Add a 👍 reaction to issues you find important.
The text was updated successfully, but these errors were encountered: