Network File System Version 4 | T. Myklebust |
Internet-Draft | Hammerspace |
Updates: 5531 (if approved) | C. Lever, Ed. |
Intended status: Standards Track | Oracle |
Expires: November 1, 2020 | April 30, 2020 |
Towards Remote Procedure Call Encryption By Default
draft-ietf-nfsv4-rpc-tls-07
This document describes a mechanism that, through the use of opportunistic Transport Layer Security (TLS), enables encryption of in-transit Remote Procedure Call (RPC) transactions while interoperating with ONC RPC implementations that do not support this mechanism. This document updates RFC 5531.
This Internet-Draft is submitted in full conformance with the provisions of BCP 78 and BCP 79.
Internet-Drafts are working documents of the Internet Engineering Task Force (IETF). Note that other groups may also distribute working documents as Internet-Drafts. The list of current Internet-Drafts is at https://datatracker.ietf.org/drafts/current/.
Internet-Drafts are draft documents valid for a maximum of six months and may be updated, replaced, or obsoleted by other documents at any time. It is inappropriate to use Internet-Drafts as reference material or to cite them other than as "work in progress."
This Internet-Draft will expire on November 1, 2020.
Copyright (c) 2020 IETF Trust and the persons identified as the document authors. All rights reserved.
This document is subject to BCP 78 and the IETF Trust's Legal Provisions Relating to IETF Documents (https://trustee.ietf.org/license-info) in effect on the date of publication of this document. Please review these documents carefully, as they describe your rights and restrictions with respect to this document. Code Components extracted from this document must include Simplified BSD License text as described in Section 4.e of the Trust Legal Provisions and are provided without warranty as described in the Simplified BSD License.
RFC Editor: Please remove this Editor's Note and the following paragraph before this document is published.
The source for this draft is maintained in GitHub. Suggested changes should be submitted as pull requests at https://github.com/chucklever/i-d-rpc-tls . Instructions are on that page as well. Editorial changes can be managed in GitHub, but any substantive change should be discussed on the nfsv4@ietf.org mailing list.
In 2014 the IETF published [RFC7258], which recognized that unauthorized observation of network traffic had become widespread and was a subversive threat to all who make use of the Internet at large. It strongly recommended that newly defined Internet protocols should make a genuine effort to mitigate monitoring attacks. Typically this mitigation is done by encrypting data in transit.
The Remote Procedure Call version 2 protocol has been a Proposed Standard for three decades (see [RFC5531] and its antecedents). Over twenty years ago, Eisler et al. first introduced RPCSEC GSS as an in-transit encryption mechanism for RPC [RFC2203]. However, experience has shown that RPCSEC GSS with in-transit encryption can be challenging to use in practice:
However strong GSS-provided confidentiality is, it cannot provide any security if the challenges of using it result in choosing not to deploy it at all.
Moreover, the use of AUTH_SYS remains common despite the adverse effects that acceptance of UIDs and GIDs from unauthenticated clients brings with it. Continued use is in part because:
The alternative described in the current document is to employ a transport layer security mechanism that can protect the confidentiality of each RPC connection transparently to RPC and upper-layer protocols. The Transport Layer Security protocol [RFC8446] (TLS) is a well-established Internet building block that protects many standard Internet protocols such as the Hypertext Transport Protocol (HTTP) [RFC2818].
Encrypting at the RPC transport layer accords several significant benefits:
The current document specifies the implementation of RPC on an encrypted transport in a manner that is transparent to upper-layer protocols based on RPC. The imposition of encryption at the transport layer protects any upper-layer protocol that employs RPC, without alteration of that protocol.
Further, Section 7 of the current document defines policies in line with [RFC7435] which enable RPC-on-TLS to be deployed opportunistically in environments that contain RPC implementations that do not support TLS. However, specifications for RPC-based upper-layer protocols should choose to require even stricter policies that guarantee encryption and host authentication is used for all RPC transactions. Enforcing the use of RPC-on-TLS is of particular importance for existing upper-layer protocols whose security infrastructure is weak.
The protocol specification in the current document assumes that support for RPC, TLS, PKI, GSS-API, and DNSSEC is already available in an RPC implementation where TLS support is to be added.
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in BCP 14 [RFC2119] [RFC8174] when, and only when, they appear in all capitals, as shown here.
This document adopts the terminology introduced in Section 3 of [RFC6973] and assumes a working knowledge of the Remote Procedure Call (RPC) version 2 protocol [RFC5531] and the Transport Layer Security (TLS) version 1.3 protocol [RFC8446].
Note also that the NFS community long ago adopted the use of the term "privacy" from documents such as [RFC2203]. In the current document, the authors use the term "privacy" only when referring specifically to the historic GSS privacy service defined in [RFC2203]. Otherwise, the authors use the term "confidentiality", following the practices of contemporary security communities.
We adhere to the convention that a "client" is a network host that actively initiates an association, and a "server" is a network host that passively accepts an association request.
RPC documentation historically refers to the authentication of a connecting host as "machine authentication" or "host authentication". TLS documentation refers to the same as "peer authentication". In the current document there is little distinction between these terms.
The term "user authentication" in the current document refers specifically to the RPC caller's credential, provided in the "cred" and "verf" fields in each RPC Call.
The mechanism described in the current document interoperates fully with RPC implementations that do not support TLS. Policy settings on the RPC-on-TLS-enabled peer determine whether RPC operation continues without the use of TLS or RPC operation is not permitted.
To achieve this, we introduce a new RPC authentication flavor called AUTH_TLS. This new flavor signals that the client wants to initiate TLS negotiation if the server supports it. Except for the modifications described in this section, the RPC protocol is unaware of security encapsulation at the transport layer.
When an RPC client is ready to begin a TLS session, it sends a NULL RPC procedure with an auth_flavor of AUTH_TLS. The value of AUTH_TLS is defined in Section 8.1. The NULL request is made to the same port as if TLS were not in use.
The length of the opaque data constituting the credential sent in the RPC Call message MUST be zero. The verifier accompanying the credential MUST be an AUTH_NONE verifier of length zero.
The flavor value of the verifier in the RPC Reply message received from the server MUST be AUTH_NONE. The length of the verifier's body field is eight. The bytes of the verifier's body field encode the ASCII characters "STARTTLS" as a fixed-length opaque.
If the RPC server replies with a reply_stat of MSG_ACCEPTED and an AUTH_NONE verifier containing the "STARTTLS" token, the RPC client follows with a "ClientHello" message. The client MAY proceed with TLS session establishment even if the Reply's accept_stat is not SUCCESS (for example, if the accept_stat is PROG_UNAVAIL). Once the TLS handshake is complete, the RPC client and server have established a secure channel for communicating.
If the Reply's reply_stat is MSG_ACCEPTED but the verifier does not contain the "STARTTLS" token, or if the Reply's reply_stat is MSG_DENIED, the RPC client MUST NOT send a "ClientHello" message. RPC operation can continue, however it will be without any confidentiality, integrity or authentication protection from (D)TLS.
If, after a successful RPC AUTH_TLS probe, the subsequent TLS handshake should fail for any reason, the RPC client reports this failure to the upper-layer application the same way it reports an AUTH_ERROR rejection from the RPC server.
If an RPC client uses the AUTH_TLS authentication flavor on any procedure other than the NULL procedure, or an RPC client sends an RPC AUTH_TLS probe within an existing TLS session, the RPC server MUST reject that RPC Call by setting the reply_stat field to MSG_DENIED, the reject_stat field to AUTH_ERROR, and the auth_stat field to AUTH_BADCRED.
Both RPC and TLS have peer and user authentication, with some overlap in capability between RPC and TLS. The goal of interoperability with implementations that do not support TLS requires limiting the combinations that are allowed and precisely specifying the role that each layer plays. We also want to handle TLS such that an RPC implementation can make the use of TLS invisible to existing RPC consumer applications.
Each RPC server that supports RPC-over-TLS MUST possess a unique global identity (e.g., a certificate that is signed by a well-known trust anchor). Such an RPC server MUST request a TLS peer identity from each client upon first contact. There are two different modes of client deployment:
In either of these modes, RPC user authentication is not affected by the use of transport layer security. When a client presents a TLS peer identity to an RPC server, the protocol extension described in the current document provides no way for the server to know whether that identity represents one RPC user on that client, or is shared amongst many RPC users. Therefore, a server implementation must not utilize the remote TLS peer identity for RPC user authentication.
To use GSS, an RPC server has to possess a GSS service principal. On a TLS session, GSS mutual (peer) authentication occurs as usual, but only after a TLS session has been established for communication. Authentication of GSS users is unchanged by the use of TLS.
RPCSEC GSS can also perform per-request integrity or confidentiality protection. When operating over a TLS session, these GSS services become redundant. An RPC implementation capable of concurrently using TLS and RPCSEC GSS can use GSS channel binding, as defined in [RFC5056], to determine when an underlying transport provides a sufficient degree of confidentiality. Channel bindings for the TLS channel type are defined in [RFC5929].
When peers negotiate a TLS session that is to transport RPC, the following restrictions apply:
Client implementations MUST include the "application_layer_protocol_negotiation(16)" extension [RFC7301] in their "ClientHello" message and MUST include the protocol identifier defined in Section 8.2 in that message's ProtocolNameList value.
Similary, in response to the "ClientHello" message, server implementations MUST include the "application_layer_protocol_negotiation(16)" extension [RFC7301] in their "ServerHello" message and MUST include only the protocol identifier defined in Section 8.2 in that message's ProtocolNameList value.
If the server responds incorrectly, the client MUST NOT establish a TLS session for use with RPC on this connection. See [RFC7301] for further details about how to form these messages properly.
There is traditionally a strong association between an RPC program and a destination port number. The use of TLS or DTLS does not change that association. Thus it is frequently -- though not always -- the case that a single TLS session carries traffic for only one RPC program.
The use of the Transport Layer Security (TLS) protocol [RFC8446] protects RPC on TCP connections. Typically, once an RPC client completes the TCP handshake, it uses the mechanism described in Section 4.1 to discover RPC-on-TLS support for that connection. If spurious traffic appears on a TCP connection between the initial clear-text AUTH_TLS probe and the TLS session handshake, receivers MUST discard that data without response and then SHOULD drop the connection.
The protocol convention specified in the current document assumes there can be no more than one concurrent TLS session per TCP connection. This is true of current generations of TLS, but might be different in a future version of TLS.
Once a TLS session is established on a TCP connection, no further clear-text communication can occur on that connection until the session is terminated. The use of TLS does not alter RPC record framing used on TCP transports.
Furthermore, if an RPC server responds with PROG_UNAVAIL to an RPC Call within an established TLS session, that does not imply that RPC server will subsequently reject the same RPC program on a different TCP connection.
Backchannel operation occurs only on connected transports such as TCP. To protect backchannel operations, an RPC server uses the existing TLS session on that connection to send backchannel operations. The server does not attempt to establish a TLS session on a TCP connection for backchannel operation.
When operation is complete, an RPC peer terminates a TLS session by sending a TLS Closure Alert and may then close the TCP connection.
RFC Editor: In the following section, please replace TBD with the connection_id extension number that is to be assigned in [I-D.ietf-tls-dtls-connection-id]. And, please remove this Editor's Note before this document is published.
RPC over UDP is protected using the Datagram Transport Layer Security (DTLS) protocol [I-D.ietf-tls-dtls13].
Using DTLS does not introduce reliable or in-order semantics to RPC on UDP. Each RPC message MUST fit in a single DTLS record. DTLS encapsulation has overhead, which reduces the effective Path MTU (PMTU) and thus the maximum RPC payload size. The use of DTLS record replay protection is REQUIRED when transporting RPC traffic.
As soon as a client initializes a UDP socket for use with an RPC server, it uses the mechanism described in Section 4.1 to discover DTLS support for an RPC program on a particular port. It then negotiates a DTLS session.
Multi-homed RPC clients and servers may send protected RPC messages via network interfaces that were not involved in the handshake that established the DTLS session. Therefore, when protecting RPC traffic, each DTLS handshake MUST include the "connection_id(TBD)" extension described in Section 9 of [I-D.ietf-tls-dtls13], and RPC-on-DTLS peer endpoints MUST provide a ConnectionID with a non-zero length. Endpoints implementing RPC programs that expect a significant number of concurrent clients should employ ConnectionIDs of at least 4 bytes in length.
Sending a TLS Closure Alert terminates a DTLS session. Subsequent RPC messages exchanged between the RPC client and server are no longer protected until a new DTLS session is established.
Transports that provide intrinsic TLS-level security (e.g., QUIC) need to be addressed separately from the current document. In such cases, the use of TLS is not opportunistic as it can be for TCP or UDP.
RPC-over-RDMA can make use of transport layer security below the RDMA transport layer [RFC8166]. The exact mechanism is not within the scope of the current document. Because there might not be other provisions to exchange client and server certificates, authentication material exchange needs to be provided by facilities within a future version of the RPC-over-RDMA transport protocol.
TLS can perform peer authentication using any of the following mechanisms:
Implementations are REQUIRED to support this mechanism. In this mode, the tuple (serial number of the presented certificate; Issuer) uniquely identifies the RPC peer.
Authenticating a connecting entity does not mean the RPC server necessarily wants to communicate with that client. For example, if the Issuer is not in a trusted set of Issuers, the RPC server may decline to perform RPC transactions with this client. Implementations that want to support a wide variety of trust models should expose as many details of the presented certificate to the administrator as possible so that the administrator can implement the trust model. As a suggestion, at least the following parameters of the X.509 client certificate SHOULD be exposed:
This mechanism is OPTIONAL to implement. In this mode, the fingerprint of the presented certificate uniquely identifies the RPC peer.
Implementations SHOULD allow the configuration of a list of trusted certificates, identified via fingerprint of the DER-encoded certificate octets. Implementations MUST support SHA-256 [FIPS.180-4] or stronger as the hash algorithm for the fingerprint.
This mechanism is OPTIONAL to implement. In this mode, the RPC peer is uniquely identified by keying material that has been shared out-of-band or by a previous TLS-protected connection (see Section 2.2 of [RFC8446]). At least the following parameters of the TLS connection SHOULD be exposed:
This mechanism is OPTIONAL to implement. In this mode, a token uniquely identifies the RPC peer.
Versions of TLS after TLS 1.2 contain a token binding mechanism that is more secure than using certificates. This mechanism is detailed in [RFC8471].
RFC Editor: Please remove this section and the reference to RFC 7942 before this document is published.
This section records the status of known implementations of the protocol defined by this specification at the time of posting of this Internet-Draft, and is based on a proposal described in [RFC7942]. The description of implementations in this section is intended to assist the IETF in its decision processes in progressing drafts to RFCs.
Please note that the listing of any individual implementation here does not imply endorsement by the IETF. Furthermore, no effort has been spent to verify the information presented here that was supplied by IETF contributors. This is not intended as, and must not be construed to be, a catalog of available implementations or their features. Readers are advised to note that other implementations may exist.
One purpose of the mechanism described in the current document is to protect RPC-based applications against threats to the confidentiality of RPC transactions and RPC user identities. A taxonomy of these threats appears in Section 5 of [RFC6973]. Also, Section 6 of [RFC7525] contains a detailed discussion of technologies used in conjunction with TLS. Implementers should familiarize themselves with these materials.
The purpose of using an explicitly opportunistic approach is to enable interoperation with implementations that do not support RPC-over-TLS. A range of options is allowed by this approach, from "no peer authentication or encryption" to "server-only authentication with encryption" to "mutual authentication with encryption". The actual security level may indeed be selected based on policy and without user intervention.
In environments where interoperability is a priority, the security benefits of TLS are partially or entirely waived. Implementations of the mechanism described in the current document must take care to accurately represent to all RPC consumers the level of security that is actually in effect, and are REQUIRED to provide an audit log of RPC-over-TLS security mode selection.
In all other cases, the adoption, implementation, and deployment of RPC-based upper-layer protocols that enforce the use of TLS authentication and encryption (when similar RPCSEC GSS services are not in use) is strongly encouraged.
A classic form of attack on network protocols that initiate an association in plain-text to discover support for TLS is a man-in-the-middle that alters the plain-text handshake to make it appear as though TLS support is not available on one or both peers. Clients implementers can choose from the following to mitigate STRIPTLS attacks:
As mentioned earlier, communication between an RPC client and server appears in the clear on the network prior to the establishment of a TLS session. This clear-text information usually includes transport connection handshake exchanges, the RPC NULL procedure probing support for TLS, and the initial parts of TLS session establishment. Appendix C of [RFC8446] discusses precautions that can mitigate exposure during the exchange of connnection handshake information and TLS certificate material that might enable attackers to track the RPC client.
Any RPC traffic that appears on the network before a TLS session has been established is vulnerable to monitoring or undetected modification. A secure client implementation limits or prevents any RPC exchanges that are not protected.
The exception to this edict is the initial RPC NULL procedure that acts as a STARTTLS message, which cannot be protected. This RPC NULL procedure contains no arguments or results, and the AUTH_TLS authentication flavor it uses does not contain user information.
The goal of the RPC-on-TLS protocol extension is to hide the content of RPC requests while they are in transit. The RPC-on-TLS protocol by itself cannot protect against exposure of a user's RPC requests to other users on the same client.
Moreover, client implementations are free to transmit RPC requests for more than one RPC user using the same TLS session. Depending on the details of the client RPC implementation, this means that the client's TLS identity material is potentially visible to every RPC user that shares a TLS session. Privileged users may also be able to access this TLS identity.
As a result, client implementations need to carefully segregate TLS identity material so that local access to it is restricted to only the local users that are authorized to perform operations on the remote RPC server.
Using a TLS-protected transport when the AUTH_SYS authentication flavor is in use addresses several longstanding weaknesses (as detailed in Appendix A). TLS augments AUTH_SYS by providing both integrity protection and confidentiality that AUTH_SYS lacks. TLS protects data payloads, RPC headers, and user identities against monitoring and alteration while in transit. TLS guards against the insertion or deletion of messages, thus also ensuring the integrity of the message stream between RPC client and server. Lastly, transport layer encryption plus peer authentication protects receiving XDR decoders from deserializing untrusted data, a common coding vulnerability.
The use of TLS enables strong authentication of the communicating RPC peers, providing a degree of non-repudiation. When AUTH_SYS is used with TLS, but the RPC client is unauthenticated, the RPC server still acts on RPC requests for which there is no trustworthy authentication. In-transit traffic is protected, but the RPC client itself can still misrepresent user identity without server detection. TLS without authentication is an improvement from AUTH_SYS without encryption, but it leaves a critical security exposure.
In light of the above, it is RECOMMENDED that when AUTH_SYS is used, every RPC client should present host authentication material to RPC servers to prove that the client is a known one. The server can then determine whether the UIDs and GIDs in AUTH_SYS requests from that client can be accepted.
The use of TLS does not enable RPC clients to detect compromise that leads to the impersonation of RPC users. Also, there continues to be a requirement that the mapping of 32-bit user and group ID values to user identities is the same on both the RPC client and server.
RPC-over-TLS implementations and deployments are strongly encouraged to adhere to the following policies to achieve the strongest possible security with RPC-over-TLS.
RFC Editor: In the following subsections, please replace RFC-TBD with the RFC number assigned to this document. And, please remove this Editor's Note before this document is published.
Following Appendix B of [RFC5531], the authors request a single new entry in the RPC Authentication Flavor Numbers registry. The purpose of the new authentication flavor is to signal the use of TLS with RPC. This new flavor is not a pseudo-flavor.
The fields in the new entry are assigned as follows:
Following Section 6 of [RFC7301], the authors request the allocation of the following value in the "Application-Layer Protocol Negotiation (ALPN) Protocol IDs" registry. The "sunrpc" string identifies SunRPC when used over TLS.
The ONC RPC protocol, as specified in [RFC5531], provides several modes of security, traditionally referred to as "authentication flavors". Some of these flavors provide much more than an authentication service. We refer to these as authentication flavors, security flavors, or simply, flavors. One of the earliest and most basic flavors is AUTH_SYS, also known as AUTH_UNIX. Appendix A of [RFC5531] specifies AUTH_SYS.
AUTH_SYS assumes that the RPC client and server both use POSIX-style user and group identifiers (each user and group can be distinctly represented as a 32-bit unsigned integer). It also assumes that the client and server both use the same mapping of user and group to an integer. One user ID, one primary group ID, and up to 16 supplemental group IDs are associated with each RPC request. The combination of these identifies the entity on the client that is making the request.
A string identifies peers (hosts) in each RPC request. [RFC5531] does not specify any requirements for this string other than that is no longer than 255 octets. It does not have to be the same from request to request. Also, it does not have to match the DNS hostname of the sending host. For these reasons, even though most implementations fill in their hostname in this field, receivers typically ignore its content.
Appendix A of [RFC5531] contains a brief explanation of security considerations:
It should be clear, therefore, that AUTH_SYS by itself (i.e., without strong client authentication) offers little to no communication security:
Special mention goes to Charles Fisher, author of "Encrypting NFSv4 with Stunnel TLS" . His article inspired the mechanism described in the current document.
Many thanks to Tigran Mkrtchyan and Rick Macklem for their work on prototype implementations and feedback on the current document.
Thanks to Derrell Piper for numerous suggestions that improved both this simple mechanism and the current document's security-related discussion.
Many thanks to Transport Area Director Magnus Westerlund for his sharp questions and careful reading of the final revisions of the current document. The text of Section 5.1.2 is mostly his contribution.
The authors are additionally grateful to Bill Baker, David Black, Alan DeKok, Lars Eggert, Benjamin Kaduk, Olga Kornievskaia, Greg Marsden, Alex McDonald, Justin Mazzola Paluska, Tom Talpey, and Martin Thomson for their input and support of this work.
Finally, special thanks to NFSV4 Working Group Chair and document shepherd David Noveck, NFSV4 Working Group Chairs Spencer Shepler and Brian Pawlowski, and NFSV4 Working Group Secretary Thomas Haynes for their guidance and oversight.