kentpeacock / rpms / openssh

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