idnits 2.17.1 draft-ietf-p2psip-base-21.txt: Checking boilerplate required by RFC 5378 and the IETF Trust (see https://trustee.ietf.org/license-info): ---------------------------------------------------------------------------- No issues found here. Checking nits according to https://www.ietf.org/id-info/1id-guidelines.txt: ---------------------------------------------------------------------------- No issues found here. Checking nits according to https://www.ietf.org/id-info/checklist : ---------------------------------------------------------------------------- -- The document has examples using IPv4 documentation addresses according to RFC6890, but does not use any IPv6 documentation addresses. Maybe there should be IPv6 examples, too? Miscellaneous warnings: ---------------------------------------------------------------------------- == The copyright year in the IETF Trust and authors Copyright Line does not match the current year == Line 1992 has weird spacing: '...Options optio...' == Line 2251 has weird spacing: '...ionType type;...' == Line 2481 has weird spacing: '...tyValue ide...' == Line 2811 has weird spacing: '...ionType typ...' == Line 2813 has weird spacing: '...ionData val...' == (3 more instances...) == Using lowercase 'not' together with uppercase 'MUST', 'SHALL', 'SHOULD', or 'RECOMMENDED' is not an accepted usage according to RFC 2119. Please use uppercase 'NOT' together with RFC 2119 keywords (if that is what you mean). Found 'MUST not' in this paragraph: All RELOAD messages MUST be signed. Upon receipt (and fragment reassembly if needed) the destination node MUST verify the signature and the authorizing certificate. If the signature fails, the implementation SHOULD simply drop the message and MUST not process it. This check provides a minimal level of assurance that the sending node is a valid part of the overlay as well as cryptographic authentication of the sending node. In addition, responses MUST be checked as follows by the requesting node: -- The document seems to contain a disclaimer for pre-RFC5378 work, and may have content which was first submitted before 10 November 2008. The disclaimer is necessary when there are original authors that you have been unable to contact, or if some do not wish to grant the BCP78 rights to the IETF Trust. If you are able to get all authors (current and original) to grant those rights, you can and should remove the disclaimer; otherwise, the disclaimer is needed and you can ignore this comment. (See the Legal Provisions document at https://trustee.ietf.org/license-info for more information.) -- The document date (March 28, 2012) is 4411 days in the past. Is this intentional? -- Found something which looks like a code comment -- if you have code sections in the document, please surround them with '' and '' lines. Checking references for intended status: Proposed Standard ---------------------------------------------------------------------------- (See RFCs 3967 and 4897 for information about using normative references to lower-maturity documents in RFCs) == Missing Reference: 'A' is mentioned on line 1185, but not defined == Missing Reference: 'B' is mentioned on line 1185, but not defined == Missing Reference: 'NodeIdLength' is mentioned on line 1887, but not defined -- Looks like a reference, but probably isn't: '0' on line 4874 == Missing Reference: 'RFC-AAAA' is mentioned on line 6632, but not defined ** Obsolete normative reference: RFC 2388 (Obsoleted by RFC 7578) ** Obsolete normative reference: RFC 2818 (Obsoleted by RFC 9110) ** Obsolete normative reference: RFC 3023 (Obsoleted by RFC 7303) ** Downref: Normative reference to an Informational RFC: RFC 3174 ** Obsolete normative reference: RFC 3447 (Obsoleted by RFC 8017) ** Obsolete normative reference: RFC 4347 (Obsoleted by RFC 6347) ** Obsolete normative reference: RFC 4395 (Obsoleted by RFC 7595) ** Obsolete normative reference: RFC 5245 (Obsoleted by RFC 8445, RFC 8839) ** Obsolete normative reference: RFC 5246 (Obsoleted by RFC 8446) ** Obsolete normative reference: RFC 5389 (Obsoleted by RFC 8489) ** Obsolete normative reference: RFC 5405 (Obsoleted by RFC 8085) ** Obsolete normative reference: RFC 5766 (Obsoleted by RFC 8656) ** Downref: Normative reference to an Informational RFC: RFC 6091 ** Downref: Normative reference to an Informational RFC: RFC 6234 == Outdated reference: A later version (-10) exists of draft-ietf-hip-reload-instance-04 == Outdated reference: A later version (-22) exists of draft-ietf-p2psip-diagnostics-08 == Outdated reference: A later version (-15) exists of draft-ietf-p2psip-self-tuning-05 == Outdated reference: A later version (-15) exists of draft-ietf-p2psip-service-discovery-04 == Outdated reference: A later version (-21) exists of draft-ietf-p2psip-sip-07 -- Obsolete informational reference (is this intentional?): RFC 5201 (Obsoleted by RFC 7401) -- Obsolete informational reference (is this intentional?): RFC 5785 (Obsoleted by RFC 8615) Summary: 14 errors (**), 0 flaws (~~), 17 warnings (==), 7 comments (--). Run idnits with the --verbose option for more detailed information about the items above. -------------------------------------------------------------------------------- 2 P2PSIP C. Jennings 3 Internet-Draft Cisco 4 Intended status: Standards Track B. Lowekamp, Ed. 5 Expires: September 29, 2012 Skype 6 E. Rescorla 7 RTFM, Inc. 8 S. Baset 9 H. Schulzrinne 10 Columbia University 11 March 28, 2012 13 REsource LOcation And Discovery (RELOAD) Base Protocol 14 draft-ietf-p2psip-base-21 16 Abstract 18 This specification defines REsource LOcation And Discovery (RELOAD), 19 a peer-to-peer (P2P) signaling protocol for use on the Internet. A 20 P2P signaling protocol provides its clients with an abstract storage 21 and messaging service between a set of cooperating peers that form 22 the overlay network. RELOAD is designed to support a P2P Session 23 Initiation Protocol (P2PSIP) network, but can be utilized by other 24 applications with similar requirements by defining new usages that 25 specify the kinds of data that must be stored for a particular 26 application. RELOAD defines a security model based on a certificate 27 enrollment service that provides unique identities. NAT traversal is 28 a fundamental service of the protocol. RELOAD also allows access 29 from "client" nodes that do not need to route traffic or store data 30 for others. 32 Status of this Memo 34 This Internet-Draft is submitted in full conformance with the 35 provisions of BCP 78 and BCP 79. 37 Internet-Drafts are working documents of the Internet Engineering 38 Task Force (IETF). Note that other groups may also distribute 39 working documents as Internet-Drafts. The list of current Internet- 40 Drafts is at http://datatracker.ietf.org/drafts/current/. 42 Internet-Drafts are draft documents valid for a maximum of six months 43 and may be updated, replaced, or obsoleted by other documents at any 44 time. It is inappropriate to use Internet-Drafts as reference 45 material or to cite them other than as "work in progress." 47 This Internet-Draft will expire on September 29, 2012. 49 Copyright Notice 51 Copyright (c) 2012 IETF Trust and the persons identified as the 52 document authors. All rights reserved. 54 This document is subject to BCP 78 and the IETF Trust's Legal 55 Provisions Relating to IETF Documents 56 (http://trustee.ietf.org/license-info) in effect on the date of 57 publication of this document. Please review these documents 58 carefully, as they describe your rights and restrictions with respect 59 to this document. Code Components extracted from this document must 60 include Simplified BSD License text as described in Section 4.e of 61 the Trust Legal Provisions and are provided without warranty as 62 described in the Simplified BSD License. 64 This document may contain material from IETF Documents or IETF 65 Contributions published or made publicly available before November 66 10, 2008. The person(s) controlling the copyright in some of this 67 material may not have granted the IETF Trust the right to allow 68 modifications of such material outside the IETF Standards Process. 69 Without obtaining an adequate license from the person(s) controlling 70 the copyright in such materials, this document may not be modified 71 outside the IETF Standards Process, and derivative works of it may 72 not be created outside the IETF Standards Process, except to format 73 it for publication as an RFC or to translate it into languages other 74 than English. 76 Table of Contents 78 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 8 79 1.1. Basic Setting . . . . . . . . . . . . . . . . . . . . . 9 80 1.2. Architecture . . . . . . . . . . . . . . . . . . . . . . 10 81 1.2.1. Usage Layer . . . . . . . . . . . . . . . . . . . . 13 82 1.2.2. Message Transport . . . . . . . . . . . . . . . . . 14 83 1.2.3. Storage . . . . . . . . . . . . . . . . . . . . . . 15 84 1.2.4. Topology Plugin . . . . . . . . . . . . . . . . . . 15 85 1.2.5. Forwarding and Link Management Layer . . . . . . . . 16 86 1.3. Security . . . . . . . . . . . . . . . . . . . . . . . . 17 87 1.4. Structure of This Document . . . . . . . . . . . . . . . 18 88 2. Terminology . . . . . . . . . . . . . . . . . . . . . . . . . 18 89 3. Overlay Management Overview . . . . . . . . . . . . . . . . . 21 90 3.1. Security and Identification . . . . . . . . . . . . . . 21 91 3.1.1. Shared-Key Security . . . . . . . . . . . . . . . . 23 92 3.2. Clients . . . . . . . . . . . . . . . . . . . . . . . . 23 93 3.2.1. Client Routing . . . . . . . . . . . . . . . . . . . 24 94 3.2.2. Minimum Functionality Requirements for Clients . . . 24 95 3.3. Routing . . . . . . . . . . . . . . . . . . . . . . . . 25 96 3.4. Connectivity Management . . . . . . . . . . . . . . . . 28 97 3.5. Overlay Algorithm Support . . . . . . . . . . . . . . . 28 98 3.5.1. Support for Pluggable Overlay Algorithms . . . . . . 29 99 3.5.2. Joining, Leaving, and Maintenance Overview . . . . . 29 100 3.6. First-Time Setup . . . . . . . . . . . . . . . . . . . . 30 101 3.6.1. Initial Configuration . . . . . . . . . . . . . . . 31 102 3.6.2. Enrollment . . . . . . . . . . . . . . . . . . . . . 31 103 3.6.3. Diagnostics . . . . . . . . . . . . . . . . . . . . 31 104 4. RFC 2119 Terminology . . . . . . . . . . . . . . . . . . . . 31 105 5. Application Support Overview . . . . . . . . . . . . . . . . 31 106 5.1. Data Storage . . . . . . . . . . . . . . . . . . . . . . 32 107 5.1.1. Storage Permissions . . . . . . . . . . . . . . . . 33 108 5.1.2. Replication . . . . . . . . . . . . . . . . . . . . 34 109 5.2. Usages . . . . . . . . . . . . . . . . . . . . . . . . . 34 110 5.3. Service Discovery . . . . . . . . . . . . . . . . . . . 35 111 5.4. Application Connectivity . . . . . . . . . . . . . . . . 35 112 6. Overlay Management Protocol . . . . . . . . . . . . . . . . . 35 113 6.1. Message Receipt and Forwarding . . . . . . . . . . . . . 36 114 6.1.1. Responsible ID . . . . . . . . . . . . . . . . . . . 36 115 6.1.2. Other ID . . . . . . . . . . . . . . . . . . . . . . 37 116 6.1.3. Opaque ID . . . . . . . . . . . . . . . . . . . . . 39 117 6.2. Symmetric Recursive Routing . . . . . . . . . . . . . . 39 118 6.2.1. Request Origination . . . . . . . . . . . . . . . . 39 119 6.2.2. Response Origination . . . . . . . . . . . . . . . . 40 120 6.3. Message Structure . . . . . . . . . . . . . . . . . . . 40 121 6.3.1. Presentation Language . . . . . . . . . . . . . . . 41 122 6.3.1.1. Common Definitions . . . . . . . . . . . . . . . 42 123 6.3.2. Forwarding Header . . . . . . . . . . . . . . . . . 44 124 6.3.2.1. Processing Configuration Sequence Numbers . . . . 46 125 6.3.2.2. Destination and Via Lists . . . . . . . . . . . . 47 126 6.3.2.3. Forwarding Options . . . . . . . . . . . . . . . 49 127 6.3.3. Message Contents Format . . . . . . . . . . . . . . 50 128 6.3.3.1. Response Codes and Response Errors . . . . . . . 51 129 6.3.4. Security Block . . . . . . . . . . . . . . . . . . . 53 130 6.4. Overlay Topology . . . . . . . . . . . . . . . . . . . . 57 131 6.4.1. Topology Plugin Requirements . . . . . . . . . . . . 57 132 6.4.2. Methods and types for use by topology plugins . . . 58 133 6.4.2.1. Join . . . . . . . . . . . . . . . . . . . . . . 58 134 6.4.2.2. Leave . . . . . . . . . . . . . . . . . . . . . . 59 135 6.4.2.3. Update . . . . . . . . . . . . . . . . . . . . . 59 136 6.4.2.4. RouteQuery . . . . . . . . . . . . . . . . . . . 60 137 6.4.2.5. Probe . . . . . . . . . . . . . . . . . . . . . . 61 138 6.5. Forwarding and Link Management Layer . . . . . . . . . . 63 139 6.5.1. Attach . . . . . . . . . . . . . . . . . . . . . . . 63 140 6.5.1.1. Request Definition . . . . . . . . . . . . . . . 64 141 6.5.1.2. Response Definition . . . . . . . . . . . . . . . 67 142 6.5.1.3. Using ICE With RELOAD . . . . . . . . . . . . . . 68 143 6.5.1.4. Collecting STUN Servers . . . . . . . . . . . . . 68 144 6.5.1.5. Gathering Candidates . . . . . . . . . . . . . . 69 145 6.5.1.6. Prioritizing Candidates . . . . . . . . . . . . . 69 146 6.5.1.7. Encoding the Attach Message . . . . . . . . . . . 70 147 6.5.1.8. Verifying ICE Support . . . . . . . . . . . . . . 70 148 6.5.1.9. Role Determination . . . . . . . . . . . . . . . 71 149 6.5.1.10. Full ICE . . . . . . . . . . . . . . . . . . . . 71 150 6.5.1.11. No-ICE . . . . . . . . . . . . . . . . . . . . . 71 151 6.5.1.12. Subsequent Offers and Answers . . . . . . . . . . 72 152 6.5.1.13. Sending Media . . . . . . . . . . . . . . . . . . 72 153 6.5.1.14. Receiving Media . . . . . . . . . . . . . . . . . 72 154 6.5.2. AppAttach . . . . . . . . . . . . . . . . . . . . . 72 155 6.5.2.1. Request Definition . . . . . . . . . . . . . . . 72 156 6.5.2.2. Response Definition . . . . . . . . . . . . . . . 73 157 6.5.3. Ping . . . . . . . . . . . . . . . . . . . . . . . . 74 158 6.5.3.1. Request Definition . . . . . . . . . . . . . . . 74 159 6.5.3.2. Response Definition . . . . . . . . . . . . . . . 74 160 6.5.4. ConfigUpdate . . . . . . . . . . . . . . . . . . . . 75 161 6.5.4.1. Request Definition . . . . . . . . . . . . . . . 75 162 6.5.4.2. Response Definition . . . . . . . . . . . . . . . 76 163 6.6. Overlay Link Layer . . . . . . . . . . . . . . . . . . . 76 164 6.6.1. Future Overlay Link Protocols . . . . . . . . . . . 78 165 6.6.1.1. HIP . . . . . . . . . . . . . . . . . . . . . . . 78 166 6.6.1.2. ICE-TCP . . . . . . . . . . . . . . . . . . . . . 79 167 6.6.1.3. Message-oriented Transports . . . . . . . . . . . 79 168 6.6.1.4. Tunneled Transports . . . . . . . . . . . . . . . 79 169 6.6.2. Framing Header . . . . . . . . . . . . . . . . . . . 79 170 6.6.3. Simple Reliability . . . . . . . . . . . . . . . . . 81 171 6.6.3.1. Stop and Wait Sender Algorithm . . . . . . . . . 82 173 6.6.4. DTLS/UDP with SR . . . . . . . . . . . . . . . . . . 83 174 6.6.5. TLS/TCP with FH, No-ICE . . . . . . . . . . . . . . 83 175 6.6.6. DTLS/UDP with SR, No-ICE . . . . . . . . . . . . . . 83 176 6.7. Fragmentation and Reassembly . . . . . . . . . . . . . . 84 177 7. Data Storage Protocol . . . . . . . . . . . . . . . . . . . . 85 178 7.1. Data Signature Computation . . . . . . . . . . . . . . . 86 179 7.2. Data Models . . . . . . . . . . . . . . . . . . . . . . 87 180 7.2.1. Single Value . . . . . . . . . . . . . . . . . . . . 88 181 7.2.2. Array . . . . . . . . . . . . . . . . . . . . . . . 88 182 7.2.3. Dictionary . . . . . . . . . . . . . . . . . . . . . 89 183 7.3. Access Control Policies . . . . . . . . . . . . . . . . 89 184 7.3.1. USER-MATCH . . . . . . . . . . . . . . . . . . . . . 90 185 7.3.2. NODE-MATCH . . . . . . . . . . . . . . . . . . . . . 90 186 7.3.3. USER-NODE-MATCH . . . . . . . . . . . . . . . . . . 90 187 7.3.4. NODE-MULTIPLE . . . . . . . . . . . . . . . . . . . 90 188 7.4. Data Storage Methods . . . . . . . . . . . . . . . . . . 91 189 7.4.1. Store . . . . . . . . . . . . . . . . . . . . . . . 91 190 7.4.1.1. Request Definition . . . . . . . . . . . . . . . 91 191 7.4.1.2. Response Definition . . . . . . . . . . . . . . . 95 192 7.4.1.3. Removing Values . . . . . . . . . . . . . . . . . 97 193 7.4.2. Fetch . . . . . . . . . . . . . . . . . . . . . . . 97 194 7.4.2.1. Request Definition . . . . . . . . . . . . . . . 98 195 7.4.2.2. Response Definition . . . . . . . . . . . . . . . 100 196 7.4.3. Stat . . . . . . . . . . . . . . . . . . . . . . . . 101 197 7.4.3.1. Request Definition . . . . . . . . . . . . . . . 101 198 7.4.3.2. Response Definition . . . . . . . . . . . . . . . 101 199 7.4.4. Find . . . . . . . . . . . . . . . . . . . . . . . . 103 200 7.4.4.1. Request Definition . . . . . . . . . . . . . . . 103 201 7.4.4.2. Response Definition . . . . . . . . . . . . . . . 104 202 7.4.5. Defining New Kinds . . . . . . . . . . . . . . . . . 105 203 8. Certificate Store Usage . . . . . . . . . . . . . . . . . . . 105 204 9. TURN Server Usage . . . . . . . . . . . . . . . . . . . . . . 106 205 10. Chord Algorithm . . . . . . . . . . . . . . . . . . . . . . . 108 206 10.1. Overview . . . . . . . . . . . . . . . . . . . . . . . . 109 207 10.2. Hash Function . . . . . . . . . . . . . . . . . . . . . 109 208 10.3. Routing . . . . . . . . . . . . . . . . . . . . . . . . 109 209 10.4. Redundancy . . . . . . . . . . . . . . . . . . . . . . . 110 210 10.5. Joining . . . . . . . . . . . . . . . . . . . . . . . . 110 211 10.6. Routing Attaches . . . . . . . . . . . . . . . . . . . . 111 212 10.7. Updates . . . . . . . . . . . . . . . . . . . . . . . . 111 213 10.7.1. Handling Neighbor Failures . . . . . . . . . . . . . 113 214 10.7.2. Handling Finger Table Entry Failure . . . . . . . . 114 215 10.7.3. Receiving Updates . . . . . . . . . . . . . . . . . 114 216 10.7.4. Stabilization . . . . . . . . . . . . . . . . . . . 115 217 10.7.4.1. Updating neighbor table . . . . . . . . . . . . . 115 218 10.7.4.2. Refreshing finger table . . . . . . . . . . . . . 115 219 10.7.4.3. Adjusting finger table size . . . . . . . . . . . 116 220 10.7.4.4. Detecting partitioning . . . . . . . . . . . . . 117 222 10.8. Route query . . . . . . . . . . . . . . . . . . . . . . 117 223 10.9. Leaving . . . . . . . . . . . . . . . . . . . . . . . . 118 224 11. Enrollment and Bootstrap . . . . . . . . . . . . . . . . . . 119 225 11.1. Overlay Configuration . . . . . . . . . . . . . . . . . 119 226 11.1.1. Relax NG Grammar . . . . . . . . . . . . . . . . . . 125 227 11.2. Discovery Through Configuration Server . . . . . . . . . 128 228 11.3. Credentials . . . . . . . . . . . . . . . . . . . . . . 128 229 11.3.1. Self-Generated Credentials . . . . . . . . . . . . . 130 230 11.4. Searching for a Bootstrap Node . . . . . . . . . . . . . 130 231 11.5. Contacting a Bootstrap Node . . . . . . . . . . . . . . 130 232 12. Message Flow Example . . . . . . . . . . . . . . . . . . . . 131 233 13. Security Considerations . . . . . . . . . . . . . . . . . . . 137 234 13.1. Overview . . . . . . . . . . . . . . . . . . . . . . . . 137 235 13.2. Attacks on P2P Overlays . . . . . . . . . . . . . . . . 138 236 13.3. Certificate-based Security . . . . . . . . . . . . . . . 138 237 13.4. Shared-Secret Security . . . . . . . . . . . . . . . . . 139 238 13.5. Storage Security . . . . . . . . . . . . . . . . . . . . 140 239 13.5.1. Authorization . . . . . . . . . . . . . . . . . . . 140 240 13.5.2. Distributed Quota . . . . . . . . . . . . . . . . . 141 241 13.5.3. Correctness . . . . . . . . . . . . . . . . . . . . 141 242 13.5.4. Residual Attacks . . . . . . . . . . . . . . . . . . 141 243 13.6. Routing Security . . . . . . . . . . . . . . . . . . . . 142 244 13.6.1. Background . . . . . . . . . . . . . . . . . . . . . 142 245 13.6.2. Admissions Control . . . . . . . . . . . . . . . . . 143 246 13.6.3. Peer Identification and Authentication . . . . . . . 143 247 13.6.4. Protecting the Signaling . . . . . . . . . . . . . . 144 248 13.6.5. Routing Loops and Dos Attacks . . . . . . . . . . . 144 249 13.6.6. Residual Attacks . . . . . . . . . . . . . . . . . . 144 250 14. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 145 251 14.1. Well-Known URI Registration . . . . . . . . . . . . . . 145 252 14.2. Port Registrations . . . . . . . . . . . . . . . . . . . 145 253 14.3. Overlay Algorithm Types . . . . . . . . . . . . . . . . 146 254 14.4. Access Control Policies . . . . . . . . . . . . . . . . 146 255 14.5. Application-ID . . . . . . . . . . . . . . . . . . . . . 147 256 14.6. Data Kind-ID . . . . . . . . . . . . . . . . . . . . . . 147 257 14.7. Data Model . . . . . . . . . . . . . . . . . . . . . . . 148 258 14.8. Message Codes . . . . . . . . . . . . . . . . . . . . . 148 259 14.9. Error Codes . . . . . . . . . . . . . . . . . . . . . . 150 260 14.10. Overlay Link Types . . . . . . . . . . . . . . . . . . . 150 261 14.11. Overlay Link Protocols . . . . . . . . . . . . . . . . . 151 262 14.12. Forwarding Options . . . . . . . . . . . . . . . . . . . 151 263 14.13. Probe Information Types . . . . . . . . . . . . . . . . 152 264 14.14. Message Extensions . . . . . . . . . . . . . . . . . . . 152 265 14.15. reload URI Scheme . . . . . . . . . . . . . . . . . . . 152 266 14.15.1. URI Registration . . . . . . . . . . . . . . . . . . 153 267 14.16. Media Type Registration . . . . . . . . . . . . . . . . 154 268 14.17. XML Name Space Registration . . . . . . . . . . . . . . 155 269 14.17.1. Config URL . . . . . . . . . . . . . . . . . . . . . 155 270 14.17.2. Config Chord URL . . . . . . . . . . . . . . . . . . 155 271 15. Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . 155 272 16. References . . . . . . . . . . . . . . . . . . . . . . . . . 156 273 16.1. Normative References . . . . . . . . . . . . . . . . . . 156 274 16.2. Informative References . . . . . . . . . . . . . . . . . 158 275 Appendix A. Routing Alternatives . . . . . . . . . . . . . . . . 161 276 A.1. Iterative vs Recursive . . . . . . . . . . . . . . . . . 161 277 A.2. Symmetric vs Forward response . . . . . . . . . . . . . 162 278 A.3. Direct Response . . . . . . . . . . . . . . . . . . . . 162 279 A.4. Relay Peers . . . . . . . . . . . . . . . . . . . . . . 163 280 A.5. Symmetric Route Stability . . . . . . . . . . . . . . . 164 281 Appendix B. Why Clients? . . . . . . . . . . . . . . . . . . . . 164 282 B.1. Why Not Only Peers? . . . . . . . . . . . . . . . . . . 164 283 B.2. Clients as Application-Level Agents . . . . . . . . . . 165 284 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 165 286 1. Introduction 288 This document defines REsource LOcation And Discovery (RELOAD), a 289 peer-to-peer (P2P) signaling protocol for use on the Internet. It 290 provides a generic, self-organizing overlay network service, allowing 291 nodes to efficiently route messages to other nodes and to efficiently 292 store and retrieve data in the overlay. RELOAD provides several 293 features that are critical for a successful P2P protocol for the 294 Internet: 296 Security Framework: A P2P network will often be established among a 297 set of peers that do not trust each other. RELOAD leverages a 298 central enrollment server to provide credentials for each peer 299 which can then be used to authenticate each operation. This 300 greatly reduces the possible attack surface. 302 Usage Model: RELOAD is designed to support a variety of 303 applications, including P2P multimedia communications with the 304 Session Initiation Protocol [I-D.ietf-p2psip-sip]. RELOAD allows 305 the definition of new application usages, each of which can define 306 its own data types, along with the rules for their use. This 307 allows RELOAD to be used with new applications through a simple 308 documentation process that supplies the details for each 309 application. 311 NAT Traversal: RELOAD is designed to function in environments where 312 many if not most of the nodes are behind NATs or firewalls. 313 Operations for NAT traversal are part of the base design, 314 including using ICE to establish new RELOAD or application 315 protocol connections. 317 High Performance Routing: The very nature of overlay algorithms 318 introduces a requirement that peers participating in the P2P 319 network route requests on behalf of other peers in the network. 320 This introduces a load on those other peers, in the form of 321 bandwidth and processing power. RELOAD has been defined with a 322 simple, lightweight forwarding header, thus minimizing the amount 323 of effort required by intermediate peers. 325 Pluggable Overlay Algorithms: RELOAD has been designed with an 326 abstract interface to the overlay layer to simplify implementing a 327 variety of structured (e.g., distributed hash tables) and 328 unstructured overlay algorithms. The idea here is that RELOAD 329 provides a generic structure that should fit most types of overlay 330 topologies (ring, hyperspace, etc.). To instantiate an actual 331 network, you combine RELOAD with a specific overlay algorithm, 332 which defines how to construct the overlay topology and route 333 messages efficiently within it. This specification also defines 334 how RELOAD is used with the Chord based DHT algorithm, which is 335 mandatory to implement. Specifying a default "must implement" 336 overlay algorithm promotes interoperability, while extensibility 337 allows selection of overlay algorithms optimized for a particular 338 application. 340 These properties were designed specifically to meet the requirements 341 for a P2P protocol to support SIP. This document defines the base 342 protocol for the distributed storage and location service, as well as 343 critical usages for NAT traversal and security. The SIP Usage itself 344 is described separately in [I-D.ietf-p2psip-sip]. RELOAD is not 345 limited to usage by SIP and could serve as a tool for supporting 346 other P2P applications with similar needs. 348 1.1. Basic Setting 350 In this section, we provide a brief overview of the operational 351 setting for RELOAD. A RELOAD Overlay Instance consists of a set of 352 nodes arranged in a partly connected graph. Each node in the overlay 353 is assigned a numeric Node-ID which, together with the specific 354 overlay algorithm in use, determines its position in the graph and 355 the set of nodes it connects to. The figure below shows a trivial 356 example which isn't drawn from any particular overlay algorithm, but 357 was chosen for convenience of representation. 359 +--------+ +--------+ +--------+ 360 | Node 10|--------------| Node 20|--------------| Node 30| 361 +--------+ +--------+ +--------+ 362 | | | 363 | | | 364 +--------+ +--------+ +--------+ 365 | Node 40|--------------| Node 50|--------------| Node 60| 366 +--------+ +--------+ +--------+ 367 | | | 368 | | | 369 +--------+ +--------+ +--------+ 370 | Node 70|--------------| Node 80|--------------| Node 90| 371 +--------+ +--------+ +--------+ 372 | 373 | 374 +--------+ 375 | Node 85| 376 |(Client)| 377 +--------+ 379 Because the graph is not fully connected, when a node wants to send a 380 message to another node, it may need to route it through the network. 382 For instance, Node 10 can talk directly to nodes 20 and 40, but not 383 to Node 70. In order to send a message to Node 70, it would first 384 send it to Node 40 with instructions to pass it along to Node 70. 385 Different overlay algorithms will have different connectivity graphs, 386 but the general idea behind all of them is to allow any node in the 387 graph to efficiently reach every other node within a small number of 388 hops. 390 The RELOAD network is not only a messaging network. It is also a 391 storage network, albeit one designed for small-scale storage rather 392 than for bulk storage of large objects. Records are stored under 393 numeric addresses which occupy the same space as node identifiers. 394 Peers are responsible for storing the data associated with some set 395 of addresses as determined by their Node-ID. For instance, we might 396 say that every peer is responsible for storing any data value which 397 has an address less than or equal to its own Node-ID, but greater 398 than the next lowest Node-ID. Thus, Node-20 would be responsible for 399 storing values 11-20. 401 RELOAD also supports clients. These are nodes which have Node-IDs 402 but do not participate in routing or storage. For instance, in the 403 figure above Node 85 is a client. It can route to the rest of the 404 RELOAD network via Node 80, but no other node will route through it 405 and Node 90 is still responsible for all addresses between 81-90. We 406 refer to non-client nodes as peers. 408 Other applications (for instance, SIP) can be defined on top of 409 RELOAD and use these two basic RELOAD services to provide their own 410 services. 412 1.2. Architecture 414 RELOAD is fundamentally an overlay network. The following figure 415 shows the layered RELOAD architecture. 417 Application 419 +-------+ +-------+ 420 | SIP | | XMPP | ... 421 | Usage | | Usage | 422 +-------+ +-------+ 423 ------------------------------------ Messaging Service Boundary 424 +------------------+ +---------+ 425 | Message |<--->| Storage | 426 | Transport | +---------+ 427 +------------------+ ^ 428 ^ ^ | 429 | v v 430 | +-------------------+ 431 | | Topology | 432 | | Plugin | 433 | +-------------------+ 434 | ^ 435 v v 436 +------------------+ 437 | Forwarding & | 438 | Link Management | 439 +------------------+ 440 ------------------------------------ Overlay Link Service Boundary 441 +-------+ +------+ 442 |TLS | |DTLS | ... 443 +-------+ +------+ 445 The major components of RELOAD are: 447 Usage Layer: Each application defines a RELOAD usage; a set of data 448 Kinds and behaviors which describe how to use the services 449 provided by RELOAD. These usages all talk to RELOAD through a 450 common Message Transport Service. 452 Message Transport: Handles end-to-end reliability, manages request 453 state for the usages, and forwards Store and Fetch operations to 454 the Storage component. Delivers message responses to the 455 component initiating the request. 457 Storage: The Storage component is responsible for processing 458 messages relating to the storage and retrieval of data. It talks 459 directly to the Topology Plugin to manage data replication and 460 migration, and it talks to the Message Transport component to send 461 and receive messages. 463 Topology Plugin: The Topology Plugin is responsible for implementing 464 the specific overlay algorithm being used. It uses the Message 465 Transport component to send and receive overlay management 466 messages, to the Storage component to manage data replication, and 467 directly to the Forwarding Layer to control hop-by-hop message 468 forwarding. This component closely parallels conventional routing 469 algorithms, but is more tightly coupled to the Forwarding Layer 470 because there is no single "routing table" equivalent used by all 471 overlay algorithms. 473 Forwarding and Link Management Layer: Stores and implements the 474 routing table by providing packet forwarding services between 475 nodes. It also handles establishing new links between nodes, 476 including setting up connections across NATs using ICE. 478 Overlay Link Layer: Responsible for actually transporting traffic 479 directly between nodes. Each such protocol includes the 480 appropriate provisions for per-hop framing or hop-by-hop ACKs 481 required by unreliable transports. TLS [RFC5246] and DTLS 482 [RFC4347] are the currently defined "link layer" protocols used by 483 RELOAD for hop-by-hop communication. New protocols can be 484 defined, as described in Section 6.6.1 and Section 11.1. As this 485 document defines only TLS and DTLS, we use those terms throughout 486 the remainder of the document with the understanding that some 487 future specification may add new overlay link layers. 489 To further clarify the roles of the various layers, this figure 490 parallels the architecture with each layer's role from an overlay 491 perspective and implementation layer in the internet: 493 | Internet Model | 494 Real | Equivalent | Reload 495 Internet | in Overlay | Architecture 496 -------------+-----------------+------------------------------------ 497 | | +-------+ +-------+ 498 | Application | | SIP | | XMPP | ... 499 | | | Usage | | Usage | 500 | | +-------+ +-------+ 501 | | ---------------------------------- 502 | |+------------------+ +---------+ 503 | Transport || Message |<--->| Storage | 504 | || Transport | +---------+ 505 | |+------------------+ ^ 506 | | ^ ^ | 507 | | | v v 508 Application | | | +-------------------+ 509 | (Routing) | | | Topology | 510 | | | | Plugin | 511 | | | +-------------------+ 512 | | | ^ 513 | | v v 514 | Network | +------------------+ 515 | | | Forwarding & | 516 | | | Link Management | 517 | | +------------------+ 518 | | ---------------------------------- 519 Transport | Link | +-------+ +------+ 520 | | |TLS | |DTLS | ... 521 | | +-------+ +------+ 522 -------------+-----------------+------------------------------------ 523 Network | 524 | 525 Link | 527 1.2.1. Usage Layer 529 The top layer, called the Usage Layer, has application usages, such 530 as the SIP Registration Usage [I-D.ietf-p2psip-sip], that use the 531 abstract Message Transport Service provided by RELOAD. The goal of 532 this layer is to implement application-specific usages of the generic 533 overlay services provided by RELOAD. The usage defines how a 534 specific application maps its data into something that can be stored 535 in the overlay, where to store the data, how to secure the data, and 536 finally how applications can retrieve and use the data. 538 The architecture diagram shows both a SIP usage and an XMPP usage. A 539 single application may require multiple usages; for example a 540 softphone application may also require a voicemail usage. A usage 541 may define multiple Kinds of data that are stored in the overlay and 542 may also rely on Kinds originally defined by other usages. 544 Because the security and storage policies for each Kind are dictated 545 by the usage defining the Kind, the usages may be coupled with the 546 Storage component to provide security policy enforcement and to 547 implement appropriate storage strategies according to the needs of 548 the usage. The exact implementation of such an interface is outside 549 the scope of this specification. 551 1.2.2. Message Transport 553 The Message Transport component provides a generic message routing 554 service for the overlay. The Message Transport layer is responsible 555 for end-to-end message transactions. Each peer is identified by its 556 location in the overlay as determined by its Node-ID. A component 557 that is a client of the Message Transport can perform two basic 558 functions: 560 o Send a message to a given peer specified by Node-ID or to the peer 561 responsible for a particular Resource-ID. 562 o Receive messages that other peers sent to a Node-ID or Resource-ID 563 for which the receiving peer is responsible. 565 All usages rely on the Message Transport component to send and 566 receive messages from peers. For instance, when a usage wants to 567 store data, it does so by sending Store requests. Note that the 568 Storage component and the Topology Plugin are themselves clients of 569 the Message Transport, because they need to send and receive messages 570 from other peers. 572 The Message Transport Service is responsible for end-to-end 573 reliability, accomplished by timer-based retransmissions. Unlike the 574 Internet transport layer, however, this layer does not provide 575 congestion control. RELOAD is a request-response protocol, with no 576 more than two pairs of request-response messages used in typical 577 transactions between pairs of nodes, therefore there are no 578 opportunities to observe and react to end-to-end congestion. As with 579 all Internet applications, implementers are strongly discouraged from 580 writing applications that react to loss by immediately retrying the 581 transaction. 583 The Message Transport Service is similar to those described as 584 providing "Key based routing" (KBR), although as RELOAD supports 585 different overlay algorithms (including non-DHT overlay algorithms) 586 that calculate keys in different ways, the actual interface must 587 accept Resource Names rather than actual keys. 589 Stability of the underlying network supporting the overlay (the 590 Internet) and congestion control between overlay neighbors, which 591 exchange routing updates and data replicas in addition to forwarding 592 end-to-end messages, is handled by the Forwarding and Link Management 593 layer described below. 595 Real-world experience has shown that a fixed timeout for the end-to- 596 end retransmission timer is sufficient for practical overlay 597 networks. This timer is adjustable via the overlay configuration. 598 As the overlay configuration can be rapidly updated, this value could 599 be dynamically adjusted at coarse time scales, although algorithms 600 for determining how to accomplish this are beyond the scope of this 601 specification. In many cases, however, more appropriate means of 602 improving network performance, such as the Topology Plugin removing 603 lossy links from use in overlay routing or reducing the overall hop- 604 count of end-to-end paths will be more effective than simply 605 increasing the retransmission timer. 607 1.2.3. Storage 609 One of the major functions of RELOAD is to allow nodes to store data 610 in the overlay and to retrieve data stored by other nodes or by 611 themselves. The Storage component is responsible for processing data 612 storage and retrieval messages. For instance, the Storage component 613 might receive a Store request for a given resource from the Message 614 Transport. It would then query the appropriate usage before storing 615 the data value(s) in its local data store and sending a response to 616 the Message Transport for delivery to the requesting node. 617 Typically, these messages will come from other nodes, but depending 618 on the overlay topology, a node might be responsible for storing data 619 for itself as well, especially if the overlay is small. 621 A peer's Node-ID determines the set of resources that it will be 622 responsible for storing. However, the exact mapping between these is 623 determined by the overlay algorithm in use. The Storage component 624 will only receive a Store request from the Message Transport if this 625 peer is responsible for that Resource-ID. The Storage component is 626 notified by the Topology Plugin when the Resource-IDs for which it is 627 responsible change, and the Storage component is then responsible for 628 migrating resources to other peers, as required. 630 1.2.4. Topology Plugin 632 RELOAD is explicitly designed to work with a variety of overlay 633 algorithms. In order to facilitate this, the overlay algorithm 634 implementation is provided by a Topology Plugin so that each overlay 635 can select an appropriate overlay algorithm that relies on the common 636 RELOAD core protocols and code. 638 The Topology Plugin is responsible for maintaining the overlay 639 algorithm Routing Table, which is consulted by the Forwarding and 640 Link Management Layer before routing a message. When connections are 641 made or broken, the Forwarding and Link Management Layer notifies the 642 Topology Plugin, which adjusts the routing table as appropriate. The 643 Topology Plugin will also instruct the Forwarding and Link Management 644 Layer to form new connections as dictated by the requirements of the 645 overlay algorithm Topology. The Topology Plugin issues periodic 646 update requests through Message Transport to maintain and update its 647 Routing Table. 649 As peers enter and leave, resources may be stored on different peers, 650 so the Topology Plugin also keeps track of which peers are 651 responsible for which resources. As peers join and leave, the 652 Topology Plugin instructs the Storage component to issue resource 653 migration requests as appropriate, in order to ensure that other 654 peers have whatever resources they are now responsible for. The 655 Topology Plugin is also responsible for providing for redundant data 656 storage to protect against loss of information in the event of a peer 657 failure and to protect against compromised or subversive peers. 659 1.2.5. Forwarding and Link Management Layer 661 The Forwarding and Link Management Layer is responsible for getting a 662 message to the next peer, as determined by the Topology Plugin. This 663 Layer establishes and maintains the network connections as required 664 by the Topology Plugin. This layer is also responsible for setting 665 up connections to other peers through NATs and firewalls using ICE, 666 and it can elect to forward traffic using relays for NAT and firewall 667 traversal. 669 Congestion control is implemented at this layer to protect the 670 Internet paths used to form the link in the overlay. Additionally, 671 retransmission is performed to improve the reliability of end-to-end 672 transactions. The relationship between this layer and the Message 673 Transport Layer is similar to the relationship between link-level 674 congestion control and retransmission in modern wireless networks is 675 to Internet transport protocols. 677 This layer provides a generic interface that allows the topology 678 plugin to control the overlay and resource operations and messages. 679 Since each overlay algorithm is defined and functions differently, we 680 generically refer to the table of other peers that the overlay 681 algorithm maintains and uses to route requests (neighbors) as a 682 Routing Table. The Topology Plugin actually owns the Routing Table, 683 and forwarding decisions are made by querying the Topology Plugin for 684 the next hop for a particular Node-ID or Resource-ID. If this node 685 is the destination of the message, the message is delivered to the 686 Message Transport. 688 This layer also utilizes a framing header to encapsulate messages as 689 they are forwarding along each hop. This header aids reliability 690 congestion control, flow control, etc. It has meaning only in the 691 context of that individual link. 693 The Forwarding and Link Management Layer sits on top of the Overlay 694 Link Layer protocols that carry the actual traffic. This 695 specification defines how to use DTLS and TLS protocols to carry 696 RELOAD messages. 698 1.3. Security 700 RELOAD's security model is based on each node having one or more 701 public key certificates. In general, these certificates will be 702 assigned by a central server which also assigns Node-IDs, although 703 self-signed certificates can be used in closed networks. These 704 credentials can be leveraged to provide communications security for 705 RELOAD messages. RELOAD provides communications security at three 706 levels: 708 Connection Level: Connections between peers are secured with TLS, 709 DTLS, or potentially some to be defined future protocol. 710 Message Level: Each RELOAD message is signed. 711 Object Level: Stored objects is signed by the creating peer. 713 These three levels of security work together to allow peers to verify 714 the origin and correctness of data they receive from other peers, 715 even in the face of malicious activity by other peers in the overlay. 716 RELOAD also provides access control built on top of these 717 communications security features. Because the peer responsible for 718 storing a piece of data can validate the signature on the data being 719 stored, the responsible peer can determine whether a given operation 720 is permitted or not. 722 RELOAD also provides an optional shared secret based admission 723 control feature using shared secrets and TLS-PSK. In order to form a 724 TLS connection to any node in the overlay, a new node needs to know 725 the shared overlay key, thus restricting access to authorized users 726 only. This feature is used together with certificate-based access 727 control, not as a replacement for it. It is typically used when 728 self-signed certificates are being used but would generally not be 729 used when the certificates were all signed by an enrollment server. 731 1.4. Structure of This Document 733 The remainder of this document is structured as follows. 735 o Section 2 provides definitions of terms used in this document. 736 o Section 3 provides an overview of the mechanisms used to establish 737 and maintain the overlay. 738 o Section 5 provides an overview of the mechanism RELOAD provides to 739 support other applications. 740 o Section 6 defines the protocol messages that RELOAD uses to 741 establish and maintain the overlay. 742 o Section 7 defines the protocol messages that are used to store and 743 retrieve data using RELOAD. 744 o Section 8 defines the Certificate Store Usage that is fundamental 745 to RELOAD security. 746 o Section 9 defines the TURN Server Usage needed to locate TURN 747 servers for NAT traversal. 748 o Section 10 defines a specific Topology Plugin using Chord based 749 algorithm. 750 o Section 11 defines the mechanisms that new RELOAD nodes use to 751 join the overlay for the first time. 752 o Section 12 provides an extended example. 754 2. Terminology 756 Terms used in this document are defined inline when used and are also 757 defined below for reference. 759 DHT: A distributed hash table. A DHT is an abstract hash table 760 service realized by storing the contents of the hash table across 761 a set of peers. 763 Overlay Algorithm: An overlay algorithm defines the rules for 764 determining which peers in an overlay store a particular piece of 765 data and for determining a topology of interconnections amongst 766 peers in order to find a piece of data. 768 Overlay Instance: A specific overlay algorithm and the collection of 769 peers that are collaborating to provide read and write access to 770 it. There can be any number of overlay instances running in an IP 771 network at a time, and each operates in isolation of the others. 773 Peer: A host that is participating in the overlay. Peers are 774 responsible for holding some portion of the data that has been 775 stored in the overlay and also route messages on behalf of other 776 hosts as required by the Overlay Algorithm. 778 Client: A host that is able to store data in and retrieve data from 779 the overlay but which is not participating in routing or data 780 storage for the overlay. 782 Kind: A Kind defines a particular type of data that can be stored in 783 the overlay. Applications define new Kinds to store the data they 784 use. Each Kind is identified with a unique integer called a 785 Kind-ID. 787 Node: We use the term "Node" to refer to a host that may be either a 788 Peer or a Client. Because RELOAD uses the same protocol for both 789 clients and peers, much of the text applies equally to both. 790 Therefore we use "Node" when the text applies to both Clients and 791 Peers and the more specific term (i.e. client or peer) when the 792 text applies only to Clients or only to Peers. 794 Node-ID: A fixed-length value that uniquely identifies a node. 795 Node-IDs of all 0s and all 1s are reserved and are invalid Node- 796 IDs. A value of zero is not used in the wire protocol but can be 797 used to indicate an invalid node in implementations and APIs. The 798 Node-ID of all 1s is used on the wire protocol as a wildcard. 800 Joining Peer: A node that is attempting to become a Peer in a 801 particular Overlay. 803 Admitting Peer: A Peer in the Overlay which helps the Joining Peer 804 join the Overlay. 806 Bootstrap Node: A network node used by Joining Peers to help locate 807 the Admitting Peer. 809 Peer Admission: The act of admitting a peer (the "Joining Peer" ) 810 into an Overlay. After the admission process is over, the joining 811 peer is a fully-functional peer of the overlay. During the 812 admission process, the joining peer may need to present 813 credentials to prove that it has sufficient authority to join the 814 overlay. 816 Resource: An object or group of objects associated with a string 817 identifier. See "Resource Name" below. 819 Resource Name: The potentially human readable name by which a 820 resource is identified. In unstructured P2P networks, the 821 resource name is sometimes used directly as a Resource-ID. In 822 structured P2P networks the resource name is typically mapped into 823 a Resource-ID by using the string as the input to hash function. 824 Structured and unstructured P2P networks are described in 825 [RFC5694]. A SIP resource, for example, is often identified by 826 its AOR which is an example of a Resource Name. 828 Resource-ID: A value that identifies some resources and which is 829 used as a key for storing and retrieving the resource. Often this 830 is not human friendly/readable. One way to generate a Resource-ID 831 is by applying a mapping function to some other unique name (e.g., 832 user name or service name) for the resource. The Resource-ID is 833 used by the distributed database algorithm to determine the peer 834 or peers that are responsible for storing the data for the 835 overlay. In structured P2P networks, Resource-IDs are generally 836 fixed length and are formed by hashing the resource name. In 837 unstructured networks, resource names may be used directly as 838 Resource-IDs and may be variable lengths. 840 Connection Table: The set of nodes to which a node is directly 841 connected. This includes nodes with which Attach handshakes have 842 been done but which have not sent any Updates. 844 Routing Table: The set of peers which a node can use to route 845 overlay messages. In general, these peers will all be on the 846 connection table but not vice versa, because some peers will have 847 Attached but not sent updates. Peers may send messages directly 848 to peers that are in the connection table but may only route 849 messages to other peers through peers that are in the routing 850 table. 852 Destination List: A list of IDs through which a message is to be 853 routed, in strict order. A single Node-ID or a Resource-ID is a 854 trivial form of destination list. When multiple Node-IDs are 855 specified (no more than one Resource-ID is permitted, and it MUST 856 be the last entry) a Destination List is a loose source route. 858 Usage: A usage is an application that wishes to use the overlay for 859 some purpose. Each application wishing to use the overlay defines 860 a set of data Kinds that it wishes to use. The SIP usage defines 861 the location data Kind. 863 Transaction ID: A randomly chosen identifier selected by the 864 originator of a request and used to correlate requests and 865 responses. 867 The term "maximum request lifetime" is the maximum time a request 868 will wait for a response; it defaults to 15 seconds. The term 869 "successor replacement hold-down time" is the amount of time to wait 870 before starting replication when a new successor is found; it 871 defaults to 30 seconds. 873 3. Overlay Management Overview 875 The most basic function of RELOAD is as a generic overlay network. 876 Nodes need to be able to join the overlay, form connections to other 877 nodes, and route messages through the overlay to nodes to which they 878 are not directly connected. This section provides an overview of the 879 mechanisms that perform these functions. 881 3.1. Security and Identification 883 The overlay parameters are specified in a configuration document. 884 Because the parameters include security critical information such as 885 the certificate signing trust anchors, the configuration document 886 must be retrieved securely. The initial configuration document is 887 either initially fetched over HTTPS or manually provisioned; 888 subsequent configuration document updates are received either by 889 periodically refreshing from the configuration server, or, more 890 commonly, by being flood filled through the overlay, which allows for 891 fast propagation once an update is pushed. In the latter case, 892 updates are via digital signatures tracing back to the initial 893 configuration document. 895 Every node in the RELOAD overlay is identified by a Node-ID. The 896 Node-ID is used for three major purposes: 898 o To address the node itself. 899 o To determine its position in the overlay topology when the overlay 900 is structured. 901 o To determine the set of resources for which the node is 902 responsible. 904 Each node has a certificate [RFC5280] containing a Node-ID, which is 905 unique within an overlay instance. 907 The certificate serves multiple purposes: 909 o It entitles the user to store data at specific locations in the 910 Overlay Instance. Each data Kind defines the specific rules for 911 determining which certificates can access each Resource-ID/Kind-ID 912 pair. For instance, some Kinds might allow anyone to write at a 913 given location, whereas others might restrict writes to the owner 914 of a single certificate. 915 o It entitles the user to operate a node that has a Node-ID found in 916 the certificate. When the node forms a connection to another 917 peer, it uses this certificate so that a node connecting to it 918 knows it is connected to the correct node (technically: a (D)TLS 919 association with client authentication is formed.) In addition, 920 the node can sign messages, thus providing integrity and 921 authentication for messages which are sent from the node. 922 o It entitles the user to use the user name found in the 923 certificate. 925 If a user has more than one device, typically they would get one 926 certificate for each device. This allows each device to act as a 927 separate peer. 929 RELOAD supports multiple certificate issuance models. The first is 930 based on a central enrollment process which allocates a unique name 931 and Node-ID and puts them in a certificate for the user. All peers 932 in a particular Overlay Instance have the enrollment server as a 933 trust anchor and so can verify any other peer's certificate. 935 In some settings, a group of users want to set up an overlay network 936 but are not concerned about attack by other users in the network. 937 For instance, users on a LAN might want to set up a short term ad hoc 938 network without going to the trouble of setting up an enrollment 939 server. RELOAD supports the use of self-generated, self-signed 940 certificates. When self-signed certificates are used, the node also 941 generates its own Node-ID and username. The Node-ID is computed as a 942 digest of the public key, to prevent Node-ID theft. Note that the 943 relevant cryptographic property for the digest is preimage 944 resistance. Collision-resistance is not required since an attacker 945 who can create two nodes with the same Node-ID but different public 946 key obtains no advantage. This model is still subject to a number of 947 known attacks (most notably Sybil attacks [Sybil]) and can only be 948 safely used in closed networks where users are mutually trusting. 949 Another drawback of this approach is that user's data is then tied to 950 their keys, so if a key is changed any data stored under their 951 Node-ID must then be re-stored. This is not an issue for centrally- 952 issued Node-IDs provided that the CA re-issues the same Node-ID when 953 a new certificate is generated. 955 The general principle here is that the security mechanisms (TLS and 956 message signatures) are always used, even if the certificates are 957 self-signed. This allows for a single set of code paths in the 958 systems with the only difference being whether certificate 959 verification is required to chain to a single root of trust. 961 3.1.1. Shared-Key Security 963 RELOAD also provides an admission control system based on shared 964 keys. In this model, the peers all share a single key which is used 965 to authenticate the peer-to-peer connections via TLS-PSK/TLS-SRP. 967 3.2. Clients 969 RELOAD defines a single protocol that is used both as the peer 970 protocol and as the client protocol for the overlay. This simplifies 971 implementation, particularly for devices that may act in either role, 972 and allows clients to inject messages directly into the overlay. 974 We use the term "peer" to identify a node in the overlay that routes 975 messages for nodes other than those to which it is directly 976 connected. Peers also have storage responsibilities. We use the 977 term "client" to refer to nodes that do not have routing or storage 978 responsibilities. When text applies to both peers and clients, we 979 will simply refer to such devices as "nodes." 981 RELOAD's client support allows nodes that are not participating in 982 the overlay as peers to utilize the same implementation and to 983 benefit from the same security mechanisms as the peers. Clients 984 possess and use certificates that authorize the user to store data at 985 certain locations in the overlay. The Node-ID in the certificate is 986 used to identify the particular client as a member of the overlay and 987 to authenticate its messages. 989 In RELOAD, unlike some other designs, clients are not a first-class 990 entity. From the perspective of a peer, a client is simply a node 991 which has not yet sent any Updates or Joins. It might never do so 992 (if it's a client) or it might eventually do so (if it's just a node 993 that's taking a long time to join). The routing and storage rules 994 for RELOAD provide for correct behavior by peers regardless of 995 whether other nodes attached to them are clients or peers. Of 996 course, a client implementation must know that it intends to be a 997 client, but this localizes complexity only to that node. 999 For more discussion of the motivation for RELOAD's client support, 1000 see Appendix B. 1002 3.2.1. Client Routing 1004 Clients may insert themselves in the overlay in two ways: 1006 o Establish a connection to the peer responsible for the client's 1007 Node-ID in the overlay. Then requests may be sent from/to the 1008 client using its Node-ID in the same manner as if it were a peer, 1009 because the responsible peer in the overlay will handle the final 1010 step of routing to the client. This may require a TURN relay in 1011 cases where NATs or firewalls prevent a client from forming a 1012 direct connections with its responsible peer. Note that clients 1013 that choose this option need to process Update messages from the 1014 peer. Those updates can indicate that the peer no longer is 1015 responsible for the Client's Node-ID. The client would then need 1016 to form a connection to the appropriate peer. Failure to do so 1017 will result in the client no longer receiving messages. 1018 o Establish a connection with an arbitrary peer in the overlay 1019 (perhaps based on network proximity or an inability to establish a 1020 direct connection with the responsible peer). In this case, the 1021 client will rely on RELOAD's Destination List feature to ensure 1022 reachability. The client can initiate requests, and any node in 1023 the overlay that knows the Destination List to its current 1024 location can reach it, but the client is not directly reachable 1025 using only its Node-ID. If the client is to receive incoming 1026 requests from other members of the overlay, the Destination List 1027 required to reach it must be learnable via other mechanisms, such 1028 as being stored in the overlay by a usage. A client connected 1029 this way using a certificate with only a single Node-ID MAY 1030 proceed to use the connection without performing an Attach. A 1031 client wishing to connect using this mechanism with a certificate 1032 with multiple Node-IDs can use a Ping to probe the Node-ID of the 1033 node to which it is connected before doing the Attach. 1035 3.2.2. Minimum Functionality Requirements for Clients 1037 A node may act as a client simply because it does not have the 1038 resources or even an implementation of the topology plugin required 1039 to act as a peer in the overlay. In order to exchange RELOAD 1040 messages with a peer, a client MUST meet a minimum level of 1041 functionality. Such a client MUST: 1043 o Implement RELOAD's connection-management operations that are used 1044 to establish the connection with the peer. 1045 o Implement RELOAD's data retrieval methods (with client 1046 functionality). 1047 o Be able to calculate Resource-IDs used by the overlay. 1049 o Possess security credentials required by the overlay it is 1050 implementing. 1052 A client speaks the same protocol as the peers, knows how to 1053 calculate Resource-IDs, and signs its requests in the same manner as 1054 peers. While a client does not necessarily require a full 1055 implementation of the overlay algorithm, calculating the Resource-ID 1056 requires an implementation of the appropriate algorithm for the 1057 overlay. 1059 3.3. Routing 1061 This section will discuss the capabilities of RELOAD's routing layer, 1062 the protocol features used to implement them, and a brief overview of 1063 how they are used. Appendix A discusses some alternative designs and 1064 the tradeoffs that would be necessary to support them. 1066 RELOAD's routing provides the following capabilities: 1068 Resource-based routing: RELOAD supports routing messages based 1069 soley on the name of the resource. Such messages are delivered to 1070 a node that is responsible for that resource. Both structured and 1071 unstructured overlays are supported, so the route may not be 1072 deterministic for all Topology Plugins. 1073 Node-based routing: RELOAD supports routing messages to a specific 1074 node in the overlay. 1075 Clients: RELOAD supports requests from and to clients that do not 1076 participate in overlay routing, located via either of the 1077 mechanisms described above. 1078 Bridging overlays: Similar to how a Destination List is used to 1079 reach a client attached via an arbitrary peer, RELOAD can route 1080 messages between two different overlays by building a destination 1081 list that includes a peer (or client) with connectivity to both 1082 networks. 1083 NAT Traversal: RELOAD supports establishing and using connections 1084 between nodes separated by one or more NATs, including locating 1085 peers behind NATs for those overlays allowing/requiring it. 1086 Low state: RELOAD's routing algorithms do not require significant 1087 state (i.e., state linear or greater in the number of outstanding 1088 messages that have passed through it) to be stored on intermediate 1089 peers. 1090 Routability in unstable topologies: Overlay topology changes 1091 constantly in an overlay of moderate size due to the failure of 1092 individual nodes and links in the system. RELOAD's routing allows 1093 peers to re-route messages when a failure is detected, and replies 1094 can be returned to the requesting node as long as the peers that 1095 originally forwarded the successful request do not fail before the 1096 response is returned. 1098 RELOAD's routing utilizes three basic mechanisms: 1100 Destination Lists: While in principle it is possible to just 1101 inject a message into the overlay with a single Node-ID as the 1102 destination, RELOAD provides a source routing capability in the 1103 form of "Destination Lists". A Destination List provides a list 1104 of the nodes through which a message must flow in order (i.e., it 1105 is loose source routed). The minimal destination list contains 1106 just a single value. 1107 Via Lists: In order to allow responses to follow the same path as 1108 requests, each message also contains a "Via List", which is 1109 appended to by each node a message traverses. This via list can 1110 then be inverted and used as a destination list for the response. 1111 RouteQuery: The RouteQuery method allows a node to query a peer 1112 for the next hop it will use to route a message. This method is 1113 useful for diagnostics and for iterative routing. 1115 The basic routing mechanism used by RELOAD is Symmetric Recursive. 1116 We will first describe symmetric recursive routing and then discuss 1117 its advantages in terms of the requirements discussed above. 1119 Symmetric recursive routing requires that a request message follow a 1120 path through the overlay to the destination: each peer forwards the 1121 message closer to its destination. The return path of the response 1122 is then the same path followed in reverse. For example, a message 1123 following a route from A to Z through B and X: 1125 A B X Z 1126 ------------------------------- 1128 ----------> 1129 Dest=Z 1130 ----------> 1131 Via=A 1132 Dest=Z 1133 ----------> 1134 Via=A,B 1135 Dest=Z 1137 <---------- 1138 Dest=X,B,A 1139 <---------- 1140 Dest=B,A 1141 <---------- 1142 Dest=A 1144 Note that the preceding Figure does not indicate whether A is a 1145 client or peer: A forwards its request to B and the response is 1146 returned to A in the same manner regardless of A's role in the 1147 overlay. 1149 This figure shows use of full via-lists by intermediate peers B and 1150 X. However, if B and/or X are willing to store state, then they may 1151 elect to truncate the lists, save that information internally (keyed 1152 by the transaction id), and return the response message along the 1153 path from which it was received when the response is received. This 1154 option requires greater state to be stored on intermediate peers but 1155 saves a small amount of bandwidth and reduces the need for modifying 1156 the message en route. Selection of this mode of operation is a 1157 choice for the individual peer; the techniques are interoperable even 1158 on a single message. The figure below shows B using full via lists 1159 but X truncating them to X1 and saving the state internally. 1161 A B X Z 1162 ------------------------------- 1164 ----------> 1165 Dest=Z 1166 ----------> 1167 Via=A 1168 Dest=Z 1169 ----------> 1170 Via=X1 1171 Dest=Z 1173 <---------- 1174 Dest=X,X1 1175 <---------- 1176 Dest=B,A 1177 <---------- 1178 Dest=A 1180 As before, when B receives the message, he creates via list 1181 consisting of [A]. However, instead of sending [A,B], X creates an 1182 opaque ID X1 which maps internally to [A, B] (perhaps by being an 1183 encryption of [A, B] and forwards to Z with only X1 as the via list. 1184 When the response arrives at X, it maps X1 back to [A, B] and then 1185 inverts it to produce the new destination list [B, A] and routes it 1186 to B. 1188 RELOAD also supports a basic Iterative routing mode (where the 1189 intermediate peers merely return a response indicating the next hop, 1190 but do not actually forward the message to that next hop themselves). 1191 Iterative routing is implemented using the RouteQuery method, which 1192 requests this behavior. Note that iterative routing is selected only 1193 by the initiating node. 1195 3.4. Connectivity Management 1197 In order to provide efficient routing, a peer needs to maintain a set 1198 of direct connections to other peers in the Overlay Instance. Due to 1199 the presence of NATs, these connections often cannot be formed 1200 directly. Instead, we use the Attach request to establish a 1201 connection. Attach uses ICE [RFC5245] to establish the connection. 1202 It is assumed that the reader is familiar with ICE. 1204 Say that peer A wishes to form a direct connection to peer B. It 1205 gathers ICE candidates and packages them up in an Attach request 1206 which it sends to B through usual overlay routing procedures. B does 1207 its own candidate gathering and sends back a response with its 1208 candidates. A and B then do ICE connectivity checks on the candidate 1209 pairs. The result is a connection between A and B. At this point, A 1210 and B can add each other to their routing tables and send messages 1211 directly between themselves without going through other overlay 1212 peers. 1214 There are two cases where Attach is not used. The first is when a 1215 peer is joining the overlay and is not connected to any peers. In 1216 order to support this case, some small number of "bootstrap nodes" 1217 typically need to be publicly accessible so that new peers can 1218 directly connect to them. Section 11 contains more detail on this. 1219 The second case is when a client node connects to a node at an 1220 arbitrary IP address, rather than to its responsible peer, as 1221 described in the second bullet point of Section 3.2.1. 1223 In general, a peer needs to maintain connections to all of the peers 1224 near it in the Overlay Instance and to enough other peers to have 1225 efficient routing (the details depend on the specific overlay). If a 1226 peer cannot form a connection to some other peer, this isn't 1227 necessarily a disaster; overlays can route correctly even without 1228 fully connected links. However, a peer should try to maintain the 1229 specified link set and if it detects that it has fewer direct 1230 connections, should form more as required. This also implies that 1231 peers need to periodically verify that the connected peers are still 1232 alive and if not try to reform the connection or form an alternate 1233 one. 1235 3.5. Overlay Algorithm Support 1237 The Topology Plugin allows RELOAD to support a variety of overlay 1238 algorithms. This specification defines a DHT based on Chord, which 1239 is mandatory to implement, but the base RELOAD protocol is designed 1240 to support a variety of overlay algorithms. The information needed 1241 to implement this DHT is fully contained in this specification but it 1242 is easier to understand if you are familiar with Chord [Chord] based 1243 DHTs. A nice tutorial can be found at [wikiChord]. 1245 3.5.1. Support for Pluggable Overlay Algorithms 1247 RELOAD defines three methods for overlay maintenance: Join, Update, 1248 and Leave. However, the contents of those messages, when they are 1249 sent, and their precise semantics are specified by the actual overlay 1250 algorithm, which is specified by configuration for all nodes in the 1251 overlay, and thus known to nodes prior to their attempting to join 1252 the overlay. RELOAD merely provides a framework of commonly-needed 1253 methods that provides uniformity of notation (and ease of debugging) 1254 for a variety of overlay algorithms. 1256 3.5.2. Joining, Leaving, and Maintenance Overview 1258 When a new peer wishes to join the Overlay Instance, it MUST have a 1259 Node-ID that it is allowed to use and a set of credentials which 1260 match that Node-ID. When an enrollment server is used that Node-ID 1261 will be in the certificate the node received from the enrollment 1262 server. The details of the joining procedure are defined by the 1263 overlay algorithm, but the general steps for joining an Overlay 1264 Instance are: 1266 o Forming connections to some other peers. 1267 o Acquiring the data values this peer is responsible for storing. 1268 o Informing the other peers which were previously responsible for 1269 that data that this peer has taken over responsibility. 1271 The first thing the peer needs to do is to form a connection to some 1272 "bootstrap node". Because this is the first connection the peer 1273 makes, these nodes MUST have public IP addresses so that they can be 1274 connected to directly. Once a peer has connected to one or more 1275 bootstrap nodes, it can form connections in the usual way by routing 1276 Attach messages through the overlay to other nodes. Once a peer has 1277 connected to the overlay for the first time, it can cache the set of 1278 past adjacencies which have public IP address and attempt to use them 1279 as future bootstrap nodes. Note that this requires some notion of 1280 which addresses are likely to be public as discussed in Section 9. 1282 Once a peer has connected to a bootstrap node, it then needs to take 1283 up its appropriate place in the overlay. This requires two major 1284 operations: 1286 o Forming connections to other peers in the overlay to populate its 1287 Routing Table. 1289 o Getting a copy of the data it is now responsible for storing and 1290 assuming responsibility for that data. 1292 The second operation is performed by contacting the Admitting Peer 1293 (AP), the node which is currently responsible for that section of the 1294 overlay. 1296 The details of this operation depend mostly on the overlay algorithm 1297 involved, but a typical case would be: 1299 1. JP (Joining Peer) sends a Join request to AP (Admitting Peer) 1300 announcing its intention to join. 1301 2. AP sends a Join response. 1302 3. AP does a sequence of Stores to JP to give it the data it will 1303 need. 1304 4. AP does Updates to JP and to other peers to tell it about its own 1305 routing table. At this point, both JP and AP consider JP 1306 responsible for some section of the Overlay Instance. 1307 5. JP makes its own connections to the appropriate peers in the 1308 Overlay Instance. 1310 After this process is completed, JP is a full member of the Overlay 1311 Instance and can process Store/Fetch requests. 1313 Note that the first node is a special case. When ordinary nodes 1314 cannot form connections to the bootstrap nodes, then they are not 1315 part of the overlay. However, the first node in the overlay can 1316 obviously not connect to other nodes. In order to support this case, 1317 potential first nodes (which must also serve as bootstrap nodes 1318 initially) must somehow be instructed (perhaps by configuration 1319 settings) that they are the entire overlay, rather than not part of 1320 it. 1322 Note that clients do not perform either of these operations. 1324 3.6. First-Time Setup 1326 Previous sections addressed how RELOAD works once a node has 1327 connected. This section provides an overview of how users get 1328 connected to the overlay for the first time. RELOAD is designed so 1329 that users can start with the name of the overlay they wish to join 1330 and perhaps a username and password, and leverage that into having a 1331 working peer with minimal user intervention. This helps avoid the 1332 problems that have been experienced with conventional SIP clients 1333 where users are required to manually configure a large number of 1334 settings. 1336 3.6.1. Initial Configuration 1338 In the first phase of the process, the user starts out with the name 1339 of the overlay and uses this to download an initial set of overlay 1340 configuration parameters. The node does a DNS SRV lookup on the 1341 overlay name to get the address of a configuration server. It can 1342 then connect to this server with HTTPS [RFC2818] to download a 1343 configuration document which contains the basic overlay configuration 1344 parameters as well as a set of bootstrap nodes which can be used to 1345 join the overlay. The expected domain name for HTTPS is the name of 1346 the overlay. 1348 If a node already has the valid configuration document that it 1349 received by some out of band method, this step can be skipped. Note 1350 that that out of band method MUST provide authentication and 1351 integrity, because the configuration document contains the trust 1352 anchors for the system. 1354 3.6.2. Enrollment 1356 If the overlay is using centralized enrollment, then a user needs to 1357 acquire a certificate before joining the overlay. The certificate 1358 attests both to the user's name within the overlay and to the Node- 1359 IDs which they are permitted to operate. In that case, the 1360 configuration document will contain the address of an enrollment 1361 server which can be used to obtain such a certificate. The 1362 enrollment server may (and probably will) require some sort of 1363 username and password before issuing the certificate. The enrollment 1364 server's ability to restrict attackers' access to certificates in the 1365 overlay is one of the cornerstones of RELOAD's security. 1367 3.6.3. Diagnostics 1369 Significant advice around managing a RELAOD overlay and extensions 1370 for diagnostics are described in [I-D.ietf-p2psip-diagnostics]. 1372 4. RFC 2119 Terminology 1374 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", 1375 "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this 1376 document are to be interpreted as described in RFC 2119 [RFC2119]. 1378 5. Application Support Overview 1380 RELOAD is not intended to be used alone, but rather as a substrate 1381 for other applications. These applications can use RELOAD for a 1382 variety of purposes: 1384 o To store data in the overlay and retrieve data stored by other 1385 nodes. 1386 o As a discovery mechanism for services such as TURN. 1387 o To form direct connections which can be used to transmit 1388 application-level messages without using the overlay. 1390 This section provides an overview of these services. 1392 5.1. Data Storage 1394 RELOAD provides operations to Store and Fetch data. Each location in 1395 the Overlay Instance is referenced by a Resource-ID. However, each 1396 location may contain data elements corresponding to multiple Kinds 1397 (e.g., certificate, SIP registration). Similarly, there may be 1398 multiple elements of a given Kind, as shown below: 1400 +--------------------------------+ 1401 | Resource-ID | 1402 | | 1403 | +------------+ +------------+ | 1404 | | Kind 1 | | Kind 2 | | 1405 | | | | | | 1406 | | +--------+ | | +--------+ | | 1407 | | | Value | | | | Value | | | 1408 | | +--------+ | | +--------+ | | 1409 | | | | | | 1410 | | +--------+ | | +--------+ | | 1411 | | | Value | | | | Value | | | 1412 | | +--------+ | | +--------+ | | 1413 | | | +------------+ | 1414 | | +--------+ | | 1415 | | | Value | | | 1416 | | +--------+ | | 1417 | +------------+ | 1418 +--------------------------------+ 1420 Each Kind is identified by a Kind-ID, which is a code point either 1421 assigned by IANA or allocated out of a private range. As part of the 1422 Kind definition, protocol designers may define constraints, such as 1423 limits on size, on the values which may be stored. For many Kinds, 1424 the set may be restricted to a single value; some sets may be allowed 1425 to contain multiple identical items while others may only have unique 1426 items. Note that a Kind may be employed by multiple usages and new 1427 usages are encouraged to use previously defined Kinds where possible. 1428 We define the following data models in this document, though other 1429 usages can define their own structures: 1431 single value: There can be at most one item in the set and any value 1432 overwrites the previous item. 1434 array: Many values can be stored and addressed by a numeric index. 1436 dictionary: The values stored are indexed by a key. Often this key 1437 is one of the values from the certificate of the peer sending the 1438 Store request. 1440 In order to protect stored data from tampering, by other nodes, each 1441 stored value is individually digitally signed by the node which 1442 created it. When a value is retrieved, the digital signature can be 1443 verified to detect tampering. 1445 5.1.1. Storage Permissions 1447 A major issue in peer-to-peer storage networks is minimizing the 1448 burden of becoming a peer, and in particular minimizing the amount of 1449 data which any peer is required to store for other nodes. RELOAD 1450 addresses this issue by only allowing any given node to store data at 1451 a small number of locations in the overlay, with those locations 1452 being determined by the node's certificate. When a peer uses a Store 1453 request to place data at a location authorized by its certificate, it 1454 signs that data with the private key that corresponds to its 1455 certificate. Then the peer responsible for storing the data is able 1456 to verify that the peer issuing the request is authorized to make 1457 that request. Each data Kind defines the exact rules for determining 1458 what certificate is appropriate. 1460 The most natural rule is that a certificate authorizes a user to 1461 store data keyed with their user name X. This rule is used for all 1462 the Kinds defined in this specification. Thus, only a user with a 1463 certificate for "alice@example.org" could write to that location in 1464 the overlay. However, other usages can define any rules they choose, 1465 including publicly writable values. 1467 The digital signature over the data serves two purposes. First, it 1468 allows the peer responsible for storing the data to verify that this 1469 Store is authorized. Second, it provides integrity for the data. 1470 The signature is saved along with the data value (or values) so that 1471 any reader can verify the integrity of the data. Of course, the 1472 responsible peer can "lose" the value but it cannot undetectably 1473 modify it. 1475 The size requirements of the data being stored in the overlay are 1476 variable. For instance, a SIP AOR and voicemail differ widely in the 1477 storage size. RELOAD leaves it to the Usage and overlay 1478 configuration to limit size imbalance of various Kinds. 1480 5.1.2. Replication 1482 Replication in P2P overlays can be used to provide: 1484 persistence: if the responsible peer crashes and/or if the storing 1485 peer leaves the overlay 1486 security: to guard against DoS attacks by the responsible peer or 1487 routing attacks to that responsible peer 1488 load balancing: to balance the load of queries for popular 1489 resources. 1491 A variety of schemes are used in P2P overlays to achieve some of 1492 these goals. Common techniques include replicating on neighbors of 1493 the responsible peer, randomly locating replicas around the overlay, 1494 or replicating along the path to the responsible peer. 1496 The core RELOAD specification does not specify a particular 1497 replication strategy. Instead, the first level of replication 1498 strategies are determined by the overlay algorithm, which can base 1499 the replication strategy on its particular topology. For example, 1500 Chord places replicas on successor peers, which will take over 1501 responsibility should the responsible peer fail [Chord]. 1503 If additional replication is needed, for example if data persistence 1504 is particularly important for a particular usage, then that usage may 1505 specify additional replication, such as implementing random 1506 replications by inserting a different well known constant into the 1507 Resource Name used to store each replicated copy of the resource. 1508 Such replication strategies can be added independent of the 1509 underlying algorithm, and their usage can be determined based on the 1510 needs of the particular usage. 1512 5.2. Usages 1514 By itself, the distributed storage layer just provides infrastructure 1515 on which applications are built. In order to do anything useful, a 1516 usage must be defined. Each Usage needs to specify several things: 1518 o Registers Kind-ID code points for any Kinds that the Usage 1519 defines. 1520 o Defines the data structure for each of the Kinds. 1521 o Defines access control rules for each of the Kinds. 1522 o Defines how the Resource Name is formed that is hashed to form the 1523 Resource-ID where each Kind is stored. 1525 o Describes how values will be merged after a network partition. 1526 Unless otherwise specified, the default merging rule is to act as 1527 if all the values that need to be merged were stored and as if the 1528 order they were stored in corresponds to the stored time values 1529 associated with (and carried in) their values. Because the stored 1530 time values are those associated with the peer which did the 1531 writing, clock skew is generally not an issue. If two nodes are 1532 on different partitions, write to the same location, and have 1533 clock skew, this can create merge conflicts. However because 1534 RELOAD deliberately segregates storage so that data from different 1535 users and peers is stored in different locations, and a single 1536 peer will typically only be in a single network partition, this 1537 case will generally not arise. 1539 The Kinds defined by a usage may also be applied to other usages. 1540 However, a need for different parameters, such as different size 1541 limits, would imply the need to create a new Kind. 1543 5.3. Service Discovery 1545 RELOAD does not currently define a generic service discovery 1546 algorithm as part of the base protocol, although a simplistic TURN- 1547 specific discovery mechanism is provided. A variety of service 1548 discovery algorithms can be implemented as extensions to the base 1549 protocol, such as the service discovery algorithm ReDIR 1550 [opendht-sigcomm05] or [I-D.ietf-p2psip-service-discovery]. 1552 5.4. Application Connectivity 1554 There is no requirement that a RELOAD usage must use RELOAD's 1555 primitives for establishing its own communication if it already 1556 possesses its own means of establishing connections. For example, 1557 one could design a RELOAD-based resource discovery protocol which 1558 used HTTP to retrieve the actual data. 1560 For more common situations, however, it is the overlay itself - 1561 rather than an external authority such as DNS - which is used to 1562 establish a connection. RELOAD provides connectivity to applications 1563 using the AppAttach method. For example, if a P2PSIP node wishes to 1564 establish a SIP dialog with another P2PSIP node, it will use 1565 AppAttach to establish a direct connection with the other node. This 1566 new connection is separate from the peer protocol connection. It is 1567 a dedicated UDP or TCP flow used only for the SIP dialog. 1569 6. Overlay Management Protocol 1571 This section defines the basic protocols used to create, maintain, 1572 and use the RELOAD overlay network. We start by defining the basic 1573 concept of how message destinations are interpreted when routing 1574 messages. We then describe the symmetric recursive routing model, 1575 which is RELOAD's default routing algorithm. We then define the 1576 message structure and then finally define the messages used to join 1577 and maintain the overlay. 1579 6.1. Message Receipt and Forwarding 1581 When a node receives a message, it first examines the overlay, 1582 version, and other header fields to determine whether the message is 1583 one it can process. If any of these are incorrect (e.g., the message 1584 is for an overlay in which the peer does not participate) it is an 1585 error and the message MUST be discarded. The peer SHOULD generate an 1586 appropriate error but local policy can override this and cause the 1587 messages to be silently dropped. 1589 Once the peer has determined that the message is correctly formatted 1590 (note that this does not include signature checking on intermediate 1591 nodes as the message may be fragmented) it examines the first entry 1592 on the destination list. There are three possible cases here: 1594 o The first entry on the destination list is an ID for which the 1595 peer is responsible. A peer is always responsible for the 1596 wildcard Node-ID. Handling of this case is described in 1597 Section 6.1.1. 1598 o The first entry on the destination list is an ID for which another 1599 peer is responsible. Handling of this case is described in 1600 Section 6.1.2. 1601 o The first entry on the destination list is an opaque ID that is 1602 being used for destination list compression. Handling of this 1603 case is described in Section 6.1.3. Note that opaque IDs can be 1604 distinguished from Node-IDs and Resource-IDs on the wire as 1605 described in Section 6.3.2.2). 1607 These cases are handled as discussed below. 1609 6.1.1. Responsible ID 1611 If the first entry on the destination list is an ID for which the 1612 peer is responsible, there are several (mutually exclusive) sub-cases 1613 to consider. 1615 o If the entry is a Resource-ID, then it MUST be the only entry on 1616 the destination list. If there are other entries, the message 1617 MUST be silently dropped. Otherwise, the message is destined for 1618 this node and it verify the signature and pass it up to the upper 1619 layers. 1621 o If the entry is a Node-ID which equals this node's Node-ID, then 1622 the message is destined for this node. If this is the only entry 1623 on the destination list, the message is destined for this node and 1624 so the node passes it up to the upper layers. Otherwise the node 1625 removes the entry from the destination list and repeats the 1626 routing process with the next entry on the destination list. If 1627 the message is a response and list compression was used, then the 1628 node first modifies the destination list to reinsert the saved 1629 state, e.g., by unpacking any opaque ids. 1630 o If the entry is the wildcard Node-ID, the message is destined for 1631 this node and it passes it up to the upper layers. 1632 o If the entry is a Node-ID which is not equal to this node, then 1633 the node MUST drop the message silently unless the Node-ID 1634 corresponds to a node which is directly connected to this node 1635 (i.e., a client). In the later case, it MUST forward the message 1636 to the destination node as described in the next section. 1638 Note that this implies that in order to address a message to "the 1639 peer that controls region X", a sender sends to Resource-ID X, not 1640 Node-ID X. 1642 6.1.2. Other ID 1644 If neither of the other three cases applies, then the peer MUST 1645 forward the message towards the first entry on the destination list. 1646 This means that it MUST select one of the peers to which it is 1647 connected and which is likely to be responsible for the first entry 1648 on the destination list. If the first entry on the destination list 1649 is in the peer's connection table, then it SHOULD forward the message 1650 to that peer directly. Otherwise, the peer consults the routing 1651 table to forward the message. 1653 Any intermediate peer which forwards a RELOAD request MUST ensure 1654 that if it receives a response to that message the response can be 1655 routed back through the set of nodes through which the request 1656 passed. There are two major ways of accomplishing this: 1658 o The peer can add an entry to the via list in the forwarding header 1659 that will enable it to determine the correct node. 1660 o The peer can keep per-transaction state which will allow it to 1661 determine the correct node. 1663 As an example of the first strategy, consider an example with nodes 1664 A, B, C, D and E. If node D receives a message from node C with via 1665 list (A, B), then D would forward to the next node (E) with via list 1666 (A, B, C). Now, if E wants to respond to the message, it reverses 1667 the via list to produce the destination list, resulting in (D, C, B, 1668 A). When D forwards the response to C, the destination list will 1669 contain (C, B, A). 1671 As an example of the second strategy, if node D receives a message 1672 from node C with transaction ID X and via list (A, B), it could store 1673 (X, C) in its state database and forward the message with the via 1674 list unchanged. When D receives the response, it consults its state 1675 database for transaction id X, determines that the request came from 1676 C, and forwards the response to C. 1678 Intermediate peers which modify the via list are not required to 1679 simply add entries. The only requirement is that the peer MUST be 1680 able to reconstruct the correct destination list on the return route. 1681 RELOAD provides explicit support for this functionality in the form 1682 of opaque IDs, which can replace any number of via list entries. For 1683 instance, in the above example, Node D might send E a via list 1684 containing only the opaque ID (I). E would then use the destination 1685 list (D, I) to send its return message. When D processes this 1686 destination list, it would detect that I is a opaque ID, recover the 1687 via list (A, B, C), and reverse that to produce the correct 1688 destination list (C, B, A) before sending it to C. This feature is 1689 called List Compression. Possibilities for a opaque id include a 1690 compressed version of the original via list or an index into a state 1691 database containing the original via list, but the details are a 1692 local matter. 1694 No matter what mechanism for storing via list state is used, if an 1695 intermediate peer exits the overlay, then on the return trip the 1696 message cannot be forwarded and will be dropped. The ordinary 1697 timeout and retransmission mechanisms provide stability over this 1698 type of failure. 1700 Note that if an intermediate peer retains per-transaction state 1701 instead of modifying the via list, it needs some mechanism for timing 1702 out that state, otherwise its state database will grow without bound. 1703 Whatever algorithm is used, unless a FORWARD_CRITICAL forwarding 1704 option or overlay configuration option explicitly indicates this 1705 state is not needed, the state MUST be maintained for at least the 1706 value of the overlay-reliability-timer configuration parameter and 1707 MAY be kept longer. Future extension, such as 1708 [I-D.jiang-p2psip-relay], may define mechanisms for determining when 1709 this state does not need to be retained. 1711 None of the above mechanisms are required for responses, since there 1712 is no need to ensure that subsequent requests follow the same path. 1714 To be precise on the responsibility of the intermediate node, suppose 1715 that an intermediate node, A, receives a message from node B with via 1716 list X-Y-Z. Node A MUST implement an algorithm that ensures that A 1717 returns a response to this request to node B with the destination 1718 list B-Z-Y-X, provided that the node to which A forwards the request 1719 follows the same contract. Node A normally learns the Node-ID B is 1720 using via an Attach, but a node using a certificate with a single 1721 Node-ID MAY elect to not send an Attach (see Section 3.2.1 bullet 2). 1722 If a node with a certificate with multiple Node-IDs attempts to route 1723 a message other than a Ping or Attach through a node without 1724 performing an Attach, the receiving node MUST reject the request with 1725 an Error_Forbidden error. The node MUST implement support for 1726 returning responses to a Ping or Attach request made by a joining 1727 node Attaching to its responsible peer. 1729 6.1.3. Opaque ID 1731 If the first entry in the destination list is an opaque id (e.g., a 1732 compressed via list), the peer MUST replace that entry with the 1733 original via list that it replaced and then re-examine the 1734 destination list to determine which of the three cases in Section 6.1 1735 now applies. 1737 6.2. Symmetric Recursive Routing 1739 This Section defines RELOAD's symmetric recursive routing algorithm, 1740 which is the default algorithm used by nodes to route messages 1741 through the overlay. All implementations MUST implement this routing 1742 algorithm. An overlay MAY be configured to use alternative routing 1743 algorithms, and alternative routing algorithms MAY be selected on a 1744 per-message basis. I.e., a node in an overlay which supports SRR and 1745 routing algorithm XXX might use SRR some of the time and XXX some of 1746 the time. 1748 6.2.1. Request Origination 1750 In order to originate a message to a given Node-ID or Resource-ID, a 1751 node constructs an appropriate destination list. The simplest such 1752 destination list is a single entry containing the Node-ID or 1753 Resource-ID. The resulting message uses the normal overlay routing 1754 mechanisms to forward the message to that destination. The node can 1755 also construct a more complicated destination list for source 1756 routing. 1758 Once the message is constructed, the node sends the message to some 1759 adjacent peer. If the first entry on the destination list is 1760 directly connected, then the message MUST be routed down that 1761 connection. Otherwise, the topology plugin MUST be consulted to 1762 determine the appropriate next hop. 1764 Parallel requests for a resource are a common solution to improve 1765 reliability in the face of churn or of subversive peers. Parallel 1766 searches for usage-specified replicas are managed by the usage layer, 1767 for instance by having the usage store data at multiple Resource-IDs 1768 with the requesting node sending requests to each of those Resource- 1769 IDs. However, a single request MAY also be routed through multiple 1770 adjacent peers, even when known to be sub-optimal, to improve 1771 reliability [vulnerabilities-acsac04]. Such parallel searches MAY be 1772 specified by the topology plugin, in which case it would return 1773 multiple next hops and the request would be routed to all of them. 1775 Because messages may be lost in transit through the overlay, RELOAD 1776 incorporates an end-to-end reliability mechanism. When an 1777 originating node transmits a request it MUST set a timer to the 1778 current overlay-reliability-timer. If a response has not been 1779 received when the timer fires, the request is retransmitted with the 1780 same transaction identifier. The request MAY be retransmitted up to 1781 4 times (for a total of 5 messages). After the timer for the fifth 1782 transmission fires, the message SHALL be considered to have failed. 1783 Note that this retransmission procedure is not followed by 1784 intermediate nodes. They follow the hop-by-hop reliability procedure 1785 described in Section 6.6.3. 1787 The above algorithm can result in multiple requests being delivered 1788 to a node. Receiving nodes MUST generate semantically equivalent 1789 responses to retransmissions of the same request (this can be 1790 determined by transaction id) if the request is received within the 1791 maximum request lifetime (15 seconds). For some requests (e.g., 1792 Fetch) this can be accomplished merely by processing the request 1793 again. For other requests, (e.g., Store) it may be necessary to 1794 maintain state for the duration of the request lifetime. 1796 6.2.2. Response Origination 1798 When a peer sends a response to a request using this routing 1799 algorithm, it MUST construct the destination list by reversing the 1800 order of the entries on the via list. This has the result that the 1801 response traverses the same peers as the request traversed, except in 1802 reverse order (symmetric routing). 1804 6.3. Message Structure 1806 RELOAD is a message-oriented request/response protocol. The messages 1807 are encoded using binary fields. All integers are represented in 1808 network byte order. The general philosophy behind the design was to 1809 use Type, Length, Value fields to allow for extensibility. However, 1810 for the parts of a structure that were required in all messages, we 1811 just define these in a fixed position, as adding a type and length 1812 for them is unnecessary and would simply increase bandwidth and 1813 introduces new potential for interoperability issues. 1815 Each message has three parts, concatenated as shown below: 1817 +-------------------------+ 1818 | Forwarding Header | 1819 +-------------------------+ 1820 | Message Contents | 1821 +-------------------------+ 1822 | Security Block | 1823 +-------------------------+ 1825 The contents of these parts are as follows: 1827 Forwarding Header: Each message has a generic header which is used 1828 to forward the message between peers and to its final destination. 1829 This header is the only information that an intermediate peer 1830 (i.e., one that is not the target of a message) needs to examine. 1832 Message Contents: The message being delivered between the peers. 1833 From the perspective of the forwarding layer, the contents are 1834 opaque, however, they are interpreted by the higher layers. 1836 Security Block: A security block containing certificates and a 1837 digital signature over the "Message Contents" section. Note that 1838 this signature can be computed without parsing the message 1839 contents. All messages MUST be signed by their originator. 1841 The following sections describe the format of each part of the 1842 message. 1844 6.3.1. Presentation Language 1846 The structures defined in this document are defined using a C-like 1847 syntax based on the presentation language used to define 1848 TLS[RFC5246]. Advantages of this style include: 1850 o It familiar enough looking that most readers can grasp it quickly. 1851 o The ability to define nested structures allows a separation 1852 between high-level and low-level message structures. 1853 o It has a straightforward wire encoding that allows quick 1854 implementation, but the structures can be comprehended without 1855 knowing the encoding. 1856 o The ability to mechanically compile encoders and decoders. 1858 Several idiosyncrasies of this language are worth noting. 1860 o All lengths are denoted in bytes, not objects. 1861 o Variable length values are denoted like arrays with angle 1862 brackets. 1863 o "select" is used to indicate variant structures. 1865 For instance, "uint16 array<0..2^8-2>;" represents up to 254 bytes 1866 which corresponds to up to 127 values of two bytes (16 bits) each. 1868 6.3.1.1. Common Definitions 1870 The following definitions are used throughout RELOAD and so are 1871 defined here. They also provide a convenient introduction to how to 1872 read the presentation language. 1874 An enum represents an enumerated type. The values associated with 1875 each possibility are represented in parentheses and the maximum value 1876 is represented as a nameless value, for purposes of describing the 1877 width of the containing integral type. For instance, Boolean 1878 represents a true or false: 1880 enum { false (0), true(1), (255)} Boolean; 1882 A boolean value is either a 1 or a 0. The max value of 255 indicates 1883 this is represented as a single byte on the wire. 1885 The NodeId, shown below, represents a single Node-ID. 1887 typedef opaque NodeId[NodeIdLength]; 1889 A NodeId is a fixed-length structure represented as a series of 1890 bytes, with the most significant byte first. The length is set on a 1891 per-overlay basis within the range of 16-20 bytes (128 to 160 bits). 1892 (See Section 11.1 for how NodeIdLength is set.) Note: the use of 1893 "typedef" here is an extension to the TLS language, but its meaning 1894 should be relatively obvious. Note the [ size ] syntax defines a 1895 fixed length element that does not include the length of the element 1896 in the on the wire encoding. 1898 A ResourceId, shown below, represents a single Resource-ID. 1900 typedef opaque ResourceId<0..2^8-1>; 1902 Like a NodeId, a ResourceId is an opaque string of bytes, but unlike 1903 NodeIds, ResourceIds are variable length, up to 254 bytes (2040 bits) 1904 in length. On the wire, each ResourceId is preceded by a single 1905 length byte (allowing lengths up to 255). Thus, the 3-byte value 1906 "FOO" would be encoded as: 03 46 4f 4f. Note the < range > syntax 1907 defines a variable length element that does include the length of the 1908 element in the on the wire encoding. The number of bytes to encode 1909 the length on the wire is derived by range; i.e., it is the minimum 1910 number of bytes which can encode the largest range value. 1912 A more complicated example is IpAddressPort, which represents a 1913 network address and can be used to carry either an IPv6 or IPv4 1914 address: 1916 enum {reservedAddr(0), ipv4_address (1), ipv6_address (2), 1917 (255)} AddressType; 1919 struct { 1920 uint32 addr; 1921 uint16 port; 1922 } IPv4AddrPort; 1924 struct { 1925 uint128 addr; 1926 uint16 port; 1927 } IPv6AddrPort; 1929 struct { 1930 AddressType type; 1931 uint8 length; 1933 select (type) { 1934 case ipv4_address: 1935 IPv4AddrPort v4addr_port; 1937 case ipv6_address: 1938 IPv6AddrPort v6addr_port; 1940 /* This structure can be extended */ 1941 }; 1942 } IpAddressPort; 1944 The first two fields in the structure are the same no matter what 1945 kind of address is being represented: 1947 type: the type of address (v4 or v6). 1948 length: the length of the rest of the structure. 1950 By having the type and the length appear at the beginning of the 1951 structure regardless of the kind of address being represented, an 1952 implementation which does not understand new address type X can still 1953 parse the IpAddressPort field and then discard it if it is not 1954 needed. 1956 The rest of the IpAddressPort structure is either an IPv4AddrPort or 1957 an IPv6AddrPort. Both of these simply consist of an address 1958 represented as an integer and a 16-bit port. As an example, here is 1959 the wire representation of the IPv4 address "192.0.2.1" with port 1960 "6100". 1962 01 ; type = IPv4 1963 06 ; length = 6 1964 c0 00 02 01 ; address = 192.0.2.1 1965 17 d4 ; port = 6100 1967 Unless a given structure that uses a select explicitly allows for 1968 unknown types in the select, any unknown type SHOULD be treated as an 1969 parsing error and the whole message discarded with no response. 1971 6.3.2. Forwarding Header 1973 The forwarding header is defined as a ForwardingHeader structure, as 1974 shown below. 1976 struct { 1977 uint32 relo_token; 1978 uint32 overlay; 1979 uint16 configuration_sequence; 1980 uint8 version; 1981 uint8 ttl; 1982 uint32 fragment; 1983 uint32 length; 1984 uint64 transaction_id; 1985 uint32 max_response_length; 1986 uint16 via_list_length; 1987 uint16 destination_list_length; 1988 uint16 options_length; 1989 Destination via_list[via_list_length]; 1990 Destination destination_list 1991 [destination_list_length]; 1992 ForwardingOptions options[options_length]; 1993 } ForwardingHeader; 1995 The contents of the structure are: 1997 relo_token: The first four bytes identify this message as a RELOAD 1998 message. This field MUST contain the value 0xd2454c4f (the string 1999 'RELO' with the high bit of the first byte set). 2001 overlay: The 32 bit checksum/hash of the overlay being used. This 2002 MUST be formed by taking the lower 32 bits of the SHA-1 [RFC3174] 2003 hash of the overlay name. The purpose of this field is to allow 2004 nodes to participate in multiple overlays and to detect accidental 2005 misconfiguration. This is not a security critical function. The 2006 overlay name MUST consist of a sequence of charters what would be 2007 allowable as a DNS name. 2009 configuration_sequence: The sequence number of the configuration 2010 file. 2012 version: The version of the RELOAD protocol being used. This is a 2013 fixed point integer between 0.1 and 25.4. This document describes 2014 version 0.1, with a value of 0x01. [[ Note to RFC Editor: Please 2015 update this to version 1.0 with value of 0x0a and remove this 2016 note. ]] 2018 ttl: An 8 bit field indicating the number of iterations, or hops, a 2019 message can experience before it is discarded. The TTL value MUST 2020 be decremented by one at every hop along the route the message 2021 traverses just before transmission. If a received message has a 2022 TTL of 0, and the message is not destined for the receiving node, 2023 then the message MUST NOT be propagated further and and a 2024 "Error_TTL_Exceeded" error should be generated. The initial value 2025 of the TTL SHOULD be 100 and MUST NOT exceed 100 unless defined 2026 otherwise by the overlay configuration. Implementations which 2027 receive message with a TTL greater than the current value of 2028 initial-ttl (or the 100 default) MUST discard the message and send 2029 an "Error_TTL_Exceeded" error. 2031 fragment: This field is used to handle fragmentation. The high bit 2032 (0x80000000) MUST be set for historical reasons. If the next bit 2033 (0x40000000) is set to 1, it indicates that this is the last (or 2034 only) fragment. The next six bits (0x20000000 to 0x01000000) are 2035 reserved and SHOULD be set to zero. The remainder of the field is 2036 used to indicate the fragment offset; see Section 6.7 2038 length: The count in bytes of the size of the message, including the 2039 header. 2041 transaction_id: A unique 64 bit number that identifies this 2042 transaction and also allows receivers to disambiguate transactions 2043 which are otherwise identical. In order to provide a high 2044 probability that transaction IDs are unique, they MUST be randomly 2045 generated. Responses use the same Transaction ID as the request 2046 they correspond to. Transaction IDs are also used for fragment 2047 reassembly. 2049 max_response_length: The maximum size in bytes of a response. Used 2050 by requesting nodes to avoid receiving (unexpected) very large 2051 responses. If this value is non-zero, responding peers MUST check 2052 that any response would not exceed it and if so generate an 2053 "Error_Incompatible_with_Overlay" value. This value SHOULD be set 2054 to zero for responses. 2056 via_list_length: The length of the via list in bytes. Note that in 2057 this field and the following two length fields we depart from the 2058 usual variable-length convention of having the length immediately 2059 precede the value in order to make it easier for hardware decoding 2060 engines to quickly determine the length of the header. 2062 destination_list_length: The length of the destination list in 2063 bytes. 2065 options_length: The length of the header options in bytes. 2067 via_list: The via_list contains the sequence of destinations through 2068 which the message has passed. The via_list starts out empty and 2069 grows as the message traverses each peer. 2071 destination_list: The destination_list contains a sequence of 2072 destinations which the message should pass through. The 2073 destination list is constructed by the message originator. The 2074 first element in the destination list is where the message goes 2075 next. The list shrinks as the message traverses each listed peer. 2077 options: Contains a series of ForwardingOptions entries. See 2078 Section 6.3.2.3. 2080 6.3.2.1. Processing Configuration Sequence Numbers 2082 In order to be part of the overlay, a node MUST have a copy of the 2083 overlay configuration document. In order to allow for configuration 2084 document changes, each version of the configuration document has a 2085 sequence number which is monotonically increasing mod 65536. Because 2086 the sequence number may in principle wrap, greater than or less than 2087 are interpreted by modulo arithmetic as in TCP. 2089 When a destination node receives a request, it MUST check that the 2090 configuration_sequence field is equal to its own configuration 2091 sequence number. If they do not match, it MUST generate an error, 2092 either Error_Config_Too_Old or Error_Config_Too_New. In addition, if 2093 the configuration file in the request is too old, it MUST generate a 2094 ConfigUpdate message to update the requesting node. This allows new 2095 configuration documents to propagate quickly throughout the system. 2096 The one exception to this rule is that if the configuration_sequence 2097 field is equal to 0xffff, and the message type is ConfigUpdate, then 2098 the message MUST be accepted regardless of the receiving node's 2099 configuration sequence number. Since 65535 is a special value, peers 2100 sending a new configuration when the configuration sequence is 2101 currently 65534 MUST set the configuration sequence number to 0 when 2102 they send out a new configuration. 2104 6.3.2.2. Destination and Via Lists 2106 The destination list and via lists are sequences of Destination 2107 values: 2109 enum {reserved(0), node(1), resource(2), opaque_id_type(3), 2110 /* 128-255 not allowed */ (255) } 2111 DestinationType; 2113 select (destination_type) { 2114 case node: 2115 NodeId node_id; 2117 case resource: 2118 ResourceId resource_id; 2120 case opaque_id_type: 2121 opaque opaque_id<0..2^8-1>; 2123 /* This structure may be extended with new types */ 2124 } DestinationData; 2126 struct { 2127 DestinationType type; 2128 uint8 length; 2129 DestinationData destination_data; 2130 } Destination; 2132 struct { 2133 uint16 opaque_id; /* top bit MUST be 1 */ 2135 } Destination; 2137 If a destination structure has its first bit set to 1, then it is a 2138 16 bit integer. If the first bit is not set, then it is a structure 2139 starting with DestinationType. If it is a 16 bit integer, it is 2140 treated as if it were a full structure with a DestinationType of 2141 opaque_id_type and a opaque_id that was 2 bytes long with the value 2142 of the 16 bit integer. When the destination structure is not a 16 2143 bit integer, it is the TLV structure with the following contents: 2145 type 2146 The type of the DestinationData Payload Data Unit (PDU). This may 2147 be one of "node", "resource", or "opaque_id_type". 2149 length 2150 The length of the destination_data. 2152 destination_data 2153 The destination value itself, which is an encoded DestinationData 2154 structure, depending on the value of "type". 2156 Note: This structure encodes a type, length, value. The length 2157 field specifies the length of the DestinationData values, which 2158 allows the addition of new DestinationTypes. This allows an 2159 implementation which does not understand a given DestinationType 2160 to skip over it. 2162 A DestinationData can be one of three types: 2164 node 2165 A Node-ID. 2167 opaque 2168 A compressed list of Node-IDs and/or resources. Because this 2169 value was compressed by one of the peers, it is only meaningful to 2170 that peer and cannot be decoded by other peers. Thus, it is 2171 represented as an opaque string. 2173 resource 2174 The Resource-ID of the resource which is desired. This type MUST 2175 only appear in the final location of a destination list and MUST 2176 NOT appear in a via list. It is meaningless to try to route 2177 through a resource. 2179 One possible encoding of the 16 bit integer version as an opaque 2180 identifier is to encode an index into a connection table. To avoid 2181 misrouting responses in the event a response is delayed and the 2182 connection table entry has changed, the identifier SHOULD be split 2183 between an index and a generation counter for that index. At 2184 startup, the generation counters should be initialized to random 2185 values. An implementation could use 12 bits for the connection table 2186 index and 3 bits for the generation counter. (Note that this does 2187 not suggest a 4096 entry connection table for every node, only the 2188 ability to encode for a larger connection table.) When a connection 2189 table slot is used for a new connection, the generation counter is 2190 incremented (with wrapping). Connection table slots are used on a 2191 rotating basis to maximize the time interval between uses of the same 2192 slot for different connections. When routing a message to an entry 2193 in the destination list encoding a connection table entry, the node 2194 confirms that the generation counter matches the current generation 2195 counter of that index before forwarding the message. If it does not 2196 match, the message is silently dropped. 2198 6.3.2.3. Forwarding Options 2200 The Forwarding header can be extended with forwarding header options, 2201 which are a series of ForwardingOptions structures: 2203 enum { reservedForwarding(0), (255) } 2204 ForwardingOptionsType; 2206 struct { 2207 ForwardingOptionsType type; 2208 uint8 flags; 2209 uint16 length; 2210 select (type) { 2211 /* This type may be extended */ 2212 } option; 2213 } ForwardingOption; 2215 Each ForwardingOption consists of the following values: 2217 type 2218 The type of the option. This structure allows for unknown options 2219 types. 2221 length 2222 The length of the rest of the structure. 2224 flags 2225 Three flags are defined FORWARD_CRITICAL(0x01), 2226 DESTINATION_CRITICAL(0x02), and RESPONSE_COPY(0x04). These flags 2227 MUST NOT be set in a response. If the FORWARD_CRITICAL flag is 2228 set, any node that would forward the message but does not 2229 understand this options MUST reject the request with an 2230 Error_Unsupported_Forwarding_Option error response. If the 2231 DESTINATION_CRITICAL flag is set, any node that generates a 2232 response to the message but does not understand the forwarding 2233 option MUST reject the request with an 2234 Error_Unsupported_Forwarding_Option error response. If the 2235 RESPONSE_COPY flag is set, any node generating a response MUST 2236 copy the option from the request to the response except that the 2237 RESPONSE_COPY, FORWARD_CRITICAL and DESTINATION_CRITICAL flags 2238 MUST be cleared. 2240 option 2241 The option value. 2243 6.3.3. Message Contents Format 2245 The second major part of a RELOAD message is the contents part, which 2246 is defined by MessageContents: 2248 enum { reservedMessagesExtension(0), (2^16-1) } MessageExtensionType; 2250 struct { 2251 MessageExtensionType type; 2252 Boolean critical; 2253 opaque extension_contents<0..2^32-1>; 2254 } MessageExtension; 2256 struct { 2257 uint16 message_code; 2258 opaque message_body<0..2^32-1>; 2259 MessageExtensions extensions<0..2^32-1>; 2260 } MessageContents; 2262 The contents of this structure are as follows: 2264 message_code 2265 This indicates the message that is being sent. The code space is 2266 broken up as follows. 2268 0 Reserved 2270 1 .. 0x7fff Requests and responses. These code points are always 2271 paired, with requests being odd and the corresponding response 2272 being the request code plus 1. Thus, "probe_request" (the 2273 Probe request) has value 1 and "probe_answer" (the Probe 2274 response) has value 2 2276 0xffff Error 2277 The message codes are defined in Section 14.8 2278 message_body 2279 The message body itself, represented as a variable-length string 2280 of bytes. The bytes themselves are dependent on the code value. 2281 See the sections describing the various RELOAD methods (Join, 2282 Update, Attach, Store, Fetch, etc.) for the definitions of the 2283 payload contents. 2284 extensions 2285 Extensions to the message. Currently no extensions are defined, 2286 but new extensions can be defined by the process described in 2287 Section 14.14. 2289 All extensions have the following form: 2291 type 2292 The extension type. 2294 critical 2295 Whether this extension must be understood in order to process the 2296 message. If critical = True and the recipient does not understand 2297 the message, it MUST generate an Error_Unknown_Extension error. 2298 If critical = False, the recipient MAY choose to process the 2299 message even if it does not understand the extension. 2301 extension_contents 2302 The contents of the extension (extension-dependent). 2304 6.3.3.1. Response Codes and Response Errors 2306 A peer processing a request returns its status in the message_code 2307 field. If the request was a success, then the message code is the 2308 response code that matches the request (i.e., the next code up). The 2309 response payload is then as defined in the request/response 2310 descriptions. 2312 If the request has failed, then the message code is set to 0xffff 2313 (error) and the payload MUST be an error_response PDU, as shown 2314 below. 2316 When the message code is 0xffff, the payload MUST be an 2317 ErrorResponse. 2319 public struct { 2320 uint16 error_code; 2321 opaque error_info<0..2^16-1>; 2322 } ErrorResponse; 2324 The contents of this structure are as follows: 2326 error_code 2327 A numeric error code indicating the error that occurred. 2329 error_info 2330 An optional arbitrary byte string. Unless otherwise specified, 2331 this will be a UTF-8 text string providing further information 2332 about what went wrong. Developers are encouraged to put enough 2333 diagnostic information to be useful in error_info. 2335 The following error code values are defined. The numeric values for 2336 these are defined in Section 14.9. 2338 Error_Forbidden: The requesting node does not have permission to 2339 make this request. 2341 Error_Not_Found: The resource or peer cannot be found or does not 2342 exist. 2344 Error_Request_Timeout: A response to the request has not been 2345 received in a suitable amount of time. The requesting node MAY 2346 resend the request at a later time. 2348 Error_Data_Too_Old: A store cannot be completed because the 2349 storage_time precedes the existing value. 2351 Error_Data_Too_Large: A store cannot be completed because the 2352 requested object exceeds the size limits for that Kind. 2354 Error_Generation_Counter_Too_Low: A store cannot be completed 2355 because the generation counter precedes the existing value. 2357 Error_Incompatible_with_Overlay: A peer receiving the request is 2358 using a different overlay, overlay algorithm, or hash algorithm, 2359 or some other parameter that is inconsistent with the overlay 2360 configuration. 2362 Error_Unsupported_Forwarding_Option: A peer receiving the request 2363 with a forwarding options flagged as critical but the peer does 2364 not support this option. See section Section 6.3.2.3. 2366 Error_TTL_Exceeded: A peer receiving the request where the TTL got 2367 decremented to zero. See section Section 6.3.2. 2369 Error_Message_Too_Large: A peer receiving the request that was too 2370 large. See section Section 6.6. 2372 Error_Response_Too_Large: A peer would have generated a response 2373 that is too large per the max_response_length field. 2375 Error_Config_Too_Old: A destination peer received a request with a 2376 configuration sequence that's too old. See Section 6.3.2.1. 2378 Error_Config_Too_New: A destination node received a request with a 2379 configuration sequence that's too new. See Section 6.3.2.1. 2381 Error_Unknown_Kind: A destination node received a request with an 2382 unknown Kind-ID. See Section 7.4.1.2. 2384 Error_In_Progress: An Attach is already in progress to this peer. 2385 See Section 6.5.1.2. 2387 Error_Unknown_Extension: A destination node received a request with 2388 an unknown extension. 2390 Error_Invalid_Message: Something about this message is invalid but 2391 it doesn't fit the other error codes. When this message is sent, 2392 implementations SHOULD provide some meaningful description in 2393 error_info to aid in debugging. 2395 6.3.4. Security Block 2397 The third part of a RELOAD message is the security block. The 2398 security block is represented by a SecurityBlock structure: 2400 struct { 2401 CertificateType type; 2402 opaque certificate<0..2^16-1>; 2403 } GenericCertificate; 2405 struct { 2406 GenericCertificate certificates<0..2^16-1>; 2407 Signature signature; 2408 } SecurityBlock; 2410 The contents of this structure are: 2412 certificates 2413 A bucket of certificates. 2415 signature 2416 A signature over the message contents. 2418 The certificates bucket SHOULD contain all the certificates necessary 2419 to verify every signature in both the message and the internal 2420 message objects, except for those certificates in a root-cert element 2421 of the current configuration file. This is the only location in the 2422 message which contains certificates, thus allowing for only a single 2423 copy of each certificate to be sent. In systems that have an 2424 alternative certificate distribution mechanism, some certificates MAY 2425 be omitted. However, unless an alternative mechanism for immediately 2426 generating certifcates, such as shared secret security (Section 13.4) 2427 is used, it is strongly RECOMMENDED that implementors include all 2428 referenced certificates, otherwise there is the possibility that 2429 messages may not be immediately verifiable because certificates must 2430 first be retrieved. 2432 NOTE TO IMPLEMENTERS: This requirement implies that a peer storing 2433 data is obligated to retain certificates for the data it holds 2434 regardless of whether it is responsible for or actually holding the 2435 certificates for the Certificate Store usage. 2437 Each certificate is represented by a GenericCertificate structure, 2438 which has the following contents: 2440 type 2441 The type of the certificate, as defined in [RFC6091]. Only the 2442 use of X.509 certificates is defined in this draft. 2444 certificate 2445 The encoded version of the certificate. For X.509 certificates, 2446 it is the DER form. 2448 The signature is computed over the payload and parts of the 2449 forwarding header. The payload, in case of a Store, may contain an 2450 additional signature computed over a StoreReq structure. All 2451 signatures are formatted using the Signature element. This element 2452 is also used in other contexts where signatures are needed. The 2453 input structure to the signature computation varies depending on the 2454 data element being signed. 2456 enum { reservedSignerIdentity(0), 2457 cert_hash(1), cert_hash_node_id(2), 2458 none(3) 2459 (255)} SignerIdentityType; 2461 struct { 2462 select (identity_type) { 2464 case cert_hash; 2465 HashAlgorithm hash_alg; // From TLS 2466 opaque certificate_hash<0..2^8-1>; 2468 case cert_hash_node_id: 2469 HashAlgorithm hash_alg; // From TLS 2470 opaque certificate_node_id_hash<0..2^8-1>; 2472 case none: 2473 /* empty */ 2474 /* This structure may be extended with new types if necessary*/ 2475 }; 2476 } SignerIdentityValue; 2478 struct { 2479 SignerIdentityType identity_type; 2480 uint16 length; 2481 SignerIdentityValue identity[SignerIdentity.length]; 2482 } SignerIdentity; 2484 struct { 2485 SignatureAndHashAlgorithm algorithm; // From TLS 2486 SignerIdentity identity; 2487 opaque signature_value<0..2^16-1>; 2488 } Signature; 2490 The signature construct contains the following values: 2492 algorithm 2493 The signature algorithm in use. The algorithm definitions are 2494 found in the IANA TLS SignatureAlgorithm Registry and 2495 HashAlgorithm registries. All implementations MUST support 2496 RSASSA-PKCS1-v1_5 [RFC3447] signatures with SHA-256 hashes. 2498 identity 2499 The identity used to form the signature. 2501 signature_value 2502 The value of the signature. 2504 There are two permitted identity formats, one for a certificate with 2505 only one node-id and one for a certificate with multiple node-ids. 2506 In the first case, the cert_hash type MUST be used. The hash_alg 2507 field is used to indicate the algorithm used to produce the hash. 2508 The certificate_hash contains the hash of the certificate object 2509 (i.e., the DER-encoded certificate). 2511 In the second case, the cert_hash_node_id type MUST be used. The 2512 hash_alg is as in cert_hash but the cert_hash_node_id is computed 2513 over the NodeId used to sign concatenated with the certificate. 2514 I.e., H(NodeID || certificate). The NodeId is represented without 2515 any framing or length fields, as simple raw bytes. This is safe 2516 because NodeIds are fixed-length for a given overlay. 2518 For signatures over messages the input to the signature is computed 2519 over: 2521 overlay || transaction_id || MessageContents || SignerIdentity 2523 where overlay and transaction_id come from the forwarding header and 2524 || indicates concatenation. 2526 The input to signatures over data values is different, and is 2527 described in Section 7.1. 2529 All RELOAD messages MUST be signed. Upon receipt (and fragment 2530 reassembly if needed) the destination node MUST verify the signature 2531 and the authorizing certificate. If the signature fails, the 2532 implementation SHOULD simply drop the message and MUST not process 2533 it. This check provides a minimal level of assurance that the 2534 sending node is a valid part of the overlay as well as cryptographic 2535 authentication of the sending node. In addition, responses MUST be 2536 checked as follows by the requesting node: 2538 1. The response to a message sent to a specific Node-ID MUST have 2539 been sent by that Node-ID. 2540 2. The response to a message sent to a Resource-Id MUST have been 2541 sent by a Node-ID which is as close to or closer to the target 2542 Resource-Id than any node in the requesting node's neighbor 2543 table. 2545 The second condition serves as a primitive check for responses from 2546 wildly wrong nodes but is not a complete check. Note that in periods 2547 of churn, it is possible for the requesting node to obtain a closer 2548 neighbor while the request is outstanding. This will cause the 2549 response to be rejected and the request to be retransmitted. 2551 In addition, some methods (especially Store) have additional 2552 authentication requirements, which are described in the sections 2553 covering those methods. 2555 6.4. Overlay Topology 2557 As discussed in previous sections, RELOAD does not itself implement 2558 any overlay topology. Rather, it relies on Topology Plugins, which 2559 allow a variety of overlay algorithms to be used while maintaining 2560 the same RELOAD core. This section describes the requirements for 2561 new topology plugins and the methods that RELOAD provides for overlay 2562 topology maintenance. 2564 6.4.1. Topology Plugin Requirements 2566 When specifying a new overlay algorithm, at least the following need 2567 to be described: 2569 o Joining procedures, including the contents of the Join message. 2570 o Stabilization procedures, including the contents of the Update 2571 message, the frequency of topology probes and keepalives, and the 2572 mechanism used to detect when peers have disconnected. 2573 o Exit procedures, including the contents of the Leave message. 2574 o The length of the Resource-IDs. For DHTs, the hash algorithm to 2575 compute the hash of an identifier. 2576 o The procedures that peers use to route messages. 2577 o The replication strategy used to ensure data redundancy. 2579 All overlay algorithms MUST specify maintenance procedures that send 2580 Updates to clients and peers that have established connections to the 2581 peer responsible for a particular ID when the responsibility for that 2582 ID changes. Because tracking this information is difficult, overlay 2583 algorithms MAY simply specify that an Update is sent to all members 2584 of the Connection Table whenever the range of IDs for which the peer 2585 is responsible changes. 2587 6.4.2. Methods and types for use by topology plugins 2589 This section describes the methods that topology plugins use to join, 2590 leave, and maintain the overlay. 2592 6.4.2.1. Join 2594 A new peer (but one that already has credentials) uses the JoinReq 2595 message to join the overlay. The JoinReq is sent to the responsible 2596 peer depending on the routing mechanism described in the topology 2597 plugin. This notifies the responsible peer that the new peer is 2598 taking over some of the overlay and it needs to synchronize its 2599 state. 2601 struct { 2602 NodeId joining_peer_id; 2603 opaque overlay_specific_data<0..2^16-1>; 2604 } JoinReq; 2606 The minimal JoinReq contains only the Node-ID which the sending peer 2607 wishes to assume. Overlay algorithms MAY specify other data to 2608 appear in this request. Receivers of the JoinReq MUST verify that 2609 the joining_peer_id field matches the Node-ID used to sign the 2610 message and if not MUST reject the message with an Error_Forbidden 2611 error. 2613 Because joins may only be executed between nodes which are directly 2614 adjacent, receiving peers MUST verify that any JoinReq they receive 2615 arrives from a transport channel that is bound to the Node-Id to be 2616 assumed by the joining peer.) This also prevents replay attacks 2617 provided that DTLS anti-replay is used. 2619 If the request succeeds, the responding peer responds with a JoinAns 2620 message, as defined below: 2622 struct { 2623 opaque overlay_specific_data<0..2^16-1>; 2624 } JoinAns; 2626 If the request succeeds, the responding peer MUST follow up by 2627 executing the right sequence of Stores and Updates to transfer the 2628 appropriate section of the overlay space to the joining peer. In 2629 addition, overlay algorithms MAY define data to appear in the 2630 response payload that provides additional info. 2632 Joining nodes MUST verify that the signature on the JoinAns message 2633 matches the expected target (i.e., the adjacency over which they are 2634 joining.) If not, they MUST discard the message. 2636 In general, nodes which cannot form connections SHOULD report an 2637 error to the user. However, implementations MUST provide some 2638 mechanism whereby nodes can determine that they are potentially the 2639 first node and take responsibility for the overlay (the idea is to 2640 avoid having ordinary nodes try to become responsible for the entire 2641 overlay during a partition.) This specification does not mandate any 2642 particular mechanism, but a configuration flag or setting seems 2643 appropriate. 2645 6.4.2.2. Leave 2647 The LeaveReq message is used to indicate that a node is exiting the 2648 overlay. A node SHOULD send this message to each peer with which it 2649 is directly connected prior to exiting the overlay. 2651 struct { 2652 NodeId leaving_peer_id; 2653 opaque overlay_specific_data<0..2^16-1>; 2654 } LeaveReq; 2656 LeaveReq contains only the Node-ID of the leaving peer. Overlay 2657 algorithms MAY specify other data to appear in this request. 2658 Receivers of the LeaveReq MUST verify that the leaving_peer_id field 2659 matches the Node-ID used to sign the message and if not MUST reject 2660 the message with an Error_Forbidden error. 2662 Because leaves may only be executed between nodes which are directly 2663 adjacent, receiving peers MUST verify that any LeaveReq they receive 2664 arrives from a transport channel that is bound to the Node-Id to be 2665 assumed by the leaving peer.) This also prevents replay attacks 2666 provided that DTLS anti-replay is used. 2668 Upon receiving a Leave request, a peer MUST update its own routing 2669 table, and send the appropriate Store/Update sequences to re- 2670 stabilize the overlay. 2672 6.4.2.3. Update 2674 Update is the primary overlay-specific maintenance message. It is 2675 used by the sender to notify the recipient of the sender's view of 2676 the current state of the overlay (its routing state), and it is up to 2677 the recipient to take whatever actions are appropriate to deal with 2678 the state change. In general, peers send Update messages to all 2679 their adjacencies whenever they detect a topology shift. 2681 When a peer receives an Attach request with the send_update flag set 2682 to "true" (Section 6.4.2.4.1, it MUST send an Update message back to 2683 the sender of the Attach request after the completion of the 2684 corresponding ICE check and TLS connection. Note that the sender of 2685 a such Attach request may not have joined the overlay yet. 2687 When a peer detects through an Update that it is no longer 2688 responsible for any data value it is storing, it MUST attempt to 2689 Store a copy to the correct node unless it knows the newly 2690 responsible node already has a copy of the data. This prevents data 2691 loss during large-scale topology shifts such as the merging of 2692 partitioned overlays. 2694 The contents of the UpdateReq message are completely overlay- 2695 specific. The UpdateAns response is expected to be either success or 2696 an error. 2698 6.4.2.4. RouteQuery 2700 The RouteQuery request allows the sender to ask a peer where they 2701 would route a message directed to a given destination. In other 2702 words, a RouteQuery for a destination X requests the Node-ID for the 2703 node that the receiving peer would next route to in order to get to 2704 X. A RouteQuery can also request that the receiving peer initiate an 2705 Update request to transfer the receiving peer's routing table. 2707 One important use of the RouteQuery request is to support iterative 2708 routing. The sender selects one of the peers in its routing table 2709 and sends it a RouteQuery message with the destination_object set to 2710 the Node-ID or Resource-ID it wishes to route to. The receiving peer 2711 responds with information about the peers to which the request would 2712 be routed. The sending peer MAY then use the Attach method to attach 2713 to that peer(s), and repeat the RouteQuery. Eventually, the sender 2714 gets a response from a peer that is closest to the identifier in the 2715 destination_object as determined by the topology plugin. At that 2716 point, the sender can send messages directly to that peer. 2718 6.4.2.4.1. Request Definition 2720 A RouteQueryReq message indicates the peer or resource that the 2721 requesting node is interested in. It also contains a "send_update" 2722 option allowing the requesting node to request a full copy of the 2723 other peer's routing table. 2725 struct { 2726 Boolean send_update; 2727 Destination destination; 2728 opaque overlay_specific_data<0..2^16-1>; 2730 } RouteQueryReq; 2732 The contents of the RouteQueryReq message are as follows: 2734 send_update 2735 A single byte. This may be set to "true" to indicate that the 2736 requester wishes the responder to initiate an Update request 2737 immediately. Otherwise, this value MUST be set to "false". 2739 destination 2740 The destination which the requester is interested in. This may be 2741 any valid destination object, including a Node-ID, opaque ids, or 2742 Resource-ID. 2744 overlay_specific_data 2745 Other data as appropriate for the overlay. 2747 6.4.2.4.2. Response Definition 2749 A response to a successful RouteQueryReq request is a RouteQueryAns 2750 message. This is completely overlay specific. 2752 6.4.2.5. Probe 2754 Probe provides primitive "exploration" services: it allows node to 2755 determine which resources another node is responsible for; and it 2756 allows some discovery services using multicast, anycast, or 2757 broadcast. A probe can be addressed to a specific Node-ID, or the 2758 peer controlling a given location (by using a Resource-ID). In 2759 either case, the target Node-IDs respond with a simple response 2760 containing some status information. 2762 6.4.2.5.1. Request Definition 2764 The ProbeReq message contains a list (potentially empty) of the 2765 pieces of status information that the requester would like the 2766 responder to provide. 2768 enum { reservedProbeInformation(0), responsible_set(1), 2769 num_resources(2), uptime(3), (255)} 2770 ProbeInformationType; 2772 struct { 2773 ProbeInformationType requested_info<0..2^8-1>; 2774 } ProbeReq 2776 The currently defined values for ProbeInformation are: 2778 responsible_set 2779 indicates that the peer should Respond with the fraction of the 2780 overlay for which the responding peer is responsible. 2782 num_resources 2783 indicates that the peer should Respond with the number of 2784 resources currently being stored by the peer. 2786 uptime 2787 indicates that the peer should Respond with how long the peer has 2788 been up in seconds. 2790 6.4.2.5.2. Response Definition 2792 A successful ProbeAns response contains the information elements 2793 requested by the peer. 2795 struct { 2796 select (type) { 2797 case responsible_set: 2798 uint32 responsible_ppb; 2800 case num_resources: 2801 uint32 num_resources; 2803 case uptime: 2804 uint32 uptime; 2805 /* This type may be extended */ 2807 }; 2808 } ProbeInformationData; 2810 struct { 2811 ProbeInformationType type; 2812 uint8 length; 2813 ProbeInformationData value; 2814 } ProbeInformation; 2816 struct { 2817 ProbeInformation probe_info<0..2^16-1>; 2818 } ProbeAns; 2820 A ProbeAns message contains a sequence of ProbeInformation 2821 structures. Each has a "length" indicating the length of the 2822 following value field. This structure allows for unknown option 2823 types. 2825 Each of the current possible Probe information types is a 32-bit 2826 unsigned integer. For type "responsible_ppb", it is the fraction of 2827 the overlay for which the peer is responsible in parts per billion. 2828 For type "num_resources", it is the number of resources the peer is 2829 storing. For the type "uptime" it is the number of seconds the peer 2830 has been up. 2832 The responding peer SHOULD include any values that the requesting 2833 node requested and that it recognizes. They SHOULD be returned in 2834 the requested order. Any other values MUST NOT be returned. 2836 6.5. Forwarding and Link Management Layer 2838 Each node maintains connections to a set of other nodes defined by 2839 the topology plugin. This section defines the methods RELOAD uses to 2840 form and maintain connections between nodes in the overlay. Three 2841 methods are defined: 2843 Attach: used to form RELOAD connections between nodes using ICE 2844 for NAT traversal. When node A wants to connect to node B, it 2845 sends an Attach message to node B through the overlay. The Attach 2846 contains A's ICE parameters. B responds with its ICE parameters 2847 and the two nodes perform ICE to form connection. Attach also 2848 allows two nodes to connect via No-ICE instead of full ICE. 2849 AppAttach: used to form application layer connections between 2850 nodes. 2851 Ping: is a simple request/response which is used to verify 2852 connectivity of the target peer. 2854 6.5.1. Attach 2856 A node sends an Attach request when it wishes to establish a direct 2857 TCP or UDP connection to another node for the purpose of sending 2858 RELOAD messages. A client that can establish a connection directly 2859 need not send an attach as described in the second bullet of 2860 Section 3.2.1 2862 As described in Section 6.1, an Attach may be routed to either a 2863 Node-ID or to a Resource-ID. An Attach routed to a specific Node-ID 2864 will fail if that node is not reached. An Attach routed to a 2865 Resource-ID will establish a connection with the peer currently 2866 responsible for that Resource-ID, which may be useful in establishing 2867 a direct connection to the responsible peer for use with frequent or 2868 large resource updates. 2870 An Attach in and of itself does not result in updating the routing 2871 table of either node. That function is performed by Updates. If 2872 node A has Attached to node B, but not received any Updates from B, 2873 it MAY route messages which are directly addressed to B through that 2874 channel but MUST NOT route messages through B to other peers via that 2875 channel. The process of Attaching is separate from the process of 2876 becoming a peer (using Join and Update), to prevent half-open states 2877 where a node has started to form connections but is not really ready 2878 to act as a peer. Thus, clients (unlike peers) can simply Attach 2879 without sending Join or Update. 2881 6.5.1.1. Request Definition 2883 An Attach request message contains the requesting node ICE connection 2884 parameters formatted into a binary structure. 2886 enum { reservedOverlayLink(0), DTLS-UDP-SR(1), 2887 DTLS-UDP-SR-NO-ICE(3), TLS-TCP-FH-NO-ICE(4), 2888 (255) } OverlayLinkType; 2890 enum { reservedCand(0), host(1), srflx(2), prflx(3), relay(4), 2891 (255) } CandType; 2893 struct { 2894 opaque name<0..2^16-1>; 2895 opaque value<0..2^16-1>; 2896 } IceExtension; 2898 struct { 2899 IpAddressPort addr_port; 2900 OverlayLinkType overlay_link; 2901 opaque foundation<0..255>; 2902 uint32 priority; 2903 CandType type; 2904 select (type){ 2905 case host: 2906 ; /* Nothing */ 2907 case srflx: 2908 case prflx: 2909 case relay: 2910 IpAddressPort rel_addr_port; 2911 }; 2912 IceExtension extensions<0..2^16-1>; 2913 } IceCandidate; 2915 struct { 2916 opaque ufrag<0..2^8-1>; 2917 opaque password<0..2^8-1>; 2918 opaque role<0..2^8-1>; 2919 IceCandidate candidates<0..2^16-1>; 2920 Boolean send_update; 2921 } AttachReqAns; 2923 The values contained in AttachReqAns are: 2925 ufrag 2926 The username fragment (from ICE). 2928 password 2929 The ICE password. 2931 role 2932 An active/passive/actpass attribute from RFC 4145 [RFC4145]. This 2933 value MUST be 'passive' for the offerer (the peer sending the 2934 Attach request) and 'active' for the answerer (the peer sending 2935 the Attach response). 2937 candidates 2938 One or more ICE candidate values, as described below. 2939 send_update 2940 Has the same meaning as the send_update field in RouteQueryReq. 2942 Each ICE candidate is represented as an IceCandidate structure, which 2943 is a direct translation of the information from the ICE string 2944 structures, with the exception of the component ID. Since there is 2945 only one component, it is always 1, and thus left out of the PDU. 2946 The remaining values are specified as follows: 2948 addr_port 2949 corresponds to the connection-address and port productions. 2951 overlay_link 2952 corresponds to the OverlayLinkType production, Overlay Link 2953 protocols used with No-ICE MUST specify "No-ICE" in their 2954 description. Future overlay link values can be added be defining 2955 new OverlayLinkType values in the IANA registry in Section 14.10. 2956 Future extensions to the encapsulation or framing that provide for 2957 backward compatibility with that specified by a previously defined 2958 OverlayLinkType values MUST use that previous value. 2959 OverlayLinkType protocols are defined in Section 6.6 2960 A single AttachReqAns MUST NOT include both candidates whose 2961 OverlayLinkType protocols use ICE (the default) and candidates 2962 that specify "No-ICE". 2964 foundation 2965 corresponds to the foundation production. 2967 priority 2968 corresponds to the priority production. 2970 type 2971 corresponds to the cand-type production. 2973 rel_addr_port 2974 corresponds to the rel-addr and rel-port productions. Only 2975 present for type "relay". 2977 extensions 2978 ICE extensions. The name and value fields correspond to binary 2979 translations of the equivalent fields in the ICE extensions. 2981 These values should be generated using the procedures described in 2982 Section 6.5.1.3. 2984 6.5.1.2. Response Definition 2986 If a peer receives an Attach request, it MUST determine how to 2987 process the request as follows: 2989 o If it has not initiated an Attach request to the originating peer 2990 of this Attach request, it MUST process this request and SHOULD 2991 generate its own response with an AttachReqAns. It should then 2992 begin ICE checks. 2993 o If it has already sent an Attach request to and received the 2994 response from the originating peer of this Attach request, and as 2995 a result, an ICE check and TLS connection is in progress, then it 2996 SHOULD generate an Error_In_Progress error instead of an 2997 AttachReqAns. 2998 o If it has already sent an Attach request to but not yet received 2999 the response from the originating peer of this Attach request, it 3000 SHOULD apply the following tie-breaker heuristic to determine how 3001 to handle this Attach request and the incomplete Attach request it 3002 has sent out: 3003 * If the peer's own Node-ID is smaller when compared as big- 3004 endian unsigned integers, it MUST cancel its own incomplete 3005 Attach request. It MUST then process this Attach request, 3006 generate an AttachReqAns response, and proceed with the 3007 corresponding ICE check. 3008 * If the peer's own Node-ID is larger when compared as big-endien 3009 unsigned integers, it MUST generate an Error_In_Progress error 3010 to this Attach request, then proceed to wait for and complete 3011 the Attach and the corresponding ICE check it has originated. 3012 o If the peer is overloaded or detects some other kind of error, it 3013 MAY generate an error instead of an AttachReqAns. 3015 When a peer receives an Attach response, it SHOULD parse the response 3016 and begin its own ICE checks. 3018 6.5.1.3. Using ICE With RELOAD 3020 This section describes the profile of ICE that is used with RELOAD. 3021 RELOAD implementations MUST implement full ICE. 3023 In ICE as defined by [RFC5245], SDP is used to carry the ICE 3024 parameters. In RELOAD, this function is performed by a binary 3025 encoding in the Attach method. This encoding is more restricted than 3026 the SDP encoding because the RELOAD environment is simpler: 3028 o Only a single media stream is supported. 3029 o In this case, the "stream" refers not to RTP or other types of 3030 media, but rather to a connection for RELOAD itself or other 3031 application-layer protocols such as SIP. 3032 o RELOAD only allows for a single offer/answer exchange. Unlike the 3033 usage of ICE within SIP, there is never a need to send a 3034 subsequent offer to update the default candidates to match the 3035 ones selected by ICE. 3037 An agent follows the ICE specification as described in [RFC5245] with 3038 the changes and additional procedures described in the subsections 3039 below. 3041 6.5.1.4. Collecting STUN Servers 3043 ICE relies on the node having one or more STUN servers to use. In 3044 conventional ICE, it is assumed that nodes are configured with one or 3045 more STUN servers through some out of band mechanism. This is still 3046 possible in RELOAD but RELOAD also learns STUN servers as it connects 3047 to other peers. Because all RELOAD peers implement ICE and use STUN 3048 keepalives, every peer is a capable of responding to STUN Binding 3049 requests [RFC5389]. Accordingly, any peer that a node knows about 3050 can be used like a STUN server -- though of course it may be behind a 3051 NAT. 3053 A peer on a well-provisioned wide-area overlay will be configured 3054 with one or more bootstrap nodes. These nodes make an initial list 3055 of STUN servers. However, as the peer forms connections with 3056 additional peers, it builds more peers it can use like STUN servers. 3058 Because complicated NAT topologies are possible, a peer may need more 3059 than one STUN server. Specifically, a peer that is behind a single 3060 NAT will typically observe only two IP addresses in its STUN checks: 3061 its local address and its server reflexive address from a STUN server 3062 outside its NAT. However, if there are more NATs involved, it may 3063 learn additional server reflexive addresses (which vary based on 3064 where in the topology the STUN server is). To maximize the chance of 3065 achieving a direct connection, a peer SHOULD group other peers by the 3066 peer-reflexive addresses it discovers through them. It SHOULD then 3067 select one peer from each group to use as a STUN server for future 3068 connections. 3070 Only peers to which the peer currently has connections may be used. 3071 If the connection to that host is lost, it MUST be removed from the 3072 list of stun servers and a new server from the same group MUST be 3073 selected unless there are no others servers in the group in which 3074 case some other peer MAY be used. 3076 6.5.1.5. Gathering Candidates 3078 When a node wishes to establish a connection for the purposes of 3079 RELOAD signaling or application signaling, it follows the process of 3080 gathering candidates as described in Section 4 of ICE [RFC5245]. 3081 RELOAD utilizes a single component. Consequently, gathering for 3082 these "streams" requires a single component. In the case where a 3083 node has not yet found a TURN server, the agent would not include a 3084 relayed candidate. 3086 The ICE specification assumes that an ICE agent is configured with, 3087 or somehow knows of, TURN and STUN servers. RELOAD provides a way 3088 for an agent to learn these by querying the overlay, as described in 3089 Section 6.5.1.4 and Section 9. 3091 The default candidate selection described in Section 4.1.4 of ICE is 3092 ignored; defaults are not signaled or utilized by RELOAD. 3094 An alternative to using the full ICE supported by the Attach request 3095 is to use No-ICE mechanism by providing candidates with "No-ICE" 3096 Overlay Link protocols. Configuration for the overlay indicates 3097 whether or not these Overlay Link protocols can be used. An overlay 3098 MUST be either all ICE or all No-ICE. 3100 No-ICE will not work in all of the scenarios where ICE would work, 3101 but in some cases, particularly those with no NATs or firewalls, it 3102 will work. 3104 6.5.1.6. Prioritizing Candidates 3106 However, standardization of additional protocols for use with ICE is 3107 expected, including TCP[I-D.ietf-mmusic-ice-tcp] and protocols such 3108 as SCTP and DCCP. UDP encapsulations for SCTP and DCCP would expand 3109 the available Overlay Link protocols available for RELOAD. When 3110 additional protocols are available, the following prioritization is 3111 RECOMMENDED: 3113 o Highest priority is assigned to protocols that offer well- 3114 understood congestion and flow control without head of line 3115 blocking. For example, SCTP without message ordering, DCCP, or 3116 those protocols encapsulated using UDP. 3117 o Second highest priority is assigned to protocols that offer well- 3118 understood congestion and flow control but have head of line 3119 blocking such as TCP. 3120 o Lowest priority is assigned to protocols encapsulated over UDP 3121 that do not implement well-established congestion control 3122 algorithms. The DTLS/UDP with SR overlay link protocol is an 3123 example of such a protocol. 3125 Head of line blocking is undesireable in an Overlay Link protocol 3126 because the messages carried on a RELOAD link are independent, rather 3127 than stream-oriented. Therefore, if message N on a link is lost, 3128 delaying message N+1 on that same link until N is successfully 3129 retransmitted does nothing other than increase the latency for the 3130 transaction of message N+1 as they are unrelated to each other. 3131 Therefore, while the high quality, performance, and availability of 3132 modern TCP implementations makes them very attractive, their 3133 performance as an Overlay Link protocol is not optimal. 3135 6.5.1.7. Encoding the Attach Message 3137 Section 4.3 of ICE describes procedures for encoding the SDP for 3138 conveying RELOAD candidates. Instead of actually encoding an SDP 3139 message, the candidate information (IP address and port and transport 3140 protocol, priority, foundation, type and related address) is carried 3141 within the attributes of the Attach request or its response. 3142 Similarly, the username fragment and password are carried in the 3143 Attach message or its response. Section 6.5.1 describes the detailed 3144 attribute encoding for Attach. The Attach request and its response 3145 do not contain any default candidates or the ice-lite attribute, as 3146 these features of ICE are not used by RELOAD. 3148 Since the Attach request contains the candidate information and short 3149 term credentials, it is considered as an offer for a single media 3150 stream that happens to be encoded in a format different than SDP, but 3151 is otherwise considered a valid offer for the purposes of following 3152 the ICE specification. Similarly, the Attach response is considered 3153 a valid answer for the purposes of following the ICE specification. 3155 6.5.1.8. Verifying ICE Support 3157 An agent MUST skip the verification procedures in Section 5.1 and 6.1 3158 of ICE. Since RELOAD requires full ICE from all agents, this check 3159 is not required. 3161 6.5.1.9. Role Determination 3163 The roles of controlling and controlled as described in Section 5.2 3164 of ICE are still utilized with RELOAD. However, the offerer (the 3165 entity sending the Attach request) will always be controlling, and 3166 the answerer (the entity sending the Attach response) will always be 3167 controlled. The connectivity checks MUST still contain the ICE- 3168 CONTROLLED and ICE-CONTROLLING attributes, however, even though the 3169 role reversal capability for which they are defined will never be 3170 needed with RELOAD. This is to allow for a common codebase between 3171 ICE for RELOAD and ICE for SDP. 3173 6.5.1.10. Full ICE 3175 When the overlay uses ICE , connectivity checks and nominations are 3176 used as in regular ICE. 3178 6.5.1.10.1. Connectivity Checks 3180 The processes of forming check lists in Section 5.7 of ICE, 3181 scheduling checks in Section 5.8, and checking connectivity checks in 3182 Section 7 are used with RELOAD without change. 3184 6.5.1.10.2. Concluding ICE 3186 The procedures in Section 8 of ICE are followed to conclude ICE, with 3187 the following exceptions: 3189 o The controlling agent MUST NOT attempt to send an updated offer 3190 once the state of its single media stream reaches Completed. 3191 o Once the state of ICE reaches Completed, the agent can immediately 3192 free all unused candidates. This is because RELOAD does not have 3193 the concept of forking, and thus the three second delay in Section 3194 8.3 of ICE does not apply. 3196 6.5.1.10.3. Media Keepalives 3198 STUN MUST be utilized for the keepalives described in Section 10 of 3199 ICE. 3201 6.5.1.11. No-ICE 3203 No-ICE is selected when either side has provided "no ICE" Overlay 3204 Link candidates. STUN is not used for connectivity checks when doing 3205 No-ICE; instead the DTLS or TLS handshake (or similar security layer 3206 of future overlay link protocols) forms the connectivity check. The 3207 certificate exchanged during the (D)TLS handshake MUST match the node 3208 that sent the AttachReqAns and if it does not, the connection MUST be 3209 closed. 3211 6.5.1.12. Subsequent Offers and Answers 3213 An agent MUST NOT send a subsequent offer or answer. Thus, the 3214 procedures in Section 9 of ICE MUST be ignored. 3216 6.5.1.13. Sending Media 3218 The procedures of Section 11 of ICE apply to RELOAD as well. 3219 However, in this case, the "media" takes the form of application 3220 layer protocols (e.g. RELOAD) over TLS or DTLS. Consequently, once 3221 ICE processing completes, the agent will begin TLS or DTLS procedures 3222 to establish a secure connection. The node which sent the Attach 3223 request MUST be the TLS server. The other node MUST be the TLS 3224 client. The server MUST request TLS client authentication. The 3225 nodes MUST verify that the certificate presented in the handshake 3226 matches the identity of the other peer as found in the Attach 3227 message. Once the TLS or DTLS signaling is complete, the application 3228 protocol is free to use the connection. 3230 The concept of a previous selected pair for a component does not 3231 apply to RELOAD, since ICE restarts are not possible with RELOAD. 3233 6.5.1.14. Receiving Media 3235 An agent MUST be prepared to receive packets for the application 3236 protocol (TLS or DTLS carrying RELOAD, SIP or anything else) at any 3237 time. The jitter and RTP considerations in Section 11 of ICE do not 3238 apply to RELOAD. 3240 6.5.2. AppAttach 3242 A node sends an AppAttach request when it wishes to establish a 3243 direct connection to another node for the purposes of sending 3244 application layer messages. AppAttach is nearly identical to Attach, 3245 except for the purpose of the connection: it is used to transport 3246 non-RELOAD "media". A separate request is used to avoid implementor 3247 confusion between the two methods (this was found to be a real 3248 problem with initial implementations). The AppAttach request and its 3249 response contain an application attribute, which indicates what 3250 protocol is to be run over the connection. 3252 6.5.2.1. Request Definition 3254 An AppAttachReq message contains the requesting node's ICE connection 3255 parameters formatted into a binary structure. 3257 struct { 3258 opaque ufrag<0..2^8-1>; 3259 opaque password<0..2^8-1>; 3260 uint16 application; 3261 opaque role<0..2^8-1>; 3262 IceCandidate candidates<0..2^16-1>; 3263 } AppAttachReq; 3265 The values contained in AppAttachReq and AppAttachAns are: 3267 ufrag 3268 The username fragment (from ICE) 3270 password 3271 The ICE password. 3273 application 3274 A 16-bit application-id as defined in the Section 14.5. This 3275 number represents the IANA registered application that is going to 3276 send data on this connection. 3278 role 3279 An active/passive/actpass attribute from RFC 4145 [RFC4145]. 3281 candidates 3282 One or more ICE candidate values 3284 The application using connection set up with this request is 3285 responsible for providing sufficiently frequent keep traffic for NAT 3286 and Firewall keep alive and for deciding when to close the 3287 connection. 3289 6.5.2.2. Response Definition 3291 If a peer receives an AppAttach request, it SHOULD process the 3292 request and generate its own response with a AppAttachAns. It should 3293 then begin ICE checks. When a peer receives an AppAttach response, 3294 it SHOULD parse the response and begin its own ICE checks. If the 3295 application ID is not supported, the peer MUST reply with an 3296 Error_Not_Found error. 3298 struct { 3299 opaque ufrag<0..2^8-1>; 3300 opaque password<0..2^8-1>; 3301 uint16 application; 3302 opaque role<0..2^8-1>; 3303 IceCandidate candidates<0..2^16-1>; 3305 } AppAttachAns; 3307 The meaning of the fields is the same as in the AppAttachReq. 3309 6.5.3. Ping 3311 Ping is used to test connectivity along a path. A ping can be 3312 addressed to a specific Node-ID, to the peer controlling a given 3313 location (by using a resource ID), or to the broadcast Node-ID 3314 (2^128-1). 3316 6.5.3.1. Request Definition 3318 struct { 3319 opaque<0..2^16-1> padding; 3320 } PingReq 3322 The Ping request is empty of meaningful contents. However, it may 3323 contain up to 65535 bytes of padding to facilitate the discovery of 3324 overlay maximum packet sizes. 3326 6.5.3.2. Response Definition 3328 A successful PingAns response contains the information elements 3329 requested by the peer. 3331 struct { 3332 uint64 response_id; 3333 uint64 time; 3334 } PingAns; 3336 A PingAns message contains the following elements: 3338 response_id 3339 A randomly generated 64-bit response ID. This is used to 3340 distinguish Ping responses. 3342 time 3343 The time when the Ping response was created represented in the 3344 same way as storage_time defined in Section 7. 3346 6.5.4. ConfigUpdate 3348 The ConfigUpdate method is used to push updated configuration data 3349 across the overlay. Whenever a node detects that another node has 3350 old configuration data, it MUST generate a ConfigUpdate request. The 3351 ConfigUpdate request allows updating of two kinds of data: the 3352 configuration data (Section 6.3.2.1) and the Kind information 3353 (Section 7.4.1.1). 3355 6.5.4.1. Request Definition 3357 enum { reservedConfigUpdate(0), config(1), kind(2), (255) } 3358 ConfigUpdateType; 3360 typedef uint32 KindId; 3361 typedef opaque KindDescription<0..2^16-1>; 3363 struct { 3364 ConfigUpdateType type; 3365 uint32 length; 3367 select (type) { 3368 case config: 3369 opaque config_data<0..2^24-1>; 3371 case kind: 3372 KindDescription kinds<0..2^24-1>; 3374 /* This structure may be extended with new types*/ 3375 }; 3376 } ConfigUpdateReq; 3378 The ConfigUpdateReq message contains the following elements: 3380 type 3381 The type of the contents of the message. This structure allows 3382 for unknown content types. 3383 length 3384 The length of the remainder of the message. This is included to 3385 preserve backward compatibility and is 32 bits instead of 24 to 3386 facilitate easy conversion between network and host byte order. 3387 config_data (type==config) 3388 The contents of the configuration document. 3390 kinds (type==kind) 3391 One or more XML kind-block productions (see Section 11.1). These 3392 MUST be encoded with UTF-8 and assume a default namespace of 3393 "urn:ietf:params:xml:ns:p2p:config-base". 3395 6.5.4.2. Response Definition 3397 struct { 3398 } ConfigUpdateAns 3400 If the ConfigUpdateReq is of type "config" it MUST only be processed 3401 if all the following are true: 3402 o The sequence number in the document is greater than the current 3403 configuration sequence number. 3404 o The configuration document is correctly digitally signed (see 3405 Section 11 for details on signatures. 3406 Otherwise appropriate errors MUST be generated. 3408 If the ConfigUpdateReq is of type "kind" it MUST only be processed if 3409 it is correctly digitally signed by an acceptable Kind signer (i.e., 3410 one listed in the current configuration file). Details on kind- 3411 signer field in the configuration file is described in Section 11.1. 3412 In addition, if the Kind update conflicts with an existing known Kind 3413 (i.e., it is signed by a different signer), then it should be 3414 rejected with "Error_Forbidden". This should not happen in correctly 3415 functioning overlays. 3417 If the update is acceptable, then the node MUST reconfigure itself to 3418 match the new information. This may include adding permissions for 3419 new Kinds, deleting old Kinds, or even, in extreme circumstances, 3420 exiting and reentering the overlay, if, for instance, the DHT 3421 algorithm has changed. 3423 If an implementation receives repeated ConfigUpdates which it cannot 3424 verify with sequence numbers substantially in advance of its own 3425 configuration document, it SHOULD contact the configuration server to 3426 get the latest configuration file in order to avoid permanent 3427 breakage. The details of this are left up to the implementation. 3429 The response for ConfigUpdate is empty. 3431 6.6. Overlay Link Layer 3433 RELOAD can use multiple Overlay Link protocols to send its messages. 3434 Because ICE is used to establish connections (see Section 6.5.1.3), 3435 RELOAD nodes are able to detect which Overlay Link protocols are 3436 offered by other nodes and establish connections between them. Any 3437 link protocol needs to be able to establish a secure, authenticated 3438 connection and to provide data origin authentication and message 3439 integrity for individual data elements. RELOAD currently supports 3440 three Overlay Link protocols: 3442 o DTLS [RFC4347] over UDP with Simple Reliability (SR) 3443 (OverlayLinkType=DTLS-UDP-SR 3444 o TLS [RFC5246] over TCP with Framing Header, No-ICE 3445 (OverlayLinkType=TLS-TCP-FH-NO-ICE 3446 o DTLS [RFC4347] over UDP with SR, No-ICE (OverlayLinkType=DTLS-UDP- 3447 SR-NO-ICE) 3449 Note that although UDP does not properly have "connections", both TLS 3450 and DTLS have a handshake which establishes a similar, stateful 3451 association, and we simply refer to these as "connections" for the 3452 purposes of this document. 3454 If a peer receives a message that is larger than value of max- 3455 message-size defined in the overlay configuration, the peer SHOULD 3456 send an Error_Message_Too_Large error and then close the TLS or DTLS 3457 session from which the message was received. Note that this error 3458 can be sent and the session closed before receiving the complete 3459 message. If the forwarding header is larger than the max-message- 3460 size, the receiver SHOULD close the TLS or DTLS session without 3461 sending an error. 3463 The Framing Header (FH) is used to frame messages and provide timing 3464 when used on a reliable stream-based transport protocol. Simple 3465 Reliability (SR) makes use of the FH to provide congestion control 3466 and semi-reliability when using unreliable message-oriented transport 3467 protocols. We will first define each of these algorithms, then 3468 define overlay link protocols that use them. 3470 Note: We expect future Overlay Link protocols to define replacements 3471 for all components of these protocols, including the framing header. 3472 These protocols have been chosen for simplicity of implementation and 3473 reasonable performance. 3475 Note to implementers: There are inherent tradeoffs in utilizing 3476 short timeouts to determine when a link has failed. To balance the 3477 tradeoffs, an implementation SHOULD quickly act to remove entries 3478 from the routing table when there is reason to suspect the link has 3479 failed. For example, in a Chord derived overlay algorithm, a closer 3480 finger table entry could be substituted for an entry in the finger 3481 table that has experienced a timeout. That entry can be restored if 3482 it proves to resume functioning, or replaced at some point in the 3483 future if necessary. End-to-end retransmissions will handle any lost 3484 messages, but only if the failing entries do not remain in the finger 3485 table for subsequent retransmissions. 3487 6.6.1. Future Overlay Link Protocols 3489 It is possible to define new link-layer protocols and apply them to a 3490 new overlay using the "overlay-link-protocol" configuration directive 3491 (see Section 11.1.). However, any new protocols MUST meet the 3492 following requirements. 3494 Endpoint authentication When a node forms an association with 3495 another endpoint, it MUST be possible to cryptographically verify 3496 that the endpoint has a given Node-Id. 3498 Traffic origin authentication and integrity When a node receives 3499 traffic from another endpoint, it MUST be possible to 3500 cryptographically verify that the traffic came from a given 3501 association and that it has not been modified in transit from the 3502 other endpoint in the association. The overlay link protocol MUST 3503 also provide replay prevention/detection. 3505 Traffic confidentiality When a node sends traffic to another 3506 endpoint, it MUST NOT be possible for a third party not involved 3507 in the association to determine the contents of that traffic. 3509 Any new overlay protocol MUST be defined via RFC 5226 Standards 3510 Action; see Section 14.11. 3512 6.6.1.1. HIP 3514 In a Host Identity Protocol Based Overlay Networking Environment (HIP 3515 BONE) [RFC6079] HIP [RFC5201] provides connection management (e.g., 3516 NAT traversal and mobility) and security for the overlay network. 3517 The P2PSIP Working Group has expressed interest in supporting a HIP- 3518 based link protocol. Such support would require specifying such 3519 details as: 3521 o How to issue certificates which provided identities meaningful to 3522 the HIP base exchange. We anticipate that this would require a 3523 mapping between ORCHIDs and NodeIds. 3524 o How to carry the HIP I1 and I2 messages. 3525 o How to carry RELOAD messages over HIP. 3527 [I-D.ietf-hip-reload-instance] documents work in progress on using 3528 RELOAD with the HIP BONE. 3530 6.6.1.2. ICE-TCP 3532 The ICE-TCP draft [I-D.ietf-mmusic-ice-tcp] allows TCP to be 3533 supported as an Overlay Link protocol that can be added using ICE. 3535 6.6.1.3. Message-oriented Transports 3537 Modern message-oriented transports offer high performance, good 3538 congestion control, and avoid head of line blocking in case of lost 3539 data. These characteristics make them preferable as underlying 3540 transport protocols for RELOAD links. SCTP without message ordering 3541 and DCCP are two examples of such protocols. However, currently they 3542 are not well-supported by commonly available NATs, and specifications 3543 for ICE session establishment are not available. 3545 6.6.1.4. Tunneled Transports 3547 As of the time of this writing, there is significant interest in the 3548 IETF community in tunneling other transports over UDP, motivated by 3549 the situation that UDP is well-supported by modern NAT hardware, and 3550 similar performance can be achieved to native implementation. 3551 Currently SCTP, DCCP, and a generic tunneling extension are being 3552 proposed for message-oriented protocols. Once ICE traversal has been 3553 specified for these tunneled protocols, they should be 3554 straightforward to support as overlay link protocols. 3556 6.6.2. Framing Header 3558 In order to support unreliable links and to allow for quick detection 3559 of link failures when using reliable end-to-end transports, each 3560 message is wrapped in a very simple framing layer (FramedMessage) 3561 which is only used for each hop. This layer contains a sequence 3562 number which can then be used for ACKs. The same header is used for 3563 both reliable and unreliable transports for simplicity of 3564 implementation. 3566 The definition of FramedMessage is: 3568 enum { data(128), ack(129), (255)} FramedMessageType; 3570 struct { 3571 FramedMessageType type; 3573 select (type) { 3574 case data: 3575 uint32 sequence; 3576 opaque message<0..2^24-1>; 3578 case ack: 3579 uint32 ack_sequence; 3580 uint32 received; 3581 }; 3582 } FramedMessage; 3584 The type field of the PDU is set to indicate whether the message is 3585 data or an acknowledgement. 3587 If the message is of type "data", then the remainder of the PDU is as 3588 follows: 3590 sequence 3591 the sequence number. This increments by 1 for each framed message 3592 sent over this transport session. 3594 message 3595 the message that is being transmitted. 3597 Each connection has it own sequence number space. Initially the 3598 value is zero and it increments by exactly one for each message sent 3599 over that connection. 3601 When the receiver receives a message, it SHOULD immediately send an 3602 ACK message. The receiver MUST keep track of the 32 most recent 3603 sequence numbers received on this association in order to generate 3604 the appropriate ack. 3606 If the PDU is of type "ack", the contents are as follows: 3608 ack_sequence 3609 The sequence number of the message being acknowledged. 3611 received 3612 A bitmask indicating if each of the previous 32 sequence numbers 3613 before this packet has been among the 32 packets most recently 3614 received on this connection. When a packet is received with a 3615 sequence number N, the receiver looks at the sequence number of 3616 the previously 32 packets received on this connection. Call the 3617 previously received packet number M. For each of the previous 32 3618 packets, if the sequence number M is less than N but greater than 3619 N-32, the N-M bit of the received bitmask is set to one; otherwise 3620 it is zero. Note that a bit being set to one indicates positively 3621 that a particular packet was received, but a bit being set to zero 3622 means only that it is unknown whether or not the packet has been 3623 received, because it might have been received before the 32 most 3624 recently received packets. 3626 The received field bits in the ACK provide a high degree of 3627 redundancy so that the sender can figure out which packets the 3628 receiver has received and can then estimate packet loss rates. If 3629 the sender also keeps track of the time at which recent sequence 3630 numbers have been sent, the RTT can be estimated. 3632 Note that because retransmissions receive new sequence numbers, 3633 multiple ACKs may be received for the same message. This approach 3634 provides more information than traditional TCP sequence numbers, but 3635 care must be taken when applying algorithms designed based on TCP's 3636 stream-oriented sequence number. 3638 6.6.3. Simple Reliability 3640 When RELOAD is carried over DTLS or another unreliable link protocol, 3641 it needs to be used with a reliability and congestion control 3642 mechanism, which is provided on a hop-by-hop basis. The basic 3643 principle is that each message, regardless of whether or not it 3644 carries a request or response, will get an ACK and be reliably 3645 retransmitted. The receiver's job is very simple, limited to just 3646 sending ACKs. All the complexity is at the sender side. This allows 3647 the sending implementation to trade off performance versus 3648 implementation complexity without affecting the wire protocol. 3650 Because the receiver's role is limited to providing packet 3651 acknowledgements, a wide variety of congestion control algorithms can 3652 be implemented on the sender side while using the same basic wire 3653 protocol. The sender algorithm used MUST meet the requirements of 3654 [RFC5405]. 3656 6.6.3.1. Stop and Wait Sender Algorithm 3658 This section describes one possible implementation of a sender 3659 algorithm for Simple Reliability. It is adequate for overlays 3660 running on underlying networks with low latency and loss (LANs) or 3661 low-traffic overlays on the Internet. 3663 A node MUST NOT have more than one unacknowledged message on the DTLS 3664 connection at a time. Note that because retransmissions of the same 3665 message are given new sequence numbers, there may be multiple 3666 unacknowledged sequence numbers in use. 3668 The RTO ("Retransmission TimeOut") is based on an estimate of the 3669 round-trip time (RTT). The value for RTO is calculated separately 3670 for each DTLS session. Implementations can use a static value for 3671 RTO or a dynamic estimate which will result in better performance. 3672 For implementations that use a static value, the default value for 3673 RTO is 500 ms. Nodes MAY use smaller values of RTO if it is known 3674 that all nodes are within the local network. The default RTO MAY be 3675 chosen larger, and this is RECOMMENDED if it is known in advance 3676 (such as on high latency access links) that the round-trip time is 3677 larger. 3679 Implementations that use a dynamic estimate to compute the RTO MUST 3680 use the algorithm described in RFC 6298[RFC6298], with the exception 3681 that the value of RTO SHOULD NOT be rounded up to the nearest second 3682 but instead rounded up to the nearest millisecond. The RTT of a 3683 successful STUN transaction from the ICE stage is used as the initial 3684 measurement for formula 2.2 of RFC 6298. The sender keeps track of 3685 the time each message was sent for all recently sent messages. Any 3686 time an ACK is received, the sender can compute the RTT for that 3687 message by looking at the time the ACK was received and the time when 3688 the message was sent. This is used as a subsequent RTT measurement 3689 for formula 2.3 of RFC 6298 to update the RTO estimate. (Note that 3690 because retransmissions receive new sequence numbers, all received 3691 ACKs are used.) 3693 An initiating node SHOULD retransmit a message if it has not received 3694 an ACK after an interval of RTO (transit nodes do not retransmit at 3695 this layer). The node MUST double the time to wait after each 3696 retransmission. For each retransmission, the sequence number MUST be 3697 incremented. 3699 Retransmissions continue until a response is received, or until a 3700 total of 5 requests have been sent or there has been a hard ICMP 3701 error [RFC1122] or a TLS alert. The sender knows a response was 3702 received when it receives an ACK with a sequence number that 3703 indicates it is a response to one of the transmissions of this 3704 messages. For example, assuming an RTO of 500 ms, requests would be 3705 sent at times 0 ms, 500 ms, 1500 ms, 3500 ms, and 7500 ms. If all 3706 retransmissions for a message fail, then the sending node SHOULD 3707 close the connection routing the message. 3709 To determine when a link may be failing without waiting for the final 3710 timeout, observe when no ACKs have been received for an entire RTO 3711 interval, and then wait for three retransmissions to occur beyond 3712 that point. If no ACKs have been received by the time the third 3713 retransmission occurs, it is RECOMMENDED that the link be removed 3714 from the routing table. The link MAY be restored to the routing 3715 table if ACKs resume before the connection is closed, as described 3716 above. 3718 A sender MUST wait 10ms between receipt of an ACK and transmission of 3719 the next message. 3721 6.6.4. DTLS/UDP with SR 3723 This overlay link protocol consists of DTLS over UDP while 3724 implementing the Simple Reliability protocol. STUN Connectivity 3725 checks and keepalives are used. Any compliant sender algorithm may 3726 be used. 3728 6.6.5. TLS/TCP with FH, No-ICE 3730 This overlay link protocol consists of TLS over TCP with the framing 3731 header. Because ICE is not used, STUN connectivity checks are not 3732 used upon establishing the TCP connection, nor are they used for 3733 keepalives. 3735 Because the TCP layer's application-level timeout is too slow to be 3736 useful for overlay routing, the Overlay Link implementation MUST use 3737 the framing header to measure the RTT of the connection and calculate 3738 an RTO as specified in Section 2 of [RFC6298]. The resulting RTO is 3739 not used for retransmissions, but as a timeout to indicate when the 3740 link SHOULD be removed from the routing table. It is RECOMMENDED 3741 that such a connection be retained for 30s to determine if the 3742 failure was transient before concluding the link has failed 3743 permanently. 3745 When sending candidates for TLS/TCP with FH, No-ICE, a passive 3746 candidate MUST be provided. 3748 6.6.6. DTLS/UDP with SR, No-ICE 3750 This overlay link protocol consists of DTLS over UDP while 3751 implementing the Simple Reliability protocol. Because ICE is not 3752 used, no STUN connectivity checks or keepalives are used. 3754 6.7. Fragmentation and Reassembly 3756 In order to allow transmission over datagram protocols such as DTLS, 3757 RELOAD messages may be fragmented. 3759 Any node along the path can fragment the message but only the final 3760 destination reassembles the fragments. When a node takes a packet 3761 and fragments it, each fragment has a full copy of the Forwarding 3762 Header but the data after the Forwarding Header is broken up in 3763 appropriate sized chunks. The size of the payload chunks needs to 3764 take into account space to allow the via and destination lists to 3765 grow. Each fragment MUST contain a full copy of the via list, 3766 destination list, and ForwardingOptions and MUST contain at least 256 3767 bytes of the message body. If these elements cannot fit within the 3768 MTU of the underlying datagram protocol, RELOAD fragmentation is not 3769 performed and IP-layer fragmentation is allowed to occur. When a 3770 message must be fragmented, it SHOULD be split into equal-sized 3771 fragments that are no larger than the PMTU of the next overlay link 3772 minus 32 bytes. This is to allow the via list to grow before further 3773 fragmentation is required. 3775 Note that this fragmentation is not optimal for the end-to-end path - 3776 a message may be refragmented multiple times as it traverses the 3777 overlay but is only assembled at the final destination. This option 3778 has been chosen as it is far easier to implement than e2e PMTU 3779 discovery across an ever-changing overlay, and it effectively 3780 addresses the reliability issues of relying on IP-layer 3781 fragmentation. However, PING can be used to allow e2e PMTU discovery 3782 to be implemented if desired. 3784 Upon receipt of a fragmented message by the intended peer, the peer 3785 holds the fragments in a holding buffer until the entire message has 3786 been received. The message is then reassembled into a single message 3787 and processed. In order to mitigate denial of service attacks, 3788 receivers SHOULD time out incomplete fragments after maximum request 3789 lifetime (15 seconds). Note this time was derived from looking at 3790 the end to end retransmission time and saving fragments long enough 3791 for the full end to end retransmissions to take place. Ideally the 3792 receiver would have enough buffer space to deal with as many 3793 fragments as can arrive in the maximum request lifetime. However, if 3794 the receiver runs out of buffer space to reassemble the messages it 3795 MUST drop the message. 3797 The fragment field of the forwarding header is used to encode 3798 fragmentation information. The offset is the number of bytes between 3799 the end of the forwarding header and the start of the data. The 3800 first fragment therefore has an offset of 0. The last fragment 3801 indicator MUST be appropriately set. If the message is not 3802 fragmented, it is simply treated as if it is the only fragment: the 3803 last fragment bit is set and the offset is 0 resulting in a fragment 3804 value of 0xC0000000. 3806 Note: the reason for this definition of the fragment field is that 3807 originally the high bit was defined in part of the specification as 3808 "is fragmented" and so there was some specification ambiguity about 3809 how to encode messages with only one fragment. This ambiguity was 3810 resolved in favor of always encoding as the "last" fragment with 3811 offset 0, thus simplifying the receiver code path, but resulting in 3812 the high bit being redundant. Because messages MUST be set with the 3813 high bit set to 1, implementations SHOULD discard any message with it 3814 set to 0. Implementations (presumably legacy ones) which choose to 3815 accept such messages MUST either ignore the remaining bits or ensure 3816 that they are 0. They MUST NOT try to interpret as fragmented 3817 messages with the high bit set low. 3819 7. Data Storage Protocol 3821 RELOAD provides a set of generic mechanisms for storing and 3822 retrieving data in the Overlay Instance. These mechanisms can be 3823 used for new applications simply by defining new code points and a 3824 small set of rules. No new protocol mechanisms are required. 3826 The basic unit of stored data is a single StoredData structure: 3828 struct { 3829 uint32 length; 3830 uint64 storage_time; 3831 uint32 lifetime; 3832 StoredDataValue value; 3833 Signature signature; 3834 } StoredData; 3836 The contents of this structure are as follows: 3838 length 3839 The size of the StoredData structure in octets excluding the size 3840 of length itself. 3842 storage_time 3843 The time when the data was stored represented as the number of 3844 milliseconds elapsed since midnight Jan 1, 1970 UTC not counting 3845 leap seconds. This will have the same values for seconds as 3846 standard UNIX time or POSIX time. More information can be found 3847 at [UnixTime]. Any attempt to store a data value with a storage 3848 time before that of a value already stored at this location MUST 3849 generate a Error_Data_Too_Old error. This prevents rollback 3850 attacks. The node SHOULD make a best-effort attempt to use a 3851 correct clock to determine this number, however, the protocol does 3852 not require synchronized clocks: the receiving peer uses the 3853 storage time in the previous store, not its own clock. Clock 3854 values are used so that when clocks are generally synchronized, 3855 data may be stored in a single transaction, rather than querying 3856 for the value of a counter before the actual store. 3857 If a node attempting to store new data in response to a user 3858 request (rather than as an overlay maintenance operation such as 3859 occurs during unpartitioning) is rejected with an 3860 Error_Data_Too_Old error, the node MAY elect to perform its store 3861 using a storage_time that increments the value used with the 3862 previous store. This situation may occur when the clocks of nodes 3863 storing to this location are not properly synchronized. 3865 lifetime 3866 The validity period for the data, in seconds, starting from the 3867 time the peer receives the StoreReq. 3869 value 3870 The data value itself, as described in Section 7.2. 3872 signature 3873 A signature as defined in Section 7.1. 3875 Each Resource-ID specifies a single location in the Overlay Instance. 3876 However, each location may contain multiple StoredData values 3877 distinguished by Kind-ID. The definition of a Kind describes both 3878 the data values which may be stored and the data model of the data. 3879 Some data models allow multiple values to be stored under the same 3880 Kind-ID. Section Section 7.2 describes the available data models. 3881 Thus, for instance, a given Resource-ID might contain a single-value 3882 element stored under Kind-ID X and an array containing multiple 3883 values stored under Kind-ID Y. 3885 7.1. Data Signature Computation 3887 Each StoredData element is individually signed. However, the 3888 signature also must be self-contained and cover the Kind-ID and 3889 Resource-ID even though they are not present in the StoredData 3890 structure. The input to the signature algorithm is: 3892 resource_id || kind || storage_time || StoredDataValue || 3893 SignerIdentity 3895 Where || indicates concatenation. 3897 Where these values are: 3899 resource_id 3900 The resource ID where this data is stored. 3902 kind 3903 The Kind-ID for this data. 3905 storage_time 3907 The contents of the storage_time data value. 3908 StoredDataValue 3909 The contents of the stored data value, as described in the 3910 previous sections. 3912 SignerIdentity 3913 The signer identity as defined in Section 6.3.4. 3915 Once the signature has been computed, the signature is represented 3916 using a signature element, as described in Section 6.3.4. 3918 Note that there is no necessarily relationship between the validity 3919 window of a certificate and the expiry of the data it is 3920 authenticating. When signatures are verified, the current time MUST 3921 be compared to the certificate validity period. However, it is 3922 permitted to have a value signed which expires after a certificate's 3923 validity period (though this will likely cause verification failure 3924 at some future time.) 3926 7.2. Data Models 3928 The protocol currently defines the following data models: 3930 o single value 3931 o array 3932 o dictionary 3934 These are represented with the StoredDataValue structure. The actual 3935 dataModel is known from the Kind being stored. 3937 struct { 3938 Boolean exists; 3939 opaque value<0..2^32-1>; 3940 } DataValue; 3942 struct { 3943 select (dataModel) { 3944 case single_value: 3945 DataValue single_value_entry; 3947 case array: 3948 ArrayEntry array_entry; 3950 case dictionary: 3951 DictionaryEntry dictionary_entry; 3953 /* This structure may be extended */ 3954 }; 3955 } StoredDataValue; 3957 We now discuss the properties of each data model in turn: 3959 7.2.1. Single Value 3961 A single-value element is a simple sequence of bytes. There may be 3962 only one single-value element for each Resource-ID, Kind-ID pair. 3964 A single value element is represented as a DataValue, which contains 3965 the following two elements: 3967 exists 3968 This value indicates whether the value exists at all. If it is 3969 set to False, it means that no value is present. If it is True, 3970 that means that a value is present. This gives the protocol a 3971 mechanism for indicating nonexistence as opposed to emptiness. 3973 value 3974 The stored data. 3976 7.2.2. Array 3978 An array is a set of opaque values addressed by an integer index. 3979 Arrays are zero based. Note that arrays can be sparse. For 3980 instance, a Store of "X" at index 2 in an empty array produces an 3981 array with the values [ NA, NA, "X"]. Future attempts to fetch 3982 elements at index 0 or 1 will return values with "exists" set to 3983 False. 3985 A array element is represented as an ArrayEntry: 3987 struct { 3988 uint32 index; 3989 DataValue value; 3990 } ArrayEntry; 3992 The contents of this structure are: 3994 index 3995 The index of the data element in the array. 3997 value 3998 The stored data. 4000 7.2.3. Dictionary 4002 A dictionary is a set of opaque values indexed by an opaque key with 4003 one value for each key. A single dictionary entry is represented as 4004 follows: 4006 A dictionary element is represented as a DictionaryEntry: 4008 typedef opaque DictionaryKey<0..2^16-1>; 4010 struct { 4011 DictionaryKey key; 4012 DataValue value; 4013 } DictionaryEntry; 4015 The contents of this structure are: 4017 key 4018 The dictionary key for this value. 4020 value 4021 The stored data. 4023 7.3. Access Control Policies 4025 Every Kind which is storable in an overlay MUST be associated with an 4026 access control policy. This policy defines whether a request from a 4027 given node to operate on a given value should succeed or fail. It is 4028 anticipated that only a small number of generic access control 4029 policies are required. To that end, this section describes a small 4030 set of such policies and Section 14.4 establishes a registry for new 4031 policies if required. Each policy has a short string identifier 4032 which is used to reference it in the configuration document. 4034 In the following policies, the term "signer" refers to the signer of 4035 the StoredValue object and, in the case of non-replica stores, to the 4036 signer of the StoreReq message. I.e., in a non-replica store, both 4037 the signer of the StoredValue and the signer of the StoreReq MUST 4038 conform to the policy. In the case of a replica store, the signer of 4039 the StoredValue MUST conform to the policy and the StoreReq itself 4040 MUST be checked as described in Section 7.4.1.1. 4042 7.3.1. USER-MATCH 4044 In the USER-MATCH policy, a given value MUST be written (or 4045 overwritten) if and only if the signer's certificate has a user name 4046 which hashes (using the hash function for the overlay) to the 4047 Resource-ID for the resource. Recall that the certificate may, 4048 depending on the overlay configuration, be self-signed. 4050 7.3.2. NODE-MATCH 4052 In the NODE-MATCH policy, a given value MUST be written (or 4053 overwritten) if and only if the signer's certificate has a specified 4054 Node-ID which hashes (using the hash function for the overlay) to the 4055 Resource-ID for the resource and that Node-ID is the one indicated in 4056 the SignerIdentity value cert_hash. 4058 7.3.3. USER-NODE-MATCH 4060 The USER-NODE-MATCH policy may only be used with dictionary types. 4061 In the USER-NODE-MATCH policy, a given value MUST be written (or 4062 overwritten) if and only if the signer's certificate has a user name 4063 which hashes (using the hash function for the overlay) to the 4064 Resource-ID for the resource. In addition, the dictionary key MUST 4065 be equal to the Node-ID in the certificate and that Node-ID MUST be 4066 the one indicated in the SignerIdentity value cert_hash. 4068 7.3.4. NODE-MULTIPLE 4070 In the NODE-MULTIPLE policy, a given value MUST be written (or 4071 overwritten) if and only if signer's certificate contains a Node-ID 4072 such that H(Node-ID || i) is equal to the Resource-ID for some small 4073 integer value of i and that Node-ID is the one indicated in the 4074 SignerIdentity value cert_hash. When this policy is in use, the 4075 maximum value of i MUST be specified in the Kind definition. 4077 Note that as i is not carried on the wire, the verifier MUST iterate 4078 through potential i values up to the maximum value in order to 4079 determine whether a store is acceptable. 4081 7.4. Data Storage Methods 4083 RELOAD provides several methods for storing and retrieving data: 4085 o Store values in the overlay 4086 o Fetch values from the overlay 4087 o Stat: get metadata about values in the overlay 4088 o Find the values stored at an individual peer 4090 These methods are each described in the following sections. 4092 7.4.1. Store 4094 The Store method is used to store data in the overlay. The format of 4095 the Store request depends on the data model which is determined by 4096 the Kind. 4098 7.4.1.1. Request Definition 4100 A StoreReq message is a sequence of StoreKindData values, each of 4101 which represents a sequence of stored values for a given Kind. The 4102 same Kind-ID MUST NOT be used twice in a given store request. Each 4103 value is then processed in turn. These operations MUST be atomic. 4104 If any operation fails, the state MUST be rolled back to before the 4105 request was received. 4107 The store request is defined by the StoreReq structure: 4109 struct { 4110 KindId kind; 4111 uint64 generation_counter; 4112 StoredData values<0..2^32-1>; 4113 } StoreKindData; 4115 struct { 4116 ResourceId resource; 4117 uint8 replica_number; 4118 StoreKindData kind_data<0..2^32-1>; 4119 } StoreReq; 4121 A single Store request stores data of a number of kinds to a single 4122 resource location. The contents of the structure are: 4124 resource 4125 The resource to store at. 4127 replica_number 4128 The number of this replica. When a storing peer saves replicas to 4129 other peers each peer is assigned a replica number starting from 1 4130 and sent in the Store message. This field is set to 0 when a node 4131 is storing its own data. This allows peers to distinguish replica 4132 writes from original writes. 4134 kind_data 4135 A series of elements, one for each Kind of data to be stored. 4137 If the replica number is zero, then the peer MUST check that it is 4138 responsible for the resource and, if not, reject the request. If the 4139 replica number is nonzero, then the peer MUST check that it expects 4140 to be a replica for the resource and that the request sender is 4141 consistent with being the responsible node (i.e., that the receiving 4142 peer does not know of a better node) and, if not, reject the request. 4144 Each StoreKindData element represents the data to be stored for a 4145 single Kind-ID. The contents of the element are: 4147 kind 4148 The Kind-ID. Implementations MUST reject requests corresponding 4149 to unknown Kinds. 4151 generation_counter 4152 The expected current state of the generation counter 4153 (approximately the number of times this object has been written; 4154 see below for details). 4156 values 4157 The value or values to be stored. This may contain one or more 4158 stored_data values depending on the data model associated with 4159 each Kind. 4161 The peer MUST perform the following checks: 4163 o The Kind-ID is known and supported. 4164 o The signatures over each individual data element (if any) are 4165 valid. If this check fails, the request MUST be rejected with an 4166 Error_Forbidden error. 4167 o Each element is signed by a credential which is authorized to 4168 write this Kind at this Resource-ID. If this check fails, the 4169 request MUST be rejected with an Error_Forbidden error. 4171 o For original (non-replica) stores, the StoreReq is signed by a 4172 credential which is authorized to write this Kind at this 4173 Resource-Id. If this check fails, the request MUST be rejected 4174 with an Error_Forbidden error. 4175 o For replica stores, the StoreReq is signed by a Node-Id which is a 4176 plausible node to either have originally stored the value or in 4177 the replica set. What this means is overlay specific, but in the 4178 case of the Chord based DHT defined in this specification, replica 4179 StoreReqs MUST come from nodes which are either in the known 4180 replica set for a given resource or which are closer than some 4181 node in the replica set. If this check fails, the request MUST be 4182 rejected with an Error_Forbidden error. 4183 o For original (non-replica) stores, the peer MUST check that if the 4184 generation counter is non-zero, it equals the current value of the 4185 generation counter for this Kind. This feature allows the 4186 generation counter to be used in a way similar to the HTTP Etag 4187 feature. 4188 o For replica Stores, the peer MUST set the generation counter to 4189 match the generation counter in the message, and MUST NOT check 4190 the generation counter against the current value. Replica Stores 4191 MUST NOT use a generation counter of 0. 4192 o The storage time values are greater than that of any value which 4193 would be replaced by this Store. 4194 o The size and number of the stored values is consistent with the 4195 limits specified in the overlay configuration. 4196 o If the data is signed with identity_type set to "none" and/or 4197 SignatureAndHashAlgorithm values set to {0, 0} ("anonymous" and 4198 "none"), the StoreReq MUST be rejected with an Error_forbidden 4199 error. Only synthesized data returned by the storage can use 4200 these values 4202 If all these checks succeed, the peer MUST attempt to store the data 4203 values. For non-replica stores, if the store succeeds and the data 4204 is changed, then the peer MUST increase the generation counter by at 4205 least one. If there are multiple stored values in a single 4206 StoreKindData, it is permissible for the peer to increase the 4207 generation counter by only 1 for the entire Kind-ID, or by 1 or more 4208 than one for each value. Accordingly, all stored data values MUST 4209 have a generation counter of 1 or greater. 0 is used in the Store 4210 request to indicate that the generation counter should be ignored for 4211 processing this request; however the responsible peer should increase 4212 the stored generation counter and should return the correct 4213 generation counter in the response. 4215 When a peer stores data previously stored by another node (e.g., for 4216 replicas or topology shifts) it MUST adjust the lifetime value 4217 downward to reflect the amount of time the value was stored at the 4218 peer. The adjustment SHOULD be implemented by an algorithm 4219 equivalent to the following: at the time the peer initially receives 4220 the StoreReq it notes the local time T. When it then attempts to do a 4221 StoreReq to another node it should decrement the lifetime value by 4222 the difference between the current local time and T. 4224 Unless otherwise specified by the usage, if a peer attempts to store 4225 data previously stored by another node (e.g., for replicas or 4226 topology shifts) and that store fails with either an 4227 Error_Generation_Counter_Too_Low or an Error_Data_Too old error, the 4228 peer MUST fetch the newer data from the peer generating the error and 4229 use that to replace its own copy. This rule allows resynchronization 4230 after partitions heal. 4232 The properties of stores for each data model are as follows: 4234 Single-value: 4235 A store of a new single-value element creates the element if it 4236 does not exist and overwrites any existing value with the new 4237 value. 4239 Array: 4240 A store of an array entry replaces (or inserts) the given value at 4241 the location specified by the index. Because arrays are sparse, a 4242 store past the end of the array extends it with nonexistent values 4243 (exists=False) as required. A store at index 0xffffffff places 4244 the new value at the end of the array regardless of the length of 4245 the array. The resulting StoredData has the correct index value 4246 when it is subsequently fetched. 4248 Dictionary: 4249 A store of a dictionary entry replaces (or inserts) the given 4250 value at the location specified by the dictionary key. 4252 The following figure shows the relationship between these structures 4253 for an example store which stores the following values at resource 4254 "1234" 4256 o The value "abc" in the single value location for Kind X 4257 o The value "foo" at index 0 in the array for Kind Y 4258 o The value "bar" at index 1 in the array for Kind Y 4259 Store 4260 resource=1234 4261 replica_number = 0 4262 / \ 4263 / \ 4264 StoreKindData StoreKindData 4265 kind=X (Single-Value) kind=Y (Array) 4266 generation_counter = 99 generation_counter = 107 4267 | /\ 4268 | / \ 4269 StoredData / \ 4270 storage_time = xxxxxxx / \ 4271 lifetime = 86400 / \ 4272 signature = XXXX / \ 4273 | | | 4274 | StoredData StoredData 4275 | storage_time = storage_time = 4276 | yyyyyyyy zzzzzzz 4277 | lifetime = 86400 lifetime = 33200 4278 | signature = YYYY signature = ZZZZ 4279 | | | 4280 StoredDataValue | | 4281 value="abc" | | 4282 | | 4283 StoredDataValue StoredDataValue 4284 index=0 index=1 4285 value="foo" value="bar" 4287 7.4.1.2. Response Definition 4289 In response to a successful Store request the peer MUST return a 4290 StoreAns message containing a series of StoreKindResponse elements 4291 containing the current value of the generation counter for each 4292 Kind-ID, as well as a list of the peers where the data will be 4293 replicated by the node processing the request. 4295 struct { 4296 KindId kind; 4297 uint64 generation_counter; 4298 NodeId replicas<0..2^16-1>; 4299 } StoreKindResponse; 4301 struct { 4302 StoreKindResponse kind_responses<0..2^16-1>; 4303 } StoreAns; 4305 The contents of each StoreKindResponse are: 4307 kind 4308 The Kind-ID being represented. 4310 generation_counter 4311 The current value of the generation counter for that Kind-ID. 4313 replicas 4314 The list of other peers at which the data was/will be replicated. 4315 In overlays and applications where the responsible peer is 4316 intended to store redundant copies, this allows the storing peer 4317 to independently verify that the replicas have in fact been 4318 stored. It does this verification by using the Stat method (see 4319 Section 7.4.3). Note that the storing peer is not required to 4320 perform this verification. 4322 The response itself is just StoreKindResponse values packed end-to- 4323 end. 4325 If any of the generation counters in the request precede the 4326 corresponding stored generation counter, then the peer MUST fail the 4327 entire request and respond with an Error_Generation_Counter_Too_Low 4328 error. The error_info in the ErrorResponse MUST be a StoreAns 4329 response containing the correct generation counter for each Kind and 4330 the replica list, which will be empty. For original (non-replica) 4331 stores, a node which receives such an error SHOULD attempt to fetch 4332 the data and, if the storage_time value is newer, replace its own 4333 data with that newer data. This rule improves data consistency in 4334 the case of partitions and merges. 4336 If the data being stored is too large for the allowed limit by the 4337 given usage, then the peer MUST fail the request and generate an 4338 Error_Data_Too_Large error. 4340 If any type of request tries to access a data Kind that the node does 4341 not know about, an Error_Unknown_Kind MUST be generated. The 4342 error_info in the Error_Response is: 4344 KindId unknown_kinds<0..2^8-1>; 4346 which lists all the Kinds that were unrecognized. A node which 4347 receives this error MUST generate a ConfigUpdate message which 4348 contains the appropriate Kind definition (assuming that in fact a 4349 Kind was used which was defined in the configuration document). 4351 7.4.1.3. Removing Values 4353 RELOAD does not have an explicit Remove operation. Rather, values 4354 are Removed by storing "nonexistent" values in their place. Each 4355 DataValue contains a boolean value called "exists" which indicates 4356 whether a value is present at that location. In order to effectively 4357 remove a value, the owner stores a new DataValue with "exists" set to 4358 "false": 4360 exists = false 4361 value = {} (0 length) 4363 The owner SHOULD use a lifetime for the nonexistent value at least as 4364 long as the remainder of the lifetime of the value it is replacing; 4365 otherwise it is possible for the original value to be accidentally or 4366 maliciously re-stored after the storing node has expired it. Note 4367 that there is still a window of vulnerability for replay attack after 4368 the original lifetime has expired (as with any store). This attack 4369 can be mitigated by doing a nonexistent store with a very long 4370 lifetime. 4372 Storing nodes MUST treat these nonexistent values the same way they 4373 treat any other stored value, including overwriting the existing 4374 value, replicating them, and aging them out as necessary when 4375 lifetime expires. When a stored nonexistent value's lifetime 4376 expires, it is simply removed from the storing node like any other 4377 stored value expiration. 4379 Note that in the case of arrays and dictionaries, expiration may 4380 create an implicit, unsigned "nonexistent" value to represent a gap 4381 in the data structure, as might happen when any value is aged out. 4382 However, this value isn't persistent nor is it replicated. It is 4383 simply synthesized by the storing node. 4385 7.4.2. Fetch 4387 The Fetch request retrieves one or more data elements stored at a 4388 given Resource-ID. A single Fetch request can retrieve multiple 4389 different Kinds. 4391 7.4.2.1. Request Definition 4393 struct { 4394 int32 first; 4395 int32 last; 4396 } ArrayRange; 4398 struct { 4399 KindId kind; 4400 uint64 generation; 4401 uint16 length; 4403 select (dataModel) { 4404 case single_value: ; /* Empty */ 4406 case array: 4407 ArrayRange indices<0..2^16-1>; 4409 case dictionary: 4410 DictionaryKey keys<0..2^16-1>; 4412 /* This structure may be extended */ 4414 } model_specifier; 4415 } StoredDataSpecifier; 4417 struct { 4418 ResourceId resource; 4419 StoredDataSpecifier specifiers<0..2^16-1>; 4420 } FetchReq; 4422 The contents of the Fetch requests are as follows: 4424 resource 4425 The Resource-ID to fetch from. 4427 specifiers 4428 A sequence of StoredDataSpecifier values, each specifying some of 4429 the data values to retrieve. 4431 Each StoredDataSpecifier specifies a single Kind of data to retrieve 4432 and (if appropriate) the subset of values that are to be retrieved. 4433 The contents of the StoredDataSpecifier structure are as follows: 4435 kind 4436 The Kind-ID of the data being fetched. Implementations SHOULD 4437 reject requests corresponding to unknown Kinds unless specifically 4438 configured otherwise. 4440 dataModel 4441 The data model of the data. This is not transmitted on the wire 4442 but comes from the definition of the Kind. 4444 generation 4445 The last generation counter that the requesting node saw. This 4446 may be used to avoid unnecessary fetches or it may be set to zero. 4448 length 4449 The length of the rest of the structure, thus allowing 4450 extensibility. 4452 model_specifier 4453 A reference to the data value being requested within the data 4454 model specified for the Kind. For instance, if the data model is 4455 "array", it might specify some subset of the values. 4457 The model_specifier is as follows: 4459 o If the data model is single value, the specifier is empty. 4460 o If the data model is array, the specifier contains a list of 4461 ArrayRange elements, each of which contains two integers. The 4462 first integer is the beginning of the range and the second is the 4463 end of the range. 0 is used to indicate the first element and 4464 0xffffffff is used to indicate the final element. The first 4465 integer MUST be less than the second. While multiple ranges MAY 4466 be specified, they MUST NOT overlap. 4467 o If the data model is dictionary then the specifier contains a list 4468 of the dictionary keys being requested. If no keys are specified, 4469 than this is a wildcard fetch and all key-value pairs are 4470 returned. 4472 The generation counter is used to indicate the requester's expected 4473 state of the storing peer. If the generation counter in the request 4474 matches the stored counter, then the storing peer returns a response 4475 with no StoredData values. 4477 Note that because the certificate for a user is typically stored at 4478 the same location as any data stored for that user, a requesting node 4479 that does not already have the user's certificate should request the 4480 certificate in the Fetch as an optimization. 4482 7.4.2.2. Response Definition 4484 The response to a successful Fetch request is a FetchAns message 4485 containing the data requested by the requester. 4487 struct { 4488 KindId kind; 4489 uint64 generation; 4490 StoredData values<0..2^32-1>; 4491 } FetchKindResponse; 4493 struct { 4494 FetchKindResponse kind_responses<0..2^32-1>; 4495 } FetchAns; 4497 The FetchAns structure contains a series of FetchKindResponse 4498 structures. There MUST be one FetchKindResponse element for each 4499 Kind-ID in the request. 4501 The contents of the FetchKindResponse structure are as follows: 4503 kind 4504 the Kind that this structure is for. 4506 generation 4507 the generation counter for this Kind. 4509 values 4510 the relevant values. If the generation counter in the request 4511 matches the generation counter in the stored data, then no 4512 StoredData values are returned. Otherwise, all relevant data 4513 values MUST be returned. A nonexistent value (i.e., one which the 4514 node has no knowledge of) is represented by a synthetic value with 4515 "exists" set to False and has an empty signature. Specifically, 4516 the identity_type is set to "none", the SignatureAndHashAlgorithm 4517 values are set to {0, 0} ("anonymous" and "none" respectively), 4518 and the signature value is of zero length. This removes the need 4519 for the responding node to do signatures for values which do not 4520 exist. These signatures are unnecessary as the entire response is 4521 signed by that node. Note that entries which have been removed by 4522 the procedure of Section 7.4.1.3 and have not yet expired also 4523 have exists = false but have valid signatures from the node which 4524 did the store. 4526 Upon receipt of a FetchAns message, nodes MUST verify the signatures 4527 on all the received values. Any values with invalid signatures 4528 (including expired certificates) MUST be discarded. Note that this 4529 implies that implementations which wish to store data for long 4530 periods of time must have certificates with appropriate expiry dates 4531 or re-store periodically. Implementations MAY return the subset of 4532 values with valid signatures, but in that case SHOULD somehow signal 4533 to the application that a partial response was received. 4535 There is one subtle point about signature computation on arrays. If 4536 the storing node uses the append feature (where the 4537 index=0xffffffff), then the index in the StoredData that is returned 4538 will not match that used by the storing node, which would break the 4539 signature. In order to avoid this issue, the index value in the 4540 array is set to zero before the signature is computed. This implies 4541 that malicious storing nodes can reorder array entries without being 4542 detected. 4544 7.4.3. Stat 4546 The Stat request is used to get metadata (length, generation counter, 4547 digest, etc.) for a stored element without retrieving the element 4548 itself. The name is from the UNIX stat(2) system call which performs 4549 a similar function for files in a file system. It also allows the 4550 requesting node to get a list of matching elements without requesting 4551 the entire element. 4553 7.4.3.1. Request Definition 4555 The Stat request is identical to the Fetch request. It simply 4556 specifies the elements to get metadata about. 4558 struct { 4559 ResourceId resource; 4560 StoredDataSpecifier specifiers<0..2^16-1>; 4561 } StatReq; 4563 7.4.3.2. Response Definition 4565 The Stat response contains the same sort of entries that a Fetch 4566 response would contain; however, instead of containing the element 4567 data it contains metadata. 4569 struct { 4570 Boolean exists; 4571 uint32 value_length; 4572 HashAlgorithm hash_algorithm; 4573 opaque hash_value<0..255>; 4574 } MetaData; 4576 struct { 4577 uint32 index; 4578 MetaData value; 4579 } ArrayEntryMeta; 4581 struct { 4582 DictionaryKey key; 4583 MetaData value; 4584 } DictionaryEntryMeta; 4586 struct { 4587 select (model) { 4588 case single_value: 4589 MetaData single_value_entry; 4591 case array: 4592 ArrayEntryMeta array_entry; 4594 case dictionary: 4595 DictionaryEntryMeta dictionary_entry; 4597 /* This structure may be extended */ 4598 }; 4599 } MetaDataValue; 4601 struct { 4602 uint32 value_length; 4603 uint64 storage_time; 4604 uint32 lifetime; 4605 MetaDataValue metadata; 4606 } StoredMetaData; 4608 struct { 4609 KindId kind; 4610 uint64 generation; 4611 StoredMetaData values<0..2^32-1>; 4612 } StatKindResponse; 4614 struct { 4615 StatKindResponse kind_responses<0..2^32-1>; 4616 } StatAns; 4618 The structures used in StatAns parallel those used in FetchAns: a 4619 response consists of multiple StatKindResponse values, one for each 4620 kind that was in the request. The contents of the StatKindResponse 4621 are the same as those in the FetchKindResponse, except that the 4622 values list contains StoredMetaData entries instead of StoredData 4623 entries. 4625 The contents of the StoredMetaData structure are the same as the 4626 corresponding fields in StoredData except that there is no signature 4627 field and the value is a MetaDataValue rather than a StoredDataValue. 4629 A MetaDataValue is a variant structure, like a StoredDataValue, 4630 except for the types of each arm, which replace DataValue with 4631 MetaData. 4633 The only really new structure is MetaData, which has the following 4634 contents: 4636 exists 4637 Same as in DataValue 4639 value_length 4640 The length of the stored value. 4642 hash_algorithm 4643 The hash algorithm used to perform the digest of the value. 4645 hash_value 4646 A digest of the value using hash_algorithm. 4648 7.4.4. Find 4650 The Find request can be used to explore the Overlay Instance. A Find 4651 request for a Resource-ID R and a Kind-ID T retrieves the Resource-ID 4652 (if any) of the resource of kind T known to the target peer which is 4653 closest to R. This method can be used to walk the Overlay Instance by 4654 iteratively fetching R_n+1=nearest(1 + R_n). 4656 7.4.4.1. Request Definition 4658 The FindReq message contains a Resource-ID and a series of Kind-IDs 4659 identifying the resource the peer is interested in. 4661 struct { 4662 ResourceId resource; 4663 KindId kinds<0..2^8-1>; 4664 } FindReq; 4666 The request contains a list of Kind-IDs which the Find is for, as 4667 indicated below: 4669 resource 4670 The desired Resource-ID 4672 kinds 4673 The desired Kind-IDs. Each value MUST only appear once, and if 4674 not the request MUST be rejected with an error. 4676 7.4.4.2. Response Definition 4678 A response to a successful Find request is a FindAns message 4679 containing the closest Resource-ID on the peer for each kind 4680 specified in the request. 4682 struct { 4683 KindId kind; 4684 ResourceId closest; 4685 } FindKindData; 4687 struct { 4688 FindKindData results<0..2^16-1>; 4689 } FindAns; 4691 If the processing peer is not responsible for the specified 4692 Resource-ID, it SHOULD return an Error_Not_Found error code. 4694 For each Kind-ID in the request the response MUST contain a 4695 FindKindData indicating the closest Resource-ID for that Kind-ID, 4696 unless the kind is not allowed to be used with Find in which case a 4697 FindKindData for that Kind-ID MUST NOT be included in the response. 4698 If a Kind-ID is not known, then the corresponding Resource-ID MUST be 4699 0. Note that different Kind-IDs may have different closest Resource- 4700 IDs. 4702 The response is simply a series of FindKindData elements, one per 4703 kind, concatenated end-to-end. The contents of each element are: 4705 kind 4706 The Kind-ID. 4708 closest 4709 The closest resource ID to the specified resource ID. This is 0 4710 if no resource ID is known. 4712 Note that the response does not contain the contents of the data 4713 stored at these Resource-IDs. If the requester wants this, it must 4714 retrieve it using Fetch. 4716 7.4.5. Defining New Kinds 4718 There are two ways to define a new Kind. The first is by writing a 4719 document and registering the Kind-ID with IANA. This is the 4720 preferred method for Kinds which may be widely used and reused. The 4721 second method is to simply define the Kind and its parameters in the 4722 configuration document using the section of Kind-id space set aside 4723 for private use. This method MAY be used to define ad hoc Kinds in 4724 new overlays. 4726 However a Kind is defined, the definition MUST include: 4728 o The meaning of the data to be stored (in some textual form). 4729 o The Kind-ID. 4730 o The data model (single value, array, dictionary, etc). 4731 o The access control model. 4733 In addition, when Kinds are registered with IANA, each Kind is 4734 assigned a short string name which is used to refer to it in 4735 configuration documents. 4737 While each Kind needs to define what data model is used for its data, 4738 that does not mean that it must define new data models. Where 4739 practical, Kinds should use the existing data models. The intention 4740 is that the basic data model set be sufficient for most applications/ 4741 usages. 4743 8. Certificate Store Usage 4745 The Certificate Store usage allows a peer to store its certificate in 4746 the overlay, thus avoiding the need to send a certificate in each 4747 message. 4749 A user/peer MUST store its certificate at Resource-IDs derived from 4750 two Resource Names: 4752 o The user name in the certificate. 4754 o The Node-ID in the certificate. 4756 Note that in the second case the certificate is not stored at the 4757 peer's Node-ID but rather at a hash of the peer's Node-ID. The 4758 intention here (as is common throughout RELOAD) is to avoid making a 4759 peer responsible for its own data. 4761 A peer MUST ensure that the user's certificates are stored in the 4762 Overlay Instance. New certificates are stored at the end of the 4763 list. This structure allows users to store an old and a new 4764 certificate that both have the same Node-ID, which allows for 4765 migration of certificates when they are renewed. 4767 This usage defines the following Kinds: 4769 Name: CERTIFICATE_BY_NODE 4771 Data Model: The data model for CERTIFICATE_BY_NODE data is array. 4773 Access Control: NODE-MATCH. 4775 Name: CERTIFICATE_BY_USER 4777 Data Model: The data model for CERTIFICATE_BY_USER data is array. 4779 Access Control: USER-MATCH. 4781 9. TURN Server Usage 4783 The TURN server usage allows a RELOAD peer to advertise that it is 4784 prepared to be a TURN server as defined in [RFC5766]. When a node 4785 starts up, it joins the overlay network and forms several connections 4786 in the process. If the ICE stage in any of these connections returns 4787 a reflexive address that is not the same as the peer's perceived 4788 address, then the peer is behind a NAT and SHOULD NOT be a candidate 4789 for a TURN server. Additionally, if the peer's IP address is in the 4790 private address space range as defined by [RFC1918], then it is also 4791 SHOULD NOT be a candidate for a TURN server. Otherwise, the peer 4792 SHOULD assume it is a potential TURN server and follow the procedures 4793 below. 4795 If the node is a candidate for a TURN server it will insert some 4796 pointers in the overlay so that other peers can find it. The overlay 4797 configuration file specifies a turn-density parameter that indicates 4798 how many times each TURN server SHOULD record itself in the overlay. 4800 Typically this should be set to the reciprocal of the estimate of 4801 what percentage of peers will act as TURN servers. If the turn- 4802 density is not set to zero, for each value, called d, between 1 and 4803 turn-density, the peer forms a Resource Name by concatenating its 4804 Node-ID and the value d. This Resource Name is hashed to form a 4805 Resource-ID. The address of the peer is stored at that Resource-ID 4806 using type TURN-SERVICE and the TurnServer object: 4808 struct { 4809 uint8 iteration; 4810 IpAddressAndPort server_address; 4811 } TurnServer; 4813 The contents of this structure are as follows: 4815 iteration 4816 the d value 4818 server_address 4819 the address at which the TURN server can be contacted. 4821 Note: Correct functioning of this algorithm depends on having turn- 4822 density be an reasonable estimate of the reciprocal of the 4823 proportion of nodes in the overlay that can act as TURN servers. 4824 If the turn-density value in the configuration file is too low, 4825 then the process of finding TURN servers becomes more expensive as 4826 multiple candidate Resource-IDs must be probed to find a TURN 4827 server. 4829 Peers that provide this service need to support the TURN extensions 4830 to STUN for media relay as defined in [RFC5766]. 4832 This usage defines the following Kind to indicate that a peer is 4833 willing to act as a TURN server: 4835 Name TURN-SERVICE 4836 Data Model The TURN-SERVICE Kind stores a single value for each 4837 Resource-ID. 4838 Access Control NODE-MULTIPLE, with maximum iteration counter 20. 4840 Peers MAY find other servers by selecting a random Resource-ID and 4841 then doing a Find request for the appropriate Kind-ID with that 4842 Resource-ID. The Find request gets routed to a random peer based on 4843 the Resource-ID. If that peer knows of any servers, they will be 4844 returned. The returned response may be empty if the peer does not 4845 know of any servers, in which case the process gets repeated with 4846 some other random Resource-ID. As long as the ratio of servers 4847 relative to peers is not too low, this approach will result in 4848 finding a server relatively quickly. 4850 NOTE TO IMPLEMENTERS: As the access control for this usage is not 4851 CERTIFICATE_BY_NODE or CERTIFICATE_BY_USER, the certificates used by 4852 TurnServer entries need to be retained as described in Section 6.3.4. 4854 10. Chord Algorithm 4856 This algorithm is assigned the name CHORD-RELOAD to indicate it is an 4857 adaptation of the basic Chord based DHT algorithm. 4859 This algorithm differs from the originally presented Chord algorithm 4860 [Chord]. It has been updated based on more recent research results 4861 and implementation experiences, and to adapt it to the RELOAD 4862 protocol. A short list of differences: 4864 o The original Chord algorithm specified that a single predecessor 4865 and a successor list be stored. The CHORD-RELOAD algorithm 4866 attempts to have more than one predecessor and successor. The 4867 predecessor sets help other neighbors learn their successor list. 4868 o The original Chord specification and analysis called for iterative 4869 routing. RELOAD specifies recursive routing. In addition to the 4870 performance implications, the cost of NAT traversal dictates 4871 recursive routing. 4872 o Finger table entries are indexed in opposite order. Original 4873 Chord specifies finger[0] as the immediate successor of the peer. 4874 CHORD-RELOAD specifies finger[0] as the peer 180 degrees around 4875 the ring from the peer. This change was made to simplify 4876 discussion and implementation of variable sized finger tables. 4877 However, with either approach no more than O(log N) entries should 4878 typically be stored in a finger table. 4879 o The stabilize() and fix_fingers() algorithms in the original Chord 4880 algorithm are merged into a single periodic process. 4881 Stabilization is implemented slightly differently because of the 4882 larger neighborhood, and fix_fingers is not as aggressive to 4883 reduce load, nor does it search for optimal matches of the finger 4884 table entries. 4885 o RELOAD uses a 128 bit hash instead of a 160 bit hash, as RELOAD is 4886 not designed to be used in networks with close to or more than 4887 2^128 nodes (and it is hard to see how one would assemble such a 4888 network). 4889 o RELOAD uses randomized finger entries as described in 4890 Section 10.7.4.2. 4891 o This algorithm allows the use of either reactive or periodic 4892 recovery. The original Chord paper used periodic recovery. 4893 Reactive recovery provides better performance in small overlays, 4894 but is believed to be unstable in large (>1000) overlays with high 4895 levels of churn [handling-churn-usenix04]. The overlay 4896 configuration file specifies a "chord-reactive" element that 4897 indicates whether reactive recovery should be used. 4899 10.1. Overview 4901 The algorithm described here is a modified version of the Chord 4902 algorithm. Each peer keeps track of a finger table and a neighbor 4903 table. The neighbor table contains at least the three peers before 4904 and after this peer in the DHT ring. There may not be three entries 4905 in all cases such as small rings or while the ring topology is 4906 changing. The first entry in the finger table contains the peer 4907 half-way around the ring from this peer; the second entry contains 4908 the peer that is 1/4 of the way around; the third entry contains the 4909 peer that is 1/8th of the way around, and so on. Fundamentally, the 4910 chord data structure can be thought of a doubly-linked list formed by 4911 knowing the successors and predecessor peers in the neighbor table, 4912 sorted by the Node-ID. As long as the successor peers are correct, 4913 the DHT will return the correct result. The pointers to the prior 4914 peers are kept to enable the insertion of new peers into the list 4915 structure. Keeping multiple predecessor and successor pointers makes 4916 it possible to maintain the integrity of the data structure even when 4917 consecutive peers simultaneously fail. The finger table forms a skip 4918 list, so that entries in the linked list can be found in O(log(N)) 4919 time instead of the typical O(N) time that a linked list would 4920 provide. 4922 A peer, n, is responsible for a particular Resource-ID k if k is less 4923 than or equal to n and k is greater than p, where p is the Node-ID of 4924 the previous peer in the neighbor table. Care must be taken when 4925 computing to note that all math is modulo 2^128. 4927 10.2. Hash Function 4929 For this Chord based topology plugin, the size of the Resource-ID is 4930 128 bits. The hash of a Resource-ID MUST be computed using SHA-1 4931 [RFC3174]then truncating the SHA-1 result to the most significant 128 4932 bits. 4934 10.3. Routing 4936 The routing table is the union of the neighbor table and the finger 4937 table. 4939 If a peer is not responsible for a Resource-ID k, but is directly 4940 connected to a node with Node-ID k, then it MUST route the message to 4941 that node. Otherwise, it MUST route the request to the peer in the 4942 routing table that has the largest Node-ID that is in the interval 4943 between the peer and k. If no such node is found, it finds the 4944 smallest Node-Id that is greater than k and MUST route the message to 4945 that node. 4947 10.4. Redundancy 4949 When a peer receives a Store request for Resource-ID k, and it is 4950 responsible for Resource-ID k, it MUST store the data and returns a 4951 success response. It MUST then sends a Store request to its 4952 successor in the neighbor table and to that peer's successor. Note 4953 that these Store requests are addressed to those specific peers, even 4954 though the Resource-ID they are being asked to store is outside the 4955 range that they are responsible for. The peers receiving these 4956 SHOULD check they came from an appropriate predecessor in their 4957 neighbor table and that they are in a range that this predecessor is 4958 responsible for, and then they MUST store the data. They do not 4959 themselves perform further Stores because they can determine that 4960 they are not responsible for the Resource-ID. 4962 Managing replicas as the overlay changes is described in 4963 Section 10.7.3. 4965 The sequential replicas used in this overlay algorithm protect 4966 against peer failure but not against malicious peers. Additional 4967 replication from the Usage is required to protect resources from such 4968 attacks, as discussed in Section 13.5.4. 4970 10.5. Joining 4972 The join process for a joining party (JP) with Node-ID n is as 4973 follows. 4975 1. JP MUST connect to its chosen bootstrap node. 4976 2. JP SHOULD send an Attach request to the admitting peer (AP) for 4977 Node-ID n. The "send_update" flag should be used to acquire the 4978 routing table for AP. 4979 3. JP SHOULD send Attach requests to initiate connections to each of 4980 the peers in the neighbor table as well as to the desired finger 4981 table entries. Note that this does not populate their routing 4982 tables, but only their connection tables, so JP will not get 4983 messages that it is expected to route to other nodes. 4984 4. JP MUST enter all the peers it has contacted into its routing 4985 table. 4986 5. JP MUST send a Join to AP. The AP sends the response to the 4987 Join. 4989 6. AP MUST do a series of Store requests to JP to store the data 4990 that JP will be responsible for. 4991 7. AP MUST send JP an Update explicitly labeling JP as its 4992 predecessor. At this point, JP is part of the ring and 4993 responsible for a section of the overlay. AP can now forget any 4994 data which is assigned to JP and not AP. 4995 8. The AP MUST send an Update to all of its neighbors with the new 4996 values of its neighbor set (including JP). 4997 9. The JP MUST send Updates to all the peers in its neighbor table. 4999 If JP sends an Attach to AP with send_update, it immediately knows 5000 most of its expected neighbors from AP's routing table update and can 5001 directly connect to them. This is the RECOMMENDED procedure. 5003 If for some reason JP does not get AP's routing table, it can still 5004 populate its neighbor table incrementally. It sends a Ping directed 5005 at Resource-ID n+1 (directly after its own Resource-ID). This allows 5006 it to discover its own successor. Call that node p0. It then sends 5007 a ping to p0+1 to discover its successor (p1). This process can be 5008 repeated to discover as many successors as desired. The values for 5009 the two peers before p will be found at a later stage when n receives 5010 an Update. An alternate procedure is to send Attaches to those nodes 5011 rather than pings, which forms the connections immediately but may be 5012 slower if the nodes need to collect ICE candidates, thus reducing 5013 parallelism. 5015 In order to set up its finger table entry for peer i, JP simply sends 5016 an Attach to peer (n+2^(128-i). This will be routed to a peer in 5017 approximately the right location around the ring. 5019 The joining peer MUST NOT send any Update message placing itself in 5020 the overlay until it has successfully completed an Attach with each 5021 peer that should be in its neighbor table. 5023 10.6. Routing Attaches 5025 When a peer needs to Attach to a new peer in its neighbor table, it 5026 MUST source-route the Attach request through the peer from which it 5027 learned the new peer's Node-ID. Source-routing these requests allows 5028 the overlay to recover from instability. 5030 All other Attach requests, such as those for new finger table 5031 entries, are routed conventionally through the overlay. 5033 10.7. Updates 5035 An Update for this DHT is defined as 5036 enum { reserved (0), 5037 peer_ready(1), neighbors(2), full(3), (255) } 5038 ChordUpdateType; 5040 struct { 5041 uint32 uptime; 5042 ChordUpdateType type; 5043 select(type){ 5044 case peer_ready: /* Empty */ 5045 ; 5047 case neighbors: 5048 NodeId predecessors<0..2^16-1>; 5049 NodeId successors<0..2^16-1>; 5051 case full: 5052 NodeId predecessors<0..2^16-1>; 5053 NodeId successors<0..2^16-1>; 5054 NodeId fingers<0..2^16-1>; 5055 }; 5056 } ChordUpdate; 5058 The "uptime" field contains the time this peer has been up in 5059 seconds. 5061 The "type" field contains the type of the update, which depends on 5062 the reason the update was sent. 5064 peer_ready: this peer is ready to receive messages. This message 5065 is used to indicate that a node which has Attached is a peer and 5066 can be routed through. It is also used as a connectivity check to 5067 non-neighbor peers. 5069 neighbors: this version is sent to members of the Chord neighbor 5070 table. 5072 full: this version is sent to peers which request an Update with a 5073 RouteQueryReq. 5075 If the message is of type "neighbors", then the contents of the 5076 message will be: 5078 predecessors 5079 The predecessor set of the Updating peer. 5081 successors 5082 The successor set of the Updating peer. 5084 If the message is of type "full", then the contents of the message 5085 will be: 5087 predecessors 5088 The predecessor set of the Updating peer. 5090 successors 5091 The successor set of the Updating peer. 5093 fingers 5094 The finger table of the Updating peer, in numerically ascending 5095 order. 5097 A peer MUST maintain an association (via Attach) to every member of 5098 its neighbor set. A peer MUST attempt to maintain at least three 5099 predecessors and three successors, even though this will not be 5100 possible if the ring is very small. It is RECOMMENDED that O(log(N)) 5101 predecessors and successors be maintained in the neighbor set. 5103 10.7.1. Handling Neighbor Failures 5105 Every time a connection to a peer in the neighbor table is lost (as 5106 determined by connectivity pings or the failure of some request), the 5107 peer MUST remove the entry from its neighbor table and replace it 5108 with the best match it has from the other peers in its routing table. 5109 If using reactive recovery, it then sends an immediate Update to all 5110 nodes in its Neighbor Table. The update will contain all the Node- 5111 IDs of the current entries of the table (after the failed one has 5112 been removed). Note that when replacing a successor the peer SHOULD 5113 delay the creation of new replicas for successor replacement hold- 5114 down time (30 seconds) after removing the failed entry from its 5115 neighbor table in order to allow a triggered update to inform it of a 5116 better match for its neighbor table. 5118 If the neighbor failure effects the peer's range of responsible IDs, 5119 then the Update MUST be sent to all nodes in its Connection Table. 5121 A peer MAY attempt to reestablish connectivity with a lost neighbor 5122 either by waiting additional time to see if connectivity returns or 5123 by actively routing a new Attach to the lost peer. Details for these 5124 procedures are beyond the scope of this document. In no event does 5125 an attempt to reestablish connectivity with a lost neighbor allow the 5126 peer to remain in the neighbor table. Such a peer is returned to the 5127 neighbor table once connectivity is reestablished. 5129 If connectivity is lost to all successor peers in the neighbor table, 5130 then this peer should behave as if it is joining the network and use 5131 Pings to find a peer and send it a Join. If connectivity is lost to 5132 all the peers in the finger table, this peer should assume that it 5133 has been disconnected from the rest of the network, and it should 5134 periodically try to join the DHT. 5136 10.7.2. Handling Finger Table Entry Failure 5138 If a finger table entry is found to have failed, all references to 5139 the failed peer are removed from the finger table and replaced with 5140 the closest preceding peer from the finger table or neighbor table. 5142 If using reactive recovery, the peer initiates a search for a new 5143 finger table entry as described below. 5145 10.7.3. Receiving Updates 5147 When a peer, N, receives an Update request, it examines the Node-IDs 5148 in the UpdateReq and at its neighbor table and decides if this 5149 UpdateReq would change its neighbor table. This is done by taking 5150 the set of peers currently in the neighbor table and comparing them 5151 to the peers in the update request. There are two major cases: 5153 o The UpdateReq contains peers that match N's neighbor table, so no 5154 change is needed to the neighbor set. 5155 o The UpdateReq contains peers N does not know about that should be 5156 in N's neighbor table, i.e. they are closer than entries in the 5157 neighbor table. 5159 In the first case, no change is needed. 5161 In the second case, N MUST attempt to Attach to the new peers and if 5162 it is successful it MUST adjust its neighbor set accordingly. Note 5163 that it can maintain the now inferior peers as neighbors, but it MUST 5164 remember the closer ones. 5166 After any Pings and Attaches are done, if the neighbor table changes 5167 and the peer is using reactive recovery, the peer sends an Update 5168 request to each member of its Connection Table. These Update 5169 requests are what end up filling in the predecessor/successor tables 5170 of peers that this peer is a neighbor to. A peer MUST NOT enter 5171 itself in its successor or predecessor table and instead should leave 5172 the entries empty. 5174 If peer N is responsible for a Resource-ID R, and N discovers that 5175 the replica set for R (the next two nodes in its successor set) has 5176 changed, it MUST send a Store for any data associated with R to any 5177 new node in the replica set. It SHOULD NOT delete data from peers 5178 which have left the replica set. 5180 When a peer N detects that it is no longer in the replica set for a 5181 resource R (i.e., there are three predecessors between N and R), it 5182 SHOULD delete all data associated with R from its local store. 5184 When a peer discovers that its range of responsible IDs have changed, 5185 it MUST send an Update to all entries in its connection table. 5187 10.7.4. Stabilization 5189 There are four components to stabilization: 5190 1. exchange Updates with all peers in its neighbor table to exchange 5191 state. 5192 2. search for better peers to place in its finger table. 5193 3. search to determine if the current finger table size is 5194 sufficiently large. 5195 4. search to determine if the overlay has partitioned and needs to 5196 recover. 5198 10.7.4.1. Updating neighbor table 5200 A peer MUST periodically send an Update request to every peer in its 5201 Connection Table. The purpose of this is to keep the predecessor and 5202 successor lists up to date and to detect failed peers. The default 5203 time is about every ten minutes, but the configuration server SHOULD 5204 set this in the configuration document using the "chord-update- 5205 interval" element (denominated in seconds.) A peer SHOULD randomly 5206 offset these Update requests so they do not occur all at once. 5208 10.7.4.2. Refreshing finger table 5210 A peer MUST periodically search for new peers to replace invalid 5211 entries in the finger table. A finger table entry i is valid if it 5212 is in the range [ n+2^( 128-i ) , n+2^( 128-(i-1) )-1 ]. Invalid 5213 entries occur in the finger table when a previous finger table entry 5214 has failed or when no peer has been found in that range. 5216 A peer SHOULD NOT send Ping requests looking for new finger table 5217 entries more often than the configuration element "chord-ping- 5218 interval", which defaults to 3600 seconds (one per hour). 5220 Two possible methods for searching for new peers for the finger table 5221 entries are presented: 5223 Alternative 1: A peer selects one entry in the finger table from 5224 among the invalid entries. It pings for a new peer for that finger 5225 table entry. The selection SHOULD be exponentially weighted to 5226 attempt to replace earlier (lower i) entries in the finger table. A 5227 simple way to implement this selection is to search through the 5228 finger table entries from i=0 and each time an invalid entry is 5229 encountered, send a Ping to replace that entry with probability 0.5. 5231 Alternative 2: A peer monitors the Update messages received from its 5232 connections to observe when an Update indicates a peer that would be 5233 used to replace in invalid finger table entry, i, and flags that 5234 entry in the finger table. Every "chord-ping-interval" seconds, the 5235 peer selects from among those flagged candidates using an 5236 exponentially weighted probability as above. 5238 When searching for a better entry, the peer SHOULD send the Ping to a 5239 Node-ID selected randomly from that range. Random selection is 5240 preferred over a search for strictly spaced entries to minimize the 5241 effect of churn on overlay routing [minimizing-churn-sigcomm06]. An 5242 implementation or subsequent specification MAY choose a method for 5243 selecting finger table entries other than choosing randomly within 5244 the range. Any such alternate methods SHOULD be employed only on 5245 finger table stabilization and not for the selection of initial 5246 finger table entries unless the alternative method is faster and 5247 imposes less overhead on the overlay. 5249 A peer MAY choose to keep connections to multiple peers that can act 5250 for a given finger table entry. 5252 10.7.4.3. Adjusting finger table size 5254 If the finger table has less than 16 entries, the node SHOULD attempt 5255 to discover more fingers to grow the size of the table to 16. The 5256 value 16 was chosen to ensure high odds of a node maintaining 5257 connectivity to the overlay even with strange network partitions. 5259 For many overlays, 16 finger table entries will be enough, but as an 5260 overlay grows very large, more than 16 entries may be required in the 5261 finger table for efficient routing. An implementation SHOULD be 5262 capable of increasing the number of entries in the finger table to 5263 128 entries. 5265 Note to implementers: Although log(N) entries are all that are 5266 required for optimal performance, careful implementation of 5267 stabilization will result in no additional traffic being generated 5268 when maintaining a finger table larger than log(N) entries. 5269 Implementers are encouraged to make use of RouteQuery and algorithms 5270 for determining where new finger table entries may be found. 5271 Complete details of possible implementations are outside the scope of 5272 this specification. 5274 A simple approach to sizing the finger table is to ensure the finger 5275 table is large enough to contain at least the final successor in the 5276 peer's neighbor table. 5278 10.7.4.4. Detecting partitioning 5280 To detect that a partitioning has occurred and to heal the overlay, a 5281 peer P MUST periodically repeat the discovery process used in the 5282 initial join for the overlay to locate an appropriate bootstrap node, 5283 B. P should then send a Ping for its own Node-ID routed through B. If 5284 a response is received from a peer S', which is not P's successor, 5285 then the overlay is partitioned and P should send an Attach to S' 5286 routed through B, followed by an Update sent to S'. (Note that S' 5287 may not be in P's neighbor table once the overlay is healed, but the 5288 connection will allow S' to discover appropriate neighbor entries for 5289 itself via its own stabilization.) 5291 Future specifications may describe alternative mechanisms for 5292 determining when to repeat the discovery process. 5294 10.8. Route query 5296 For this topology plugin, the RouteQueryReq contains no additional 5297 information. The RouteQueryAns contains the single node ID of the 5298 next peer to which the responding peer would have routed the request 5299 message in recursive routing: 5301 struct { 5302 NodeId next_peer; 5303 } ChordRouteQueryAns; 5305 The contents of this structure are as follows: 5307 next_peer 5308 The peer to which the responding peer would route the message in 5309 order to deliver it to the destination listed in the request. 5311 If the requester has set the send_update flag, the responder SHOULD 5312 initiate an Update immediately after sending the RouteQueryAns. 5314 10.9. Leaving 5316 To support extensions, such as [I-D.ietf-p2psip-self-tuning], Peers 5317 SHOULD send a Leave request to all members of their neighbor table 5318 prior to exiting the Overlay Instance. The overlay_specific_data 5319 field MUST contain the ChordLeaveData structure defined below: 5321 enum { reserved (0), 5322 from_succ(1), from_pred(2), (255) } 5323 ChordLeaveType; 5325 struct { 5326 ChordLeaveType type; 5328 select(type) { 5329 case from_succ: 5330 NodeId successors<0..2^16-1>; 5331 case from_pred: 5332 NodeId predecessors<0..2^16-1>; 5333 }; 5334 } ChordLeaveData; 5336 The 'type' field indicates whether the Leave request was sent by a 5337 predecessor or a successor of the recipient: 5339 from_succ 5340 The Leave request was sent by a successor. 5342 from_pred 5343 The Leave request was sent by a predecessor. 5345 If the type of the request is 'from_succ', the contents will be: 5347 successors 5348 The sender's successor list. 5350 If the type of the request is 'from_pred', the contents will be: 5352 predecessors 5353 The sender's predecessor list. 5355 Any peer which receives a Leave for a peer n in its neighbor set 5356 follows procedures as if it had detected a peer failure as described 5357 in Section 10.7.1. 5359 11. Enrollment and Bootstrap 5361 The section defines the format of the configuration data as well the 5362 process to join a new overlay. 5364 11.1. Overlay Configuration 5366 This specification defines a new content type "application/ 5367 p2p-overlay+xml" for an MIME entity that contains overlay 5368 information. An example document is shown below. 5370 5371 5374 5376 CHORD-RELOAD 5377 16 5378 5379 MIIDJDCCAo2gAwIBAgIBADANBgkqhkiG9w0BAQUFADBwMQswCQYDVQQGEwJVUzET 5380 MBEGA1UECBMKQ2FsaWZvcm5pYTERMA8GA1UEBxMIU2FuIEpvc2UxDjAMBgNVBAoT 5381 BXNpcGl0MSkwJwYDVQQLEyBTaXBpdCBUZXN0IENlcnRpZmljYXRlIEF1dGhvcml0 5382 eTAeFw0wMzA3MTgxMjIxNTJaFw0xMzA3MTUxMjIxNTJaMHAxCzAJBgNVBAYTAlVT 5383 MRMwEQYDVQQIEwpDYWxpZm9ybmlhMREwDwYDVQQHEwhTYW4gSm9zZTEOMAwGA1UE 5384 ChMFc2lwaXQxKTAnBgNVBAsTIFNpcGl0IFRlc3QgQ2VydGlmaWNhdGUgQXV0aG9y 5385 aXR5MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDDIh6DkcUDLDyK9BEUxkud 5386 +nJ4xrCVGKfgjHm6XaSuHiEtnfELHM+9WymzkBNzZpJu30yzsxwfKoIKugdNUrD4 5387 N3viCicwcN35LgP/KnbN34cavXHr4ZlqxH+OdKB3hQTpQa38A7YXdaoz6goW2ft5 5388 Mi74z03GNKP/G9BoKOGd5QIDAQABo4HNMIHKMB0GA1UdDgQWBBRrRhcU6pR2JYBU 5389 bhNU2qHjVBShtjCBmgYDVR0jBIGSMIGPgBRrRhcU6pR2JYBUbhNU2qHjVBShtqF0 5390 pHIwcDELMAkGA1UEBhMCVVMxEzARBgNVBAgTCkNhbGlmb3JuaWExETAPBgNVBAcT 5391 CFNhbiBKb3NlMQ4wDAYDVQQKEwVzaXBpdDEpMCcGA1UECxMgU2lwaXQgVGVzdCBD 5392 ZXJ0aWZpY2F0ZSBBdXRob3JpdHmCAQAwDAYDVR0TBAUwAwEB/zANBgkqhkiG9w0B 5393 AQUFAAOBgQCWbRvv1ZGTRXxbH8/EqkdSCzSoUPrs+rQqR0xdQac9wNY/nlZbkR3O 5394 qAezG6Sfmklvf+DOg5RxQq/+Y6I03LRepc7KeVDpaplMFGnpfKsibETMipwzayNQ 5395 QgUf4cKBiF+65Ue7hZuDJa2EMv8qW4twEhGDYclpFU9YozyS1OhvUg== 5396 5397 YmFkIGNlcnQK 5398 https://example.org 5399 https://example.net 5400 false 5402 5403 5404 5405 20 5406 5407 5408 false 5409 false 5410 5411 400 5412 30 5413 true 5414 password 5415 4000 5416 30 5417 3000 5418 TLS 5419 47112162e84c69ba 5420 47112162e84c69ba 5421 6eba45d31a900c06 5422 6ebc45d31a900c06 5423 6ebc45d31a900ca6 5425 foo 5427 5428 urn:ietf:params:xml:ns:p2p:config-ext1 5429 5431 5432 5433 5434 SINGLE 5435 USER-MATCH 5436 1 5437 100 5438 5439 5440 VGhpcyBpcyBub3QgcmlnaHQhCg== 5441 5442 5443 5444 5445 ARRAY 5446 NODE-MULTIPLE 5447 3 5448 22 5449 4 5450 1 5451 5452 5453 5454 VGhpcyBpcyBub3QgcmlnaHQhCg== 5456 5457 5458 5459 5460 VGhpcyBpcyBub3QgcmlnaHQhCg== 5462 5463 5464 VGhpcyBpcyBub3QgcmlnaHQhCg== 5466 5468 The file MUST be a well formed XML document and it SHOULD contain an 5469 encoding declaration in the XML declaration. The file MUST use the 5470 UTF-8 character encoding. The namespace for the elements defined in 5471 this specification is urn:ietf:params:xml:ns:p2p:config-base and 5472 urn:ietf:params:xml:ns:p2p:config-chord". 5474 The file can contain multiple "configuration" elements where each one 5475 contains the configuration information for a different overlay. Each 5476 configuration element may be followed by signature elements that 5477 provides a signature over the preceding configuration element. Each 5478 configuration element has the following attributes: 5480 instance-name: name of the overlay 5481 expiration: time in the future at which this overlay configuration 5482 is no longer valid. The node SHOULD retrieve a new copy of the 5483 configuration at a randomly selected time that is before the 5484 expiration time. Note that if the certificates expire before a 5485 new configuration is retried, the node will not be able to 5486 validate the configuration file. All times MUST be in UTC. 5487 sequence: a monotonically increasing sequence number between 0 and 5488 2^16-2 5490 Inside each overlay element, the following elements can occur: 5492 topology-plugin This element defines the overlay algorithm being 5493 used. If missing the default is "CHORD-RELOAD". 5494 node-id-length This element contains the length of a NodeId 5495 (NodeIdLength) in bytes. This value MUST be between 16 (128 bits) 5496 and 20 (160 bits). If this element is not present, the default of 5497 16 is used. 5498 root-cert This element contains a base-64 encoded X.509v3 5499 certificate that is a root trust anchor used to sign all 5500 certificates in this overlay. There can be more than one root- 5501 cert element. 5503 enrollment-server This element contains the URL at which the 5504 enrollment server can be reached in a "url" element. This URL 5505 MUST be of type "https:". More than one enrollment-server element 5506 may be present. Note that there is no necessary relationship 5507 between the overlay name/configuration server name and the 5508 enrollment server name. 5509 self-signed-permitted This element indicates whether self-signed 5510 certificates are permitted. If it is set to "true", then self- 5511 signed certificates are allowed, in which case the enrollment- 5512 server and root-cert elements may be absent. Otherwise, it SHOULD 5513 be absent, but MAY be set to "false". This element also contains 5514 an attribute "digest" which indicates the digest to be used to 5515 compute the Node-ID. Valid values for this parameter are "sha1" 5516 and "sha256" representing SHA-1 [RFC3174] and SHA-256 [RFC6234] 5517 respectively. Implementations MUST support both of these 5518 algorithms. 5519 bootstrap-node This element represents the address of one of the 5520 bootstrap nodes. It has an attribute called "address" that 5521 represents the IP address (either IPv4 or IPv6, since they can be 5522 distinguished) and an optional attribute called "port" that 5523 represents the port and defaults to 6084. The IP address is in 5524 typical hexadecimal form using standard period and colon 5525 separators as specified in [RFC5952]. More than one bootstrap- 5526 peer element may be present. 5527 turn-density This element is a positive integer that represents the 5528 approximate reciprocal of density of nodes that can act as TURN 5529 servers. For example, if 5% of the nodes can act as TURN servers, 5530 this would be set to 20. If it is not present, the default value 5531 is 1. If there are no TURN servers in the overlay, it is set to 5532 zero. 5533 multicast-bootstrap This element represents the address of a 5534 multicast, broadcast, or anycast address and port that may be used 5535 for bootstrap. Nodes SHOULD listen on the address. It has an 5536 attributed called "address" that represents the IP address and an 5537 optional attribute called "port" that represents the port and 5538 defaults to 6084. More than one "multicast-bootstrap" element may 5539 be present. 5540 clients-permitted This element represents whether clients are 5541 permitted or whether all nodes must be peers. If it is set to 5542 "true" or absent, this indicates that clients are permitted. If 5543 it is set to "false" then nodes are not allowed to remain clients 5544 after the initial join. There is currently no way for the overlay 5545 to enforce this. 5546 no-ice This element represents whether nodes are required to use 5547 the "No-ICE" Overlay Link protocols in this overlay. If it is 5548 absent, it is treated as if it were set to "false". 5550 chord-update-interval The update frequency for the Chord-reload 5551 topology plugin (see Section 10). 5552 chord-ping-interval The ping frequency for the Chord-reload 5553 topology plugin (see Section 10). 5554 chord-reactive Whether reactive recovery should be used for this 5555 overlay. Set to "true" or "false". Default if missing is "true". 5556 (see Section 10). 5557 shared-secret If shared secret mode is used, this contains the 5558 shared secret. The security guarantee here is that any agent 5559 which is able to access the configuration document (presumably 5560 protected by some sort of HTTP access control or network topology) 5561 is able to recover the shared secret and hence join the overlay. 5562 max-message-size Maximum size in bytes of any message in the 5563 overlay. If this value is not present, the default is 5000. 5564 initial-ttl Initial default TTL (time to live, see Section 6.3.2) 5565 for messages. If this value is not present, the default is 100. 5566 overlay-reliability-timer Default value for the end-to-end 5567 retransmission timer for messages, in milliseconds. If not 5568 present, the default value is 3000. 5569 overlay-link-protocol Indicates a permissible overlay link protocol 5570 (see Section 6.6.1 for requirements for such protocols). An 5571 arbitrary number of these elements may appear. If none appear, 5572 then this implies the default value, "TLS", which refers to the 5573 use of TLS and DTLS. If one or more elements appear, then no 5574 default value applies. 5575 kind-signer This contains a single Node-ID in hexadecimal and 5576 indicates that the certificate with this Node-ID is allowed to 5577 sign Kinds. Identifying kind-signer by Node-ID instead of 5578 certificate allows the use of short lived certificates without 5579 constantly having to provide an updated configuration file. 5580 configuration-signer This contains a single Node-ID in hexadecimal 5581 and indicates that the certificate with this Node-ID is allowed to 5582 sign configurations for this instance-name. Identifying the 5583 signer by Node-ID instead of certificate allows the use of short 5584 lived certificates without constantly having to provide an updated 5585 configuration file. 5586 bad-node This contains a single Node-ID in hexadecimal and 5587 indicates that the certificate with this Node-ID MUST NOT be 5588 considered valid. This allows certificate revocation. An 5589 arbitrary number of these elements can be provided. Note that 5590 because certificates may expire, bad-node entries need only be 5591 present for the lifetime of the certificate. Technically 5592 speaking, bad node-ids may be reused once their certificates have 5593 expired, the requirement for node-ids to be pseudo randomly 5594 generated gives this event a vanishing probability. 5596 mandatory-extension This element contains the name of an XML 5597 namespace that a node joining the overlay MUST support. The 5598 presence of a mandatory-extension element does not require the 5599 extension to be used in the current configuration file, but can 5600 indicate that it may be used in the future. Note that the 5601 namespace is case-sensitive, as specified in [w3c-xml-namespaces] 5602 Section 2.3. More than one mandatory-extension element may be 5603 present. 5605 Inside each overlay element, the required-kinds elements can also 5606 occur. This element indicates the Kinds that members must support 5607 and contains multiple kind-block elements that each define a single 5608 Kind that MUST be supported by nodes in the overlay. Each kind-block 5609 consists of a single kind element and a kind-signature. The kind 5610 element defines the Kind. The kind-signature is the signature 5611 computed over the kind element. 5613 Each kind has either an id attribute or a name attribute. The name 5614 attribute is a string representing the Kind (the name registered to 5615 IANA) while the id is an integer Kind-ID allocated out of private 5616 space. 5618 In addition, the kind element contains the following elements: 5619 max-count: the maximum number of values which members of the overlay 5620 must support. 5621 data-model: the data model to be used. 5622 max-size: the maximum size of individual values. 5623 access-control: the access control model to be used. 5624 max-node-multiple: This is optional and only used when the access 5625 control is NODE-MULTIPLE. This indicates the maximum value for 5626 the i counter. This is an integer greater than 0. 5628 All of the non optional values MUST be provided. If the Kind is 5629 registered with IANA, the data-model and access-control elements MUST 5630 match those in the Kind registration, and clients MUST ignore them in 5631 favor of the IANA versions. Multiple required-kinds elements MAY be 5632 present. 5634 The kind-block element also MUST contain a "kind-signature" element. 5635 This signature is computed across the kind from the beginning of the 5636 first < of the kind to the end of the last > of the kind in the same 5637 way as the signature element described later in this section. 5639 The configuration file needs to be treated as a binary blob that 5640 cannot be changed - including any whitespace changes - or the 5641 signature will break. The signature is computed by taking each 5642 configuration element and starting from, and including, the first < 5643 at the start of up to and including the > in 5644 and treating this as a binary blob that is signed 5645 using the standard SecurityBlock defined in Section 6.3.4. The 5646 SecurityBlock is base 64 encoded using the base64 alphabet from 5647 RFC[RFC4648] and put in the signature element following the 5648 configuration object in the configuration file. Any configuration 5649 file through the overlay (as opposed to directly from the 5650 configuration server) MUST be signed by one of the configure-signers 5651 from the previous extant configuration. Recipients MUST verify the 5652 signature prior to accepting the configuration file. 5654 When a node receives a new configuration file, it MUST change its 5655 configuration to meet the new requirements. This may require the 5656 node to exit the DHT and re-join. If a node is not capable of 5657 supporting the new requirements, it MUST exit the overlay. If some 5658 information about a particular Kind changes from what the node 5659 previously knew about the Kind (for example the max size), the new 5660 information in the configuration files overrides any previously 5661 learned information. If any Kind data was signed by a node that is 5662 no longer allowed to sign kinds, that Kind MUST be discarded along 5663 with any stored information of that Kind. Note that forcing an 5664 avalanche restart of the overlay with a configuration change that 5665 requires re-joining the overlay may result in serious performance 5666 problems, including total collapse of the network if configuration 5667 parameters are not properly considered. Such an event may be 5668 necessary in case of a compromised CA or similar problem, but for 5669 large overlays should be avoided in almost all circumstances. 5671 11.1.1. Relax NG Grammar 5673 The grammar for the configuration data is: 5675 namespace chord = "urn:ietf:params:xml:ns:p2p:config-chord" 5676 namespace local = "" 5677 default namespace p2pcf = "urn:ietf:params:xml:ns:p2p:config-base" 5678 namespace rng = "http://relaxng.org/ns/structure/1.0" 5680 anything = 5681 (element * { anything } 5682 | attribute * { text } 5683 | text)* 5685 foreign-elements = element * - (p2pcf:* | local:* | chord:*) 5686 { anything }* 5687 foreign-attributes = attribute * - (p2pcf:*|local:*|chord:*) 5688 { text }* 5689 foreign-nodes = (foreign-attributes | foreign-elements)* 5691 start = element p2pcf:overlay { 5692 overlay-element 5693 } 5695 overlay-element &= element configuration { 5696 attribute instance-name { xsd:string }, 5697 attribute expiration { xsd:dateTime }?, 5698 attribute sequence { xsd:long }?, 5699 foreign-attributes*, 5700 parameter 5701 }+ 5702 overlay-element &= element signature { 5703 attribute algorithm { signature-algorithm-type }?, 5704 xsd:base64Binary 5705 }* 5707 signature-algorithm-type |= "rsa-sha1" 5708 signature-algorithm-type |= xsd:string # signature alg extensions 5710 parameter &= element topology-plugin { topology-plugin-type }? 5711 topology-plugin-type |= xsd:string # topo plugin extensions 5712 parameter &= element max-message-size { xsd:unsignedInt }? 5713 parameter &= element initial-ttl { xsd:int }? 5714 parameter &= element root-cert { xsd:base64Binary }* 5715 parameter &= element required-kinds { kind-block* }? 5716 parameter &= element enrollment-server { xsd:anyURI }* 5717 parameter &= element kind-signer { xsd:string }* 5718 parameter &= element configuration-signer { xsd:string }* 5719 parameter &= element bad-node { xsd:string }* 5720 parameter &= element no-ice { xsd:boolean }? 5721 parameter &= element shared-secret { xsd:string }? 5722 parameter &= element overlay-link-protocol { xsd:string }* 5723 parameter &= element clients-permitted { xsd:boolean }? 5724 parameter &= element turn-density { xsd:unsignedByte }? 5725 parameter &= element node-id-length { xsd:int }? 5726 parameter &= element mandatory-extension { xsd:string }* 5727 parameter &= foreign-elements* 5729 parameter &= 5730 element self-signed-permitted { 5731 attribute digest { self-signed-digest-type }, 5732 xsd:boolean 5733 }? 5734 self-signed-digest-type |= "sha1" 5735 self-signed-digest-type |= xsd:string # signature digest extensions 5737 parameter &= element bootstrap-node { 5738 attribute address { xsd:string }, 5739 attribute port { xsd:int }? 5741 }* 5743 parameter &= element multicast-bootstrap { 5744 attribute address { xsd:string }, 5745 attribute port { xsd:int }? 5746 }* 5748 kind-block = element kind-block { 5749 element kind { 5750 ( attribute name { kind-names } 5751 | attribute id { xsd:unsignedInt } ), 5752 kind-parameter 5753 } & 5754 element kind-signature { 5755 attribute algorithm { signature-algorithm-type }?, 5756 xsd:base64Binary 5757 }? 5758 } 5760 kind-parameter &= element max-count { xsd:int } 5761 kind-parameter &= element max-size { xsd:int } 5762 kind-parameter &= element max-node-multiple { xsd:int }? 5764 kind-parameter &= element data-model { data-model-type } 5765 data-model-type |= "SINGLE" 5766 data-model-type |= "ARRAY" 5767 data-model-type |= "DICTIONARY" 5768 data-model-type |= xsd:string # data model extensions 5770 kind-parameter &= element access-control { access-control-type } 5771 access-control-type |= "USER-MATCH" 5772 access-control-type |= "NODE-MATCH" 5773 access-control-type |= "USER-NODE-MATCH" 5774 access-control-type |= "NODE-MULTIPLE" 5775 access-control-type |= xsd:string # access control extensions 5777 kind-parameter &= foreign-elements* 5779 kind-names |= "TURN-SERVICE" 5780 kind-names |= "CERTIFICATE_BY_NODE" 5781 kind-names |= "CERTIFICATE_BY_USER" 5782 kind-names |= xsd:string # kind extensions 5784 # Chord specific parameters 5785 topology-plugin-type |= "CHORD-RELOAD" 5786 parameter &= element chord:chord-ping-interval { xsd:int }? 5787 parameter &= element chord:chord-update-interval { xsd:int }? 5788 parameter &= element chord:chord-reactive { xsd:boolean }? 5790 11.2. Discovery Through Configuration Server 5792 When a node first enrolls in a new overlay, it starts with a 5793 discovery process to find a configuration server. 5795 The node MAY start by determining the overlay name. This value is 5796 provided by the user or some other out of band provisioning 5797 mechanism. The out of band mechanisms MAY also provide an optional 5798 URL for the configuration server. If a URL for the configuration 5799 server is not provided, the node MUST do a DNS SRV query using a 5800 Service name of "p2psip-enroll" and a protocol of TCP to find a 5801 configuration server and form the URL by appending a path of "/.well- 5802 known/p2psip-enroll" to the overlay name. This uses the "well known 5803 URI" framework defined in [RFC5785]. For example, if the overlay 5804 name was example.com, the URL would be 5805 "https://example.com/.well-known/p2psip-enroll". 5807 Once an address and URL for the configuration server is determined, 5808 the peer MUST form an HTTPS connection to that IP address. The 5809 certificate MUST match the overlay name as described in [RFC2818]. 5810 Then the node MUST fetch a new copy of the configuration file. To do 5811 this, the peer performs a GET to the URL. The result of the HTTP GET 5812 is an XML configuration file described above, which MUST replace any 5813 previously learned configuration file for this overlay. 5815 For overlays that do not use a configuration server, nodes need to 5816 obtain the configuration information needed to join the overlay 5817 through some out of band approach such an XML configuration file sent 5818 over email. 5820 11.3. Credentials 5822 If the configuration document contains a enrollment-server element, 5823 credentials are required to join the Overlay Instance. A peer which 5824 does not yet have credentials MUST contact the enrollment server to 5825 acquire them. 5827 RELOAD defines its own trivial certificate request protocol. We 5828 would have liked to have used an existing protocol but were concerned 5829 about the implementation burden of even the simplest of those 5830 protocols, such as [RFC5272] and [RFC5273]. The objective was to 5831 have a protocol which could be easily implemented in a Web server 5832 which the operator did not control (e.g., in a hosted service) and 5833 was compatible with the existing certificate handling tooling as used 5834 with the Web certificate infrastructure. This means accepting bare 5835 PKCS#10 requests and returning a single bare X.509 certificate. 5836 Although the MIME types for these objects are defined, none of the 5837 existing protocols support exactly this model. 5839 The certificate request protocol is performed over HTTPS. The 5840 request is an HTTP POST with the parameter encodes as described in 5841 [RFC2388] and the following properties: 5843 o If authentication is required, there is an form parameter of 5844 "password" and "username" containing the user's name and password 5845 in the clear (hence the need for HTTPS) 5846 o If more than one Node-ID is required, there is an form parameter 5847 of "nodeids" containing the number of Node-IDs required. 5848 o There MUST be a form parameter of "csr" with a content type of 5849 "application/pkcs10", as defined in [RFC2311]. 5850 o The Accept header MUST contain the type "application/pkix-cert", 5851 indicating the type that is expected in the response. 5853 The enrollment server MUST authenticate the request using the 5854 provided user name and password. The reason for using the RFC 2388 5855 "multipart/form-data" encoding is so that the password parameter will 5856 not be encoded in the URL to reduce the chance of accidental leakage 5857 of the password. If the authentication succeeds and the requested 5858 user name is acceptable, the server generates and returns a 5859 certificate for the certificate signing request in the "csr" 5860 parameter of the request. The SubjectAltName field in the 5861 certificate contains the following values: 5863 o One or more Node-IDs which MUST be cryptographically random 5864 [RFC4086]. Each MUST be chosen by the enrollment server in such a 5865 way that they are unpredictable to the requesting user. E.g., the 5866 user MUST NOT be informed of potential (random) Node-IDs prior to 5867 authenticating. Each is placed in the subjectAltName using the 5868 uniformResourceIdentifier type and MUST contain RELOAD URIs as 5869 described in Section 14.15 and MUST contain a Destination list 5870 with a single entry of type "node_id". The enrollment server 5871 SHOULD maintain a mapping of users to node-ids and if the same 5872 user returns (e.g., to have their certificate re-issued) return 5873 the same Node-ID, thus avoiding the need for implementations to 5874 re-store all their data when their certificates expire. 5875 o A single name this user is allowed to use in the overlay, using 5876 type rfc822Name. Enrollment servers SHOULD take care to only 5877 allow legal characters in the name (e.g., no embedded NULs), 5878 rather than simply accepting any name provided by the user. 5880 The certificate is returned as type "application/pkix-cert" as 5881 defined in [RFC2585], with an HTTP status code of 200 OK. 5882 Certificate processing errors should be treated as HTTP errors and 5883 have appropriate HTTP status codes. In particular, password errors 5884 SHOULD be returned as 401 Unauthorized. [[ OPEN ISSUE: We know this 5885 isn't right and have a question out to the apps AD. ]] 5886 The client MUST check that the certificate returned chains back to 5887 one of the certificates received in the "root-cert" list of the 5888 overlay configuration data (including PKIX BasicConstraints checks.) 5889 The node then reads the certificate to find the Node-IDs it can use. 5891 11.3.1. Self-Generated Credentials 5893 If the "self-signed-permitted" element is present in the 5894 configuration and set to "true", then a node MUST generate its own 5895 self-signed certificate to join the overlay. The self-signed 5896 certificate MAY contain any user name of the users choice. 5898 The Node-ID MUST be computed by applying the digest specified in the 5899 self-signed-permitted element to the DER representation of the user's 5900 public key (more specifically the subjectPublicKeyInfo) and taking 5901 the high order bits. When accepting a self-signed certificate, nodes 5902 MUST check that the Node-ID and public keys match. This prevents 5903 Node-ID theft. 5905 Once the node has constructed a self-signed certificate, it MAY join 5906 the overlay. Before storing its certificate in the overlay 5907 (Section 8) it SHOULD look to see if the user name is already taken 5908 and if so choose another user name. Note that this only provides 5909 protection against accidental name collisions. Name theft is still 5910 possible. If protection against name theft is desired, then the 5911 enrollment service must be used. 5913 11.4. Searching for a Bootstrap Node 5915 If no cached bootstrap nodes are available and the configuration file 5916 has an multicast-bootstrap element, then the node SHOULD send a Ping 5917 request over UDP to the address and port found to each multicast- 5918 bootstrap element found in the configuration document. This MAY be a 5919 multicast, broadcast, or anycast address. The Ping should use the 5920 wildcard Node-ID as the destination Node-ID. 5922 The responder node that receives the Ping request SHOULD check that 5923 the overlay name is correct and that the requester peer sending the 5924 request has appropriate credentials for the overlay before responding 5925 to the Ping request even if the response is only an error. 5927 11.5. Contacting a Bootstrap Node 5929 In order to join the overlay, the joining node MUST contact a node in 5930 the overlay. Typically this means contacting the bootstrap nodes, 5931 since they are reachable by the local peer or have public IP 5932 addresses. If the joining node has cached a list of peers it has 5933 previously been connected with in this overlay, as an optimization it 5934 MAY attempt to use one or more of them as bootstrap nodes before 5935 falling back to the bootstrap nodes listed in the configuration file. 5937 When contacting a bootstrap node, the joining node MUST first form 5938 the DTLS or TLS connection to the bootstrap node and then sends an 5939 Attach request over this connection with the destination Node-ID set 5940 to the joining node's Node-ID. 5942 When the requester node finally does receive a response from some 5943 responding node, it can note the Node-ID in the response and use this 5944 Node-ID to start sending requests to join the Overlay Instance as 5945 described in Section 6.4. 5947 After a node has successfully joined the overlay network, it will 5948 have direct connections to several peers. Some MAY be added to the 5949 cached bootstrap nodes list and used in future boots. Peers that are 5950 not directly connected MUST NOT be cached. The suggested number of 5951 peers to cache is 10. Algorithms for determining which peers to 5952 cache are beyond the scope of this specification. 5954 12. Message Flow Example 5956 The following abbreviations are used in the message flow diagrams: 5957 JP = joining peer, AP = admitting peer, NP = next peer after the AP, 5958 NNP = next next peer which is the peer after NP, PP = previous peer 5959 before the AP, PPP = previous previous peer which is the peer before 5960 the PP, BP = bootstrap peer. 5962 In the following example, we assume that JP has formed a connection 5963 to one of the bootstrap nodes. JP then sends an Attach through that 5964 peer to a resource ID of itself (JP). It gets routed to the 5965 admitting peer (AP) because JP is not yet part of the overlay. When 5966 AP responds, JP and AP use ICE to set up a connection and then set up 5967 TLS. Once AP has connected to JP, AP sends to JP an Update to 5968 populate its Routing Table. The following example shows the Update 5969 happening after the TLS connection is formed but it could also happen 5970 before in which case the Update would often be routed through other 5971 nodes. 5973 JP PPP PP AP NP NNP BP 5974 | | | | | | | 5975 | | | | | | | 5976 | | | | | | | 5977 |Attach Dest=JP | | | | | 5978 |---------------------------------------------------------->| 5979 | | | | | | | 5980 | | | | | | | 5981 | | |Attach Dest=JP | | | 5982 | | |<--------------------------------------| 5983 | | | | | | | 5984 | | | | | | | 5985 | | |Attach Dest=JP | | | 5986 | | |-------->| | | | 5987 | | | | | | | 5988 | | | | | | | 5989 | | |AttachAns | | | 5990 | | |<--------| | | | 5991 | | | | | | | 5992 | | | | | | | 5993 | | |AttachAns | | | 5994 | | |-------------------------------------->| 5995 | | | | | | | 5996 | | | | | | | 5997 |AttachAns | | | | | 5998 |<----------------------------------------------------------| 5999 | | | | | | | 6000 | | | | | | | 6001 |TLS | | | | | | 6002 |.............................| | | | 6003 | | | | | | | 6004 | | | | | | | 6005 | | | | | | | 6006 |Update | | | | | | 6007 |<----------------------------| | | | 6008 | | | | | | | 6009 | | | | | | | 6010 |UpdateAns| | | | | | 6011 |---------------------------->| | | | 6012 | | | | | | | 6013 | | | | | | | 6014 | | | | | | | 6016 The JP then forms connections to the appropriate neighbors, such as 6017 NP, by sending an Attach which gets routed via other nodes. When NP 6018 responds, JP and NP use ICE and TLS to set up a connection. 6020 JP PPP PP AP NP NNP BP 6021 | | | | | | | 6022 | | | | | | | 6023 | | | | | | | 6024 |Attach NP | | | | | 6025 |---------------------------->| | | | 6026 | | | | | | | 6027 | | | | | | | 6028 | | | |Attach NP| | | 6029 | | | |-------->| | | 6030 | | | | | | | 6031 | | | | | | | 6032 | | | |AttachAns| | | 6033 | | | |<--------| | | 6034 | | | | | | | 6035 | | | | | | | 6036 |AttachAns | | | | | 6037 |<----------------------------| | | | 6038 | | | | | | | 6039 | | | | | | | 6040 |Attach | | | | | | 6041 |-------------------------------------->| | | 6042 | | | | | | | 6043 | | | | | | | 6044 |TLS | | | | | | 6045 |.......................................| | | 6046 | | | | | | | 6047 | | | | | | | 6048 | | | | | | | 6049 | | | | | | | 6051 JP also needs to populate its finger table (for the Chord based DHT). 6052 It issues an Attach to a variety of locations around the overlay. 6053 The diagram below shows it sending an Attach halfway around the Chord 6054 ring to the JP + 2^127. 6056 JP NP XX TP 6057 | | | | 6058 | | | | 6059 | | | | 6060 |Attach JP+2<<126 | | 6061 |-------->| | | 6062 | | | | 6063 | | | | 6064 | |Attach JP+2<<126 | 6065 | |-------->| | 6066 | | | | 6067 | | | | 6068 | | |Attach JP+2<<126 6069 | | |-------->| 6070 | | | | 6071 | | | | 6072 | | |AttachAns| 6073 | | |<--------| 6074 | | | | 6075 | | | | 6076 | |AttachAns| | 6077 | |<--------| | 6078 | | | | 6079 | | | | 6080 |AttachAns| | | 6081 |<--------| | | 6082 | | | | 6083 | | | | 6084 |TLS | | | 6085 |.............................| 6086 | | | | 6087 | | | | 6088 | | | | 6089 | | | | 6091 Once JP has a reasonable set of connections, it is ready to take its 6092 place in the DHT. It does this by sending a Join to AP. AP does a 6093 series of Store requests to JP to store the data that JP will be 6094 responsible for. AP then sends JP an Update explicitly labeling JP 6095 as its predecessor. At this point, JP is part of the ring and 6096 responsible for a section of the overlay. AP can now forget any data 6097 which is assigned to JP and not AP. 6099 JP PPP PP AP NP NNP BP 6100 | | | | | | | 6101 | | | | | | | 6102 | | | | | | | 6103 |JoinReq | | | | | | 6104 |---------------------------->| | | | 6105 | | | | | | | 6106 | | | | | | | 6107 |JoinAns | | | | | | 6108 |<----------------------------| | | | 6109 | | | | | | | 6110 | | | | | | | 6111 |StoreReq Data A | | | | | 6112 |<----------------------------| | | | 6113 | | | | | | | 6114 | | | | | | | 6115 |StoreAns | | | | | | 6116 |---------------------------->| | | | 6117 | | | | | | | 6118 | | | | | | | 6119 |StoreReq Data B | | | | | 6120 |<----------------------------| | | | 6121 | | | | | | | 6122 | | | | | | | 6123 |StoreAns | | | | | | 6124 |---------------------------->| | | | 6125 | | | | | | | 6126 | | | | | | | 6127 |UpdateReq| | | | | | 6128 |<----------------------------| | | | 6129 | | | | | | | 6130 | | | | | | | 6131 |UpdateAns| | | | | | 6132 |---------------------------->| | | | 6133 | | | | | | | 6134 | | | | | | | 6135 | | | | | | | 6136 | | | | | | | 6138 In Chord, JP's neighbor table needs to contain its own predecessors. 6139 It couldn't connect to them previously because it did not yet know 6140 their addresses. However, now that it has received an Update from 6141 AP, it has AP's predecessors, which are also its own, so it sends 6142 Attaches to them. Below it is shown connecting to AP's closest 6143 predecessor, PP. 6145 JP PPP PP AP NP NNP BP 6146 | | | | | | | 6147 | | | | | | | 6148 | | | | | | | 6149 |Attach Dest=PP | | | | | 6150 |---------------------------->| | | | 6151 | | | | | | | 6152 | | | | | | | 6153 | | |Attach Dest=PP | | | 6154 | | |<--------| | | | 6155 | | | | | | | 6156 | | | | | | | 6157 | | |AttachAns| | | | 6158 | | |-------->| | | | 6159 | | | | | | | 6160 | | | | | | | 6161 |AttachAns| | | | | | 6162 |<----------------------------| | | | 6163 | | | | | | | 6164 | | | | | | | 6165 |TLS | | | | | | 6166 |...................| | | | | 6167 | | | | | | | 6168 | | | | | | | 6169 |UpdateReq| | | | | | 6170 |------------------>| | | | | 6171 | | | | | | | 6172 | | | | | | | 6173 |UpdateAns| | | | | | 6174 |<------------------| | | | | 6175 | | | | | | | 6176 | | | | | | | 6177 |UpdateReq| | | | | | 6178 |---------------------------->| | | | 6179 | | | | | | | 6180 | | | | | | | 6181 |UpdateAns| | | | | | 6182 |<----------------------------| | | | 6183 | | | | | | | 6184 | | | | | | | 6185 |UpdateReq| | | | | | 6186 |-------------------------------------->| | | 6187 | | | | | | | 6188 | | | | | | | 6189 |UpdateAns| | | | | | 6190 |<--------------------------------------| | | 6191 | | | | | | | 6192 | | | | | | | 6194 Finally, now that JP has a copy of all the data and is ready to route 6195 messages and receive requests, it sends Updates to everyone in its 6196 Routing Table to tell them it is ready to go. Below, it is shown 6197 sending such an update to TP. 6199 JP NP XX TP 6200 | | | | 6201 | | | | 6202 | | | | 6203 |Update | | | 6204 |---------------------------->| 6205 | | | | 6206 | | | | 6207 |UpdateAns| | | 6208 |<----------------------------| 6209 | | | | 6210 | | | | 6211 | | | | 6212 | | | | 6214 13. Security Considerations 6216 13.1. Overview 6218 RELOAD provides a generic storage service, albeit one designed to be 6219 useful for P2PSIP. In this section we discuss security issues that 6220 are likely to be relevant to any usage of RELOAD. More background 6221 information can be found in [RFC5765]. 6223 In any Overlay Instance, any given user depends on a number of peers 6224 with which they have no well-defined relationship except that they 6225 are fellow members of the Overlay Instance. In practice, these other 6226 nodes may be friendly, lazy, curious, or outright malicious. No 6227 security system can provide complete protection in an environment 6228 where most nodes are malicious. The goal of security in RELOAD is to 6229 provide strong security guarantees of some properties even in the 6230 face of a large number of malicious nodes and to allow the overlay to 6231 function correctly in the face of a modest number of malicious nodes. 6233 P2PSIP deployments require the ability to authenticate both peers and 6234 resources (users) without the active presence of a trusted entity in 6235 the system. We describe two mechanisms. The first mechanism is 6236 based on public key certificates and is suitable for general 6237 deployments. The second is an admission control mechanism based on 6238 an overlay-wide shared symmetric key. 6240 13.2. Attacks on P2P Overlays 6242 The two basic functions provided by overlay nodes are storage and 6243 routing: some node is responsible for storing a peer's data and for 6244 allowing a third peer to fetch this stored data. Other nodes are 6245 responsible for routing messages to and from the storing nodes. Each 6246 of these issues is covered in the following sections. 6248 P2P overlays are subject to attacks by subversive nodes that may 6249 attempt to disrupt routing, corrupt or remove user registrations, or 6250 eavesdrop on signaling. The certificate-based security algorithms we 6251 describe in this specification are intended to protect overlay 6252 routing and user registration information in RELOAD messages. 6254 To protect the signaling from attackers pretending to be valid peers 6255 (or peers other than themselves), the first requirement is to ensure 6256 that all messages are received from authorized members of the 6257 overlay. For this reason, RELOAD transports all messages over a 6258 secure channel (TLS and DTLS are defined in this document) which 6259 provides message integrity and authentication of the directly 6260 communicating peer. In addition, messages and data are digitally 6261 signed with the sender's private key, providing end-to-end security 6262 for communications. 6264 13.3. Certificate-based Security 6266 This specification stores users' registrations and possibly other 6267 data in an overlay network. This requires a solution to securing 6268 this data as well as securing, as well as possible, the routing in 6269 the overlay. Both types of security are based on requiring that 6270 every entity in the system (whether user or peer) authenticate 6271 cryptographically using an asymmetric key pair tied to a certificate. 6273 When a user enrolls in the Overlay Instance, they request or are 6274 assigned a unique name, such as "alice@dht.example.net". These names 6275 are unique and are meant to be chosen and used by humans much like a 6276 SIP Address of Record (AOR) or an email address. The user is also 6277 assigned one or more Node-IDs by the central enrollment authority. 6278 Both the name and the Node-ID are placed in the certificate, along 6279 with the user's public key. 6281 Each certificate enables an entity to act in two sorts of roles: 6283 o As a user, storing data at specific Resource-IDs in the Overlay 6284 Instance corresponding to the user name. 6285 o As a overlay peer with the Node-ID(s) listed in the certificate. 6287 Note that since only users of this Overlay Instance need to validate 6288 a certificate, this usage does not require a global PKI. Instead, 6289 certificates are signed by a central enrollment authority which acts 6290 as the certificate authority for the Overlay Instance. This 6291 authority signs each peer's certificate. Because each peer possesses 6292 the CA's certificate (which they receive on enrollment) they can 6293 verify the certificates of the other entities in the overlay without 6294 further communication. Because the certificates contain the user/ 6295 peer's public key, communications from the user/peer can be verified 6296 in turn. 6298 If self-signed certificates are used, then the security provided is 6299 significantly decreased, since attackers can mount Sybil attacks. In 6300 addition, attackers cannot trust the user names in certificates 6301 (though they can trust the Node-IDs because they are 6302 cryptographically verifiable). This scheme may be appropriate for 6303 some small deployments, such as a small office or an ad hoc overlay 6304 set up among participants in a meeting where all hosts on the network 6305 are trusted. Some additional security can be provided by using the 6306 shared secret admission control scheme as well. 6308 Because all stored data is signed by the owner of the data the 6309 storing peer can verify that the storer is authorized to perform a 6310 store at that Resource-ID and also allow any consumer of the data to 6311 verify the provenance and integrity of the data when it retrieves it. 6313 Note that RELOAD does not itself provide a revocation/status 6314 mechanism (though certificates may of course include OCSP responder 6315 information). Thus, certificate lifetimes should be chosen to 6316 balance the compromise window versus the cost of certificate renewal. 6317 Because RELOAD is already designed to operate in the face of some 6318 fraction of malicious peers, this form of compromise is not fatal. 6320 All implementations MUST implement certificate-based security. 6322 13.4. Shared-Secret Security 6324 RELOAD also supports a shared secret admission control scheme that 6325 relies on a single key that is shared among all members of the 6326 overlay. It is appropriate for small groups that wish to form a 6327 private network without complexity. In shared secret mode, all the 6328 peers share a single symmetric key which is used to key TLS-PSK 6329 [RFC4279] or TLS-SRP [RFC5054] mode. A peer which does not know the 6330 key cannot form TLS connections with any other peer and therefore 6331 cannot join the overlay. 6333 One natural approach to a shared-secret scheme is to use a user- 6334 entered password as the key. The difficulty with this is that in 6335 TLS-PSK mode, such keys are very susceptible to dictionary attacks. 6337 If passwords are used as the source of shared-keys, then TLS-SRP is a 6338 superior choice because it is not subject to dictionary attacks. 6340 13.5. Storage Security 6342 When certificate-based security is used in RELOAD, any given 6343 Resource-ID/Kind-ID pair is bound to some small set of certificates. 6344 In order to write data, the writer must prove possession of the 6345 private key for one of those certificates. Moreover, all data is 6346 stored, signed with the same private key that was used to authorize 6347 the storage. This set of rules makes questions of authorization and 6348 data integrity - which have historically been thorny for overlays - 6349 relatively simple. 6351 13.5.1. Authorization 6353 When a client wants to store some value, it first digitally signs the 6354 value with its own private key. It then sends a Store request that 6355 contains both the value and the signature towards the storing peer 6356 (which is defined by the Resource Name construction algorithm for 6357 that particular Kind of value). 6359 When the storing peer receives the request, it must determine whether 6360 the storing client is authorized to store at this Resource-ID/Kind-ID 6361 pair. Determining this requires comparing the user's identity to the 6362 requirements of the access control model (see Section 7.3). If it 6363 satisfies those requirements the user is authorized to write, pending 6364 quota checks as described in the next section. 6366 For example, consider the certificate with the following properties: 6368 User name: alice@dht.example.com 6369 Node-ID: 013456789abcdef 6370 Serial: 1234 6372 If Alice wishes to Store a value of the "SIP Location" Kind, the 6373 Resource Name will be the SIP AOR "sip:alice@dht.example.com". The 6374 Resource-ID will be determined by hashing the Resource Name. Because 6375 SIP Location uses the USER-NODE-MATCH policy, it first verifies that 6376 the user name in the certificate hashes to the requested Resource-ID. 6377 It then verifies that the Node-Id in the certificate matches the 6378 dictionary key being used for the store. If both of these checks 6379 succeed, the Store is authorized. Note that because the access 6380 control model is different for different Kinds, the exact set of 6381 checks will vary. 6383 13.5.2. Distributed Quota 6385 Being a peer in an Overlay Instance carries with it the 6386 responsibility to store data for a given region of the Overlay 6387 Instance. However, allowing clients to store unlimited amounts of 6388 data would create unacceptable burdens on peers and would also enable 6389 trivial denial of service attacks. RELOAD addresses this issue by 6390 requiring configurations to define maximum sizes for each Kind of 6391 stored data. Attempts to store values exceeding this size MUST be 6392 rejected (if peers are inconsistent about this, then strange 6393 artifacts will happen when the zone of responsibility shifts and a 6394 different peer becomes responsible for overlarge data). Because each 6395 Resource-ID/Kind-ID pair is bound to a small set of certificates, 6396 these size restrictions also create a distributed quota mechanism, 6397 with the quotas administered by the central configuration server. 6399 Allowing different Kinds of data to have different size restrictions 6400 allows new usages the flexibility to define limits that fit their 6401 needs without requiring all usages to have expansive limits. 6403 13.5.3. Correctness 6405 Because each stored value is signed, it is trivial for any retrieving 6406 peer to verify the integrity of the stored value. Some more care 6407 needs to be taken to prevent version rollback attacks. Rollback 6408 attacks on storage are prevented by the use of store times and 6409 lifetime values in each store. A lifetime represents the latest time 6410 at which the data is valid and thus limits (though does not 6411 completely prevent) the ability of the storing node to perform a 6412 rollback attack on retrievers. In order to prevent a rollback attack 6413 at the time of the Store request, we require that storage times be 6414 monotonically increasing. Storing peers MUST reject Store requests 6415 with storage times smaller than or equal to those they are currently 6416 storing. In addition, a fetching node which receives a data value 6417 with a storage time older than the result of the previous fetch knows 6418 a rollback has occurred. 6420 13.5.4. Residual Attacks 6422 The mechanisms described here provides a high degree of security, but 6423 some attacks remain possible. Most simply, it is possible for 6424 storing nodes to refuse to store a value (i.e., reject any request). 6425 In addition, a storing node can deny knowledge of values which it has 6426 previously accepted. To some extent these attacks can be ameliorated 6427 by attempting to store to/retrieve from replicas, but a retrieving 6428 client does not know whether it should try this or not, since there 6429 is a cost to doing so. 6431 The certificate-based authentication scheme prevents a single peer 6432 from being able to forge data owned by other peers. Furthermore, 6433 although a subversive peer can refuse to return data resources for 6434 which it is responsible, it cannot return forged data because it 6435 cannot provide authentication for such registrations. Therefore 6436 parallel searches for redundant registrations can mitigate most of 6437 the effects of a compromised peer. The ultimate reliability of such 6438 an overlay is a statistical question based on the replication factor 6439 and the percentage of compromised peers. 6441 In addition, when a Kind is multivalued (e.g., an array data model), 6442 the storing node can return only some subset of the values, thus 6443 biasing its responses. This can be countered by using single values 6444 rather than sets, but that makes coordination between multiple 6445 storing agents much more difficult. This is a trade off that must be 6446 made when designing any usage. 6448 13.6. Routing Security 6450 Because the storage security system guarantees (within limits) the 6451 integrity of the stored data, routing security focuses on stopping 6452 the attacker from performing a DOS attack that misroutes requests in 6453 the overlay. There are a few obvious observations to make about 6454 this. First, it is easy to ensure that an attacker is at least a 6455 valid peer in the Overlay Instance. Second, this is a DOS attack 6456 only. Third, if a large percentage of the peers on the Overlay 6457 Instance are controlled by the attacker, it is probably impossible to 6458 perfectly secure against this. 6460 13.6.1. Background 6462 In general, attacks on DHT routing are mounted by the attacker 6463 arranging to route traffic through one or two nodes it controls. In 6464 the Eclipse attack [Eclipse] the attacker tampers with messages to 6465 and from nodes for which it is on-path with respect to a given victim 6466 node. This allows it to pretend to be all the nodes that are 6467 reachable through it. In the Sybil attack [Sybil], the attacker 6468 registers a large number of nodes and is therefore able to capture a 6469 large amount of the traffic through the DHT. 6471 Both the Eclipse and Sybil attacks require the attacker to be able to 6472 exercise control over her Node-IDs. The Sybil attack requires the 6473 creation of a large number of peers. The Eclipse attack requires 6474 that the attacker be able to impersonate specific peers. In both 6475 cases, these attacks are limited by the use of centralized, 6476 certificate-based admission control. 6478 13.6.2. Admissions Control 6480 Admission to a RELOAD Overlay Instance is controlled by requiring 6481 that each peer have a certificate containing its Node-Id. The 6482 requirement to have a certificate is enforced by using certificate- 6483 based mutual authentication on each connection. (Note: the 6484 following only applies when self-signed certificates are not used.) 6485 Whenever a peer connects to another peer, each side automatically 6486 checks that the other has a suitable certificate. These Node-Ids are 6487 randomly assigned by the central enrollment server. This has two 6488 benefits: 6490 o It allows the enrollment server to limit the number of Node-IDs 6491 issued to any individual user. 6492 o It prevents the attacker from choosing specific Node-Ids. 6494 The first property allows protection against Sybil attacks (provided 6495 the enrollment server uses strict rate limiting policies). The 6496 second property deters but does not completely prevent Eclipse 6497 attacks. Because an Eclipse attacker must impersonate peers on the 6498 other side of the attacker, he must have a certificate for suitable 6499 Node-Ids, which requires him to repeatedly query the enrollment 6500 server for new certificates, which will match only by chance. From 6501 the attacker's perspective, the difficulty is that if he only has a 6502 small number of certificates, the region of the Overlay Instance he 6503 is impersonating appears to be very sparsely populated by comparison 6504 to the victim's local region. 6506 13.6.3. Peer Identification and Authentication 6508 In general, whenever a peer engages in overlay activity that might 6509 affect the routing table it must establish its identity. This 6510 happens in two ways. First, whenever a peer establishes a direct 6511 connection to another peer it authenticates via certificate-based 6512 mutual authentication. All messages between peers are sent over this 6513 protected channel and therefore the peers can verify the data origin 6514 of the last hop peer for requests and responses without further 6515 cryptography. 6517 In some situations, however, it is desirable to be able to establish 6518 the identity of a peer with whom one is not directly connected. The 6519 most natural case is when a peer Updates its state. At this point, 6520 other peers may need to update their view of the overlay structure, 6521 but they need to verify that the Update message came from the actual 6522 peer rather than from an attacker. To prevent this, all overlay 6523 routing messages are signed by the peer that generated them. 6525 Replay is typically prevented for messages that impact the topology 6526 of the overlay by having the information come directly, or be 6527 verified by, the nodes that claimed to have generated the update. 6528 Data storage replay detection is done by signing time of the node 6529 that generated the signature on the store request thus providing a 6530 time based replay protection but the time synchronization is only 6531 needed between peers that can write to the same location. 6533 13.6.4. Protecting the Signaling 6535 The goal here is to stop an attacker from knowing who is signaling 6536 what to whom. An attacker is unlikely to be able to observe the 6537 activities of a specific individual given the randomization of IDs 6538 and routing based on the present peers discussed above. Furthermore, 6539 because messages can be routed using only the header information, the 6540 actual body of the RELOAD message can be encrypted during 6541 transmission. 6543 There are two lines of defense here. The first is the use of TLS or 6544 DTLS for each communications link between peers. This provides 6545 protection against attackers who are not members of the overlay. The 6546 second line of defense is to digitally sign each message. This 6547 prevents adversarial peers from modifying messages in flight, even if 6548 they are on the routing path. 6550 13.6.5. Routing Loops and Dos Attacks 6552 Source routing mechanisms are known to create the possibility for DoS 6553 amplification, especially by the induction of routing loops 6554 [RFC5095]. In order to limit amplification, the initial-ttl value in 6555 the configuration file SHOULD be set to a value slightly larger than 6556 the longest expected path through the network. For Chord, experience 6557 has shown that log(2) of the number of nodes in the network + 5 is a 6558 safe bound. Because nodes are required to enforce the initial-ttl as 6559 the maximum value, an attacker cannot achieve an amplification factor 6560 greater than initial-ttl, thus limiting the additional capabilities 6561 provided by source routing. 6563 In order to prevent the use of loops for targeted implementation 6564 attacks, implementations SHOULD check the destination list for 6565 duplicate entries and discard such records with an 6566 "Error_Invalid_Message" error. This does not completely prevent 6567 loops but does require that at least one attacker node be part of the 6568 loop. 6570 13.6.6. Residual Attacks 6572 The routing security mechanisms in RELOAD are designed to contain 6573 rather than eliminate attacks on routing. It is still possible for 6574 an attacker to mount a variety of attacks. In particular, if an 6575 attacker is able to take up a position on the overlay routing between 6576 A and B it can make it appear as if B does not exist or is 6577 disconnected. It can also advertise false network metrics in an 6578 attempt to reroute traffic. However, these are primarily DOS 6579 attacks. 6581 The certificate-based security scheme secures the namespace, but if 6582 an individual peer is compromised or if an attacker obtains a 6583 certificate from the CA, then a number of subversive peers can still 6584 appear in the overlay. While these peers cannot falsify responses to 6585 resource queries, they can respond with error messages, effecting a 6586 DoS attack on the resource registration. They can also subvert 6587 routing to other compromised peers. To defend against such attacks, 6588 a resource search must still consist of parallel searches for 6589 replicated registrations. 6591 14. IANA Considerations 6593 This section contains the new code points registered by this 6594 document. [NOTE TO IANA/RFC-EDITOR: Please replace RFC-AAAA with 6595 the RFC number for this specification in the following list.] 6597 14.1. Well-Known URI Registration 6599 IANA SHALL make the following "Well Known URI" registration as 6600 described in [RFC5785]: 6602 [[Note to RFC Editor - this paragraph can be removed before 6603 publication. ]] A review request was sent to 6604 wellknown-uri-review@ietf.org on October 12, 2010. 6606 +----------------------------+----------------------+ 6607 | URI suffix: | p2psip-enroll | 6608 | Change controller: | IETF | 6609 | Specification document(s): | [RFC-AAAA] | 6610 | Related information: | None | 6611 +----------------------------+----------------------+ 6613 14.2. Port Registrations 6615 [[Note to RFC Editor - this paragraph can be removed before 6616 publication. ]] IANA has already allocated a TCP port for the main 6617 peer to peer protocol. This port has the name p2p-sip and the port 6618 number of 6084. IANA needs to update this registration to be defined 6619 for UDP as well as TCP. 6621 IANA SHALL make the following port registration: 6623 +------------------------------+------------------------------------+ 6624 | Registration Technical | Cullen Jennings | 6625 | Contact | | 6626 | Registration Owner | IETF | 6627 | Transport Protocol | TCP & UDP | 6628 | Port Number | 6084 | 6629 | Service Name | p2psip-enroll | 6630 | Description | Peer to Peer Infrastructure | 6631 | | Enrollment | 6632 | Reference | [RFC-AAAA] | 6633 +------------------------------+------------------------------------+ 6635 14.3. Overlay Algorithm Types 6637 IANA SHALL create a "RELOAD Overlay Algorithm Type" Registry. 6638 Entries in this registry are strings denoting the names of overlay 6639 algorithms. The registration policy for this registry is RFC 5226 6640 IETF Review. The initial contents of this registry are: 6642 +----------------+----------+ 6643 | Algorithm Name | RFC | 6644 +----------------+----------+ 6645 | CHORD-RELOAD | RFC-AAAA | 6646 | EXP-OVERLAY | RFC-AAAA | 6647 +----------------+----------+ 6649 The value EXP-OVERLAY has been made available for the purposes of 6650 experimentation. This value is not meant for vendor specific use of 6651 any sort and it MUST NOT be used for operational deployments. 6653 14.4. Access Control Policies 6655 IANA SHALL create a "RELOAD Access Control Policy" Registry. Entries 6656 in this registry are strings denoting access control policies, as 6657 described in Section 7.3. New entries in this registry SHALL be 6658 registered via RFC 5226 Standards Action. The initial contents of 6659 this registry are: 6661 +-----------------+----------+ 6662 | Access Policy | RFC | 6663 +-----------------+----------+ 6664 | USER-MATCH | RFC-AAAA | 6665 | NODE-MATCH | RFC-AAAA | 6666 | USER-NODE-MATCH | RFC-AAAA | 6667 | NODE-MULTIPLE | RFC-AAAA | 6668 | EXP-MATCH | RFC-AAAA | 6669 +-----------------+----------+ 6671 The value EXP-MATCH has been made available for the purposes of 6672 experimentation. This value is not meant for vendor specific use of 6673 any sort and it MUST NOT be used for operational deployments. 6675 14.5. Application-ID 6677 IANA SHALL create a "RELOAD Application-ID" Registry. Entries in 6678 this registry are 16-bit integers denoting application Kinds. Code 6679 points in the range 0x0001 to 0x7fff SHALL be registered via RFC 5226 6680 Standards Action. Code points in the range 0x8000 to 0xf000 SHALL be 6681 registered via RFC 5226 Expert Review. Code points in the range 6682 0xf001 to 0xfffe are reserved for private use. The initial contents 6683 of this registry are: 6685 +-------------+----------------+-------------------------------+ 6686 | Application | Application-ID | Specification | 6687 +-------------+----------------+-------------------------------+ 6688 | INVALID | 0 | RFC-AAAA | 6689 | SIP | 5060 | Reserved for use by SIP Usage | 6690 | SIP | 5061 | Reserved for use by SIP Usage | 6691 | Reserved | 0xffff | RFC-AAAA | 6692 +-------------+----------------+-------------------------------+ 6694 14.6. Data Kind-ID 6696 IANA SHALL create a "RELOAD Data Kind-ID" Registry. Entries in this 6697 registry are 32-bit integers denoting data Kinds, as described in 6698 Section 5.2. Code points in the range 0x00000001 to 0x7fffffff SHALL 6699 be registered via RFC 5226 Standards Action. Code points in the 6700 range 0x8000000 to 0xf0000000 SHALL be registered via RFC 5226 Expert 6701 Review. Code points in the range 0xf0000001 to 0xfffffffe are 6702 reserved for private use via the Kind description mechanism described 6703 in Section 11. The initial contents of this registry are: 6705 +---------------------+------------+----------+ 6706 | Kind | Kind-ID | RFC | 6707 +---------------------+------------+----------+ 6708 | INVALID | 0 | RFC-AAAA | 6709 | TURN-SERVICE | 2 | RFC-AAAA | 6710 | CERTIFICATE_BY_NODE | 3 | RFC-AAAA | 6711 | CERTIFICATE_BY_USER | 16 | RFC-AAAA | 6712 | Reserved | 0x7fffffff | RFC-AAAA | 6713 | Reserved | 0xfffffffe | RFC-AAAA | 6714 +---------------------+------------+----------+ 6716 14.7. Data Model 6718 IANA SHALL create a "RELOAD Data Model" Registry. Entries in this 6719 registry denoting data models, as described in Section 7.2. Code 6720 points in this registry SHALL be registered via RFC 5226 Standards 6721 Action. The initial contents of this registry are: 6723 +------------+----------+ 6724 | Data Model | RFC | 6725 +------------+----------+ 6726 | INVALID | RFC-AAAA | 6727 | SINGLE | RFC-AAAA | 6728 | ARRAY | RFC-AAAA | 6729 | DICTIONARY | RFC-AAAA | 6730 | EXP-DATA | RFC-AAAA | 6731 | RESERVED | RFC-AAAA | 6732 +------------+----------+ 6734 The value EXP-DATA has been made available for the purposes of 6735 experimentation. This value is not meant for vendor specific use of 6736 any sort and it MUST NOT be used for operational deployments. 6738 14.8. Message Codes 6740 IANA SHALL create a "RELOAD Message Code" Registry. Entries in this 6741 registry are 16-bit integers denoting method codes as described in 6742 Section 6.3.3. These codes SHALL be registered via RFC 5226 6743 Standards Action. The initial contents of this registry are: 6745 +---------------------------------+----------------+----------+ 6746 | Message Code Name | Code Value | RFC | 6747 +---------------------------------+----------------+----------+ 6748 | invalid | 0 | RFC-AAAA | 6749 | probe_req | 1 | RFC-AAAA | 6750 | probe_ans | 2 | RFC-AAAA | 6751 | attach_req | 3 | RFC-AAAA | 6752 | attach_ans | 4 | RFC-AAAA | 6753 | unused | 5 | | 6754 | unused | 6 | | 6755 | store_req | 7 | RFC-AAAA | 6756 | store_ans | 8 | RFC-AAAA | 6757 | fetch_req | 9 | RFC-AAAA | 6758 | fetch_ans | 10 | RFC-AAAA | 6759 | unused (was remove_req) | 11 | RFC-AAAA | 6760 | unused (was remove_ans) | 12 | RFC-AAAA | 6761 | find_req | 13 | RFC-AAAA | 6762 | find_ans | 14 | RFC-AAAA | 6763 | join_req | 15 | RFC-AAAA | 6764 | join_ans | 16 | RFC-AAAA | 6765 | leave_req | 17 | RFC-AAAA | 6766 | leave_ans | 18 | RFC-AAAA | 6767 | update_req | 19 | RFC-AAAA | 6768 | update_ans | 20 | RFC-AAAA | 6769 | route_query_req | 21 | RFC-AAAA | 6770 | route_query_ans | 22 | RFC-AAAA | 6771 | ping_req | 23 | RFC-AAAA | 6772 | ping_ans | 24 | RFC-AAAA | 6773 | stat_req | 25 | RFC-AAAA | 6774 | stat_ans | 26 | RFC-AAAA | 6775 | unused (was attachlite_req) | 27 | RFC-AAAA | 6776 | unused (was attachlite_ans) | 28 | RFC-AAAA | 6777 | app_attach_req | 29 | RFC-AAAA | 6778 | app_attach_ans | 30 | RFC-AAAA | 6779 | unused (was app_attachlite_req) | 31 | RFC-AAAA | 6780 | unused (was app_attachlite_ans) | 32 | RFC-AAAA | 6781 | config_update_req | 33 | RFC-AAAA | 6782 | config_update_ans | 34 | RFC-AAAA | 6783 | exp_a_req | 35 | RFC-AAAA | 6784 | exp_a_ans | 36 | RFC-AAAA | 6785 | exp_b_req | 37 | RFC-AAAA | 6786 | exp_b_ans | 38 | RFC-AAAA | 6787 | reserved | 0x8000..0xfffe | RFC-AAAA | 6788 | error | 0xffff | RFC-AAAA | 6789 +---------------------------------+----------------+----------+ 6791 The values exp_a_req, exp_a_ans, exp_b_req, and exp_b_ans have been 6792 made available for the purposes of experimentation. These values are 6793 not meant for vendor specific use of any sort and MUST NOT be used 6794 for operational deployments. 6796 14.9. Error Codes 6798 IANA SHALL create a "RELOAD Error Code" Registry. Entries in this 6799 registry are 16-bit integers denoting error codes. New entries SHALL 6800 be defined via RFC 5226 Standards Action. The initial contents of 6801 this registry are: 6803 +-------------------------------------+----------------+----------+ 6804 | Error Code Name | Code Value | RFC | 6805 +-------------------------------------+----------------+----------+ 6806 | invalid | 0 | RFC-AAAA | 6807 | Unused | 1 | RFC-AAAA | 6808 | Error_Forbidden | 2 | RFC-AAAA | 6809 | Error_Not_Found | 3 | RFC-AAAA | 6810 | Error_Request_Timeout | 4 | RFC-AAAA | 6811 | Error_Generation_Counter_Too_Low | 5 | RFC-AAAA | 6812 | Error_Incompatible_with_Overlay | 6 | RFC-AAAA | 6813 | Error_Unsupported_Forwarding_Option | 7 | RFC-AAAA | 6814 | Error_Data_Too_Large | 8 | RFC-AAAA | 6815 | Error_Data_Too_Old | 9 | RFC-AAAA | 6816 | Error_TTL_Exceeded | 10 | RFC-AAAA | 6817 | Error_Message_Too_Large | 11 | RFC-AAAA | 6818 | Error_Unknown_Kind | 12 | RFC-AAAA | 6819 | Error_Unknown_Extension | 13 | RFC-AAAA | 6820 | Error_Response_Too_Large | 14 | RFC-AAAA | 6821 | Error_Config_Too_Old | 15 | RFC-AAAA | 6822 | Error_Config_Too_New | 16 | RFC-AAAA | 6823 | Error_In_Progress | 17 | RFC-AAAA | 6824 | Error_Exp_A | 18 | RFC-AAAA | 6825 | Error_Exp_B | 19 | RFC-AAAA | 6826 | Error_Invalid_Message | 20 | RFC-AAAA | 6827 | reserved | 0x8000..0xfffe | RFC-AAAA | 6828 +-------------------------------------+----------------+----------+ 6830 The values Error_Exp_A and Error_Exp_B have been made available for 6831 the purposes of experimentation. These values are not meant for 6832 vendor specific use of any sort and MUST NOT be used for operational 6833 deployments. 6835 14.10. Overlay Link Types 6837 IANA SHALL create a "RELOAD Overlay Link Registry". For more 6838 information on the link types defeind here, see Section 6.6. New 6839 entries SHALL be defined via RFC 5226 Standards Action. This 6840 registry SHALL be initially populated with the following values: 6842 +--------------------+------+---------------+ 6843 | Protocol | Code | Specification | 6844 +--------------------+------+---------------+ 6845 | reserved | 0 | RFC-AAAA | 6846 | DTLS-UDP-SR | 1 | RFC-AAAA | 6847 | DTLS-UDP-SR-NO-ICE | 3 | RFC-AAAA | 6848 | TLS-TCP-FH-NO-ICE | 4 | RFC-AAAA | 6849 | EXP-LINK | 5 | RFC-AAAA | 6850 | reserved | 255 | RFC-AAAA | 6851 +--------------------+------+---------------+ 6853 The value EXP-LINK has been made available for the purposes of 6854 experimentation. This value is not meant for vendor specific use of 6855 any sort and it MUST NOT be used for operational deployments. 6857 14.11. Overlay Link Protocols 6859 IANA SHALL create an "Overlay Link Protocol Registry". Entries in 6860 this registry SHALL be defined via RFC 5226 Standards Action. This 6861 registry SHALL be initially populated with the following valuse: 6863 +---------------+---------------+ 6864 | Link Protocol | Specification | 6865 +---------------+---------------+ 6866 | TLS | RFC-AAAA | 6867 | EXP-PROTOCOL | RFC-AAAA | 6868 +---------------+---------------+ 6870 The value EXP-PROTOCOL has been made available for the purposes of 6871 experimentation. This value is not meant for vendor specific use of 6872 any sort and it MUST NOT be used for operational deployments. 6874 14.12. Forwarding Options 6876 IANA SHALL create a "Forwarding Option Registry". Entries in this 6877 registry between 1 and 127 SHALL be defined via RFC 5226 Standards 6878 Action. Entries in this registry between 128 and 254 SHALL be 6879 defined via RFC 5226 Specification Required. This registry SHALL be 6880 initially populated with the following values: 6882 +-------------------+------+---------------+ 6883 | Forwarding Option | Code | Specification | 6884 +-------------------+------+---------------+ 6885 | invalid | 0 | RFC-AAAA | 6886 | exp-forward | 1 | RFC-AAAA | 6887 | reserved | 255 | RFC-AAAA | 6888 +-------------------+------+---------------+ 6890 The value exp-forward has been made available for the purposes of 6891 experimentation. This value is not meant for vendor specific use of 6892 any sort and it MUST NOT be used for operational deployments. 6894 14.13. Probe Information Types 6896 IANA SHALL create a "RELOAD Probe Information Type Registry". 6897 Entries in this registry SHALL be defined via RFC 5226 Standards 6898 Action. This registry SHALL be initially populated with the 6899 following values: 6901 +-----------------+------+---------------+ 6902 | Probe Option | Code | Specification | 6903 +-----------------+------+---------------+ 6904 | invalid | 0 | RFC-AAAA | 6905 | responsible_set | 1 | RFC-AAAA | 6906 | num_resources | 2 | RFC-AAAA | 6907 | uptime | 3 | RFC-AAAA | 6908 | exp-probe | 4 | RFC-AAAA | 6909 | reserved | 255 | RFC-AAAA | 6910 +-----------------+------+---------------+ 6912 The value exp-probe has been made available for the purposes of 6913 experimentation. This value is not meant for vendor specific use of 6914 any sort and it MUST NOT be used for operational deployments. 6916 14.14. Message Extensions 6918 IANA SHALL create a "RELOAD Extensions Registry". Entries in this 6919 registry SHALL be defined via RFC 5226 Specification Required. This 6920 registry SHALL be initially populated with the following values: 6922 +-----------------+--------+---------------+ 6923 | Extensions Name | Code | Specification | 6924 +-----------------+--------+---------------+ 6925 | invalid | 0 | RFC-AAAA | 6926 | exp-ext | 1 | RFC-AAAA | 6927 | reserved | 0xFFFF | RFC-AAAA | 6928 +-----------------+--------+---------------+ 6930 The value exp-ext has been made available for the purposes of 6931 experimentation. This value is not meant for vendor specific use of 6932 any sort and it MUST NOT be used for operational deployments. 6934 14.15. reload URI Scheme 6936 This section describes the scheme for a reload URI, which can be used 6937 to refer to either: 6939 o A peer. 6940 o A resource inside a peer. 6942 The reload URI is defined using a subset of the URI schema specified 6943 in Appendix A of RFC 3986 [RFC3986] and the associated URI Guidelines 6944 [RFC4395] per the following ABNF syntax: 6946 RELOAD-URI = "reload://" destination "@" overlay "/" 6947 [specifier] 6949 destination = 1 * HEXDIG 6950 overlay = reg-name 6951 specifier = 1*HEXDIG 6953 The definitions of these productions are as follows: 6955 destination: a hex-encoded Destination List object (i.e., multiple 6956 concatenated Destination objects with no length prefix prior to 6957 the object as a whole.) 6959 overlay: the name of the overlay. 6961 specifier : a hex-encoded StoredDataSpecifier indicating the data 6962 element. 6964 If no specifier is present then this URI addresses the peer which can 6965 be reached via the indicated destination list at the indicated 6966 overlay name. If a specifier is present, then the URI addresses the 6967 data value. 6969 14.15.1. URI Registration 6971 [[ Note to RFC Editor - please remove this paragraph before 6972 publication. ]] A review request was sent to uri-review@ietf.org on 6973 Oct 7, 2010. 6975 The following summarizes the information necessary to register the 6976 reload URI. 6978 URI Scheme Name: reload 6979 Status: permanent 6980 URI Scheme Syntax: see Section 14.15 of RFC-AAAA 6981 URI Scheme Semantics: The reload URI is intended to be used as a 6982 reference to a RELOAD peer or resource. 6984 Encoding Considerations: The reload URI is not intended to be human- 6985 readable text, so it is encoded entirely in US-ASCII. 6986 Applications/protocols that use this URI scheme: The RELOAD protocol 6987 described in RFC-AAAA. 6988 Interoperability considerations: See RFC-AAAA. 6989 Security considerations: See RFC-AAAA 6990 Contact: Cullen Jennings 6991 Author/Change controller: IESG 6992 References: RFC-AAAA 6994 14.16. Media Type Registration 6996 [[ Note to RFC Editor - please remove this paragraph before 6997 publication. ]] A review request was sent to ietf-types@iana.org on 6998 May 27, 2011. 7000 Type name: application 7002 Subtype name: p2p-overlay+xml 7004 Required parameters: none 7006 Optional parameters: none 7008 Encoding considerations: Must be binary encoded. 7010 Security considerations: This media type is typically not used to 7011 transport information that needs to be kept confidential, however 7012 there are cases where it is integrity of the information is 7013 important. For these cases using a digital signature is RECOMMENDED. 7014 One way of doing this is specified in RFC-AAAA. In the case when the 7015 media includes a "shared-secret" element, then the contents of the 7016 file MUST be kept confidential or else anyone that can see the 7017 shared-secret and effect the RELOAD overlay network. 7019 Interoperability considerations: No known interoperability 7020 consideration beyond those identified for application/xml in 7021 [RFC3023]. 7023 Published specification: RFC-AAAA 7025 Applications that use this media type: The type is used to configure 7026 the peer to peer overlay networks defined in RFC-AAAA. 7028 Additional information: The syntax for this media type is specified 7029 in Section 11.1 of RFC-AAAA. The contents MUST be valid XML 7030 compliant with the relax NG grammar specified in RFC-AAAA and use the 7031 UTF-8[RFC3629] character encoding. 7033 Magic number(s): none 7035 File extension(s): relo 7037 Macintosh file type code(s): none 7039 Person & email address to contact for further information: Cullen 7040 Jennings 7042 Intended usage: COMMON 7044 Restrictions on usage: None 7046 Author: Cullen Jennings 7048 Change controller: IESG 7050 14.17. XML Name Space Registration 7052 This document registers two URIs for the config and config-chord XML 7053 namespaces in the IETF XML registry defined in [RFC3688]. 7055 14.17.1. Config URL 7057 URI: urn:ietf:params:xml:ns:p2p:config-base 7059 Registrant Contact: The IESG. 7061 XML: N/A, the requested URIs are XML namespaces 7063 14.17.2. Config Chord URL 7065 URI: urn:ietf:params:xml:ns:p2p:config-chord 7067 Registrant Contact: The IESG. 7069 XML: N/A, the requested URIs are XML namespaces 7071 15. Acknowledgments 7073 This specification is a merge of the "REsource LOcation And Discovery 7074 (RELOAD)" draft by David A. Bryan, Marcia Zangrilli and Bruce B. 7075 Lowekamp, the "Address Settlement by Peer to Peer" draft by Cullen 7076 Jennings, Jonathan Rosenberg, and Eric Rescorla, the "Security 7077 Extensions for RELOAD" draft by Bruce B. Lowekamp and James Deverick, 7078 the "A Chord-based DHT for Resource Lookup in P2PSIP" by Marcia 7079 Zangrilli and David A. Bryan, and the Peer-to-Peer Protocol (P2PP) 7080 draft by Salman A. Baset, Henning Schulzrinne, and Marcin 7081 Matuszewski. Thanks to the authors of RFC 5389 for text included 7082 from that. Vidya Narayanan provided many comments and improvements. 7084 The ideas and text for the Chord specific extension data to the Leave 7085 mechanisms was provided by Jouni Maenpaa, Gonzalo Camarillo, and Jani 7086 Hautakorpi. 7088 Thanks to the many people who contributed including Ted Hardie, 7089 Michael Chen, Dan York, Das Saumitra, Lyndsay Campbell, Brian Rosen, 7090 David Bryan, Dave Craig, and Julian Cain. Extensive last call 7091 comments were provided by: Jouni Maenpaa, Roni Even, Gonzalo 7092 Camarillo, Ari Keranen, John Buford, Michael Chen, Frederic-Philippe 7093 Met, Mary Barnes, and David Bryan. Special thanks to Marc Petit- 7094 Huguenin who provided an amazing amount of detailed review. 7096 16. References 7098 16.1. Normative References 7100 [RFC1918] Rekhter, Y., Moskowitz, R., Karrenberg, D., Groot, G., and 7101 E. Lear, "Address Allocation for Private Internets", 7102 BCP 5, RFC 1918, February 1996. 7104 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 7105 Requirement Levels", BCP 14, RFC 2119, March 1997. 7107 [RFC2388] Masinter, L., "Returning Values from Forms: multipart/ 7108 form-data", RFC 2388, August 1998. 7110 [RFC2585] Housley, R. and P. Hoffman, "Internet X.509 Public Key 7111 Infrastructure Operational Protocols: FTP and HTTP", 7112 RFC 2585, May 1999. 7114 [RFC2818] Rescorla, E., "HTTP Over TLS", RFC 2818, May 2000. 7116 [RFC3023] Murata, M., St. Laurent, S., and D. Kohn, "XML Media 7117 Types", RFC 3023, January 2001. 7119 [RFC3174] Eastlake, D. and P. Jones, "US Secure Hash Algorithm 1 7120 (SHA1)", RFC 3174, September 2001. 7122 [RFC3447] Jonsson, J. and B. Kaliski, "Public-Key Cryptography 7123 Standards (PKCS) #1: RSA Cryptography Specifications 7124 Version 2.1", RFC 3447, February 2003. 7126 [RFC3629] Yergeau, F., "UTF-8, a transformation format of ISO 7127 10646", STD 63, RFC 3629, November 2003. 7129 [RFC3986] Berners-Lee, T., Fielding, R., and L. Masinter, "Uniform 7130 Resource Identifier (URI): Generic Syntax", STD 66, 7131 RFC 3986, January 2005. 7133 [RFC4279] Eronen, P. and H. Tschofenig, "Pre-Shared Key Ciphersuites 7134 for Transport Layer Security (TLS)", RFC 4279, 7135 December 2005. 7137 [RFC4347] Rescorla, E. and N. Modadugu, "Datagram Transport Layer 7138 Security", RFC 4347, April 2006. 7140 [RFC4395] Hansen, T., Hardie, T., and L. Masinter, "Guidelines and 7141 Registration Procedures for New URI Schemes", BCP 35, 7142 RFC 4395, February 2006. 7144 [RFC4648] Josefsson, S., "The Base16, Base32, and Base64 Data 7145 Encodings", RFC 4648, October 2006. 7147 [RFC5245] Rosenberg, J., "Interactive Connectivity Establishment 7148 (ICE): A Protocol for Network Address Translator (NAT) 7149 Traversal for Offer/Answer Protocols", RFC 5245, 7150 April 2010. 7152 [RFC5246] Dierks, T. and E. Rescorla, "The Transport Layer Security 7153 (TLS) Protocol Version 1.2", RFC 5246, August 2008. 7155 [RFC5272] Schaad, J. and M. Myers, "Certificate Management over CMS 7156 (CMC)", RFC 5272, June 2008. 7158 [RFC5273] Schaad, J. and M. Myers, "Certificate Management over CMS 7159 (CMC): Transport Protocols", RFC 5273, June 2008. 7161 [RFC5389] Rosenberg, J., Mahy, R., Matthews, P., and D. Wing, 7162 "Session Traversal Utilities for NAT (STUN)", RFC 5389, 7163 October 2008. 7165 [RFC5405] Eggert, L. and G. Fairhurst, "Unicast UDP Usage Guidelines 7166 for Application Designers", BCP 145, RFC 5405, 7167 November 2008. 7169 [RFC5766] Mahy, R., Matthews, P., and J. Rosenberg, "Traversal Using 7170 Relays around NAT (TURN): Relay Extensions to Session 7171 Traversal Utilities for NAT (STUN)", RFC 5766, April 2010. 7173 [RFC5952] Kawamura, S. and M. Kawashima, "A Recommendation for IPv6 7174 Address Text Representation", RFC 5952, August 2010. 7176 [RFC6091] Mavrogiannopoulos, N. and D. Gillmor, "Using OpenPGP Keys 7177 for Transport Layer Security (TLS) Authentication", 7178 RFC 6091, February 2011. 7180 [RFC6234] Eastlake, D. and T. Hansen, "US Secure Hash Algorithms 7181 (SHA and SHA-based HMAC and HKDF)", RFC 6234, May 2011. 7183 [RFC6298] Paxson, V., Allman, M., Chu, J., and M. Sargent, 7184 "Computing TCP's Retransmission Timer", RFC 6298, 7185 June 2011. 7187 [w3c-xml-namespaces] 7188 Bray, T., Hollander, D., Layman, A., Tobin, R., and Henry 7189 S. , "Namespaces in XML 1.0 (Third Edition)". 7191 16.2. Informative References 7193 [Chord] Stoica, I., Morris, R., Liben-Nowell, D., Karger, D., 7194 Kaashoek, M., Dabek, F., and H. Balakrishnan, "Chord: A 7195 Scalable Peer-to-peer Lookup Protocol for Internet 7196 Applications", IEEE/ACM Transactions on Networking Volume 7197 11, Issue 1, 17-32, Feb 2003. 7199 [Eclipse] Singh, A., Ngan, T., Druschel, T., and D. Wallach, 7200 "Eclipse Attacks on Overlay Networks: Threats and 7201 Defenses", INFOCOM 2006, April 2006. 7203 [I-D.ietf-hip-reload-instance] 7204 Keranen, A., Camarillo, G., and J. Maenpaa, "Host Identity 7205 Protocol-Based Overlay Networking Environment (HIP BONE) 7206 Instance Specification for REsource LOcation And Discovery 7207 (RELOAD)", draft-ietf-hip-reload-instance-04 (work in 7208 progress), October 2011. 7210 [I-D.ietf-mmusic-ice-tcp] 7211 Rosenberg, J., Keranen, A., Lowekamp, B., and A. Roach, 7212 "TCP Candidates with Interactive Connectivity 7213 Establishment (ICE)", draft-ietf-mmusic-ice-tcp-16 (work 7214 in progress), November 2011. 7216 [I-D.ietf-p2psip-diagnostics] 7217 Bryan, D., Jiang, X., Even, R., and H. Song, "P2PSIP 7218 Overlay Diagnostics", draft-ietf-p2psip-diagnostics-08 7219 (work in progress), December 2011. 7221 [I-D.ietf-p2psip-self-tuning] 7222 Maenpaa, J., Camarillo, G., and J. Hautakorpi, "A Self- 7223 tuning Distributed Hash Table (DHT) for REsource LOcation 7224 And Discovery (RELOAD)", draft-ietf-p2psip-self-tuning-05 7225 (work in progress), January 2012. 7227 [I-D.ietf-p2psip-service-discovery] 7228 Maenpaa, J. and G. Camarillo, "Service Discovery Usage for 7229 REsource LOcation And Discovery (RELOAD)", 7230 draft-ietf-p2psip-service-discovery-04 (work in progress), 7231 January 2012. 7233 [I-D.ietf-p2psip-sip] 7234 Jennings, C., Lowekamp, B., Rescorla, E., Baset, S., and 7235 H. Schulzrinne, "A SIP Usage for RELOAD", 7236 draft-ietf-p2psip-sip-07 (work in progress), January 2012. 7238 [I-D.jiang-p2psip-relay] 7239 Jiang, X., Zong, N., Even, R., and Y. Zhang, "An extension 7240 to RELOAD to support Direct Response and Relay Peer 7241 routing", draft-jiang-p2psip-relay-05 (work in progress), 7242 March 2011. 7244 [RFC1122] Braden, R., "Requirements for Internet Hosts - 7245 Communication Layers", STD 3, RFC 1122, October 1989. 7247 [RFC2311] Dusse, S., Hoffman, P., Ramsdell, B., Lundblade, L., and 7248 L. Repka, "S/MIME Version 2 Message Specification", 7249 RFC 2311, March 1998. 7251 [RFC3688] Mealling, M., "The IETF XML Registry", BCP 81, RFC 3688, 7252 January 2004. 7254 [RFC4086] Eastlake, D., Schiller, J., and S. Crocker, "Randomness 7255 Requirements for Security", BCP 106, RFC 4086, June 2005. 7257 [RFC4145] Yon, D. and G. Camarillo, "TCP-Based Media Transport in 7258 the Session Description Protocol (SDP)", RFC 4145, 7259 September 2005. 7261 [RFC4787] Audet, F. and C. Jennings, "Network Address Translation 7262 (NAT) Behavioral Requirements for Unicast UDP", BCP 127, 7263 RFC 4787, January 2007. 7265 [RFC5054] Taylor, D., Wu, T., Mavrogiannopoulos, N., and T. Perrin, 7266 "Using the Secure Remote Password (SRP) Protocol for TLS 7267 Authentication", RFC 5054, November 2007. 7269 [RFC5095] Abley, J., Savola, P., and G. Neville-Neil, "Deprecation 7270 of Type 0 Routing Headers in IPv6", RFC 5095, 7271 December 2007. 7273 [RFC5201] Moskowitz, R., Nikander, P., Jokela, P., and T. Henderson, 7274 "Host Identity Protocol", RFC 5201, April 2008. 7276 [RFC5280] Cooper, D., Santesson, S., Farrell, S., Boeyen, S., 7277 Housley, R., and W. Polk, "Internet X.509 Public Key 7278 Infrastructure Certificate and Certificate Revocation List 7279 (CRL) Profile", RFC 5280, May 2008. 7281 [RFC5694] Camarillo, G. and IAB, "Peer-to-Peer (P2P) Architecture: 7282 Definition, Taxonomies, Examples, and Applicability", 7283 RFC 5694, November 2009. 7285 [RFC5765] Schulzrinne, H., Marocco, E., and E. Ivov, "Security 7286 Issues and Solutions in Peer-to-Peer Systems for Realtime 7287 Communications", RFC 5765, February 2010. 7289 [RFC5785] Nottingham, M. and E. Hammer-Lahav, "Defining Well-Known 7290 Uniform Resource Identifiers (URIs)", RFC 5785, 7291 April 2010. 7293 [RFC6079] Camarillo, G., Nikander, P., Hautakorpi, J., Keranen, A., 7294 and A. Johnston, "HIP BONE: Host Identity Protocol (HIP) 7295 Based Overlay Networking Environment (BONE)", RFC 6079, 7296 January 2011. 7298 [Sybil] Douceur, J., "The Sybil Attack", IPTPS 02, March 2002. 7300 [UnixTime] 7301 Wikipedia, "Unix Time", . 7304 [bryan-design-hotp2p08] 7305 Bryan, D., Lowekamp, B., and M. Zangrilli, "The Design of 7306 a Versatile, Secure P2PSIP Communications Architecture for 7307 the Public Internet", Hot-P2P'08. 7309 [handling-churn-usenix04] 7310 Rhea, S., Geels, D., Roscoe, T., and J. Kubiatowicz, 7311 "Handling Churn in a DHT", In Proc. of the USENIX Annual 7312 Technical Conference June 2004 USENIX 2004. 7314 [lookups-churn-p2p06] 7315 Wu, D., Tian, Y., and K. Ng, "Analytical Study on 7316 Improving DHT Lookup Performance under Churn", IEEE 7317 P2P'06. 7319 [minimizing-churn-sigcomm06] 7320 Godfrey, P., Shenker, S., and I. Stoica, "Minimizing Churn 7321 in Distributed Systems", SIGCOMM 2006. 7323 [non-transitive-dhts-worlds05] 7324 Freedman, M., Lakshminarayanan, K., Rhea, S., and I. 7325 Stoica, "Non-Transitive Connectivity and DHTs", 7326 WORLDS'05. 7328 [opendht-sigcomm05] 7329 Rhea, S., Godfrey, B., Karp, B., Kubiatowicz, J., 7330 Ratnasamy, S., Shenker, S., Stoica, I., and H. Yu, 7331 "OpenDHT: A Public DHT and its Uses", SIGCOMM'05. 7333 [vulnerabilities-acsac04] 7334 Srivatsa, M. and L. Liu, "Vulnerabilities and Security 7335 Threats in Structured Peer-to-Peer Systems: A Quantitative 7336 Analysis", ACSAC 2004. 7338 [wikiChord] 7339 Wikipedia, "Chord (peer-to-peer)", 7340 . 7342 Appendix A. Routing Alternatives 7344 Significant discussion has been focused on the selection of a routing 7345 algorithm for P2PSIP. This section discusses the motivations for 7346 selecting symmetric recursive routing for RELOAD and describes the 7347 extensions that would be required to support additional routing 7348 algorithms. 7350 A.1. Iterative vs Recursive 7352 Iterative routing has a number of advantages. It is easier to debug, 7353 consumes fewer resources on intermediate peers, and allows the 7354 querying peer to identify and route around misbehaving peers 7355 [non-transitive-dhts-worlds05]. However, in the presence of NATs, 7356 iterative routing is intolerably expensive because a new connection 7357 must be established for each hop (using ICE) [bryan-design-hotp2p08]. 7359 Iterative routing is supported through the RouteQuery mechanism and 7360 is primarily intended for debugging. It also allows the querying 7361 peer to evaluate the routing decisions made by the peers at each hop, 7362 consider alternatives, and perhaps detect at what point the 7363 forwarding path fails. 7365 A.2. Symmetric vs Forward response 7367 An alternative to the symmetric recursive routing method used by 7368 RELOAD is Forward-Only routing, where the response is routed to the 7369 requester as if it were a new message initiated by the responder (in 7370 the previous example, Z sends the response to A as if it were sending 7371 a request). Forward-only routing requires no state in either the 7372 message or intermediate peers. 7374 The drawback of forward-only routing is that it does not work when 7375 the overlay is unstable. For example, if A is in the process of 7376 joining the overlay and is sending a Join request to Z, it is not yet 7377 reachable via forward routing. Even if it is established in the 7378 overlay, if network failures produce temporary instability, A may not 7379 be reachable (and may be trying to stabilize its network connectivity 7380 via Attach messages). 7382 Furthermore, forward-only responses are less likely to reach the 7383 querying peer than symmetric recursive ones are, because the forward 7384 path is more likely to have a failed peer than is the request path 7385 (which was just tested to route the request) 7386 [non-transitive-dhts-worlds05]. 7388 An extension to RELOAD that supports forward-only routing but relies 7389 on symmetric responses as a fallback would be possible, but due to 7390 the complexities of determining when to use forward-only and when to 7391 fallback to symmetric, we have chosen not to include it as an option 7392 at this point. 7394 A.3. Direct Response 7396 Another routing option is Direct Response routing, in which the 7397 response is returned directly to the querying node. In the previous 7398 example, if A encodes its IP address in the request, then Z can 7399 simply deliver the response directly to A. In the absence of NATs or 7400 other connectivity issues, this is the optimal routing technique. 7402 The challenge of implementing direct response is the presence of 7403 NATs. There are a number of complexities that must be addressed. In 7404 this discussion, we will continue our assumption that A issued the 7405 request and Z is generating the response. 7407 o The IP address listed by A may be unreachable, either due to NAT 7408 or firewall rules. Therefore, a direct response technique must 7409 fallback to symmetric response [non-transitive-dhts-worlds05]. 7410 The hop-by-hop ACKs used by RELOAD allow Z to determine when A has 7411 received the message (and the TLS negotiation will provide earlier 7412 confirmation that A is reachable), but this fallback requires a 7413 timeout that will increase the response latency whenever A is not 7414 reachable from Z. 7415 o Whenever A is behind a NAT it will have multiple candidate IP 7416 addresses, each of which must be advertised to ensure 7417 connectivity; therefore Z will need to attempt multiple 7418 connections to deliver the response. 7419 o One (or all) of A's candidate addresses may route from Z to a 7420 different device on the Internet. In the worst case these nodes 7421 may actually be running RELOAD on the same port. Therefore, it is 7422 absolutely necessary to establish a secure connection to 7423 authenticate A before delivering the response. This step 7424 diminishes the efficiency of direct response because multiple 7425 roundtrips are required before the message can be delivered. 7426 o If A is behind a NAT and does not have a connection already 7427 established with Z, there are only two ways the direct response 7428 will work. The first is that A and Z both be behind the same NAT, 7429 in which case the NAT is not involved. In the more common case, 7430 when Z is outside A's NAT, the response will only be received if 7431 A's NAT implements endpoint-independent filtering. As the choice 7432 of filtering mode conflates application transparency with security 7433 [RFC4787], and no clear recommendation is available, the 7434 prevalence of this feature in future devices remains unclear. 7436 An extension to RELOAD that supports direct response routing but 7437 relies on symmetric responses as a fallback would be possible, but 7438 due to the complexities of determining when to use direct response 7439 and when to fallback to symmetric, and the reduced performance for 7440 responses to peers behind restrictive NATs, we have chosen not to 7441 include it as an option at this point. 7443 A.4. Relay Peers 7445 [I-D.jiang-p2psip-relay] has proposed implementing a form of direct 7446 response by having A identify a peer, Q, that will be directly 7447 reachable by any other peer. A uses Attach to establish a connection 7448 with Q and advertises Q's IP address in the request sent to Z. Z 7449 sends the response to Q, which relays it to A. This then reduces the 7450 latency to two hops, plus Z negotiating a secure connection to Q. 7452 This technique relies on the relative population of nodes such as A 7453 that require relay peers and peers such as Q that are capable of 7454 serving as a relay peer. It also requires nodes to be able to 7455 identify which category they are in. This identification problem has 7456 turned out to be hard to solve and is still an open area of 7457 exploration. 7459 An extension to RELOAD that supports relay peers is possible, but due 7460 to the complexities of implementing such an alternative, we have not 7461 added such a feature to RELOAD at this point. 7463 A concept similar to relay peers, essentially choosing a relay peer 7464 at random, has previously been suggested to solve problems of 7465 pairwise non-transitivity [non-transitive-dhts-worlds05], but 7466 deterministic filtering provided by NATs makes random relay peers no 7467 more likely to work than the responding peer. 7469 A.5. Symmetric Route Stability 7471 A common concern about symmetric recursive routing has been that one 7472 or more peers along the request path may fail before the response is 7473 received. The significance of this problem essentially depends on 7474 the response latency of the overlay. An overlay that produces slow 7475 responses will be vulnerable to churn, whereas responses that are 7476 delivered very quickly are vulnerable only to failures that occur 7477 over that small interval. 7479 The other aspect of this issue is whether the request itself can be 7480 successfully delivered. Assuming typical connection maintenance 7481 intervals, the time period between the last maintenance and the 7482 request being sent will be orders of magnitude greater than the delay 7483 between the request being forwarded and the response being received. 7484 Therefore, if the path was stable enough to be available to route the 7485 request, it is almost certainly going to remain available to route 7486 the response. 7488 An overlay that is unstable enough to suffer this type of failure 7489 frequently is unlikely to be able to support reliable functionality 7490 regardless of the routing mechanism. However, regardless of the 7491 stability of the return path, studies show that in the event of high 7492 churn, iterative routing is a better solution to ensure request 7493 completion [lookups-churn-p2p06] [non-transitive-dhts-worlds05] 7495 Finally, because RELOAD retries the end-to-end request, that retry 7496 will address the issues of churn that remain. 7498 Appendix B. Why Clients? 7500 There are a wide variety of reasons a node may act as a client rather 7501 than as a peer. This section outlines some of those scenarios and 7502 how the client's behavior changes based on its capabilities. 7504 B.1. Why Not Only Peers? 7506 For a number of reasons, a particular node may be forced to act as a 7507 client even though it is willing to act as a peer. These include: 7509 o The node does not have appropriate network connectivity, typically 7510 because it has a low-bandwidth network connection. 7511 o The node may not have sufficient resources, such as computing 7512 power, storage space, or battery power. 7513 o The overlay algorithm may dictate specific requirements for peer 7514 selection. These may include participating in the overlay to 7515 determine trustworthiness; controlling the number of peers in the 7516 overlay to reduce overly-long routing paths; or ensuring minimum 7517 application uptime before a node can join as a peer. 7519 The ultimate criteria for a node to become a peer are determined by 7520 the overlay algorithm and specific deployment. A node acting as a 7521 client that has a full implementation of RELOAD and the appropriate 7522 overlay algorithm is capable of locating its responsible peer in the 7523 overlay and using Attach to establish a direct connection to that 7524 peer. In that way, it may elect to be reachable under either of the 7525 routing approaches listed above. Particularly for overlay algorithms 7526 that elect nodes to serve as peers based on trustworthiness or 7527 population, the overlay algorithm may require such a client to locate 7528 itself at a particular place in the overlay. 7530 B.2. Clients as Application-Level Agents 7532 SIP defines an extensive protocol for registration and security 7533 between a client and its registrar/proxy server(s). Any SIP device 7534 can act as a client of a RELOAD-based P2PSIP overlay if it contacts a 7535 peer that implements the server-side functionality required by the 7536 SIP protocol. In this case, the peer would be acting as if it were 7537 the user's peer, and would need the appropriate credentials for that 7538 user. 7540 Application-level support for clients is defined by a usage. A usage 7541 offering support for application-level clients should specify how the 7542 security of the system is maintained when the data is moved between 7543 the application and RELOAD layers. 7545 Authors' Addresses 7547 Cullen Jennings 7548 Cisco 7549 170 West Tasman Drive 7550 MS: SJC-21/2 7551 San Jose, CA 95134 7552 USA 7554 Phone: +1 408 421-9990 7555 Email: fluffy@cisco.com 7557 Bruce B. Lowekamp (editor) 7558 Skype 7559 Palo Alto, CA 7560 USA 7562 Email: bbl@lowekamp.net 7564 Eric Rescorla 7565 RTFM, Inc. 7566 2064 Edgewood Drive 7567 Palo Alto, CA 94303 7568 USA 7570 Phone: +1 650 678 2350 7571 Email: ekr@rtfm.com 7573 Salman A. Baset 7574 Columbia University 7575 1214 Amsterdam Avenue 7576 New York, NY 7577 USA 7579 Email: salman@cs.columbia.edu 7581 Henning Schulzrinne 7582 Columbia University 7583 1214 Amsterdam Avenue 7584 New York, NY 7585 USA 7587 Email: hgs@cs.columbia.edu