summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Kettlewell <rjk@greenend.org.uk>2014-02-09 16:09:52 +0000
committerColin Watson <cjwatson@debian.org>2015-11-29 17:36:18 +0000
commit5664b20b9d8ee691d664333b83ebb5e7560933a4 (patch)
tree0bf98865c38014f76c9b01b55de772ea897516e7
parent5e3b425ba1e334c987c5e15abf3d90e9eb776ab3 (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: 2015-11-29 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 522ad373c..46c343f30 100644
--- a/readconf.c
+++ b/readconf.c
@@ -160,6 +160,7 @@ typedef enum {
160 oStreamLocalBindMask, oStreamLocalBindUnlink, oRevokedHostKeys, 160 oStreamLocalBindMask, oStreamLocalBindUnlink, oRevokedHostKeys,
161 oFingerprintHash, oUpdateHostkeys, oHostbasedKeyTypes, 161 oFingerprintHash, oUpdateHostkeys, oHostbasedKeyTypes,
162 oPubkeyAcceptedKeyTypes, 162 oPubkeyAcceptedKeyTypes,
163 oProtocolKeepAlives, oSetupTimeOut,
163 oIgnoredUnknownOption, oDeprecated, oUnsupported 164 oIgnoredUnknownOption, oDeprecated, oUnsupported
164} OpCodes; 165} OpCodes;
165 166
@@ -290,6 +291,8 @@ static struct {
290 { "hostbasedkeytypes", oHostbasedKeyTypes }, 291 { "hostbasedkeytypes", oHostbasedKeyTypes },
291 { "pubkeyacceptedkeytypes", oPubkeyAcceptedKeyTypes }, 292 { "pubkeyacceptedkeytypes", oPubkeyAcceptedKeyTypes },
292 { "ignoreunknown", oIgnoreUnknown }, 293 { "ignoreunknown", oIgnoreUnknown },
294 { "protocolkeepalives", oProtocolKeepAlives },
295 { "setuptimeout", oSetupTimeOut },
293 296
294 { NULL, oBadOption } 297 { NULL, oBadOption }
295}; 298};
@@ -1304,6 +1307,8 @@ parse_keytypes:
1304 goto parse_flag; 1307 goto parse_flag;
1305 1308
1306 case oServerAliveInterval: 1309 case oServerAliveInterval:
1310 case oProtocolKeepAlives: /* Debian-specific compatibility alias */
1311 case oSetupTimeOut: /* Debian-specific compatibility alias */
1307 intptr = &options->server_alive_interval; 1312 intptr = &options->server_alive_interval;
1308 goto parse_time; 1313 goto parse_time;
1309 1314
@@ -1856,8 +1861,13 @@ fill_default_options(Options * options)
1856 options->rekey_interval = 0; 1861 options->rekey_interval = 0;
1857 if (options->verify_host_key_dns == -1) 1862 if (options->verify_host_key_dns == -1)
1858 options->verify_host_key_dns = 0; 1863 options->verify_host_key_dns = 0;
1859 if (options->server_alive_interval == -1) 1864 if (options->server_alive_interval == -1) {
1860 options->server_alive_interval = 0; 1865 /* in batch mode, default is 5mins */
1866 if (options->batch_mode == 1)
1867 options->server_alive_interval = 300;
1868 else
1869 options->server_alive_interval = 0;
1870 }
1861 if (options->server_alive_count_max == -1) 1871 if (options->server_alive_count_max == -1)
1862 options->server_alive_count_max = 3; 1872 options->server_alive_count_max = 3;
1863 if (options->control_master == -1) 1873 if (options->control_master == -1)
diff --git a/ssh_config.5 b/ssh_config.5
index 673d0b7d6..4e341155a 100644
--- a/ssh_config.5
+++ b/ssh_config.5
@@ -233,8 +233,12 @@ Valid arguments are
233If set to 233If set to
234.Dq yes , 234.Dq yes ,
235passphrase/password querying will be disabled. 235passphrase/password querying will be disabled.
236In addition, the
237.Cm ServerAliveInterval
238option will be set to 300 seconds by default.
236This option is useful in scripts and other batch jobs where no user 239This option is useful in scripts and other batch jobs where no user
237is present to supply the password. 240is present to supply the password,
241and where it is desirable to detect a broken network swiftly.
238The argument must be 242The argument must be
239.Dq yes 243.Dq yes
240or 244or
@@ -1479,8 +1483,15 @@ from the server,
1479will send a message through the encrypted 1483will send a message through the encrypted
1480channel to request a response from the server. 1484channel to request a response from the server.
1481The default 1485The default
1482is 0, indicating that these messages will not be sent to the server. 1486is 0, indicating that these messages will not be sent to the server,
1487or 300 if the
1488.Cm BatchMode
1489option is set.
1483This option applies to protocol version 2 only. 1490This option applies to protocol version 2 only.
1491.Cm ProtocolKeepAlives
1492and
1493.Cm SetupTimeOut
1494are Debian-specific compatibility aliases for this option.
1484.It Cm StreamLocalBindMask 1495.It Cm StreamLocalBindMask
1485Sets the octal file creation mode mask 1496Sets the octal file creation mode mask
1486.Pq umask 1497.Pq umask
@@ -1546,6 +1557,12 @@ Specifies whether the system should send TCP keepalive messages to the
1546other side. 1557other side.
1547If they are sent, death of the connection or crash of one 1558If they are sent, death of the connection or crash of one
1548of the machines will be properly noticed. 1559of the machines will be properly noticed.
1560This option only uses TCP keepalives (as opposed to using ssh level
1561keepalives), so takes a long time to notice when the connection dies.
1562As such, you probably want
1563the
1564.Cm ServerAliveInterval
1565option as well.
1549However, this means that 1566However, this means that
1550connections will die if the route is down temporarily, and some people 1567connections will die if the route is down temporarily, and some people
1551find it annoying. 1568find it annoying.
diff --git a/sshd_config.5 b/sshd_config.5
index 5491c89cf..c8ee35dfc 100644
--- a/sshd_config.5
+++ b/sshd_config.5
@@ -1510,6 +1510,9 @@ This avoids infinitely hanging sessions.
1510.Pp 1510.Pp
1511To disable TCP keepalive messages, the value should be set to 1511To disable TCP keepalive messages, the value should be set to
1512.Dq no . 1512.Dq no .
1513.Pp
1514This option was formerly called
1515.Cm KeepAlive .
1513.It Cm TrustedUserCAKeys 1516.It Cm TrustedUserCAKeys
1514Specifies a file containing public keys of certificate authorities that are 1517Specifies a file containing public keys of certificate authorities that are
1515trusted to sign user certificates for authentication, or 1518trusted to sign user certificates for authentication, or