summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKees Cook <kees@debian.org>2014-02-09 16:10:06 +0000
committerColin Watson <cjwatson@debian.org>2019-10-09 23:07:49 +0100
commit4eb06adf69f21f387e4f2d29dad01b2ca1303094 (patch)
tree782c6d7db67c6754958162301c996ea4bae19572
parent6a8dfab1a067a52b004594fadb3a90578a8cc094 (diff)
Add DebianBanner server configuration option
Setting this to "no" causes sshd to omit the Debian revision from its initial protocol handshake, for those scared by package-versioning.patch. Bug-Debian: http://bugs.debian.org/562048 Forwarded: not-needed Last-Update: 2019-06-05 Patch-Name: debian-banner.patch
-rw-r--r--kex.c5
-rw-r--r--kex.h2
-rw-r--r--servconf.c9
-rw-r--r--servconf.h2
-rw-r--r--sshconnect.c2
-rw-r--r--sshd.c3
-rw-r--r--sshd_config.55
7 files changed, 23 insertions, 5 deletions
diff --git a/kex.c b/kex.c
index 65ed6af02..f450bc2c7 100644
--- a/kex.c
+++ b/kex.c
@@ -1221,7 +1221,7 @@ send_error(struct ssh *ssh, char *msg)
1221 */ 1221 */
1222int 1222int
1223kex_exchange_identification(struct ssh *ssh, int timeout_ms, 1223kex_exchange_identification(struct ssh *ssh, int timeout_ms,
1224 const char *version_addendum) 1224 int debian_banner, const char *version_addendum)
1225{ 1225{
1226 int remote_major, remote_minor, mismatch; 1226 int remote_major, remote_minor, mismatch;
1227 size_t len, i, n; 1227 size_t len, i, n;
@@ -1239,7 +1239,8 @@ kex_exchange_identification(struct ssh *ssh, int timeout_ms,
1239 if (version_addendum != NULL && *version_addendum == '\0') 1239 if (version_addendum != NULL && *version_addendum == '\0')
1240 version_addendum = NULL; 1240 version_addendum = NULL;
1241 if ((r = sshbuf_putf(our_version, "SSH-%d.%d-%.100s%s%s\r\n", 1241 if ((r = sshbuf_putf(our_version, "SSH-%d.%d-%.100s%s%s\r\n",
1242 PROTOCOL_MAJOR_2, PROTOCOL_MINOR_2, SSH_RELEASE, 1242 PROTOCOL_MAJOR_2, PROTOCOL_MINOR_2,
1243 debian_banner ? SSH_RELEASE : SSH_RELEASE_MINIMUM,
1243 version_addendum == NULL ? "" : " ", 1244 version_addendum == NULL ? "" : " ",
1244 version_addendum == NULL ? "" : version_addendum)) != 0) { 1245 version_addendum == NULL ? "" : version_addendum)) != 0) {
1245 error("%s: sshbuf_putf: %s", __func__, ssh_err(r)); 1246 error("%s: sshbuf_putf: %s", __func__, ssh_err(r));
diff --git a/kex.h b/kex.h
index fe7141414..938dca03b 100644
--- a/kex.h
+++ b/kex.h
@@ -194,7 +194,7 @@ char *kex_names_cat(const char *, const char *);
194int kex_assemble_names(char **, const char *, const char *); 194int kex_assemble_names(char **, const char *, const char *);
195int kex_gss_names_valid(const char *); 195int kex_gss_names_valid(const char *);
196 196
197int kex_exchange_identification(struct ssh *, int, const char *); 197int kex_exchange_identification(struct ssh *, int, int, const char *);
198 198
199struct kex *kex_new(void); 199struct kex *kex_new(void);
200int kex_ready(struct ssh *, char *[PROPOSAL_MAX]); 200int kex_ready(struct ssh *, char *[PROPOSAL_MAX]);
diff --git a/servconf.c b/servconf.c
index 73b93c636..5576098a5 100644
--- a/servconf.c
+++ b/servconf.c
@@ -184,6 +184,7 @@ initialize_server_options(ServerOptions *options)
184 options->fingerprint_hash = -1; 184 options->fingerprint_hash = -1;
185 options->disable_forwarding = -1; 185 options->disable_forwarding = -1;
186 options->expose_userauth_info = -1; 186 options->expose_userauth_info = -1;
187 options->debian_banner = -1;
187} 188}
188 189
189/* Returns 1 if a string option is unset or set to "none" or 0 otherwise. */ 190/* Returns 1 if a string option is unset or set to "none" or 0 otherwise. */
@@ -437,6 +438,8 @@ fill_default_server_options(ServerOptions *options)
437 options->disable_forwarding = 0; 438 options->disable_forwarding = 0;
438 if (options->expose_userauth_info == -1) 439 if (options->expose_userauth_info == -1)
439 options->expose_userauth_info = 0; 440 options->expose_userauth_info = 0;
441 if (options->debian_banner == -1)
442 options->debian_banner = 1;
440 443
441 assemble_algorithms(options); 444 assemble_algorithms(options);
442 445
@@ -523,6 +526,7 @@ typedef enum {
523 sStreamLocalBindMask, sStreamLocalBindUnlink, 526 sStreamLocalBindMask, sStreamLocalBindUnlink,
524 sAllowStreamLocalForwarding, sFingerprintHash, sDisableForwarding, 527 sAllowStreamLocalForwarding, sFingerprintHash, sDisableForwarding,
525 sExposeAuthInfo, sRDomain, 528 sExposeAuthInfo, sRDomain,
529 sDebianBanner,
526 sDeprecated, sIgnore, sUnsupported 530 sDeprecated, sIgnore, sUnsupported
527} ServerOpCodes; 531} ServerOpCodes;
528 532
@@ -682,6 +686,7 @@ static struct {
682 { "exposeauthinfo", sExposeAuthInfo, SSHCFG_ALL }, 686 { "exposeauthinfo", sExposeAuthInfo, SSHCFG_ALL },
683 { "rdomain", sRDomain, SSHCFG_ALL }, 687 { "rdomain", sRDomain, SSHCFG_ALL },
684 { "casignaturealgorithms", sCASignatureAlgorithms, SSHCFG_ALL }, 688 { "casignaturealgorithms", sCASignatureAlgorithms, SSHCFG_ALL },
689 { "debianbanner", sDebianBanner, SSHCFG_GLOBAL },
685 { NULL, sBadOption, 0 } 690 { NULL, sBadOption, 0 }
686}; 691};
687 692
@@ -2217,6 +2222,10 @@ process_server_config_line(ServerOptions *options, char *line,
2217 *charptr = xstrdup(arg); 2222 *charptr = xstrdup(arg);
2218 break; 2223 break;
2219 2224
2225 case sDebianBanner:
2226 intptr = &options->debian_banner;
2227 goto parse_flag;
2228
2220 case sDeprecated: 2229 case sDeprecated:
2221 case sIgnore: 2230 case sIgnore:
2222 case sUnsupported: 2231 case sUnsupported:
diff --git a/servconf.h b/servconf.h
index 29329ba1f..d5ad19065 100644
--- a/servconf.h
+++ b/servconf.h
@@ -214,6 +214,8 @@ typedef struct {
214 int fingerprint_hash; 214 int fingerprint_hash;
215 int expose_userauth_info; 215 int expose_userauth_info;
216 u_int64_t timing_secret; 216 u_int64_t timing_secret;
217
218 int debian_banner;
217} ServerOptions; 219} ServerOptions;
218 220
219/* Information about the incoming connection as used by Match */ 221/* Information about the incoming connection as used by Match */
diff --git a/sshconnect.c b/sshconnect.c
index 41e75a275..27daef74f 100644
--- a/sshconnect.c
+++ b/sshconnect.c
@@ -1291,7 +1291,7 @@ ssh_login(struct ssh *ssh, Sensitive *sensitive, const char *orighost,
1291 lowercase(host); 1291 lowercase(host);
1292 1292
1293 /* Exchange protocol version identification strings with the server. */ 1293 /* Exchange protocol version identification strings with the server. */
1294 if (kex_exchange_identification(ssh, timeout_ms, NULL) != 0) 1294 if (kex_exchange_identification(ssh, timeout_ms, 1, NULL) != 0)
1295 cleanup_exit(255); /* error already logged */ 1295 cleanup_exit(255); /* error already logged */
1296 1296
1297 /* Put the connection into non-blocking mode. */ 1297 /* Put the connection into non-blocking mode. */
diff --git a/sshd.c b/sshd.c
index ea8beacb4..4e8ff0662 100644
--- a/sshd.c
+++ b/sshd.c
@@ -2165,7 +2165,8 @@ main(int ac, char **av)
2165 if (!debug_flag) 2165 if (!debug_flag)
2166 alarm(options.login_grace_time); 2166 alarm(options.login_grace_time);
2167 2167
2168 if (kex_exchange_identification(ssh, -1, options.version_addendum) != 0) 2168 if (kex_exchange_identification(ssh, -1, options.debian_banner,
2169 options.version_addendum) != 0)
2169 cleanup_exit(255); /* error already logged */ 2170 cleanup_exit(255); /* error already logged */
2170 2171
2171 ssh_packet_set_nonblocking(ssh); 2172 ssh_packet_set_nonblocking(ssh);
diff --git a/sshd_config.5 b/sshd_config.5
index eec224158..46537f177 100644
--- a/sshd_config.5
+++ b/sshd_config.5
@@ -545,6 +545,11 @@ or
545.Cm no . 545.Cm no .
546The default is 546The default is
547.Cm yes . 547.Cm yes .
548.It Cm DebianBanner
549Specifies whether the distribution-specified extra version suffix is
550included during initial protocol handshake.
551The default is
552.Cm yes .
548.It Cm DenyGroups 553.It Cm DenyGroups
549This keyword can be followed by a list of group name patterns, separated 554This keyword can be followed by a list of group name patterns, separated
550by spaces. 555by spaces.