jonathancammack / rpms / openssh

Forked from rpms/openssh 8 months ago
Clone

Blame SOURCES/openssh-6.6p1-GSSAPIEnablek5users.patch

943807
diff -up openssh-7.4p1/gss-serv-krb5.c.GSSAPIEnablek5users openssh-7.4p1/gss-serv-krb5.c
943807
--- openssh-7.4p1/gss-serv-krb5.c.GSSAPIEnablek5users	2016-12-23 15:18:40.615216100 +0100
943807
+++ openssh-7.4p1/gss-serv-krb5.c	2016-12-23 15:18:40.628216102 +0100
943807
@@ -279,7 +279,6 @@ ssh_gssapi_krb5_cmdok(krb5_principal pri
943807
 	FILE *fp;
943807
 	char file[MAXPATHLEN];
943807
 	char *line = NULL;
943807
-	char kuser[65]; /* match krb5_kuserok() */
943807
 	struct stat st;
943807
 	struct passwd *pw = the_authctxt->pw;
943807
 	int found_principal = 0;
943807
@@ -288,7 +287,7 @@ ssh_gssapi_krb5_cmdok(krb5_principal pri
943807
 
943807
 	snprintf(file, sizeof(file), "%s/.k5users", pw->pw_dir);
943807
 	/* If both .k5login and .k5users DNE, self-login is ok. */
943807
-	if (!k5login_exists && (access(file, F_OK) == -1)) {
943807
+	if ( !options.enable_k5users || (!k5login_exists && (access(file, F_OK) == -1))) {
943807
                 return ssh_krb5_kuserok(krb_context, principal, luser,
943807
                                         k5login_exists);
943807
 	}
943807
diff -up openssh-7.4p1/servconf.c.GSSAPIEnablek5users openssh-7.4p1/servconf.c
943807
--- openssh-7.4p1/servconf.c.GSSAPIEnablek5users	2016-12-23 15:18:40.615216100 +0100
943807
+++ openssh-7.4p1/servconf.c	2016-12-23 15:35:36.354401156 +0100
943807
@@ -168,6 +168,7 @@ initialize_server_options(ServerOptions
943807
 	options->gss_store_rekey = -1;
943807
 	options->gss_kex_algorithms = NULL;
943807
 	options->use_kuserok = -1;
943807
+	options->enable_k5users = -1;
943807
 	options->password_authentication = -1;
943807
 	options->kbd_interactive_authentication = -1;
943807
 	options->challenge_response_authentication = -1;
943807
@@ -345,6 +346,8 @@ fill_default_server_options(ServerOption
943807
 #endif
943807
 	if (options->use_kuserok == -1)
943807
 		options->use_kuserok = 1;
943807
+	if (options->enable_k5users == -1)
943807
+		options->enable_k5users = 0;
943807
 	if (options->password_authentication == -1)
943807
 		options->password_authentication = 1;
943807
 	if (options->kbd_interactive_authentication == -1)
943807
@@ -418,7 +421,7 @@ typedef enum {
943807
 	sHostbasedUsesNameFromPacketOnly, sHostbasedAcceptedAlgorithms,
943807
 	sHostKeyAlgorithms, sPerSourceMaxStartups, sPerSourceNetBlockSize,
943807
 	sClientAliveInterval, sClientAliveCountMax, sAuthorizedKeysFile,
943807
-	sGssAuthentication, sGssCleanupCreds, sGssStrictAcceptor,
943807
+	sGssAuthentication, sGssCleanupCreds, sGssEnablek5users, sGssStrictAcceptor,
943807
 	sGssKeyEx, sGssKexAlgorithms, sGssStoreRekey,
943807
 	sAcceptEnv, sSetEnv, sPermitTunnel,
943807
 	sMatch, sPermitOpen, sPermitListen, sForceCommand, sChrootDirectory,
943807
@@ -497,14 +500,16 @@ static struct {
943807
 	{ "gssapikeyexchange", sGssKeyEx, SSHCFG_GLOBAL },
943807
 	{ "gssapistorecredentialsonrekey", sGssStoreRekey, SSHCFG_GLOBAL },
943807
 	{ "gssapikexalgorithms", sGssKexAlgorithms, SSHCFG_GLOBAL },
943807
+	{ "gssapienablek5users", sGssEnablek5users, SSHCFG_ALL },
943807
 #else
943807
 	{ "gssapiauthentication", sUnsupported, SSHCFG_ALL },
943807
 	{ "gssapicleanupcredentials", sUnsupported, SSHCFG_GLOBAL },
943807
 	{ "gssapicleanupcreds", sUnsupported, SSHCFG_GLOBAL },
943807
 	{ "gssapistrictacceptorcheck", sUnsupported, SSHCFG_GLOBAL },
943807
 	{ "gssapikeyexchange", sUnsupported, SSHCFG_GLOBAL },
943807
 	{ "gssapistorecredentialsonrekey", sUnsupported, SSHCFG_GLOBAL },
943807
 	{ "gssapikexalgorithms", sUnsupported, SSHCFG_GLOBAL },
943807
+	{ "gssapienablek5users", sUnsupported, SSHCFG_ALL },
943807
 #endif
943807
 	{ "gssusesessionccache", sUnsupported, SSHCFG_GLOBAL },
943807
 	{ "gssapiusesessioncredcache", sUnsupported, SSHCFG_GLOBAL },
943807
@@ -1653,6 +1658,10 @@ process_server_config_line(ServerOptions
943807
 		intptr = &options->use_kuserok;
943807
 		goto parse_flag;
943807
 
943807
+	case sGssEnablek5users:
943807
+		intptr = &options->enable_k5users;
943807
+		goto parse_flag;
943807
+
943807
 	case sPermitListen:
943807
 	case sPermitOpen:
943807
 		if (opcode == sPermitListen) {
943807
@@ -2026,6 +2035,7 @@ copy_set_server_options(ServerOptions *d
943807
 	M_CP_INTOPT(ip_qos_interactive);
943807
 	M_CP_INTOPT(ip_qos_bulk);
943807
 	M_CP_INTOPT(use_kuserok);
943807
+	M_CP_INTOPT(enable_k5users);
943807
 	M_CP_INTOPT(rekey_limit);
943807
 	M_CP_INTOPT(rekey_interval);
943807
 	M_CP_INTOPT(log_level);
943807
@@ -2320,6 +2330,7 @@ dump_config(ServerOptions *o)
943807
 # endif
943807
 	dump_cfg_fmtint(sKerberosUniqueCCache, o->kerberos_unique_ccache);
943807
 	dump_cfg_fmtint(sKerberosUseKuserok, o->use_kuserok);
943807
+	dump_cfg_fmtint(sGssEnablek5users, o->enable_k5users);
943807
 #endif
943807
 #ifdef GSSAPI
943807
 	dump_cfg_fmtint(sGssAuthentication, o->gss_authentication);
943807
diff -up openssh-7.4p1/servconf.h.GSSAPIEnablek5users openssh-7.4p1/servconf.h
943807
--- openssh-7.4p1/servconf.h.GSSAPIEnablek5users	2016-12-23 15:18:40.616216100 +0100
943807
+++ openssh-7.4p1/servconf.h	2016-12-23 15:18:40.629216102 +0100
943807
@@ -174,6 +174,7 @@ typedef struct {
943807
	int     kerberos_unique_ccache;		/* If true, the acquired ticket will
943807
						 * be stored in per-session ccache */
943807
 	int	use_kuserok;
943807
+	int		enable_k5users;
943807
 	int     gss_authentication;	/* If true, permit GSSAPI authentication */
943807
 	int     gss_keyex;		/* If true, permit GSSAPI key exchange */
943807
 	int     gss_cleanup_creds;	/* If true, destroy cred cache on logout */
943807
diff -up openssh-7.4p1/sshd_config.5.GSSAPIEnablek5users openssh-7.4p1/sshd_config.5
943807
--- openssh-7.4p1/sshd_config.5.GSSAPIEnablek5users	2016-12-23 15:18:40.630216103 +0100
943807
+++ openssh-7.4p1/sshd_config.5	2016-12-23 15:36:21.607408435 +0100
943807
@@ -628,6 +628,12 @@ Specifies whether to automatically destr
943807
 on logout.
943807
 The default is
943807
 .Cm yes .
943807
+.It Cm GSSAPIEnablek5users
943807
+Specifies whether to look at .k5users file for GSSAPI authentication
943807
+access control. Further details are described in
943807
+.Xr ksu 1 .
943807
+The default is
943807
+.Cm no .
943807
 .It Cm GSSAPIKeyExchange
943807
 Specifies whether key exchange based on GSSAPI is allowed. GSSAPI key exchange
943807
 doesn't rely on ssh keys to verify host identity.
943807
diff -up openssh-7.4p1/sshd_config.GSSAPIEnablek5users openssh-7.4p1/sshd_config
943807
--- openssh-7.4p1/sshd_config.GSSAPIEnablek5users	2016-12-23 15:18:40.616216100 +0100
943807
+++ openssh-7.4p1/sshd_config	2016-12-23 15:18:40.631216103 +0100
943807
@@ -80,6 +80,7 @@ GSSAPIAuthentication yes
943807
 #GSSAPICleanupCredentials yes
943807
 #GSSAPIStrictAcceptorCheck yes
943807
 #GSSAPIKeyExchange no
943807
+#GSSAPIEnablek5users no
943807
 
943807
 # Set this to 'yes' to enable PAM authentication, account processing,
943807
 # and session processing. If this is enabled, PAM authentication will