-
Notifications
You must be signed in to change notification settings - Fork 3
4_1 Authentication methods
The NFS protocol offers multiple authentication methods which are also called authentication flavors.
The most common ones are AUTH_SYS
and RPCSEC_GSS
which are supported by most servers and clients.
On Linux, multiple authentication methods can be allowed for an export by using the option sec=FLAVOR1:FLAVOR2:...
The available options are sys
, kr5b
, krb5i
, and krb5p
, which will be explained now.
This is the easiest authentication method and usually the default setting because it does not require any configuration on the server or client side.
The client attaches a uid
, gid
and up to 16 auxiliary gids
to each request and the server simply trusts these values without any verification.
By default on most server implementations, only ID 0 for the root user is not allowed.
This authentication flavor does not involve any cryptography, nothing stops a clients from spoofing a uid
in order to access other users' files.
Another problem of this authentication flavor is that servers and clients need to make sure that a uid
refers to the same user on both systems.
On Linux this is the default option, it can also be set explicitly using the sec=sys
option.
Many NFS implementations support Kerberos 5 authentication. There are three levels of protection that can be chosen based on the security and performance requirements of an application.
-
krb5
: authentication only -
krb5i
: authentication and data integrity protection -
krb5p
: authentication, integrity protection and encryption
The main advantage compared to AUTH_SYS
is that server and client can cryptographically verify each other's identity.
A big disadvantage is that Kerberos may be difficult to setup if it is not already available.
In the NFS RFC, this authentication flavor is called RPCSEC_GSS
because it is internally based on GSS-API (Generic Security Services), which provides an abstraction layer between protocols and authentication methods.
Because of its generic nature, the RPCSEC_GSS
authentication flavor can use other authentication methods than Kerberos.
Older versions of the NFSv4 RFC also required SPKM-3
and LIPKEY
as mandatory authentication methods which were designed to be easier to configure than Kerberos, however the requirement has been removed from the standard and most NFS implementations only support Kerberos.
On Linux, when the kernel's NFS client wants to initiate a session using Kerberos, it makes a call to the user space process rpc.gssd
which performs the handshake. On the server there is rpc.svcgssd
to accept the session.
Once the session and the keys have been established, everything else happens in the kernel.
Some Unix implementations of NFS also support other authentication flavors.
Solaris based operating systems support Diffie-Hellman authentication with pre-shared public keys (referred to as AUTH_DH
and AUTH_DES
).
The Diffie-Hellman algorithm with a modulus of 192 bit is used to derive a DES key for the session.
This cryptography is considered weak nowadays.
For more details on how it works, see https://docstore.mik.ua/orelly/networking_2ndEd/nfs/ch12_05.htm.