summary refs log tree commit diff
path: root/nixos/tests/openssh.nix
diff options
context:
space:
mode:
authorNikita Uvarov <uv.nikita@gmail.com>2019-02-25 00:48:01 +0100
committerNikita Uvarov <uv.nikita@gmail.com>2019-02-25 00:51:58 +0100
commit131e31cd1b7bbef6214a0e711136bf4093fde7b5 (patch)
tree00c0513e436b3e60a90bbd658b4a8b76cedb1f4b /nixos/tests/openssh.nix
parent8a791f0b83127036ca774ac27e5329e4c6818706 (diff)
downloadnixpkgs-131e31cd1b7bbef6214a0e711136bf4093fde7b5.tar
nixpkgs-131e31cd1b7bbef6214a0e711136bf4093fde7b5.tar.gz
nixpkgs-131e31cd1b7bbef6214a0e711136bf4093fde7b5.tar.bz2
nixpkgs-131e31cd1b7bbef6214a0e711136bf4093fde7b5.tar.lz
nixpkgs-131e31cd1b7bbef6214a0e711136bf4093fde7b5.tar.xz
nixpkgs-131e31cd1b7bbef6214a0e711136bf4093fde7b5.tar.zst
nixpkgs-131e31cd1b7bbef6214a0e711136bf4093fde7b5.zip
sshd: fix startWhenNeeded and listenAddresses combination
Previously, if startWhenNeeded was set, listenAddresses option was
ignored and daemon was listening on all interfaces.
Fixes #56325.
Diffstat (limited to 'nixos/tests/openssh.nix')
-rw-r--r--nixos/tests/openssh.nix23
1 files changed, 23 insertions, 0 deletions
diff --git a/nixos/tests/openssh.nix b/nixos/tests/openssh.nix
index 219a20c5c7e..8b9e2170f15 100644
--- a/nixos/tests/openssh.nix
+++ b/nixos/tests/openssh.nix
@@ -34,6 +34,24 @@ in {
         ];
       };
 
+    server_localhost_only =
+      { ... }:
+
+      {
+        services.openssh = {
+          enable = true; listenAddresses = [ { addr = "127.0.0.1"; port = 22; } ];
+        };
+      };
+
+    server_localhost_only_lazy =
+      { ... }:
+
+      {
+        services.openssh = {
+          enable = true; startWhenNeeded = true; listenAddresses = [ { addr = "127.0.0.1"; port = 22; } ];
+        };
+      };
+
     client =
       { ... }: { };
 
@@ -77,5 +95,10 @@ in {
                        " server_lazy true");
 
     };
+
+    subtest "localhost-only", sub {
+      $server_localhost_only->succeed("ss -nlt | grep '127.0.0.1:22'");
+      $server_localhost_only_lazy->succeed("ss -nlt | grep '127.0.0.1:22'");
+    }
   '';
 })