Skip to contentSkip to conversation

sunrpc: Add comment defining gssd upcall API keywords

PATCH In review Chuck Lever 3 participants 3 messages Aug 20, 2018

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

PATCH 1/1 sunrpc: Add comment defining gssd upcall API keywords

During review, it was found that the target, service, and srchost keywords are easily conflated. Add an explainer.

---
 net/sunrpc/auth_gss/auth_gss.c |   17 +++++++++++++++++
 1 file changed, 17 insertions(+)

Hi Bruce-

I've received no objections to this patch. Can you include it in v4.19 with the other patches I've already submitted?

net/sunrpc/auth_gss/auth_gss.c +17 -0
index 1943e11..2460759 100644
@@ -461,12 +461,28 @@ static int gss_encode_v1_msg(struct gss_upcall_msg *gss_msg,
 	buflen -= len;
 	p += len;
 	gss_msg->msg.len = len;
+
+	/*
+	 * target= is a full service principal that names the remote
+	 * identity that we are authenticating to.
+	 */
 	if (target_name) {
 		len = scnprintf(p, buflen, "target=%s ", target_name);
 		buflen -= len;
 		p += len;
 		gss_msg->msg.len += len;
 	}
+
+	/*
+	 * gssd uses service= and srchost= to select a matching key from
+	 * the system's keytab to use as the source principal.
+	 *
+	 * service= is the service name part of the source principal,
+	 * or "*" (meaning choose any).
+	 *
+	 * srchost= is the hostname part of the source principal. When
+	 * not provided, gssd uses the local hostname.
+	 */
 	if (service_name) {
 		char *c = strchr(service_name, '@');
 
@@ -482,6 +498,7 @@ static int gss_encode_v1_msg(struct gss_upcall_msg *gss_msg,
 		p += len;
 		gss_msg->msg.len += len;
 	}
+
 	if (mech->gm_upcall_enctypes) {
 		len = scnprintf(p, buflen, "enctypes=%s ",
 				mech->gm_upcall_enctypes);
#1 lore raw

Hello,

I found your examples in the "Enable the kernel to specify the hostname..." thread to be very useful. See below.

Quoted 19 lines · Chuck Lever

During review, it was found that the target, service, and srchost keywords are easily conflated. Add an explainer.

---
 net/sunrpc/auth_gss/auth_gss.c |   17 +++++++++++++++++
 1 file changed, 17 insertions(+)

Hi Bruce-

I've received no objections to this patch. Can you include it in v4.19 with the other patches I've already submitted?

net/sunrpc/auth_gss/auth_gss.c +0 -0
index 1943e11..2460759 100644

net/sunrpc/auth_gss/auth_gss.c static int gss_encode_v1_msg(struct gss_upcall_msg *gss_msg, · line 467

Quoted 7 lines
net/sunrpc/auth_gss/auth_gss.c +4 -0
@@ -461,12 +461,28 @@ static int gss_encode_v1_msg(struct gss_upcall_msg *gss_msg,
 	buflen -= len;
 	p += len;
 	gss_msg->msg.len = len;
+
+	/*
+	 * target= is a full service principal that names the remote
+	 * identity that we are authenticating to.

* In full, the target is:
* host/[email protected]

Quoted 7 lines
net/sunrpc/auth_gss/auth_gss.c +1 -0
+	 */
 	if (target_name) {
 		len = scnprintf(p, buflen, "target=%s ", target_name);
 		buflen -= len;
 		p += len;
 		gss_msg->msg.len += len;
 	}

net/sunrpc/auth_gss/auth_gss.c static int gss_encode_v1_msg(struct gss_upcall_msg *gss_msg, · line 484

Quoted 10 lines
net/sunrpc/auth_gss/auth_gss.c +10 -0
+
+	/*
+	 * gssd uses service= and srchost= to select a matching key from
+	 * the system's keytab to use as the source principal.
+	 *
+	 * service= is the service name part of the source principal,
+	 * or "*" (meaning choose any).
+	 *
+	 * srchost= is the hostname part of the source principal. When
+	 * not provided, gssd uses the local hostname. 

* Thus the full source principal has to be:
* nfs/[email protected]

net/sunrpc/auth_gss/auth_gss.c static int gss_encode_v1_msg(struct gss_upcall_msg *gss_msg, · line 485

Quoted 1 line
net/sunrpc/auth_gss/auth_gss.c +1 -0
+	 */

Just a suggestion...

steved.

Quoted 12 lines
net/sunrpc/auth_gss/auth_gss.c +1 -0
 	if (service_name) {
 		char *c = strchr(service_name, '@');
 
@@ -482,6 +498,7 @@ static int gss_encode_v1_msg(struct gss_upcall_msg *gss_msg,
 		p += len;
 		gss_msg->msg.len += len;
 	}
+
 	if (mech->gm_upcall_enctypes) {
 		len = scnprintf(p, buflen, "enctypes=%s ",
 				mech->gm_upcall_enctypes);
#2 lore raw
In reply to Chuck Lever
Quoted 4 lines · Chuck Lever

During review, it was found that the target, service, and srchost keywords are easily conflated. Add an explainer.

Quoted 8 lines
---
 net/sunrpc/auth_gss/auth_gss.c |   17 +++++++++++++++++
 1 file changed, 17 insertions(+)

Hi Bruce-

I've received no objections to this patch. Can you include it in v4.19 with the other patches I've already submitted?

Will do, it'll probably just be another week or so before I publish a 4.19 branch.

--b.

Quoted 43 lines
net/sunrpc/auth_gss/auth_gss.c +17 -0
index 1943e11..2460759 100644
@@ -461,12 +461,28 @@ static int gss_encode_v1_msg(struct gss_upcall_msg *gss_msg,
 	buflen -= len;
 	p += len;
 	gss_msg->msg.len = len;
+
+	/*
+	 * target= is a full service principal that names the remote
+	 * identity that we are authenticating to.
+	 */
 	if (target_name) {
 		len = scnprintf(p, buflen, "target=%s ", target_name);
 		buflen -= len;
 		p += len;
 		gss_msg->msg.len += len;
 	}
+
+	/*
+	 * gssd uses service= and srchost= to select a matching key from
+	 * the system's keytab to use as the source principal.
+	 *
+	 * service= is the service name part of the source principal,
+	 * or "*" (meaning choose any).
+	 *
+	 * srchost= is the hostname part of the source principal. When
+	 * not provided, gssd uses the local hostname.
+	 */
 	if (service_name) {
 		char *c = strchr(service_name, '@');
 
@@ -482,6 +498,7 @@ static int gss_encode_v1_msg(struct gss_upcall_msg *gss_msg,
 		p += len;
 		gss_msg->msg.len += len;
 	}
+
 	if (mech->gm_upcall_enctypes) {
 		len = scnprintf(p, buflen, "enctypes=%s ",
 				mech->gm_upcall_enctypes);