summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Kettlewell <rjk@greenend.org.uk>2014-02-09 16:09:52 +0000
committerColin Watson <cjwatson@debian.org>2016-01-04 15:07:00 +0000
commit8f53616f872acf853b52e94f5b0668c78bf0cb76 (patch)
tree4ba3e39648647e03c80276adb062cea38d72f4d6
parent6b1e8291597ff151b913c470f4af4b04ddec5c7d (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-11-29 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 522ad373c..46c343f30 100644
--- a/readconf.c
+++ b/readconf.c
@@ -160,6 +160,7 @@ typedef enum {
160 oStreamLocalBindMask, oStreamLocalBindUnlink, oRevokedHostKeys, 160 oStreamLocalBindMask, oStreamLocalBindUnlink, oRevokedHostKeys,
161 oFingerprintHash, oUpdateHostkeys, oHostbasedKeyTypes, 161 oFingerprintHash, oUpdateHostkeys, oHostbasedKeyTypes,
162 oPubkeyAcceptedKeyTypes, 162 oPubkeyAcceptedKeyTypes,
163 oProtocolKeepAlives, oSetupTimeOut,
163 oIgnoredUnknownOption, oDeprecated, oUnsupported 164 oIgnoredUnknownOption, oDeprecated, oUnsupported
164} OpCodes; 165} OpCodes;
165 166
@@ -290,6 +291,8 @@ static struct {
290 { "hostbasedkeytypes", oHostbasedKeyTypes }, 291 { "hostbasedkeytypes", oHostbasedKeyTypes },
291 { "pubkeyacceptedkeytypes", oPubkeyAcceptedKeyTypes }, 292 { "pubkeyacceptedkeytypes", oPubkeyAcceptedKeyTypes },
292 { "ignoreunknown", oIgnoreUnknown }, 293 { "ignoreunknown", oIgnoreUnknown },
294 { "protocolkeepalives", oProtocolKeepAlives },
295 { "setuptimeout", oSetupTimeOut },
293 296
294 { NULL, oBadOption } 297 { NULL, oBadOption }
295}; 298};
@@ -1304,6 +1307,8 @@ parse_keytypes:
1304 goto parse_flag; 1307 goto parse_flag;
1305 1308
1306 case oServerAliveInterval: 1309 case oServerAliveInterval:
1310 case oProtocolKeepAlives: /* Debian-specific compatibility alias */
1311 case oSetupTimeOut: /* Debian-specific compatibility alias */
1307 intptr = &options->server_alive_interval; 1312 intptr = &options->server_alive_interval;
1308 goto parse_time; 1313 goto parse_time;
1309 1314
@@ -1856,8 +1861,13 @@ fill_default_options(Options * options)
1856 options->rekey_interval = 0; 1861 options->rekey_interval = 0;
1857 if (options->verify_host_key_dns == -1) 1862 if (options->verify_host_key_dns == -1)
1858 options->verify_host_key_dns = 0; 1863 options->verify_host_key_dns = 0;
1859 if (options->server_alive_interval == -1) 1864 if (options->server_alive_interval == -1) {
1860 options->server_alive_interval = 0; 1865 /* in batch mode, default is 5mins */
1866 if (options->batch_mode == 1)
1867 options->server_alive_interval = 300;
1868 else
1869 options->server_alive_interval = 0;
1870 }
1861 if (options->server_alive_count_max == -1) 1871 if (options->server_alive_count_max == -1)
1862 options->server_alive_count_max = 3; 1872 options->server_alive_count_max = 3;
1863 if (options->control_master == -1) 1873 if (options->control_master == -1)
diff --git a/ssh_config.5 b/ssh_config.5
index cac8cdaa7..78e918a0e 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
@@ -1476,8 +1480,15 @@ from the server,
1476will send a message through the encrypted 1480will send a message through the encrypted
1477channel to request a response from the server. 1481channel to request a response from the server.
1478The default 1482The default
1479is 0, indicating that these messages will not be sent to the server. 1483is 0, indicating that these messages will not be sent to the server,
1484or 300 if the
1485.Cm BatchMode
1486option is set.
1480This option applies to protocol version 2 only. 1487This option applies to protocol version 2 only.
1488.Cm ProtocolKeepAlives
1489and
1490.Cm SetupTimeOut
1491are Debian-specific compatibility aliases for this option.
1481.It Cm StreamLocalBindMask 1492.It Cm StreamLocalBindMask
1482Sets the octal file creation mode mask 1493Sets the octal file creation mode mask
1483.Pq umask 1494.Pq umask
@@ -1543,6 +1554,12 @@ Specifies whether the system should send TCP keepalive messages to the
1543other side. 1554other side.
1544If they are sent, death of the connection or crash of one 1555If they are sent, death of the connection or crash of one
1545of the machines will be properly noticed. 1556of the machines will be properly noticed.
1557This option only uses TCP keepalives (as opposed to using ssh level
1558keepalives), so takes a long time to notice when the connection dies.
1559As such, you probably want
1560the
1561.Cm ServerAliveInterval
1562option as well.
1546However, this means that 1563However, this means that
1547connections will die if the route is down temporarily, and some people 1564connections will die if the route is down temporarily, and some people
1548find it annoying. 1565find it annoying.
diff --git a/sshd_config.5 b/sshd_config.5
index 5491c89cf..c8ee35dfc 100644
--- a/sshd_config.5
+++ b/sshd_config.5
@@ -1510,6 +1510,9 @@ This avoids infinitely hanging sessions.
1510.Pp 1510.Pp
1511To disable TCP keepalive messages, the value should be set to 1511To disable TCP keepalive messages, the value should be set to
1512.Dq no . 1512.Dq no .
1513.Pp
1514This option was formerly called
1515.Cm KeepAlive .
1513.It Cm TrustedUserCAKeys 1516.It Cm TrustedUserCAKeys
1514Specifies a file containing public keys of certificate authorities that are 1517Specifies a file containing public keys of certificate authorities that are
1515trusted to sign user certificates for authentication, or 1518trusted to sign user certificates for authentication, or