Skip to content
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: add option --use-remote-sudo-activate #109046

Closed
wants to merge 1 commit into from

Conversation

oxalica
Copy link
Contributor

@oxalica oxalica commented Jan 11, 2021

Motivation for this change

Current option --use-remote-sudo doesn't work when remote sudo asking for password.
And it also cause all command to be prefixed by sudo, including commands for building, copying and querying,
which usually doesn't need root permission at all.

In this PR:

  • Added an option --use-remote-sudo-activate for minimal usage of sudo, which only acquire root permission on activation related commands.
  • Added -t for ssh when sudo is used. This is needed when sudo asking for password.

Tested commands test and boot with --target-host --use-remote-sudo-activate.

Related commits:

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS linux)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Ensured that relevant documentation is up to date
  • Fits CONTRIBUTING.md.

@stale
Copy link

stale bot commented Oct 12, 2021

I marked this as stale due to inactivity. → More info

@stale stale bot added the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Oct 12, 2021
@iagocq
Copy link
Member

iagocq commented Oct 12, 2021

still relevant to me, as it makes remote passwords work

@stale stale bot removed the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Nov 15, 2021
@SuperSandro2000 SuperSandro2000 added the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Nov 15, 2021
@noonien
Copy link

noonien commented Dec 9, 2021

I'm also facing this issue, currently the solution is either to deploy with a separate script, or have paswordless sudo which is a major security issue IMO.

@stale stale bot removed the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Dec 9, 2021
@stale stale bot added the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Jun 12, 2022
@FRidh
Copy link
Member

FRidh commented Jun 15, 2022

I think the old option needs to be changed to this. As mentioned, the old behavior is insecure, so that is enough reason to change it's behavior.

@stale stale bot removed the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Jun 15, 2022
@stale stale bot added the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Jan 8, 2023
@oxalica oxalica closed this Jan 22, 2024
@oxalica oxalica deleted the fix/nixos-rebuild-remote-sudo branch January 22, 2024 20:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants