Skip to contentSkip to conversation

Avoid DNS Reverse lookups when possible

PATCH In review Simo Sorce 5 participants 31 messages Apr 2, 2013 – Apr 10, 2013

Subsystems (2)
lore
Share & tools
lore

Simo Sorce

author
#0 lore raw

cover Avoid DNS Reverse lookups when possible

This new patchset obsoletes the patch sent earlier today. The first and third patch are obvious.

The second patch implement a new command line option -N that takes an on|off argument.

When 'on' is specified the RPC Server name as passed from the kernel to rpc.gssd is check to see if it really is an actual IP address, if it is the current code is executed (and reverse resolution happens), otherwise the name used at the mount option is used directly w/o any DNS resolution to construct the GSSAPI name.

Avoiding Reverse name resolution helps making the system work when PTR records cannot be properly set on a network (because the amdin does not control DNS for example) and also avoids a potential MITM attack (as explained early on in the original patch thread).

Simo Sorce (3):
Fix segfault when using -R option
Avoid reverse resolution for server name
Document new -N option

 utils/gssd/gss_util.h  |    2 ++
 utils/gssd/gssd.c      |   18 ++++++++++++++++--
 utils/gssd/gssd.man    |   11 ++++++++++-
 utils/gssd/gssd_proc.c |   25 +++++++++++++++++++++----
 4 files changed, 49 insertions(+), 7 deletions(-)
author
#1 lore raw

PATCH 1/3 Fix segfault when using -R option

The getopt string did not add : after the R option resulting in a sefgault whenever -R was used as optarg is NULL and it is dereferenced.

---
 utils/gssd/gssd.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
utils/gssd/gssd.c +1 -1
index 0be251781bacaa562270f773341126bc95ca6b45..07b1e52e6b84e9bcba96e7a63b0505ca7823482a 100644
@@ -102,7 +102,7 @@ main(int argc, char *argv[])
 	char *progname;
 
 	memset(ccachesearch, 0, sizeof(ccachesearch));
-	while ((opt = getopt(argc, argv, "fvrlmnMp:k:d:t:R")) != -1) {
+	while ((opt = getopt(argc, argv, "fvrlmnMp:k:d:t:R:")) != -1) {
 		switch (opt) {
 			case 'f':
 				fg = 1;
Signature · 1 line
1.7.1
#2 lore raw

Re: [PATCH 1/3] Fix segfault when using -R option

Quoted 4 lines · Simo Sorce

The getopt string did not add : after the R option resulting in a sefgault whenever -R was used as optarg is NULL and it is dereferenced.

committed...

steved.

Quoted 18 lines
---
 utils/gssd/gssd.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
utils/gssd/gssd.c +1 -1
index 0be251781bacaa562270f773341126bc95ca6b45..07b1e52e6b84e9bcba96e7a63b0505ca7823482a 100644
@@ -102,7 +102,7 @@ main(int argc, char *argv[])
 	char *progname;
 
 	memset(ccachesearch, 0, sizeof(ccachesearch));
-	while ((opt = getopt(argc, argv, "fvrlmnMp:k:d:t:R")) != -1) {
+	while ((opt = getopt(argc, argv, "fvrlmnMp:k:d:t:R:")) != -1) {
 		switch (opt) {
 			case 'f':
 				fg = 1;
author
#3 lore raw

PATCH 2/3 Avoid reverse resolution for server name

In reply to Simo Sorce

A NFS client should be able to work properly even if the DNS Reverse record for the server is not set. There is no excuse to forcefully prevent that from working when it can.

This patch adds a new -N option that takes an 'on' or 'off' argument and controls whether forced PTR resolution is avoided (on) or performed (off)

To avoid breaking current behavior the option defaults to off by default, ideally we will turn this on by default after a transition period.

---
 utils/gssd/gss_util.h  |    2 ++
 utils/gssd/gssd.c      |   18 ++++++++++++++++--
 utils/gssd/gssd_proc.c |   25 +++++++++++++++++++++----
 3 files changed, 39 insertions(+), 6 deletions(-)
utils/gssd/gss_util.h +2 -0
index aa9f77806075f9ab67a7763a75a010369ba2d1b9..663fb0998bede6144118f890b9311ee8687176e3 100644
@@ -52,4 +52,6 @@ int gssd_check_mechs(void);
 		gss_krb5_set_allowable_enctypes(min, cred, num, types)
 #endif
 
+extern int avoid_ptr;
+
 #endif /* _GSS_UTIL_H_ */
utils/gssd/gssd.c +16 -2
index 07b1e52e6b84e9bcba96e7a63b0505ca7823482a..cc326dc2a729c1191c9f72ffd32203a58452b793 100644
@@ -82,10 +82,19 @@ sig_hup(int signal)
 	return;
 }
 
+static int get_bool_arg(const char *arg)
+{
+	if (strcmp(arg, "on") == 0)
+		return 1;
+	if (strcmp(arg, "off") == 0)
+		return 0;
+	return -1;
+}
+
 static void
 usage(char *progname)
 {
-	fprintf(stderr, "usage: %s [-f] [-l] [-M] [-n] [-v] [-r] [-p pipefsdir] [-k keytab] [-d ccachedir] [-t timeout] [-R preferred realm]\n",
+	fprintf(stderr, "usage: %s [-f] [-l] [-M] [-N on|off] [-n] [-v] [-r] [-p pipefsdir] [-k keytab] [-d ccachedir] [-t timeout] [-R preferred realm]\n",
 		progname);
 	exit(1);
 }
@@ -102,7 +111,7 @@ main(int argc, char *argv[])
 	char *progname;
 
 	memset(ccachesearch, 0, sizeof(ccachesearch));
-	while ((opt = getopt(argc, argv, "fvrlmnMp:k:d:t:R:")) != -1) {
+	while ((opt = getopt(argc, argv, "fvrlmnMp:k:d:t:R:N:")) != -1) {
 		switch (opt) {
 			case 'f':
 				fg = 1;
@@ -150,6 +159,11 @@ main(int argc, char *argv[])
 				errx(1, "Encryption type limits not supported by Kerberos libraries.");
 #endif
 				break;
+			case 'N':
+				avoid_ptr = get_bool_arg(optarg);
+				if (avoid_ptr == -1)
+					errx(1, "Invalid argument for -N option");
+				break;
 			default:
 				usage(argv[0]);
 				break;
utils/gssd/gssd_proc.c +21 -4
index ea01e92e4565670b97dea1a936d2f0dbdc7c4610..21d4e1d78eb54d177626cb0a19b9de4e93e0a20d 100644
@@ -67,6 +67,7 @@
 #include <errno.h>
 #include <gssapi/gssapi.h>
 #include <netdb.h>
+#include <ctype.h>
 
 #include "gssd.h"
 #include "err_util.h"
@@ -107,6 +108,8 @@ struct pollfd * pollarray;
 
 unsigned long pollsize;  /* the size of pollaray (in pollfd's) */
 
+int avoid_ptr = 0;
+
 /*
  * convert a presentation address string to a sockaddr_storage struct. Returns
  * true on success or false on failure.
@@ -165,12 +168,26 @@ addrstr_to_sockaddr(struct sockaddr *sa, const char *node, const char *port)
  * convert a sockaddr to a hostname
  */
 static char *
-sockaddr_to_hostname(const struct sockaddr *sa, const char *addr)
+get_servername(const char *name, const struct sockaddr *sa, const char *addr)
 {
 	socklen_t		addrlen;
 	int			err;
 	char			*hostname;
 	char			hbuf[NI_MAXHOST];
+	unsigned char		buf[sizeof(struct in6_addr)];
+	int			do_ptr_lookup = 0;
+
+	if (avoid_ptr) {
+		/* try to determine if this is a name, or an IP address.
+		 * If it is an IP fallback to a PTR lookup */
+		if (strchr(name, '.') && inet_pton(AF_INET, name, buf) == 1)
+			do_ptr_lookup = 1; /* IPv4 */
+		else if (strchr(name, ':') && inet_pton(AF_INET6, name, buf) == 1)
+			do_ptr_lookup = 1; /* or IPv6 */
+		if (!do_ptr_lookup) {
+			return strdup(name);
+		}
+	}
 
 	switch (sa->sa_family) {
 	case AF_INET:
@@ -208,7 +225,7 @@ read_service_info(char *info_file_name, char **servicename, char **servername,
 		  struct sockaddr *addr) {
 #define INFOBUFLEN 256
 	char		buf[INFOBUFLEN + 1];
-	static char	dummy[128];
+	static char	server[128];
 	int		nbytes;
 	static char	service[128];
 	static char	address[128];
@@ -236,7 +253,7 @@ read_service_info(char *info_file_name, char **servicename, char **servername,
 		   "service: %127s %15s version %15s\n"
 		   "address: %127s\n"
 		   "protocol: %15s\n",
-		   dummy,
+		   server,
 		   service, program, version,
 		   address,
 		   protoname);
@@ -258,7 +275,7 @@ read_service_info(char *info_file_name, char **servicename, char **servername,
 	if (!addrstr_to_sockaddr(addr, address, port))
 		goto fail;
 
-	*servername = sockaddr_to_hostname(addr, address);
+	*servername = get_servername(server, addr, address);
 	if (*servername == NULL)
 		goto fail;
 
Signature · 1 line
1.7.1
#4 lore raw

RE: [PATCH 2/3] Avoid reverse resolution for server name

Quoted 10 lines

-----Original Message-----
From: [email protected] [mailto:linux-nfs- [email protected]] On Behalf Of Simo Sorce
Sent: Tuesday, April 02, 2013 1:49 PM
To: Linux NFS Mailing list
Subject: [PATCH 2/3] Avoid reverse resolution for server name

A NFS client should be able to work properly even if the DNS Reverse record for the server is not set. There is no excuse to forcefully prevent that from working when it can.

Note that rpc.statd has the same limitation.

Quoted 2 lines

This patch adds a new -N option that takes an 'on' or 'off' argument and controls whether forced PTR resolution is avoided (on) or performed (off)

'-N' already has a very different meaning on rpc.mountd and rpc.nfsd. It might therefore be better to choose a different name to avoid confusion. Also, why do a single option with an 'on/off' argument instead of just choosing 2 options ?

Trond

author
#5 lore raw

RE: [PATCH 2/3] Avoid reverse resolution for server name

Quoted 11 lines · Trond
Quoted 10 lines

-----Original Message-----
From: [email protected] [mailto:linux-nfs- [email protected]] On Behalf Of Simo Sorce
Sent: Tuesday, April 02, 2013 1:49 PM
To: Linux NFS Mailing list
Subject: [PATCH 2/3] Avoid reverse resolution for server name

A NFS client should be able to work properly even if the DNS Reverse record for the server is not set. There is no excuse to forcefully prevent that from working when it can.

Quoted 8 lines

Note that rpc.statd has the same limitation.

Quoted 2 lines

This patch adds a new -N option that takes an 'on' or 'off' argument and controls whether forced PTR resolution is avoided (on) or performed (off)

'-N' already has a very different meaning on rpc.mountd and rpc.nfsd. It might therefore be better to choose a different name to avoid confusion. Also, why do a single option with an 'on/off' argument instead of just choosing 2 options ?

Well Jeff seemed to suggest that way, I do not have any preference, can you please give me 2 letters to use ?

Meanwhile I'll check rpc.statd as well.

Simo.

Signature · 1 line
Simo Sorce * Red Hat, Inc * New York
#6 lore raw

Re: [PATCH 2/3] Avoid reverse resolution for server name

Quoted 20 lines · On Tue, 02 Apr 2013 14:08:56 -0400 Simo Sorce <[email protected]> wrote:
Quoted 11 lines · Trond
Quoted 10 lines

-----Original Message-----
From: [email protected] [mailto:linux-nfs- [email protected]] On Behalf Of Simo Sorce
Sent: Tuesday, April 02, 2013 1:49 PM
To: Linux NFS Mailing list
Subject: [PATCH 2/3] Avoid reverse resolution for server name

A NFS client should be able to work properly even if the DNS Reverse record for the server is not set. There is no excuse to forcefully prevent that from working when it can.

Quoted 8 lines

Note that rpc.statd has the same limitation.

Quoted 2 lines

This patch adds a new -N option that takes an 'on' or 'off' argument and controls whether forced PTR resolution is avoided (on) or performed (off)

'-N' already has a very different meaning on rpc.mountd and rpc.nfsd. It might therefore be better to choose a different name to avoid confusion. Also, why do a single option with an 'on/off' argument instead of just choosing 2 options ?

Quoted 7 lines

Well Jeff seemed to suggest that way, I do not have any preference, can you please give me 2 letters to use ?

Meanwhile I'll check rpc.statd as well.

Simo.

FWIW, doesn't much matter to me...

You just want some clear way to designate what behavior you want, and some way to tell whether it was specified at all (so you can disable the warning if it was).

Signature · 1 line
Jeff Layton <[email protected]>
author
#7 lore raw

RE: [PATCH 2/3] Avoid reverse resolution for server name

In reply to Myklebust, Trond
Quoted 7 lines · Trond
Quoted 7 lines

-----Original Message-----
From: [email protected] [mailto:linux-nfs- [email protected]] On Behalf Of Simo Sorce
Sent: Tuesday, April 02, 2013 1:49 PM
To: Linux NFS Mailing list
Subject: [PATCH 2/3] Avoid reverse resolution for server name

Quoted 5 lines
Quoted 3 lines

A NFS client should be able to work properly even if the DNS Reverse record for the server is not set. There is no excuse to forcefully prevent that from working when it can.

Note that rpc.statd has the same limitation.

I checked rpc.statd with a quick "git grep getnameinfo", and as far as I can see PTR lookups are done only if the 'name' is actually an IP address, but skipped if not. So I think rpc.statd is ok.

I see rpc.statd uses getaddrinfo with hints set to AI_NUMERICHOST, if that's preferred over using inet_pton I can change my patches to do the same.

Simo.

Signature · 1 line
Simo Sorce * Red Hat, Inc * New York
#8 lore raw

Re: [PATCH 2/3] Avoid reverse resolution for server name

Quoted 14 lines · Simo Sorce
Quoted 7 lines · Trond
Quoted 7 lines

-----Original Message-----
From: [email protected] [mailto:linux-nfs- [email protected]] On Behalf Of Simo Sorce
Sent: Tuesday, April 02, 2013 1:49 PM
To: Linux NFS Mailing list
Subject: [PATCH 2/3] Avoid reverse resolution for server name

Quoted 5 lines
Quoted 3 lines

A NFS client should be able to work properly even if the DNS Reverse record for the server is not set. There is no excuse to forcefully prevent that from working when it can.

Note that rpc.statd has the same limitation.

Quoted 7 lines

I checked rpc.statd with a quick "git grep getnameinfo", and as far as I can see PTR lookups are done only if the 'name' is actually an IP address, but skipped if not. So I think rpc.statd is ok.

I see rpc.statd uses getaddrinfo with hints set to AI_NUMERICHOST, if that's preferred over using inet_pton I can change my patches to do the same.

Please do.. let try to keep it consistent.... thanks!

steved.

author
#9 lore raw

Re: [PATCH 2/3] Avoid reverse resolution for server name

Quoted 16 lines · Steve Dickson
Quoted 14 lines · Simo Sorce
Quoted 12 lines · Trond
Quoted 10 lines

-----Original Message-----
From: [email protected] [mailto:linux-nfs- [email protected]] On Behalf Of Simo Sorce
Sent: Tuesday, April 02, 2013 1:49 PM
To: Linux NFS Mailing list
Subject: [PATCH 2/3] Avoid reverse resolution for server name

A NFS client should be able to work properly even if the DNS Reverse record for the server is not set. There is no excuse to forcefully prevent that from working when it can.

Note that rpc.statd has the same limitation.

Quoted 8 lines
Quoted 7 lines

I checked rpc.statd with a quick "git grep getnameinfo", and as far as I can see PTR lookups are done only if the 'name' is actually an IP address, but skipped if not. So I think rpc.statd is ok.

I see rpc.statd uses getaddrinfo with hints set to AI_NUMERICHOST, if that's preferred over using inet_pton I can change my patches to do the same.

Please do.. let try to keep it consistent.... thanks!

Ok I looked at doing it, and looked at a helper function to reuse to avoid duplication, however the functions in statd/hostname.c are static, then I looked ad host_pton in support/export/hostname.c and realized 2 things:
- the comments there say inet_pton is actually better for what I need to do, in fact inet_pton is used as a filter before calling getaddrinfo.
- the function can't be used in gssd_proc.c as the file is not linked there.

So given the above I would prefer to not change the use of inet_pton in the patches and leave them as is.

Simo.

Signature · 1 line
Simo Sorce * Red Hat, Inc * New York
#10 lore raw

Re: [PATCH 2/3] Avoid reverse resolution for server name

In reply to Myklebust, Trond
Quoted 11 lines · Trond
Quoted 10 lines

-----Original Message-----
From: [email protected] [mailto:linux-nfs- [email protected]] On Behalf Of Simo Sorce
Sent: Tuesday, April 02, 2013 1:49 PM
To: Linux NFS Mailing list
Subject: [PATCH 2/3] Avoid reverse resolution for server name

A NFS client should be able to work properly even if the DNS Reverse record for the server is not set. There is no excuse to forcefully prevent that from working when it can.

Quoted 7 lines

Note that rpc.statd has the same limitation.

Quoted 2 lines

This patch adds a new -N option that takes an 'on' or 'off' argument and controls whether forced PTR resolution is avoided (on) or performed (off)

'-N' already has a very different meaning on rpc.mountd and rpc.nfsd. It might therefore be better to choose a different name to avoid confusion. Also, why do a single option with an 'on/off' argument instead of just choosing 2 options ?

Do we really what two options? why not just have something like -Z that will restore today default?

steved.

Quoted 7 lines

Trond
--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

author
#11 lore raw

cover Alternative patchset to avoid PTR lookups

This one does the same thing as the previous but uses -z/-Z options.

Pick the one you like most, but this one is less code, so I guess it is porefereable.

Simo Sorce (2):
Avoid reverse resolution for server name
Document new -z/-Z options

 utils/gssd/gss_util.h  |    2 ++
 utils/gssd/gssd.c      |   10 ++++++++--
 utils/gssd/gssd.man    |   13 ++++++++++++-
 utils/gssd/gssd_proc.c |   25 +++++++++++++++++++++----
 4 files changed, 43 insertions(+), 7 deletions(-)
author
#12 lore raw

PATCH 1/2 Avoid reverse resolution for server name

In reply to Steve Dickson

A NFS client should be able to work properly even if the DNS Reverse record for the server is not set. There is no excuse to forcefully prevent that from working when it can.

This patch adds a new pair of options (-z/-Z) that allow to turn on/off DNS reverse resolution for determining the server name to use with GSSAPI.

To avoid breaking current behavior the option defaults to off by default, ideally we will turn this on by default after a transition period.

---
 utils/gssd/gss_util.h  |    2 ++
 utils/gssd/gssd.c      |   10 ++++++++--
 utils/gssd/gssd_proc.c |   25 +++++++++++++++++++++----
 3 files changed, 31 insertions(+), 6 deletions(-)
utils/gssd/gss_util.h +2 -0
index aa9f77806075f9ab67a7763a75a010369ba2d1b9..663fb0998bede6144118f890b9311ee8687176e3 100644
@@ -52,4 +52,6 @@ int gssd_check_mechs(void);
 		gss_krb5_set_allowable_enctypes(min, cred, num, types)
 #endif
 
+extern int avoid_ptr;
+
 #endif /* _GSS_UTIL_H_ */
utils/gssd/gssd.c +8 -2
index 07b1e52e6b84e9bcba96e7a63b0505ca7823482a..1f0ac0c47667c42ed03e271cb18b6124165e5d5f 100644
@@ -85,7 +85,7 @@ sig_hup(int signal)
 static void
 usage(char *progname)
 {
-	fprintf(stderr, "usage: %s [-f] [-l] [-M] [-n] [-v] [-r] [-p pipefsdir] [-k keytab] [-d ccachedir] [-t timeout] [-R preferred realm]\n",
+	fprintf(stderr, "usage: %s [-f] [-l] [-M] [-n] [-v] [-r] [-p pipefsdir] [-k keytab] [-d ccachedir] [-t timeout] [-R preferred realm] [-z] [-Z]\n",
 		progname);
 	exit(1);
 }
@@ -102,7 +102,7 @@ main(int argc, char *argv[])
 	char *progname;
 
 	memset(ccachesearch, 0, sizeof(ccachesearch));
-	while ((opt = getopt(argc, argv, "fvrlmnMp:k:d:t:R:")) != -1) {
+	while ((opt = getopt(argc, argv, "fvrlmnMp:k:d:t:R:zZ")) != -1) {
 		switch (opt) {
 			case 'f':
 				fg = 1;
@@ -150,6 +150,12 @@ main(int argc, char *argv[])
 				errx(1, "Encryption type limits not supported by Kerberos libraries.");
 #endif
 				break;
+			case 'z':
+				avoid_ptr = 1;
+				break;
+			case 'Z':
+				avoid_ptr = 0;
+				break;
 			default:
 				usage(argv[0]);
 				break;
utils/gssd/gssd_proc.c +21 -4
index ea01e92e4565670b97dea1a936d2f0dbdc7c4610..21d4e1d78eb54d177626cb0a19b9de4e93e0a20d 100644
@@ -67,6 +67,7 @@
 #include <errno.h>
 #include <gssapi/gssapi.h>
 #include <netdb.h>
+#include <ctype.h>
 
 #include "gssd.h"
 #include "err_util.h"
@@ -107,6 +108,8 @@ struct pollfd * pollarray;
 
 unsigned long pollsize;  /* the size of pollaray (in pollfd's) */
 
+int avoid_ptr = 0;
+
 /*
  * convert a presentation address string to a sockaddr_storage struct. Returns
  * true on success or false on failure.
@@ -165,12 +168,26 @@ addrstr_to_sockaddr(struct sockaddr *sa, const char *node, const char *port)
  * convert a sockaddr to a hostname
  */
 static char *
-sockaddr_to_hostname(const struct sockaddr *sa, const char *addr)
+get_servername(const char *name, const struct sockaddr *sa, const char *addr)
 {
 	socklen_t		addrlen;
 	int			err;
 	char			*hostname;
 	char			hbuf[NI_MAXHOST];
+	unsigned char		buf[sizeof(struct in6_addr)];
+	int			do_ptr_lookup = 0;
+
+	if (avoid_ptr) {
+		/* try to determine if this is a name, or an IP address.
+		 * If it is an IP fallback to a PTR lookup */
+		if (strchr(name, '.') && inet_pton(AF_INET, name, buf) == 1)
+			do_ptr_lookup = 1; /* IPv4 */
+		else if (strchr(name, ':') && inet_pton(AF_INET6, name, buf) == 1)
+			do_ptr_lookup = 1; /* or IPv6 */
+		if (!do_ptr_lookup) {
+			return strdup(name);
+		}
+	}
 
 	switch (sa->sa_family) {
 	case AF_INET:
@@ -208,7 +225,7 @@ read_service_info(char *info_file_name, char **servicename, char **servername,
 		  struct sockaddr *addr) {
 #define INFOBUFLEN 256
 	char		buf[INFOBUFLEN + 1];
-	static char	dummy[128];
+	static char	server[128];
 	int		nbytes;
 	static char	service[128];
 	static char	address[128];
@@ -236,7 +253,7 @@ read_service_info(char *info_file_name, char **servicename, char **servername,
 		   "service: %127s %15s version %15s\n"
 		   "address: %127s\n"
 		   "protocol: %15s\n",
-		   dummy,
+		   server,
 		   service, program, version,
 		   address,
 		   protoname);
@@ -258,7 +275,7 @@ read_service_info(char *info_file_name, char **servicename, char **servername,
 	if (!addrstr_to_sockaddr(addr, address, port))
 		goto fail;
 
-	*servername = sockaddr_to_hostname(addr, address);
+	*servername = get_servername(server, addr, address);
 	if (*servername == NULL)
 		goto fail;
 
Signature · 1 line
1.7.1
#13 lore raw

Re: [PATCH 1/2] Avoid reverse resolution for server name

Quoted 6 lines · Simo Sorce

A NFS client should be able to work properly even if the DNS Reverse record for the server is not set. There is no excuse to forcefully prevent that from working when it can.

This patch adds a new pair of options (-z/-Z) that allow to turn on/off DNS reverse resolution for determining the server name to use with GSSAPI.

Again, please tell me why we need the -Z flag when that is the default?

steved.

Quoted 134 lines

To avoid breaking current behavior the option defaults to off by default, ideally we will turn this on by default after a transition period.

---
 utils/gssd/gss_util.h  |    2 ++
 utils/gssd/gssd.c      |   10 ++++++++--
 utils/gssd/gssd_proc.c |   25 +++++++++++++++++++++----
 3 files changed, 31 insertions(+), 6 deletions(-)
utils/gssd/gss_util.h +2 -0
index aa9f77806075f9ab67a7763a75a010369ba2d1b9..663fb0998bede6144118f890b9311ee8687176e3 100644
@@ -52,4 +52,6 @@ int gssd_check_mechs(void);
 		gss_krb5_set_allowable_enctypes(min, cred, num, types)
 #endif
 
+extern int avoid_ptr;
+
 #endif /* _GSS_UTIL_H_ */
utils/gssd/gssd.c +8 -2
index 07b1e52e6b84e9bcba96e7a63b0505ca7823482a..1f0ac0c47667c42ed03e271cb18b6124165e5d5f 100644
@@ -85,7 +85,7 @@ sig_hup(int signal)
 static void
 usage(char *progname)
 {
-	fprintf(stderr, "usage: %s [-f] [-l] [-M] [-n] [-v] [-r] [-p pipefsdir] [-k keytab] [-d ccachedir] [-t timeout] [-R preferred realm]\n",
+	fprintf(stderr, "usage: %s [-f] [-l] [-M] [-n] [-v] [-r] [-p pipefsdir] [-k keytab] [-d ccachedir] [-t timeout] [-R preferred realm] [-z] [-Z]\n",
 		progname);
 	exit(1);
 }
@@ -102,7 +102,7 @@ main(int argc, char *argv[])
 	char *progname;
 
 	memset(ccachesearch, 0, sizeof(ccachesearch));
-	while ((opt = getopt(argc, argv, "fvrlmnMp:k:d:t:R:")) != -1) {
+	while ((opt = getopt(argc, argv, "fvrlmnMp:k:d:t:R:zZ")) != -1) {
 		switch (opt) {
 			case 'f':
 				fg = 1;
@@ -150,6 +150,12 @@ main(int argc, char *argv[])
 				errx(1, "Encryption type limits not supported by Kerberos libraries.");
 #endif
 				break;
+			case 'z':
+				avoid_ptr = 1;
+				break;
+			case 'Z':
+				avoid_ptr = 0;
+				break;
 			default:
 				usage(argv[0]);
 				break;
utils/gssd/gssd_proc.c +21 -4
index ea01e92e4565670b97dea1a936d2f0dbdc7c4610..21d4e1d78eb54d177626cb0a19b9de4e93e0a20d 100644
@@ -67,6 +67,7 @@
 #include <errno.h>
 #include <gssapi/gssapi.h>
 #include <netdb.h>
+#include <ctype.h>
 
 #include "gssd.h"
 #include "err_util.h"
@@ -107,6 +108,8 @@ struct pollfd * pollarray;
 
 unsigned long pollsize;  /* the size of pollaray (in pollfd's) */
 
+int avoid_ptr = 0;
+
 /*
  * convert a presentation address string to a sockaddr_storage struct. Returns
  * true on success or false on failure.
@@ -165,12 +168,26 @@ addrstr_to_sockaddr(struct sockaddr *sa, const char *node, const char *port)
  * convert a sockaddr to a hostname
  */
 static char *
-sockaddr_to_hostname(const struct sockaddr *sa, const char *addr)
+get_servername(const char *name, const struct sockaddr *sa, const char *addr)
 {
 	socklen_t		addrlen;
 	int			err;
 	char			*hostname;
 	char			hbuf[NI_MAXHOST];
+	unsigned char		buf[sizeof(struct in6_addr)];
+	int			do_ptr_lookup = 0;
+
+	if (avoid_ptr) {
+		/* try to determine if this is a name, or an IP address.
+		 * If it is an IP fallback to a PTR lookup */
+		if (strchr(name, '.') && inet_pton(AF_INET, name, buf) == 1)
+			do_ptr_lookup = 1; /* IPv4 */
+		else if (strchr(name, ':') && inet_pton(AF_INET6, name, buf) == 1)
+			do_ptr_lookup = 1; /* or IPv6 */
+		if (!do_ptr_lookup) {
+			return strdup(name);
+		}
+	}
 
 	switch (sa->sa_family) {
 	case AF_INET:
@@ -208,7 +225,7 @@ read_service_info(char *info_file_name, char **servicename, char **servername,
 		  struct sockaddr *addr) {
 #define INFOBUFLEN 256
 	char		buf[INFOBUFLEN + 1];
-	static char	dummy[128];
+	static char	server[128];
 	int		nbytes;
 	static char	service[128];
 	static char	address[128];
@@ -236,7 +253,7 @@ read_service_info(char *info_file_name, char **servicename, char **servername,
 		   "service: %127s %15s version %15s\n"
 		   "address: %127s\n"
 		   "protocol: %15s\n",
-		   dummy,
+		   server,
 		   service, program, version,
 		   address,
 		   protoname);
@@ -258,7 +275,7 @@ read_service_info(char *info_file_name, char **servicename, char **servername,
 	if (!addrstr_to_sockaddr(addr, address, port))
 		goto fail;
 
-	*servername = sockaddr_to_hostname(addr, address);
+	*servername = get_servername(server, addr, address);
 	if (*servername == NULL)
 		goto fail;
 
author
#14 lore raw

Re: [PATCH 1/2] Avoid reverse resolution for server name

Quoted 9 lines · Steve Dickson
Quoted 6 lines · Simo Sorce

A NFS client should be able to work properly even if the DNS Reverse record for the server is not set. There is no excuse to forcefully prevent that from working when it can.

This patch adds a new pair of options (-z/-Z) that allow to turn on/off DNS reverse resolution for determining the server name to use with GSSAPI.

Again, please tell me why we need the -Z flag when that is the default?

The idea is to switch the default in the code at some point, so then -Z will be needed to get back to the original behavior.

The idea is that by having both flags a distribution may choose to decide now what behavior they want and use the relative flag. Then even if we change the default their configuration will not "break".

Simo.

Signature · 1 line
Simo Sorce * Red Hat, Inc * New York
#15 lore raw

Re: [PATCH 1/2] Avoid reverse resolution for server name

Quoted 7 lines · Simo Sorce
Quoted 6 lines · Steve Dickson
Quoted 4 lines · Simo Sorce

A NFS client should be able to work properly even if the DNS Reverse record for the server is not set. There is no excuse to forcefully prevent that from working when it can.

Quoted 6 lines
Quoted 3 lines
Quoted 2 lines

This patch adds a new pair of options (-z/-Z) that allow to turn on/off DNS reverse resolution for determining the server name to use with GSSAPI.

Again, please tell me why we need the -Z flag when that is the default?

The idea is to switch the default in the code at some point, so then -Z will be needed to get back to the original behavior.

I'm thinking that's what major version number changes are for... not flags...

Quoted 4 lines

The idea is that by having both flags a distribution may choose to decide now what behavior they want and use the relative flag. Then even if we change the default their configuration will not "break".

I'll do the work to remove the option and repost the patches..

steved.

author
#16 lore raw

Re: [PATCH 1/2] Avoid reverse resolution for server name

Quoted 15 lines · Steve Dickson
Quoted 7 lines · Simo Sorce
Quoted 6 lines · Steve Dickson
Quoted 4 lines · Simo Sorce

A NFS client should be able to work properly even if the DNS Reverse record for the server is not set. There is no excuse to forcefully prevent that from working when it can.

Quoted 6 lines
Quoted 3 lines
Quoted 2 lines

This patch adds a new pair of options (-z/-Z) that allow to turn on/off DNS reverse resolution for determining the server name to use with GSSAPI.

Again, please tell me why we need the -Z flag when that is the default?

The idea is to switch the default in the code at some point, so then -Z will be needed to get back to the original behavior.

Quoted 7 lines

I'm thinking that's what major version number changes are for... not flags...

Quoted 4 lines

The idea is that by having both flags a distribution may choose to decide now what behavior they want and use the relative flag. Then even if we change the default their configuration will not "break".

I'll do the work to remove the option and repost the patches..

As you wish, I do not have hard preferences, should we take the bait and also by default *not* do PTR lookups ?

Simo.

Signature · 1 line
Simo Sorce * Red Hat, Inc * New York
#17 lore raw

Re: [PATCH 1/2] Avoid reverse resolution for server name

Quoted 19 lines · Simo Sorce
Quoted 18 lines · Steve Dickson
Quoted 7 lines · Simo Sorce
Quoted 6 lines · Steve Dickson
Quoted 4 lines · Simo Sorce

A NFS client should be able to work properly even if the DNS Reverse record for the server is not set. There is no excuse to forcefully prevent that from working when it can.

Quoted 6 lines
Quoted 3 lines
Quoted 2 lines

This patch adds a new pair of options (-z/-Z) that allow to turn on/off DNS reverse resolution for determining the server name to use with GSSAPI.

Again, please tell me why we need the -Z flag when that is the default?

The idea is to switch the default in the code at some point, so then -Z will be needed to get back to the original behavior.

I'm thinking that's what major version number changes are for... not flags...

Quoted 1 line
Quoted 7 lines
Quoted 4 lines
Quoted 3 lines

The idea is that by having both flags a distribution may choose to decide now what behavior they want and use the relative flag. Then even if we change the default their configuration will not "break".

I'll do the work to remove the option and repost the patches..

As you wish, I do not have hard preferences, should we take the bait and also by default *not* do PTR lookups ?

I was thinking no. Leaves the default as is and used the -z to avoid the lookup...

I'm struggling with how big of a problem this really is, so why should be break existing environments? I'm no DNS expert but I thinking not have PTR is a DNS config issue... but again I'm no expert...

steved.

author
#18 lore raw

Re: [PATCH 1/2] Avoid reverse resolution for server name

Quoted 26 lines · Steve Dickson
Quoted 24 lines · Simo Sorce
Quoted 22 lines · Steve Dickson
Quoted 7 lines · Simo Sorce
Quoted 6 lines · Steve Dickson
Quoted 4 lines · Simo Sorce

A NFS client should be able to work properly even if the DNS Reverse record for the server is not set. There is no excuse to forcefully prevent that from working when it can.

Quoted 6 lines
Quoted 3 lines
Quoted 2 lines

This patch adds a new pair of options (-z/-Z) that allow to turn on/off DNS reverse resolution for determining the server name to use with GSSAPI.

Again, please tell me why we need the -Z flag when that is the default?

The idea is to switch the default in the code at some point, so then -Z will be needed to get back to the original behavior.

I'm thinking that's what major version number changes are for... not flags...

Quoted 4 lines

The idea is that by having both flags a distribution may choose to decide now what behavior they want and use the relative flag. Then even if we change the default their configuration will not "break".

I'll do the work to remove the option and repost the patches..

Quoted 8 lines
Quoted 2 lines

As you wish, I do not have hard preferences, should we take the bait and also by default *not* do PTR lookups ?

I was thinking no. Leaves the default as is and used the -z to avoid the lookup...

I'm struggling with how big of a problem this really is, so why should be break existing environments? I'm no DNS expert but I thinking not have PTR is a DNS config issue... but again I'm no expert...

Read this:
http://ssimo.org/blog/id_015.html

Simo.

Signature · 1 line
Simo Sorce * Red Hat, Inc * New York
#19 lore raw

Re: [PATCH 1/2] Avoid reverse resolution for server name

In reply to Steve Dickson
Quoted 27 lines · Steve Dickson
Quoted 24 lines · Simo Sorce
Quoted 22 lines · Steve Dickson
Quoted 7 lines · Simo Sorce
Quoted 6 lines · Steve Dickson
Quoted 4 lines · Simo Sorce

A NFS client should be able to work properly even if the DNS Reverse record for the server is not set. There is no excuse to forcefully prevent that from working when it can.

Quoted 6 lines
Quoted 3 lines
Quoted 2 lines

This patch adds a new pair of options (-z/-Z) that allow to turn on/off DNS reverse resolution for determining the server name to use with GSSAPI.

Again, please tell me why we need the -Z flag when that is the default?

The idea is to switch the default in the code at some point, so then -Z will be needed to get back to the original behavior.

I'm thinking that's what major version number changes are for... not flags...

Quoted 4 lines

The idea is that by having both flags a distribution may choose to decide now what behavior they want and use the relative flag. Then even if we change the default their configuration will not "break".

I'll do the work to remove the option and repost the patches..

Quoted 8 lines
Quoted 2 lines

As you wish, I do not have hard preferences, should we take the bait and also by default *not* do PTR lookups ?

I was thinking no. Leaves the default as is and used the -z to avoid the lookup...

I'm struggling with how big of a problem this really is, so why should be break existing environments? I'm no DNS expert but I thinking not have PTR is a DNS config issue... but again I'm no expert...

Argh, no, one away or another the default needs to be to not do the PTR lookup.

The transition Simo's using was Jeff's suggestion. Let's just stick to that if we don't have a good reason.

(But I don't have strong opinions about how to do it either. I'd actually be OK with being harsh and just switching to the new behavior without any option.)

--b.

#20 lore raw

Re: [PATCH 1/2] Avoid reverse resolution for server name

Quoted 33 lines · J. Bruce Fields
Quoted 32 lines · Steve Dickson
Quoted 19 lines · Simo Sorce
Quoted 18 lines · Steve Dickson
Quoted 7 lines · Simo Sorce
Quoted 6 lines · Steve Dickson
Quoted 4 lines · Simo Sorce

A NFS client should be able to work properly even if the DNS Reverse record for the server is not set. There is no excuse to forcefully prevent that from working when it can.

Quoted 6 lines
Quoted 3 lines
Quoted 2 lines

This patch adds a new pair of options (-z/-Z) that allow to turn on/off DNS reverse resolution for determining the server name to use with GSSAPI.

Again, please tell me why we need the -Z flag when that is the default?

The idea is to switch the default in the code at some point, so then -Z will be needed to get back to the original behavior.

I'm thinking that's what major version number changes are for... not flags...

Quoted 1 line
Quoted 7 lines
Quoted 4 lines
Quoted 3 lines

The idea is that by having both flags a distribution may choose to decide now what behavior they want and use the relative flag. Then even if we change the default their configuration will not "break".

I'll do the work to remove the option and repost the patches..

As you wish, I do not have hard preferences, should we take the bait and also by default *not* do PTR lookups ?

I was thinking no. Leaves the default as is and used the -z to avoid the lookup...

Quoted 6 lines
Quoted 3 lines

I'm struggling with how big of a problem this really is, so why should be break existing environments? I'm no DNS expert but I thinking not have PTR is a DNS config issue... but again I'm no expert...

Argh, no, one away or another the default needs to be to not do the PTR lookup.

Fine...

Quoted 3 lines

The transition Simo's using was Jeff's suggestion. Let's just stick to that if we don't have a good reason.

Yeah... I would like to avoid adding to flags... I don't think both are needed.

Quoted 4 lines

(But I don't have strong opinions about how to do it either. I'd actually be OK with being harsh and just switching to the new behavior without any option.)

My crutch is I'm not a big DNS guy so I'm not sure how much breakage would occur... So I would rather be on the safe side and give people a way to go back...

steved.

#21 lore raw

Re: [PATCH 1/2] Avoid reverse resolution for server name

Quoted 5 lines · Steve Dickson
Quoted 2 lines · J. Bruce Fields

Argh, no, one away or another the default needs to be to not do the PTR lookup.

Quoted 7 lines

Fine...

Quoted 3 lines

The transition Simo's using was Jeff's suggestion. Let's just stick to that if we don't have a good reason.

Yeah... I would like to avoid adding to flags... I don't think both are needed.

So, no flags.

Quoted 6 lines
Quoted 3 lines

(But I don't have strong opinions about how to do it either. I'd actually be OK with being harsh and just switching to the new behavior without any option.)

My crutch is I'm not a big DNS guy so I'm not sure how much breakage would occur... So I would rather be on the safe side and give people a way to go back...

So, yes to flags. I'm confused!

I guess we can be moderately harsh: switch to the new default and provide only a flag to restore the old default for whoever wants it, but not a flag to specify the new default. Is that what you mean?

--b.

#22 lore raw

Re: [PATCH 1/2] Avoid reverse resolution for server name

Quoted 23 lines · On Tue, 9 Apr 2013 15:22:59 -0400 "J. Bruce Fields" <[email protected]>…
Quoted 5 lines · Steve Dickson
Quoted 2 lines · J. Bruce Fields

Argh, no, one away or another the default needs to be to not do the PTR lookup.

Quoted 7 lines

Fine...

Quoted 3 lines

The transition Simo's using was Jeff's suggestion. Let's just stick to that if we don't have a good reason.

Yeah... I would like to avoid adding to flags... I don't think both are needed.

So, no flags.

Quoted 6 lines
Quoted 3 lines

(But I don't have strong opinions about how to do it either. I'd actually be OK with being harsh and just switching to the new behavior without any option.)

My crutch is I'm not a big DNS guy so I'm not sure how much breakage would occur... So I would rather be on the safe side and give people a way to go back...

Quoted 6 lines

So, yes to flags. I'm confused!

I guess we can be moderately harsh: switch to the new default and provide only a flag to restore the old default for whoever wants it, but not a flag to specify the new default. Is that what you mean?

I think the above is the best course of action at this point. My original thinking was "let's transition to the new behavior gracefully" -- start with the default as-is, and then after suitably warning everyone switch the default to the new behavior.

Now there's a CVE in play though, so I think our hands are tied here. We have to change the default to the new behavior now without any sort of graceful transition. That's likely to break in some environments at least, so I think we need some mechanism to allow people to switch gssd to the old behavior.

Note too that the problems are not likely to be "lack of a PTR record", but rather that they have multiple A records pointing at the server. In that situation, the ai_canonname field in the addrinfo struct may not match what the PTR record points to, depending on which server name you use.

Signature · 1 line
Jeff Layton <[email protected]>
#23 lore raw

Re: [PATCH 1/2] Avoid reverse resolution for server name

In reply to J. Bruce Fields
Quoted 16 lines · J. Bruce Fields
Quoted 5 lines · Steve Dickson
Quoted 2 lines · J. Bruce Fields

Argh, no, one away or another the default needs to be to not do the PTR lookup.

Quoted 7 lines

Fine...

Quoted 3 lines

The transition Simo's using was Jeff's suggestion. Let's just stick to that if we don't have a good reason.

Yeah... I would like to avoid adding to flags... I don't think both are needed.

So, no flags.

Quoted 8 lines
Quoted 6 lines
Quoted 3 lines

(But I don't have strong opinions about how to do it either. I'd actually be OK with being harsh and just switching to the new behavior without any option.)

My crutch is I'm not a big DNS guy so I'm not sure how much breakage would occur... So I would rather be on the safe side and give people a way to go back...

So, yes to flags. I'm confused!

Join the club! ;-)

Quoted 4 lines

I guess we can be moderately harsh: switch to the new default and provide only a flag to restore the old default for whoever wants it, but not a flag to specify the new default. Is that what you mean?

Yes... This makes sense to me...

steved.

author
#24 lore raw

PATCH 2/2 Document new -z/-Z options

In reply to Steve Dickson

Options are not in alphabetical order but -z/-Z clearly always come last.

---
 utils/gssd/gssd.man |   13 ++++++++++++-
 1 files changed, 12 insertions(+), 1 deletions(-)
utils/gssd/gssd.man +12 -1
index 79d9bf91ac6b976c57d167e60d07f828a3ff5b1f..7918c2a0ff76c3918449cf3e1420f0a289929ac1 100644
@@ -8,7 +8,7 @@
 rpc.gssd \- RPCSEC_GSS daemon
 .SH SYNOPSIS
 .B rpc.gssd
-.RB [ \-fMnlvr ]
+.RB [ \-fMnlvrzZ ]
 .RB [ \-k
 .IR keytab ]
 .RB [ \-p
@@ -266,6 +266,17 @@ new kernel contexts to be negotiated after
 seconds, which allows changing Kerberos tickets and identities frequently.
 The default is no explicit timeout, which means the kernel context will live
 the lifetime of the Kerberos service ticket used in its creation.
+.TP
+.B -z
+This option tries to avoid DNS Reverse (PTR) lookups for determining the 
+server name to pass to GSSAPI if the name passed at mount point is not an IP 
+address. Currently off by default for compatibility reasons.
+.TP
+.B -Z
+This is the inverse of 
+.B -z
+and forces the use of DNS Reverse resolution of the server's IP address to
+retrieve the server name to use in GSAPI authentication.
 .SH SEE ALSO
 .BR rpc.svcgssd (8),
 .BR kerberos (1),
Signature · 1 line
1.7.1
#25 lore raw

Re: [PATCH 2/2] Document new -z/-Z options

Quoted 25 lines · Simo Sorce

Options are not in alphabetical order but -z/-Z clearly always come last.

---
 utils/gssd/gssd.man |   13 ++++++++++++-
 1 files changed, 12 insertions(+), 1 deletions(-)
utils/gssd/gssd.man +2 -1
index 79d9bf91ac6b976c57d167e60d07f828a3ff5b1f..7918c2a0ff76c3918449cf3e1420f0a289929ac1 100644
@@ -8,7 +8,7 @@
 rpc.gssd \- RPCSEC_GSS daemon
 .SH SYNOPSIS
 .B rpc.gssd
-.RB [ \-fMnlvr ]
+.RB [ \-fMnlvrzZ ]
 .RB [ \-k
 .IR keytab ]
 .RB [ \-p
@@ -266,6 +266,17 @@ new kernel contexts to be negotiated after
 seconds, which allows changing Kerberos tickets and identities frequently.
 The default is no explicit timeout, which means the kernel context will live
 the lifetime of the Kerberos service ticket used in its creation.
+.TP

utils/gssd/gssd.man new kernel contexts to be negotiated after · line 279

Quoted 10 lines
utils/gssd/gssd.man +10 -0
+.B -z
+This option tries to avoid DNS Reverse (PTR) lookups for determining the 
+server name to pass to GSSAPI if the name passed at mount point is not an IP 
+address. Currently off by default for compatibility reasons.
+.TP
+.B -Z
+This is the inverse of 
+.B -z
+and forces the use of DNS Reverse resolution of the server's IP address to
+retrieve the server name to use in GSAPI authentication.

By the way I think with the "new" upcall, gssd ignores whatever it got out of the info file if the "target=" parameter is provided in the upcall.

(But looking at the code I think that's only used in the nfsv4.0 callback case, and isn't worth mentioning here.)

--b.

Quoted 10 lines
utils/gssd/gssd.man +0 -0
 .SH SEE ALSO
 .BR rpc.svcgssd (8),
 .BR kerberos (1),
Signature · 6 lines
1.7.1

--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#26 lore raw

Re: [PATCH 2/2] Document new -z/-Z options

Quoted 32 lines · J. Bruce Fields
Quoted 31 lines · Simo Sorce

Options are not in alphabetical order but -z/-Z clearly always come last.

---
 utils/gssd/gssd.man |   13 ++++++++++++-
 1 files changed, 12 insertions(+), 1 deletions(-)
utils/gssd/gssd.man +8 -1
index 79d9bf91ac6b976c57d167e60d07f828a3ff5b1f..7918c2a0ff76c3918449cf3e1420f0a289929ac1 100644
@@ -8,7 +8,7 @@
 rpc.gssd \- RPCSEC_GSS daemon
 .SH SYNOPSIS
 .B rpc.gssd
-.RB [ \-fMnlvr ]
+.RB [ \-fMnlvrzZ ]
 .RB [ \-k
 .IR keytab ]
 .RB [ \-p
@@ -266,6 +266,17 @@ new kernel contexts to be negotiated after
 seconds, which allows changing Kerberos tickets and identities frequently.
 The default is no explicit timeout, which means the kernel context will live
 the lifetime of the Kerberos service ticket used in its creation.
+.TP
+.B -z
+This option tries to avoid DNS Reverse (PTR) lookups for determining the 
+server name to pass to GSSAPI if the name passed at mount point is not an IP 
+address. Currently off by default for compatibility reasons.
+.TP
+.B -Z
Quoted 8 lines

utils/gssd/gssd.man new kernel contexts to be negotiated after · line 279

Quoted 4 lines
utils/gssd/gssd.man +4 -0
+This is the inverse of 
+.B -z
+and forces the use of DNS Reverse resolution of the server's IP address to
+retrieve the server name to use in GSAPI authentication.

By the way I think with the "new" upcall, gssd ignores whatever it got out of the info file if the "target=" parameter is provided in the upcall.

Correct.

Quoted 2 lines

(But looking at the code I think that's only used in the nfsv4.0 callback case, and isn't worth mentioning here.)

Wrong. It is also used for NFSv4 and NFSv4.1 state management.
IOW: SETCLIENTID/RENEW and for NFSv4.1 EXCHANGE_ID/SEQUENCE; anything that uses clp->cl_machine_cred.

Signature · 6 lines
Trond Myklebust
Linux NFS client maintainer

NetApp
[email protected]
www.netapp.com
#27 lore raw

Re: [PATCH 2/2] Document new -z/-Z options

Quoted 42 lines · Trond
Quoted 32 lines · J. Bruce Fields
Quoted 31 lines · Simo Sorce

Options are not in alphabetical order but -z/-Z clearly always come last.

---
 utils/gssd/gssd.man |   13 ++++++++++++-
 1 files changed, 12 insertions(+), 1 deletions(-)
utils/gssd/gssd.man +8 -1
index 79d9bf91ac6b976c57d167e60d07f828a3ff5b1f..7918c2a0ff76c3918449cf3e1420f0a289929ac1 100644
@@ -8,7 +8,7 @@
 rpc.gssd \- RPCSEC_GSS daemon
 .SH SYNOPSIS
 .B rpc.gssd
-.RB [ \-fMnlvr ]
+.RB [ \-fMnlvrzZ ]
 .RB [ \-k
 .IR keytab ]
 .RB [ \-p
@@ -266,6 +266,17 @@ new kernel contexts to be negotiated after
 seconds, which allows changing Kerberos tickets and identities frequently.
 The default is no explicit timeout, which means the kernel context will live
 the lifetime of the Kerberos service ticket used in its creation.
+.TP
+.B -z
+This option tries to avoid DNS Reverse (PTR) lookups for determining the 
+server name to pass to GSSAPI if the name passed at mount point is not an IP 
+address. Currently off by default for compatibility reasons.
+.TP
+.B -Z
Quoted 8 lines

utils/gssd/gssd.man new kernel contexts to be negotiated after · line 279

Quoted 4 lines
utils/gssd/gssd.man +4 -0
+This is the inverse of 
+.B -z
+and forces the use of DNS Reverse resolution of the server's IP address to
+retrieve the server name to use in GSAPI authentication.

By the way I think with the "new" upcall, gssd ignores whatever it got out of the info file if the "target=" parameter is provided in the upcall.

Quoted 8 lines

Correct.

Quoted 2 lines

(But looking at the code I think that's only used in the nfsv4.0 callback case, and isn't worth mentioning here.)

Wrong. It is also used for NFSv4 and NFSv4.1 state management.
IOW: SETCLIENTID/RENEW and for NFSv4.1 EXCHANGE_ID/SEQUENCE; anything that uses clp->cl_machine_cred.

I was talk about "target=", but I believe you're talking about "service=".

The former is a server name (myserver.example.com), the latter a service name (nfs).

--b.

#28 lore raw

Re: [PATCH 2/2] Document new -z/-Z options

Quoted 52 lines · J. Bruce Fields
Quoted 42 lines · Trond
Quoted 32 lines · J. Bruce Fields
Quoted 31 lines · Simo Sorce

Options are not in alphabetical order but -z/-Z clearly always come last.

---
 utils/gssd/gssd.man |   13 ++++++++++++-
 1 files changed, 12 insertions(+), 1 deletions(-)
utils/gssd/gssd.man +8 -1
index 79d9bf91ac6b976c57d167e60d07f828a3ff5b1f..7918c2a0ff76c3918449cf3e1420f0a289929ac1 100644
@@ -8,7 +8,7 @@
 rpc.gssd \- RPCSEC_GSS daemon
 .SH SYNOPSIS
 .B rpc.gssd
-.RB [ \-fMnlvr ]
+.RB [ \-fMnlvrzZ ]
 .RB [ \-k
 .IR keytab ]
 .RB [ \-p
@@ -266,6 +266,17 @@ new kernel contexts to be negotiated after
 seconds, which allows changing Kerberos tickets and identities frequently.
 The default is no explicit timeout, which means the kernel context will live
 the lifetime of the Kerberos service ticket used in its creation.
+.TP
+.B -z
+This option tries to avoid DNS Reverse (PTR) lookups for determining the 
+server name to pass to GSSAPI if the name passed at mount point is not an IP 
+address. Currently off by default for compatibility reasons.
+.TP
+.B -Z
Quoted 8 lines

utils/gssd/gssd.man new kernel contexts to be negotiated after · line 279

Quoted 4 lines
utils/gssd/gssd.man +4 -0
+This is the inverse of 
+.B -z
+and forces the use of DNS Reverse resolution of the server's IP address to
+retrieve the server name to use in GSAPI authentication.

By the way I think with the "new" upcall, gssd ignores whatever it got out of the info file if the "target=" parameter is provided in the upcall.

Quoted 8 lines

Correct.

Quoted 2 lines

(But looking at the code I think that's only used in the nfsv4.0 callback case, and isn't worth mentioning here.)

Wrong. It is also used for NFSv4 and NFSv4.1 state management.
IOW: SETCLIENTID/RENEW and for NFSv4.1 EXCHANGE_ID/SEQUENCE; anything that uses clp->cl_machine_cred.

Quoted 5 lines

I was talk about "target=", but I believe you're talking about "service=".

The former is a server name (myserver.example.com), the latter a service name (nfs).

Right, but gssd_refresh_krb5_machine_credential combines both in order to create the keytab entry.

Signature · 6 lines
Trond Myklebust
Linux NFS client maintainer

NetApp
[email protected]
www.netapp.com
#29 lore raw

Re: [PATCH 2/2] Document new -z/-Z options

Quoted 53 lines · Trond Myklebust
Quoted 52 lines · J. Bruce Fields
Quoted 50 lines · Trond
Quoted 32 lines · J. Bruce Fields
Quoted 31 lines · Simo Sorce

Options are not in alphabetical order but -z/-Z clearly always come last.

---
 utils/gssd/gssd.man |   13 ++++++++++++-
 1 files changed, 12 insertions(+), 1 deletions(-)
utils/gssd/gssd.man +8 -1
index 79d9bf91ac6b976c57d167e60d07f828a3ff5b1f..7918c2a0ff76c3918449cf3e1420f0a289929ac1 100644
@@ -8,7 +8,7 @@
 rpc.gssd \- RPCSEC_GSS daemon
 .SH SYNOPSIS
 .B rpc.gssd
-.RB [ \-fMnlvr ]
+.RB [ \-fMnlvrzZ ]
 .RB [ \-k
 .IR keytab ]
 .RB [ \-p
@@ -266,6 +266,17 @@ new kernel contexts to be negotiated after
 seconds, which allows changing Kerberos tickets and identities frequently.
 The default is no explicit timeout, which means the kernel context will live
 the lifetime of the Kerberos service ticket used in its creation.
+.TP
+.B -z
+This option tries to avoid DNS Reverse (PTR) lookups for determining the 
+server name to pass to GSSAPI if the name passed at mount point is not an IP 
+address. Currently off by default for compatibility reasons.
+.TP
+.B -Z
Quoted 8 lines

utils/gssd/gssd.man new kernel contexts to be negotiated after · line 279

Quoted 4 lines
utils/gssd/gssd.man +4 -0
+This is the inverse of 
+.B -z
+and forces the use of DNS Reverse resolution of the server's IP address to
+retrieve the server name to use in GSAPI authentication.

By the way I think with the "new" upcall, gssd ignores whatever it got out of the info file if the "target=" parameter is provided in the upcall.

Correct.

Quoted 2 lines

(But looking at the code I think that's only used in the nfsv4.0 callback case, and isn't worth mentioning here.)

Wrong. It is also used for NFSv4 and NFSv4.1 state management.
IOW: SETCLIENTID/RENEW and for NFSv4.1 EXCHANGE_ID/SEQUENCE; anything that uses clp->cl_machine_cred.

Quoted 9 lines
Quoted 5 lines

I was talk about "target=", but I believe you're talking about "service=".

The former is a server name (myserver.example.com), the latter a service name (nfs).

Right, but gssd_refresh_krb5_machine_credential combines both in order to create the keytab entry.

Never mind. I see what you mean: we only set the rpc_client->cl_principal for the case of NFSv4 callbacks to the client.

Signature · 6 lines
Trond Myklebust
Linux NFS client maintainer

NetApp
[email protected]
www.netapp.com
author
#30 lore raw

PATCH 3/3 Document new -N option

In reply to Simo Sorce

Options are not in alphabetical order but I put the new one after the -M, let's see this slow bubble sort algorithm to go on in the next decade :)

---
 utils/gssd/gssd.man |   11 ++++++++++-
 1 files changed, 10 insertions(+), 1 deletions(-)
utils/gssd/gssd.man +10 -1
index 79d9bf91ac6b976c57d167e60d07f828a3ff5b1f..d1851eb0c39d8fda3da6020b35566d391fe2daba 100644
@@ -8,7 +8,7 @@
 rpc.gssd \- RPCSEC_GSS daemon
 .SH SYNOPSIS
 .B rpc.gssd
-.RB [ \-fMnlvr ]
+.RB [ \-fMnlvrN ]
 .RB [ \-k
 .IR keytab ]
 .RB [ \-p
@@ -245,6 +245,15 @@ is set,
 .B rpc.gssd
 stores machine credentials in memory instead.
 .TP
+.B -N [on|off]
+When -N is set to
+.BR on
+the program tries to avoid DNS Reverse (PTR) lookups for resolving the server 
+name if the name passed at mount point is not an IP address. 
+Currently defaults to
+.BR off
+for compatibility reasons.
+.TP
 .B -v
 Increases the verbosity of the output (can be specified multiple times).
 .TP
Signature · 1 line
1.7.1