summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Kettlewell <rjk@greenend.org.uk>2014-02-09 16:09:52 +0000
committerColin Watson <cjwatson@debian.org>2015-09-17 13:52:39 +0100
commit302a74ce4e7eb60564410f482cb5778a3dec2e96 (patch)
tree68c0b28f89892c2669ee2e1c11d2571310b9dfda
parent634f3188e7f3c104cc7b13a078059f15f3f4a68a (diff)
Various keepalive extensions
Add compatibility aliases for ProtocolKeepAlives and SetupTimeOut, supported in previous versions of Debian's OpenSSH package but since superseded by ServerAliveInterval. (We're probably stuck with this bit for compatibility.) In batch mode, default ServerAliveInterval to five minutes. Adjust documentation to match and to give some more advice on use of keepalives. Author: Ian Jackson <ian@chiark.greenend.org.uk> Author: Matthew Vernon <matthew@debian.org> Author: Colin Watson <cjwatson@debian.org> Last-Update: 2015-08-19 Patch-Name: keepalive-extensions.patch
-rw-r--r--readconf.c14
-rw-r--r--ssh_config.521
-rw-r--r--sshd_config.53
3 files changed, 34 insertions, 4 deletions
diff --git a/readconf.c b/readconf.c
index 85eea4800..5c5890c88 100644
--- a/readconf.c
+++ b/readconf.c
@@ -159,6 +159,7 @@ typedef enum {
159 oCanonicalizeFallbackLocal, oCanonicalizePermittedCNAMEs, 159 oCanonicalizeFallbackLocal, oCanonicalizePermittedCNAMEs,
160 oStreamLocalBindMask, oStreamLocalBindUnlink, oRevokedHostKeys, 160 oStreamLocalBindMask, oStreamLocalBindUnlink, oRevokedHostKeys,
161 oFingerprintHash, oUpdateHostkeys, oHostbasedKeyTypes, 161 oFingerprintHash, oUpdateHostkeys, oHostbasedKeyTypes,
162 oProtocolKeepAlives, oSetupTimeOut,
162 oIgnoredUnknownOption, oDeprecated, oUnsupported 163 oIgnoredUnknownOption, oDeprecated, oUnsupported
163} OpCodes; 164} OpCodes;
164 165
@@ -288,6 +289,8 @@ static struct {
288 { "updatehostkeys", oUpdateHostkeys }, 289 { "updatehostkeys", oUpdateHostkeys },
289 { "hostbasedkeytypes", oHostbasedKeyTypes }, 290 { "hostbasedkeytypes", oHostbasedKeyTypes },
290 { "ignoreunknown", oIgnoreUnknown }, 291 { "ignoreunknown", oIgnoreUnknown },
292 { "protocolkeepalives", oProtocolKeepAlives },
293 { "setuptimeout", oSetupTimeOut },
291 294
292 { NULL, oBadOption } 295 { NULL, oBadOption }
293}; 296};
@@ -1299,6 +1302,8 @@ parse_int:
1299 goto parse_flag; 1302 goto parse_flag;
1300 1303
1301 case oServerAliveInterval: 1304 case oServerAliveInterval:
1305 case oProtocolKeepAlives: /* Debian-specific compatibility alias */
1306 case oSetupTimeOut: /* Debian-specific compatibility alias */
1302 intptr = &options->server_alive_interval; 1307 intptr = &options->server_alive_interval;
1303 goto parse_time; 1308 goto parse_time;
1304 1309
@@ -1858,8 +1863,13 @@ fill_default_options(Options * options)
1858 options->rekey_interval = 0; 1863 options->rekey_interval = 0;
1859 if (options->verify_host_key_dns == -1) 1864 if (options->verify_host_key_dns == -1)
1860 options->verify_host_key_dns = 0; 1865 options->verify_host_key_dns = 0;
1861 if (options->server_alive_interval == -1) 1866 if (options->server_alive_interval == -1) {
1862 options->server_alive_interval = 0; 1867 /* in batch mode, default is 5mins */
1868 if (options->batch_mode == 1)
1869 options->server_alive_interval = 300;
1870 else
1871 options->server_alive_interval = 0;
1872 }
1863 if (options->server_alive_count_max == -1) 1873 if (options->server_alive_count_max == -1)
1864 options->server_alive_count_max = 3; 1874 options->server_alive_count_max = 3;
1865 if (options->control_master == -1) 1875 if (options->control_master == -1)
diff --git a/ssh_config.5 b/ssh_config.5
index e60a5b4ea..67e0dff9a 100644
--- a/ssh_config.5
+++ b/ssh_config.5
@@ -233,8 +233,12 @@ Valid arguments are
233If set to 233If set to
234.Dq yes , 234.Dq yes ,
235passphrase/password querying will be disabled. 235passphrase/password querying will be disabled.
236In addition, the
237.Cm ServerAliveInterval
238option will be set to 300 seconds by default.
236This option is useful in scripts and other batch jobs where no user 239This option is useful in scripts and other batch jobs where no user
237is present to supply the password. 240is present to supply the password,
241and where it is desirable to detect a broken network swiftly.
238The argument must be 242The argument must be
239.Dq yes 243.Dq yes
240or 244or
@@ -1427,8 +1431,15 @@ from the server,
1427will send a message through the encrypted 1431will send a message through the encrypted
1428channel to request a response from the server. 1432channel to request a response from the server.
1429The default 1433The default
1430is 0, indicating that these messages will not be sent to the server. 1434is 0, indicating that these messages will not be sent to the server,
1435or 300 if the
1436.Cm BatchMode
1437option is set.
1431This option applies to protocol version 2 only. 1438This option applies to protocol version 2 only.
1439.Cm ProtocolKeepAlives
1440and
1441.Cm SetupTimeOut
1442are Debian-specific compatibility aliases for this option.
1432.It Cm StreamLocalBindMask 1443.It Cm StreamLocalBindMask
1433Sets the octal file creation mode mask 1444Sets the octal file creation mode mask
1434.Pq umask 1445.Pq umask
@@ -1494,6 +1505,12 @@ Specifies whether the system should send TCP keepalive messages to the
1494other side. 1505other side.
1495If they are sent, death of the connection or crash of one 1506If they are sent, death of the connection or crash of one
1496of the machines will be properly noticed. 1507of the machines will be properly noticed.
1508This option only uses TCP keepalives (as opposed to using ssh level
1509keepalives), so takes a long time to notice when the connection dies.
1510As such, you probably want
1511the
1512.Cm ServerAliveInterval
1513option as well.
1497However, this means that 1514However, this means that
1498connections will die if the route is down temporarily, and some people 1515connections will die if the route is down temporarily, and some people
1499find it annoying. 1516find it annoying.
diff --git a/sshd_config.5 b/sshd_config.5
index 68424f110..1269bbd40 100644
--- a/sshd_config.5
+++ b/sshd_config.5
@@ -1443,6 +1443,9 @@ This avoids infinitely hanging sessions.
1443.Pp 1443.Pp
1444To disable TCP keepalive messages, the value should be set to 1444To disable TCP keepalive messages, the value should be set to
1445.Dq no . 1445.Dq no .
1446.Pp
1447This option was formerly called
1448.Cm KeepAlive .
1446.It Cm TrustedUserCAKeys 1449.It Cm TrustedUserCAKeys
1447Specifies a file containing public keys of certificate authorities that are 1450Specifies a file containing public keys of certificate authorities that are
1448trusted to sign user certificates for authentication, or 1451trusted to sign user certificates for authentication, or