2016-04-13 23:33:29

by NeilBrown

[permalink] [raw]
Subject: AUTH_NONE at top of SECINFO_NONAME reply.


Hi,
I have an NFSv4.1 server (Netapp, don't know about version numbers)
which responds to
PUT_ROOTFH
SECINFO_NONAME

with:

flavor: AUTH_NULL (0)
flavor: RPCSEC_GSS (6)
service: rpcsec_gss_svc_integrity (2)
flavor: RPCSEC_GSS (6)
service: rpcsec_gss_svc_none (1)
flavor: AUTH_UNIX (1)

This causes the Linux client to use AUTH_NULL, which doesn't end well
Opcode: ACCESS (3), [Access Denied: RD LU MD XT DL]

I suspect this is a server bug, because the first flavor is meant to be
the most preferred. However I wonder if there might be something else
going on.

1/ I note that for NFSv3 AUTH_NULL means something a bit different
in this context:

* AUTH_NULL has a special meaning when it's in the server list - it
* means that the server will ignore the rpc creds, so any flavor
* can be used.

Is there any chance that servers might reasonably expect that
behavior for NFSv4.1 as well??

2/ In the pseudo-root filesystem it might make sense to use AUTH_NULL,
providing something else is used when crossing in to another
filesystem.
Should the client send a new SECINFO when that happens (it may not
help in this case, I don't know) or is that really only needed when
NFS4ERR_WRONGSEC is returned?
It seems a bit asymmetric that SECINFO is use pro-actively at the start
of a session, but then only re-actively after that.

Any thoughts?

Thanks,
NeilBrown


Attachments:
signature.asc (818.00 B)

2016-04-18 18:26:35

by J. Bruce Fields

[permalink] [raw]
Subject: Re: AUTH_NONE at top of SECINFO_NONAME reply.

On Thu, Apr 14, 2016 at 09:33:22AM +1000, NeilBrown wrote:
> I have an NFSv4.1 server (Netapp, don't know about version numbers)
> which responds to
> PUT_ROOTFH
> SECINFO_NONAME
>
> with:
>
> flavor: AUTH_NULL (0)
> flavor: RPCSEC_GSS (6)
> service: rpcsec_gss_svc_integrity (2)
> flavor: RPCSEC_GSS (6)
> service: rpcsec_gss_svc_none (1)
> flavor: AUTH_UNIX (1)
>
> This causes the Linux client to use AUTH_NULL, which doesn't end well
> Opcode: ACCESS (3), [Access Denied: RD LU MD XT DL]
>
> I suspect this is a server bug, because the first flavor is meant to be
> the most preferred. However I wonder if there might be something else
> going on.
>
> 1/ I note that for NFSv3 AUTH_NULL means something a bit different
> in this context:
>
> * AUTH_NULL has a special meaning when it's in the server list - it
> * means that the server will ignore the rpc creds, so any flavor
> * can be used.
>
> Is there any chance that servers might reasonably expect that
> behavior for NFSv4.1 as well??

I'll admit it seems a trap for the unwary implementor, but I think this
case is really clear:

http://tools.ietf.org/html/rfc5661#section-18.29.3

The result will contain an array that represents the security
mechanisms available, with an order corresponding to the
server's preferences, the most preferred being first in the
array. The client is free to pick whatever security mechanism
it both desires and supports, or to pick in the server's
preference order the first one it supports.

So we should be leaning on the server vendor to fix and/or explain
what's going on there.

> 2/ In the pseudo-root filesystem it might make sense to use AUTH_NULL,
> providing something else is used when crossing in to another
> filesystem.

One thing that bugs me about that is that the client could have been fed
forged replies while using AUTH_NULL, and after switching to, say,
krb5i, it may still be depending on those results (e.g., the lookups
that got you to that mountpoint), unless it's careful to recheck some
things.

There are probably assumptions under which that could still be useful,
but it starts to feel a bit delicate. Anyway, that's a bit of a derail:

> Should the client send a new SECINFO when that happens (it may not
> help in this case, I don't know) or is that really only needed when
> NFS4ERR_WRONGSEC is returned?
> It seems a bit asymmetric that SECINFO is use pro-actively at the start
> of a session, but then only re-actively after that.

Maybe. I would have guessed that / is the point where you're most
likely to guess the security flavor wrong. I'm not sure it really
matters which way you do it, though. It's just one round trip plus or
minus on each mountpoint.

--b.

2016-04-19 21:24:32

by NeilBrown

[permalink] [raw]
Subject: Re: AUTH_NONE at top of SECINFO_NONAME reply.

On Tue, Apr 19 2016, J. Bruce Fields wrote:

> On Thu, Apr 14, 2016 at 09:33:22AM +1000, NeilBrown wrote:
>> I have an NFSv4.1 server (Netapp, don't know about version numbers)
>> which responds to
>> PUT_ROOTFH
>> SECINFO_NONAME
>>
>> with:
>>
>> flavor: AUTH_NULL (0)
>> flavor: RPCSEC_GSS (6)
>> service: rpcsec_gss_svc_integrity (2)
>> flavor: RPCSEC_GSS (6)
>> service: rpcsec_gss_svc_none (1)
>> flavor: AUTH_UNIX (1)
>>
>> This causes the Linux client to use AUTH_NULL, which doesn't end well
>> Opcode: ACCESS (3), [Access Denied: RD LU MD XT DL]
>>
>> I suspect this is a server bug, because the first flavor is meant to be
>> the most preferred. However I wonder if there might be something else
>> going on.
>>
>> 1/ I note that for NFSv3 AUTH_NULL means something a bit different
>> in this context:
>>
>> * AUTH_NULL has a special meaning when it's in the server list - it
>> * means that the server will ignore the rpc creds, so any flavor
>> * can be used.
>>
>> Is there any chance that servers might reasonably expect that
>> behavior for NFSv4.1 as well??
>
> I'll admit it seems a trap for the unwary implementor, but I think this
> case is really clear:
>
> http://tools.ietf.org/html/rfc5661#section-18.29.3
>
> The result will contain an array that represents the security
> mechanisms available, with an order corresponding to the
> server's preferences, the most preferred being first in the
> array. The client is free to pick whatever security mechanism
> it both desires and supports, or to pick in the server's
> preference order the first one it supports.
>
> So we should be leaning on the server vendor to fix and/or explain
> what's going on there.

That was the direction I was leaning, but it is nice to have it
confirmed - particularly given the interesting rules with NFSv3.

My colleague subsequently discovered that there were setting on the
Netapp which could change the behavior. He fiddled things and the
problem went away, but he noted:

On the netapp side, I have three of these settings: rorule,rwrule,superuser, and for
each of these I can set
from the list: "any none krb5 krb5i ntlm sys". So with
"ro=sys,rw=none,superuser=any" I'm still in the
situation where I can get the AUTH_NULL first ...

("AUTH_NULL first" being the problematic situation).
I wonder if "none" means "no authentication needed" or "no access
given".

Still seems strange behavior for the server, but as it can be avoided it
probably isn't worth any more consideration.

Thanks a lot,

NeilBrown


Attachments:
signature.asc (818.00 B)

2016-04-19 22:15:03

by Trond Myklebust

[permalink] [raw]
Subject: Re: AUTH_NONE at top of SECINFO_NONAME reply.

DQoNCg0KDQoNCk9uIDQvMTkvMTYsIDE3OjI0LCAiTmVpbEJyb3duIiA8bGludXgtbmZzLW93bmVy
QHZnZXIua2VybmVsLm9yZyBvbiBiZWhhbGYgb2YgbmVpbGJAc3VzZS5jb20+IHdyb3RlOg0KDQo+
T24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GVydXNlcj1hbnkiIEknbSBzdGlsbCBpbiB0aGUNCj4Jc2l0dWF0aW9uIHdoZXJlIEkgY2Fu
IGdldCB0aGUgQVVUSF9OVUxMIGZpcnN0IC4uLg0KPg0KPigiQVVUSF9OVUxMIGZpcnN0IiBiZWlu
ZyB0aGUgcHJvYmxlbWF0aWMgc2l0dWF0aW9uKS4NCj5JIHdvbmRlciBpZiAibm9uZSIgbWVhbnMg
Im5vIGF1dGhlbnRpY2F0aW9uIG5lZWRlZCIgb3IgIm5vIGFjY2Vzcw0KPmdpdmVuIi4NCg0KQSBj
ZXJ0YWluIHRob21hc0BuZXRhcHAuY29tIGV4cGxhaW5lZCB0aGUgYmVoYXZpb3VyIHRodXM6DQoN
CiBodHRwczovL3d3dy5pZXRmLm9yZy9tYWlsLWFyY2hpdmUvd2ViL25mc3Y0L2N1cnJlbnQvbXNn
MDk3NDMuaHRtbA0KDQpDaGVlcnMNCiAgVHJvbmQNCg==


2016-04-19 23:13:22

by NeilBrown

[permalink] [raw]
Subject: Re: AUTH_NONE at top of SECINFO_NONAME reply.

On Wed, Apr 20 2016, Trond Myklebust <[email protected]> wrote:

> On 4/19/16, 17:24, "NeilBrown" <[email protected] on behalf of [email protected]> wrote:
>
>>I wonder if "none" means "no authentication needed" or "no access
>>given".
>
> A certain [email protected] explained the behaviour thus:
>
> https://www.ietf.org/mail-archive/web/nfsv4/current/msg09743.html
>

Ahhh, cool. Thanks!

NeilBrown


Attachments:
signature.asc (818.00 B)