sshd: fix startWhenNeeded and listenAddresses combination
Previously, if startWhenNeeded was set, listenAddresses option was ignored and daemon was listening on all interfaces. Fixes #56325.
This commit is contained in:
@@ -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'");
|
||||
}
|
||||
'';
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user