summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Kettlewell <rjk@greenend.org.uk>2014-02-09 16:09:52 +0000
committerColin Watson <cjwatson@debian.org>2018-08-24 17:49:07 +0100
commit2c0a1fef2aaf16c5b97694139239797f0ea33d27 (patch)
tree4b8ec2ba96e74ed13116c18184b7cdd964e22cc8
parent80ef33d2e2559a2fcb71940f0ef0de18f426dab4 (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: 2018-08-24 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 6e26ba32d..3fd0fe7b7 100644
--- a/readconf.c
+++ b/readconf.c
@@ -175,6 +175,7 @@ typedef enum {
175 oStreamLocalBindMask, oStreamLocalBindUnlink, oRevokedHostKeys, 175 oStreamLocalBindMask, oStreamLocalBindUnlink, oRevokedHostKeys,
176 oFingerprintHash, oUpdateHostkeys, oHostbasedKeyTypes, 176 oFingerprintHash, oUpdateHostkeys, oHostbasedKeyTypes,
177 oPubkeyAcceptedKeyTypes, oProxyJump, 177 oPubkeyAcceptedKeyTypes, oProxyJump,
178 oProtocolKeepAlives, oSetupTimeOut,
178 oIgnore, oIgnoredUnknownOption, oDeprecated, oUnsupported 179 oIgnore, oIgnoredUnknownOption, oDeprecated, oUnsupported
179} OpCodes; 180} OpCodes;
180 181
@@ -321,6 +322,8 @@ static struct {
321 { "pubkeyacceptedkeytypes", oPubkeyAcceptedKeyTypes }, 322 { "pubkeyacceptedkeytypes", oPubkeyAcceptedKeyTypes },
322 { "ignoreunknown", oIgnoreUnknown }, 323 { "ignoreunknown", oIgnoreUnknown },
323 { "proxyjump", oProxyJump }, 324 { "proxyjump", oProxyJump },
325 { "protocolkeepalives", oProtocolKeepAlives },
326 { "setuptimeout", oSetupTimeOut },
324 327
325 { NULL, oBadOption } 328 { NULL, oBadOption }
326}; 329};
@@ -1401,6 +1404,8 @@ parse_keytypes:
1401 goto parse_flag; 1404 goto parse_flag;
1402 1405
1403 case oServerAliveInterval: 1406 case oServerAliveInterval:
1407 case oProtocolKeepAlives: /* Debian-specific compatibility alias */
1408 case oSetupTimeOut: /* Debian-specific compatibility alias */
1404 intptr = &options->server_alive_interval; 1409 intptr = &options->server_alive_interval;
1405 goto parse_time; 1410 goto parse_time;
1406 1411
@@ -2075,8 +2080,13 @@ fill_default_options(Options * options)
2075 options->rekey_interval = 0; 2080 options->rekey_interval = 0;
2076 if (options->verify_host_key_dns == -1) 2081 if (options->verify_host_key_dns == -1)
2077 options->verify_host_key_dns = 0; 2082 options->verify_host_key_dns = 0;
2078 if (options->server_alive_interval == -1) 2083 if (options->server_alive_interval == -1) {
2079 options->server_alive_interval = 0; 2084 /* in batch mode, default is 5mins */
2085 if (options->batch_mode == 1)
2086 options->server_alive_interval = 300;
2087 else
2088 options->server_alive_interval = 0;
2089 }
2080 if (options->server_alive_count_max == -1) 2090 if (options->server_alive_count_max == -1)
2081 options->server_alive_count_max = 3; 2091 options->server_alive_count_max = 3;
2082 if (options->control_master == -1) 2092 if (options->control_master == -1)
diff --git a/ssh_config.5 b/ssh_config.5
index 5b99921b4..86ada128e 100644
--- a/ssh_config.5
+++ b/ssh_config.5
@@ -247,8 +247,12 @@ Valid arguments are
247If set to 247If set to
248.Cm yes , 248.Cm yes ,
249passphrase/password querying will be disabled. 249passphrase/password querying will be disabled.
250In addition, the
251.Cm ServerAliveInterval
252option will be set to 300 seconds by default (Debian-specific).
250This option is useful in scripts and other batch jobs where no user 253This option is useful in scripts and other batch jobs where no user
251is present to supply the password. 254is present to supply the password,
255and where it is desirable to detect a broken network swiftly.
252The argument must be 256The argument must be
253.Cm yes 257.Cm yes
254or 258or
@@ -1463,7 +1467,14 @@ from the server,
1463will send a message through the encrypted 1467will send a message through the encrypted
1464channel to request a response from the server. 1468channel to request a response from the server.
1465The default 1469The default
1466is 0, indicating that these messages will not be sent to the server. 1470is 0, indicating that these messages will not be sent to the server,
1471or 300 if the
1472.Cm BatchMode
1473option is set (Debian-specific).
1474.Cm ProtocolKeepAlives
1475and
1476.Cm SetupTimeOut
1477are Debian-specific compatibility aliases for this option.
1467.It Cm SetEnv 1478.It Cm SetEnv
1468Directly specify one or more environment variables and their contents to 1479Directly specify one or more environment variables and their contents to
1469be sent to the server. 1480be sent to the server.
@@ -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 a0ac717c7..0fbbccbde 100644
--- a/sshd_config.5
+++ b/sshd_config.5
@@ -1566,6 +1566,9 @@ This avoids infinitely hanging sessions.
1566.Pp 1566.Pp
1567To disable TCP keepalive messages, the value should be set to 1567To disable TCP keepalive messages, the value should be set to
1568.Cm no . 1568.Cm no .
1569.Pp
1570This option was formerly called
1571.Cm KeepAlive .
1569.It Cm TrustedUserCAKeys 1572.It Cm TrustedUserCAKeys
1570Specifies a file containing public keys of certificate authorities that are 1573Specifies a file containing public keys of certificate authorities that are
1571trusted to sign user certificates for authentication, or 1574trusted to sign user certificates for authentication, or