Blame SOURCES/openssh-6.6p1-GSSAPIEnablek5users.patch

1d31ef
diff -up openssh-7.4p1/gss-serv-krb5.c.GSSAPIEnablek5users openssh-7.4p1/gss-serv-krb5.c
1d31ef
--- openssh-7.4p1/gss-serv-krb5.c.GSSAPIEnablek5users	2017-02-09 10:10:47.403859893 +0100
1d31ef
+++ openssh-7.4p1/gss-serv-krb5.c	2017-02-09 10:10:47.414859882 +0100
1d31ef
@@ -260,7 +260,6 @@ ssh_gssapi_krb5_cmdok(krb5_principal pri
017ff1
 	FILE *fp;
017ff1
 	char file[MAXPATHLEN];
017ff1
 	char line[BUFSIZ];
017ff1
-	char kuser[65]; /* match krb5_kuserok() */
017ff1
 	struct stat st;
017ff1
 	struct passwd *pw = the_authctxt->pw;
017ff1
 	int found_principal = 0;
1d31ef
@@ -269,7 +268,7 @@ ssh_gssapi_krb5_cmdok(krb5_principal pri
017ff1
 
017ff1
 	snprintf(file, sizeof(file), "%s/.k5users", pw->pw_dir);
017ff1
 	/* If both .k5login and .k5users DNE, self-login is ok. */
017ff1
-	if (!k5login_exists && (access(file, F_OK) == -1)) {
017ff1
+	if ( !options.enable_k5users || (!k5login_exists && (access(file, F_OK) == -1))) {
017ff1
                 return ssh_krb5_kuserok(krb_context, principal, luser,
017ff1
                                         k5login_exists);
017ff1
 	}
1d31ef
diff -up openssh-7.4p1/servconf.c.GSSAPIEnablek5users openssh-7.4p1/servconf.c
1d31ef
--- openssh-7.4p1/servconf.c.GSSAPIEnablek5users	2017-02-09 10:10:47.404859892 +0100
1d31ef
+++ openssh-7.4p1/servconf.c	2017-02-09 10:18:45.800385543 +0100
1d31ef
@@ -166,6 +166,7 @@ initialize_server_options(ServerOptions
017ff1
 	options->ip_qos_bulk = -1;
017ff1
 	options->version_addendum = NULL;
017ff1
 	options->use_kuserok = -1;
017ff1
+	options->enable_k5users = -1;
1d31ef
 	options->fingerprint_hash = -1;
1d31ef
 	options->disable_forwarding = -1;
017ff1
 }
1d31ef
@@ -337,6 +338,8 @@ fill_default_server_options(ServerOption
017ff1
 		options->show_patchlevel = 0;
017ff1
 	if (options->use_kuserok == -1)
017ff1
 		options->use_kuserok = 1;
017ff1
+	if (options->enable_k5users == -1)
017ff1
+		options->enable_k5users = 0;
1d31ef
 	if (options->fwd_opts.streamlocal_bind_mask == (mode_t)-1)
1d31ef
 		options->fwd_opts.streamlocal_bind_mask = 0177;
1d31ef
 	if (options->fwd_opts.streamlocal_bind_unlink == -1)
1d31ef
@@ -418,7 +421,7 @@ typedef enum {
1d31ef
 	sHostbasedUsesNameFromPacketOnly, sHostbasedAcceptedKeyTypes,
1d31ef
 	sHostKeyAlgorithms,
1d31ef
 	sClientAliveInterval, sClientAliveCountMax, sAuthorizedKeysFile,
017ff1
-	sGssAuthentication, sGssCleanupCreds, sGssStrictAcceptor,
017ff1
+	sGssAuthentication, sGssCleanupCreds, sGssEnablek5users, sGssStrictAcceptor,
017ff1
 	sGssKeyEx, sGssStoreRekey, sAcceptEnv, sPermitTunnel,
017ff1
 	sMatch, sPermitOpen, sForceCommand, sChrootDirectory,
017ff1
 	sUsePrivilegeSeparation, sAllowAgentForwarding,
1d31ef
@@ -497,12 +500,14 @@ static struct {
017ff1
 	{ "gssapistrictacceptorcheck", sGssStrictAcceptor, SSHCFG_GLOBAL },
017ff1
 	{ "gssapikeyexchange", sGssKeyEx, SSHCFG_GLOBAL },
017ff1
 	{ "gssapistorecredentialsonrekey", sGssStoreRekey, SSHCFG_GLOBAL },
017ff1
+	{ "gssapienablek5users", sGssEnablek5users, SSHCFG_ALL },
017ff1
 #else
017ff1
 	{ "gssapiauthentication", sUnsupported, SSHCFG_ALL },
017ff1
 	{ "gssapicleanupcredentials", sUnsupported, SSHCFG_GLOBAL },
017ff1
 	{ "gssapistrictacceptorcheck", sUnsupported, SSHCFG_GLOBAL },
017ff1
 	{ "gssapikeyexchange", sUnsupported, SSHCFG_GLOBAL },
017ff1
 	{ "gssapistorecredentialsonrekey", sUnsupported, SSHCFG_GLOBAL },
017ff1
+	{ "gssapienablek5users", sUnsupported, SSHCFG_ALL },
017ff1
 #endif
017ff1
 	{ "gssusesessionccache", sUnsupported, SSHCFG_GLOBAL },
017ff1
 	{ "gssapiusesessioncredcache", sUnsupported, SSHCFG_GLOBAL },
1d31ef
@@ -1653,6 +1658,10 @@ process_server_config_line(ServerOptions
017ff1
 		intptr = &options->use_kuserok;
017ff1
 		goto parse_flag;
017ff1
 
017ff1
+	case sGssEnablek5users:
017ff1
+		intptr = &options->enable_k5users;
017ff1
+		goto parse_flag;
017ff1
+
017ff1
 	case sPermitOpen:
017ff1
 		arg = strdelim(&cp;;
017ff1
 		if (!arg || *arg == '\0')
1d31ef
@@ -2026,6 +2035,7 @@ copy_set_server_options(ServerOptions *d
017ff1
 	M_CP_INTOPT(ip_qos_interactive);
017ff1
 	M_CP_INTOPT(ip_qos_bulk);
017ff1
 	M_CP_INTOPT(use_kuserok);
017ff1
+	M_CP_INTOPT(enable_k5users);
017ff1
 	M_CP_INTOPT(rekey_limit);
017ff1
 	M_CP_INTOPT(rekey_interval);
017ff1
 
1d31ef
@@ -2319,6 +2329,7 @@ dump_config(ServerOptions *o)
1d31ef
 	dump_cfg_fmtint(sStreamLocalBindUnlink, o->fwd_opts.streamlocal_bind_unlink);
017ff1
 	dump_cfg_fmtint(sUsePrivilegeSeparation, use_privsep);
017ff1
 	dump_cfg_fmtint(sKerberosUseKuserok, o->use_kuserok);
017ff1
+	dump_cfg_fmtint(sGssEnablek5users, o->enable_k5users);
1d31ef
 	dump_cfg_fmtint(sFingerprintHash, o->fingerprint_hash);
017ff1
 
017ff1
 	/* string arguments */
1d31ef
diff -up openssh-7.4p1/servconf.h.GSSAPIEnablek5users openssh-7.4p1/servconf.h
1d31ef
--- openssh-7.4p1/servconf.h.GSSAPIEnablek5users	2017-02-09 10:10:47.404859892 +0100
1d31ef
+++ openssh-7.4p1/servconf.h	2017-02-09 10:10:47.415859881 +0100
1d31ef
@@ -174,7 +174,8 @@ typedef struct {
017ff1
 
017ff1
 	int	num_permitted_opens;
017ff1
 
017ff1
-	int	use_kuserok;
017ff1
+	int		use_kuserok;
017ff1
+	int		enable_k5users;
017ff1
 	char   *chroot_directory;
017ff1
 	char   *revoked_keys_file;
017ff1
 	char   *trusted_user_ca_keys;
1d31ef
diff -up openssh-7.4p1/sshd_config.5.GSSAPIEnablek5users openssh-7.4p1/sshd_config.5
1d31ef
--- openssh-7.4p1/sshd_config.5.GSSAPIEnablek5users	2017-02-09 10:10:47.415859881 +0100
1d31ef
+++ openssh-7.4p1/sshd_config.5	2017-02-09 10:19:29.420336796 +0100
1d31ef
@@ -633,6 +633,12 @@ Specifies whether key exchange based on
1d31ef
 doesn't rely on ssh keys to verify host identity.
017ff1
 The default is
1d31ef
 .Dq no .
017ff1
+.It Cm GSSAPIEnablek5users
017ff1
+Specifies whether to look at .k5users file for GSSAPI authentication
017ff1
+access control. Further details are described in
017ff1
+.Xr ksu 1 .
017ff1
+The default is
1d31ef
+.Cm no .
017ff1
 .It Cm GSSAPIStrictAcceptorCheck
1d31ef
 Determines whether to be strict about the identity of the GSSAPI acceptor
1d31ef
 a client authenticates against.
1d31ef
diff -up openssh-7.4p1/sshd_config.GSSAPIEnablek5users openssh-7.4p1/sshd_config
1d31ef
--- openssh-7.4p1/sshd_config.GSSAPIEnablek5users	2017-02-09 10:10:47.404859892 +0100
1d31ef
+++ openssh-7.4p1/sshd_config	2017-02-09 10:10:47.415859881 +0100
1d31ef
@@ -80,6 +80,7 @@ GSSAPIAuthentication yes
1d31ef
 GSSAPICleanupCredentials no
1d31ef
 #GSSAPIStrictAcceptorCheck yes
1d31ef
 #GSSAPIKeyExchange no
1d31ef
+#GSSAPIEnablek5users no
1d31ef
 
1d31ef
 # Set this to 'yes' to enable PAM authentication, account processing,
1d31ef
 # and session processing. If this is enabled, PAM authentication will