Skip to content

Commit fedd7cd

Browse files
committed
nixos: explicitely set security.wrappers ownership
This is slightly more verbose and inconvenient, but it forces you to think about what the wrapper ownership and permissions will be.
1 parent 8f76a6e commit fedd7cd

39 files changed

+276
-72
lines changed

nixos/modules/programs/bandwhich.nix

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,10 @@ in {
2222
config = mkIf cfg.enable {
2323
environment.systemPackages = with pkgs; [ bandwhich ];
2424
security.wrappers.bandwhich = {
25-
source = "${pkgs.bandwhich}/bin/bandwhich";
25+
owner = "root";
26+
group = "root";
2627
capabilities = "cap_net_raw,cap_net_admin+ep";
28+
source = "${pkgs.bandwhich}/bin/bandwhich";
2729
};
2830
};
2931
}

nixos/modules/programs/captive-browser.nix

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,11 +105,15 @@ in
105105
);
106106

107107
security.wrappers.udhcpc = {
108+
owner = "root";
109+
group = "root";
108110
capabilities = "cap_net_raw+p";
109111
source = "${pkgs.busybox}/bin/udhcpc";
110112
};
111113

112114
security.wrappers.captive-browser = {
115+
owner = "root";
116+
group = "root";
113117
capabilities = "cap_net_raw+p";
114118
source = pkgs.writeShellScript "captive-browser" ''
115119
export PREV_CONFIG_HOME="$XDG_CONFIG_HOME"

nixos/modules/programs/firejail.nix

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,12 @@ in {
8181
};
8282

8383
config = mkIf cfg.enable {
84-
security.wrappers.firejail.source = "${lib.getBin pkgs.firejail}/bin/firejail";
84+
security.wrappers.firejail =
85+
{ setuid = true;
86+
owner = "root";
87+
group = "root";
88+
source = "${lib.getBin pkgs.firejail}/bin/firejail";
89+
};
8590

8691
environment.systemPackages = [ pkgs.firejail ] ++ [ wrappedBins ];
8792
};

nixos/modules/programs/gamemode.nix

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,8 @@ in
5656
polkit.enable = true;
5757
wrappers = mkIf cfg.enableRenice {
5858
gamemoded = {
59+
owner = "root";
60+
group = "root";
5961
source = "${pkgs.gamemode}/bin/gamemoded";
6062
capabilities = "cap_sys_nice+ep";
6163
};

nixos/modules/programs/iftop.nix

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,10 @@ in {
1111
config = mkIf cfg.enable {
1212
environment.systemPackages = [ pkgs.iftop ];
1313
security.wrappers.iftop = {
14-
source = "${pkgs.iftop}/bin/iftop";
14+
owner = "root";
15+
group = "root";
1516
capabilities = "cap_net_raw+p";
17+
source = "${pkgs.iftop}/bin/iftop";
1618
};
1719
};
1820
}

nixos/modules/programs/iotop.nix

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,10 @@ in {
1010
};
1111
config = mkIf cfg.enable {
1212
security.wrappers.iotop = {
13-
source = "${pkgs.iotop}/bin/iotop";
13+
owner = "root";
14+
group = "root";
1415
capabilities = "cap_net_admin+p";
16+
source = "${pkgs.iotop}/bin/iotop";
1517
};
1618
};
1719
}

nixos/modules/programs/kbdlight.nix

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,11 @@ in
1111

1212
config = mkIf cfg.enable {
1313
environment.systemPackages = [ pkgs.kbdlight ];
14-
security.wrappers.kbdlight.source = "${pkgs.kbdlight.out}/bin/kbdlight";
14+
security.wrappers.kbdlight =
15+
{ setuid = true;
16+
owner = "root";
17+
group = "root";
18+
source = "${pkgs.kbdlight.out}/bin/kbdlight";
19+
};
1520
};
1621
}

nixos/modules/programs/liboping.nix

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,10 @@ in {
1313
security.wrappers = mkMerge (map (
1414
exec: {
1515
"${exec}" = {
16-
source = "${pkgs.liboping}/bin/${exec}";
16+
owner = "root";
17+
group = "root";
1718
capabilities = "cap_net_raw+p";
19+
source = "${pkgs.liboping}/bin/${exec}";
1820
};
1921
}
2022
) [ "oping" "noping" ]);

nixos/modules/programs/mtr.nix

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,10 @@ in {
3131
environment.systemPackages = with pkgs; [ cfg.package ];
3232

3333
security.wrappers.mtr-packet = {
34-
source = "${cfg.package}/bin/mtr-packet";
34+
owner = "root";
35+
group = "root";
3536
capabilities = "cap_net_raw+p";
37+
source = "${cfg.package}/bin/mtr-packet";
3638
};
3739
};
3840
}

nixos/modules/programs/noisetorch.nix

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,10 @@ in {
1818

1919
config = mkIf cfg.enable {
2020
security.wrappers.noisetorch = {
21-
source = "${cfg.package}/bin/noisetorch";
21+
owner = "root";
22+
group = "root";
2223
capabilities = "cap_sys_resource=+ep";
24+
source = "${cfg.package}/bin/noisetorch";
2325
};
2426
};
2527
}

0 commit comments

Comments
 (0)