jonathancammack / rpms / openssh

Forked from rpms/openssh 8 months ago
Clone

Blame SOURCES/openssh-6.6p1-GSSAPIEnablek5users.patch

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