diff options
author | Richard Kettlewell <rjk@greenend.org.uk> | 2014-02-09 16:09:52 +0000 |
---|---|---|
committer | Colin Watson <cjwatson@debian.org> | 2020-02-21 12:06:03 +0000 |
commit | 3558be2914c0127489faae40ce2eae66142c3287 (patch) | |
tree | 25a77cf5d70b22f2ac271625b93c2872a14cf7b1 | |
parent | 11d571f137c76d8c2e38b1c1a537b04cc279f8e3 (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: 2020-02-21
Patch-Name: keepalive-extensions.patch
-rw-r--r-- | readconf.c | 14 | ||||
-rw-r--r-- | ssh_config.5 | 21 | ||||
-rw-r--r-- | sshd_config.5 | 3 |
3 files changed, 34 insertions, 4 deletions
diff --git a/readconf.c b/readconf.c index 0fc996871..2399208f8 100644 --- a/readconf.c +++ b/readconf.c | |||
@@ -176,6 +176,7 @@ typedef enum { | |||
176 | oFingerprintHash, oUpdateHostkeys, oHostbasedKeyTypes, | 176 | oFingerprintHash, oUpdateHostkeys, oHostbasedKeyTypes, |
177 | oPubkeyAcceptedKeyTypes, oCASignatureAlgorithms, oProxyJump, | 177 | oPubkeyAcceptedKeyTypes, oCASignatureAlgorithms, oProxyJump, |
178 | oSecurityKeyProvider, | 178 | oSecurityKeyProvider, |
179 | oProtocolKeepAlives, oSetupTimeOut, | ||
179 | oIgnore, oIgnoredUnknownOption, oDeprecated, oUnsupported | 180 | oIgnore, oIgnoredUnknownOption, oDeprecated, oUnsupported |
180 | } OpCodes; | 181 | } OpCodes; |
181 | 182 | ||
@@ -326,6 +327,8 @@ static struct { | |||
326 | { "ignoreunknown", oIgnoreUnknown }, | 327 | { "ignoreunknown", oIgnoreUnknown }, |
327 | { "proxyjump", oProxyJump }, | 328 | { "proxyjump", oProxyJump }, |
328 | { "securitykeyprovider", oSecurityKeyProvider }, | 329 | { "securitykeyprovider", oSecurityKeyProvider }, |
330 | { "protocolkeepalives", oProtocolKeepAlives }, | ||
331 | { "setuptimeout", oSetupTimeOut }, | ||
329 | 332 | ||
330 | { NULL, oBadOption } | 333 | { NULL, oBadOption } |
331 | }; | 334 | }; |
@@ -1495,6 +1498,8 @@ parse_keytypes: | |||
1495 | goto parse_flag; | 1498 | goto parse_flag; |
1496 | 1499 | ||
1497 | case oServerAliveInterval: | 1500 | case oServerAliveInterval: |
1501 | case oProtocolKeepAlives: /* Debian-specific compatibility alias */ | ||
1502 | case oSetupTimeOut: /* Debian-specific compatibility alias */ | ||
1498 | intptr = &options->server_alive_interval; | 1503 | intptr = &options->server_alive_interval; |
1499 | goto parse_time; | 1504 | goto parse_time; |
1500 | 1505 | ||
@@ -2198,8 +2203,13 @@ fill_default_options(Options * options) | |||
2198 | options->rekey_interval = 0; | 2203 | options->rekey_interval = 0; |
2199 | if (options->verify_host_key_dns == -1) | 2204 | if (options->verify_host_key_dns == -1) |
2200 | options->verify_host_key_dns = 0; | 2205 | options->verify_host_key_dns = 0; |
2201 | if (options->server_alive_interval == -1) | 2206 | if (options->server_alive_interval == -1) { |
2202 | options->server_alive_interval = 0; | 2207 | /* in batch mode, default is 5mins */ |
2208 | if (options->batch_mode == 1) | ||
2209 | options->server_alive_interval = 300; | ||
2210 | else | ||
2211 | options->server_alive_interval = 0; | ||
2212 | } | ||
2203 | if (options->server_alive_count_max == -1) | 2213 | if (options->server_alive_count_max == -1) |
2204 | options->server_alive_count_max = 3; | 2214 | options->server_alive_count_max = 3; |
2205 | if (options->control_master == -1) | 2215 | if (options->control_master == -1) |
diff --git a/ssh_config.5 b/ssh_config.5 index 3f4906972..3079db19b 100644 --- a/ssh_config.5 +++ b/ssh_config.5 | |||
@@ -266,9 +266,13 @@ If set to | |||
266 | .Cm yes , | 266 | .Cm yes , |
267 | user interaction such as password prompts and host key confirmation requests | 267 | user interaction such as password prompts and host key confirmation requests |
268 | will be disabled. | 268 | will be disabled. |
269 | In addition, the | ||
270 | .Cm ServerAliveInterval | ||
271 | option will be set to 300 seconds by default (Debian-specific). | ||
269 | This option is useful in scripts and other batch jobs where no user | 272 | This option is useful in scripts and other batch jobs where no user |
270 | is present to interact with | 273 | is present to interact with |
271 | .Xr ssh 1 . | 274 | .Xr ssh 1 , |
275 | and where it is desirable to detect a broken network swiftly. | ||
272 | The argument must be | 276 | The argument must be |
273 | .Cm yes | 277 | .Cm yes |
274 | or | 278 | or |
@@ -1593,7 +1597,14 @@ from the server, | |||
1593 | will send a message through the encrypted | 1597 | will send a message through the encrypted |
1594 | channel to request a response from the server. | 1598 | channel to request a response from the server. |
1595 | The default | 1599 | The default |
1596 | is 0, indicating that these messages will not be sent to the server. | 1600 | is 0, indicating that these messages will not be sent to the server, |
1601 | or 300 if the | ||
1602 | .Cm BatchMode | ||
1603 | option is set (Debian-specific). | ||
1604 | .Cm ProtocolKeepAlives | ||
1605 | and | ||
1606 | .Cm SetupTimeOut | ||
1607 | are Debian-specific compatibility aliases for this option. | ||
1597 | .It Cm SetEnv | 1608 | .It Cm SetEnv |
1598 | Directly specify one or more environment variables and their contents to | 1609 | Directly specify one or more environment variables and their contents to |
1599 | be sent to the server. | 1610 | be sent to the server. |
@@ -1673,6 +1684,12 @@ Specifies whether the system should send TCP keepalive messages to the | |||
1673 | other side. | 1684 | other side. |
1674 | If they are sent, death of the connection or crash of one | 1685 | If they are sent, death of the connection or crash of one |
1675 | of the machines will be properly noticed. | 1686 | of the machines will be properly noticed. |
1687 | This option only uses TCP keepalives (as opposed to using ssh level | ||
1688 | keepalives), so takes a long time to notice when the connection dies. | ||
1689 | As such, you probably want | ||
1690 | the | ||
1691 | .Cm ServerAliveInterval | ||
1692 | option as well. | ||
1676 | However, this means that | 1693 | However, this means that |
1677 | connections will die if the route is down temporarily, and some people | 1694 | connections will die if the route is down temporarily, and some people |
1678 | find it annoying. | 1695 | find it annoying. |
diff --git a/sshd_config.5 b/sshd_config.5 index f6b41a2f8..ebd09f891 100644 --- a/sshd_config.5 +++ b/sshd_config.5 | |||
@@ -1668,6 +1668,9 @@ This avoids infinitely hanging sessions. | |||
1668 | .Pp | 1668 | .Pp |
1669 | To disable TCP keepalive messages, the value should be set to | 1669 | To disable TCP keepalive messages, the value should be set to |
1670 | .Cm no . | 1670 | .Cm no . |
1671 | .Pp | ||
1672 | This option was formerly called | ||
1673 | .Cm KeepAlive . | ||
1671 | .It Cm TrustedUserCAKeys | 1674 | .It Cm TrustedUserCAKeys |
1672 | Specifies a file containing public keys of certificate authorities that are | 1675 | Specifies a file containing public keys of certificate authorities that are |
1673 | trusted to sign user certificates for authentication, or | 1676 | trusted to sign user certificates for authentication, or |