bmh10 / rpms / openssh

Forked from rpms/openssh 10 days ago
Clone

Blame SOURCES/openssh-6.6p1-GSSAPIEnablek5users.patch

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