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 16:33:32 +0100
commit7efad61f1e562f504a5ff3fb0ae90ac05a208e66 (patch)
tree4802f0e3934b5f7b47be21cd7195ada8442f6754
parent396f7d932b391fc92ac7ccdf8813f49564e2bbab (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 278fe152b..1d2d59648 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 dd35dd8d1..250c0d15a 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
@@ -1420,8 +1424,15 @@ from the server,
1420will send a message through the encrypted 1424will send a message through the encrypted
1421channel to request a response from the server. 1425channel to request a response from the server.
1422The default 1426The default
1423is 0, indicating that these messages will not be sent to the server. 1427is 0, indicating that these messages will not be sent to the server,
1428or 300 if the
1429.Cm BatchMode
1430option is set.
1424This option applies to protocol version 2 only. 1431This option applies to protocol version 2 only.
1432.Cm ProtocolKeepAlives
1433and
1434.Cm SetupTimeOut
1435are Debian-specific compatibility aliases for this option.
1425.It Cm StreamLocalBindMask 1436.It Cm StreamLocalBindMask
1426Sets the octal file creation mode mask 1437Sets the octal file creation mode mask
1427.Pq umask 1438.Pq umask
@@ -1487,6 +1498,12 @@ Specifies whether the system should send TCP keepalive messages to the
1487other side. 1498other side.
1488If they are sent, death of the connection or crash of one 1499If they are sent, death of the connection or crash of one
1489of the machines will be properly noticed. 1500of the machines will be properly noticed.
1501This option only uses TCP keepalives (as opposed to using ssh level
1502keepalives), so takes a long time to notice when the connection dies.
1503As such, you probably want
1504the
1505.Cm ServerAliveInterval
1506option as well.
1490However, this means that 1507However, this means that
1491connections will die if the route is down temporarily, and some people 1508connections will die if the route is down temporarily, and some people
1492find it annoying. 1509find it annoying.
diff --git a/sshd_config.5 b/sshd_config.5
index 033149695..d14576e69 100644
--- a/sshd_config.5
+++ b/sshd_config.5
@@ -1392,6 +1392,9 @@ This avoids infinitely hanging sessions.
1392.Pp 1392.Pp
1393To disable TCP keepalive messages, the value should be set to 1393To disable TCP keepalive messages, the value should be set to
1394.Dq no . 1394.Dq no .
1395.Pp
1396This option was formerly called
1397.Cm KeepAlive .
1395.It Cm TrustedUserCAKeys 1398.It Cm TrustedUserCAKeys
1396Specifies a file containing public keys of certificate authorities that are 1399Specifies a file containing public keys of certificate authorities that are
1397trusted to sign user certificates for authentication. 1400trusted to sign user certificates for authentication.