summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Kettlewell <rjk@greenend.org.uk>2014-02-09 16:09:52 +0000
committerColin Watson <cjwatson@debian.org>2020-10-18 12:07:21 +0100
commit164d1c9f11309d38273ac64e30eda2baa3733f78 (patch)
tree0164bba0d3d7196bb5ba57cb1c3ffb9a5d136e39
parent61b4d4c07d19cd0816ab5d48da81a75f7adbdf24 (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.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 b069333fa..3d0a812b3 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};
@@ -1534,6 +1537,8 @@ parse_keytypes:
1534 goto parse_flag; 1537 goto parse_flag;
1535 1538
1536 case oServerAliveInterval: 1539 case oServerAliveInterval:
1540 case oProtocolKeepAlives: /* Debian-specific compatibility alias */
1541 case oSetupTimeOut: /* Debian-specific compatibility alias */
1537 intptr = &options->server_alive_interval; 1542 intptr = &options->server_alive_interval;
1538 goto parse_time; 1543 goto parse_time;
1539 1544
@@ -2266,8 +2271,13 @@ fill_default_options(Options * options)
2266 options->rekey_interval = 0; 2271 options->rekey_interval = 0;
2267 if (options->verify_host_key_dns == -1) 2272 if (options->verify_host_key_dns == -1)
2268 options->verify_host_key_dns = 0; 2273 options->verify_host_key_dns = 0;
2269 if (options->server_alive_interval == -1) 2274 if (options->server_alive_interval == -1) {
2270 options->server_alive_interval = 0; 2275 /* in batch mode, default is 5mins */
2276 if (options->batch_mode == 1)
2277 options->server_alive_interval = 300;
2278 else
2279 options->server_alive_interval = 0;
2280 }
2271 if (options->server_alive_count_max == -1) 2281 if (options->server_alive_count_max == -1)
2272 options->server_alive_count_max = 3; 2282 options->server_alive_count_max = 3;
2273 if (options->control_master == -1) 2283 if (options->control_master == -1)
diff --git a/ssh_config.5 b/ssh_config.5
index bd86d000c..3ceb800ba 100644
--- a/ssh_config.5
+++ b/ssh_config.5
@@ -275,9 +275,13 @@ If set to
275.Cm yes , 275.Cm yes ,
276user interaction such as password prompts and host key confirmation requests 276user interaction such as password prompts and host key confirmation requests
277will be disabled. 277will be disabled.
278In addition, the
279.Cm ServerAliveInterval
280option will be set to 300 seconds by default (Debian-specific).
278This option is useful in scripts and other batch jobs where no user 281This option is useful in scripts and other batch jobs where no user
279is present to interact with 282is present to interact with
280.Xr ssh 1 . 283.Xr ssh 1 ,
284and where it is desirable to detect a broken network swiftly.
281The argument must be 285The argument must be
282.Cm yes 286.Cm yes
283or 287or
@@ -1624,7 +1628,14 @@ from the server,
1624will send a message through the encrypted 1628will send a message through the encrypted
1625channel to request a response from the server. 1629channel to request a response from the server.
1626The default 1630The default
1627is 0, indicating that these messages will not be sent to the server. 1631is 0, indicating that these messages will not be sent to the server,
1632or 300 if the
1633.Cm BatchMode
1634option is set (Debian-specific).
1635.Cm ProtocolKeepAlives
1636and
1637.Cm SetupTimeOut
1638are Debian-specific compatibility aliases for this option.
1628.It Cm SetEnv 1639.It Cm SetEnv
1629Directly specify one or more environment variables and their contents to 1640Directly specify one or more environment variables and their contents to
1630be sent to the server. 1641be sent to the server.
@@ -1704,6 +1715,12 @@ Specifies whether the system should send TCP keepalive messages to the
1704other side. 1715other side.
1705If they are sent, death of the connection or crash of one 1716If they are sent, death of the connection or crash of one
1706of the machines will be properly noticed. 1717of the machines will be properly noticed.
1718This option only uses TCP keepalives (as opposed to using ssh level
1719keepalives), so takes a long time to notice when the connection dies.
1720As such, you probably want
1721the
1722.Cm ServerAliveInterval
1723option as well.
1707However, this means that 1724However, this means that
1708connections will die if the route is down temporarily, and some people 1725connections will die if the route is down temporarily, and some people
1709find it annoying. 1726find it annoying.
diff --git a/sshd_config.5 b/sshd_config.5
index eabbe9e73..6457620bb 100644
--- a/sshd_config.5
+++ b/sshd_config.5
@@ -1691,6 +1691,9 @@ This avoids infinitely hanging sessions.
1691.Pp 1691.Pp
1692To disable TCP keepalive messages, the value should be set to 1692To disable TCP keepalive messages, the value should be set to
1693.Cm no . 1693.Cm no .
1694.Pp
1695This option was formerly called
1696.Cm KeepAlive .
1694.It Cm TrustedUserCAKeys 1697.It Cm TrustedUserCAKeys
1695Specifies a file containing public keys of certificate authorities that are 1698Specifies a file containing public keys of certificate authorities that are
1696trusted to sign user certificates for authentication, or 1699trusted to sign user certificates for authentication, or