Skip to contentSkip to conversation

Making svcgssd more Cluster friendly

PATCH New Steve Dickson 1 participant 3 messages Sep 27, 2010

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover Making svcgssd more Cluster friendly

I'm basically reposting Eberhard's patches to svcgssd in format that makes them easlier to review.

They basically add a -p argument which allows the setting of the principle used to get the machine creds, instead of using the principle in the keytab... I think its a good idea.. Anything that make svcgssed easier to work with I'm a fan of! ;-)

Eberhard Kuemmerle (2):
svcgssd: Adding a <-p principal> flag
Added the -p <principal> flag to the svcgssd manpage

 utils/gssd/gss_util.c  |    4 ++--
 utils/gssd/gss_util.h  |    2 +-
 utils/gssd/gssd.h      |    1 -
 utils/gssd/svcgssd.c   |   28 ++++++++++++++++++++--------
 utils/gssd/svcgssd.man |    6 ++++--
 5 files changed, 27 insertions(+), 14 deletions(-)
Signature · 1 line
1.7.2.3
#1 lore raw

PATCH 1/2 svcgssd: Adding a <-p principal> flag

From: Eberhard Kuemmerle <[email protected]>

Allow the principal that is used to get the machines creds definable on the command like with the new '-p <principal>'. This is useful in cluster environments.

---
 utils/gssd/gss_util.c |    4 ++--
 utils/gssd/gss_util.h |    2 +-
 utils/gssd/gssd.h     |    1 -
 utils/gssd/svcgssd.c  |   28 ++++++++++++++++++++--------
 4 files changed, 23 insertions(+), 12 deletions(-)
utils/gssd/gss_util.c +2 -2
index 99aceb3..8fe1e9b 100644
@@ -191,7 +191,7 @@ pgsserr(char *msg, u_int32_t maj_stat, u_int32_t min_stat, const gss_OID mech)
 }
 
 int
-gssd_acquire_cred(char *server_name)
+gssd_acquire_cred(char *server_name, const gss_OID oid)
 {
 	gss_buffer_desc name;
 	gss_name_t target_name;
@@ -203,7 +203,7 @@ gssd_acquire_cred(char *server_name)
 	name.length = strlen(server_name);
 
 	maj_stat = gss_import_name(&min_stat, &name,
-			(const gss_OID) GSS_C_NT_HOSTBASED_SERVICE,
+			oid,
 			&target_name);
 
 	if (maj_stat != GSS_S_COMPLETE) {
utils/gssd/gss_util.h +1 -1
index bfe8c4a..67b3077 100644
@@ -37,7 +37,7 @@
 
 extern gss_cred_id_t	gssd_creds;
 
-int gssd_acquire_cred(char *server_name);
+int gssd_acquire_cred(char *server_name, const gss_OID oid);
 void pgsserr(char *msg, u_int32_t maj_stat, u_int32_t min_stat,
 	const gss_OID mech);
 int gssd_check_mechs(void);
utils/gssd/gssd.h +0 -1
index 465c305..b1b5793 100644
@@ -100,7 +100,6 @@ int update_client_list(void);
 void handle_krb5_upcall(struct clnt_info *clp);
 void handle_spkm3_upcall(struct clnt_info *clp);
 void handle_gssd_upcall(struct clnt_info *clp);
-int gssd_acquire_cred(char *server_name);
 void gssd_run(void);
 
 
utils/gssd/svcgssd.c +20 -8
index e7375a4..9b463f3 100644
@@ -167,7 +167,7 @@ sig_hup(int signal)
 static void
 usage(char *progname)
 {
-	fprintf(stderr, "usage: %s [-n] [-f] [-v] [-r] [-i]\n",
+	fprintf(stderr, "usage: %s [-n] [-f] [-v] [-r] [-i] [-p principal]\n",
 		progname);
 	exit(1);
 }
@@ -180,9 +180,10 @@ main(int argc, char *argv[])
 	int verbosity = 0;
 	int rpc_verbosity = 0;
 	int idmap_verbosity = 0;
-	int opt;
+	int opt, status;
 	extern char *optarg;
 	char *progname;
+	char *principal = NULL;
 
 	while ((opt = getopt(argc, argv, "fivrnp:")) != -1) {
 		switch (opt) {
@@ -201,6 +202,9 @@ main(int argc, char *argv[])
 			case 'r':
 				rpc_verbosity++;
 				break;
+			case 'p':
+				principal = optarg;
+				break;
 			default:
 				usage(argv[0]);
 				break;
@@ -244,12 +248,20 @@ main(int argc, char *argv[])
 	signal(SIGTERM, sig_die);
 	signal(SIGHUP, sig_hup);
 
-	if (get_creds && !gssd_acquire_cred(GSSD_SERVICE_NAME)) {
-                printerr(0, "unable to obtain root (machine) credentials\n");
-                printerr(0, "do you have a keytab entry for "
-			    "nfs/<your.host>@<YOUR.REALM> in "
-			    "/etc/krb5.keytab?\n");
-		exit(1);
+	if (get_creds) {
+		if (principal)
+			status = gssd_acquire_cred(principal, 
+				((const gss_OID)GSS_C_NT_USER_NAME));
+		else
+			status = gssd_acquire_cred(GSSD_SERVICE_NAME, 
+				(const gss_OID)GSS_C_NT_HOSTBASED_SERVICE);
+		if (status == FALSE) {
+			printerr(0, "unable to obtain root (machine) credentials\n");
+			printerr(0, "do you have a keytab entry for "
+				"nfs/<your.host>@<YOUR.REALM> in "
+				"/etc/krb5.keytab?\n");
+			exit(1);
+		}
 	}
 
 	if (!fg)
Signature · 1 line
1.7.2.3
#2 lore raw

PATCH 2/2 Added the -p <principal> flag to the svcgssd manpage

In reply to Steve Dickson

From: Eberhard Kuemmerle <[email protected]>

---
 utils/gssd/svcgssd.man |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
utils/gssd/svcgssd.man +4 -2
index 1a015e1..1c7bb32 100644
@@ -6,7 +6,7 @@
 .SH NAME
 rpc.svcgssd \- server-side rpcsec_gss daemon
 .SH SYNOPSIS
-.B "rpc.svcgssd [-v] [-r] [-i] [-f] [-p pipefsdir]"
+.B "rpc.svcgssd [-v] [-r] [-i] [-f] [-p principal]"
 .SH DESCRIPTION
 The rpcsec_gss protocol gives a means of using the gss-api generic security
 api to provide security for protocols using rpc (in particular, nfs).  Before
@@ -35,7 +35,9 @@ increases the verbosity of the output (can be specified multiple times).
 .B -i
 If the nfsidmap library supports setting debug level,
 increases the verbosity of the output (can be specified multiple times).
-
+.TP
+.B -p
+Use \fIprincipal\fR instead of the default nfs/host.domain.
 .SH SEE ALSO
 .BR rpc.gssd(8),
 .SH AUTHORS
Signature · 1 line
1.7.2.3