summary refs log tree commit diff
path: root/nixos/tests
diff options
context:
space:
mode:
authorgithub-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>2021-05-09 12:23:16 +0000
committerGitHub <noreply@github.com>2021-05-09 12:23:16 +0000
commitbc1f4b790e211dc578c2655b76c525707a07bc07 (patch)
tree1c1e0569f09e82935784a6d6f43f3b85b42e4e8a /nixos/tests
parent5663b2b2d385c06bffeb8514dec22d5e2838bdcb (diff)
parent2c1a792911ae079699ea8ec9860987de525e7351 (diff)
downloadnixpkgs-bc1f4b790e211dc578c2655b76c525707a07bc07.tar
nixpkgs-bc1f4b790e211dc578c2655b76c525707a07bc07.tar.gz
nixpkgs-bc1f4b790e211dc578c2655b76c525707a07bc07.tar.bz2
nixpkgs-bc1f4b790e211dc578c2655b76c525707a07bc07.tar.lz
nixpkgs-bc1f4b790e211dc578c2655b76c525707a07bc07.tar.xz
nixpkgs-bc1f4b790e211dc578c2655b76c525707a07bc07.tar.zst
nixpkgs-bc1f4b790e211dc578c2655b76c525707a07bc07.zip
Merge master into staging-next
Diffstat (limited to 'nixos/tests')
-rw-r--r--nixos/tests/docker.nix3
-rw-r--r--nixos/tests/sudo.nix21
2 files changed, 23 insertions, 1 deletions
diff --git a/nixos/tests/docker.nix b/nixos/tests/docker.nix
index 58e33535ed3..dee7480eb4a 100644
--- a/nixos/tests/docker.nix
+++ b/nixos/tests/docker.nix
@@ -45,5 +45,8 @@ import ./make-test-python.nix ({ pkgs, ...} : {
 
     # Must match version 4 times to ensure client and server git commits and versions are correct
     docker.succeed('[ $(docker version | grep ${pkgs.docker.version} | wc -l) = "4" ]')
+    docker.succeed("systemctl restart systemd-sysctl")
+    docker.succeed("grep 1 /proc/sys/net/ipv4/conf/all/forwarding")
+    docker.succeed("grep 1 /proc/sys/net/ipv4/conf/default/forwarding")
   '';
 })
diff --git a/nixos/tests/sudo.nix b/nixos/tests/sudo.nix
index 2a85c490665..4885d6e17b8 100644
--- a/nixos/tests/sudo.nix
+++ b/nixos/tests/sudo.nix
@@ -10,7 +10,7 @@ in
       maintainers = [ lschuermann ];
     };
 
-    machine =
+    nodes.machine =
       { lib, ... }:
       with lib;
       {
@@ -48,6 +48,19 @@ in
         };
       };
 
+    nodes.strict = { ... }: {
+      users.users = {
+        admin = { isNormalUser = true; extraGroups = [ "wheel" ]; };
+        noadmin = { isNormalUser = true; };
+      };
+
+      security.sudo = {
+        enable = true;
+        wheelNeedsPassword = false;
+        execWheelOnly = true;
+      };
+    };
+
     testScript =
       ''
         with subtest("users in wheel group should have passwordless sudo"):
@@ -79,5 +92,11 @@ in
 
         with subtest("users in group 'barfoo' should not be able to keep their environment"):
             machine.fail("sudo -u test3 sudo -n -E -u root true")
+
+        with subtest("users in wheel should be able to run sudo despite execWheelOnly"):
+            strict.succeed('su - admin -c "sudo -u root true"')
+
+        with subtest("non-wheel users should be unable to run sudo thanks to execWheelOnly"):
+            strict.fail('su - noadmin -c "sudo --help"')
       '';
   })