Skip to content

Commit

Permalink
Merge pull request #154 from jschpp/fix_nix_polkit
Browse files Browse the repository at this point in the history
Fixed ci tests for run0
  • Loading branch information
ifd3f authored Nov 27, 2024
2 parents a2a9dc0 + ed40d17 commit cd50799
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
2 changes: 2 additions & 0 deletions checks/autoescalate/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ nixosTest {
else if escalationTool == "run0" then {
security.sudo.enable = mkForce false;

security.polkit.enable = true;

# see https://warlord0blog.wordpress.com/2024/07/30/passwordless-run0/
security.polkit.extraConfig = ''
polkit.addRule(function(action, subject) {
Expand Down
4 changes: 2 additions & 2 deletions checks/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ in with lib;
pkgs.callPackage ./autoescalate { escalationTool = "doas"; };
autoescalate-sudo =
pkgs.callPackage ./autoescalate { escalationTool = "sudo"; };
# autoescalate-run0 =
# pkgs.callPackage ./autoescalate { escalationTool = "run0"; };
autoescalate-run0 =
pkgs.callPackage ./autoescalate { escalationTool = "run0"; };
} //

# blocksize alignment tests
Expand Down
4 changes: 3 additions & 1 deletion src/escalation/unix.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ pub struct Command<'a> {
}

impl EscalationMethod {
const ALL: [EscalationMethod; 4] = [Self::Sudo, Self::Doas, Self::Su, Self::Run0];
// Order is relevant here. Since this array is enumerated in `EscalationMethod::detect()`
// The first esalation found tool will be used
const ALL: [EscalationMethod; 4] = [Self::Sudo, Self::Doas, Self::Run0, Self::Su];

pub fn detect() -> Result<Self, Error> {
for m in Self::ALL {
Expand Down

0 comments on commit cd50799

Please sign in to comment.