···45454646 # Must match version 4 times to ensure client and server git commits and versions are correct
4747 docker.succeed('[ $(docker version | grep ${pkgs.docker.version} | wc -l) = "4" ]')
4848+ docker.succeed("systemctl restart systemd-sysctl")
4949+ docker.succeed("grep 1 /proc/sys/net/ipv4/conf/all/forwarding")
5050+ docker.succeed("grep 1 /proc/sys/net/ipv4/conf/default/forwarding")
4851 '';
4952})
+20-1
nixos/tests/sudo.nix
···1010 maintainers = [ lschuermann ];
1111 };
12121313- machine =
1313+ nodes.machine =
1414 { lib, ... }:
1515 with lib;
1616 {
···4848 };
4949 };
50505151+ nodes.strict = { ... }: {
5252+ users.users = {
5353+ admin = { isNormalUser = true; extraGroups = [ "wheel" ]; };
5454+ noadmin = { isNormalUser = true; };
5555+ };
5656+5757+ security.sudo = {
5858+ enable = true;
5959+ wheelNeedsPassword = false;
6060+ execWheelOnly = true;
6161+ };
6262+ };
6363+5164 testScript =
5265 ''
5366 with subtest("users in wheel group should have passwordless sudo"):
···79928093 with subtest("users in group 'barfoo' should not be able to keep their environment"):
8194 machine.fail("sudo -u test3 sudo -n -E -u root true")
9595+9696+ with subtest("users in wheel should be able to run sudo despite execWheelOnly"):
9797+ strict.succeed('su - admin -c "sudo -u root true"')
9898+9999+ with subtest("non-wheel users should be unable to run sudo thanks to execWheelOnly"):
100100+ strict.fail('su - noadmin -c "sudo --help"')
82101 '';
83102 })