rutwa189 / rpms / openssh

Forked from rpms/openssh a year ago
Clone

Blame SOURCES/openssh-6.6p1-GSSAPIEnablek5users.patch

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