Skip to contentSkip to conversation

systemd: Only start the gssd daemons when they are enabled

PATCH In review Steve Dickson 3 participants 15 messages Jun 21, 2016 – Jun 28, 2016

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

PATCH v2 1/1 systemd: Only start the gssd daemons when they are enabled

When Kerberos is enabled, the /etc/krb5.keytab exists which causes the both gssd daemons to start, automatically.

With rpc.gssd running, on all NFS mounts, an upcall is done to get GSS security context for SETCLIENTID procedure.

When Kerberos is not configured for NFS, meaning there is no host/hostname@REALM principal in the key tab, those upcalls always fall causing the mount to hang for several seconds.

This patch added an [Install] section to both services so the services can be enable and disable. The README was also updated.

---
 systemd/README              | 14 +++++---------
 systemd/rpc-gssd.service    |  6 ++++++
 systemd/rpc-svcgssd.service |  7 +++++++
 3 files changed, 18 insertions(+), 9 deletions(-)
systemd/README +5 -9
index 7c43df8..58dae42 100644
@@ -59,13 +59,9 @@ information such as in /etc/sysconfig/nfs or /etc/defaults/nfs.
 It is run once by nfs-config.service.
 
 rpc.gssd and rpc.svcgssd are assumed to be needed if /etc/krb5.keytab
-is present.
-If a site needs this file present but does not want the gss daemons
-running, it should create
-   /etc/systemd/system/rpc-gssd.service.d/01-disable.conf
-and
-   /etc/systemd/system/rpc-svcgssd.service.d/01-disable.conf
+is present.  If a site needs this file present but does not want 
+the gss daemons running, they can be disabled by doing
+   
+   systemctl disable rpc-gssd
+   systemctl disable rpc-svcgssd
 
-containing
-   [Unit]
-   ConditionNull=false
systemd/rpc-gssd.service +6 -0
index d4a3819..681f26a 100644
@@ -17,3 +17,9 @@ EnvironmentFile=-/run/sysconfig/nfs-utils
 
 Type=forking
 ExecStart=/usr/sbin/rpc.gssd $GSSDARGS
+
+# Only start if the service is enabled 
+# and /etc/krb5.keytab exists 
+[Install]
+WantedBy=multi-user.target
+
systemd/rpc-svcgssd.service +7 -0
index 41177b6..4433ed7 100644
@@ -18,3 +18,10 @@ After=nfs-config.service
 EnvironmentFile=-/run/sysconfig/nfs-utils
 Type=forking
 ExecStart=/usr/sbin/rpc.svcgssd $SVCGSSDARGS
+
+# Only start if the service is enabled 
+# and /etc/krb5.keytab exists 
+# and when gss-proxy is not runing
+[Install]
+WantedBy=multi-user.target
+
Signature · 1 line
2.5.5
#1 lore raw
Quoted 6 lines · Steve Dickson

When Kerberos is enabled, the /etc/krb5.keytab exists which causes the both gssd daemons to start, automatically.

Quoted 7 lines

With rpc.gssd running, on all NFS mounts, an upcall is done to get GSS security context for SETCLIENTID procedure.

When Kerberos is not configured for NFS, meaning there is no host/hostname@REALM principal in the key tab, those upcalls always fall causing the mount to hang for several seconds.

What is the root cause of the temporary hang?

When you say "the upcall fails" do you mean there is no reply, or that there is a negative reply after a delay, or there is an immediate negative reply?

Quoted 70 lines

This patch added an [Install] section to both services so the services can be enable and disable. The README was also updated.

---

systemd/README              | 14 +++++---------
systemd/rpc-gssd.service    |  6 ++++++
systemd/rpc-svcgssd.service |  7 +++++++
3 files changed, 18 insertions(+), 9 deletions(-)
systemd/README +0 -0
index 7c43df8..58dae42 100644
@@ -59,13 +59,9 @@ information such as in /etc/sysconfig/nfs or /etc/defaults/nfs.

It is run once by nfs-config.service.

rpc.gssd and rpc.svcgssd are assumed to be needed if /etc/krb5.keytab

systemd/README +5 -9
-is present.
-If a site needs this file present but does not want the gss daemons
-running, it should create
-   /etc/systemd/system/rpc-gssd.service.d/01-disable.conf
-and
-   /etc/systemd/system/rpc-svcgssd.service.d/01-disable.conf
+is present.  If a site needs this file present but does not want 
+the gss daemons running, they can be disabled by doing
+   
+   systemctl disable rpc-gssd
+   systemctl disable rpc-svcgssd
 
-containing
-   [Unit]
-   ConditionNull=false
systemd/rpc-gssd.service +0 -0
index d4a3819..681f26a 100644
@@ -17,3 +17,9 @@ EnvironmentFile=-/run/sysconfig/nfs-utils
 

Type=forking
ExecStart=/usr/sbin/rpc.gssd $GSSDARGS

systemd/rpc-gssd.service +6 -0
+
+# Only start if the service is enabled 
+# and /etc/krb5.keytab exists 
+[Install]
+WantedBy=multi-user.target
+
systemd/rpc-svcgssd.service +0 -0
index 41177b6..4433ed7 100644
@@ -18,3 +18,10 @@ After=nfs-config.service

EnvironmentFile=-/run/sysconfig/nfs-utils Type=forking
ExecStart=/usr/sbin/rpc.svcgssd $SVCGSSDARGS

systemd/rpc-svcgssd.service +7 -0
+
+# Only start if the service is enabled 
+# and /etc/krb5.keytab exists 
+# and when gss-proxy is not runing
+[Install]
+WantedBy=multi-user.target
+
Signature · 6 lines
2.5.5

--
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

--
Chuck Lever

#2 lore raw
Quoted 9 lines · Chuck Lever
Quoted 9 lines · Steve Dickson

When Kerberos is enabled, the /etc/krb5.keytab exists which causes the both gssd daemons to start, automatically.

With rpc.gssd running, on all NFS mounts, an upcall is done to get GSS security context for SETCLIENTID procedure.

Quoted 6 lines
Quoted 4 lines

When Kerberos is not configured for NFS, meaning there is no host/hostname@REALM principal in the key tab, those upcalls always fall causing the mount to hang for several seconds.

What is the root cause of the temporary hang?

All the upcalls to rpc.gssd... I think there are
three for every mount.

Quoted 4 lines

When you say "the upcall fails" do you mean there is no reply, or that there is a negative reply after a delay, or there is an immediate negative reply?

Good point.. the upcalls did not fail, they
just received negative replies.

steved.

Quoted 78 lines
Quoted 72 lines

This patch added an [Install] section to both services so the services can be enable and disable. The README was also updated.

---

systemd/README              | 14 +++++---------
systemd/rpc-gssd.service    |  6 ++++++
systemd/rpc-svcgssd.service |  7 +++++++
3 files changed, 18 insertions(+), 9 deletions(-)
systemd/README +0 -0
index 7c43df8..58dae42 100644
@@ -59,13 +59,9 @@ information such as in /etc/sysconfig/nfs or /etc/defaults/nfs.

It is run once by nfs-config.service.

rpc.gssd and rpc.svcgssd are assumed to be needed if /etc/krb5.keytab

systemd/README +5 -9
-is present.
-If a site needs this file present but does not want the gss daemons
-running, it should create
-   /etc/systemd/system/rpc-gssd.service.d/01-disable.conf
-and
-   /etc/systemd/system/rpc-svcgssd.service.d/01-disable.conf
+is present.  If a site needs this file present but does not want 
+the gss daemons running, they can be disabled by doing
+   
+   systemctl disable rpc-gssd
+   systemctl disable rpc-svcgssd
 
-containing
-   [Unit]
-   ConditionNull=false
systemd/rpc-gssd.service +0 -0
index d4a3819..681f26a 100644
@@ -17,3 +17,9 @@ EnvironmentFile=-/run/sysconfig/nfs-utils
 

Type=forking
ExecStart=/usr/sbin/rpc.gssd $GSSDARGS

systemd/rpc-gssd.service +6 -0
+
+# Only start if the service is enabled 
+# and /etc/krb5.keytab exists 
+[Install]
+WantedBy=multi-user.target
+
systemd/rpc-svcgssd.service +0 -0
index 41177b6..4433ed7 100644
@@ -18,3 +18,10 @@ After=nfs-config.service

EnvironmentFile=-/run/sysconfig/nfs-utils Type=forking
ExecStart=/usr/sbin/rpc.svcgssd $SVCGSSDARGS

systemd/rpc-svcgssd.service +7 -0
+
+# Only start if the service is enabled 
+# and /etc/krb5.keytab exists 
+# and when gss-proxy is not runing
+[Install]
+WantedBy=multi-user.target
+
Signature · 6 lines
2.5.5

--
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

--
Chuck Lever

#3 lore raw
Quoted 25 lines · Steve Dickson
Quoted 9 lines · Chuck Lever
Quoted 9 lines · Steve Dickson

When Kerberos is enabled, the /etc/krb5.keytab exists which causes the both gssd daemons to start, automatically.

With rpc.gssd running, on all NFS mounts, an upcall is done to get GSS security context for SETCLIENTID procedure.

Quoted 6 lines
Quoted 4 lines

When Kerberos is not configured for NFS, meaning there is no host/hostname@REALM principal in the key tab, those upcalls always fall causing the mount to hang for several seconds.

What is the root cause of the temporary hang?

All the upcalls to rpc.gssd... I think there are
three for every mount.

Quoted 1 line
Quoted 5 lines
Quoted 3 lines

When you say "the upcall fails" do you mean there is no reply, or that there is a negative reply after a delay, or there is an immediate negative reply?

Good point.. the upcalls did not fail, they
just received negative replies.

I would say that the upcalls themselves are not the root cause of the delay if they all return immediately.

Are you saying that each negative reply takes a moment? If that's the case, is there something that gssd should do to reply more quickly when there's no host or nfs service principal in the keytab?

Adding administrative interface complexity to work around an underlying implementation problem might not be the best long term choice.

Quoted 77 lines

steved.

Quoted 75 lines
Quoted 72 lines

This patch added an [Install] section to both services so the services can be enable and disable. The README was also updated.

---

systemd/README              | 14 +++++---------
systemd/rpc-gssd.service    |  6 ++++++
systemd/rpc-svcgssd.service |  7 +++++++
3 files changed, 18 insertions(+), 9 deletions(-)
systemd/README +0 -0
index 7c43df8..58dae42 100644
@@ -59,13 +59,9 @@ information such as in /etc/sysconfig/nfs or /etc/defaults/nfs.

It is run once by nfs-config.service.

rpc.gssd and rpc.svcgssd are assumed to be needed if /etc/krb5.keytab

systemd/README +5 -9
-is present.
-If a site needs this file present but does not want the gss daemons
-running, it should create
-   /etc/systemd/system/rpc-gssd.service.d/01-disable.conf
-and
-   /etc/systemd/system/rpc-svcgssd.service.d/01-disable.conf
+is present.  If a site needs this file present but does not want 
+the gss daemons running, they can be disabled by doing
+   
+   systemctl disable rpc-gssd
+   systemctl disable rpc-svcgssd
 
-containing
-   [Unit]
-   ConditionNull=false
systemd/rpc-gssd.service +0 -0
index d4a3819..681f26a 100644
@@ -17,3 +17,9 @@ EnvironmentFile=-/run/sysconfig/nfs-utils
 

Type=forking
ExecStart=/usr/sbin/rpc.gssd $GSSDARGS

systemd/rpc-gssd.service +6 -0
+
+# Only start if the service is enabled 
+# and /etc/krb5.keytab exists 
+[Install]
+WantedBy=multi-user.target
+
systemd/rpc-svcgssd.service +0 -0
index 41177b6..4433ed7 100644
@@ -18,3 +18,10 @@ After=nfs-config.service

EnvironmentFile=-/run/sysconfig/nfs-utils Type=forking
ExecStart=/usr/sbin/rpc.svcgssd $SVCGSSDARGS

systemd/rpc-svcgssd.service +7 -0
+
+# Only start if the service is enabled 
+# and /etc/krb5.keytab exists 
+# and when gss-proxy is not runing
+[Install]
+WantedBy=multi-user.target
+
Signature · 6 lines
2.5.5

--
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

--
Chuck Lever

--
Chuck Lever

#4 lore raw

Hey,

Quoted 7 lines · Chuck Lever
Quoted 5 lines
Quoted 5 lines
Quoted 3 lines
Quoted 3 lines

When you say "the upcall fails" do you mean there is no reply, or that there is a negative reply after a delay, or there is an immediate negative reply?

Good point.. the upcalls did not fail, they
just received negative replies.

I would say that the upcalls themselves are not the root cause of the delay if they all return immediately.

Well when rpc.gssd is not running (aka no upcalls) the delays stop happening.

Quoted 2 lines

Are you saying that each negative reply takes a moment?

Yes. Even on sec=sys mounts. Which is the issue.

Quoted 3 lines

If that's the case, is there something that gssd should do to reply more quickly when there's no host or nfs service principal in the keytab?

I don't think so... unless we start caching negative negative response or something like which is way overkill especially since the problem is solved by not starting rpc.gssd.

Quoted 4 lines

Adding administrative interface complexity to work around an underlying implementation problem might not be the best long term choice.

Well there already was way to stop gssd from starting when kerberos is configured but not for NFS. From the systemd/README:

rpc.gssd and rpc.svcgssd are assumed to be needed if /etc/krb5.keytab is present.
If a site needs this file present but does not want the gss daemons running, it should create
/etc/systemd/system/rpc-gssd.service.d/01-disable.conf
and
/etc/systemd/system/rpc-svcgssd.service.d/01-disable.conf

containing
[Unit]
ConditionNull=false

Which does work and will still work... but I'm thinking it is much similar to disable the service via systemd command
systemctl disable rpc-gssd

than creating and editing those .conf files.

steved

#5 lore raw
Quoted 9 lines · Steve Dickson

Hey,

Quoted 3 lines · Chuck Lever
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

When you say "the upcall fails" do you mean there is no reply, or that there is a negative reply after a delay, or there is an immediate negative reply?

Quoted 6 lines
Quoted 4 lines
Quoted 2 lines
Quoted 2 lines

Good point.. the upcalls did not fail, they
just received negative replies.

I would say that the upcalls themselves are not the root cause of the delay if they all return immediately.

Well when rpc.gssd is not running (aka no upcalls) the delays stop happening.

Well let me say it a different way: the mechanism of performing an upcall should be fast. The stuff that gssd is doing as a result of the upcall request may be taking longer than expected, though.

If gssd is up, and has nothing to do (which I think is the case here?) then IMO that upcall should be unnoticeable. I don't expect there to be any difference between the kernel squelching an upcall, and an upcall completing immediately.

Quoted 2 lines
Quoted 1 line

Are you saying that each negative reply takes a moment?

Yes. Even on sec=sys mounts. Which is the issue.

Yep, I get that. I've seen that behavior on occasion, and agree it should be addressed somehow.

Quoted 7 lines
Quoted 3 lines

If that's the case, is there something that gssd should do to reply more quickly when there's no host or nfs service principal in the keytab?

I don't think so... unless we start caching negative negative response or something like which is way overkill especially since the problem is solved by not starting rpc.gssd.

I'd like to understand why this upcall, which should be equivalent to a no-op, is not returning an immediate answer. Three of these in a row shouldn't take more than a dozen milliseconds.

How long does the upcall take when there is a service principal versus how long it takes when there isn't one? Try running gssd under strace to get some timings.

Is gssd waiting for syslog or something?

Quoted 18 lines
Quoted 3 lines

Adding administrative interface complexity to work around an underlying implementation problem might not be the best long term choice.

Well there already was way to stop gssd from starting when kerberos is configured but not for NFS. From the systemd/README:

rpc.gssd and rpc.svcgssd are assumed to be needed if /etc/krb5.keytab is present.
If a site needs this file present but does not want the gss daemons running, it should create
/etc/systemd/system/rpc-gssd.service.d/01-disable.conf
and
/etc/systemd/system/rpc-svcgssd.service.d/01-disable.conf

containing
[Unit]
ConditionNull=false

Quoted 5 lines

Which does work and will still work... but I'm thinking it is much similar to disable the service via systemd command
systemctl disable rpc-gssd

than creating and editing those .conf files.

This should all be automatic, IMO.

On Solaris, drop in a keytab and a krb5.conf, and add sec=krb5 to your mounts. No reboot, nothing to restart. Linux should be that simple.

--
Chuck Lever

#6 lore raw

Sorry for the delayed response... PTO yesterday.

Quoted 13 lines · Chuck Lever
Quoted 13 lines · Steve Dickson

Hey,

Quoted 7 lines · Chuck Lever
Quoted 5 lines
Quoted 5 lines
Quoted 3 lines
Quoted 3 lines

When you say "the upcall fails" do you mean there is no reply, or that there is a negative reply after a delay, or there is an immediate negative reply?

Good point.. the upcalls did not fail, they
just received negative replies.

I would say that the upcalls themselves are not the root cause of the delay if they all return immediately.

Quoted 7 lines
Quoted 2 lines

Well when rpc.gssd is not running (aka no upcalls) the delays stop happening.

Well let me say it a different way: the mechanism of performing an upcall should be fast. The stuff that gssd is doing as a result of the upcall request may be taking longer than expected, though.

I'm pretty sure its not the actual mechanism causing the delay... Its the act of failing (read keytabs maybe even ping the KDC) is what taking the time at least that's what the sys logs show.

Quoted 3 lines

If gssd is up, and has nothing to do (which I think is the case here?) then IMO that upcall should be unnoticeable.

Well its not... It is causing a delay.

Quoted 2 lines

I don't expect there to be any difference between the kernel squelching an upcall, and an upcall completing immediately.

There kernel will always make the upcall when rpc.gssd is running... I don't see how the kernel can squelch the upcall with rpc.gssd running. Not starting rpc.gssd is the only way to squelch the upcall.

Quoted 17 lines
Quoted 4 lines
Quoted 3 lines

Are you saying that each negative reply takes a moment?

Yes. Even on sec=sys mounts. Which is the issue.

Yep, I get that. I've seen that behavior on occasion, and agree it should be addressed somehow.

Quoted 7 lines
Quoted 3 lines

If that's the case, is there something that gssd should do to reply more quickly when there's no host or nfs service principal in the keytab?

I don't think so... unless we start caching negative negative response or something like which is way overkill especially since the problem is solved by not starting rpc.gssd.

Quoted 4 lines

I'd like to understand why this upcall, which should be equivalent to a no-op, is not returning an immediate answer. Three of these in a row shouldn't take more than a dozen milliseconds.

It looks like, from the systlog timestamps, each upcall is taking a ~1 sec.

Quoted 4 lines

How long does the upcall take when there is a service principal versus how long it takes when there isn't one? Try running gssd under strace to get some timings.

the key tab does have a nfs/hosname@REALM entry. So the call to the KDC is probably failing... which could be construed as a misconfiguration, but that misconfiguration should not even come into play with sec=sys mounts... IMHO...

Quoted 2 lines

Is gssd waiting for syslog or something?

No... its just failing to get the machine creds for root

[snip]

Quoted 11 lines
Quoted 5 lines

Which does work and will still work... but I'm thinking it is much similar to disable the service via systemd command
systemctl disable rpc-gssd

than creating and editing those .conf files.

This should all be automatic, IMO.

On Solaris, drop in a keytab and a krb5.conf, and add sec=krb5 to your mounts. No reboot, nothing to restart. Linux should be that simple.

The only extra step with Linux is to 'sysctmctl start rpc-gssd' I don't there is much would can do about that.... But of course... Patches are always welcomed!! 8-)

TBL... When kerberos is configured correctly for NFS everything works just fine. When kerberos is configured, but not for NFS, causes delays on all NFS mounts.

Today, there is a method to stop rpc-gssd from blindly starting when kerberos is configured to eliminate that delay. This patch just tweaking that method to make things easier.

To address your concern about covering up a bug. I just don't see it... The code is doing exactly what its asked to do. By default the kernel asks krb5i context (when rpc.gssd is run). rpc.gssd looking for a principle in the key tab, when found the KDC is called...

Everything is working just like it should and it is failing just like it should. I'm just trying to eliminate all this process when not needed, in an easier way..

steved.

#7 lore raw
Quoted 68 lines · Steve Dickson

Sorry for the delayed response... PTO yesterday.

Quoted 14 lines · Chuck Lever
Quoted 13 lines · Steve Dickson

Hey,

Quoted 7 lines · Chuck Lever
Quoted 5 lines
Quoted 5 lines
Quoted 3 lines
Quoted 3 lines

When you say "the upcall fails" do you mean there is no reply, or that there is a negative reply after a delay, or there is an immediate negative reply?

Good point.. the upcalls did not fail, they
just received negative replies.

I would say that the upcalls themselves are not the root cause of the delay if they all return immediately.

Quoted 7 lines
Quoted 2 lines

Well when rpc.gssd is not running (aka no upcalls) the delays stop happening.

Well let me say it a different way: the mechanism of performing an upcall should be fast. The stuff that gssd is doing as a result of the upcall request may be taking longer than expected, though.

I'm pretty sure its not the actual mechanism causing the delay... Its the act of failing (read keytabs maybe even ping the KDC) is what taking the time at least that's what the sys logs show.

Quoted 3 lines

If gssd is up, and has nothing to do (which I think is the case here?) then IMO that upcall should be unnoticeable.

Well its not... It is causing a delay.

Quoted 2 lines

I don't expect there to be any difference between the kernel squelching an upcall, and an upcall completing immediately.

There kernel will always make the upcall when rpc.gssd is running... I don't see how the kernel can squelch the upcall with rpc.gssd running. Not starting rpc.gssd is the only way to squelch the upcall.

Quoted 17 lines
Quoted 4 lines
Quoted 3 lines

Are you saying that each negative reply takes a moment?

Yes. Even on sec=sys mounts. Which is the issue.

Yep, I get that. I've seen that behavior on occasion, and agree it should be addressed somehow.

Quoted 7 lines
Quoted 3 lines

If that's the case, is there something that gssd should do to reply more quickly when there's no host or nfs service principal in the keytab?

I don't think so... unless we start caching negative negative response or something like which is way overkill especially since the problem is solved by not starting rpc.gssd.

Quoted 4 lines

I'd like to understand why this upcall, which should be equivalent to a no-op, is not returning an immediate answer. Three of these in a row shouldn't take more than a dozen milliseconds.

It looks like, from the systlog timestamps, each upcall is taking a ~1 sec.

Quoted 1 line
Quoted 8 lines
Quoted 3 lines

How long does the upcall take when there is a service principal versus how long it takes when there isn't one? Try running gssd under strace to get some timings.

the key tab does have a nfs/hosname@REALM entry. So the call to the KDC is probably failing... which could be construed as a misconfiguration, but that misconfiguration should not even come into play with sec=sys mounts... IMHO...

I disagree, of course. sec=sys means the client is not going to use Kerberos to authenticate individual user requests, and users don't need a Kerberos ticket to access their files. That's still the case.

I'm not aware of any promise that sec=sys means there is no Kerberos within 50 miles of that mount.

If there are valid keytabs on both systems, they need to be set up correctly. If there's a misconfiguration, then gssd needs to report it precisely instead of time out. And it's just as easy to add a service principal to a keytab as it is to disable a systemd service in that case.

Quoted 2 lines
Quoted 1 line

Is gssd waiting for syslog or something?

No... its just failing to get the machine creds for root

Clearly more is going on than that, and so far we have only some speculation. Can you provide an strace of rpc.gssd or a network capture so we can confirm what's going on?

Quoted 8 lines

[snip]

Quoted 6 lines
Quoted 5 lines

Which does work and will still work... but I'm thinking it is much similar to disable the service via systemd command
systemctl disable rpc-gssd

than creating and editing those .conf files.

Quoted 7 lines
Quoted 5 lines

This should all be automatic, IMO.

On Solaris, drop in a keytab and a krb5.conf, and add sec=krb5 to your mounts. No reboot, nothing to restart. Linux should be that simple.

The only extra step with Linux is to 'sysctmctl start rpc-gssd' I don't there is much would can do about that....

Sure there is. Leave gssd running, and make sure it can respond quickly in every reasonable case. :-p

Quoted 6 lines

But of
course... Patches are always welcomed!! 8-)

TBL... When kerberos is configured correctly for NFS everything works just fine. When kerberos is configured, but not for NFS, causes delays on all NFS mounts.

This convinces me even more that there is a gssd issue here.

Quoted 2 lines

Today, there is a method to stop rpc-gssd from blindly starting when kerberos is configured to eliminate that delay.

I can fix my broken TV by not turning it on, and I don't notice the problem. But the problem is still there any time I want to watch TV.

The problem is not fixed by disabling gssd, it's just hidden in some cases.

Quoted 1 line

This patch just tweaking that method to make things easier.

It makes one thing easier, and other things more difficult. As a community, I thought our goal was to make Kerberos easier to use, not easier to turn off.

Quoted 10 lines

To address your concern about covering up a bug. I just don't see it... The code is doing exactly what its asked to do. By default the kernel asks krb5i context (when rpc.gssd is run). rpc.gssd looking for a principle in the key tab, when found the KDC is called...

Everything is working just like it should and it is failing just like it should. I'm just trying to eliminate all this process when not needed, in an easier way..

I'm not even sure now what the use case is. The client has proper principals, but the server doesn't? The server should refuse the init sec context immediately. Is gssd even running on the server?

Suppose there are a thousand clients and one broken server. An administrator would fix that one server by adding an extra service principal, rather than log into a thousand clients to change a setting on each.

Suppose your client wants both sys and krb5 mounts of a group of servers, and some are "misconfigured." You have to enable gssd on the client but there are still delays on the sec=sys mounts.

In fact, I think that's going to be pretty common. Why add an NFS service principal on a client if you don't expect to use sec=krb5 some of the time?

#8 lore raw

Again, sorry for the delay... That darn flux capacitor broke... again!!! :-)

Quoted 2 lines · Chuck Lever
Quoted 2 lines · Steve Dickson

[snip]

Quoted 6 lines
Quoted 5 lines

the key tab does have a nfs/hosname@REALM entry. So the call to the KDC is probably failing... which could be construed as a misconfiguration, but that misconfiguration should not even come into play with sec=sys mounts... IMHO...

Quoted 7 lines

I disagree, of course. sec=sys means the client is not going to use Kerberos to authenticate individual user requests, and users don't need a Kerberos ticket to access their files. That's still the case.

I'm not aware of any promise that sec=sys means there is no Kerberos within 50 miles of that mount.

I think that's is the assumption... No Kerberos will be needed for sec=sys mounts. Its not when Kerberos is not configured.

Quoted 6 lines

If there are valid keytabs on both systems, they need to be set up correctly. If there's a misconfiguration, then gssd needs to report it precisely instead of time out. And it's just as easy to add a service principal to a keytab as it is to disable a systemd service in that case.

I think its more straightforward to disable a service that is not needed than to have to add a principal to a keytab for a service that's not being used or needed.

Quoted 8 lines
Quoted 4 lines
Quoted 3 lines

Is gssd waiting for syslog or something?

No... its just failing to get the machine creds for root

Clearly more is going on than that, and so far we have only some speculation. Can you provide an strace of rpc.gssd or a network capture so we can confirm what's going on?

Yes... Yes... and Yes.. I added you to the bz...

Quoted 35 lines
Quoted 10 lines

[snip]

Quoted 6 lines
Quoted 5 lines

Which does work and will still work... but I'm thinking it is much similar to disable the service via systemd command
systemctl disable rpc-gssd

than creating and editing those .conf files.

Quoted 7 lines
Quoted 5 lines

This should all be automatic, IMO.

On Solaris, drop in a keytab and a krb5.conf, and add sec=krb5 to your mounts. No reboot, nothing to restart. Linux should be that simple.

The only extra step with Linux is to 'sysctmctl start rpc-gssd' I don't there is much would can do about that....

Sure there is. Leave gssd running, and make sure it can respond quickly in every reasonable case. :-p

Quoted 6 lines

But of
course... Patches are always welcomed!! 8-)

TBL... When kerberos is configured correctly for NFS everything works just fine. When kerberos is configured, but not for NFS, causes delays on all NFS mounts.

This convinces me even more that there is a gssd issue here.

Quoted 2 lines

Today, there is a method to stop rpc-gssd from blindly starting when kerberos is configured to eliminate that delay.

Quoted 6 lines

I can fix my broken TV by not turning it on, and I don't notice the problem. But the problem is still there any time I want to watch TV.

The problem is not fixed by disabling gssd, it's just hidden in some cases.

I agree this %100... All I'm saying there should be a way to disable it when the daemon is not needed or used.

Having it automatically started just because there is a keytab, at first, I thought was a good idea, now it turns not people really don't what miscellaneous daemons running. Case in point gssproxy... Automatically comes but there is a way to disable it. With rpc.gssd there is not (easily).

Quoted 7 lines
Quoted 3 lines

This patch just tweaking that method to make things easier.

It makes one thing easier, and other things more difficult. As a community, I thought our goal was to make Kerberos easier to use, not easier to turn off.

Again I can't agree with you more! But this is the case were Kerberos is *not* being used for NFS... we should make that case work as well...

Quoted 13 lines
Quoted 8 lines

To address your concern about covering up a bug. I just don't see it... The code is doing exactly what its asked to do. By default the kernel asks krb5i context (when rpc.gssd is run). rpc.gssd looking for a principle in the key tab, when found the KDC is called...

Quoted 4 lines

Everything is working just like it should and it is failing just like it should. I'm just trying to eliminate all this process when not needed, in an easier way..

Quoted 4 lines

I'm not even sure now what the use case is. The client has proper principals, but the server doesn't? The server should refuse the init sec context immediately. Is gssd even running on the server?

No they don't because they are not using Kerberos for NFS...

So I guess this is what we are saying:

If you what to used Kerberos for anything at all, they must configure it for NFS for their clients to work properly... I'm not sure we really want to say this.

Quoted 10 lines

Suppose there are a thousand clients and one broken server. An administrator would fix that one server by adding an extra service principal, rather than log into a thousand clients to change a setting on each.

Suppose your client wants both sys and krb5 mounts of a group of servers, and some are "misconfigured." You have to enable gssd on the client but there are still delays on the sec=sys mounts.

In both these cases you are assuming Kerberos mounts are being used and so Kerberos should be configured for NFS. That is just not the case.

Quoted 4 lines

In fact, I think that's going to be pretty common. Why add an NFS service principal on a client if you don't expect to use sec=krb5 some of the time?

In that case adding the principal does make sense. But...

Why *must* you add a principal when you know only sec=sys mounts will be used?

steved.

#9 lore raw
Quoted 22 lines · Steve Dickson

Again, sorry for the delay... That darn flux capacitor broke... again!!! :-)

Quoted 2 lines · Chuck Lever
Quoted 2 lines · Steve Dickson

[snip]

Quoted 11 lines
Quoted 5 lines

the key tab does have a nfs/hosname@REALM entry. So the call to the KDC is probably failing... which could be construed as a misconfiguration, but that misconfiguration should not even come into play with sec=sys mounts... IMHO...

I disagree, of course. sec=sys means the client is not going to use Kerberos to authenticate individual user requests, and users don't need a Kerberos ticket to access their files. That's still the case.

Quoted 5 lines
Quoted 2 lines

I'm not aware of any promise that sec=sys means there is no Kerberos within 50 miles of that mount.

I think that's is the assumption... No Kerberos will be needed for sec=sys mounts. Its not when Kerberos is not configured.

NFSv3 sec=sys happens to mean that no Kerberos is needed. This hasn't changed either.

NFSv4 sec=sys is different. Just like NFSv4 ACLs, and NFSv4 ID mapping, and NFSv4 locking, and so on.

Note though that Kerberos isn't needed for NFSv4 sec=sys even when there is a keytab. The client negotiates and operates without it.

Quoted 8 lines
Quoted 5 lines

If there are valid keytabs on both systems, they need to be set up correctly. If there's a misconfiguration, then gssd needs to report it precisely instead of time out. And it's just as easy to add a service principal to a keytab as it is to disable a systemd service in that case.

I think its more straightforward to disable a service that is not needed than to have to add a principal to a keytab for a service that's not being used or needed.

IMO automating NFS setup so that it chooses the most secure possible settings without intervention is the best possible solution.

Quoted 7 lines
Quoted 6 lines
Quoted 2 lines
Quoted 1 line

Is gssd waiting for syslog or something?

No... its just failing to get the machine creds for root

Clearly more is going on than that, and so far we have only some speculation. Can you provide an strace of rpc.gssd or a network capture so we can confirm what's going on?

Yes... Yes... and Yes.. I added you to the bz...

Thanks! I'll have a look at it.

Quoted 33 lines
Quoted 33 lines
Quoted 8 lines

[snip]

Quoted 6 lines
Quoted 5 lines

Which does work and will still work... but I'm thinking it is much similar to disable the service via systemd command systemctl disable rpc-gssd

than creating and editing those .conf files.

Quoted 7 lines
Quoted 5 lines

This should all be automatic, IMO.

On Solaris, drop in a keytab and a krb5.conf, and add sec=krb5 to your mounts. No reboot, nothing to restart. Linux should be that simple.

The only extra step with Linux is to 'sysctmctl start rpc-gssd' I don't there is much would can do about that....

Sure there is. Leave gssd running, and make sure it can respond quickly in every reasonable case. :-p

Quoted 6 lines

But of
course... Patches are always welcomed!! 8-)

TBL... When kerberos is configured correctly for NFS everything works just fine. When kerberos is configured, but not for NFS, causes delays on all NFS mounts.

This convinces me even more that there is a gssd issue here.

Quoted 2 lines

Today, there is a method to stop rpc-gssd from blindly starting when kerberos is configured to eliminate that delay.

Quoted 8 lines
Quoted 6 lines

I can fix my broken TV by not turning it on, and I don't notice the problem. But the problem is still there any time I want to watch TV.

The problem is not fixed by disabling gssd, it's just hidden in some cases.

I agree this %100... All I'm saying there should be a way to disable it when the daemon is not needed or used.

NFSv4 sec=sys *does* use Kerberos, when it is available. It has for years.

Documentation should be updated to state that if Kerberos is configured on clients, they will attempt to use it to manage some operations that are common to all NFSv4 mount points on that client, even when a mount point uses sec=sys.

Kerberos will be used for user authentication only if the client administrator has not specified a sec= setting, but the server export allows the use of Kerberos; or if the client administrator has specified a sec=krb5, sec=krb5i, or sec=krb5p setting.

The reason for using Kerberos for common operations is that a client may have just one lease management principal. If the client uses sec=sys and sec=krb5 mounts, and the sec=sys mount is done first, then lease management would use sys as well. The client cannot change this principal after it has established a lease and files are open.

A subsequent sec=krb5 mount will also use sec=sys for lease management. This will be surprising and insecure behavior. Therefore, all mounts from this client attempt to set up a krb5 lease management transport.

The server should have an nfs/ service principal. It doesn't _require_ one, but it's a best practice to have one in place.

Administrators that have Kerberos available should use it. There's no overhead to enabling it on NFS servers, as long as the list of security flavors the server returns for each export does not include Kerberos flavors.

Quoted 6 lines

Having it automatically started just because there is a keytab, at first, I thought was a good idea, now it turns not people really don't what miscellaneous daemons running. Case in point gssproxy... Automatically comes but there is a way to disable it. With rpc.gssd there is not (easily).

There are good reasons to disable daemons:

- The daemon consumes a lot of resources.
- The daemon exposes an attack surface.

gssd does neither.

There are good reasons not to disable daemons:

- It enables simpler administration.
- It keeps the test matrix narrow (because you
have to test just one configuration, not
multiple ones: gssd enabled, gssd disabled,
and so on).

Always enabling gssd provides both of these benefits.

Quoted 8 lines
Quoted 5 lines
Quoted 1 line

This patch just tweaking that method to make things easier.

It makes one thing easier, and other things more difficult. As a community, I thought our goal was to make Kerberos easier to use, not easier to turn off.

Again I can't agree with you more! But this is the case were Kerberos is *not* being used for NFS... we should make that case work as well...

Agreed.

But NFSv4 sec=sys *does* use Kerberos when Kerberos is configured on the system. It's a fact, and we now need to make it convenient and natural and bug-free. The choice is between increasing security and just making it work, or adding one more knob that administrators have to Google for.

Quoted 11 lines
Quoted 11 lines
Quoted 10 lines

To address your concern about covering up a bug. I just don't see it... The code is doing exactly what its asked to do. By default the kernel asks krb5i context (when rpc.gssd is run). rpc.gssd looking for a principle in the key tab, when found the KDC is called...

Everything is working just like it should and it is failing just like it should. I'm just trying to eliminate all this process when not needed, in an easier way..

Quoted 5 lines
Quoted 4 lines

I'm not even sure now what the use case is. The client has proper principals, but the server doesn't? The server should refuse the init sec context immediately. Is gssd even running on the server?

No they don't because they are not using Kerberos for NFS...

OK, let's state clearly what's going on here:

The client has a host/ principal. gssd is started automatically.

The server has what?

If the server has a keytab and an nfs/ principal, gss-proxy should be running, and there are no delays.

If the server has a keytab and no nfs/ principal, gss-proxy should be running, and any init sec context should fail immediately. There should be no delay. (If there is a delay, that needs to be troubleshot).

If the server does not have a keytab, gss-proxy will not be running, and NFSv4 clients will have to sense this. It takes a moment for each sniff. Otherwise, there's no operational difference.

I'm assuming then that the problem is that Kerberos is not set up on the _server_. Can you confirm this?

Also, this negotiation should be done only during the first contact of each server after a client reboot, thus the delay happens only during the first mount, not during subsequent ones. Can that also be confirmed?

Quoted 6 lines

So I guess this is what we are saying:

If you what to used Kerberos for anything at all, they must configure it for NFS for their clients to work properly... I'm not sure we really want to say this.

Well, the clients are working properly without the server principal in place. They just have an extra delay at mount time. (you yourself pointed out in an earlier e-mail that the client is doing everything correctly, and no mention has been made of any other operational issue).

We should encourage customers to set up in the most secure way possible. In this case:

- Kerberos is already available in the environment

- It's not _required_ only _recommended_ (clients can still use sec=sys without it) for the server to enable Kerberos, but it's a best practice

I'm guessing that if gssd and gss-proxy are running on the server all the time, even when there is no keytab, that delay should go away for everyone. So:

- Always run a gssd service on servers that export NFSv4 (I assume this will address the delay problem)

- Recommend the NFS server be provisioned with an nfs/ principal, and explicitly specify sec=sys on exports to prevent clients from negotiating an unwanted Kerberos security setting

I far prefer these fixes to adding another administrative setting on the client. It encourages better security, and it addresses the problem for all NFS clients that might want to try using Kerberos against Linux NFS servers, for whatever reason.

Quoted 5 lines
Quoted 5 lines

Suppose there are a thousand clients and one broken server. An administrator would fix that one server by adding an extra service principal, rather than log into a thousand clients to change a setting on each.

Quoted 7 lines
Quoted 4 lines

Suppose your client wants both sys and krb5 mounts of a group of servers, and some are "misconfigured." You have to enable gssd on the client but there are still delays on the sec=sys mounts.

In both these cases you are assuming Kerberos mounts are being used and so Kerberos should be configured for NFS. That is just not the case.

My assumption is that administrators would prefer automatic client set up, and good security by default.

There's no way to know in advance whether an administrator will want sec=sys and sec=krb5 mounts on the same system. /etc/fstab can be changed at any time, mounts can be done by hand, or the administrator can add or remove principals from /etc/krb5.keytab.

Our clients have to work when there are just sec=sys mounts, or when there are sec=sys and sec=krb5 mounts. They must allow on-demand configuration of sec=krb5. They must attempt to provide the best possible level of security at all times.

The out-of-the-shrinkwrap configuration must assume a mix of capabilities.

Quoted 7 lines
Quoted 3 lines

In fact, I think that's going to be pretty common. Why add an NFS service principal on a client if you don't expect to use sec=krb5 some of the time?

In that case adding the principal does make sense. But...

Why *must* you add a principal when you know only sec=sys mounts will be used?

Explained in detail above (and this is only for NFSv4, and is not at all a _must_). But in summary:

A client will attempt to use Kerberos for NFSv4 sec=sys when there is a host/ or nfs/ principal in its keytab. That needs to be documented.

Our _recommendation_ is that the server be provisioned with an nfs/ principal as well when NFSv4 is used in an environment where Kerberos is present. This eliminates a costly per-mount security negotiation, and enables cryptographically strong authentication of each client that mounts that server. NFSv4 sec=sys works properly otherwise without this principal.

--
Chuck Lever

#10 lore raw
Quoted 130 lines · Chuck Lever
Quoted 23 lines · Steve Dickson

Again, sorry for the delay... That darn flux capacitor broke... again!!! :-)

Quoted 2 lines · Chuck Lever
Quoted 2 lines · Steve Dickson

[snip]

Quoted 11 lines
Quoted 5 lines

the key tab does have a nfs/hosname@REALM entry. So the call to the KDC is probably failing... which could be construed as a misconfiguration, but that misconfiguration should not even come into play with sec=sys mounts... IMHO...

I disagree, of course. sec=sys means the client is not going to use Kerberos to authenticate individual user requests, and users don't need a Kerberos ticket to access their files. That's still the case.

Quoted 5 lines
Quoted 2 lines

I'm not aware of any promise that sec=sys means there is no Kerberos within 50 miles of that mount.

I think that's is the assumption... No Kerberos will be needed for sec=sys mounts. Its not when Kerberos is not configured.

NFSv3 sec=sys happens to mean that no Kerberos is needed. This hasn't changed either.

NFSv4 sec=sys is different. Just like NFSv4 ACLs, and NFSv4 ID mapping, and NFSv4 locking, and so on.

Note though that Kerberos isn't needed for NFSv4 sec=sys even when there is a keytab. The client negotiates and operates without it.

Quoted 8 lines
Quoted 5 lines

If there are valid keytabs on both systems, they need to be set up correctly. If there's a misconfiguration, then gssd needs to report it precisely instead of time out. And it's just as easy to add a service principal to a keytab as it is to disable a systemd service in that case.

I think its more straightforward to disable a service that is not needed than to have to add a principal to a keytab for a service that's not being used or needed.

IMO automating NFS setup so that it chooses the most secure possible settings without intervention is the best possible solution.

Quoted 7 lines
Quoted 6 lines
Quoted 2 lines
Quoted 1 line

Is gssd waiting for syslog or something?

No... its just failing to get the machine creds for root

Clearly more is going on than that, and so far we have only some speculation. Can you provide an strace of rpc.gssd or a network capture so we can confirm what's going on?

Yes... Yes... and Yes.. I added you to the bz...

Thanks! I'll have a look at it.

Quoted 33 lines
Quoted 33 lines
Quoted 8 lines

[snip]

Quoted 6 lines
Quoted 5 lines

Which does work and will still work... but I'm thinking it is much similar to disable the service via systemd command systemctl disable rpc-gssd

than creating and editing those .conf files.

Quoted 7 lines
Quoted 5 lines

This should all be automatic, IMO.

On Solaris, drop in a keytab and a krb5.conf, and add sec=krb5 to your mounts. No reboot, nothing to restart. Linux should be that simple.

The only extra step with Linux is to 'sysctmctl start rpc-gssd' I don't there is much would can do about that....

Sure there is. Leave gssd running, and make sure it can respond quickly in every reasonable case. :-p

Quoted 6 lines

But of
course... Patches are always welcomed!! 8-)

TBL... When kerberos is configured correctly for NFS everything works just fine. When kerberos is configured, but not for NFS, causes delays on all NFS mounts.

This convinces me even more that there is a gssd issue here.

Quoted 2 lines

Today, there is a method to stop rpc-gssd from blindly starting when kerberos is configured to eliminate that delay.

Quoted 8 lines
Quoted 6 lines

I can fix my broken TV by not turning it on, and I don't notice the problem. But the problem is still there any time I want to watch TV.

The problem is not fixed by disabling gssd, it's just hidden in some cases.

I agree this %100... All I'm saying there should be a way to disable it when the daemon is not needed or used.

NFSv4 sec=sys *does* use Kerberos, when it is available. It has for years.

Documentation should be updated to state that if Kerberos is configured on clients, they will attempt to use it to manage some operations that are common to all NFSv4 mount points on that client, even when a mount point uses sec=sys.

Kerberos will be used for user authentication only if the client administrator has not specified a sec= setting, but the server export allows the use of Kerberos; or if the client administrator has specified a sec=krb5, sec=krb5i, or sec=krb5p setting.

The reason for using Kerberos for common operations is that a client may have just one lease management principal. If the client uses sec=sys and sec=krb5 mounts, and the sec=sys mount is done first, then lease management would use sys as well. The client cannot change this principal after it has established a lease and files are open.

Quoted 4 lines

A subsequent sec=krb5 mount will also use sec=sys for lease management. This will be surprising and insecure behavior. Therefore, all mounts from this client attempt to set up a krb5 lease management transport.

Chuck,

Thanks for explaining this so well! This definitely should make it’s way into documentation - we should have added something like this a long time ago.

I’m definitely guilty of having to figure out why the client worked this way and not documenting it...

-dros

Quoted 212 lines

The server should have an nfs/ service principal. It doesn't _require_ one, but it's a best practice to have one in place.

Administrators that have Kerberos available should use it. There's no overhead to enabling it on NFS servers, as long as the list of security flavors the server returns for each export does not include Kerberos flavors.

Quoted 6 lines

Having it automatically started just because there is a keytab, at first, I thought was a good idea, now it turns not people really don't what miscellaneous daemons running. Case in point gssproxy... Automatically comes but there is a way to disable it. With rpc.gssd there is not (easily).

There are good reasons to disable daemons:

- The daemon consumes a lot of resources.
- The daemon exposes an attack surface.

gssd does neither.

There are good reasons not to disable daemons:

- It enables simpler administration.
- It keeps the test matrix narrow (because you
have to test just one configuration, not
multiple ones: gssd enabled, gssd disabled,
and so on).

Always enabling gssd provides both of these benefits.

Quoted 8 lines
Quoted 5 lines
Quoted 1 line

This patch just tweaking that method to make things easier.

It makes one thing easier, and other things more difficult. As a community, I thought our goal was to make Kerberos easier to use, not easier to turn off.

Again I can't agree with you more! But this is the case were Kerberos is *not* being used for NFS... we should make that case work as well...

Agreed.

But NFSv4 sec=sys *does* use Kerberos when Kerberos is configured on the system. It's a fact, and we now need to make it convenient and natural and bug-free. The choice is between increasing security and just making it work, or adding one more knob that administrators have to Google for.

Quoted 11 lines
Quoted 11 lines
Quoted 10 lines

To address your concern about covering up a bug. I just don't see it... The code is doing exactly what its asked to do. By default the kernel asks krb5i context (when rpc.gssd is run). rpc.gssd looking for a principle in the key tab, when found the KDC is called...

Everything is working just like it should and it is failing just like it should. I'm just trying to eliminate all this process when not needed, in an easier way..

Quoted 5 lines
Quoted 4 lines

I'm not even sure now what the use case is. The client has proper principals, but the server doesn't? The server should refuse the init sec context immediately. Is gssd even running on the server?

No they don't because they are not using Kerberos for NFS...

OK, let's state clearly what's going on here:

The client has a host/ principal. gssd is started automatically.

The server has what?

If the server has a keytab and an nfs/ principal, gss-proxy should be running, and there are no delays.

If the server has a keytab and no nfs/ principal, gss-proxy should be running, and any init sec context should fail immediately. There should be no delay. (If there is a delay, that needs to be troubleshot).

If the server does not have a keytab, gss-proxy will not be running, and NFSv4 clients will have to sense this. It takes a moment for each sniff. Otherwise, there's no operational difference.

I'm assuming then that the problem is that Kerberos is not set up on the _server_. Can you confirm this?

Also, this negotiation should be done only during the first contact of each server after a client reboot, thus the delay happens only during the first mount, not during subsequent ones. Can that also be confirmed?

Quoted 6 lines

So I guess this is what we are saying:

If you what to used Kerberos for anything at all, they must configure it for NFS for their clients to work properly... I'm not sure we really want to say this.

Well, the clients are working properly without the server principal in place. They just have an extra delay at mount time. (you yourself pointed out in an earlier e-mail that the client is doing everything correctly, and no mention has been made of any other operational issue).

We should encourage customers to set up in the most secure way possible. In this case:

- Kerberos is already available in the environment

- It's not _required_ only _recommended_ (clients can still use sec=sys without it) for the server to enable Kerberos, but it's a best practice

I'm guessing that if gssd and gss-proxy are running on the server all the time, even when there is no keytab, that delay should go away for everyone. So:

- Always run a gssd service on servers that export NFSv4 (I assume this will address the delay problem)

- Recommend the NFS server be provisioned with an nfs/ principal, and explicitly specify sec=sys on exports to prevent clients from negotiating an unwanted Kerberos security setting

I far prefer these fixes to adding another administrative setting on the client. It encourages better security, and it addresses the problem for all NFS clients that might want to try using Kerberos against Linux NFS servers, for whatever reason.

Quoted 5 lines
Quoted 5 lines

Suppose there are a thousand clients and one broken server. An administrator would fix that one server by adding an extra service principal, rather than log into a thousand clients to change a setting on each.

Quoted 7 lines
Quoted 4 lines

Suppose your client wants both sys and krb5 mounts of a group of servers, and some are "misconfigured." You have to enable gssd on the client but there are still delays on the sec=sys mounts.

In both these cases you are assuming Kerberos mounts are being used and so Kerberos should be configured for NFS. That is just not the case.

My assumption is that administrators would prefer automatic client set up, and good security by default.

There's no way to know in advance whether an administrator will want sec=sys and sec=krb5 mounts on the same system. /etc/fstab can be changed at any time, mounts can be done by hand, or the administrator can add or remove principals from /etc/krb5.keytab.

Our clients have to work when there are just sec=sys mounts, or when there are sec=sys and sec=krb5 mounts. They must allow on-demand configuration of sec=krb5. They must attempt to provide the best possible level of security at all times.

The out-of-the-shrinkwrap configuration must assume a mix of capabilities.

Quoted 7 lines
Quoted 3 lines

In fact, I think that's going to be pretty common. Why add an NFS service principal on a client if you don't expect to use sec=krb5 some of the time?

In that case adding the principal does make sense. But...

Why *must* you add a principal when you know only sec=sys mounts will be used?

Explained in detail above (and this is only for NFSv4, and is not at all a _must_). But in summary:

A client will attempt to use Kerberos for NFSv4 sec=sys when there is a host/ or nfs/ principal in its keytab. That needs to be documented.

Our _recommendation_ is that the server be provisioned with an nfs/ principal as well when NFSv4 is used in an environment where Kerberos is present. This eliminates a costly per-mount security negotiation, and enables cryptographically strong authentication of each client that mounts that server. NFSv4 sec=sys works properly otherwise without this principal.

--
Chuck Lever

--
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

#11 lore raw
Quoted 135 lines · Weston Andros Adamson
Quoted 130 lines · Chuck Lever
Quoted 23 lines · Steve Dickson

Again, sorry for the delay... That darn flux capacitor broke... again!!! :-)

Quoted 2 lines · Chuck Lever
Quoted 2 lines · Steve Dickson

[snip]

Quoted 11 lines
Quoted 5 lines

the key tab does have a nfs/hosname@REALM entry. So the call to the KDC is probably failing... which could be construed as a misconfiguration, but that misconfiguration should not even come into play with sec=sys mounts... IMHO...

I disagree, of course. sec=sys means the client is not going to use Kerberos to authenticate individual user requests, and users don't need a Kerberos ticket to access their files. That's still the case.

Quoted 5 lines
Quoted 2 lines

I'm not aware of any promise that sec=sys means there is no Kerberos within 50 miles of that mount.

I think that's is the assumption... No Kerberos will be needed for sec=sys mounts. Its not when Kerberos is not configured.

NFSv3 sec=sys happens to mean that no Kerberos is needed. This hasn't changed either.

NFSv4 sec=sys is different. Just like NFSv4 ACLs, and NFSv4 ID mapping, and NFSv4 locking, and so on.

Note though that Kerberos isn't needed for NFSv4 sec=sys even when there is a keytab. The client negotiates and operates without it.

Quoted 8 lines
Quoted 5 lines

If there are valid keytabs on both systems, they need to be set up correctly. If there's a misconfiguration, then gssd needs to report it precisely instead of time out. And it's just as easy to add a service principal to a keytab as it is to disable a systemd service in that case.

I think its more straightforward to disable a service that is not needed than to have to add a principal to a keytab for a service that's not being used or needed.

IMO automating NFS setup so that it chooses the most secure possible settings without intervention is the best possible solution.

Quoted 7 lines
Quoted 6 lines
Quoted 2 lines
Quoted 1 line

Is gssd waiting for syslog or something?

No... its just failing to get the machine creds for root

Clearly more is going on than that, and so far we have only some speculation. Can you provide an strace of rpc.gssd or a network capture so we can confirm what's going on?

Yes... Yes... and Yes.. I added you to the bz...

Thanks! I'll have a look at it.

Quoted 33 lines
Quoted 33 lines
Quoted 8 lines

[snip]

Quoted 6 lines
Quoted 5 lines

Which does work and will still work... but I'm thinking it is much similar to disable the service via systemd command systemctl disable rpc-gssd

than creating and editing those .conf files.

Quoted 7 lines
Quoted 5 lines

This should all be automatic, IMO.

On Solaris, drop in a keytab and a krb5.conf, and add sec=krb5 to your mounts. No reboot, nothing to restart. Linux should be that simple.

The only extra step with Linux is to 'sysctmctl start rpc-gssd' I don't there is much would can do about that....

Sure there is. Leave gssd running, and make sure it can respond quickly in every reasonable case. :-p

Quoted 6 lines

But of
course... Patches are always welcomed!! 8-)

TBL... When kerberos is configured correctly for NFS everything works just fine. When kerberos is configured, but not for NFS, causes delays on all NFS mounts.

This convinces me even more that there is a gssd issue here.

Quoted 2 lines

Today, there is a method to stop rpc-gssd from blindly starting when kerberos is configured to eliminate that delay.

Quoted 8 lines
Quoted 6 lines

I can fix my broken TV by not turning it on, and I don't notice the problem. But the problem is still there any time I want to watch TV.

The problem is not fixed by disabling gssd, it's just hidden in some cases.

I agree this %100... All I'm saying there should be a way to disable it when the daemon is not needed or used.

NFSv4 sec=sys *does* use Kerberos, when it is available. It has for years.

Documentation should be updated to state that if Kerberos is configured on clients, they will attempt to use it to manage some operations that are common to all NFSv4 mount points on that client, even when a mount point uses sec=sys.

Kerberos will be used for user authentication only if the client administrator has not specified a sec= setting, but the server export allows the use of Kerberos; or if the client administrator has specified a sec=krb5, sec=krb5i, or sec=krb5p setting.

The reason for using Kerberos for common operations is that a client may have just one lease management principal. If the client uses sec=sys and sec=krb5 mounts, and the sec=sys mount is done first, then lease management would use sys as well. The client cannot change this principal after it has established a lease and files are open.

Quoted 4 lines

A subsequent sec=krb5 mount will also use sec=sys for lease management. This will be surprising and insecure behavior. Therefore, all mounts from this client attempt to set up a krb5 lease management transport.

Quoted 5 lines

Chuck,

Thanks for explaining this so well! This definitely should make it’s way into documentation - we should have added something like this a long time ago.

I agree... where should it go? the mount.nfs man page??

steved.

#12 lore raw
Quoted 141 lines · Steve Dickson
Quoted 139 lines · Weston Andros Adamson
Quoted 134 lines
Quoted 25 lines · Chuck Lever

On Jun 28, 2016, at 10:27 AM, Steve Dickson <[email protected]> wrote:

Again, sorry for the delay... That darn flux capacitor broke... again!!! :-)

Quoted 3 lines · Chuck Lever
Quoted 2 lines · Steve Dickson

[snip]

Quoted 11 lines
Quoted 5 lines

the key tab does have a nfs/hosname@REALM entry. So the call to the KDC is probably failing... which could be construed as a misconfiguration, but that misconfiguration should not even come into play with sec=sys mounts... IMHO...

I disagree, of course. sec=sys means the client is not going to use Kerberos to authenticate individual user requests, and users don't need a Kerberos ticket to access their files. That's still the case.

Quoted 5 lines
Quoted 2 lines

I'm not aware of any promise that sec=sys means there is no Kerberos within 50 miles of that mount.

I think that's is the assumption... No Kerberos will be needed for sec=sys mounts. Its not when Kerberos is not configured.

NFSv3 sec=sys happens to mean that no Kerberos is needed. This hasn't changed either.

NFSv4 sec=sys is different. Just like NFSv4 ACLs, and NFSv4 ID mapping, and NFSv4 locking, and so on.

Note though that Kerberos isn't needed for NFSv4 sec=sys even when there is a keytab. The client negotiates and operates without it.

Quoted 8 lines
Quoted 5 lines

If there are valid keytabs on both systems, they need to be set up correctly. If there's a misconfiguration, then gssd needs to report it precisely instead of time out. And it's just as easy to add a service principal to a keytab as it is to disable a systemd service in that case.

I think its more straightforward to disable a service that is not needed than to have to add a principal to a keytab for a service that's not being used or needed.

IMO automating NFS setup so that it chooses the most secure possible settings without intervention is the best possible solution.

Quoted 7 lines
Quoted 6 lines
Quoted 2 lines
Quoted 1 line

Is gssd waiting for syslog or something?

No... its just failing to get the machine creds for root

Clearly more is going on than that, and so far we have only some speculation. Can you provide an strace of rpc.gssd or a network capture so we can confirm what's going on?

Yes... Yes... and Yes.. I added you to the bz...

Thanks! I'll have a look at it.

Quoted 33 lines
Quoted 33 lines
Quoted 8 lines

[snip]

Quoted 6 lines
Quoted 5 lines

Which does work and will still work... but I'm thinking it is much similar to disable the service via systemd command systemctl disable rpc-gssd

than creating and editing those .conf files.

Quoted 7 lines
Quoted 5 lines

This should all be automatic, IMO.

On Solaris, drop in a keytab and a krb5.conf, and add sec=krb5 to your mounts. No reboot, nothing to restart. Linux should be that simple.

The only extra step with Linux is to 'sysctmctl start rpc-gssd' I don't there is much would can do about that....

Sure there is. Leave gssd running, and make sure it can respond quickly in every reasonable case. :-p

Quoted 6 lines

But of
course... Patches are always welcomed!! 8-)

TBL... When kerberos is configured correctly for NFS everything works just fine. When kerberos is configured, but not for NFS, causes delays on all NFS mounts.

This convinces me even more that there is a gssd issue here.

Quoted 2 lines

Today, there is a method to stop rpc-gssd from blindly starting when kerberos is configured to eliminate that delay.

Quoted 8 lines
Quoted 6 lines

I can fix my broken TV by not turning it on, and I don't notice the problem. But the problem is still there any time I want to watch TV.

The problem is not fixed by disabling gssd, it's just hidden in some cases.

I agree this %100... All I'm saying there should be a way to disable it when the daemon is not needed or used.

NFSv4 sec=sys *does* use Kerberos, when it is available. It has for years.

Documentation should be updated to state that if Kerberos is configured on clients, they will attempt to use it to manage some operations that are common to all NFSv4 mount points on that client, even when a mount point uses sec=sys.

Kerberos will be used for user authentication only if the client administrator has not specified a sec= setting, but the server export allows the use of Kerberos; or if the client administrator has specified a sec=krb5, sec=krb5i, or sec=krb5p setting.

The reason for using Kerberos for common operations is that a client may have just one lease management principal. If the client uses sec=sys and sec=krb5 mounts, and the sec=sys mount is done first, then lease management would use sys as well. The client cannot change this principal after it has established a lease and files are open.

A subsequent sec=krb5 mount will also use sec=sys for lease management. This will be surprising and insecure behavior. Therefore, all mounts from this client attempt to set up a krb5 lease management transport.

Quoted 6 lines
Quoted 5 lines

Chuck,

Thanks for explaining this so well! This definitely should make it’s way into documentation - we should have added something like this a long time ago.

I agree... where should it go? the mount.nfs man page??

nfs(5) is where this kind of thing typically goes.

#13 lore raw
In reply to Chuck Lever
Quoted 31 lines · Chuck Lever
Quoted 22 lines · Steve Dickson

Again, sorry for the delay... That darn flux capacitor broke... again!!! :-)

Quoted 2 lines · Chuck Lever
Quoted 2 lines · Steve Dickson

[snip]

Quoted 11 lines
Quoted 5 lines

the key tab does have a nfs/hosname@REALM entry. So the call to the KDC is probably failing... which could be construed as a misconfiguration, but that misconfiguration should not even come into play with sec=sys mounts... IMHO...

I disagree, of course. sec=sys means the client is not going to use Kerberos to authenticate individual user requests, and users don't need a Kerberos ticket to access their files. That's still the case.

Quoted 5 lines
Quoted 2 lines

I'm not aware of any promise that sec=sys means there is no Kerberos within 50 miles of that mount.

I think that's is the assumption... No Kerberos will be needed for sec=sys mounts. Its not when Kerberos is not configured.

NFSv3 sec=sys happens to mean that no Kerberos is needed. This hasn't changed either.

Quoted 6 lines

NFSv4 sec=sys is different. Just like NFSv4 ACLs, and NFSv4 ID mapping, and NFSv4 locking, and so on.

Note though that Kerberos isn't needed for NFSv4 sec=sys even when there is a keytab. The client negotiates and operates without it.

If there is a keytab... there will be rpc.gssd runnning which will cause an upcall... and the negotiation starts with krb5i.. So yes its not needed but it will be tried.

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

If there are valid keytabs on both systems, they need to be set up correctly. If there's a misconfiguration, then gssd needs to report it precisely instead of time out. And it's just as easy to add a service principal to a keytab as it is to disable a systemd service in that case.

Quoted 7 lines
Quoted 3 lines

I think its more straightforward to disable a service that is not needed than to have to add a principal to a keytab for a service that's not being used or needed.

IMO automating NFS setup so that it chooses the most secure possible settings without intervention is the best possible solution.

Sure... now back to the point. ;-)

Quoted 8 lines
Quoted 5 lines
Quoted 3 lines

The problem is not fixed by disabling gssd, it's just hidden in some cases.

I agree this %100... All I'm saying there should be a way to disable it when the daemon is not needed or used.

NFSv4 sec=sys *does* use Kerberos, when it is available. It has for years.

Right... lets define "available" when rpc.gssd is running. When rpc.gssd is not running Kerberos is not available.

Quoted 19 lines

Documentation should be updated to state that if Kerberos is configured on clients, they will attempt to use it to manage some operations that are common to all NFSv4 mount points on that client, even when a mount point uses sec=sys.

Kerberos will be used for user authentication only if the client administrator has not specified a sec= setting, but the server export allows the use of Kerberos; or if the client administrator has specified a sec=krb5, sec=krb5i, or sec=krb5p setting.

The reason for using Kerberos for common operations is that a client may have just one lease management principal. If the client uses sec=sys and sec=krb5 mounts, and the sec=sys mount is done first, then lease management would use sys as well. The client cannot change this principal after it has established a lease and files are open.

Quoted 8 lines

A subsequent sec=krb5 mount will also use sec=sys for lease management. This will be surprising and insecure behavior. Therefore, all mounts from this client attempt to set up a krb5 lease management transport.

The server should have an nfs/ service principal. It doesn't _require_ one, but it's a best practice to have one in place.

Yeah our documentation is lacking in this area...

Quoted 6 lines

Administrators that have Kerberos available should use it. There's no overhead to enabling it on NFS servers, as long as the list of security flavors the server returns for each export does not include Kerberos flavors.

Admins are going to do what they want to no matter what we say... IMHO...

Quoted 9 lines
Quoted 8 lines

Having it automatically started just because there is a keytab, at first, I thought was a good idea, now it turns not people really don't what miscellaneous daemons running. Case in point gssproxy... Automatically comes but there is a way to disable it. With rpc.gssd there is not (easily).

Quoted 6 lines

There are good reasons to disable daemons:

- The daemon consumes a lot of resources.
- The daemon exposes an attack surface.

gssd does neither.

How about not needed? no rpc.gssd.. no upcall... no problem... ;-)

Quoted 2 lines

There are good reasons not to disable daemons:

I'm assuming you meant "to disable" or "not to enable" here.

Quoted 8 lines

- It enables simpler administration.
- It keeps the test matrix narrow (because you
have to test just one configuration, not
multiple ones: gssd enabled, gssd disabled,
and so on).

Always enabling gssd provides both of these benefits.

This is a production environment so there is no testing but simpler admin is never a bad thing.

Quoted 11 lines
Quoted 10 lines
Quoted 7 lines
Quoted 3 lines

This patch just tweaking that method to make things easier.

It makes one thing easier, and other things more difficult. As a community, I thought our goal was to make Kerberos easier to use, not easier to turn off.

Again I can't agree with you more! But this is the case were Kerberos is *not* being used for NFS... we should make that case work as well...

Quoted 7 lines

Agreed.

But NFSv4 sec=sys *does* use Kerberos when Kerberos is configured on the system. It's a fact, and we now need to make it convenient and natural and bug-free. The choice is between increasing security and just making it work, or adding one more knob that administrators have to Google for.

If they do not want use Kerberos for NFS, whether is a good idea or not, we can not force them to... Or can we?

Quoted 19 lines
Quoted 13 lines
Quoted 13 lines
Quoted 12 lines

To address your concern about covering up a bug. I just don't see it... The code is doing exactly what its asked to do. By default the kernel asks krb5i context (when rpc.gssd is run). rpc.gssd looking for a principle in the key tab, when found the KDC is called...

Everything is working just like it should and it is failing just like it should. I'm just trying to eliminate all this process when not needed, in an easier way..

Quoted 5 lines
Quoted 4 lines

I'm not even sure now what the use case is. The client has proper principals, but the server doesn't? The server should refuse the init sec context immediately. Is gssd even running on the server?

No they don't because they are not using Kerberos for NFS...

Quoted 8 lines

OK, let's state clearly what's going on here:

The client has a host/ principal. gssd is started automatically.

The server has what?

No info on the server other than its Linux and the nfs server is running.

Quoted 3 lines

If the server has a keytab and an nfs/ principal, gss-proxy should be running, and there are no delays.

In my testing when gss-proxy is not runnning the mount hangs.

Quoted 7 lines

If the server has a keytab and no nfs/ principal, gss-proxy should be running, and any init sec context should fail immediately. There should be no delay. (If there is a delay, that needs to be troubleshot).

Quoted 8 lines

If the server does not have a keytab, gss-proxy will not be running, and NFSv4 clients will have to sense this. It takes a moment for each sniff. Otherwise, there's no operational difference.

I'm assuming then that the problem is that Kerberos is not set up on the _server_. Can you confirm this?

I'll try... but we should have to force people to set up Kerberos on server they are not going to use.

Quoted 6 lines

Also, this negotiation should be done only during the first contact of each server after a client reboot, thus the delay happens only during the first mount, not during subsequent ones. Can that also be confirmed?

It appears it happen on all of them.

Quoted 9 lines
Quoted 8 lines

So I guess this is what we are saying:

If you what to used Kerberos for anything at all, they must configure it for NFS for their clients to work properly... I'm not sure we really want to say this.

Quoted 6 lines

Well, the clients are working properly without the server principal in place. They just have an extra delay at mount time. (you yourself pointed out in an earlier e-mail that the client is doing everything correctly, and no mention has been made of any other operational issue).

This appeared to be the case.

Quoted 14 lines

We should encourage customers to set up in the most secure way possible. In this case:

- Kerberos is already available in the environment

- It's not _required_ only _recommended_ (clients can still use sec=sys without it) for the server to enable Kerberos, but it's a best practice

I'm guessing that if gssd and gss-proxy are running on the server all the time, even when there is no keytab, that delay should go away for everyone. So:

Quoted 7 lines

- Always run a gssd service on servers that export NFSv4 (I assume this will address the delay problem)

- Recommend the NFS server be provisioned with an nfs/ principal, and explicitly specify sec=sys on exports to prevent clients from negotiating an unwanted Kerberos security setting

Or don't start rpc.gssd... ;-)

Quoted 6 lines

I far prefer these fixes to adding another administrative setting on the client. It encourages better security, and it addresses the problem for all NFS clients that might want to try using Kerberos against Linux NFS servers, for whatever reason.

As you say we can only recommend... If they don't now want to use secure mounts in a Kerberos environment we should not make them, is all I'm saying.

Quoted 11 lines
Quoted 11 lines
Quoted 11 lines

Suppose there are a thousand clients and one broken server. An administrator would fix that one server by adding an extra service principal, rather than log into a thousand clients to change a setting on each.

Suppose your client wants both sys and krb5 mounts of a group of servers, and some are "misconfigured." You have to enable gssd on the client but there are still delays on the sec=sys mounts.

Quoted 6 lines
Quoted 3 lines

In both these cases you are assuming Kerberos mounts are being used and so Kerberos should be configured for NFS. That is just not the case.

My assumption is that administrators would prefer automatic client set up, and good security by default.

I don't think we can make any assumption what admins want. They want strong security, but not with NFS... That's their choice, not ours.

Quoted 7 lines

There's no way to know in advance whether an administrator will want sec=sys and sec=krb5 mounts on the same system. /etc/fstab can be changed at any time, mounts can be done by hand, or the administrator can add or remove principals from /etc/krb5.keytab.

Quoted 8 lines

Our clients have to work when there are just sec=sys mounts, or when there are sec=sys and sec=krb5 mounts. They must allow on-demand configuration of sec=krb5. They must attempt to provide the best possible level of security at all times.

The out-of-the-shrinkwrap configuration must assume a mix of capabilities.

I agree... And they are... But if they know for a fact, that their client(s) will never want to use secure mount, which I'm sure there a few out there, I see no problem in not starting a service they well never use.

Quoted 17 lines
Quoted 9 lines
Quoted 5 lines

In fact, I think that's going to be pretty common. Why add an NFS service principal on a client if you don't expect to use sec=krb5 some of the time?

In that case adding the principal does make sense. But...

Why *must* you add a principal when you know only sec=sys mounts will be used?

Explained in detail above (and this is only for NFSv4, and is not at all a _must_). But in summary:

A client will attempt to use Kerberos for NFSv4 sec=sys when there is a host/ or nfs/ principal in its keytab. That needs to be documented.

Quoted 6 lines

Our _recommendation_ is that the server be provisioned with an nfs/ principal as well when NFSv4 is used in an environment where Kerberos is present. This eliminates a costly per-mount security negotiation, and enables cryptographically strong authentication of each client that mounts that server. NFSv4 sec=sys works properly otherwise without this principal.

The was beautifully said... and I agree with all...
But customer is going to turn around and tell me to go pound sand... Because they are not about to touching their server!!! :-) Esp when all they have to do is disable a service on the client where the hang is occurring.

steved.

#14 lore raw
Quoted 67 lines · Steve Dickson
Quoted 35 lines · Chuck Lever
Quoted 22 lines · Steve Dickson

Again, sorry for the delay... That darn flux capacitor broke... again!!! :-)

Quoted 3 lines · Chuck Lever
Quoted 2 lines · Steve Dickson

[snip]

Quoted 11 lines
Quoted 5 lines

the key tab does have a nfs/hosname@REALM entry. So the call to the KDC is probably failing... which could be construed as a misconfiguration, but that misconfiguration should not even come into play with sec=sys mounts... IMHO...

I disagree, of course. sec=sys means the client is not going to use Kerberos to authenticate individual user requests, and users don't need a Kerberos ticket to access their files. That's still the case.

Quoted 5 lines
Quoted 2 lines

I'm not aware of any promise that sec=sys means there is no Kerberos within 50 miles of that mount.

I think that's is the assumption... No Kerberos will be needed for sec=sys mounts. Its not when Kerberos is not configured.

NFSv3 sec=sys happens to mean that no Kerberos is needed. This hasn't changed either.

Quoted 6 lines

NFSv4 sec=sys is different. Just like NFSv4 ACLs, and NFSv4 ID mapping, and NFSv4 locking, and so on.

Note though that Kerberos isn't needed for NFSv4 sec=sys even when there is a keytab. The client negotiates and operates without it.

If there is a keytab... there will be rpc.gssd runnning which will cause an upcall... and the negotiation starts with krb5i.. So yes its not needed but it will be tried.

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

If there are valid keytabs on both systems, they need to be set up correctly. If there's a misconfiguration, then gssd needs to report it precisely instead of time out. And it's just as easy to add a service principal to a keytab as it is to disable a systemd service in that case.

Quoted 7 lines
Quoted 3 lines

I think its more straightforward to disable a service that is not needed than to have to add a principal to a keytab for a service that's not being used or needed.

IMO automating NFS setup so that it chooses the most secure possible settings without intervention is the best possible solution.

Sure... now back to the point. ;-)

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

The problem is not fixed by disabling gssd, it's just hidden in some cases.

Quoted 7 lines
Quoted 5 lines
Quoted 2 lines

I agree this %100... All I'm saying there should be a way to disable it when the daemon is not needed or used.

NFSv4 sec=sys *does* use Kerberos, when it is available. It has for years.

Right... lets define "available" when rpc.gssd is running. When rpc.gssd is not running Kerberos is not available.

OK, but now whenever a change to the Kerberos configuration on the host is made (the keytab is created or destroyed, or a principal is added or removed from the keytab), an extra step is needed to ensure secure NFS is working properly.

Should we go farther and say that, if there happen to be no sec=krb5[ip] mounts on the system, gssd should be shut down? I mean, it's not being used, so let's turn it off!

There is a host/ principal in the keytab. That means Kerberos is active on that system, and gssd can use it. That means it is possible that an administrator (or automounter) may specify sec=krb5 at some point during the life of this client. For me that means gssd should be running on this system.

Another way to achieve your goal is to add a command line option to gssd which specifies which principal in the local keytab to use as the machine credential. Specify a principal that is not in the keytab, and gssd should do no negotiation at all, and will return immediately.

There may already be a command line option to do this (I'm not at liberty to confirm my memory at the moment).

That would be an immediate solution for this customer, if provisioning an nfs/ service principal on their server is still anathema, and no other code change is needed.

Quoted 48 lines
Quoted 18 lines

Documentation should be updated to state that if Kerberos is configured on clients, they will attempt to use it to manage some operations that are common to all NFSv4 mount points on that client, even when a mount point uses sec=sys.

Kerberos will be used for user authentication only if the client administrator has not specified a sec= setting, but the server export allows the use of Kerberos; or if the client administrator has specified a sec=krb5, sec=krb5i, or sec=krb5p setting.

The reason for using Kerberos for common operations is that a client may have just one lease management principal. If the client uses sec=sys and sec=krb5 mounts, and the sec=sys mount is done first, then lease management would use sys as well. The client cannot change this principal after it has established a lease and files are open.

Quoted 8 lines

A subsequent sec=krb5 mount will also use sec=sys for lease management. This will be surprising and insecure behavior. Therefore, all mounts from this client attempt to set up a krb5 lease management transport.

The server should have an nfs/ service principal. It doesn't _require_ one, but it's a best practice to have one in place.

Yeah our documentation is lacking in this area...

Quoted 6 lines

Administrators that have Kerberos available should use it. There's no overhead to enabling it on NFS servers, as long as the list of security flavors the server returns for each export does not include Kerberos flavors.

Admins are going to do what they want to no matter what we say... IMHO...

Quoted 11 lines
Quoted 8 lines

Having it automatically started just because there is a keytab, at first, I thought was a good idea, now it turns not people really don't what miscellaneous daemons running. Case in point gssproxy... Automatically comes but there is a way to disable it. With rpc.gssd there is not (easily).

There are good reasons to disable daemons:

Quoted 8 lines
Quoted 4 lines

- The daemon consumes a lot of resources.
- The daemon exposes an attack surface.

gssd does neither.

How about not needed? no rpc.gssd.. no upcall... no problem... ;-)

Quoted 1 line

There are good reasons not to disable daemons:

I'm assuming you meant "to disable" or "not to enable" here.

No, I meant exactly what I wrote. Let's rewrite it "good reasons to leave a daemon enabled"

Quoted 8 lines
Quoted 7 lines

- It enables simpler administration.
- It keeps the test matrix narrow (because you
have to test just one configuration, not
multiple ones: gssd enabled, gssd disabled,
and so on).

Always enabling gssd provides both of these benefits.

This is a production environment so there is no testing

I meant QA testing by the distributor. Without the extra knob, the QA tester has to test only the configuration where gssd is enabled.

Whenever you add a knob like this, you have to double your QA test matrix.

Quoted 15 lines

but simpler admin is never a bad thing.

Quoted 13 lines
Quoted 10 lines
Quoted 7 lines
Quoted 3 lines

This patch just tweaking that method to make things easier.

It makes one thing easier, and other things more difficult. As a community, I thought our goal was to make Kerberos easier to use, not easier to turn off.

Again I can't agree with you more! But this is the case were Kerberos is *not* being used for NFS... we should make that case work as well...

Agreed.

Quoted 7 lines
Quoted 5 lines

But NFSv4 sec=sys *does* use Kerberos when Kerberos is configured on the system. It's a fact, and we now need to make it convenient and natural and bug-free. The choice is between increasing security and just making it work, or adding one more knob that administrators have to Google for.

If they do not want use Kerberos for NFS, whether is a good idea or not, we can not force them to... Or can we?

No-one is forcing anyone to do anything.

Quoted 47 lines
Quoted 17 lines
Quoted 11 lines
Quoted 11 lines
Quoted 10 lines

To address your concern about covering up a bug. I just don't see it... The code is doing exactly what its asked to do. By default the kernel asks krb5i context (when rpc.gssd is run). rpc.gssd looking for a principle in the key tab, when found the KDC is called...

Everything is working just like it should and it is failing just like it should. I'm just trying to eliminate all this process when not needed, in an easier way..

Quoted 5 lines
Quoted 4 lines

I'm not even sure now what the use case is. The client has proper principals, but the server doesn't? The server should refuse the init sec context immediately. Is gssd even running on the server?

No they don't because they are not using Kerberos for NFS...

Quoted 8 lines

OK, let's state clearly what's going on here:

The client has a host/ principal. gssd is started automatically.

The server has what?

No info on the server other than its Linux and the nfs server is running.

Quoted 3 lines

If the server has a keytab and an nfs/ principal, gss-proxy should be running, and there are no delays.

In my testing when gss-proxy is not runnning the mount hangs.

Quoted 13 lines

If the server has a keytab and no nfs/ principal, gss-proxy should be running, and any init sec context should fail immediately. There should be no delay. (If there is a delay, that needs to be troubleshot).

If the server does not have a keytab, gss-proxy will not be running, and NFSv4 clients will have to sense this. It takes a moment for each sniff. Otherwise, there's no operational difference.

Quoted 4 lines
Quoted 2 lines

I'm assuming then that the problem is that Kerberos is not set up on the _server_. Can you confirm this?

I'll try... but we should have to force people to set up Kerberos on server they are not going to use.

I say one more time: no-one is forcing anyone to do anything.

Quoted 6 lines
Quoted 5 lines

Also, this negotiation should be done only during the first contact of each server after a client reboot, thus the delay happens only during the first mount, not during subsequent ones. Can that also be confirmed?

It appears it happen on all of them.

Can this customer's observed behavior be reproduced in vitro? Seems like there are many unknowns here, and it would make sense to get more answers before proposing a long-term change to our administrative interfaces.

Quoted 39 lines
Quoted 7 lines
Quoted 6 lines

So I guess this is what we are saying:

If you what to used Kerberos for anything at all, they must configure it for NFS for their clients to work properly... I'm not sure we really want to say this.

Quoted 6 lines

Well, the clients are working properly without the server principal in place. They just have an extra delay at mount time. (you yourself pointed out in an earlier e-mail that the client is doing everything correctly, and no mention has been made of any other operational issue).

This appeared to be the case.

Quoted 14 lines

We should encourage customers to set up in the most secure way possible. In this case:

- Kerberos is already available in the environment

- It's not _required_ only _recommended_ (clients can still use sec=sys without it) for the server to enable Kerberos, but it's a best practice

I'm guessing that if gssd and gss-proxy are running on the server all the time, even when there is no keytab, that delay should go away for everyone. So:

Quoted 7 lines

- Always run a gssd service on servers that export NFSv4 (I assume this will address the delay problem)

- Recommend the NFS server be provisioned with an nfs/ principal, and explicitly specify sec=sys on exports to prevent clients from negotiating an unwanted Kerberos security setting

Or don't start rpc.gssd... ;-)

Quoted 1 line
Quoted 8 lines
Quoted 5 lines

I far prefer these fixes to adding another administrative setting on the client. It encourages better security, and it addresses the problem for all NFS clients that might want to try using Kerberos against Linux NFS servers, for whatever reason.

As you say we can only recommend... If they don't now want to use secure mounts in a Kerberos environment we should not make them, is all I'm saying.

I don't see that I'm proposing otherwise. I've simply described the recommended best practice.

NFSv4 sec=sys works fine with or without Kerberos present.

However, if there is a KDC available, and the client is provisioned with a host/ principal, we recommend adding an nfs/ service principal to the NFS server. sec=sys still works in the absence of said principal.

How is that forcing anything?

In the specific case for your customer, it's simply not clear why the delays occur. More information is needed before it makes sense to propose a code change.

Quoted 31 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines

Suppose there are a thousand clients and one broken server. An administrator would fix that one server by adding an extra service principal, rather than log into a thousand clients to change a setting on each.

Suppose your client wants both sys and krb5 mounts of a group of servers, and some are "misconfigured." You have to enable gssd on the client but there are still delays on the sec=sys mounts.

Quoted 6 lines
Quoted 3 lines

In both these cases you are assuming Kerberos mounts are being used and so Kerberos should be configured for NFS. That is just not the case.

My assumption is that administrators would prefer automatic client set up, and good security by default.

I don't think we can make any assumption what admins want. They want strong security, but not with NFS... That's their choice, not ours.

Quoted 12 lines

There's no way to know in advance whether an administrator will want sec=sys and sec=krb5 mounts on the same system. /etc/fstab can be changed at any time, mounts can be done by hand, or the administrator can add or remove principals from /etc/krb5.keytab.

Our clients have to work when there are just sec=sys mounts, or when there are sec=sys and sec=krb5 mounts. They must allow on-demand configuration of sec=krb5. They must attempt to provide the best possible level of security at all times.

Quoted 6 lines
Quoted 2 lines

The out-of-the-shrinkwrap configuration must assume a mix of capabilities.

I agree... And they are... But if they know for a fact, that their client(s) will never want to use secure mount, which I'm sure there a few out there, I see no problem in not starting a service they well never use.

Why "force" an admin to worry about whether some random service is running or not?

IMO the mechanism (one or more daemons, a systemctl service, the use of a keyring, or using The Force) should be transparent to the administrator, who should care only about security policy settings.

The whole idea of having separate services for enabling NFS security is confusing IMO. The default is sec=sys, but as soon as you vary from that, things get wonky.

It also makes it much harder for distributors or upstream developers to make alterations to this mechanism while not altering the administrative interfaces.

I have to check whether "SECURE=YES" is uncommented in /etc/sysconfig/nfs. I have to check whether nfs.target includes nfs-secure.service. None of this is obvious or desirable, and after all is said and done I usually miss something and have to Google anyway, before a valid krb5.conf and adding "sec=krb5" works properly.

And the only reason we have this complication is because someone complained once about extra daemons running. It's just superstition.

Why can't it be simple for all sec= settings?

Quoted 21 lines
Quoted 15 lines
Quoted 7 lines
Quoted 3 lines

In fact, I think that's going to be pretty common. Why add an NFS service principal on a client if you don't expect to use sec=krb5 some of the time?

In that case adding the principal does make sense. But...

Why *must* you add a principal when you know only sec=sys mounts will be used?

Explained in detail above (and this is only for NFSv4, and is not at all a _must_). But in summary:

A client will attempt to use Kerberos for NFSv4 sec=sys when there is a host/ or nfs/ principal in its keytab. That needs to be documented.

Quoted 6 lines

Our _recommendation_ is that the server be provisioned with an nfs/ principal as well when NFSv4 is used in an environment where Kerberos is present. This eliminates a costly per-mount security negotiation, and enables cryptographically strong authentication of each client that mounts that server. NFSv4 sec=sys works properly otherwise without this principal.

Quoted 3 lines

The was beautifully said... and I agree with all...
But customer is going to turn around and tell me to go pound sand... Because they are not about to touching their server!!! :-)

What if this customer came back and said "We also want this to work with NFSv2 on UDP?" Would you still want to accommodate them?

If they don't want to provision an nfs/ service principal it would be really helpful for us to know why. IMO the community should not accommodate anyone who refuses to use a best practice without a reason. Is there a reason?

Quoted 2 lines

Esp when all they have to do is disable a service on the client where the hang is occurring.

They could also use NFSv3.