File tree Expand file tree Collapse file tree 3 files changed +20
-18
lines changed
pkgs/build-support/kernel/make-initrd-ng/src Expand file tree Collapse file tree 3 files changed +20
-18
lines changed Original file line number Diff line number Diff line change 12961296 systemd-initrd-luks-unl0kr = handleTest ./systemd-initrd-luks-unl0kr.nix { } ;
12971297 systemd-initrd-modprobe = handleTest ./systemd-initrd-modprobe.nix { } ;
12981298 systemd-initrd-shutdown = handleTest ./systemd-shutdown.nix { systemdStage1 = true ; } ;
1299- systemd-initrd-simple = handleTest ./systemd-initrd-simple.nix { } ;
1299+ systemd-initrd-simple = runTest ./systemd-initrd-simple.nix ;
13001300 systemd-initrd-swraid = handleTest ./systemd-initrd-swraid.nix { } ;
13011301 systemd-initrd-vconsole = handleTest ./systemd-initrd-vconsole.nix { } ;
13021302 systemd-initrd-networkd = handleTest ./systemd-initrd-networkd.nix { } ;
Original file line number Diff line number Diff line change 1- import ./make-test-python.nix (
2- { lib , pkgs , ... } :
3- {
4- name = "systemd-initrd-simple" ;
5-
6- nodes . machine =
7- { pkgs , ... } :
8- {
9- testing . initrdBackdoor = true ;
10- boot . initrd . systemd . enable = true ;
11- virtualisation . fileSystems . "/" . autoResize = true ;
12- } ;
13-
14- testScript = ''
1+ {
2+ name = "systemd-initrd-simple" ;
3+
4+ nodes . machine =
5+ { pkgs , ... } :
6+ {
7+ testing . initrdBackdoor = true ;
8+ boot . initrd . systemd . enable = true ;
9+ virtualisation . fileSystems . "/" . autoResize = true ;
10+ } ;
11+
12+ testScript =
13+ # python
14+ ''
1515 import subprocess
1616
1717 with subtest("testing initrd backdoor"):
@@ -50,6 +50,8 @@ import ./make-test-python.nix (
5050 newAvail = machine.succeed("df --output=avail / | sed 1d")
5151
5252 assert int(oldAvail) < int(newAvail), "File system did not grow"
53+
54+ with subtest("no warnings from systemd about write permissions"):
55+ machine.fail("journalctl -b 0 | grep 'is marked world-writable, which is a security risk as it is executed with privileges'")
5356 '' ;
54- }
55- )
57+ }
Original file line number Diff line number Diff line change @@ -212,7 +212,7 @@ fn copy_file<
212212 }
213213
214214 // Remove writable permissions
215- permissions. set_mode ( permissions. mode ( ) ^ 0o222 ) ;
215+ permissions. set_mode ( permissions. mode ( ) & 0o555 ) ;
216216 fs:: set_permissions ( & target, permissions)
217217 . wrap_err_with ( || format ! ( "failed to remove writable permissions for {:?}" , target) ) ?;
218218 } ;
You can’t perform that action at this time.
0 commit comments