aboutsummaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorDamien Cassou <damien@cassou.me>2020-06-01 16:50:34 +0200
committerRobert Helgesson <robert@rycee.net>2020-06-03 23:16:43 +0200
commita21c97d0113ebc43983ff688b2d9abddd07d6f6e (patch)
tree0b368e62c0d75593160094cd82ae5acab9b587d4 /modules
parentdd50dc4c13b5676b45f40a286199fcad71ad211d (diff)
ssh: add support for ServerAliveCountMax
PR #1299
Diffstat (limited to 'modules')
-rw-r--r--modules/misc/news.nix15
-rw-r--r--modules/programs/ssh.nix23
2 files changed, 37 insertions, 1 deletions
diff --git a/modules/misc/news.nix b/modules/misc/news.nix
index 933446aa19e..4f962eaddcf 100644
--- a/modules/misc/news.nix
+++ b/modules/misc/news.nix
@@ -1527,6 +1527,21 @@ in
A new module is available: 'programs.zoxide'
'';
}
+
+ {
+ time = "2020-06-03T17:46:11+00:00";
+ condition = config.programs.ssh.enable;
+ message = ''
+ The ssh module now supports the 'ServerAliveCountMax' option
+ both globally through
+
+ programs.ssh.serverAliveCountMax
+
+ and per match blocks
+
+ programs.ssh.matchBlocks.<name>.serverAliveCountMax
+ '';
+ }
];
};
}
diff --git a/modules/programs/ssh.nix b/modules/programs/ssh.nix
index 95d4edc4b0b..ae1f221803c 100644
--- a/modules/programs/ssh.nix
+++ b/modules/programs/ssh.nix
@@ -143,6 +143,15 @@ let
"Set timeout in seconds after which response will be requested.";
};
+ serverAliveCountMax = mkOption {
+ type = types.ints.positive;
+ default = 3;
+ description = ''
+ Sets the number of server alive messages which may be sent
+ without SSH receiving any messages back from the server.
+ '';
+ };
+
sendEnv = mkOption {
type = types.listOf types.str;
default = [];
@@ -281,7 +290,9 @@ let
++ optional (cf.addressFamily != null) " AddressFamily ${cf.addressFamily}"
++ optional (cf.sendEnv != []) " SendEnv ${unwords cf.sendEnv}"
++ optional (cf.serverAliveInterval != 0)
- " ServerAliveInterval ${toString cf.serverAliveInterval}"
+ " ServerAliveInterval ${toString cf.serverAliveInterval}"
+ ++ optional (cf.serverAliveCountMax != 3)
+ " ServerAliveCountMax ${toString cf.serverAliveCountMax}"
++ optional (cf.compression != null) " Compression ${yn cf.compression}"
++ optional (!cf.checkHostIP) " CheckHostIP no"
++ optional (cf.proxyCommand != null) " ProxyCommand ${cf.proxyCommand}"
@@ -325,6 +336,15 @@ in
'';
};
+ serverAliveCountMax = mkOption {
+ type = types.ints.positive;
+ default = 3;
+ description = ''
+ Sets the default number of server alive messages which may be
+ sent without SSH receiving any messages back from the server.
+ '';
+ };
+
hashKnownHosts = mkOption {
default = false;
type = types.bool;
@@ -459,6 +479,7 @@ in
ForwardAgent ${yn cfg.forwardAgent}
Compression ${yn cfg.compression}
ServerAliveInterval ${toString cfg.serverAliveInterval}
+ ServerAliveCountMax ${toString cfg.serverAliveCountMax}
HashKnownHosts ${yn cfg.hashKnownHosts}
UserKnownHostsFile ${cfg.userKnownHostsFile}
ControlMaster ${cfg.controlMaster}