nixos/lock-kernel-modules: reorder before/after

Moving the service before multi-user.target (so the `hardened` test
continue to work the way it did before) can result in locking the kernel
too early. It's better to lock it a bit later and changing the test to
wait specifically for the disable-kernel-module-loading.service.

rnhmjoj 1bd7260a 5aef5e8d

Changed files
+2 -1
nixos
modules
tests
+1 -1
nixos/modules/security/lock-kernel-modules.nix
···
wants = [ "systemd-udevd.service" ];
wantedBy = [ config.systemd.defaultUnit ];
-
before = [ config.systemd.defaultUnit ];
after =
[ "firewall.service"
"systemd-modules-load.service"
+
config.systemd.defaultUnit
];
unitConfig.ConditionPathIsReadWrite = "/proc/sys/kernel";
+1
nixos/tests/hardened.nix
···
# Test kernel module hardening
with subtest("No more kernel modules can be loaded"):
# note: this better a be module we normally wouldn't load ...
+
machine.wait_for_unit("disable-kernel-module-loading.service")
machine.fail("modprobe dccp")