kentpeacock / rpms / openssh

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