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-08-19 17:09:56 +0100
commit02a61bcb045503a5f3f7e274ac1f4524e30f87c8 (patch)
treee8596ef7152befbf784abcc1a683347a59490e45
parentb3d7661669a0f5255ede81f82c25951aeba9576c (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 f7510b6ce..21d3e9440 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
@@ -1425,8 +1429,15 @@ from the server,
1425will send a message through the encrypted 1429will send a message through the encrypted
1426channel to request a response from the server. 1430channel to request a response from the server.
1427The default 1431The default
1428is 0, indicating that these messages will not be sent to the server. 1432is 0, indicating that these messages will not be sent to the server,
1433or 300 if the
1434.Cm BatchMode
1435option is set.
1429This option applies to protocol version 2 only. 1436This option applies to protocol version 2 only.
1437.Cm ProtocolKeepAlives
1438and
1439.Cm SetupTimeOut
1440are Debian-specific compatibility aliases for this option.
1430.It Cm StreamLocalBindMask 1441.It Cm StreamLocalBindMask
1431Sets the octal file creation mode mask 1442Sets the octal file creation mode mask
1432.Pq umask 1443.Pq umask
@@ -1492,6 +1503,12 @@ Specifies whether the system should send TCP keepalive messages to the
1492other side. 1503other side.
1493If they are sent, death of the connection or crash of one 1504If they are sent, death of the connection or crash of one
1494of the machines will be properly noticed. 1505of the machines will be properly noticed.
1506This option only uses TCP keepalives (as opposed to using ssh level
1507keepalives), so takes a long time to notice when the connection dies.
1508As such, you probably want
1509the
1510.Cm ServerAliveInterval
1511option as well.
1495However, this means that 1512However, this means that
1496connections will die if the route is down temporarily, and some people 1513connections will die if the route is down temporarily, and some people
1497find it annoying. 1514find 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