← 返回首页
Internet Engineering Task Force (IETF) T. Reddy Request for Comments: 7635 P. Patil Category: Standards Track R. Ravindranath ISSN: 2070-1721 Cisco J. Uberti Google August 2015 Session Traversal Utilities for NAT (STUN) Extension for Third-Party Authorization Abstract This document proposes the use of OAuth 2.0 to obtain and validate ephemeral tokens that can be used for Session Traversal Utilities for NAT (STUN) authentication. The usage of ephemeral tokens ensures that access to a STUN server can be controlled even if the tokens are compromised. Status of This Memo This is an Internet Standards Track document. This document is a product of the Internet Engineering Task Force (IETF). It represents the consensus of the IETF community. It has received public review and has been approved for publication by the Internet Engineering Steering Group (IESG). Further information on Internet Standards is available in Section 2 of RFC 5741. Information about the current status of this document, any errata, and how to provide feedback on it may be obtained at http://www.rfc-editor.org/info/rfc7635. Copyright Notice Copyright (c) 2015 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 (http://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. Reddy, et al. Standards Track [Page 1] RFC 7635 STUN for Third-Party Authorization August 2015 Table of Contents 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 2 2. Terminology . . . . . . . . . . . . . . . . . . . . . . . . . 3 3. Solution Overview . . . . . . . . . . . . . . . . . . . . . . 3 3.1. Usage with TURN . . . . . . . . . . . . . . . . . . . . . 4 4. Obtaining a Token Using OAuth . . . . . . . . . . . . . . . . 7 4.1. Key Establishment . . . . . . . . . . . . . . . . . . . . 8 4.1.1. HTTP Interactions . . . . . . . . . . . . . . . . . . 8 4.1.2. Manual Provisioning . . . . . . . . . . . . . . . . . 10 5. Forming a Request . . . . . . . . . . . . . . . . . . . . . . 10 6. STUN Attributes . . . . . . . . . . . . . . . . . . . . . . . 10 6.1. THIRD-PARTY-AUTHORIZATION . . . . . . . . . . . . . . . . 10 6.2. ACCESS-TOKEN . . . . . . . . . . . . . . . . . . . . . . 11 7. STUN Server Behavior . . . . . . . . . . . . . . . . . . . . 13 8. STUN Client Behavior . . . . . . . . . . . . . . . . . . . . 14 9. TURN Client and Server Behavior . . . . . . . . . . . . . . . 14 10. Operational Considerations . . . . . . . . . . . . . . . . . 15 11. Security Considerations . . . . . . . . . . . . . . . . . . . 15 12. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 16 12.1. Well-Known 'stun-key' URI . . . . . . . . . . . . . . . 16 13. References . . . . . . . . . . . . . . . . . . . . . . . . . 16 13.1. Normative References . . . . . . . . . . . . . . . . . . 16 13.2. Informative References . . . . . . . . . . . . . . . . . 17 Appendix A. Sample Tickets . . . . . . . . . . . . . . . . . . . 20 Appendix B. Interaction between the Client and Authorization Server . . . . . . . . . . . . . . . . . . . . . . . 22 Acknowledgements . . . . . . . . . . . . . . . . . . . . . . . . 24 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 24 1. Introduction Session Traversal Utilities for NAT (STUN) [RFC5389] provides a mechanism to control access via 'long-term' username/password credentials that are provided as part of the STUN protocol. It is expected that these credentials will be kept secret; if the credentials are discovered, the STUN server could be used by unauthorized users or applications. However, in web applications like WebRTC [WEBRTC] where JavaScript uses the browser functionality for making real-time audio and/or video calls, web conferencing, and direct data transfer, ensuring this secrecy is typically not possible. To address this problem and the ones described in [RFC7376], this document proposes the use of third-party authorization using OAuth 2.0 [RFC6749] for STUN. Using OAuth 2.0, a client obtains an ephemeral token from an authorization server, e.g., a WebRTC server, and the token is presented to the STUN server instead of the Reddy, et al. Standards Track [Page 2] RFC 7635 STUN for Third-Party Authorization August 2015 traditional mechanism of presenting username/password credentials. The STUN server validates the authenticity of the token and provides required services. Third-party authorization using OAuth 2.0 for STUN explained in this specification can also be used with Traversal Using Relays around NAT (TURN) [RFC5766]. 2. Terminology The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in [RFC2119]. This document uses the following abbreviations: o WebRTC Server: A web server that supports WebRTC [WEBRTC]. o Access Token: OAuth 2.0 access token. o mac_key: The session key generated by the authorization server. This session key has a lifetime that corresponds to the lifetime of the access token, is generated by the authorization server, and is bound to the access token. o kid: An ephemeral and unique key identifier. The kid also allows the resource server to select the appropriate keying material for decryption. o AS: Authorization server. o RS: Resource server. Some sections in this specification show the WebRTC server as the authorization server and the client as the WebRTC client; however, WebRTC is intended to be used for illustrative purpose only. 3. Solution Overview The STUN client knows that it can use OAuth 2.0 with the target STUN server either through configuration or when it receives the new STUN attribute THIRD-PARTY-AUTHORIZATION in the error response with an error code of 401 (Unauthorized). This specification uses the token type 'Assertion' (a.k.a. self- contained token) described in [RFC6819] where all the information necessary to authenticate the validity of the token is contained within the token itself. This approach has the benefit of avoiding a protocol between the STUN server and the authorization server for token validation, thus reducing latency. The content of the token is Reddy, et al. Standards Track [Page 3] RFC 7635 STUN for Third-Party Authorization August 2015 opaque to the client. The client embeds the token within a STUN request sent to the STUN server. Once the STUN server has determined the token is valid, its services are offered for a determined period of time. The access token issued by the authorization server is explained in Section 6.2. OAuth 2.0 in [RFC6749] defines four grant types. This specification uses the OAuth 2.0 grant type 'Implicit' as explained in Section 1.3.2 of [RFC6749] where the client is issued an access token directly. The string 'stun' is defined by this specification for use as the OAuth scope parameter (see Section 3.3 of [RFC6749]) for the OAuth token. The exact mechanism used by a client to obtain a token and other OAuth 2.0 parameters like token type, mac_key, token lifetime, and kid is outside the scope of this document. Appendix B provides an example deployment scenario of interaction between the client and authorization server to obtain a token and other OAuth 2.0 parameters. Section 3.1 illustrates the use of OAuth 2.0 to achieve third-party authorization for TURN. 3.1. Usage with TURN TURN, an extension to the STUN protocol, is often used to improve the connectivity of peer-to-peer (P2P) applications. TURN ensures that a connection can be established even when one or both sides are incapable of a direct P2P connection. However, as a relay service, it imposes a non-trivial cost on the service provider. Therefore, access to a TURN service is almost always access controlled. In order to achieve third-party authorization, a resource owner, e.g., a WebRTC server, authorizes a TURN client to access resources on the TURN server. In this example, a resource owner, i.e., a WebRTC server, authorizes a TURN client to access resources on a TURN server. Reddy, et al. Standards Track [Page 4] RFC 7635 STUN for Third-Party Authorization August 2015 +----------------------+----------------------------+ | OAuth 2.0 | WebRTC | +======================+============================+ | Client | WebRTC client | +----------------------+----------------------------+ | Resource owner | WebRTC server | +----------------------+----------------------------+ | Authorization server | Authorization server | +----------------------+----------------------------+ | Resource server | TURN server | +----------------------+----------------------------+ Figure 1: OAuth Terminology Mapped to WebRTC Terminology Using the OAuth 2.0 authorization framework, a WebRTC client (third- party application) obtains limited access to a TURN server (resource server) on behalf of the WebRTC server (resource owner or authorization server). The WebRTC client requests access to resources controlled by the resource owner (WebRTC server) and hosted by the resource server (TURN server). The WebRTC client obtains the access token, lifetime, session key, and kid. The TURN client conveys the access token and other OAuth 2.0 parameters learned from the authorization server to the TURN server. The TURN server obtains the session key from the access token. The TURN server validates the token, computes the message integrity of the request, and takes appropriate action, i.e, permits the TURN client to create allocations. This is shown in an abstract way in Figure 2. Reddy, et al. Standards Track [Page 5] RFC 7635 STUN for Third-Party Authorization August 2015 +---------------+ | +| Authorization | * | | server | * | +----------|(WebRTC server)| * AS-RS, | | | | * AUTH keys (1) | | +---------------+ * (0) Access | | (2) * Token | | Access Token * request | | + * | | Session Key * | | * | V V +-------+---+ +-+----=-----+ | | (3) | | | | TURN request + Access | | | WebRTC | Token | TURN | | client |---------------------->| server | | (Alice) | Allocate response (4) | | | || | | | | | | | Allocate error response | | | | (401 Unauthorized) | | | || | | HTTP response with token parameters | | || | | | | Allocate request ACCESS-TOKEN | | | |------------------------------------------>| | | | | | | | Allocate success response | | | |