summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Kettlewell <rjk@greenend.org.uk>2014-02-09 16:09:52 +0000
committerColin Watson <cjwatson@debian.org>2017-10-04 13:54:48 +0100
commitc147d4dbab74e0dbf738beb9d9f4220534ae9da6 (patch)
tree3a1dabf64acc0d3480d54e9241fbd8c8e01b78c7
parent19971fb92159a621b55f0b9da76dd38a56d7247c (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: 2017-10-04 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 d2b28a41b..45caa0951 100644
--- a/readconf.c
+++ b/readconf.c
@@ -174,6 +174,7 @@ typedef enum {
174 oStreamLocalBindMask, oStreamLocalBindUnlink, oRevokedHostKeys, 174 oStreamLocalBindMask, oStreamLocalBindUnlink, oRevokedHostKeys,
175 oFingerprintHash, oUpdateHostkeys, oHostbasedKeyTypes, 175 oFingerprintHash, oUpdateHostkeys, oHostbasedKeyTypes,
176 oPubkeyAcceptedKeyTypes, oProxyJump, 176 oPubkeyAcceptedKeyTypes, oProxyJump,
177 oProtocolKeepAlives, oSetupTimeOut,
177 oIgnore, oIgnoredUnknownOption, oDeprecated, oUnsupported 178 oIgnore, oIgnoredUnknownOption, oDeprecated, oUnsupported
178} OpCodes; 179} OpCodes;
179 180
@@ -318,6 +319,8 @@ static struct {
318 { "pubkeyacceptedkeytypes", oPubkeyAcceptedKeyTypes }, 319 { "pubkeyacceptedkeytypes", oPubkeyAcceptedKeyTypes },
319 { "ignoreunknown", oIgnoreUnknown }, 320 { "ignoreunknown", oIgnoreUnknown },
320 { "proxyjump", oProxyJump }, 321 { "proxyjump", oProxyJump },
322 { "protocolkeepalives", oProtocolKeepAlives },
323 { "setuptimeout", oSetupTimeOut },
321 324
322 { NULL, oBadOption } 325 { NULL, oBadOption }
323}; 326};
@@ -1406,6 +1409,8 @@ parse_keytypes:
1406 goto parse_flag; 1409 goto parse_flag;
1407 1410
1408 case oServerAliveInterval: 1411 case oServerAliveInterval:
1412 case oProtocolKeepAlives: /* Debian-specific compatibility alias */
1413 case oSetupTimeOut: /* Debian-specific compatibility alias */
1409 intptr = &options->server_alive_interval; 1414 intptr = &options->server_alive_interval;
1410 goto parse_time; 1415 goto parse_time;
1411 1416
@@ -2042,8 +2047,13 @@ fill_default_options(Options * options)
2042 options->rekey_interval = 0; 2047 options->rekey_interval = 0;
2043 if (options->verify_host_key_dns == -1) 2048 if (options->verify_host_key_dns == -1)
2044 options->verify_host_key_dns = 0; 2049 options->verify_host_key_dns = 0;
2045 if (options->server_alive_interval == -1) 2050 if (options->server_alive_interval == -1) {
2046 options->server_alive_interval = 0; 2051 /* in batch mode, default is 5mins */
2052 if (options->batch_mode == 1)
2053 options->server_alive_interval = 300;
2054 else
2055 options->server_alive_interval = 0;
2056 }
2047 if (options->server_alive_count_max == -1) 2057 if (options->server_alive_count_max == -1)
2048 options->server_alive_count_max = 3; 2058 options->server_alive_count_max = 3;
2049 if (options->control_master == -1) 2059 if (options->control_master == -1)
diff --git a/ssh_config.5 b/ssh_config.5
index 9a06a757a..d6f43c2dd 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
@@ -1455,7 +1459,14 @@ from the server,
1455will send a message through the encrypted 1459will send a message through the encrypted
1456channel to request a response from the server. 1460channel to request a response from the server.
1457The default 1461The default
1458is 0, indicating that these messages will not be sent to the server. 1462is 0, indicating that these messages will not be sent to the server,
1463or 300 if the
1464.Cm BatchMode
1465option is set (Debian-specific).
1466.Cm ProtocolKeepAlives
1467and
1468.Cm SetupTimeOut
1469are Debian-specific compatibility aliases for this option.
1459.It Cm StreamLocalBindMask 1470.It Cm StreamLocalBindMask
1460Sets the octal file creation mode mask 1471Sets the octal file creation mode mask
1461.Pq umask 1472.Pq umask
@@ -1529,6 +1540,12 @@ Specifies whether the system should send TCP keepalive messages to the
1529other side. 1540other side.
1530If they are sent, death of the connection or crash of one 1541If they are sent, death of the connection or crash of one
1531of the machines will be properly noticed. 1542of the machines will be properly noticed.
1543This option only uses TCP keepalives (as opposed to using ssh level
1544keepalives), so takes a long time to notice when the connection dies.
1545As such, you probably want
1546the
1547.Cm ServerAliveInterval
1548option as well.
1532However, this means that 1549However, this means that
1533connections will die if the route is down temporarily, and some people 1550connections will die if the route is down temporarily, and some people
1534find it annoying. 1551find it annoying.
diff --git a/sshd_config.5 b/sshd_config.5
index 0dbcb8daa..7db255522 100644
--- a/sshd_config.5
+++ b/sshd_config.5
@@ -1454,6 +1454,9 @@ This avoids infinitely hanging sessions.
1454.Pp 1454.Pp
1455To disable TCP keepalive messages, the value should be set to 1455To disable TCP keepalive messages, the value should be set to
1456.Cm no . 1456.Cm no .
1457.Pp
1458This option was formerly called
1459.Cm KeepAlive .
1457.It Cm TrustedUserCAKeys 1460.It Cm TrustedUserCAKeys
1458Specifies a file containing public keys of certificate authorities that are 1461Specifies a file containing public keys of certificate authorities that are
1459trusted to sign user certificates for authentication, or 1462trusted to sign user certificates for authentication, or