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

Gbp-Pq: Name keepalive-extensions.patch
This commit is contained in:
Richard Kettlewell 2014-02-09 16:09:52 +00:00 committed by Lu zhiping
parent 993e298325
commit 636783df82
3 changed files with 34 additions and 4 deletions

View File

@ -176,6 +176,7 @@ typedef enum {
oFingerprintHash, oUpdateHostkeys, oHostbasedKeyTypes,
oPubkeyAcceptedKeyTypes, oCASignatureAlgorithms, oProxyJump,
oSecurityKeyProvider,
oProtocolKeepAlives, oSetupTimeOut,
oIgnore, oIgnoredUnknownOption, oDeprecated, oUnsupported
} OpCodes;
@ -326,6 +327,8 @@ static struct {
{ "ignoreunknown", oIgnoreUnknown },
{ "proxyjump", oProxyJump },
{ "securitykeyprovider", oSecurityKeyProvider },
{ "protocolkeepalives", oProtocolKeepAlives },
{ "setuptimeout", oSetupTimeOut },
{ NULL, oBadOption }
};
@ -1495,6 +1498,8 @@ parse_keytypes:
goto parse_flag;
case oServerAliveInterval:
case oProtocolKeepAlives: /* Debian-specific compatibility alias */
case oSetupTimeOut: /* Debian-specific compatibility alias */
intptr = &options->server_alive_interval;
goto parse_time;
@ -2198,8 +2203,13 @@ fill_default_options(Options * options)
options->rekey_interval = 0;
if (options->verify_host_key_dns == -1)
options->verify_host_key_dns = 0;
if (options->server_alive_interval == -1)
options->server_alive_interval = 0;
if (options->server_alive_interval == -1) {
/* in batch mode, default is 5mins */
if (options->batch_mode == 1)
options->server_alive_interval = 300;
else
options->server_alive_interval = 0;
}
if (options->server_alive_count_max == -1)
options->server_alive_count_max = 3;
if (options->control_master == -1)

View File

@ -266,9 +266,13 @@ If set to
.Cm yes ,
user interaction such as password prompts and host key confirmation requests
will be disabled.
In addition, the
.Cm ServerAliveInterval
option will be set to 300 seconds by default (Debian-specific).
This option is useful in scripts and other batch jobs where no user
is present to interact with
.Xr ssh 1 .
.Xr ssh 1 ,
and where it is desirable to detect a broken network swiftly.
The argument must be
.Cm yes
or
@ -1593,7 +1597,14 @@ from the server,
will send a message through the encrypted
channel to request a response from the server.
The default
is 0, indicating that these messages will not be sent to the server.
is 0, indicating that these messages will not be sent to the server,
or 300 if the
.Cm BatchMode
option is set (Debian-specific).
.Cm ProtocolKeepAlives
and
.Cm SetupTimeOut
are Debian-specific compatibility aliases for this option.
.It Cm SetEnv
Directly specify one or more environment variables and their contents to
be sent to the server.
@ -1673,6 +1684,12 @@ Specifies whether the system should send TCP keepalive messages to the
other side.
If they are sent, death of the connection or crash of one
of the machines will be properly noticed.
This option only uses TCP keepalives (as opposed to using ssh level
keepalives), so takes a long time to notice when the connection dies.
As such, you probably want
the
.Cm ServerAliveInterval
option as well.
However, this means that
connections will die if the route is down temporarily, and some people
find it annoying.

View File

@ -1668,6 +1668,9 @@ This avoids infinitely hanging sessions.
.Pp
To disable TCP keepalive messages, the value should be set to
.Cm no .
.Pp
This option was formerly called
.Cm KeepAlive .
.It Cm TrustedUserCAKeys
Specifies a file containing public keys of certificate authorities that are
trusted to sign user certificates for authentication, or