rcolebaugh / rpms / openssh

Forked from rpms/openssh 2 years ago
Clone
8f2528
diff -up openssh-7.4p1/configure.ac.vendor openssh-7.4p1/configure.ac
8f2528
--- openssh-7.4p1/configure.ac.vendor	2017-02-10 10:45:54.977836854 +0100
8f2528
+++ openssh-7.4p1/configure.ac	2017-02-10 10:45:54.995836725 +0100
8f2528
@@ -4930,6 +4930,12 @@ AC_ARG_WITH([lastlog],
8f2528
 		fi
8f2528
 	]
8f2528
 )
8f2528
+AC_ARG_ENABLE(vendor-patchlevel,
8f2528
+  [  --enable-vendor-patchlevel=TAG  specify a vendor patch level],
8f2528
+  [AC_DEFINE_UNQUOTED(SSH_VENDOR_PATCHLEVEL,[SSH_RELEASE "-" "$enableval"],[Define to your vendor patch level, if it has been modified from the upstream source release.])
8f2528
+   SSH_VENDOR_PATCHLEVEL="$enableval"],
8f2528
+  [AC_DEFINE(SSH_VENDOR_PATCHLEVEL,SSH_RELEASE,[Define to your vendor patch level, if it has been modified from the upstream source release.])
8f2528
+   SSH_VENDOR_PATCHLEVEL=none])
8f2528
 
8f2528
 dnl lastlog, [uw]tmpx? detection
8f2528
 dnl  NOTE: set the paths in the platform section to avoid the
8f2528
@@ -5194,6 +5200,7 @@ echo "           Translate v4 in v6 hack
8f2528
 echo "                  BSD Auth support: $BSD_AUTH_MSG"
8f2528
 echo "              Random number source: $RAND_MSG"
8f2528
 echo "             Privsep sandbox style: $SANDBOX_STYLE"
8f2528
+echo "                Vendor patch level: $SSH_VENDOR_PATCHLEVEL"
8f2528
 
8f2528
 echo ""
8f2528
 
8f2528
diff -up openssh-7.4p1/servconf.c.vendor openssh-7.4p1/servconf.c
8f2528
--- openssh-7.4p1/servconf.c.vendor	2016-12-19 05:59:41.000000000 +0100
8f2528
+++ openssh-7.4p1/servconf.c	2017-02-10 10:45:54.995836725 +0100
8f2528
@@ -143,6 +143,7 @@ initialize_server_options(ServerOptions
8f2528
 	options->max_authtries = -1;
8f2528
 	options->max_sessions = -1;
8f2528
 	options->banner = NULL;
8f2528
+	options->show_patchlevel = -1;
8f2528
 	options->use_dns = -1;
8f2528
 	options->client_alive_interval = -1;
8f2528
 	options->client_alive_count_max = -1;
8f2528
@@ -325,6 +326,8 @@ fill_default_server_options(ServerOption
8f2528
 		options->ip_qos_bulk = IPTOS_THROUGHPUT;
8f2528
 	if (options->version_addendum == NULL)
8f2528
 		options->version_addendum = xstrdup("");
8f2528
+	if (options->show_patchlevel == -1)
8f2528
+		options->show_patchlevel = 0;
8f2528
 	if (options->fwd_opts.streamlocal_bind_mask == (mode_t)-1)
8f2528
 		options->fwd_opts.streamlocal_bind_mask = 0177;
8f2528
 	if (options->fwd_opts.streamlocal_bind_unlink == -1)
8f2528
@@ -402,7 +405,7 @@ typedef enum {
8f2528
 	sIgnoreUserKnownHosts, sCiphers, sMacs, sPidFile,
8f2528
 	sGatewayPorts, sPubkeyAuthentication, sPubkeyAcceptedKeyTypes,
8f2528
 	sXAuthLocation, sSubsystem, sMaxStartups, sMaxAuthTries, sMaxSessions,
8f2528
-	sBanner, sUseDNS, sHostbasedAuthentication,
8f2528
+	sBanner, sShowPatchLevel, sUseDNS, sHostbasedAuthentication,
8f2528
 	sHostbasedUsesNameFromPacketOnly, sHostbasedAcceptedKeyTypes,
8f2528
 	sHostKeyAlgorithms,
8f2528
 	sClientAliveInterval, sClientAliveCountMax, sAuthorizedKeysFile,
8f2528
@@ -528,6 +531,7 @@ static struct {
8f2528
 	{ "maxauthtries", sMaxAuthTries, SSHCFG_ALL },
8f2528
 	{ "maxsessions", sMaxSessions, SSHCFG_ALL },
8f2528
 	{ "banner", sBanner, SSHCFG_ALL },
8f2528
+	{ "showpatchlevel", sShowPatchLevel, SSHCFG_GLOBAL },
8f2528
 	{ "usedns", sUseDNS, SSHCFG_GLOBAL },
8f2528
 	{ "verifyreversemapping", sDeprecated, SSHCFG_GLOBAL },
8f2528
 	{ "reversemappingcheck", sDeprecated, SSHCFG_GLOBAL },
8f2528
@@ -1369,6 +1373,10 @@ process_server_config_line(ServerOptions
8f2528
 		multistate_ptr = multistate_privsep;
8f2528
 		goto parse_multistate;
8f2528
 
8f2528
+	case sShowPatchLevel:
8f2528
+		intptr = &options->show_patchlevel;
8f2528
+		goto parse_flag;
8f2528
+
8f2528
 	case sAllowUsers:
8f2528
 		while ((arg = strdelim(&cp)) && *arg != '\0') {
8f2528
 			if (options->num_allow_users >= MAX_ALLOW_USERS)
8f2528
@@ -2269,6 +2277,7 @@ dump_config(ServerOptions *o)
8f2528
 	dump_cfg_fmtint(sPermitUserEnvironment, o->permit_user_env);
8f2528
 	dump_cfg_fmtint(sCompression, o->compression);
8f2528
 	dump_cfg_fmtint(sGatewayPorts, o->fwd_opts.gateway_ports);
8f2528
+	dump_cfg_fmtint(sShowPatchLevel, o->show_patchlevel);
8f2528
 	dump_cfg_fmtint(sUseDNS, o->use_dns);
8f2528
 	dump_cfg_fmtint(sAllowTcpForwarding, o->allow_tcp_forwarding);
8f2528
 	dump_cfg_fmtint(sAllowAgentForwarding, o->allow_agent_forwarding);
8f2528
diff -up openssh-7.4p1/servconf.h.vendor openssh-7.4p1/servconf.h
8f2528
--- openssh-7.4p1/servconf.h.vendor	2016-12-19 05:59:41.000000000 +0100
8f2528
+++ openssh-7.4p1/servconf.h	2017-02-10 10:45:54.995836725 +0100
8f2528
@@ -149,6 +149,7 @@ typedef struct {
8f2528
 	int	max_authtries;
8f2528
 	int	max_sessions;
8f2528
 	char   *banner;			/* SSH-2 banner message */
8f2528
+	int	show_patchlevel;	/* Show vendor patch level to clients */
8f2528
 	int	use_dns;
8f2528
 	int	client_alive_interval;	/*
8f2528
 					 * poke the client this often to
8f2528
diff -up openssh-7.4p1/sshd_config.5.vendor openssh-7.4p1/sshd_config.5
8f2528
--- openssh-7.4p1/sshd_config.5.vendor	2017-02-10 10:45:54.990836761 +0100
8f2528
+++ openssh-7.4p1/sshd_config.5	2017-02-10 10:45:54.996836718 +0100
8f2528
@@ -1334,6 +1334,14 @@ an OpenSSH Key Revocation List (KRL) as
8f2528
 .Xr ssh-keygen 1 .
8f2528
 For more information on KRLs, see the KEY REVOCATION LISTS section in
8f2528
 .Xr ssh-keygen 1 .
8f2528
+.It Cm ShowPatchLevel 
8f2528
+Specifies whether 
8f2528
+.Nm sshd 
8f2528
+will display the patch level of the binary in the identification string. 
8f2528
+The patch level is set at compile-time. 
8f2528
+The default is 
8f2528
+.Dq no . 
8f2528
+This option applies to protocol version 1 only. 
8f2528
 .It Cm StreamLocalBindMask
8f2528
 Sets the octal file creation mode mask
8f2528
 .Pq umask
8f2528
diff -up openssh-7.4p1/sshd_config.vendor openssh-7.4p1/sshd_config
8f2528
--- openssh-7.4p1/sshd_config.vendor	2017-02-10 10:45:54.990836761 +0100
8f2528
+++ openssh-7.4p1/sshd_config	2017-02-10 10:45:54.996836718 +0100
8f2528
@@ -105,6 +105,7 @@ X11Forwarding yes
8f2528
 #Compression delayed
8f2528
 #ClientAliveInterval 0
8f2528
 #ClientAliveCountMax 3
8f2528
+#ShowPatchLevel no
8f2528
 #UseDNS no
8f2528
 #PidFile /var/run/sshd.pid
8f2528
 #MaxStartups 10:30:100
8f2528
diff -up openssh-7.4p1/sshd.c.vendor openssh-7.4p1/sshd.c
8f2528
--- openssh-7.4p1/sshd.c.vendor	2017-02-10 10:45:54.996836718 +0100
8f2528
+++ openssh-7.4p1/sshd.c	2017-02-10 10:48:41.633648667 +0100
8f2528
@@ -367,7 +367,8 @@ sshd_exchange_identification(struct ssh
8f2528
 	char remote_version[256];	/* Must be at least as big as buf. */
8f2528
 
8f2528
 	xasprintf(&server_version_string, "SSH-%d.%d-%.100s%s%s%s",
8f2528
-	    PROTOCOL_MAJOR_2, PROTOCOL_MINOR_2, SSH_VERSION,
8f2528
+	    PROTOCOL_MAJOR_2, PROTOCOL_MINOR_2,
8f2528
+	    (options.show_patchlevel == 1) ? SSH_VENDOR_PATCHLEVEL : SSH_VERSION,
8f2528
 	    *options.version_addendum == '\0' ? "" : " ",
8f2528
 	    options.version_addendum, newline);
8f2528
 
8f2528
@@ -1654,7 +1655,8 @@ main(int ac, char **av)
8f2528
 		exit(1);
8f2528
 	}
8f2528
 
8f2528
-	debug("sshd version %s, %s", SSH_VERSION,
8f2528
+	debug("sshd version %s, %s",
8f2528
+	    (options.show_patchlevel == 1) ? SSH_VENDOR_PATCHLEVEL : SSH_VERSION,
8f2528
 #ifdef WITH_OPENSSL
8f2528
 	    SSLeay_version(SSLEAY_VERSION)
8f2528
 #else