idnits 2.17.1 draft-ietf-p2psip-base-22.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 1995 has weird spacing: '...Options optio...' == Line 2254 has weird spacing: '...ionType type;...' == Line 2484 has weird spacing: '...tyValue ide...' == Line 2814 has weird spacing: '...ionType typ...' == Line 2816 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: == 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 'SHOULD not' in this paragraph: 3. JP SHOULD send Attach requests to initiate connections to each of the peers in the neighbor table as well as to the desired finger table entries. Note that this does not populate their routing tables, but only their connection tables, so JP will not get messages that it is expected to route to other nodes. 4. JP MUST enter all the peers it has successfully contacted into its routing table. 5. JP MUST send a Join to AP. The AP sends the response to the Join. 6. AP MUST do a series of Store requests to JP to store the data that JP will be responsible for. 7. AP MUST send JP an Update explicitly labeling JP as its predecessor. At this point, JP is part of the ring and responsible for a section of the overlay. AP MAY now forget any data which is assigned to JP and not AP. AP SHOULD not forget any data where AP is the replica set for the data. 8. The AP MUST send an Update to all of its neighbors with the new values of its neighbor set (including JP). 9. The JP MUST send Updates to all the peers in its neighbor table. -- 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 (July 16, 2012) is 4302 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 1188, but not defined == Missing Reference: 'B' is mentioned on line 1188, but not defined == Missing Reference: 'NodeIdLength' is mentioned on line 1890, but not defined -- Looks like a reference, but probably isn't: '0' on line 4877 == Missing Reference: 'RFC-AAAA' is mentioned on line 6662, 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 (~~), 18 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: January 17, 2013 Skype 6 E. Rescorla 7 RTFM, Inc. 8 S. Baset 9 H. Schulzrinne 10 Columbia University 11 July 16, 2012 13 REsource LOcation And Discovery (RELOAD) Base Protocol 14 draft-ietf-p2psip-base-22 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 January 17, 2013. 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 . . . . . . . . . . . . . . . . . . 16 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 . . . . . . . . . . . . . . . . . . . . . . . . 110 209 10.4. Redundancy . . . . . . . . . . . . . . . . . . . . . . . 110 210 10.5. Joining . . . . . . . . . . . . . . . . . . . . . . . . 110 211 10.6. Routing Attaches . . . . . . . . . . . . . . . . . . . . 112 212 10.7. Updates . . . . . . . . . . . . . . . . . . . . . . . . 112 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 . . . . . . . . . . . . . 116 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 . . . . . . . . . . . . . . . . . . 126 227 11.2. Discovery Through Configuration Server . . . . . . . . . 128 228 11.3. Credentials . . . . . . . . . . . . . . . . . . . . . . 129 229 11.3.1. Self-Generated Credentials . . . . . . . . . . . . . 131 230 11.4. Searching for a Bootstrap Node . . . . . . . . . . . . . 131 231 11.5. Contacting a Bootstrap Node . . . . . . . . . . . . . . 131 232 12. Message Flow Example . . . . . . . . . . . . . . . . . . . . 132 233 13. Security Considerations . . . . . . . . . . . . . . . . . . . 138 234 13.1. Overview . . . . . . . . . . . . . . . . . . . . . . . . 138 235 13.2. Attacks on P2P Overlays . . . . . . . . . . . . . . . . 139 236 13.3. Certificate-based Security . . . . . . . . . . . . . . . 139 237 13.4. Shared-Secret Security . . . . . . . . . . . . . . . . . 140 238 13.5. Storage Security . . . . . . . . . . . . . . . . . . . . 141 239 13.5.1. Authorization . . . . . . . . . . . . . . . . . . . 141 240 13.5.2. Distributed Quota . . . . . . . . . . . . . . . . . 142 241 13.5.3. Correctness . . . . . . . . . . . . . . . . . . . . 142 242 13.5.4. Residual Attacks . . . . . . . . . . . . . . . . . . 142 243 13.6. Routing Security . . . . . . . . . . . . . . . . . . . . 143 244 13.6.1. Background . . . . . . . . . . . . . . . . . . . . . 143 245 13.6.2. Admissions Control . . . . . . . . . . . . . . . . . 144 246 13.6.3. Peer Identification and Authentication . . . . . . . 144 247 13.6.4. Protecting the Signaling . . . . . . . . . . . . . . 145 248 13.6.5. Routing Loops and Dos Attacks . . . . . . . . . . . 145 249 13.6.6. Residual Attacks . . . . . . . . . . . . . . . . . . 145 250 14. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 146 251 14.1. Well-Known URI Registration . . . . . . . . . . . . . . 146 252 14.2. Port Registrations . . . . . . . . . . . . . . . . . . . 146 253 14.3. Overlay Algorithm Types . . . . . . . . . . . . . . . . 147 254 14.4. Access Control Policies . . . . . . . . . . . . . . . . 147 255 14.5. Application-ID . . . . . . . . . . . . . . . . . . . . . 148 256 14.6. Data Kind-ID . . . . . . . . . . . . . . . . . . . . . . 148 257 14.7. Data Model . . . . . . . . . . . . . . . . . . . . . . . 149 258 14.8. Message Codes . . . . . . . . . . . . . . . . . . . . . 149 259 14.9. Error Codes . . . . . . . . . . . . . . . . . . . . . . 151 260 14.10. Overlay Link Types . . . . . . . . . . . . . . . . . . . 151 261 14.11. Overlay Link Protocols . . . . . . . . . . . . . . . . . 152 262 14.12. Forwarding Options . . . . . . . . . . . . . . . . . . . 152 263 14.13. Probe Information Types . . . . . . . . . . . . . . . . 153 264 14.14. Message Extensions . . . . . . . . . . . . . . . . . . . 153 265 14.15. reload URI Scheme . . . . . . . . . . . . . . . . . . . 153 266 14.15.1. URI Registration . . . . . . . . . . . . . . . . . . 154 267 14.16. Media Type Registration . . . . . . . . . . . . . . . . 155 268 14.17. XML Name Space Registration . . . . . . . . . . . . . . 156 269 14.17.1. Config URL . . . . . . . . . . . . . . . . . . . . . 156 270 14.17.2. Config Chord URL . . . . . . . . . . . . . . . . . . 156 271 15. Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . 156 272 16. References . . . . . . . . . . . . . . . . . . . . . . . . . 157 273 16.1. Normative References . . . . . . . . . . . . . . . . . . 157 274 16.2. Informative References . . . . . . . . . . . . . . . . . 159 275 Appendix A. Routing Alternatives . . . . . . . . . . . . . . . . 162 276 A.1. Iterative vs Recursive . . . . . . . . . . . . . . . . . 162 277 A.2. Symmetric vs Forward response . . . . . . . . . . . . . 163 278 A.3. Direct Response . . . . . . . . . . . . . . . . . . . . 163 279 A.4. Relay Peers . . . . . . . . . . . . . . . . . . . . . . 164 280 A.5. Symmetric Route Stability . . . . . . . . . . . . . . . 165 281 Appendix B. Why Clients? . . . . . . . . . . . . . . . . . . . . 165 282 B.1. Why Not Only Peers? . . . . . . . . . . . . . . . . . . 165 283 B.2. Clients as Application-Level Agents . . . . . . . . . . 166 284 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 166 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 route messages to other nodes and to store and retrieve data 292 in the overlay. RELOAD provides several features that are critical 293 for a successful P2P protocol for the Internet: 295 Security Framework: A P2P network will often be established among a 296 set of peers that do not trust each other. RELOAD leverages a 297 central enrollment server to provide credentials for each peer 298 which can then be used to authenticate each operation. This 299 greatly reduces the possible attack surface. 301 Usage Model: RELOAD is designed to support a variety of 302 applications, including P2P multimedia communications with the 303 Session Initiation Protocol [I-D.ietf-p2psip-sip]. RELOAD allows 304 the definition of new application usages, each of which can define 305 its own data types, along with the rules for their use. This 306 allows RELOAD to be used with new applications through a simple 307 documentation process that supplies the details for each 308 application. 310 NAT Traversal: RELOAD is designed to function in environments where 311 many if not most of the nodes are behind NATs or firewalls. 312 Operations for NAT traversal are part of the base design, 313 including using ICE to establish new RELOAD or application 314 protocol connections. 316 High Performance Routing: The very nature of overlay algorithms 317 introduces a requirement that peers participating in the P2P 318 network route requests on behalf of other peers in the network. 319 This introduces a load on those other peers, in the form of 320 bandwidth and processing power. RELOAD has been defined with a 321 simple, lightweight forwarding header, thus minimizing the amount 322 of effort required by intermediate peers. 324 Pluggable Overlay Algorithms: RELOAD has been designed with an 325 abstract interface to the overlay layer to simplify implementing a 326 variety of structured (e.g., distributed hash tables) and 327 unstructured overlay algorithms. The idea here is that RELOAD 328 provides a generic structure that should fit most types of overlay 329 topologies (ring, hyperspace, etc.). To instantiate an actual 330 network, you combine RELOAD with a specific overlay algorithm, 331 which defines how to construct the overlay topology and route 332 messages efficiently within it. This specification also defines 333 how RELOAD is used with the Chord based DHT algorithm, which is 334 mandatory to implement. Specifying a default "must implement" 335 overlay algorithm promotes interoperability, while extensibility 336 allows selection of overlay algorithms optimized for a particular 337 application. 339 These properties were designed specifically to meet the requirements 340 for a P2P protocol to support SIP. This document defines the base 341 protocol for the distributed storage and location service, as well as 342 critical usages for NAT traversal and security. The SIP Usage itself 343 is described separately in [I-D.ietf-p2psip-sip]. RELOAD is not 344 limited to usage by SIP and could serve as a tool for supporting 345 other P2P applications with similar needs. 347 1.1. Basic Setting 349 In this section, we provide a brief overview of the operational 350 setting for RELOAD. A RELOAD Overlay Instance consists of a set of 351 nodes arranged in a partly connected graph. Each node in the overlay 352 is assigned a numeric Node-ID which, together with the specific 353 overlay algorithm in use, determines its position in the graph and 354 the set of nodes it connects to. The figure below shows a trivial 355 example which isn't drawn from any particular overlay algorithm, but 356 was chosen for convenience of representation. 358 +--------+ +--------+ +--------+ 359 | Node 10|--------------| Node 20|--------------| Node 30| 360 +--------+ +--------+ +--------+ 361 | | | 362 | | | 363 +--------+ +--------+ +--------+ 364 | Node 40|--------------| Node 50|--------------| Node 60| 365 +--------+ +--------+ +--------+ 366 | | | 367 | | | 368 +--------+ +--------+ +--------+ 369 | Node 70|--------------| Node 80|--------------| Node 90| 370 +--------+ +--------+ +--------+ 371 | 372 | 373 +--------+ 374 | Node 85| 375 |(Client)| 376 +--------+ 378 Because the graph is not fully connected, when a node wants to send a 379 message to another node, it may need to route it through the network. 380 For instance, Node 10 can talk directly to nodes 20 and 40, but not 381 to Node 70. In order to send a message to Node 70, it would first 382 send it to Node 40 with instructions to pass it along to Node 70. 383 Different overlay algorithms will have different connectivity graphs, 384 but the general idea behind all of them is to allow any node in the 385 graph to efficiently reach every other node within a small number of 386 hops. 388 The RELOAD network is not only a messaging network. It is also a 389 storage network, albeit one designed for small-scale storage rather 390 than for bulk storage of large objects. Records are stored under 391 numeric addresses which occupy the same space as node identifiers. 392 Peers are responsible for storing the data associated with some set 393 of addresses as determined by their Node-ID. For instance, we might 394 say that every peer is responsible for storing any data value which 395 has an address less than or equal to its own Node-ID, but greater 396 than the next lowest Node-ID. Thus, Node-20 would be responsible for 397 storing values 11-20. 399 RELOAD also supports clients. These are nodes which have Node-IDs 400 but do not participate in routing or storage. For instance, in the 401 figure above Node 85 is a client. It can route to the rest of the 402 RELOAD network via Node 80, but no other node will route through it 403 and Node 90 is still responsible for all addresses between 81-90. We 404 refer to non-client nodes as peers. 406 Other applications (for instance, SIP) can be defined on top of 407 RELOAD and use these two basic RELOAD services to provide their own 408 services. 410 1.2. Architecture 412 RELOAD is fundamentally an overlay network. The following figure 413 shows the layered RELOAD architecture. 415 Application 417 +-------+ +-------+ 418 | SIP | | XMPP | ... 419 | Usage | | Usage | 420 +-------+ +-------+ 421 ------------------------------------ Messaging Service Boundary 422 +------------------+ +---------+ 423 | Message |<--->| Storage | 424 | Transport | +---------+ 425 +------------------+ ^ 426 ^ ^ | 427 | v v 428 | +-------------------+ 429 | | Topology | 430 | | Plugin | 431 | +-------------------+ 432 | ^ 433 v v 434 +------------------+ 435 | Forwarding & | 436 | Link Management | 437 +------------------+ 438 ------------------------------------ Overlay Link Service Boundary 439 +-------+ +------+ 440 |TLS | |DTLS | ... 441 +-------+ +------+ 443 The major components of RELOAD are: 445 Usage Layer: Each application defines a RELOAD usage; a set of data 446 Kinds and behaviors which describe how to use the services 447 provided by RELOAD. These usages all talk to RELOAD through a 448 common Message Transport Service. 450 Message Transport: Handles end-to-end reliability, manages request 451 state for the usages, and forwards Store and Fetch operations to 452 the Storage component. Delivers message responses to the 453 component initiating the request. 455 Storage: The Storage component is responsible for processing 456 messages relating to the storage and retrieval of data. It talks 457 directly to the Topology Plugin to manage data replication and 458 migration, and it talks to the Message Transport component to send 459 and receive messages. 461 Topology Plugin: The Topology Plugin is responsible for implementing 462 the specific overlay algorithm being used. It uses the Message 463 Transport component to send and receive overlay management 464 messages, to the Storage component to manage data replication, and 465 directly to the Forwarding Layer to control hop-by-hop message 466 forwarding. This component closely parallels conventional routing 467 algorithms, but is more tightly coupled to the Forwarding Layer 468 because there is no single "routing table" equivalent used by all 469 overlay algorithms. 471 Forwarding and Link Management Layer: Stores and implements the 472 routing table by providing packet forwarding services between 473 nodes. It also handles establishing new links between nodes, 474 including setting up connections across NATs using ICE. 476 Overlay Link Layer: Responsible for actually transporting traffic 477 directly between nodes. Each such protocol includes the 478 appropriate provisions for per-hop framing or hop-by-hop ACKs 479 required by unreliable transports. TLS [RFC5246] and DTLS 480 [RFC4347] are the currently defined "link layer" protocols used by 481 RELOAD for hop-by-hop communication. New protocols can be 482 defined, as described in Section 6.6.1 and Section 11.1. As this 483 document defines only TLS and DTLS, we use those terms throughout 484 the remainder of the document with the understanding that some 485 future specification may add new overlay link layers. 487 To further clarify the roles of the various layers, this figure 488 parallels the architecture with each layer's role from an overlay 489 perspective and implementation layer in the internet: 491 | Internet Model | 492 Real | Equivalent | Reload 493 Internet | in Overlay | Architecture 494 -------------+-----------------+------------------------------------ 495 | | +-------+ +-------+ 496 | Application | | SIP | | XMPP | ... 497 | | | Usage | | Usage | 498 | | +-------+ +-------+ 499 | | ---------------------------------- 500 | |+------------------+ +---------+ 501 | Transport || Message |<--->| Storage | 502 | || Transport | +---------+ 503 | |+------------------+ ^ 504 | | ^ ^ | 505 | | | v v 506 Application | | | +-------------------+ 507 | (Routing) | | | Topology | 508 | | | | Plugin | 509 | | | +-------------------+ 510 | | | ^ 511 | | v v 512 | Network | +------------------+ 513 | | | Forwarding & | 514 | | | Link Management | 515 | | +------------------+ 516 | | ---------------------------------- 517 Transport | Link | +-------+ +------+ 518 | | |TLS | |DTLS | ... 519 | | +-------+ +------+ 520 -------------+-----------------+------------------------------------ 521 Network | 522 | 523 Link | 525 In addition to the above components, nodes communicate with a central 526 provisioning infrastructure (not shown) to get configuration 527 information, authentication credentials, and the initial set of nodes 528 to communicate with to join the overlay. 530 1.2.1. Usage Layer 532 The top layer, called the Usage Layer, has application usages, such 533 as the SIP Registration Usage [I-D.ietf-p2psip-sip], that use the 534 abstract Message Transport Service provided by RELOAD. The goal of 535 this layer is to implement application-specific usages of the generic 536 overlay services provided by RELOAD. The usage defines how a 537 specific application maps its data into something that can be stored 538 in the overlay, where to store the data, how to secure the data, and 539 finally how applications can retrieve and use the data. 541 The architecture diagram shows both a SIP usage and an XMPP usage. A 542 single application may require multiple usages; for example a 543 softphone application may also require a voicemail usage. A usage 544 may define multiple Kinds of data that are stored in the overlay and 545 may also rely on Kinds originally defined by other usages. 547 Because the security and storage policies for each Kind are dictated 548 by the usage defining the Kind, the usages may be coupled with the 549 Storage component to provide security policy enforcement and to 550 implement appropriate storage strategies according to the needs of 551 the usage. The exact implementation of such an interface is outside 552 the scope of this specification. 554 1.2.2. Message Transport 556 The Message Transport component provides a generic message routing 557 service for the overlay. The Message Transport layer is responsible 558 for end-to-end message transactions. Each peer is identified by its 559 location in the overlay as determined by its Node-ID. A component 560 that is a client of the Message Transport can perform two basic 561 functions: 563 o Send a message to a given peer specified by Node-ID or to the peer 564 responsible for a particular Resource-ID. 565 o Receive messages that other peers sent to a Node-ID or Resource-ID 566 for which the receiving peer is responsible. 568 All usages rely on the Message Transport component to send and 569 receive messages from peers. For instance, when a usage wants to 570 store data, it does so by sending Store requests. Note that the 571 Storage component and the Topology Plugin are themselves clients of 572 the Message Transport, because they need to send and receive messages 573 from other peers. 575 The Message Transport Service is responsible for end-to-end 576 reliability, accomplished by timer-based retransmissions. Unlike the 577 Internet transport layer, however, this layer does not provide 578 congestion control. RELOAD is a request-response protocol, with no 579 more than two pairs of request-response messages used in typical 580 transactions between pairs of nodes, therefore there are no 581 opportunities to observe and react to end-to-end congestion. As with 582 all Internet applications, implementers are strongly discouraged from 583 writing applications that react to loss by immediately retrying the 584 transaction. 586 The Message Transport Service is similar to those described as 587 providing "Key based routing" (KBR), although as RELOAD supports 588 different overlay algorithms (including non-DHT overlay algorithms) 589 that calculate keys in different ways, the actual interface must 590 accept Resource Names rather than actual keys. 592 Stability of the underlying network supporting the overlay (the 593 Internet) and congestion control between overlay neighbors, which 594 exchange routing updates and data replicas in addition to forwarding 595 end-to-end messages, is handled by the Forwarding and Link Management 596 layer described below. 598 Real-world experience has shown that a fixed timeout for the end-to- 599 end retransmission timer is sufficient for practical overlay 600 networks. This timer is adjustable via the overlay configuration. 601 As the overlay configuration can be rapidly updated, this value could 602 be dynamically adjusted at coarse time scales, although algorithms 603 for determining how to accomplish this are beyond the scope of this 604 specification. In many cases, however, more appropriate means of 605 improving network performance, such as the Topology Plugin removing 606 lossy links from use in overlay routing or reducing the overall hop- 607 count of end-to-end paths will be more effective than simply 608 increasing the retransmission timer. 610 1.2.3. Storage 612 One of the major functions of RELOAD is to allow nodes to store data 613 in the overlay and to retrieve data stored by other nodes or by 614 themselves. The Storage component is responsible for processing data 615 storage and retrieval messages. For instance, the Storage component 616 might receive a Store request for a given resource from the Message 617 Transport. It would then query the appropriate usage before storing 618 the data value(s) in its local data store and sending a response to 619 the Message Transport for delivery to the requesting node. 620 Typically, these messages will come from other nodes, but depending 621 on the overlay topology, a node might be responsible for storing data 622 for itself as well, especially if the overlay is small. 624 A peer's Node-ID determines the set of resources that it will be 625 responsible for storing. However, the exact mapping between these is 626 determined by the overlay algorithm in use. The Storage component 627 will only receive a Store request from the Message Transport if this 628 peer is responsible for that Resource-ID. The Storage component is 629 notified by the Topology Plugin when the Resource-IDs for which it is 630 responsible change, and the Storage component is then responsible for 631 migrating resources to other peers, as required. 633 1.2.4. Topology Plugin 635 RELOAD is explicitly designed to work with a variety of overlay 636 algorithms. In order to facilitate this, the overlay algorithm 637 implementation is provided by a Topology Plugin so that each overlay 638 can select an appropriate overlay algorithm that relies on the common 639 RELOAD core protocols and code. 641 The Topology Plugin is responsible for maintaining the overlay 642 algorithm Routing Table, which is consulted by the Forwarding and 643 Link Management Layer before routing a message. When connections are 644 made or broken, the Forwarding and Link Management Layer notifies the 645 Topology Plugin, which adjusts the routing table as appropriate. The 646 Topology Plugin will also instruct the Forwarding and Link Management 647 Layer to form new connections as dictated by the requirements of the 648 overlay algorithm Topology. The Topology Plugin issues periodic 649 update requests through Message Transport to maintain and update its 650 Routing Table. 652 As peers enter and leave, resources may be stored on different peers, 653 so the Topology Plugin also keeps track of which peers are 654 responsible for which resources. As peers join and leave, the 655 Topology Plugin instructs the Storage component to issue resource 656 migration requests as appropriate, in order to ensure that other 657 peers have whatever resources they are now responsible for. The 658 Topology Plugin is also responsible for providing for redundant data 659 storage to protect against loss of information in the event of a peer 660 failure and to protect against compromised or subversive peers. 662 1.2.5. Forwarding and Link Management Layer 664 The Forwarding and Link Management Layer is responsible for getting a 665 message to the next peer, as determined by the Topology Plugin. This 666 Layer establishes and maintains the network connections as required 667 by the Topology Plugin. This layer is also responsible for setting 668 up connections to other peers through NATs and firewalls using ICE, 669 and it can elect to forward traffic using relays for NAT and firewall 670 traversal. 672 Congestion control is implemented at this layer to protect the 673 Internet paths used to form the link in the overlay. Additionally, 674 retransmission is performed to improve the reliability of end-to-end 675 transactions. The relationship between this layer and the Message 676 Transport Layer is similar to the relationship between link-level 677 congestion control and retransmission in modern wireless networks is 678 to Internet transport protocols. 680 This layer provides a generic interface that allows the topology 681 plugin to control the overlay and resource operations and messages. 682 Since each overlay algorithm is defined and functions differently, we 683 generically refer to the table of other peers that the overlay 684 algorithm maintains and uses to route requests (neighbors) as a 685 Routing Table. The Topology Plugin actually owns the Routing Table, 686 and forwarding decisions are made by querying the Topology Plugin for 687 the next hop for a particular Node-ID or Resource-ID. If this node 688 is the destination of the message, the message is delivered to the 689 Message Transport. 691 This layer also utilizes a framing header to encapsulate messages as 692 they are forwarding along each hop. This header aids reliability 693 congestion control, flow control, etc. It has meaning only in the 694 context of that individual link. 696 The Forwarding and Link Management Layer sits on top of the Overlay 697 Link Layer protocols that carry the actual traffic. This 698 specification defines how to use DTLS and TLS protocols to carry 699 RELOAD messages. 701 1.3. Security 703 RELOAD's security model is based on each node having one or more 704 public key certificates. In general, these certificates will be 705 assigned by a central server which also assigns Node-IDs, although 706 self-signed certificates can be used in closed networks. These 707 credentials can be leveraged to provide communications security for 708 RELOAD messages. RELOAD provides communications security at three 709 levels: 711 Connection Level: Connections between peers are secured with TLS, 712 DTLS, or potentially some to be defined future protocol. 713 Message Level: Each RELOAD message is signed. 714 Object Level: Stored objects is signed by the creating peer. 716 These three levels of security work together to allow peers to verify 717 the origin and correctness of data they receive from other peers, 718 even in the face of malicious activity by other peers in the overlay. 719 RELOAD also provides access control built on top of these 720 communications security features. Because the peer responsible for 721 storing a piece of data can validate the signature on the data being 722 stored, the responsible peer can determine whether a given operation 723 is permitted or not. 725 RELOAD also provides an optional shared secret based admission 726 control feature using shared secrets and TLS-PSK. In order to form a 727 TLS connection to any node in the overlay, a new node needs to know 728 the shared overlay key, thus restricting access to authorized users 729 only. This feature is used together with certificate-based access 730 control, not as a replacement for it. It is typically used when 731 self-signed certificates are being used but would generally not be 732 used when the certificates were all signed by an enrollment server. 734 1.4. Structure of This Document 736 The remainder of this document is structured as follows. 738 o Section 2 provides definitions of terms used in this document. 739 o Section 3 provides an overview of the mechanisms used to establish 740 and maintain the overlay. 741 o Section 5 provides an overview of the mechanism RELOAD provides to 742 support other applications. 743 o Section 6 defines the protocol messages that RELOAD uses to 744 establish and maintain the overlay. 745 o Section 7 defines the protocol messages that are used to store and 746 retrieve data using RELOAD. 747 o Section 8 defines the Certificate Store Usage that is fundamental 748 to RELOAD security. 749 o Section 9 defines the TURN Server Usage needed to locate TURN 750 servers for NAT traversal. 751 o Section 10 defines a specific Topology Plugin using Chord based 752 algorithm. 753 o Section 11 defines the mechanisms that new RELOAD nodes use to 754 join the overlay for the first time. 755 o Section 12 provides an extended example. 757 2. Terminology 759 Terms used in this document are defined inline when used and are also 760 defined below for reference. 762 DHT: A distributed hash table. A DHT is an abstract hash table 763 service realized by storing the contents of the hash table across 764 a set of peers. 766 Overlay Algorithm: An overlay algorithm defines the rules for 767 determining which peers in an overlay store a particular piece of 768 data and for determining a topology of interconnections amongst 769 peers in order to find a piece of data. 771 Overlay Instance: A specific overlay algorithm and the collection of 772 peers that are collaborating to provide read and write access to 773 it. There can be any number of overlay instances running in an IP 774 network at a time, and each operates in isolation of the others. 776 Peer: A host that is participating in the overlay. Peers are 777 responsible for holding some portion of the data that has been 778 stored in the overlay and also route messages on behalf of other 779 hosts as required by the Overlay Algorithm. 781 Client: A host that is able to store data in and retrieve data from 782 the overlay but which is not participating in routing or data 783 storage for the overlay. 785 Kind: A Kind defines a particular type of data that can be stored in 786 the overlay. Applications define new Kinds to store the data they 787 use. Each Kind is identified with a unique integer called a 788 Kind-ID. 790 Node: We use the term "Node" to refer to a host that may be either a 791 Peer or a Client. Because RELOAD uses the same protocol for both 792 clients and peers, much of the text applies equally to both. 793 Therefore we use "Node" when the text applies to both Clients and 794 Peers and the more specific term (i.e. client or peer) when the 795 text applies only to Clients or only to Peers. 797 Node-ID: A fixed-length value that uniquely identifies a node. 798 Node-IDs of all 0s and all 1s are reserved and are invalid Node- 799 IDs. A value of zero is not used in the wire protocol but can be 800 used to indicate an invalid node in implementations and APIs. The 801 Node-ID of all 1s is used on the wire protocol as a wildcard. 803 Joining Peer: A node that is attempting to become a Peer in a 804 particular Overlay. 806 Admitting Peer: A Peer in the Overlay which helps the Joining Peer 807 join the Overlay. 809 Bootstrap Node: A network node used by Joining Peers to help locate 810 the Admitting Peer. 812 Peer Admission: The act of admitting a peer (the "Joining Peer" ) 813 into an Overlay. After the admission process is over, the joining 814 peer is a fully-functional peer of the overlay. During the 815 admission process, the joining peer may need to present 816 credentials to prove that it has sufficient authority to join the 817 overlay. 819 Resource: An object or group of objects associated with a string 820 identifier. See "Resource Name" below. 822 Resource Name: The potentially human readable name by which a 823 resource is identified. In unstructured P2P networks, the 824 resource name is sometimes used directly as a Resource-ID. In 825 structured P2P networks the resource name is typically mapped into 826 a Resource-ID by using the string as the input to hash function. 827 Structured and unstructured P2P networks are described in 828 [RFC5694]. A SIP resource, for example, is often identified by 829 its AOR which is an example of a Resource Name. 831 Resource-ID: A value that identifies some resources and which is 832 used as a key for storing and retrieving the resource. Often this 833 is not human friendly/readable. One way to generate a Resource-ID 834 is by applying a mapping function to some other unique name (e.g., 835 user name or service name) for the resource. The Resource-ID is 836 used by the distributed database algorithm to determine the peer 837 or peers that are responsible for storing the data for the 838 overlay. In structured P2P networks, Resource-IDs are generally 839 fixed length and are formed by hashing the resource name. In 840 unstructured networks, resource names may be used directly as 841 Resource-IDs and may be variable lengths. 843 Connection Table: The set of nodes to which a node is directly 844 connected. This includes nodes with which Attach handshakes have 845 been done but which have not sent any Updates. 847 Routing Table: The set of peers which a node can use to route 848 overlay messages. In general, these peers will all be on the 849 connection table but not vice versa, because some peers will have 850 Attached but not sent updates. Peers may send messages directly 851 to peers that are in the connection table but may only route 852 messages to other peers through peers that are in the routing 853 table. 855 Destination List: A list of IDs through which a message is to be 856 routed, in strict order. A single Node-ID or a Resource-ID is a 857 trivial form of destination list. When multiple Node-IDs are 858 specified (no more than one Resource-ID is permitted, and it MUST 859 be the last entry) a Destination List is a loose source route. 861 Usage: A usage is an application that wishes to use the overlay for 862 some purpose. Each application wishing to use the overlay defines 863 a set of data Kinds that it wishes to use. The SIP usage defines 864 the location data Kind. 866 Transaction ID: A randomly chosen identifier selected by the 867 originator of a request and used to correlate requests and 868 responses. 870 The term "maximum request lifetime" is the maximum time a request 871 will wait for a response; it defaults to 15 seconds. The term 872 "successor replacement hold-down time" is the amount of time to wait 873 before starting replication when a new successor is found; it 874 defaults to 30 seconds. 876 3. Overlay Management Overview 878 The most basic function of RELOAD is as a generic overlay network. 879 Nodes need to be able to join the overlay, form connections to other 880 nodes, and route messages through the overlay to nodes to which they 881 are not directly connected. This section provides an overview of the 882 mechanisms that perform these functions. 884 3.1. Security and Identification 886 The overlay parameters are specified in a configuration document. 887 Because the parameters include security critical information such as 888 the certificate signing trust anchors, the configuration document 889 must be retrieved securely. The initial configuration document is 890 either initially fetched over HTTPS or manually provisioned; 891 subsequent configuration document updates are received either by 892 periodically refreshing from the configuration server, or, more 893 commonly, by being flood filled through the overlay, which allows for 894 fast propagation once an update is pushed. In the latter case, 895 updates are via digital signatures tracing back to the initial 896 configuration document. 898 Every node in the RELOAD overlay is identified by a Node-ID. The 899 Node-ID is used for three major purposes: 901 o To address the node itself. 902 o To determine its position in the overlay topology when the overlay 903 is structured. 904 o To determine the set of resources for which the node is 905 responsible. 907 Each node has a certificate [RFC5280] containing a Node-ID, which is 908 unique within an overlay instance. 910 The certificate serves multiple purposes: 912 o It entitles the user to store data at specific locations in the 913 Overlay Instance. Each data Kind defines the specific rules for 914 determining which certificates can access each Resource-ID/Kind-ID 915 pair. For instance, some Kinds might allow anyone to write at a 916 given location, whereas others might restrict writes to the owner 917 of a single certificate. 918 o It entitles the user to operate a node that has a Node-ID found in 919 the certificate. When the node forms a connection to another 920 peer, it uses this certificate so that a node connecting to it 921 knows it is connected to the correct node (technically: a (D)TLS 922 association with client authentication is formed.) In addition, 923 the node can sign messages, thus providing integrity and 924 authentication for messages which are sent from the node. 925 o It entitles the user to use the user name found in the 926 certificate. 928 If a user has more than one device, typically they would get one 929 certificate for each device. This allows each device to act as a 930 separate peer. 932 RELOAD supports multiple certificate issuance models. The first is 933 based on a central enrollment process which allocates a unique name 934 and Node-ID and puts them in a certificate for the user. All peers 935 in a particular Overlay Instance have the enrollment server as a 936 trust anchor and so can verify any other peer's certificate. 938 In some settings, a group of users want to set up an overlay network 939 but are not concerned about attack by other users in the network. 940 For instance, users on a LAN might want to set up a short term ad hoc 941 network without going to the trouble of setting up an enrollment 942 server. RELOAD supports the use of self-generated, self-signed 943 certificates. When self-signed certificates are used, the node also 944 generates its own Node-ID and username. The Node-ID is computed as a 945 digest of the public key, to prevent Node-ID theft. Note that the 946 relevant cryptographic property for the digest is preimage 947 resistance. Collision-resistance is not required since an attacker 948 who can create two nodes with the same Node-ID but different public 949 key obtains no advantage. This model is still subject to a number of 950 known attacks (most notably Sybil attacks [Sybil]) and can only be 951 safely used in closed networks where users are mutually trusting. 952 Another drawback of this approach is that user's data is then tied to 953 their keys, so if a key is changed any data stored under their 954 Node-ID must then be re-stored. This is not an issue for centrally- 955 issued Node-IDs provided that the CA re-issues the same Node-ID when 956 a new certificate is generated. 958 The general principle here is that the security mechanisms (TLS and 959 message signatures) are always used, even if the certificates are 960 self-signed. This allows for a single set of code paths in the 961 systems with the only difference being whether certificate 962 verification is required to chain to a single root of trust. 964 3.1.1. Shared-Key Security 966 RELOAD also provides an admission control system based on shared 967 keys. In this model, the peers all share a single key which is used 968 to authenticate the peer-to-peer connections via TLS-PSK/TLS-SRP. 970 3.2. Clients 972 RELOAD defines a single protocol that is used both as the peer 973 protocol and as the client protocol for the overlay. This simplifies 974 implementation, particularly for devices that may act in either role, 975 and allows clients to inject messages directly into the overlay. 977 We use the term "peer" to identify a node in the overlay that routes 978 messages for nodes other than those to which it is directly 979 connected. Peers also have storage responsibilities. We use the 980 term "client" to refer to nodes that do not have routing or storage 981 responsibilities. When text applies to both peers and clients, we 982 will simply refer to such devices as "nodes." 984 RELOAD's client support allows nodes that are not participating in 985 the overlay as peers to utilize the same implementation and to 986 benefit from the same security mechanisms as the peers. Clients 987 possess and use certificates that authorize the user to store data at 988 certain locations in the overlay. The Node-ID in the certificate is 989 used to identify the particular client as a member of the overlay and 990 to authenticate its messages. 992 In RELOAD, unlike some other designs, clients are not a first-class 993 entity. From the perspective of a peer, a client is simply a node 994 which has not yet sent any Updates or Joins. It might never do so 995 (if it's a client) or it might eventually do so (if it's just a node 996 that's taking a long time to join). The routing and storage rules 997 for RELOAD provide for correct behavior by peers regardless of 998 whether other nodes attached to them are clients or peers. Of 999 course, a client implementation must know that it intends to be a 1000 client, but this localizes complexity only to that node. 1002 For more discussion of the motivation for RELOAD's client support, 1003 see Appendix B. 1005 3.2.1. Client Routing 1007 Clients may insert themselves in the overlay in two ways: 1009 o Establish a connection to the peer responsible for the client's 1010 Node-ID in the overlay. Then requests may be sent from/to the 1011 client using its Node-ID in the same manner as if it were a peer, 1012 because the responsible peer in the overlay will handle the final 1013 step of routing to the client. This may require a TURN relay in 1014 cases where NATs or firewalls prevent a client from forming a 1015 direct connections with its responsible peer. Note that clients 1016 that choose this option need to process Update messages from the 1017 peer. Those updates can indicate that the peer no longer is 1018 responsible for the Client's Node-ID. The client would then need 1019 to form a connection to the appropriate peer. Failure to do so 1020 will result in the client no longer receiving messages. 1021 o Establish a connection with an arbitrary peer in the overlay 1022 (perhaps based on network proximity or an inability to establish a 1023 direct connection with the responsible peer). In this case, the 1024 client will rely on RELOAD's Destination List feature to ensure 1025 reachability. The client can initiate requests, and any node in 1026 the overlay that knows the Destination List to its current 1027 location can reach it, but the client is not directly reachable 1028 using only its Node-ID. If the client is to receive incoming 1029 requests from other members of the overlay, the Destination List 1030 required to reach it must be learnable via other mechanisms, such 1031 as being stored in the overlay by a usage. A client connected 1032 this way using a certificate with only a single Node-ID MAY 1033 proceed to use the connection without performing an Attach. A 1034 client wishing to connect using this mechanism with a certificate 1035 with multiple Node-IDs can use a Ping to probe the Node-ID of the 1036 node to which it is connected before doing the Attach. 1038 3.2.2. Minimum Functionality Requirements for Clients 1040 A node may act as a client simply because it does not have the 1041 resources or even an implementation of the topology plugin required 1042 to act as a peer in the overlay. In order to exchange RELOAD 1043 messages with a peer, a client MUST meet a minimum level of 1044 functionality. Such a client MUST: 1046 o Implement RELOAD's connection-management operations that are used 1047 to establish the connection with the peer. 1048 o Implement RELOAD's data retrieval methods (with client 1049 functionality). 1050 o Be able to calculate Resource-IDs used by the overlay. 1052 o Possess security credentials required by the overlay it is 1053 implementing. 1055 A client speaks the same protocol as the peers, knows how to 1056 calculate Resource-IDs, and signs its requests in the same manner as 1057 peers. While a client does not necessarily require a full 1058 implementation of the overlay algorithm, calculating the Resource-ID 1059 requires an implementation of the appropriate algorithm for the 1060 overlay. 1062 3.3. Routing 1064 This section will discuss the capabilities of RELOAD's routing layer, 1065 the protocol features used to implement them, and a brief overview of 1066 how they are used. Appendix A discusses some alternative designs and 1067 the tradeoffs that would be necessary to support them. 1069 RELOAD's routing provides the following capabilities: 1071 Resource-based routing: RELOAD supports routing messages based 1072 soley on the name of the resource. Such messages are delivered to 1073 a node that is responsible for that resource. Both structured and 1074 unstructured overlays are supported, so the route may not be 1075 deterministic for all Topology Plugins. 1076 Node-based routing: RELOAD supports routing messages to a specific 1077 node in the overlay. 1078 Clients: RELOAD supports requests from and to clients that do not 1079 participate in overlay routing, located via either of the 1080 mechanisms described above. 1081 Bridging overlays: Similar to how a Destination List is used to 1082 reach a client attached via an arbitrary peer, RELOAD can route 1083 messages between two different overlays by building a destination 1084 list that includes a peer (or client) with connectivity to both 1085 networks. 1086 NAT Traversal: RELOAD supports establishing and using connections 1087 between nodes separated by one or more NATs, including locating 1088 peers behind NATs for those overlays allowing/requiring it. 1089 Low state: RELOAD's routing algorithms do not require significant 1090 state (i.e., state linear or greater in the number of outstanding 1091 messages that have passed through it) to be stored on intermediate 1092 peers. 1093 Routability in unstable topologies: Overlay topology changes 1094 constantly in an overlay of moderate size due to the failure of 1095 individual nodes and links in the system. RELOAD's routing allows 1096 peers to re-route messages when a failure is detected, and replies 1097 can be returned to the requesting node as long as the peers that 1098 originally forwarded the successful request do not fail before the 1099 response is returned. 1101 RELOAD's routing utilizes three basic mechanisms: 1103 Destination Lists: While in principle it is possible to just 1104 inject a message into the overlay with a single Node-ID as the 1105 destination, RELOAD provides a source routing capability in the 1106 form of "Destination Lists". A Destination List provides a list 1107 of the nodes through which a message must flow in order (i.e., it 1108 is loose source routed). The minimal destination list contains 1109 just a single value. 1110 Via Lists: In order to allow responses to follow the same path as 1111 requests, each message also contains a "Via List", which is 1112 appended to by each node a message traverses. This via list can 1113 then be inverted and used as a destination list for the response. 1114 RouteQuery: The RouteQuery method allows a node to query a peer 1115 for the next hop it will use to route a message. This method is 1116 useful for diagnostics and for iterative routing. 1118 The basic routing mechanism used by RELOAD is Symmetric Recursive. 1119 We will first describe symmetric recursive routing and then discuss 1120 its advantages in terms of the requirements discussed above. 1122 Symmetric recursive routing requires that a request message follow a 1123 path through the overlay to the destination: each peer forwards the 1124 message closer to its destination. The return path of the response 1125 is then the same path followed in reverse. For example, a message 1126 following a route from A to Z through B and X: 1128 A B X Z 1129 ------------------------------- 1131 ----------> 1132 Dest=Z 1133 ----------> 1134 Via=A 1135 Dest=Z 1136 ----------> 1137 Via=A,B 1138 Dest=Z 1140 <---------- 1141 Dest=X,B,A 1142 <---------- 1143 Dest=B,A 1144 <---------- 1145 Dest=A 1147 Note that the preceding Figure does not indicate whether A is a 1148 client or peer: A forwards its request to B and the response is 1149 returned to A in the same manner regardless of A's role in the 1150 overlay. 1152 This figure shows use of full via-lists by intermediate peers B and 1153 X. However, if B and/or X are willing to store state, then they may 1154 elect to truncate the lists, save that information internally (keyed 1155 by the transaction id), and return the response message along the 1156 path from which it was received when the response is received. This 1157 option requires greater state to be stored on intermediate peers but 1158 saves a small amount of bandwidth and reduces the need for modifying 1159 the message en route. Selection of this mode of operation is a 1160 choice for the individual peer; the techniques are interoperable even 1161 on a single message. The figure below shows B using full via lists 1162 but X truncating them to X1 and saving the state internally. 1164 A B X Z 1165 ------------------------------- 1167 ----------> 1168 Dest=Z 1169 ----------> 1170 Via=A 1171 Dest=Z 1172 ----------> 1173 Via=X1 1174 Dest=Z 1176 <---------- 1177 Dest=X,X1 1178 <---------- 1179 Dest=B,A 1180 <---------- 1181 Dest=A 1183 As before, when B receives the message, he creates via list 1184 consisting of [A]. However, instead of sending [A,B], X creates an 1185 opaque ID X1 which maps internally to [A, B] (perhaps by being an 1186 encryption of [A, B] and forwards to Z with only X1 as the via list. 1187 When the response arrives at X, it maps X1 back to [A, B] and then 1188 inverts it to produce the new destination list [B, A] and routes it 1189 to B. 1191 RELOAD also supports a basic Iterative routing mode (where the 1192 intermediate peers merely return a response indicating the next hop, 1193 but do not actually forward the message to that next hop themselves). 1194 Iterative routing is implemented using the RouteQuery method, which 1195 requests this behavior. Note that iterative routing is selected only 1196 by the initiating node. 1198 3.4. Connectivity Management 1200 In order to provide efficient routing, a peer needs to maintain a set 1201 of direct connections to other peers in the Overlay Instance. Due to 1202 the presence of NATs, these connections often cannot be formed 1203 directly. Instead, we use the Attach request to establish a 1204 connection. Attach uses ICE [RFC5245] to establish the connection. 1205 It is assumed that the reader is familiar with ICE. 1207 Say that peer A wishes to form a direct connection to peer B. It 1208 gathers ICE candidates and packages them up in an Attach request 1209 which it sends to B through usual overlay routing procedures. B does 1210 its own candidate gathering and sends back a response with its 1211 candidates. A and B then do ICE connectivity checks on the candidate 1212 pairs. The result is a connection between A and B. At this point, A 1213 and B can add each other to their routing tables and send messages 1214 directly between themselves without going through other overlay 1215 peers. 1217 There are two cases where Attach is not used. The first is when a 1218 peer is joining the overlay and is not connected to any peers. In 1219 order to support this case, some small number of "bootstrap nodes" 1220 typically need to be publicly accessible so that new peers can 1221 directly connect to them. Section 11 contains more detail on this. 1222 The second case is when a client node connects to a node at an 1223 arbitrary IP address, rather than to its responsible peer, as 1224 described in the second bullet point of Section 3.2.1. 1226 In general, a peer needs to maintain connections to all of the peers 1227 near it in the Overlay Instance and to enough other peers to have 1228 efficient routing (the details depend on the specific overlay). If a 1229 peer cannot form a connection to some other peer, this isn't 1230 necessarily a disaster; overlays can route correctly even without 1231 fully connected links. However, a peer should try to maintain the 1232 specified link set and if it detects that it has fewer direct 1233 connections, should form more as required. This also implies that 1234 peers need to periodically verify that the connected peers are still 1235 alive and if not try to reform the connection or form an alternate 1236 one. 1238 3.5. Overlay Algorithm Support 1240 The Topology Plugin allows RELOAD to support a variety of overlay 1241 algorithms. This specification defines a DHT based on Chord, which 1242 is mandatory to implement, but the base RELOAD protocol is designed 1243 to support a variety of overlay algorithms. The information needed 1244 to implement this DHT is fully contained in this specification but it 1245 is easier to understand if you are familiar with Chord [Chord] based 1246 DHTs. A nice tutorial can be found at [wikiChord]. 1248 3.5.1. Support for Pluggable Overlay Algorithms 1250 RELOAD defines three methods for overlay maintenance: Join, Update, 1251 and Leave. However, the contents of those messages, when they are 1252 sent, and their precise semantics are specified by the actual overlay 1253 algorithm, which is specified by configuration for all nodes in the 1254 overlay, and thus known to nodes prior to their attempting to join 1255 the overlay. RELOAD merely provides a framework of commonly-needed 1256 methods that provides uniformity of notation (and ease of debugging) 1257 for a variety of overlay algorithms. 1259 3.5.2. Joining, Leaving, and Maintenance Overview 1261 When a new peer wishes to join the Overlay Instance, it MUST have a 1262 Node-ID that it is allowed to use and a set of credentials which 1263 match that Node-ID. When an enrollment server is used that Node-ID 1264 will be in the certificate the node received from the enrollment 1265 server. The details of the joining procedure are defined by the 1266 overlay algorithm, but the general steps for joining an Overlay 1267 Instance are: 1269 o Forming connections to some other peers. 1270 o Acquiring the data values this peer is responsible for storing. 1271 o Informing the other peers which were previously responsible for 1272 that data that this peer has taken over responsibility. 1274 The first thing the peer needs to do is to form a connection to some 1275 "bootstrap node". Because this is the first connection the peer 1276 makes, these nodes MUST have public IP addresses so that they can be 1277 connected to directly. Once a peer has connected to one or more 1278 bootstrap nodes, it can form connections in the usual way by routing 1279 Attach messages through the overlay to other nodes. Once a peer has 1280 connected to the overlay for the first time, it can cache the set of 1281 past adjacencies which have public IP address and attempt to use them 1282 as future bootstrap nodes. Note that this requires some notion of 1283 which addresses are likely to be public as discussed in Section 9. 1285 Once a peer has connected to a bootstrap node, it then needs to take 1286 up its appropriate place in the overlay. This requires two major 1287 operations: 1289 o Forming connections to other peers in the overlay to populate its 1290 Routing Table. 1292 o Getting a copy of the data it is now responsible for storing and 1293 assuming responsibility for that data. 1295 The second operation is performed by contacting the Admitting Peer 1296 (AP), the node which is currently responsible for that section of the 1297 overlay. 1299 The details of this operation depend mostly on the overlay algorithm 1300 involved, but a typical case would be: 1302 1. JP (Joining Peer) sends a Join request to AP (Admitting Peer) 1303 announcing its intention to join. 1304 2. AP sends a Join response. 1305 3. AP does a sequence of Stores to JP to give it the data it will 1306 need. 1307 4. AP does Updates to JP and to other peers to tell it about its own 1308 routing table. At this point, both JP and AP consider JP 1309 responsible for some section of the Overlay Instance. 1310 5. JP makes its own connections to the appropriate peers in the 1311 Overlay Instance. 1313 After this process is completed, JP is a full member of the Overlay 1314 Instance and can process Store/Fetch requests. 1316 Note that the first node is a special case. When ordinary nodes 1317 cannot form connections to the bootstrap nodes, then they are not 1318 part of the overlay. However, the first node in the overlay can 1319 obviously not connect to other nodes. In order to support this case, 1320 potential first nodes (which must also serve as bootstrap nodes 1321 initially) must somehow be instructed (perhaps by configuration 1322 settings) that they are the entire overlay, rather than not part of 1323 it. 1325 Note that clients do not perform either of these operations. 1327 3.6. First-Time Setup 1329 Previous sections addressed how RELOAD works once a node has 1330 connected. This section provides an overview of how users get 1331 connected to the overlay for the first time. RELOAD is designed so 1332 that users can start with the name of the overlay they wish to join 1333 and perhaps a username and password, and leverage that into having a 1334 working peer with minimal user intervention. This helps avoid the 1335 problems that have been experienced with conventional SIP clients 1336 where users are required to manually configure a large number of 1337 settings. 1339 3.6.1. Initial Configuration 1341 In the first phase of the process, the user starts out with the name 1342 of the overlay and uses this to download an initial set of overlay 1343 configuration parameters. The node does a DNS SRV lookup on the 1344 overlay name to get the address of a configuration server. It can 1345 then connect to this server with HTTPS [RFC2818] to download a 1346 configuration document which contains the basic overlay configuration 1347 parameters as well as a set of bootstrap nodes which can be used to 1348 join the overlay. The expected domain name for HTTPS is the name of 1349 the overlay. 1351 If a node already has the valid configuration document that it 1352 received by some out of band method, this step can be skipped. Note 1353 that that out of band method MUST provide authentication and 1354 integrity, because the configuration document contains the trust 1355 anchors for the system. 1357 3.6.2. Enrollment 1359 If the overlay is using centralized enrollment, then a user needs to 1360 acquire a certificate before joining the overlay. The certificate 1361 attests both to the user's name within the overlay and to the Node- 1362 IDs which they are permitted to operate. In that case, the 1363 configuration document will contain the address of an enrollment 1364 server which can be used to obtain such a certificate. The 1365 enrollment server may (and probably will) require some sort of 1366 username and password before issuing the certificate. The enrollment 1367 server's ability to restrict attackers' access to certificates in the 1368 overlay is one of the cornerstones of RELOAD's security. 1370 3.6.3. Diagnostics 1372 Significant advice around managing a RELAOD overlay and extensions 1373 for diagnostics are described in [I-D.ietf-p2psip-diagnostics]. 1375 4. RFC 2119 Terminology 1377 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", 1378 "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this 1379 document are to be interpreted as described in RFC 2119 [RFC2119]. 1381 5. Application Support Overview 1383 RELOAD is not intended to be used alone, but rather as a substrate 1384 for other applications. These applications can use RELOAD for a 1385 variety of purposes: 1387 o To store data in the overlay and retrieve data stored by other 1388 nodes. 1389 o As a discovery mechanism for services such as TURN. 1390 o To form direct connections which can be used to transmit 1391 application-level messages without using the overlay. 1393 This section provides an overview of these services. 1395 5.1. Data Storage 1397 RELOAD provides operations to Store and Fetch data. Each location in 1398 the Overlay Instance is referenced by a Resource-ID. However, each 1399 location may contain data elements corresponding to multiple Kinds 1400 (e.g., certificate, SIP registration). Similarly, there may be 1401 multiple elements of a given Kind, as shown below: 1403 +--------------------------------+ 1404 | Resource-ID | 1405 | | 1406 | +------------+ +------------+ | 1407 | | Kind 1 | | Kind 2 | | 1408 | | | | | | 1409 | | +--------+ | | +--------+ | | 1410 | | | Value | | | | Value | | | 1411 | | +--------+ | | +--------+ | | 1412 | | | | | | 1413 | | +--------+ | | +--------+ | | 1414 | | | Value | | | | Value | | | 1415 | | +--------+ | | +--------+ | | 1416 | | | +------------+ | 1417 | | +--------+ | | 1418 | | | Value | | | 1419 | | +--------+ | | 1420 | +------------+ | 1421 +--------------------------------+ 1423 Each Kind is identified by a Kind-ID, which is a code point either 1424 assigned by IANA or allocated out of a private range. As part of the 1425 Kind definition, protocol designers may define constraints, such as 1426 limits on size, on the values which may be stored. For many Kinds, 1427 the set may be restricted to a single value; some sets may be allowed 1428 to contain multiple identical items while others may only have unique 1429 items. Note that a Kind may be employed by multiple usages and new 1430 usages are encouraged to use previously defined Kinds where possible. 1431 We define the following data models in this document, though other 1432 usages can define their own structures: 1434 single value: There can be at most one item in the set and any value 1435 overwrites the previous item. 1437 array: Many values can be stored and addressed by a numeric index. 1439 dictionary: The values stored are indexed by a key. Often this key 1440 is one of the values from the certificate of the peer sending the 1441 Store request. 1443 In order to protect stored data from tampering, by other nodes, each 1444 stored value is individually digitally signed by the node which 1445 created it. When a value is retrieved, the digital signature can be 1446 verified to detect tampering. 1448 5.1.1. Storage Permissions 1450 A major issue in peer-to-peer storage networks is minimizing the 1451 burden of becoming a peer, and in particular minimizing the amount of 1452 data which any peer is required to store for other nodes. RELOAD 1453 addresses this issue by only allowing any given node to store data at 1454 a small number of locations in the overlay, with those locations 1455 being determined by the node's certificate. When a peer uses a Store 1456 request to place data at a location authorized by its certificate, it 1457 signs that data with the private key that corresponds to its 1458 certificate. Then the peer responsible for storing the data is able 1459 to verify that the peer issuing the request is authorized to make 1460 that request. Each data Kind defines the exact rules for determining 1461 what certificate is appropriate. 1463 The most natural rule is that a certificate authorizes a user to 1464 store data keyed with their user name X. This rule is used for all 1465 the Kinds defined in this specification. Thus, only a user with a 1466 certificate for "alice@example.org" could write to that location in 1467 the overlay. However, other usages can define any rules they choose, 1468 including publicly writable values. 1470 The digital signature over the data serves two purposes. First, it 1471 allows the peer responsible for storing the data to verify that this 1472 Store is authorized. Second, it provides integrity for the data. 1473 The signature is saved along with the data value (or values) so that 1474 any reader can verify the integrity of the data. Of course, the 1475 responsible peer can "lose" the value but it cannot undetectably 1476 modify it. 1478 The size requirements of the data being stored in the overlay are 1479 variable. For instance, a SIP AOR and voicemail differ widely in the 1480 storage size. RELOAD leaves it to the Usage and overlay 1481 configuration to limit size imbalance of various Kinds. 1483 5.1.2. Replication 1485 Replication in P2P overlays can be used to provide: 1487 persistence: if the responsible peer crashes and/or if the storing 1488 peer leaves the overlay 1489 security: to guard against DoS attacks by the responsible peer or 1490 routing attacks to that responsible peer 1491 load balancing: to balance the load of queries for popular 1492 resources. 1494 A variety of schemes are used in P2P overlays to achieve some of 1495 these goals. Common techniques include replicating on neighbors of 1496 the responsible peer, randomly locating replicas around the overlay, 1497 or replicating along the path to the responsible peer. 1499 The core RELOAD specification does not specify a particular 1500 replication strategy. Instead, the first level of replication 1501 strategies are determined by the overlay algorithm, which can base 1502 the replication strategy on its particular topology. For example, 1503 Chord places replicas on successor peers, which will take over 1504 responsibility should the responsible peer fail [Chord]. 1506 If additional replication is needed, for example if data persistence 1507 is particularly important for a particular usage, then that usage may 1508 specify additional replication, such as implementing random 1509 replications by inserting a different well known constant into the 1510 Resource Name used to store each replicated copy of the resource. 1511 Such replication strategies can be added independent of the 1512 underlying algorithm, and their usage can be determined based on the 1513 needs of the particular usage. 1515 5.2. Usages 1517 By itself, the distributed storage layer just provides infrastructure 1518 on which applications are built. In order to do anything useful, a 1519 usage must be defined. Each Usage needs to specify several things: 1521 o Registers Kind-ID code points for any Kinds that the Usage 1522 defines. 1523 o Defines the data structure for each of the Kinds. 1524 o Defines access control rules for each of the Kinds. 1525 o Defines how the Resource Name is formed that is hashed to form the 1526 Resource-ID where each Kind is stored. 1528 o Describes how values will be merged after a network partition. 1529 Unless otherwise specified, the default merging rule is to act as 1530 if all the values that need to be merged were stored and as if the 1531 order they were stored in corresponds to the stored time values 1532 associated with (and carried in) their values. Because the stored 1533 time values are those associated with the peer which did the 1534 writing, clock skew is generally not an issue. If two nodes are 1535 on different partitions, write to the same location, and have 1536 clock skew, this can create merge conflicts. However because 1537 RELOAD deliberately segregates storage so that data from different 1538 users and peers is stored in different locations, and a single 1539 peer will typically only be in a single network partition, this 1540 case will generally not arise. 1542 The Kinds defined by a usage may also be applied to other usages. 1543 However, a need for different parameters, such as different size 1544 limits, would imply the need to create a new Kind. 1546 5.3. Service Discovery 1548 RELOAD does not currently define a generic service discovery 1549 algorithm as part of the base protocol, although a simplistic TURN- 1550 specific discovery mechanism is provided. A variety of service 1551 discovery algorithms can be implemented as extensions to the base 1552 protocol, such as the service discovery algorithm ReDIR 1553 [opendht-sigcomm05] or [I-D.ietf-p2psip-service-discovery]. 1555 5.4. Application Connectivity 1557 There is no requirement that a RELOAD usage must use RELOAD's 1558 primitives for establishing its own communication if it already 1559 possesses its own means of establishing connections. For example, 1560 one could design a RELOAD-based resource discovery protocol which 1561 used HTTP to retrieve the actual data. 1563 For more common situations, however, it is the overlay itself - 1564 rather than an external authority such as DNS - which is used to 1565 establish a connection. RELOAD provides connectivity to applications 1566 using the AppAttach method. For example, if a P2PSIP node wishes to 1567 establish a SIP dialog with another P2PSIP node, it will use 1568 AppAttach to establish a direct connection with the other node. This 1569 new connection is separate from the peer protocol connection. It is 1570 a dedicated UDP or TCP flow used only for the SIP dialog. 1572 6. Overlay Management Protocol 1574 This section defines the basic protocols used to create, maintain, 1575 and use the RELOAD overlay network. We start by defining the basic 1576 concept of how message destinations are interpreted when routing 1577 messages. We then describe the symmetric recursive routing model, 1578 which is RELOAD's default routing algorithm. We then define the 1579 message structure and then finally define the messages used to join 1580 and maintain the overlay. 1582 6.1. Message Receipt and Forwarding 1584 When a node receives a message, it first examines the overlay, 1585 version, and other header fields to determine whether the message is 1586 one it can process. If any of these are incorrect (e.g., the message 1587 is for an overlay in which the peer does not participate) it is an 1588 error and the message MUST be discarded. The peer SHOULD generate an 1589 appropriate error but local policy can override this and cause the 1590 messages to be silently dropped. 1592 Once the peer has determined that the message is correctly formatted 1593 (note that this does not include signature checking on intermediate 1594 nodes as the message may be fragmented) it examines the first entry 1595 on the destination list. There are three possible cases here: 1597 o The first entry on the destination list is an ID for which the 1598 peer is responsible. A peer is always responsible for the 1599 wildcard Node-ID. Handling of this case is described in 1600 Section 6.1.1. 1601 o The first entry on the destination list is an ID for which another 1602 peer is responsible. Handling of this case is described in 1603 Section 6.1.2. 1604 o The first entry on the destination list is an opaque ID that is 1605 being used for destination list compression. Handling of this 1606 case is described in Section 6.1.3. Note that opaque IDs can be 1607 distinguished from Node-IDs and Resource-IDs on the wire as 1608 described in Section 6.3.2.2). 1610 These cases are handled as discussed below. 1612 6.1.1. Responsible ID 1614 If the first entry on the destination list is an ID for which the 1615 peer is responsible, there are several (mutually exclusive) sub-cases 1616 to consider. 1618 o If the entry is a Resource-ID, then it MUST be the only entry on 1619 the destination list. If there are other entries, the message 1620 MUST be silently dropped. Otherwise, the message is destined for 1621 this node and it verify the signature and pass it up to the upper 1622 layers. 1624 o If the entry is a Node-ID which equals this node's Node-ID, then 1625 the message is destined for this node. If this is the only entry 1626 on the destination list, the message is destined for this node and 1627 so the node passes it up to the upper layers. Otherwise the node 1628 removes the entry from the destination list and repeats the 1629 routing process with the next entry on the destination list. If 1630 the message is a response and list compression was used, then the 1631 node first modifies the destination list to reinsert the saved 1632 state, e.g., by unpacking any opaque ids. 1633 o If the entry is the wildcard Node-ID, the message is destined for 1634 this node and it passes it up to the upper layers. 1635 o If the entry is a Node-ID which is not equal to this node, then 1636 the node MUST drop the message silently unless the Node-ID 1637 corresponds to a node which is directly connected to this node 1638 (i.e., a client). In the later case, it MUST forward the message 1639 to the destination node as described in the next section. 1641 Note that this implies that in order to address a message to "the 1642 peer that controls region X", a sender sends to Resource-ID X, not 1643 Node-ID X. 1645 6.1.2. Other ID 1647 If neither of the other three cases applies, then the peer MUST 1648 forward the message towards the first entry on the destination list. 1649 This means that it MUST select one of the peers to which it is 1650 connected and which is likely to be responsible for the first entry 1651 on the destination list. If the first entry on the destination list 1652 is in the peer's connection table, then it SHOULD forward the message 1653 to that peer directly. Otherwise, the peer consults the routing 1654 table to forward the message. 1656 Any intermediate peer which forwards a RELOAD request MUST ensure 1657 that if it receives a response to that message the response can be 1658 routed back through the set of nodes through which the request 1659 passed. There are two major ways of accomplishing this: 1661 o The peer can add an entry to the via list in the forwarding header 1662 that will enable it to determine the correct node. 1663 o The peer can keep per-transaction state which will allow it to 1664 determine the correct node. 1666 As an example of the first strategy, consider an example with nodes 1667 A, B, C, D and E. If node D receives a message from node C with via 1668 list (A, B), then D would forward to the next node (E) with via list 1669 (A, B, C). Now, if E wants to respond to the message, it reverses 1670 the via list to produce the destination list, resulting in (D, C, B, 1671 A). When D forwards the response to C, the destination list will 1672 contain (C, B, A). 1674 As an example of the second strategy, if node D receives a message 1675 from node C with transaction ID X and via list (A, B), it could store 1676 (X, C) in its state database and forward the message with the via 1677 list unchanged. When D receives the response, it consults its state 1678 database for transaction id X, determines that the request came from 1679 C, and forwards the response to C. 1681 Intermediate peers which modify the via list are not required to 1682 simply add entries. The only requirement is that the peer MUST be 1683 able to reconstruct the correct destination list on the return route. 1684 RELOAD provides explicit support for this functionality in the form 1685 of opaque IDs, which can replace any number of via list entries. For 1686 instance, in the above example, Node D might send E a via list 1687 containing only the opaque ID (I). E would then use the destination 1688 list (D, I) to send its return message. When D processes this 1689 destination list, it would detect that I is a opaque ID, recover the 1690 via list (A, B, C), and reverse that to produce the correct 1691 destination list (C, B, A) before sending it to C. This feature is 1692 called List Compression. Possibilities for a opaque id include a 1693 compressed version of the original via list or an index into a state 1694 database containing the original via list, but the details are a 1695 local matter. 1697 No matter what mechanism for storing via list state is used, if an 1698 intermediate peer exits the overlay, then on the return trip the 1699 message cannot be forwarded and will be dropped. The ordinary 1700 timeout and retransmission mechanisms provide stability over this 1701 type of failure. 1703 Note that if an intermediate peer retains per-transaction state 1704 instead of modifying the via list, it needs some mechanism for timing 1705 out that state, otherwise its state database will grow without bound. 1706 Whatever algorithm is used, unless a FORWARD_CRITICAL forwarding 1707 option or overlay configuration option explicitly indicates this 1708 state is not needed, the state MUST be maintained for at least the 1709 value of the overlay-reliability-timer configuration parameter and 1710 MAY be kept longer. Future extension, such as 1711 [I-D.jiang-p2psip-relay], may define mechanisms for determining when 1712 this state does not need to be retained. 1714 None of the above mechanisms are required for responses, since there 1715 is no need to ensure that subsequent requests follow the same path. 1717 To be precise on the responsibility of the intermediate node, suppose 1718 that an intermediate node, A, receives a message from node B with via 1719 list X-Y-Z. Node A MUST implement an algorithm that ensures that A 1720 returns a response to this request to node B with the destination 1721 list B-Z-Y-X, provided that the node to which A forwards the request 1722 follows the same contract. Node A normally learns the Node-ID B is 1723 using via an Attach, but a node using a certificate with a single 1724 Node-ID MAY elect to not send an Attach (see Section 3.2.1 bullet 2). 1725 If a node with a certificate with multiple Node-IDs attempts to route 1726 a message other than a Ping or Attach through a node without 1727 performing an Attach, the receiving node MUST reject the request with 1728 an Error_Forbidden error. The node MUST implement support for 1729 returning responses to a Ping or Attach request made by a joining 1730 node Attaching to its responsible peer. 1732 6.1.3. Opaque ID 1734 If the first entry in the destination list is an opaque id (e.g., a 1735 compressed via list), the peer MUST replace that entry with the 1736 original via list that it replaced and then re-examine the 1737 destination list to determine which of the three cases in Section 6.1 1738 now applies. 1740 6.2. Symmetric Recursive Routing 1742 This Section defines RELOAD's symmetric recursive routing algorithm, 1743 which is the default algorithm used by nodes to route messages 1744 through the overlay. All implementations MUST implement this routing 1745 algorithm. An overlay MAY be configured to use alternative routing 1746 algorithms, and alternative routing algorithms MAY be selected on a 1747 per-message basis. I.e., a node in an overlay which supports SRR and 1748 routing algorithm XXX might use SRR some of the time and XXX some of 1749 the time. 1751 6.2.1. Request Origination 1753 In order to originate a message to a given Node-ID or Resource-ID, a 1754 node constructs an appropriate destination list. The simplest such 1755 destination list is a single entry containing the Node-ID or 1756 Resource-ID. The resulting message uses the normal overlay routing 1757 mechanisms to forward the message to that destination. The node can 1758 also construct a more complicated destination list for source 1759 routing. 1761 Once the message is constructed, the node sends the message to some 1762 adjacent peer. If the first entry on the destination list is 1763 directly connected, then the message MUST be routed down that 1764 connection. Otherwise, the topology plugin MUST be consulted to 1765 determine the appropriate next hop. 1767 Parallel requests for a resource are a common solution to improve 1768 reliability in the face of churn or of subversive peers. Parallel 1769 searches for usage-specified replicas are managed by the usage layer, 1770 for instance by having the usage store data at multiple Resource-IDs 1771 with the requesting node sending requests to each of those Resource- 1772 IDs. However, a single request MAY also be routed through multiple 1773 adjacent peers, even when known to be sub-optimal, to improve 1774 reliability [vulnerabilities-acsac04]. Such parallel searches MAY be 1775 specified by the topology plugin, in which case it would return 1776 multiple next hops and the request would be routed to all of them. 1778 Because messages may be lost in transit through the overlay, RELOAD 1779 incorporates an end-to-end reliability mechanism. When an 1780 originating node transmits a request it MUST set a timer to the 1781 current overlay-reliability-timer. If a response has not been 1782 received when the timer fires, the request is retransmitted with the 1783 same transaction identifier. The request MAY be retransmitted up to 1784 4 times (for a total of 5 messages). After the timer for the fifth 1785 transmission fires, the message SHALL be considered to have failed. 1786 Note that this retransmission procedure is not followed by 1787 intermediate nodes. They follow the hop-by-hop reliability procedure 1788 described in Section 6.6.3. 1790 The above algorithm can result in multiple requests being delivered 1791 to a node. Receiving nodes MUST generate semantically equivalent 1792 responses to retransmissions of the same request (this can be 1793 determined by transaction id) if the request is received within the 1794 maximum request lifetime (15 seconds). For some requests (e.g., 1795 Fetch) this can be accomplished merely by processing the request 1796 again. For other requests, (e.g., Store) it may be necessary to 1797 maintain state for the duration of the request lifetime. 1799 6.2.2. Response Origination 1801 When a peer sends a response to a request using this routing 1802 algorithm, it MUST construct the destination list by reversing the 1803 order of the entries on the via list. This has the result that the 1804 response traverses the same peers as the request traversed, except in 1805 reverse order (symmetric routing). 1807 6.3. Message Structure 1809 RELOAD is a message-oriented request/response protocol. The messages 1810 are encoded using binary fields. All integers are represented in 1811 network byte order. The general philosophy behind the design was to 1812 use Type, Length, Value fields to allow for extensibility. However, 1813 for the parts of a structure that were required in all messages, we 1814 just define these in a fixed position, as adding a type and length 1815 for them is unnecessary and would simply increase bandwidth and 1816 introduces new potential for interoperability issues. 1818 Each message has three parts, concatenated as shown below: 1820 +-------------------------+ 1821 | Forwarding Header | 1822 +-------------------------+ 1823 | Message Contents | 1824 +-------------------------+ 1825 | Security Block | 1826 +-------------------------+ 1828 The contents of these parts are as follows: 1830 Forwarding Header: Each message has a generic header which is used 1831 to forward the message between peers and to its final destination. 1832 This header is the only information that an intermediate peer 1833 (i.e., one that is not the target of a message) needs to examine. 1835 Message Contents: The message being delivered between the peers. 1836 From the perspective of the forwarding layer, the contents are 1837 opaque, however, they are interpreted by the higher layers. 1839 Security Block: A security block containing certificates and a 1840 digital signature over the "Message Contents" section. Note that 1841 this signature can be computed without parsing the message 1842 contents. All messages MUST be signed by their originator. 1844 The following sections describe the format of each part of the 1845 message. 1847 6.3.1. Presentation Language 1849 The structures defined in this document are defined using a C-like 1850 syntax based on the presentation language used to define 1851 TLS[RFC5246]. Advantages of this style include: 1853 o It familiar enough looking that most readers can grasp it quickly. 1854 o The ability to define nested structures allows a separation 1855 between high-level and low-level message structures. 1856 o It has a straightforward wire encoding that allows quick 1857 implementation, but the structures can be comprehended without 1858 knowing the encoding. 1859 o The ability to mechanically compile encoders and decoders. 1861 Several idiosyncrasies of this language are worth noting. 1863 o All lengths are denoted in bytes, not objects. 1864 o Variable length values are denoted like arrays with angle 1865 brackets. 1866 o "select" is used to indicate variant structures. 1868 For instance, "uint16 array<0..2^8-2>;" represents up to 254 bytes 1869 which corresponds to up to 127 values of two bytes (16 bits) each. 1871 6.3.1.1. Common Definitions 1873 The following definitions are used throughout RELOAD and so are 1874 defined here. They also provide a convenient introduction to how to 1875 read the presentation language. 1877 An enum represents an enumerated type. The values associated with 1878 each possibility are represented in parentheses and the maximum value 1879 is represented as a nameless value, for purposes of describing the 1880 width of the containing integral type. For instance, Boolean 1881 represents a true or false: 1883 enum { false (0), true(1), (255)} Boolean; 1885 A boolean value is either a 1 or a 0. The max value of 255 indicates 1886 this is represented as a single byte on the wire. 1888 The NodeId, shown below, represents a single Node-ID. 1890 typedef opaque NodeId[NodeIdLength]; 1892 A NodeId is a fixed-length structure represented as a series of 1893 bytes, with the most significant byte first. The length is set on a 1894 per-overlay basis within the range of 16-20 bytes (128 to 160 bits). 1895 (See Section 11.1 for how NodeIdLength is set.) Note: the use of 1896 "typedef" here is an extension to the TLS language, but its meaning 1897 should be relatively obvious. Note the [ size ] syntax defines a 1898 fixed length element that does not include the length of the element 1899 in the on the wire encoding. 1901 A ResourceId, shown below, represents a single Resource-ID. 1903 typedef opaque ResourceId<0..2^8-1>; 1905 Like a NodeId, a ResourceId is an opaque string of bytes, but unlike 1906 NodeIds, ResourceIds are variable length, up to 254 bytes (2040 bits) 1907 in length. On the wire, each ResourceId is preceded by a single 1908 length byte (allowing lengths up to 255). Thus, the 3-byte value 1909 "FOO" would be encoded as: 03 46 4f 4f. Note the < range > syntax 1910 defines a variable length element that does include the length of the 1911 element in the on the wire encoding. The number of bytes to encode 1912 the length on the wire is derived by range; i.e., it is the minimum 1913 number of bytes which can encode the largest range value. 1915 A more complicated example is IpAddressPort, which represents a 1916 network address and can be used to carry either an IPv6 or IPv4 1917 address: 1919 enum {reservedAddr(0), ipv4_address (1), ipv6_address (2), 1920 (255)} AddressType; 1922 struct { 1923 uint32 addr; 1924 uint16 port; 1925 } IPv4AddrPort; 1927 struct { 1928 uint128 addr; 1929 uint16 port; 1930 } IPv6AddrPort; 1932 struct { 1933 AddressType type; 1934 uint8 length; 1936 select (type) { 1937 case ipv4_address: 1938 IPv4AddrPort v4addr_port; 1940 case ipv6_address: 1941 IPv6AddrPort v6addr_port; 1943 /* This structure can be extended */ 1944 }; 1945 } IpAddressPort; 1947 The first two fields in the structure are the same no matter what 1948 kind of address is being represented: 1950 type: the type of address (v4 or v6). 1951 length: the length of the rest of the structure. 1953 By having the type and the length appear at the beginning of the 1954 structure regardless of the kind of address being represented, an 1955 implementation which does not understand new address type X can still 1956 parse the IpAddressPort field and then discard it if it is not 1957 needed. 1959 The rest of the IpAddressPort structure is either an IPv4AddrPort or 1960 an IPv6AddrPort. Both of these simply consist of an address 1961 represented as an integer and a 16-bit port. As an example, here is 1962 the wire representation of the IPv4 address "192.0.2.1" with port 1963 "6100". 1965 01 ; type = IPv4 1966 06 ; length = 6 1967 c0 00 02 01 ; address = 192.0.2.1 1968 17 d4 ; port = 6100 1970 Unless a given structure that uses a select explicitly allows for 1971 unknown types in the select, any unknown type SHOULD be treated as an 1972 parsing error and the whole message discarded with no response. 1974 6.3.2. Forwarding Header 1976 The forwarding header is defined as a ForwardingHeader structure, as 1977 shown below. 1979 struct { 1980 uint32 relo_token; 1981 uint32 overlay; 1982 uint16 configuration_sequence; 1983 uint8 version; 1984 uint8 ttl; 1985 uint32 fragment; 1986 uint32 length; 1987 uint64 transaction_id; 1988 uint32 max_response_length; 1989 uint16 via_list_length; 1990 uint16 destination_list_length; 1991 uint16 options_length; 1992 Destination via_list[via_list_length]; 1993 Destination destination_list 1994 [destination_list_length]; 1995 ForwardingOptions options[options_length]; 1996 } ForwardingHeader; 1998 The contents of the structure are: 2000 relo_token: The first four bytes identify this message as a RELOAD 2001 message. This field MUST contain the value 0xd2454c4f (the string 2002 'RELO' with the high bit of the first byte set). 2004 overlay: The 32 bit checksum/hash of the overlay being used. This 2005 MUST be formed by taking the lower 32 bits of the SHA-1 [RFC3174] 2006 hash of the overlay name. The purpose of this field is to allow 2007 nodes to participate in multiple overlays and to detect accidental 2008 misconfiguration. This is not a security critical function. The 2009 overlay name MUST consist of a sequence of charters what would be 2010 allowable as a DNS name. 2012 configuration_sequence: The sequence number of the configuration 2013 file. 2015 version: The version of the RELOAD protocol being used. This is a 2016 fixed point integer between 0.1 and 25.4. This document describes 2017 version 1.0, with a value of 0x0a. [Note: Pre-RFC versions used 2018 version number 0.1]. Nodes MUST reject messages with other 2019 versions. 2021 ttl: An 8 bit field indicating the number of iterations, or hops, a 2022 message can experience before it is discarded. The TTL value MUST 2023 be decremented by one at every hop along the route the message 2024 traverses just before transmission. If a received message has a 2025 TTL of 0, and the message is not destined for the receiving node, 2026 then the message MUST NOT be propagated further and and a 2027 "Error_TTL_Exceeded" error should be generated. The initial value 2028 of the TTL SHOULD be 100 and MUST NOT exceed 100 unless defined 2029 otherwise by the overlay configuration. Implementations which 2030 receive message with a TTL greater than the current value of 2031 initial-ttl (or the 100 default) MUST discard the message and send 2032 an "Error_TTL_Exceeded" error. 2034 fragment: This field is used to handle fragmentation. The high bit 2035 (0x80000000) MUST be set for historical reasons. If the next bit 2036 (0x40000000) is set to 1, it indicates that this is the last (or 2037 only) fragment. The next six bits (0x20000000 to 0x01000000) are 2038 reserved and SHOULD be set to zero. The remainder of the field is 2039 used to indicate the fragment offset; see Section 6.7 2041 length: The count in bytes of the size of the message, including the 2042 header. 2044 transaction_id: A unique 64 bit number that identifies this 2045 transaction and also allows receivers to disambiguate transactions 2046 which are otherwise identical. In order to provide a high 2047 probability that transaction IDs are unique, they MUST be randomly 2048 generated. Responses use the same Transaction ID as the request 2049 they correspond to. Transaction IDs are also used for fragment 2050 reassembly. 2052 max_response_length: The maximum size in bytes of a response. Used 2053 by requesting nodes to avoid receiving (unexpected) very large 2054 responses. If this value is non-zero, responding peers MUST check 2055 that any response would not exceed it and if so generate an 2056 "Error_Incompatible_with_Overlay" value. This value SHOULD be set 2057 to zero for responses. 2059 via_list_length: The length of the via list in bytes. Note that in 2060 this field and the following two length fields we depart from the 2061 usual variable-length convention of having the length immediately 2062 precede the value in order to make it easier for hardware decoding 2063 engines to quickly determine the length of the header. 2065 destination_list_length: The length of the destination list in 2066 bytes. 2068 options_length: The length of the header options in bytes. 2070 via_list: The via_list contains the sequence of destinations through 2071 which the message has passed. The via_list starts out empty and 2072 grows as the message traverses each peer. 2074 destination_list: The destination_list contains a sequence of 2075 destinations which the message should pass through. The 2076 destination list is constructed by the message originator. The 2077 first element in the destination list is where the message goes 2078 next. The list shrinks as the message traverses each listed peer. 2080 options: Contains a series of ForwardingOptions entries. See 2081 Section 6.3.2.3. 2083 6.3.2.1. Processing Configuration Sequence Numbers 2085 In order to be part of the overlay, a node MUST have a copy of the 2086 overlay configuration document. In order to allow for configuration 2087 document changes, each version of the configuration document has a 2088 sequence number which is monotonically increasing mod 65536. Because 2089 the sequence number may in principle wrap, greater than or less than 2090 are interpreted by modulo arithmetic as in TCP. 2092 When a destination node receives a request, it MUST check that the 2093 configuration_sequence field is equal to its own configuration 2094 sequence number. If they do not match, it MUST generate an error, 2095 either Error_Config_Too_Old or Error_Config_Too_New. In addition, if 2096 the configuration file in the request is too old, it MUST generate a 2097 ConfigUpdate message to update the requesting node. This allows new 2098 configuration documents to propagate quickly throughout the system. 2099 The one exception to this rule is that if the configuration_sequence 2100 field is equal to 0xffff, and the message type is ConfigUpdate, then 2101 the message MUST be accepted regardless of the receiving node's 2102 configuration sequence number. Since 65535 is a special value, peers 2103 sending a new configuration when the configuration sequence is 2104 currently 65534 MUST set the configuration sequence number to 0 when 2105 they send out a new configuration. 2107 6.3.2.2. Destination and Via Lists 2109 The destination list and via lists are sequences of Destination 2110 values: 2112 enum {reserved(0), node(1), resource(2), opaque_id_type(3), 2113 /* 128-255 not allowed */ (255) } 2114 DestinationType; 2116 select (destination_type) { 2117 case node: 2118 NodeId node_id; 2120 case resource: 2121 ResourceId resource_id; 2123 case opaque_id_type: 2124 opaque opaque_id<0..2^8-1>; 2126 /* This structure may be extended with new types */ 2127 } DestinationData; 2129 struct { 2130 DestinationType type; 2131 uint8 length; 2132 DestinationData destination_data; 2133 } Destination; 2135 struct { 2136 uint16 opaque_id; /* top bit MUST be 1 */ 2138 } Destination; 2140 If a destination structure has its first bit set to 1, then it is a 2141 16 bit integer. If the first bit is not set, then it is a structure 2142 starting with DestinationType. If it is a 16 bit integer, it is 2143 treated as if it were a full structure with a DestinationType of 2144 opaque_id_type and a opaque_id that was 2 bytes long with the value 2145 of the 16 bit integer. When the destination structure is not a 16 2146 bit integer, it is the TLV structure with the following contents: 2148 type 2149 The type of the DestinationData Payload Data Unit (PDU). This may 2150 be one of "node", "resource", or "opaque_id_type". 2152 length 2153 The length of the destination_data. 2155 destination_data 2156 The destination value itself, which is an encoded DestinationData 2157 structure, depending on the value of "type". 2159 Note: This structure encodes a type, length, value. The length 2160 field specifies the length of the DestinationData values, which 2161 allows the addition of new DestinationTypes. This allows an 2162 implementation which does not understand a given DestinationType 2163 to skip over it. 2165 A DestinationData can be one of three types: 2167 node 2168 A Node-ID. 2170 opaque 2171 A compressed list of Node-IDs and/or resources. Because this 2172 value was compressed by one of the peers, it is only meaningful to 2173 that peer and cannot be decoded by other peers. Thus, it is 2174 represented as an opaque string. 2176 resource 2177 The Resource-ID of the resource which is desired. This type MUST 2178 only appear in the final location of a destination list and MUST 2179 NOT appear in a via list. It is meaningless to try to route 2180 through a resource. 2182 One possible encoding of the 16 bit integer version as an opaque 2183 identifier is to encode an index into a connection table. To avoid 2184 misrouting responses in the event a response is delayed and the 2185 connection table entry has changed, the identifier SHOULD be split 2186 between an index and a generation counter for that index. At 2187 startup, the generation counters should be initialized to random 2188 values. An implementation could use 12 bits for the connection table 2189 index and 3 bits for the generation counter. (Note that this does 2190 not suggest a 4096 entry connection table for every node, only the 2191 ability to encode for a larger connection table.) When a connection 2192 table slot is used for a new connection, the generation counter is 2193 incremented (with wrapping). Connection table slots are used on a 2194 rotating basis to maximize the time interval between uses of the same 2195 slot for different connections. When routing a message to an entry 2196 in the destination list encoding a connection table entry, the node 2197 confirms that the generation counter matches the current generation 2198 counter of that index before forwarding the message. If it does not 2199 match, the message is silently dropped. 2201 6.3.2.3. Forwarding Options 2203 The Forwarding header can be extended with forwarding header options, 2204 which are a series of ForwardingOptions structures: 2206 enum { reservedForwarding(0), (255) } 2207 ForwardingOptionsType; 2209 struct { 2210 ForwardingOptionsType type; 2211 uint8 flags; 2212 uint16 length; 2213 select (type) { 2214 /* This type may be extended */ 2215 } option; 2216 } ForwardingOption; 2218 Each ForwardingOption consists of the following values: 2220 type 2221 The type of the option. This structure allows for unknown options 2222 types. 2224 length 2225 The length of the rest of the structure. 2227 flags 2228 Three flags are defined FORWARD_CRITICAL(0x01), 2229 DESTINATION_CRITICAL(0x02), and RESPONSE_COPY(0x04). These flags 2230 MUST NOT be set in a response. If the FORWARD_CRITICAL flag is 2231 set, any node that would forward the message but does not 2232 understand this options MUST reject the request with an 2233 Error_Unsupported_Forwarding_Option error response. If the 2234 DESTINATION_CRITICAL flag is set, any node that generates a 2235 response to the message but does not understand the forwarding 2236 option MUST reject the request with an 2237 Error_Unsupported_Forwarding_Option error response. If the 2238 RESPONSE_COPY flag is set, any node generating a response MUST 2239 copy the option from the request to the response except that the 2240 RESPONSE_COPY, FORWARD_CRITICAL and DESTINATION_CRITICAL flags 2241 MUST be cleared. 2243 option 2244 The option value. 2246 6.3.3. Message Contents Format 2248 The second major part of a RELOAD message is the contents part, which 2249 is defined by MessageContents: 2251 enum { reservedMessagesExtension(0), (2^16-1) } MessageExtensionType; 2253 struct { 2254 MessageExtensionType type; 2255 Boolean critical; 2256 opaque extension_contents<0..2^32-1>; 2257 } MessageExtension; 2259 struct { 2260 uint16 message_code; 2261 opaque message_body<0..2^32-1>; 2262 MessageExtensions extensions<0..2^32-1>; 2263 } MessageContents; 2265 The contents of this structure are as follows: 2267 message_code 2268 This indicates the message that is being sent. The code space is 2269 broken up as follows. 2271 0 Reserved 2273 1 .. 0x7fff Requests and responses. These code points are always 2274 paired, with requests being odd and the corresponding response 2275 being the request code plus 1. Thus, "probe_request" (the 2276 Probe request) has value 1 and "probe_answer" (the Probe 2277 response) has value 2 2279 0xffff Error 2280 The message codes are defined in Section 14.8 2281 message_body 2282 The message body itself, represented as a variable-length string 2283 of bytes. The bytes themselves are dependent on the code value. 2284 See the sections describing the various RELOAD methods (Join, 2285 Update, Attach, Store, Fetch, etc.) for the definitions of the 2286 payload contents. 2287 extensions 2288 Extensions to the message. Currently no extensions are defined, 2289 but new extensions can be defined by the process described in 2290 Section 14.14. 2292 All extensions have the following form: 2294 type 2295 The extension type. 2297 critical 2298 Whether this extension must be understood in order to process the 2299 message. If critical = True and the recipient does not understand 2300 the message, it MUST generate an Error_Unknown_Extension error. 2301 If critical = False, the recipient MAY choose to process the 2302 message even if it does not understand the extension. 2304 extension_contents 2305 The contents of the extension (extension-dependent). 2307 6.3.3.1. Response Codes and Response Errors 2309 A peer processing a request returns its status in the message_code 2310 field. If the request was a success, then the message code is the 2311 response code that matches the request (i.e., the next code up). The 2312 response payload is then as defined in the request/response 2313 descriptions. 2315 If the request has failed, then the message code is set to 0xffff 2316 (error) and the payload MUST be an error_response PDU, as shown 2317 below. 2319 When the message code is 0xffff, the payload MUST be an 2320 ErrorResponse. 2322 public struct { 2323 uint16 error_code; 2324 opaque error_info<0..2^16-1>; 2325 } ErrorResponse; 2327 The contents of this structure are as follows: 2329 error_code 2330 A numeric error code indicating the error that occurred. 2332 error_info 2333 An optional arbitrary byte string. Unless otherwise specified, 2334 this will be a UTF-8 text string providing further information 2335 about what went wrong. Developers are encouraged to put enough 2336 diagnostic information to be useful in error_info. 2338 The following error code values are defined. The numeric values for 2339 these are defined in Section 14.9. 2341 Error_Forbidden: The requesting node does not have permission to 2342 make this request. 2344 Error_Not_Found: The resource or peer cannot be found or does not 2345 exist. 2347 Error_Request_Timeout: A response to the request has not been 2348 received in a suitable amount of time. The requesting node MAY 2349 resend the request at a later time. 2351 Error_Data_Too_Old: A store cannot be completed because the 2352 storage_time precedes the existing value. 2354 Error_Data_Too_Large: A store cannot be completed because the 2355 requested object exceeds the size limits for that Kind. 2357 Error_Generation_Counter_Too_Low: A store cannot be completed 2358 because the generation counter precedes the existing value. 2360 Error_Incompatible_with_Overlay: A peer receiving the request is 2361 using a different overlay, overlay algorithm, or hash algorithm, 2362 or some other parameter that is inconsistent with the overlay 2363 configuration. 2365 Error_Unsupported_Forwarding_Option: A peer receiving the request 2366 with a forwarding options flagged as critical but the peer does 2367 not support this option. See section Section 6.3.2.3. 2369 Error_TTL_Exceeded: A peer receiving the request where the TTL got 2370 decremented to zero. See section Section 6.3.2. 2372 Error_Message_Too_Large: A peer receiving the request that was too 2373 large. See section Section 6.6. 2375 Error_Response_Too_Large: A peer would have generated a response 2376 that is too large per the max_response_length field. 2378 Error_Config_Too_Old: A destination peer received a request with a 2379 configuration sequence that's too old. See Section 6.3.2.1. 2381 Error_Config_Too_New: A destination node received a request with a 2382 configuration sequence that's too new. See Section 6.3.2.1. 2384 Error_Unknown_Kind: A destination node received a request with an 2385 unknown Kind-ID. See Section 7.4.1.2. 2387 Error_In_Progress: An Attach is already in progress to this peer. 2388 See Section 6.5.1.2. 2390 Error_Unknown_Extension: A destination node received a request with 2391 an unknown extension. 2393 Error_Invalid_Message: Something about this message is invalid but 2394 it doesn't fit the other error codes. When this message is sent, 2395 implementations SHOULD provide some meaningful description in 2396 error_info to aid in debugging. 2398 6.3.4. Security Block 2400 The third part of a RELOAD message is the security block. The 2401 security block is represented by a SecurityBlock structure: 2403 struct { 2404 CertificateType type; 2405 opaque certificate<0..2^16-1>; 2406 } GenericCertificate; 2408 struct { 2409 GenericCertificate certificates<0..2^16-1>; 2410 Signature signature; 2411 } SecurityBlock; 2413 The contents of this structure are: 2415 certificates 2416 A bucket of certificates. 2418 signature 2419 A signature over the message contents. 2421 The certificates bucket SHOULD contain all the certificates necessary 2422 to verify every signature in both the message and the internal 2423 message objects, except for those certificates in a root-cert element 2424 of the current configuration file. This is the only location in the 2425 message which contains certificates, thus allowing for only a single 2426 copy of each certificate to be sent. In systems that have an 2427 alternative certificate distribution mechanism, some certificates MAY 2428 be omitted. However, unless an alternative mechanism for immediately 2429 generating certifcates, such as shared secret security (Section 13.4) 2430 is used, it is strongly RECOMMENDED that implementors include all 2431 referenced certificates, otherwise there is the possibility that 2432 messages may not be immediately verifiable because certificates must 2433 first be retrieved. 2435 NOTE TO IMPLEMENTERS: This requirement implies that a peer storing 2436 data is obligated to retain certificates for the data it holds 2437 regardless of whether it is responsible for or actually holding the 2438 certificates for the Certificate Store usage. 2440 Each certificate is represented by a GenericCertificate structure, 2441 which has the following contents: 2443 type 2444 The type of the certificate, as defined in [RFC6091]. Only the 2445 use of X.509 certificates is defined in this draft. 2447 certificate 2448 The encoded version of the certificate. For X.509 certificates, 2449 it is the DER form. 2451 The signature is computed over the payload and parts of the 2452 forwarding header. The payload, in case of a Store, may contain an 2453 additional signature computed over a StoreReq structure. All 2454 signatures are formatted using the Signature element. This element 2455 is also used in other contexts where signatures are needed. The 2456 input structure to the signature computation varies depending on the 2457 data element being signed. 2459 enum { reservedSignerIdentity(0), 2460 cert_hash(1), cert_hash_node_id(2), 2461 none(3) 2462 (255)} SignerIdentityType; 2464 struct { 2465 select (identity_type) { 2467 case cert_hash; 2468 HashAlgorithm hash_alg; // From TLS 2469 opaque certificate_hash<0..2^8-1>; 2471 case cert_hash_node_id: 2472 HashAlgorithm hash_alg; // From TLS 2473 opaque certificate_node_id_hash<0..2^8-1>; 2475 case none: 2476 /* empty */ 2477 /* This structure may be extended with new types if necessary*/ 2478 }; 2479 } SignerIdentityValue; 2481 struct { 2482 SignerIdentityType identity_type; 2483 uint16 length; 2484 SignerIdentityValue identity[SignerIdentity.length]; 2485 } SignerIdentity; 2487 struct { 2488 SignatureAndHashAlgorithm algorithm; // From TLS 2489 SignerIdentity identity; 2490 opaque signature_value<0..2^16-1>; 2491 } Signature; 2493 The signature construct contains the following values: 2495 algorithm 2496 The signature algorithm in use. The algorithm definitions are 2497 found in the IANA TLS SignatureAlgorithm Registry and 2498 HashAlgorithm registries. All implementations MUST support 2499 RSASSA-PKCS1-v1_5 [RFC3447] signatures with SHA-256 hashes. 2501 identity 2502 The identity used to form the signature. 2504 signature_value 2505 The value of the signature. 2507 There are two permitted identity formats, one for a certificate with 2508 only one node-id and one for a certificate with multiple node-ids. 2509 In the first case, the cert_hash type MUST be used. The hash_alg 2510 field is used to indicate the algorithm used to produce the hash. 2511 The certificate_hash contains the hash of the certificate object 2512 (i.e., the DER-encoded certificate). 2514 In the second case, the cert_hash_node_id type MUST be used. The 2515 hash_alg is as in cert_hash but the cert_hash_node_id is computed 2516 over the NodeId used to sign concatenated with the certificate. 2517 I.e., H(NodeID || certificate). The NodeId is represented without 2518 any framing or length fields, as simple raw bytes. This is safe 2519 because NodeIds are fixed-length for a given overlay. 2521 For signatures over messages the input to the signature is computed 2522 over: 2524 overlay || transaction_id || MessageContents || SignerIdentity 2526 where overlay and transaction_id come from the forwarding header and 2527 || indicates concatenation. 2529 The input to signatures over data values is different, and is 2530 described in Section 7.1. 2532 All RELOAD messages MUST be signed. Upon receipt (and fragment 2533 reassembly if needed) the destination node MUST verify the signature 2534 and the authorizing certificate. If the signature fails, the 2535 implementation SHOULD simply drop the message and MUST not process 2536 it. This check provides a minimal level of assurance that the 2537 sending node is a valid part of the overlay as well as cryptographic 2538 authentication of the sending node. In addition, responses MUST be 2539 checked as follows by the requesting node: 2541 1. The response to a message sent to a specific Node-ID MUST have 2542 been sent by that Node-ID. 2543 2. The response to a message sent to a Resource-Id MUST have been 2544 sent by a Node-ID which is as close to or closer to the target 2545 Resource-Id than any node in the requesting node's neighbor 2546 table. 2548 The second condition serves as a primitive check for responses from 2549 wildly wrong nodes but is not a complete check. Note that in periods 2550 of churn, it is possible for the requesting node to obtain a closer 2551 neighbor while the request is outstanding. This will cause the 2552 response to be rejected and the request to be retransmitted. 2554 In addition, some methods (especially Store) have additional 2555 authentication requirements, which are described in the sections 2556 covering those methods. 2558 6.4. Overlay Topology 2560 As discussed in previous sections, RELOAD does not itself implement 2561 any overlay topology. Rather, it relies on Topology Plugins, which 2562 allow a variety of overlay algorithms to be used while maintaining 2563 the same RELOAD core. This section describes the requirements for 2564 new topology plugins and the methods that RELOAD provides for overlay 2565 topology maintenance. 2567 6.4.1. Topology Plugin Requirements 2569 When specifying a new overlay algorithm, at least the following need 2570 to be described: 2572 o Joining procedures, including the contents of the Join message. 2573 o Stabilization procedures, including the contents of the Update 2574 message, the frequency of topology probes and keepalives, and the 2575 mechanism used to detect when peers have disconnected. 2576 o Exit procedures, including the contents of the Leave message. 2577 o The length of the Resource-IDs. For DHTs, the hash algorithm to 2578 compute the hash of an identifier. 2579 o The procedures that peers use to route messages. 2580 o The replication strategy used to ensure data redundancy. 2582 All overlay algorithms MUST specify maintenance procedures that send 2583 Updates to clients and peers that have established connections to the 2584 peer responsible for a particular ID when the responsibility for that 2585 ID changes. Because tracking this information is difficult, overlay 2586 algorithms MAY simply specify that an Update is sent to all members 2587 of the Connection Table whenever the range of IDs for which the peer 2588 is responsible changes. 2590 6.4.2. Methods and types for use by topology plugins 2592 This section describes the methods that topology plugins use to join, 2593 leave, and maintain the overlay. 2595 6.4.2.1. Join 2597 A new peer (but one that already has credentials) uses the JoinReq 2598 message to join the overlay. The JoinReq is sent to the responsible 2599 peer depending on the routing mechanism described in the topology 2600 plugin. This notifies the responsible peer that the new peer is 2601 taking over some of the overlay and it needs to synchronize its 2602 state. 2604 struct { 2605 NodeId joining_peer_id; 2606 opaque overlay_specific_data<0..2^16-1>; 2607 } JoinReq; 2609 The minimal JoinReq contains only the Node-ID which the sending peer 2610 wishes to assume. Overlay algorithms MAY specify other data to 2611 appear in this request. Receivers of the JoinReq MUST verify that 2612 the joining_peer_id field matches the Node-ID used to sign the 2613 message and if not MUST reject the message with an Error_Forbidden 2614 error. 2616 Because joins may only be executed between nodes which are directly 2617 adjacent, receiving peers MUST verify that any JoinReq they receive 2618 arrives from a transport channel that is bound to the Node-Id to be 2619 assumed by the joining peer.) This also prevents replay attacks 2620 provided that DTLS anti-replay is used. 2622 If the request succeeds, the responding peer responds with a JoinAns 2623 message, as defined below: 2625 struct { 2626 opaque overlay_specific_data<0..2^16-1>; 2627 } JoinAns; 2629 If the request succeeds, the responding peer MUST follow up by 2630 executing the right sequence of Stores and Updates to transfer the 2631 appropriate section of the overlay space to the joining peer. In 2632 addition, overlay algorithms MAY define data to appear in the 2633 response payload that provides additional info. 2635 Joining nodes MUST verify that the signature on the JoinAns message 2636 matches the expected target (i.e., the adjacency over which they are 2637 joining.) If not, they MUST discard the message. 2639 In general, nodes which cannot form connections SHOULD report an 2640 error to the user. However, implementations MUST provide some 2641 mechanism whereby nodes can determine that they are potentially the 2642 first node and take responsibility for the overlay (the idea is to 2643 avoid having ordinary nodes try to become responsible for the entire 2644 overlay during a partition.) This specification does not mandate any 2645 particular mechanism, but a configuration flag or setting seems 2646 appropriate. 2648 6.4.2.2. Leave 2650 The LeaveReq message is used to indicate that a node is exiting the 2651 overlay. A node SHOULD send this message to each peer with which it 2652 is directly connected prior to exiting the overlay. 2654 struct { 2655 NodeId leaving_peer_id; 2656 opaque overlay_specific_data<0..2^16-1>; 2657 } LeaveReq; 2659 LeaveReq contains only the Node-ID of the leaving peer. Overlay 2660 algorithms MAY specify other data to appear in this request. 2661 Receivers of the LeaveReq MUST verify that the leaving_peer_id field 2662 matches the Node-ID used to sign the message and if not MUST reject 2663 the message with an Error_Forbidden error. 2665 Because leaves may only be executed between nodes which are directly 2666 adjacent, receiving peers MUST verify that any LeaveReq they receive 2667 arrives from a transport channel that is bound to the Node-Id to be 2668 assumed by the leaving peer.) This also prevents replay attacks 2669 provided that DTLS anti-replay is used. 2671 Upon receiving a Leave request, a peer MUST update its own routing 2672 table, and send the appropriate Store/Update sequences to re- 2673 stabilize the overlay. 2675 6.4.2.3. Update 2677 Update is the primary overlay-specific maintenance message. It is 2678 used by the sender to notify the recipient of the sender's view of 2679 the current state of the overlay (its routing state), and it is up to 2680 the recipient to take whatever actions are appropriate to deal with 2681 the state change. In general, peers send Update messages to all 2682 their adjacencies whenever they detect a topology shift. 2684 When a peer receives an Attach request with the send_update flag set 2685 to "true" (Section 6.4.2.4.1, it MUST send an Update message back to 2686 the sender of the Attach request after the completion of the 2687 corresponding ICE check and TLS connection. Note that the sender of 2688 a such Attach request may not have joined the overlay yet. 2690 When a peer detects through an Update that it is no longer 2691 responsible for any data value it is storing, it MUST attempt to 2692 Store a copy to the correct node unless it knows the newly 2693 responsible node already has a copy of the data. This prevents data 2694 loss during large-scale topology shifts such as the merging of 2695 partitioned overlays. 2697 The contents of the UpdateReq message are completely overlay- 2698 specific. The UpdateAns response is expected to be either success or 2699 an error. 2701 6.4.2.4. RouteQuery 2703 The RouteQuery request allows the sender to ask a peer where they 2704 would route a message directed to a given destination. In other 2705 words, a RouteQuery for a destination X requests the Node-ID for the 2706 node that the receiving peer would next route to in order to get to 2707 X. A RouteQuery can also request that the receiving peer initiate an 2708 Update request to transfer the receiving peer's routing table. 2710 One important use of the RouteQuery request is to support iterative 2711 routing. The sender selects one of the peers in its routing table 2712 and sends it a RouteQuery message with the destination_object set to 2713 the Node-ID or Resource-ID it wishes to route to. The receiving peer 2714 responds with information about the peers to which the request would 2715 be routed. The sending peer MAY then use the Attach method to attach 2716 to that peer(s), and repeat the RouteQuery. Eventually, the sender 2717 gets a response from a peer that is closest to the identifier in the 2718 destination_object as determined by the topology plugin. At that 2719 point, the sender can send messages directly to that peer. 2721 6.4.2.4.1. Request Definition 2723 A RouteQueryReq message indicates the peer or resource that the 2724 requesting node is interested in. It also contains a "send_update" 2725 option allowing the requesting node to request a full copy of the 2726 other peer's routing table. 2728 struct { 2729 Boolean send_update; 2730 Destination destination; 2731 opaque overlay_specific_data<0..2^16-1>; 2733 } RouteQueryReq; 2735 The contents of the RouteQueryReq message are as follows: 2737 send_update 2738 A single byte. This may be set to "true" to indicate that the 2739 requester wishes the responder to initiate an Update request 2740 immediately. Otherwise, this value MUST be set to "false". 2742 destination 2743 The destination which the requester is interested in. This may be 2744 any valid destination object, including a Node-ID, opaque ids, or 2745 Resource-ID. 2747 overlay_specific_data 2748 Other data as appropriate for the overlay. 2750 6.4.2.4.2. Response Definition 2752 A response to a successful RouteQueryReq request is a RouteQueryAns 2753 message. This is completely overlay specific. 2755 6.4.2.5. Probe 2757 Probe provides primitive "exploration" services: it allows node to 2758 determine which resources another node is responsible for; and it 2759 allows some discovery services using multicast, anycast, or 2760 broadcast. A probe can be addressed to a specific Node-ID, or the 2761 peer controlling a given location (by using a Resource-ID). In 2762 either case, the target Node-IDs respond with a simple response 2763 containing some status information. 2765 6.4.2.5.1. Request Definition 2767 The ProbeReq message contains a list (potentially empty) of the 2768 pieces of status information that the requester would like the 2769 responder to provide. 2771 enum { reservedProbeInformation(0), responsible_set(1), 2772 num_resources(2), uptime(3), (255)} 2773 ProbeInformationType; 2775 struct { 2776 ProbeInformationType requested_info<0..2^8-1>; 2777 } ProbeReq 2779 The currently defined values for ProbeInformation are: 2781 responsible_set 2782 indicates that the peer should Respond with the fraction of the 2783 overlay for which the responding peer is responsible. 2785 num_resources 2786 indicates that the peer should Respond with the number of 2787 resources currently being stored by the peer. 2789 uptime 2790 indicates that the peer should Respond with how long the peer has 2791 been up in seconds. 2793 6.4.2.5.2. Response Definition 2795 A successful ProbeAns response contains the information elements 2796 requested by the peer. 2798 struct { 2799 select (type) { 2800 case responsible_set: 2801 uint32 responsible_ppb; 2803 case num_resources: 2804 uint32 num_resources; 2806 case uptime: 2807 uint32 uptime; 2808 /* This type may be extended */ 2810 }; 2811 } ProbeInformationData; 2813 struct { 2814 ProbeInformationType type; 2815 uint8 length; 2816 ProbeInformationData value; 2817 } ProbeInformation; 2819 struct { 2820 ProbeInformation probe_info<0..2^16-1>; 2821 } ProbeAns; 2823 A ProbeAns message contains a sequence of ProbeInformation 2824 structures. Each has a "length" indicating the length of the 2825 following value field. This structure allows for unknown option 2826 types. 2828 Each of the current possible Probe information types is a 32-bit 2829 unsigned integer. For type "responsible_ppb", it is the fraction of 2830 the overlay for which the peer is responsible in parts per billion. 2831 For type "num_resources", it is the number of resources the peer is 2832 storing. For the type "uptime" it is the number of seconds the peer 2833 has been up. 2835 The responding peer SHOULD include any values that the requesting 2836 node requested and that it recognizes. They SHOULD be returned in 2837 the requested order. Any other values MUST NOT be returned. 2839 6.5. Forwarding and Link Management Layer 2841 Each node maintains connections to a set of other nodes defined by 2842 the topology plugin. This section defines the methods RELOAD uses to 2843 form and maintain connections between nodes in the overlay. Three 2844 methods are defined: 2846 Attach: used to form RELOAD connections between nodes using ICE 2847 for NAT traversal. When node A wants to connect to node B, it 2848 sends an Attach message to node B through the overlay. The Attach 2849 contains A's ICE parameters. B responds with its ICE parameters 2850 and the two nodes perform ICE to form connection. Attach also 2851 allows two nodes to connect via No-ICE instead of full ICE. 2852 AppAttach: used to form application layer connections between 2853 nodes. 2854 Ping: is a simple request/response which is used to verify 2855 connectivity of the target peer. 2857 6.5.1. Attach 2859 A node sends an Attach request when it wishes to establish a direct 2860 TCP or UDP connection to another node for the purpose of sending 2861 RELOAD messages. A client that can establish a connection directly 2862 need not send an attach as described in the second bullet of 2863 Section 3.2.1 2865 As described in Section 6.1, an Attach may be routed to either a 2866 Node-ID or to a Resource-ID. An Attach routed to a specific Node-ID 2867 will fail if that node is not reached. An Attach routed to a 2868 Resource-ID will establish a connection with the peer currently 2869 responsible for that Resource-ID, which may be useful in establishing 2870 a direct connection to the responsible peer for use with frequent or 2871 large resource updates. 2873 An Attach in and of itself does not result in updating the routing 2874 table of either node. That function is performed by Updates. If 2875 node A has Attached to node B, but not received any Updates from B, 2876 it MAY route messages which are directly addressed to B through that 2877 channel but MUST NOT route messages through B to other peers via that 2878 channel. The process of Attaching is separate from the process of 2879 becoming a peer (using Join and Update), to prevent half-open states 2880 where a node has started to form connections but is not really ready 2881 to act as a peer. Thus, clients (unlike peers) can simply Attach 2882 without sending Join or Update. 2884 6.5.1.1. Request Definition 2886 An Attach request message contains the requesting node ICE connection 2887 parameters formatted into a binary structure. 2889 enum { reservedOverlayLink(0), DTLS-UDP-SR(1), 2890 DTLS-UDP-SR-NO-ICE(3), TLS-TCP-FH-NO-ICE(4), 2891 (255) } OverlayLinkType; 2893 enum { reservedCand(0), host(1), srflx(2), prflx(3), relay(4), 2894 (255) } CandType; 2896 struct { 2897 opaque name<0..2^16-1>; 2898 opaque value<0..2^16-1>; 2899 } IceExtension; 2901 struct { 2902 IpAddressPort addr_port; 2903 OverlayLinkType overlay_link; 2904 opaque foundation<0..255>; 2905 uint32 priority; 2906 CandType type; 2907 select (type){ 2908 case host: 2909 ; /* Nothing */ 2910 case srflx: 2911 case prflx: 2912 case relay: 2913 IpAddressPort rel_addr_port; 2914 }; 2915 IceExtension extensions<0..2^16-1>; 2916 } IceCandidate; 2918 struct { 2919 opaque ufrag<0..2^8-1>; 2920 opaque password<0..2^8-1>; 2921 opaque role<0..2^8-1>; 2922 IceCandidate candidates<0..2^16-1>; 2923 Boolean send_update; 2924 } AttachReqAns; 2926 The values contained in AttachReqAns are: 2928 ufrag 2929 The username fragment (from ICE). 2931 password 2932 The ICE password. 2934 role 2935 An active/passive/actpass attribute from RFC 4145 [RFC4145]. This 2936 value MUST be 'passive' for the offerer (the peer sending the 2937 Attach request) and 'active' for the answerer (the peer sending 2938 the Attach response). 2940 candidates 2941 One or more ICE candidate values, as described below. 2942 send_update 2943 Has the same meaning as the send_update field in RouteQueryReq. 2945 Each ICE candidate is represented as an IceCandidate structure, which 2946 is a direct translation of the information from the ICE string 2947 structures, with the exception of the component ID. Since there is 2948 only one component, it is always 1, and thus left out of the PDU. 2949 The remaining values are specified as follows: 2951 addr_port 2952 corresponds to the connection-address and port productions. 2954 overlay_link 2955 corresponds to the OverlayLinkType production, Overlay Link 2956 protocols used with No-ICE MUST specify "No-ICE" in their 2957 description. Future overlay link values can be added be defining 2958 new OverlayLinkType values in the IANA registry in Section 14.10. 2959 Future extensions to the encapsulation or framing that provide for 2960 backward compatibility with that specified by a previously defined 2961 OverlayLinkType values MUST use that previous value. 2962 OverlayLinkType protocols are defined in Section 6.6 2963 A single AttachReqAns MUST NOT include both candidates whose 2964 OverlayLinkType protocols use ICE (the default) and candidates 2965 that specify "No-ICE". 2967 foundation 2968 corresponds to the foundation production. 2970 priority 2971 corresponds to the priority production. 2973 type 2974 corresponds to the cand-type production. 2976 rel_addr_port 2977 corresponds to the rel-addr and rel-port productions. Only 2978 present for type "relay". 2980 extensions 2981 ICE extensions. The name and value fields correspond to binary 2982 translations of the equivalent fields in the ICE extensions. 2984 These values should be generated using the procedures described in 2985 Section 6.5.1.3. 2987 6.5.1.2. Response Definition 2989 If a peer receives an Attach request, it MUST determine how to 2990 process the request as follows: 2992 o If it has not initiated an Attach request to the originating peer 2993 of this Attach request, it MUST process this request and SHOULD 2994 generate its own response with an AttachReqAns. It should then 2995 begin ICE checks. 2996 o If it has already sent an Attach request to and received the 2997 response from the originating peer of this Attach request, and as 2998 a result, an ICE check and TLS connection is in progress, then it 2999 SHOULD generate an Error_In_Progress error instead of an 3000 AttachReqAns. 3001 o If it has already sent an Attach request to but not yet received 3002 the response from the originating peer of this Attach request, it 3003 SHOULD apply the following tie-breaker heuristic to determine how 3004 to handle this Attach request and the incomplete Attach request it 3005 has sent out: 3006 * If the peer's own Node-ID is smaller when compared as big- 3007 endian unsigned integers, it MUST cancel its own incomplete 3008 Attach request. It MUST then process this Attach request, 3009 generate an AttachReqAns response, and proceed with the 3010 corresponding ICE check. 3011 * If the peer's own Node-ID is larger when compared as big-endien 3012 unsigned integers, it MUST generate an Error_In_Progress error 3013 to this Attach request, then proceed to wait for and complete 3014 the Attach and the corresponding ICE check it has originated. 3015 o If the peer is overloaded or detects some other kind of error, it 3016 MAY generate an error instead of an AttachReqAns. 3018 When a peer receives an Attach response, it SHOULD parse the response 3019 and begin its own ICE checks. 3021 6.5.1.3. Using ICE With RELOAD 3023 This section describes the profile of ICE that is used with RELOAD. 3024 RELOAD implementations MUST implement full ICE. 3026 In ICE as defined by [RFC5245], SDP is used to carry the ICE 3027 parameters. In RELOAD, this function is performed by a binary 3028 encoding in the Attach method. This encoding is more restricted than 3029 the SDP encoding because the RELOAD environment is simpler: 3031 o Only a single media stream is supported. 3032 o In this case, the "stream" refers not to RTP or other types of 3033 media, but rather to a connection for RELOAD itself or other 3034 application-layer protocols such as SIP. 3035 o RELOAD only allows for a single offer/answer exchange. Unlike the 3036 usage of ICE within SIP, there is never a need to send a 3037 subsequent offer to update the default candidates to match the 3038 ones selected by ICE. 3040 An agent follows the ICE specification as described in [RFC5245] with 3041 the changes and additional procedures described in the subsections 3042 below. 3044 6.5.1.4. Collecting STUN Servers 3046 ICE relies on the node having one or more STUN servers to use. In 3047 conventional ICE, it is assumed that nodes are configured with one or 3048 more STUN servers through some out of band mechanism. This is still 3049 possible in RELOAD but RELOAD also learns STUN servers as it connects 3050 to other peers. Because all RELOAD peers implement ICE and use STUN 3051 keepalives, every peer is a capable of responding to STUN Binding 3052 requests [RFC5389]. Accordingly, any peer that a node knows about 3053 can be used like a STUN server -- though of course it may be behind a 3054 NAT. 3056 A peer on a well-provisioned wide-area overlay will be configured 3057 with one or more bootstrap nodes. These nodes make an initial list 3058 of STUN servers. However, as the peer forms connections with 3059 additional peers, it builds more peers it can use like STUN servers. 3061 Because complicated NAT topologies are possible, a peer may need more 3062 than one STUN server. Specifically, a peer that is behind a single 3063 NAT will typically observe only two IP addresses in its STUN checks: 3064 its local address and its server reflexive address from a STUN server 3065 outside its NAT. However, if there are more NATs involved, it may 3066 learn additional server reflexive addresses (which vary based on 3067 where in the topology the STUN server is). To maximize the chance of 3068 achieving a direct connection, a peer SHOULD group other peers by the 3069 peer-reflexive addresses it discovers through them. It SHOULD then 3070 select one peer from each group to use as a STUN server for future 3071 connections. 3073 Only peers to which the peer currently has connections may be used. 3074 If the connection to that host is lost, it MUST be removed from the 3075 list of stun servers and a new server from the same group MUST be 3076 selected unless there are no others servers in the group in which 3077 case some other peer MAY be used. 3079 6.5.1.5. Gathering Candidates 3081 When a node wishes to establish a connection for the purposes of 3082 RELOAD signaling or application signaling, it follows the process of 3083 gathering candidates as described in Section 4 of ICE [RFC5245]. 3084 RELOAD utilizes a single component. Consequently, gathering for 3085 these "streams" requires a single component. In the case where a 3086 node has not yet found a TURN server, the agent would not include a 3087 relayed candidate. 3089 The ICE specification assumes that an ICE agent is configured with, 3090 or somehow knows of, TURN and STUN servers. RELOAD provides a way 3091 for an agent to learn these by querying the overlay, as described in 3092 Section 6.5.1.4 and Section 9. 3094 The default candidate selection described in Section 4.1.4 of ICE is 3095 ignored; defaults are not signaled or utilized by RELOAD. 3097 An alternative to using the full ICE supported by the Attach request 3098 is to use No-ICE mechanism by providing candidates with "No-ICE" 3099 Overlay Link protocols. Configuration for the overlay indicates 3100 whether or not these Overlay Link protocols can be used. An overlay 3101 MUST be either all ICE or all No-ICE. 3103 No-ICE will not work in all of the scenarios where ICE would work, 3104 but in some cases, particularly those with no NATs or firewalls, it 3105 will work. 3107 6.5.1.6. Prioritizing Candidates 3109 However, standardization of additional protocols for use with ICE is 3110 expected, including TCP[I-D.ietf-mmusic-ice-tcp] and protocols such 3111 as SCTP and DCCP. UDP encapsulations for SCTP and DCCP would expand 3112 the available Overlay Link protocols available for RELOAD. When 3113 additional protocols are available, the following prioritization is 3114 RECOMMENDED: 3116 o Highest priority is assigned to protocols that offer well- 3117 understood congestion and flow control without head of line 3118 blocking. For example, SCTP without message ordering, DCCP, or 3119 those protocols encapsulated using UDP. 3120 o Second highest priority is assigned to protocols that offer well- 3121 understood congestion and flow control but have head of line 3122 blocking such as TCP. 3123 o Lowest priority is assigned to protocols encapsulated over UDP 3124 that do not implement well-established congestion control 3125 algorithms. The DTLS/UDP with SR overlay link protocol is an 3126 example of such a protocol. 3128 Head of line blocking is undesireable in an Overlay Link protocol 3129 because the messages carried on a RELOAD link are independent, rather 3130 than stream-oriented. Therefore, if message N on a link is lost, 3131 delaying message N+1 on that same link until N is successfully 3132 retransmitted does nothing other than increase the latency for the 3133 transaction of message N+1 as they are unrelated to each other. 3134 Therefore, while the high quality, performance, and availability of 3135 modern TCP implementations makes them very attractive, their 3136 performance as an Overlay Link protocol is not optimal. 3138 6.5.1.7. Encoding the Attach Message 3140 Section 4.3 of ICE describes procedures for encoding the SDP for 3141 conveying RELOAD candidates. Instead of actually encoding an SDP 3142 message, the candidate information (IP address and port and transport 3143 protocol, priority, foundation, type and related address) is carried 3144 within the attributes of the Attach request or its response. 3145 Similarly, the username fragment and password are carried in the 3146 Attach message or its response. Section 6.5.1 describes the detailed 3147 attribute encoding for Attach. The Attach request and its response 3148 do not contain any default candidates or the ice-lite attribute, as 3149 these features of ICE are not used by RELOAD. 3151 Since the Attach request contains the candidate information and short 3152 term credentials, it is considered as an offer for a single media 3153 stream that happens to be encoded in a format different than SDP, but 3154 is otherwise considered a valid offer for the purposes of following 3155 the ICE specification. Similarly, the Attach response is considered 3156 a valid answer for the purposes of following the ICE specification. 3158 6.5.1.8. Verifying ICE Support 3160 An agent MUST skip the verification procedures in Section 5.1 and 6.1 3161 of ICE. Since RELOAD requires full ICE from all agents, this check 3162 is not required. 3164 6.5.1.9. Role Determination 3166 The roles of controlling and controlled as described in Section 5.2 3167 of ICE are still utilized with RELOAD. However, the offerer (the 3168 entity sending the Attach request) will always be controlling, and 3169 the answerer (the entity sending the Attach response) will always be 3170 controlled. The connectivity checks MUST still contain the ICE- 3171 CONTROLLED and ICE-CONTROLLING attributes, however, even though the 3172 role reversal capability for which they are defined will never be 3173 needed with RELOAD. This is to allow for a common codebase between 3174 ICE for RELOAD and ICE for SDP. 3176 6.5.1.10. Full ICE 3178 When the overlay uses ICE , connectivity checks and nominations are 3179 used as in regular ICE. 3181 6.5.1.10.1. Connectivity Checks 3183 The processes of forming check lists in Section 5.7 of ICE, 3184 scheduling checks in Section 5.8, and checking connectivity checks in 3185 Section 7 are used with RELOAD without change. 3187 6.5.1.10.2. Concluding ICE 3189 The procedures in Section 8 of ICE are followed to conclude ICE, with 3190 the following exceptions: 3192 o The controlling agent MUST NOT attempt to send an updated offer 3193 once the state of its single media stream reaches Completed. 3194 o Once the state of ICE reaches Completed, the agent can immediately 3195 free all unused candidates. This is because RELOAD does not have 3196 the concept of forking, and thus the three second delay in Section 3197 8.3 of ICE does not apply. 3199 6.5.1.10.3. Media Keepalives 3201 STUN MUST be utilized for the keepalives described in Section 10 of 3202 ICE. 3204 6.5.1.11. No-ICE 3206 No-ICE is selected when either side has provided "no ICE" Overlay 3207 Link candidates. STUN is not used for connectivity checks when doing 3208 No-ICE; instead the DTLS or TLS handshake (or similar security layer 3209 of future overlay link protocols) forms the connectivity check. The 3210 certificate exchanged during the (D)TLS handshake MUST match the node 3211 that sent the AttachReqAns and if it does not, the connection MUST be 3212 closed. 3214 6.5.1.12. Subsequent Offers and Answers 3216 An agent MUST NOT send a subsequent offer or answer. Thus, the 3217 procedures in Section 9 of ICE MUST be ignored. 3219 6.5.1.13. Sending Media 3221 The procedures of Section 11 of ICE apply to RELOAD as well. 3222 However, in this case, the "media" takes the form of application 3223 layer protocols (e.g. RELOAD) over TLS or DTLS. Consequently, once 3224 ICE processing completes, the agent will begin TLS or DTLS procedures 3225 to establish a secure connection. The node which sent the Attach 3226 request MUST be the TLS server. The other node MUST be the TLS 3227 client. The server MUST request TLS client authentication. The 3228 nodes MUST verify that the certificate presented in the handshake 3229 matches the identity of the other peer as found in the Attach 3230 message. Once the TLS or DTLS signaling is complete, the application 3231 protocol is free to use the connection. 3233 The concept of a previous selected pair for a component does not 3234 apply to RELOAD, since ICE restarts are not possible with RELOAD. 3236 6.5.1.14. Receiving Media 3238 An agent MUST be prepared to receive packets for the application 3239 protocol (TLS or DTLS carrying RELOAD, SIP or anything else) at any 3240 time. The jitter and RTP considerations in Section 11 of ICE do not 3241 apply to RELOAD. 3243 6.5.2. AppAttach 3245 A node sends an AppAttach request when it wishes to establish a 3246 direct connection to another node for the purposes of sending 3247 application layer messages. AppAttach is nearly identical to Attach, 3248 except for the purpose of the connection: it is used to transport 3249 non-RELOAD "media". A separate request is used to avoid implementor 3250 confusion between the two methods (this was found to be a real 3251 problem with initial implementations). The AppAttach request and its 3252 response contain an application attribute, which indicates what 3253 protocol is to be run over the connection. 3255 6.5.2.1. Request Definition 3257 An AppAttachReq message contains the requesting node's ICE connection 3258 parameters formatted into a binary structure. 3260 struct { 3261 opaque ufrag<0..2^8-1>; 3262 opaque password<0..2^8-1>; 3263 uint16 application; 3264 opaque role<0..2^8-1>; 3265 IceCandidate candidates<0..2^16-1>; 3266 } AppAttachReq; 3268 The values contained in AppAttachReq and AppAttachAns are: 3270 ufrag 3271 The username fragment (from ICE) 3273 password 3274 The ICE password. 3276 application 3277 A 16-bit application-id as defined in the Section 14.5. This 3278 number represents the IANA registered application that is going to 3279 send data on this connection. 3281 role 3282 An active/passive/actpass attribute from RFC 4145 [RFC4145]. 3284 candidates 3285 One or more ICE candidate values 3287 The application using connection set up with this request is 3288 responsible for providing sufficiently frequent keep traffic for NAT 3289 and Firewall keep alive and for deciding when to close the 3290 connection. 3292 6.5.2.2. Response Definition 3294 If a peer receives an AppAttach request, it SHOULD process the 3295 request and generate its own response with a AppAttachAns. It should 3296 then begin ICE checks. When a peer receives an AppAttach response, 3297 it SHOULD parse the response and begin its own ICE checks. If the 3298 application ID is not supported, the peer MUST reply with an 3299 Error_Not_Found error. 3301 struct { 3302 opaque ufrag<0..2^8-1>; 3303 opaque password<0..2^8-1>; 3304 uint16 application; 3305 opaque role<0..2^8-1>; 3306 IceCandidate candidates<0..2^16-1>; 3308 } AppAttachAns; 3310 The meaning of the fields is the same as in the AppAttachReq. 3312 6.5.3. Ping 3314 Ping is used to test connectivity along a path. A ping can be 3315 addressed to a specific Node-ID, to the peer controlling a given 3316 location (by using a resource ID), or to the broadcast Node-ID 3317 (2^128-1). 3319 6.5.3.1. Request Definition 3321 struct { 3322 opaque<0..2^16-1> padding; 3323 } PingReq 3325 The Ping request is empty of meaningful contents. However, it may 3326 contain up to 65535 bytes of padding to facilitate the discovery of 3327 overlay maximum packet sizes. 3329 6.5.3.2. Response Definition 3331 A successful PingAns response contains the information elements 3332 requested by the peer. 3334 struct { 3335 uint64 response_id; 3336 uint64 time; 3337 } PingAns; 3339 A PingAns message contains the following elements: 3341 response_id 3342 A randomly generated 64-bit response ID. This is used to 3343 distinguish Ping responses. 3345 time 3346 The time when the Ping response was created represented in the 3347 same way as storage_time defined in Section 7. 3349 6.5.4. ConfigUpdate 3351 The ConfigUpdate method is used to push updated configuration data 3352 across the overlay. Whenever a node detects that another node has 3353 old configuration data, it MUST generate a ConfigUpdate request. The 3354 ConfigUpdate request allows updating of two kinds of data: the 3355 configuration data (Section 6.3.2.1) and the Kind information 3356 (Section 7.4.1.1). 3358 6.5.4.1. Request Definition 3360 enum { reservedConfigUpdate(0), config(1), kind(2), (255) } 3361 ConfigUpdateType; 3363 typedef uint32 KindId; 3364 typedef opaque KindDescription<0..2^16-1>; 3366 struct { 3367 ConfigUpdateType type; 3368 uint32 length; 3370 select (type) { 3371 case config: 3372 opaque config_data<0..2^24-1>; 3374 case kind: 3375 KindDescription kinds<0..2^24-1>; 3377 /* This structure may be extended with new types*/ 3378 }; 3379 } ConfigUpdateReq; 3381 The ConfigUpdateReq message contains the following elements: 3383 type 3384 The type of the contents of the message. This structure allows 3385 for unknown content types. 3386 length 3387 The length of the remainder of the message. This is included to 3388 preserve backward compatibility and is 32 bits instead of 24 to 3389 facilitate easy conversion between network and host byte order. 3390 config_data (type==config) 3391 The contents of the configuration document. 3393 kinds (type==kind) 3394 One or more XML kind-block productions (see Section 11.1). These 3395 MUST be encoded with UTF-8 and assume a default namespace of 3396 "urn:ietf:params:xml:ns:p2p:config-base". 3398 6.5.4.2. Response Definition 3400 struct { 3401 } ConfigUpdateAns 3403 If the ConfigUpdateReq is of type "config" it MUST only be processed 3404 if all the following are true: 3405 o The sequence number in the document is greater than the current 3406 configuration sequence number. 3407 o The configuration document is correctly digitally signed (see 3408 Section 11 for details on signatures. 3409 Otherwise appropriate errors MUST be generated. 3411 If the ConfigUpdateReq is of type "kind" it MUST only be processed if 3412 it is correctly digitally signed by an acceptable Kind signer (i.e., 3413 one listed in the current configuration file). Details on kind- 3414 signer field in the configuration file is described in Section 11.1. 3415 In addition, if the Kind update conflicts with an existing known Kind 3416 (i.e., it is signed by a different signer), then it should be 3417 rejected with "Error_Forbidden". This should not happen in correctly 3418 functioning overlays. 3420 If the update is acceptable, then the node MUST reconfigure itself to 3421 match the new information. This may include adding permissions for 3422 new Kinds, deleting old Kinds, or even, in extreme circumstances, 3423 exiting and reentering the overlay, if, for instance, the DHT 3424 algorithm has changed. 3426 If an implementation receives repeated ConfigUpdates which it cannot 3427 verify with sequence numbers substantially in advance of its own 3428 configuration document, it SHOULD contact the configuration server to 3429 get the latest configuration file in order to avoid permanent 3430 breakage. The details of this are left up to the implementation. 3432 The response for ConfigUpdate is empty. 3434 6.6. Overlay Link Layer 3436 RELOAD can use multiple Overlay Link protocols to send its messages. 3437 Because ICE is used to establish connections (see Section 6.5.1.3), 3438 RELOAD nodes are able to detect which Overlay Link protocols are 3439 offered by other nodes and establish connections between them. Any 3440 link protocol needs to be able to establish a secure, authenticated 3441 connection and to provide data origin authentication and message 3442 integrity for individual data elements. RELOAD currently supports 3443 three Overlay Link protocols: 3445 o DTLS [RFC4347] over UDP with Simple Reliability (SR) 3446 (OverlayLinkType=DTLS-UDP-SR 3447 o TLS [RFC5246] over TCP with Framing Header, No-ICE 3448 (OverlayLinkType=TLS-TCP-FH-NO-ICE 3449 o DTLS [RFC4347] over UDP with SR, No-ICE (OverlayLinkType=DTLS-UDP- 3450 SR-NO-ICE) 3452 Note that although UDP does not properly have "connections", both TLS 3453 and DTLS have a handshake which establishes a similar, stateful 3454 association, and we simply refer to these as "connections" for the 3455 purposes of this document. 3457 If a peer receives a message that is larger than value of max- 3458 message-size defined in the overlay configuration, the peer SHOULD 3459 send an Error_Message_Too_Large error and then close the TLS or DTLS 3460 session from which the message was received. Note that this error 3461 can be sent and the session closed before receiving the complete 3462 message. If the forwarding header is larger than the max-message- 3463 size, the receiver SHOULD close the TLS or DTLS session without 3464 sending an error. 3466 The Framing Header (FH) is used to frame messages and provide timing 3467 when used on a reliable stream-based transport protocol. Simple 3468 Reliability (SR) makes use of the FH to provide congestion control 3469 and semi-reliability when using unreliable message-oriented transport 3470 protocols. We will first define each of these algorithms, then 3471 define overlay link protocols that use them. 3473 Note: We expect future Overlay Link protocols to define replacements 3474 for all components of these protocols, including the framing header. 3475 These protocols have been chosen for simplicity of implementation and 3476 reasonable performance. 3478 Note to implementers: There are inherent tradeoffs in utilizing 3479 short timeouts to determine when a link has failed. To balance the 3480 tradeoffs, an implementation SHOULD quickly act to remove entries 3481 from the routing table when there is reason to suspect the link has 3482 failed. For example, in a Chord derived overlay algorithm, a closer 3483 finger table entry could be substituted for an entry in the finger 3484 table that has experienced a timeout. That entry can be restored if 3485 it proves to resume functioning, or replaced at some point in the 3486 future if necessary. End-to-end retransmissions will handle any lost 3487 messages, but only if the failing entries do not remain in the finger 3488 table for subsequent retransmissions. 3490 6.6.1. Future Overlay Link Protocols 3492 It is possible to define new link-layer protocols and apply them to a 3493 new overlay using the "overlay-link-protocol" configuration directive 3494 (see Section 11.1.). However, any new protocols MUST meet the 3495 following requirements. 3497 Endpoint authentication When a node forms an association with 3498 another endpoint, it MUST be possible to cryptographically verify 3499 that the endpoint has a given Node-Id. 3501 Traffic origin authentication and integrity When a node receives 3502 traffic from another endpoint, it MUST be possible to 3503 cryptographically verify that the traffic came from a given 3504 association and that it has not been modified in transit from the 3505 other endpoint in the association. The overlay link protocol MUST 3506 also provide replay prevention/detection. 3508 Traffic confidentiality When a node sends traffic to another 3509 endpoint, it MUST NOT be possible for a third party not involved 3510 in the association to determine the contents of that traffic. 3512 Any new overlay protocol MUST be defined via RFC 5226 Standards 3513 Action; see Section 14.11. 3515 6.6.1.1. HIP 3517 In a Host Identity Protocol Based Overlay Networking Environment (HIP 3518 BONE) [RFC6079] HIP [RFC5201] provides connection management (e.g., 3519 NAT traversal and mobility) and security for the overlay network. 3520 The P2PSIP Working Group has expressed interest in supporting a HIP- 3521 based link protocol. Such support would require specifying such 3522 details as: 3524 o How to issue certificates which provided identities meaningful to 3525 the HIP base exchange. We anticipate that this would require a 3526 mapping between ORCHIDs and NodeIds. 3527 o How to carry the HIP I1 and I2 messages. 3528 o How to carry RELOAD messages over HIP. 3530 [I-D.ietf-hip-reload-instance] documents work in progress on using 3531 RELOAD with the HIP BONE. 3533 6.6.1.2. ICE-TCP 3535 The ICE-TCP draft [I-D.ietf-mmusic-ice-tcp] allows TCP to be 3536 supported as an Overlay Link protocol that can be added using ICE. 3538 6.6.1.3. Message-oriented Transports 3540 Modern message-oriented transports offer high performance, good 3541 congestion control, and avoid head of line blocking in case of lost 3542 data. These characteristics make them preferable as underlying 3543 transport protocols for RELOAD links. SCTP without message ordering 3544 and DCCP are two examples of such protocols. However, currently they 3545 are not well-supported by commonly available NATs, and specifications 3546 for ICE session establishment are not available. 3548 6.6.1.4. Tunneled Transports 3550 As of the time of this writing, there is significant interest in the 3551 IETF community in tunneling other transports over UDP, motivated by 3552 the situation that UDP is well-supported by modern NAT hardware, and 3553 similar performance can be achieved to native implementation. 3554 Currently SCTP, DCCP, and a generic tunneling extension are being 3555 proposed for message-oriented protocols. Once ICE traversal has been 3556 specified for these tunneled protocols, they should be 3557 straightforward to support as overlay link protocols. 3559 6.6.2. Framing Header 3561 In order to support unreliable links and to allow for quick detection 3562 of link failures when using reliable end-to-end transports, each 3563 message is wrapped in a very simple framing layer (FramedMessage) 3564 which is only used for each hop. This layer contains a sequence 3565 number which can then be used for ACKs. The same header is used for 3566 both reliable and unreliable transports for simplicity of 3567 implementation. 3569 The definition of FramedMessage is: 3571 enum { data(128), ack(129), (255)} FramedMessageType; 3573 struct { 3574 FramedMessageType type; 3576 select (type) { 3577 case data: 3578 uint32 sequence; 3579 opaque message<0..2^24-1>; 3581 case ack: 3582 uint32 ack_sequence; 3583 uint32 received; 3584 }; 3585 } FramedMessage; 3587 The type field of the PDU is set to indicate whether the message is 3588 data or an acknowledgement. 3590 If the message is of type "data", then the remainder of the PDU is as 3591 follows: 3593 sequence 3594 the sequence number. This increments by 1 for each framed message 3595 sent over this transport session. 3597 message 3598 the message that is being transmitted. 3600 Each connection has it own sequence number space. Initially the 3601 value is zero and it increments by exactly one for each message sent 3602 over that connection. 3604 When the receiver receives a message, it SHOULD immediately send an 3605 ACK message. The receiver MUST keep track of the 32 most recent 3606 sequence numbers received on this association in order to generate 3607 the appropriate ack. 3609 If the PDU is of type "ack", the contents are as follows: 3611 ack_sequence 3612 The sequence number of the message being acknowledged. 3614 received 3615 A bitmask indicating if each of the previous 32 sequence numbers 3616 before this packet has been among the 32 packets most recently 3617 received on this connection. When a packet is received with a 3618 sequence number N, the receiver looks at the sequence number of 3619 the previously 32 packets received on this connection. Call the 3620 previously received packet number M. For each of the previous 32 3621 packets, if the sequence number M is less than N but greater than 3622 N-32, the N-M bit of the received bitmask is set to one; otherwise 3623 it is zero. Note that a bit being set to one indicates positively 3624 that a particular packet was received, but a bit being set to zero 3625 means only that it is unknown whether or not the packet has been 3626 received, because it might have been received before the 32 most 3627 recently received packets. 3629 The received field bits in the ACK provide a high degree of 3630 redundancy so that the sender can figure out which packets the 3631 receiver has received and can then estimate packet loss rates. If 3632 the sender also keeps track of the time at which recent sequence 3633 numbers have been sent, the RTT can be estimated. 3635 Note that because retransmissions receive new sequence numbers, 3636 multiple ACKs may be received for the same message. This approach 3637 provides more information than traditional TCP sequence numbers, but 3638 care must be taken when applying algorithms designed based on TCP's 3639 stream-oriented sequence number. 3641 6.6.3. Simple Reliability 3643 When RELOAD is carried over DTLS or another unreliable link protocol, 3644 it needs to be used with a reliability and congestion control 3645 mechanism, which is provided on a hop-by-hop basis. The basic 3646 principle is that each message, regardless of whether or not it 3647 carries a request or response, will get an ACK and be reliably 3648 retransmitted. The receiver's job is very simple, limited to just 3649 sending ACKs. All the complexity is at the sender side. This allows 3650 the sending implementation to trade off performance versus 3651 implementation complexity without affecting the wire protocol. 3653 Because the receiver's role is limited to providing packet 3654 acknowledgements, a wide variety of congestion control algorithms can 3655 be implemented on the sender side while using the same basic wire 3656 protocol. The sender algorithm used MUST meet the requirements of 3657 [RFC5405]. 3659 6.6.3.1. Stop and Wait Sender Algorithm 3661 This section describes one possible implementation of a sender 3662 algorithm for Simple Reliability. It is adequate for overlays 3663 running on underlying networks with low latency and loss (LANs) or 3664 low-traffic overlays on the Internet. 3666 A node MUST NOT have more than one unacknowledged message on the DTLS 3667 connection at a time. Note that because retransmissions of the same 3668 message are given new sequence numbers, there may be multiple 3669 unacknowledged sequence numbers in use. 3671 The RTO ("Retransmission TimeOut") is based on an estimate of the 3672 round-trip time (RTT). The value for RTO is calculated separately 3673 for each DTLS session. Implementations can use a static value for 3674 RTO or a dynamic estimate which will result in better performance. 3675 For implementations that use a static value, the default value for 3676 RTO is 500 ms. Nodes MAY use smaller values of RTO if it is known 3677 that all nodes are within the local network. The default RTO MAY be 3678 chosen larger, and this is RECOMMENDED if it is known in advance 3679 (such as on high latency access links) that the round-trip time is 3680 larger. 3682 Implementations that use a dynamic estimate to compute the RTO MUST 3683 use the algorithm described in RFC 6298[RFC6298], with the exception 3684 that the value of RTO SHOULD NOT be rounded up to the nearest second 3685 but instead rounded up to the nearest millisecond. The RTT of a 3686 successful STUN transaction from the ICE stage is used as the initial 3687 measurement for formula 2.2 of RFC 6298. The sender keeps track of 3688 the time each message was sent for all recently sent messages. Any 3689 time an ACK is received, the sender can compute the RTT for that 3690 message by looking at the time the ACK was received and the time when 3691 the message was sent. This is used as a subsequent RTT measurement 3692 for formula 2.3 of RFC 6298 to update the RTO estimate. (Note that 3693 because retransmissions receive new sequence numbers, all received 3694 ACKs are used.) 3696 An initiating node SHOULD retransmit a message if it has not received 3697 an ACK after an interval of RTO (transit nodes do not retransmit at 3698 this layer). The node MUST double the time to wait after each 3699 retransmission. For each retransmission, the sequence number MUST be 3700 incremented. 3702 Retransmissions continue until a response is received, or until a 3703 total of 5 requests have been sent or there has been a hard ICMP 3704 error [RFC1122] or a TLS alert. The sender knows a response was 3705 received when it receives an ACK with a sequence number that 3706 indicates it is a response to one of the transmissions of this 3707 messages. For example, assuming an RTO of 500 ms, requests would be 3708 sent at times 0 ms, 500 ms, 1500 ms, 3500 ms, and 7500 ms. If all 3709 retransmissions for a message fail, then the sending node SHOULD 3710 close the connection routing the message. 3712 To determine when a link may be failing without waiting for the final 3713 timeout, observe when no ACKs have been received for an entire RTO 3714 interval, and then wait for three retransmissions to occur beyond 3715 that point. If no ACKs have been received by the time the third 3716 retransmission occurs, it is RECOMMENDED that the link be removed 3717 from the routing table. The link MAY be restored to the routing 3718 table if ACKs resume before the connection is closed, as described 3719 above. 3721 A sender MUST wait 10ms between receipt of an ACK and transmission of 3722 the next message. 3724 6.6.4. DTLS/UDP with SR 3726 This overlay link protocol consists of DTLS over UDP while 3727 implementing the Simple Reliability protocol. STUN Connectivity 3728 checks and keepalives are used. Any compliant sender algorithm may 3729 be used. 3731 6.6.5. TLS/TCP with FH, No-ICE 3733 This overlay link protocol consists of TLS over TCP with the framing 3734 header. Because ICE is not used, STUN connectivity checks are not 3735 used upon establishing the TCP connection, nor are they used for 3736 keepalives. 3738 Because the TCP layer's application-level timeout is too slow to be 3739 useful for overlay routing, the Overlay Link implementation MUST use 3740 the framing header to measure the RTT of the connection and calculate 3741 an RTO as specified in Section 2 of [RFC6298]. The resulting RTO is 3742 not used for retransmissions, but as a timeout to indicate when the 3743 link SHOULD be removed from the routing table. It is RECOMMENDED 3744 that such a connection be retained for 30s to determine if the 3745 failure was transient before concluding the link has failed 3746 permanently. 3748 When sending candidates for TLS/TCP with FH, No-ICE, a passive 3749 candidate MUST be provided. 3751 6.6.6. DTLS/UDP with SR, No-ICE 3753 This overlay link protocol consists of DTLS over UDP while 3754 implementing the Simple Reliability protocol. Because ICE is not 3755 used, no STUN connectivity checks or keepalives are used. 3757 6.7. Fragmentation and Reassembly 3759 In order to allow transmission over datagram protocols such as DTLS, 3760 RELOAD messages may be fragmented. 3762 Any node along the path can fragment the message but only the final 3763 destination reassembles the fragments. When a node takes a packet 3764 and fragments it, each fragment has a full copy of the Forwarding 3765 Header but the data after the Forwarding Header is broken up in 3766 appropriate sized chunks. The size of the payload chunks needs to 3767 take into account space to allow the via and destination lists to 3768 grow. Each fragment MUST contain a full copy of the via list, 3769 destination list, and ForwardingOptions and MUST contain at least 256 3770 bytes of the message body. If these elements cannot fit within the 3771 MTU of the underlying datagram protocol, RELOAD fragmentation is not 3772 performed and IP-layer fragmentation is allowed to occur. When a 3773 message must be fragmented, it SHOULD be split into equal-sized 3774 fragments that are no larger than the PMTU of the next overlay link 3775 minus 32 bytes. This is to allow the via list to grow before further 3776 fragmentation is required. 3778 Note that this fragmentation is not optimal for the end-to-end path - 3779 a message may be refragmented multiple times as it traverses the 3780 overlay but is only assembled at the final destination. This option 3781 has been chosen as it is far easier to implement than e2e PMTU 3782 discovery across an ever-changing overlay, and it effectively 3783 addresses the reliability issues of relying on IP-layer 3784 fragmentation. However, PING can be used to allow e2e PMTU discovery 3785 to be implemented if desired. 3787 Upon receipt of a fragmented message by the intended peer, the peer 3788 holds the fragments in a holding buffer until the entire message has 3789 been received. The message is then reassembled into a single message 3790 and processed. In order to mitigate denial of service attacks, 3791 receivers SHOULD time out incomplete fragments after maximum request 3792 lifetime (15 seconds). Note this time was derived from looking at 3793 the end to end retransmission time and saving fragments long enough 3794 for the full end to end retransmissions to take place. Ideally the 3795 receiver would have enough buffer space to deal with as many 3796 fragments as can arrive in the maximum request lifetime. However, if 3797 the receiver runs out of buffer space to reassemble the messages it 3798 MUST drop the message. 3800 The fragment field of the forwarding header is used to encode 3801 fragmentation information. The offset is the number of bytes between 3802 the end of the forwarding header and the start of the data. The 3803 first fragment therefore has an offset of 0. The last fragment 3804 indicator MUST be appropriately set. If the message is not 3805 fragmented, it is simply treated as if it is the only fragment: the 3806 last fragment bit is set and the offset is 0 resulting in a fragment 3807 value of 0xC0000000. 3809 Note: the reason for this definition of the fragment field is that 3810 originally the high bit was defined in part of the specification as 3811 "is fragmented" and so there was some specification ambiguity about 3812 how to encode messages with only one fragment. This ambiguity was 3813 resolved in favor of always encoding as the "last" fragment with 3814 offset 0, thus simplifying the receiver code path, but resulting in 3815 the high bit being redundant. Because messages MUST be set with the 3816 high bit set to 1, implementations SHOULD discard any message with it 3817 set to 0. Implementations (presumably legacy ones) which choose to 3818 accept such messages MUST either ignore the remaining bits or ensure 3819 that they are 0. They MUST NOT try to interpret as fragmented 3820 messages with the high bit set low. 3822 7. Data Storage Protocol 3824 RELOAD provides a set of generic mechanisms for storing and 3825 retrieving data in the Overlay Instance. These mechanisms can be 3826 used for new applications simply by defining new code points and a 3827 small set of rules. No new protocol mechanisms are required. 3829 The basic unit of stored data is a single StoredData structure: 3831 struct { 3832 uint32 length; 3833 uint64 storage_time; 3834 uint32 lifetime; 3835 StoredDataValue value; 3836 Signature signature; 3837 } StoredData; 3839 The contents of this structure are as follows: 3841 length 3842 The size of the StoredData structure in octets excluding the size 3843 of length itself. 3845 storage_time 3846 The time when the data was stored represented as the number of 3847 milliseconds elapsed since midnight Jan 1, 1970 UTC not counting 3848 leap seconds. This will have the same values for seconds as 3849 standard UNIX time or POSIX time. More information can be found 3850 at [UnixTime]. Any attempt to store a data value with a storage 3851 time before that of a value already stored at this location MUST 3852 generate a Error_Data_Too_Old error. This prevents rollback 3853 attacks. The node SHOULD make a best-effort attempt to use a 3854 correct clock to determine this number, however, the protocol does 3855 not require synchronized clocks: the receiving peer uses the 3856 storage time in the previous store, not its own clock. Clock 3857 values are used so that when clocks are generally synchronized, 3858 data may be stored in a single transaction, rather than querying 3859 for the value of a counter before the actual store. 3860 If a node attempting to store new data in response to a user 3861 request (rather than as an overlay maintenance operation such as 3862 occurs during unpartitioning) is rejected with an 3863 Error_Data_Too_Old error, the node MAY elect to perform its store 3864 using a storage_time that increments the value used with the 3865 previous store. This situation may occur when the clocks of nodes 3866 storing to this location are not properly synchronized. 3868 lifetime 3869 The validity period for the data, in seconds, starting from the 3870 time the peer receives the StoreReq. 3872 value 3873 The data value itself, as described in Section 7.2. 3875 signature 3876 A signature as defined in Section 7.1. 3878 Each Resource-ID specifies a single location in the Overlay Instance. 3879 However, each location may contain multiple StoredData values 3880 distinguished by Kind-ID. The definition of a Kind describes both 3881 the data values which may be stored and the data model of the data. 3882 Some data models allow multiple values to be stored under the same 3883 Kind-ID. Section Section 7.2 describes the available data models. 3884 Thus, for instance, a given Resource-ID might contain a single-value 3885 element stored under Kind-ID X and an array containing multiple 3886 values stored under Kind-ID Y. 3888 7.1. Data Signature Computation 3890 Each StoredData element is individually signed. However, the 3891 signature also must be self-contained and cover the Kind-ID and 3892 Resource-ID even though they are not present in the StoredData 3893 structure. The input to the signature algorithm is: 3895 resource_id || kind || storage_time || StoredDataValue || 3896 SignerIdentity 3898 Where || indicates concatenation. 3900 Where these values are: 3902 resource_id 3903 The resource ID where this data is stored. 3905 kind 3906 The Kind-ID for this data. 3908 storage_time 3910 The contents of the storage_time data value. 3911 StoredDataValue 3912 The contents of the stored data value, as described in the 3913 previous sections. 3915 SignerIdentity 3916 The signer identity as defined in Section 6.3.4. 3918 Once the signature has been computed, the signature is represented 3919 using a signature element, as described in Section 6.3.4. 3921 Note that there is no necessarily relationship between the validity 3922 window of a certificate and the expiry of the data it is 3923 authenticating. When signatures are verified, the current time MUST 3924 be compared to the certificate validity period. However, it is 3925 permitted to have a value signed which expires after a certificate's 3926 validity period (though this will likely cause verification failure 3927 at some future time.) 3929 7.2. Data Models 3931 The protocol currently defines the following data models: 3933 o single value 3934 o array 3935 o dictionary 3937 These are represented with the StoredDataValue structure. The actual 3938 dataModel is known from the Kind being stored. 3940 struct { 3941 Boolean exists; 3942 opaque value<0..2^32-1>; 3943 } DataValue; 3945 struct { 3946 select (dataModel) { 3947 case single_value: 3948 DataValue single_value_entry; 3950 case array: 3951 ArrayEntry array_entry; 3953 case dictionary: 3954 DictionaryEntry dictionary_entry; 3956 /* This structure may be extended */ 3957 }; 3958 } StoredDataValue; 3960 We now discuss the properties of each data model in turn: 3962 7.2.1. Single Value 3964 A single-value element is a simple sequence of bytes. There may be 3965 only one single-value element for each Resource-ID, Kind-ID pair. 3967 A single value element is represented as a DataValue, which contains 3968 the following two elements: 3970 exists 3971 This value indicates whether the value exists at all. If it is 3972 set to False, it means that no value is present. If it is True, 3973 that means that a value is present. This gives the protocol a 3974 mechanism for indicating nonexistence as opposed to emptiness. 3976 value 3977 The stored data. 3979 7.2.2. Array 3981 An array is a set of opaque values addressed by an integer index. 3982 Arrays are zero based. Note that arrays can be sparse. For 3983 instance, a Store of "X" at index 2 in an empty array produces an 3984 array with the values [ NA, NA, "X"]. Future attempts to fetch 3985 elements at index 0 or 1 will return values with "exists" set to 3986 False. 3988 A array element is represented as an ArrayEntry: 3990 struct { 3991 uint32 index; 3992 DataValue value; 3993 } ArrayEntry; 3995 The contents of this structure are: 3997 index 3998 The index of the data element in the array. 4000 value 4001 The stored data. 4003 7.2.3. Dictionary 4005 A dictionary is a set of opaque values indexed by an opaque key with 4006 one value for each key. A single dictionary entry is represented as 4007 follows: 4009 A dictionary element is represented as a DictionaryEntry: 4011 typedef opaque DictionaryKey<0..2^16-1>; 4013 struct { 4014 DictionaryKey key; 4015 DataValue value; 4016 } DictionaryEntry; 4018 The contents of this structure are: 4020 key 4021 The dictionary key for this value. 4023 value 4024 The stored data. 4026 7.3. Access Control Policies 4028 Every Kind which is storable in an overlay MUST be associated with an 4029 access control policy. This policy defines whether a request from a 4030 given node to operate on a given value should succeed or fail. It is 4031 anticipated that only a small number of generic access control 4032 policies are required. To that end, this section describes a small 4033 set of such policies and Section 14.4 establishes a registry for new 4034 policies if required. Each policy has a short string identifier 4035 which is used to reference it in the configuration document. 4037 In the following policies, the term "signer" refers to the signer of 4038 the StoredValue object and, in the case of non-replica stores, to the 4039 signer of the StoreReq message. I.e., in a non-replica store, both 4040 the signer of the StoredValue and the signer of the StoreReq MUST 4041 conform to the policy. In the case of a replica store, the signer of 4042 the StoredValue MUST conform to the policy and the StoreReq itself 4043 MUST be checked as described in Section 7.4.1.1. 4045 7.3.1. USER-MATCH 4047 In the USER-MATCH policy, a given value MUST be written (or 4048 overwritten) if and only if the signer's certificate has a user name 4049 which hashes (using the hash function for the overlay) to the 4050 Resource-ID for the resource. Recall that the certificate may, 4051 depending on the overlay configuration, be self-signed. 4053 7.3.2. NODE-MATCH 4055 In the NODE-MATCH policy, a given value MUST be written (or 4056 overwritten) if and only if the signer's certificate has a specified 4057 Node-ID which hashes (using the hash function for the overlay) to the 4058 Resource-ID for the resource and that Node-ID is the one indicated in 4059 the SignerIdentity value cert_hash. 4061 7.3.3. USER-NODE-MATCH 4063 The USER-NODE-MATCH policy may only be used with dictionary types. 4064 In the USER-NODE-MATCH policy, a given value MUST be written (or 4065 overwritten) if and only if the signer's certificate has a user name 4066 which hashes (using the hash function for the overlay) to the 4067 Resource-ID for the resource. In addition, the dictionary key MUST 4068 be equal to the Node-ID in the certificate and that Node-ID MUST be 4069 the one indicated in the SignerIdentity value cert_hash. 4071 7.3.4. NODE-MULTIPLE 4073 In the NODE-MULTIPLE policy, a given value MUST be written (or 4074 overwritten) if and only if signer's certificate contains a Node-ID 4075 such that H(Node-ID || i) is equal to the Resource-ID for some small 4076 integer value of i and that Node-ID is the one indicated in the 4077 SignerIdentity value cert_hash. When this policy is in use, the 4078 maximum value of i MUST be specified in the Kind definition. 4080 Note that as i is not carried on the wire, the verifier MUST iterate 4081 through potential i values up to the maximum value in order to 4082 determine whether a store is acceptable. 4084 7.4. Data Storage Methods 4086 RELOAD provides several methods for storing and retrieving data: 4088 o Store values in the overlay 4089 o Fetch values from the overlay 4090 o Stat: get metadata about values in the overlay 4091 o Find the values stored at an individual peer 4093 These methods are each described in the following sections. 4095 7.4.1. Store 4097 The Store method is used to store data in the overlay. The format of 4098 the Store request depends on the data model which is determined by 4099 the Kind. 4101 7.4.1.1. Request Definition 4103 A StoreReq message is a sequence of StoreKindData values, each of 4104 which represents a sequence of stored values for a given Kind. The 4105 same Kind-ID MUST NOT be used twice in a given store request. Each 4106 value is then processed in turn. These operations MUST be atomic. 4107 If any operation fails, the state MUST be rolled back to before the 4108 request was received. 4110 The store request is defined by the StoreReq structure: 4112 struct { 4113 KindId kind; 4114 uint64 generation_counter; 4115 StoredData values<0..2^32-1>; 4116 } StoreKindData; 4118 struct { 4119 ResourceId resource; 4120 uint8 replica_number; 4121 StoreKindData kind_data<0..2^32-1>; 4122 } StoreReq; 4124 A single Store request stores data of a number of kinds to a single 4125 resource location. The contents of the structure are: 4127 resource 4128 The resource to store at. 4130 replica_number 4131 The number of this replica. When a storing peer saves replicas to 4132 other peers each peer is assigned a replica number starting from 1 4133 and sent in the Store message. This field is set to 0 when a node 4134 is storing its own data. This allows peers to distinguish replica 4135 writes from original writes. 4137 kind_data 4138 A series of elements, one for each Kind of data to be stored. 4140 If the replica number is zero, then the peer MUST check that it is 4141 responsible for the resource and, if not, reject the request. If the 4142 replica number is nonzero, then the peer MUST check that it expects 4143 to be a replica for the resource and that the request sender is 4144 consistent with being the responsible node (i.e., that the receiving 4145 peer does not know of a better node) and, if not, reject the request. 4147 Each StoreKindData element represents the data to be stored for a 4148 single Kind-ID. The contents of the element are: 4150 kind 4151 The Kind-ID. Implementations MUST reject requests corresponding 4152 to unknown Kinds. 4154 generation_counter 4155 The expected current state of the generation counter 4156 (approximately the number of times this object has been written; 4157 see below for details). 4159 values 4160 The value or values to be stored. This may contain one or more 4161 stored_data values depending on the data model associated with 4162 each Kind. 4164 The peer MUST perform the following checks: 4166 o The Kind-ID is known and supported. 4167 o The signatures over each individual data element (if any) are 4168 valid. If this check fails, the request MUST be rejected with an 4169 Error_Forbidden error. 4170 o Each element is signed by a credential which is authorized to 4171 write this Kind at this Resource-ID. If this check fails, the 4172 request MUST be rejected with an Error_Forbidden error. 4174 o For original (non-replica) stores, the StoreReq is signed by a 4175 credential which is authorized to write this Kind at this 4176 Resource-Id. If this check fails, the request MUST be rejected 4177 with an Error_Forbidden error. 4178 o For replica stores, the StoreReq is signed by a Node-Id which is a 4179 plausible node to either have originally stored the value or in 4180 the replica set. What this means is overlay specific, but in the 4181 case of the Chord based DHT defined in this specification, replica 4182 StoreReqs MUST come from nodes which are either in the known 4183 replica set for a given resource or which are closer than some 4184 node in the replica set. If this check fails, the request MUST be 4185 rejected with an Error_Forbidden error. 4186 o For original (non-replica) stores, the peer MUST check that if the 4187 generation counter is non-zero, it equals the current value of the 4188 generation counter for this Kind. This feature allows the 4189 generation counter to be used in a way similar to the HTTP Etag 4190 feature. 4191 o For replica Stores, the peer MUST set the generation counter to 4192 match the generation counter in the message, and MUST NOT check 4193 the generation counter against the current value. Replica Stores 4194 MUST NOT use a generation counter of 0. 4195 o The storage time values are greater than that of any value which 4196 would be replaced by this Store. 4197 o The size and number of the stored values is consistent with the 4198 limits specified in the overlay configuration. 4199 o If the data is signed with identity_type set to "none" and/or 4200 SignatureAndHashAlgorithm values set to {0, 0} ("anonymous" and 4201 "none"), the StoreReq MUST be rejected with an Error_forbidden 4202 error. Only synthesized data returned by the storage can use 4203 these values 4205 If all these checks succeed, the peer MUST attempt to store the data 4206 values. For non-replica stores, if the store succeeds and the data 4207 is changed, then the peer MUST increase the generation counter by at 4208 least one. If there are multiple stored values in a single 4209 StoreKindData, it is permissible for the peer to increase the 4210 generation counter by only 1 for the entire Kind-ID, or by 1 or more 4211 than one for each value. Accordingly, all stored data values MUST 4212 have a generation counter of 1 or greater. 0 is used in the Store 4213 request to indicate that the generation counter should be ignored for 4214 processing this request; however the responsible peer should increase 4215 the stored generation counter and should return the correct 4216 generation counter in the response. 4218 When a peer stores data previously stored by another node (e.g., for 4219 replicas or topology shifts) it MUST adjust the lifetime value 4220 downward to reflect the amount of time the value was stored at the 4221 peer. The adjustment SHOULD be implemented by an algorithm 4222 equivalent to the following: at the time the peer initially receives 4223 the StoreReq it notes the local time T. When it then attempts to do a 4224 StoreReq to another node it should decrement the lifetime value by 4225 the difference between the current local time and T. 4227 Unless otherwise specified by the usage, if a peer attempts to store 4228 data previously stored by another node (e.g., for replicas or 4229 topology shifts) and that store fails with either an 4230 Error_Generation_Counter_Too_Low or an Error_Data_Too old error, the 4231 peer MUST fetch the newer data from the peer generating the error and 4232 use that to replace its own copy. This rule allows resynchronization 4233 after partitions heal. 4235 The properties of stores for each data model are as follows: 4237 Single-value: 4238 A store of a new single-value element creates the element if it 4239 does not exist and overwrites any existing value with the new 4240 value. 4242 Array: 4243 A store of an array entry replaces (or inserts) the given value at 4244 the location specified by the index. Because arrays are sparse, a 4245 store past the end of the array extends it with nonexistent values 4246 (exists=False) as required. A store at index 0xffffffff places 4247 the new value at the end of the array regardless of the length of 4248 the array. The resulting StoredData has the correct index value 4249 when it is subsequently fetched. 4251 Dictionary: 4252 A store of a dictionary entry replaces (or inserts) the given 4253 value at the location specified by the dictionary key. 4255 The following figure shows the relationship between these structures 4256 for an example store which stores the following values at resource 4257 "1234" 4259 o The value "abc" in the single value location for Kind X 4260 o The value "foo" at index 0 in the array for Kind Y 4261 o The value "bar" at index 1 in the array for Kind Y 4262 Store 4263 resource=1234 4264 replica_number = 0 4265 / \ 4266 / \ 4267 StoreKindData StoreKindData 4268 kind=X (Single-Value) kind=Y (Array) 4269 generation_counter = 99 generation_counter = 107 4270 | /\ 4271 | / \ 4272 StoredData / \ 4273 storage_time = xxxxxxx / \ 4274 lifetime = 86400 / \ 4275 signature = XXXX / \ 4276 | | | 4277 | StoredData StoredData 4278 | storage_time = storage_time = 4279 | yyyyyyyy zzzzzzz 4280 | lifetime = 86400 lifetime = 33200 4281 | signature = YYYY signature = ZZZZ 4282 | | | 4283 StoredDataValue | | 4284 value="abc" | | 4285 | | 4286 StoredDataValue StoredDataValue 4287 index=0 index=1 4288 value="foo" value="bar" 4290 7.4.1.2. Response Definition 4292 In response to a successful Store request the peer MUST return a 4293 StoreAns message containing a series of StoreKindResponse elements 4294 containing the current value of the generation counter for each 4295 Kind-ID, as well as a list of the peers where the data will be 4296 replicated by the node processing the request. 4298 struct { 4299 KindId kind; 4300 uint64 generation_counter; 4301 NodeId replicas<0..2^16-1>; 4302 } StoreKindResponse; 4304 struct { 4305 StoreKindResponse kind_responses<0..2^16-1>; 4306 } StoreAns; 4308 The contents of each StoreKindResponse are: 4310 kind 4311 The Kind-ID being represented. 4313 generation_counter 4314 The current value of the generation counter for that Kind-ID. 4316 replicas 4317 The list of other peers at which the data was/will be replicated. 4318 In overlays and applications where the responsible peer is 4319 intended to store redundant copies, this allows the storing peer 4320 to independently verify that the replicas have in fact been 4321 stored. It does this verification by using the Stat method (see 4322 Section 7.4.3). Note that the storing peer is not required to 4323 perform this verification. 4325 The response itself is just StoreKindResponse values packed end-to- 4326 end. 4328 If any of the generation counters in the request precede the 4329 corresponding stored generation counter, then the peer MUST fail the 4330 entire request and respond with an Error_Generation_Counter_Too_Low 4331 error. The error_info in the ErrorResponse MUST be a StoreAns 4332 response containing the correct generation counter for each Kind and 4333 the replica list, which will be empty. For original (non-replica) 4334 stores, a node which receives such an error SHOULD attempt to fetch 4335 the data and, if the storage_time value is newer, replace its own 4336 data with that newer data. This rule improves data consistency in 4337 the case of partitions and merges. 4339 If the data being stored is too large for the allowed limit by the 4340 given usage, then the peer MUST fail the request and generate an 4341 Error_Data_Too_Large error. 4343 If any type of request tries to access a data Kind that the node does 4344 not know about, an Error_Unknown_Kind MUST be generated. The 4345 error_info in the Error_Response is: 4347 KindId unknown_kinds<0..2^8-1>; 4349 which lists all the Kinds that were unrecognized. A node which 4350 receives this error MUST generate a ConfigUpdate message which 4351 contains the appropriate Kind definition (assuming that in fact a 4352 Kind was used which was defined in the configuration document). 4354 7.4.1.3. Removing Values 4356 RELOAD does not have an explicit Remove operation. Rather, values 4357 are Removed by storing "nonexistent" values in their place. Each 4358 DataValue contains a boolean value called "exists" which indicates 4359 whether a value is present at that location. In order to effectively 4360 remove a value, the owner stores a new DataValue with "exists" set to 4361 "false": 4363 exists = false 4364 value = {} (0 length) 4366 The owner SHOULD use a lifetime for the nonexistent value at least as 4367 long as the remainder of the lifetime of the value it is replacing; 4368 otherwise it is possible for the original value to be accidentally or 4369 maliciously re-stored after the storing node has expired it. Note 4370 that there is still a window of vulnerability for replay attack after 4371 the original lifetime has expired (as with any store). This attack 4372 can be mitigated by doing a nonexistent store with a very long 4373 lifetime. 4375 Storing nodes MUST treat these nonexistent values the same way they 4376 treat any other stored value, including overwriting the existing 4377 value, replicating them, and aging them out as necessary when 4378 lifetime expires. When a stored nonexistent value's lifetime 4379 expires, it is simply removed from the storing node like any other 4380 stored value expiration. 4382 Note that in the case of arrays and dictionaries, expiration may 4383 create an implicit, unsigned "nonexistent" value to represent a gap 4384 in the data structure, as might happen when any value is aged out. 4385 However, this value isn't persistent nor is it replicated. It is 4386 simply synthesized by the storing node. 4388 7.4.2. Fetch 4390 The Fetch request retrieves one or more data elements stored at a 4391 given Resource-ID. A single Fetch request can retrieve multiple 4392 different Kinds. 4394 7.4.2.1. Request Definition 4396 struct { 4397 int32 first; 4398 int32 last; 4399 } ArrayRange; 4401 struct { 4402 KindId kind; 4403 uint64 generation; 4404 uint16 length; 4406 select (dataModel) { 4407 case single_value: ; /* Empty */ 4409 case array: 4410 ArrayRange indices<0..2^16-1>; 4412 case dictionary: 4413 DictionaryKey keys<0..2^16-1>; 4415 /* This structure may be extended */ 4417 } model_specifier; 4418 } StoredDataSpecifier; 4420 struct { 4421 ResourceId resource; 4422 StoredDataSpecifier specifiers<0..2^16-1>; 4423 } FetchReq; 4425 The contents of the Fetch requests are as follows: 4427 resource 4428 The Resource-ID to fetch from. 4430 specifiers 4431 A sequence of StoredDataSpecifier values, each specifying some of 4432 the data values to retrieve. 4434 Each StoredDataSpecifier specifies a single Kind of data to retrieve 4435 and (if appropriate) the subset of values that are to be retrieved. 4436 The contents of the StoredDataSpecifier structure are as follows: 4438 kind 4439 The Kind-ID of the data being fetched. Implementations SHOULD 4440 reject requests corresponding to unknown Kinds unless specifically 4441 configured otherwise. 4443 dataModel 4444 The data model of the data. This is not transmitted on the wire 4445 but comes from the definition of the Kind. 4447 generation 4448 The last generation counter that the requesting node saw. This 4449 may be used to avoid unnecessary fetches or it may be set to zero. 4451 length 4452 The length of the rest of the structure, thus allowing 4453 extensibility. 4455 model_specifier 4456 A reference to the data value being requested within the data 4457 model specified for the Kind. For instance, if the data model is 4458 "array", it might specify some subset of the values. 4460 The model_specifier is as follows: 4462 o If the data model is single value, the specifier is empty. 4463 o If the data model is array, the specifier contains a list of 4464 ArrayRange elements, each of which contains two integers. The 4465 first integer is the beginning of the range and the second is the 4466 end of the range. 0 is used to indicate the first element and 4467 0xffffffff is used to indicate the final element. The first 4468 integer MUST be less than the second. While multiple ranges MAY 4469 be specified, they MUST NOT overlap. 4470 o If the data model is dictionary then the specifier contains a list 4471 of the dictionary keys being requested. If no keys are specified, 4472 than this is a wildcard fetch and all key-value pairs are 4473 returned. 4475 The generation counter is used to indicate the requester's expected 4476 state of the storing peer. If the generation counter in the request 4477 matches the stored counter, then the storing peer returns a response 4478 with no StoredData values. 4480 Note that because the certificate for a user is typically stored at 4481 the same location as any data stored for that user, a requesting node 4482 that does not already have the user's certificate should request the 4483 certificate in the Fetch as an optimization. 4485 7.4.2.2. Response Definition 4487 The response to a successful Fetch request is a FetchAns message 4488 containing the data requested by the requester. 4490 struct { 4491 KindId kind; 4492 uint64 generation; 4493 StoredData values<0..2^32-1>; 4494 } FetchKindResponse; 4496 struct { 4497 FetchKindResponse kind_responses<0..2^32-1>; 4498 } FetchAns; 4500 The FetchAns structure contains a series of FetchKindResponse 4501 structures. There MUST be one FetchKindResponse element for each 4502 Kind-ID in the request. 4504 The contents of the FetchKindResponse structure are as follows: 4506 kind 4507 the Kind that this structure is for. 4509 generation 4510 the generation counter for this Kind. 4512 values 4513 the relevant values. If the generation counter in the request 4514 matches the generation counter in the stored data, then no 4515 StoredData values are returned. Otherwise, all relevant data 4516 values MUST be returned. A nonexistent value (i.e., one which the 4517 node has no knowledge of) is represented by a synthetic value with 4518 "exists" set to False and has an empty signature. Specifically, 4519 the identity_type is set to "none", the SignatureAndHashAlgorithm 4520 values are set to {0, 0} ("anonymous" and "none" respectively), 4521 and the signature value is of zero length. This removes the need 4522 for the responding node to do signatures for values which do not 4523 exist. These signatures are unnecessary as the entire response is 4524 signed by that node. Note that entries which have been removed by 4525 the procedure of Section 7.4.1.3 and have not yet expired also 4526 have exists = false but have valid signatures from the node which 4527 did the store. 4529 Upon receipt of a FetchAns message, nodes MUST verify the signatures 4530 on all the received values. Any values with invalid signatures 4531 (including expired certificates) MUST be discarded. Note that this 4532 implies that implementations which wish to store data for long 4533 periods of time must have certificates with appropriate expiry dates 4534 or re-store periodically. Implementations MAY return the subset of 4535 values with valid signatures, but in that case SHOULD somehow signal 4536 to the application that a partial response was received. 4538 There is one subtle point about signature computation on arrays. If 4539 the storing node uses the append feature (where the 4540 index=0xffffffff), then the index in the StoredData that is returned 4541 will not match that used by the storing node, which would break the 4542 signature. In order to avoid this issue, the index value in the 4543 array is set to zero before the signature is computed. This implies 4544 that malicious storing nodes can reorder array entries without being 4545 detected. 4547 7.4.3. Stat 4549 The Stat request is used to get metadata (length, generation counter, 4550 digest, etc.) for a stored element without retrieving the element 4551 itself. The name is from the UNIX stat(2) system call which performs 4552 a similar function for files in a file system. It also allows the 4553 requesting node to get a list of matching elements without requesting 4554 the entire element. 4556 7.4.3.1. Request Definition 4558 The Stat request is identical to the Fetch request. It simply 4559 specifies the elements to get metadata about. 4561 struct { 4562 ResourceId resource; 4563 StoredDataSpecifier specifiers<0..2^16-1>; 4564 } StatReq; 4566 7.4.3.2. Response Definition 4568 The Stat response contains the same sort of entries that a Fetch 4569 response would contain; however, instead of containing the element 4570 data it contains metadata. 4572 struct { 4573 Boolean exists; 4574 uint32 value_length; 4575 HashAlgorithm hash_algorithm; 4576 opaque hash_value<0..255>; 4577 } MetaData; 4579 struct { 4580 uint32 index; 4581 MetaData value; 4582 } ArrayEntryMeta; 4584 struct { 4585 DictionaryKey key; 4586 MetaData value; 4587 } DictionaryEntryMeta; 4589 struct { 4590 select (model) { 4591 case single_value: 4592 MetaData single_value_entry; 4594 case array: 4595 ArrayEntryMeta array_entry; 4597 case dictionary: 4598 DictionaryEntryMeta dictionary_entry; 4600 /* This structure may be extended */ 4601 }; 4602 } MetaDataValue; 4604 struct { 4605 uint32 value_length; 4606 uint64 storage_time; 4607 uint32 lifetime; 4608 MetaDataValue metadata; 4609 } StoredMetaData; 4611 struct { 4612 KindId kind; 4613 uint64 generation; 4614 StoredMetaData values<0..2^32-1>; 4615 } StatKindResponse; 4617 struct { 4618 StatKindResponse kind_responses<0..2^32-1>; 4619 } StatAns; 4621 The structures used in StatAns parallel those used in FetchAns: a 4622 response consists of multiple StatKindResponse values, one for each 4623 kind that was in the request. The contents of the StatKindResponse 4624 are the same as those in the FetchKindResponse, except that the 4625 values list contains StoredMetaData entries instead of StoredData 4626 entries. 4628 The contents of the StoredMetaData structure are the same as the 4629 corresponding fields in StoredData except that there is no signature 4630 field and the value is a MetaDataValue rather than a StoredDataValue. 4632 A MetaDataValue is a variant structure, like a StoredDataValue, 4633 except for the types of each arm, which replace DataValue with 4634 MetaData. 4636 The only really new structure is MetaData, which has the following 4637 contents: 4639 exists 4640 Same as in DataValue 4642 value_length 4643 The length of the stored value. 4645 hash_algorithm 4646 The hash algorithm used to perform the digest of the value. 4648 hash_value 4649 A digest of the value using hash_algorithm. 4651 7.4.4. Find 4653 The Find request can be used to explore the Overlay Instance. A Find 4654 request for a Resource-ID R and a Kind-ID T retrieves the Resource-ID 4655 (if any) of the resource of kind T known to the target peer which is 4656 closest to R. This method can be used to walk the Overlay Instance by 4657 iteratively fetching R_n+1=nearest(1 + R_n). 4659 7.4.4.1. Request Definition 4661 The FindReq message contains a Resource-ID and a series of Kind-IDs 4662 identifying the resource the peer is interested in. 4664 struct { 4665 ResourceId resource; 4666 KindId kinds<0..2^8-1>; 4667 } FindReq; 4669 The request contains a list of Kind-IDs which the Find is for, as 4670 indicated below: 4672 resource 4673 The desired Resource-ID 4675 kinds 4676 The desired Kind-IDs. Each value MUST only appear once, and if 4677 not the request MUST be rejected with an error. 4679 7.4.4.2. Response Definition 4681 A response to a successful Find request is a FindAns message 4682 containing the closest Resource-ID on the peer for each kind 4683 specified in the request. 4685 struct { 4686 KindId kind; 4687 ResourceId closest; 4688 } FindKindData; 4690 struct { 4691 FindKindData results<0..2^16-1>; 4692 } FindAns; 4694 If the processing peer is not responsible for the specified 4695 Resource-ID, it SHOULD return an Error_Not_Found error code. 4697 For each Kind-ID in the request the response MUST contain a 4698 FindKindData indicating the closest Resource-ID for that Kind-ID, 4699 unless the kind is not allowed to be used with Find in which case a 4700 FindKindData for that Kind-ID MUST NOT be included in the response. 4701 If a Kind-ID is not known, then the corresponding Resource-ID MUST be 4702 0. Note that different Kind-IDs may have different closest Resource- 4703 IDs. 4705 The response is simply a series of FindKindData elements, one per 4706 kind, concatenated end-to-end. The contents of each element are: 4708 kind 4709 The Kind-ID. 4711 closest 4712 The closest resource ID to the specified resource ID. This is 0 4713 if no resource ID is known. 4715 Note that the response does not contain the contents of the data 4716 stored at these Resource-IDs. If the requester wants this, it must 4717 retrieve it using Fetch. 4719 7.4.5. Defining New Kinds 4721 There are two ways to define a new Kind. The first is by writing a 4722 document and registering the Kind-ID with IANA. This is the 4723 preferred method for Kinds which may be widely used and reused. The 4724 second method is to simply define the Kind and its parameters in the 4725 configuration document using the section of Kind-id space set aside 4726 for private use. This method MAY be used to define ad hoc Kinds in 4727 new overlays. 4729 However a Kind is defined, the definition MUST include: 4731 o The meaning of the data to be stored (in some textual form). 4732 o The Kind-ID. 4733 o The data model (single value, array, dictionary, etc). 4734 o The access control model. 4736 In addition, when Kinds are registered with IANA, each Kind is 4737 assigned a short string name which is used to refer to it in 4738 configuration documents. 4740 While each Kind needs to define what data model is used for its data, 4741 that does not mean that it must define new data models. Where 4742 practical, Kinds should use the existing data models. The intention 4743 is that the basic data model set be sufficient for most applications/ 4744 usages. 4746 8. Certificate Store Usage 4748 The Certificate Store usage allows a peer to store its certificate in 4749 the overlay, thus avoiding the need to send a certificate in each 4750 message. 4752 A user/peer MUST store its certificate at Resource-IDs derived from 4753 two Resource Names: 4755 o The user name in the certificate. 4757 o The Node-ID in the certificate. 4759 Note that in the second case the certificate is not stored at the 4760 peer's Node-ID but rather at a hash of the peer's Node-ID. The 4761 intention here (as is common throughout RELOAD) is to avoid making a 4762 peer responsible for its own data. 4764 A peer MUST ensure that the user's certificates are stored in the 4765 Overlay Instance. New certificates are stored at the end of the 4766 list. This structure allows users to store an old and a new 4767 certificate that both have the same Node-ID, which allows for 4768 migration of certificates when they are renewed. 4770 This usage defines the following Kinds: 4772 Name: CERTIFICATE_BY_NODE 4774 Data Model: The data model for CERTIFICATE_BY_NODE data is array. 4776 Access Control: NODE-MATCH. 4778 Name: CERTIFICATE_BY_USER 4780 Data Model: The data model for CERTIFICATE_BY_USER data is array. 4782 Access Control: USER-MATCH. 4784 9. TURN Server Usage 4786 The TURN server usage allows a RELOAD peer to advertise that it is 4787 prepared to be a TURN server as defined in [RFC5766]. When a node 4788 starts up, it joins the overlay network and forms several connections 4789 in the process. If the ICE stage in any of these connections returns 4790 a reflexive address that is not the same as the peer's perceived 4791 address, then the peer is behind a NAT and SHOULD NOT be a candidate 4792 for a TURN server. Additionally, if the peer's IP address is in the 4793 private address space range as defined by [RFC1918], then it is also 4794 SHOULD NOT be a candidate for a TURN server. Otherwise, the peer 4795 SHOULD assume it is a potential TURN server and follow the procedures 4796 below. 4798 If the node is a candidate for a TURN server it will insert some 4799 pointers in the overlay so that other peers can find it. The overlay 4800 configuration file specifies a turn-density parameter that indicates 4801 how many times each TURN server SHOULD record itself in the overlay. 4803 Typically this should be set to the reciprocal of the estimate of 4804 what percentage of peers will act as TURN servers. If the turn- 4805 density is not set to zero, for each value, called d, between 1 and 4806 turn-density, the peer forms a Resource Name by concatenating its 4807 Node-ID and the value d. This Resource Name is hashed to form a 4808 Resource-ID. The address of the peer is stored at that Resource-ID 4809 using type TURN-SERVICE and the TurnServer object: 4811 struct { 4812 uint8 iteration; 4813 IpAddressAndPort server_address; 4814 } TurnServer; 4816 The contents of this structure are as follows: 4818 iteration 4819 the d value 4821 server_address 4822 the address at which the TURN server can be contacted. 4824 Note: Correct functioning of this algorithm depends on having turn- 4825 density be an reasonable estimate of the reciprocal of the 4826 proportion of nodes in the overlay that can act as TURN servers. 4827 If the turn-density value in the configuration file is too low, 4828 then the process of finding TURN servers becomes more expensive as 4829 multiple candidate Resource-IDs must be probed to find a TURN 4830 server. 4832 Peers that provide this service need to support the TURN extensions 4833 to STUN for media relay as defined in [RFC5766]. 4835 This usage defines the following Kind to indicate that a peer is 4836 willing to act as a TURN server: 4838 Name TURN-SERVICE 4839 Data Model The TURN-SERVICE Kind stores a single value for each 4840 Resource-ID. 4841 Access Control NODE-MULTIPLE, with maximum iteration counter 20. 4843 Peers MAY find other servers by selecting a random Resource-ID and 4844 then doing a Find request for the appropriate Kind-ID with that 4845 Resource-ID. The Find request gets routed to a random peer based on 4846 the Resource-ID. If that peer knows of any servers, they will be 4847 returned. The returned response may be empty if the peer does not 4848 know of any servers, in which case the process gets repeated with 4849 some other random Resource-ID. As long as the ratio of servers 4850 relative to peers is not too low, this approach will result in 4851 finding a server relatively quickly. 4853 NOTE TO IMPLEMENTERS: As the access control for this usage is not 4854 CERTIFICATE_BY_NODE or CERTIFICATE_BY_USER, the certificates used by 4855 TurnServer entries need to be retained as described in Section 6.3.4. 4857 10. Chord Algorithm 4859 This algorithm is assigned the name CHORD-RELOAD to indicate it is an 4860 adaptation of the basic Chord based DHT algorithm. 4862 This algorithm differs from the originally presented Chord algorithm 4863 [Chord]. It has been updated based on more recent research results 4864 and implementation experiences, and to adapt it to the RELOAD 4865 protocol. A short list of differences: 4867 o The original Chord algorithm specified that a single predecessor 4868 and a successor list be stored. The CHORD-RELOAD algorithm 4869 attempts to have more than one predecessor and successor. The 4870 predecessor sets help other neighbors learn their successor list. 4871 o The original Chord specification and analysis called for iterative 4872 routing. RELOAD specifies recursive routing. In addition to the 4873 performance implications, the cost of NAT traversal dictates 4874 recursive routing. 4875 o Finger table entries are indexed in opposite order. Original 4876 Chord specifies finger[0] as the immediate successor of the peer. 4877 CHORD-RELOAD specifies finger[0] as the peer 180 degrees around 4878 the ring from the peer. This change was made to simplify 4879 discussion and implementation of variable sized finger tables. 4880 However, with either approach no more than O(log N) entries should 4881 typically be stored in a finger table. 4882 o The stabilize() and fix_fingers() algorithms in the original Chord 4883 algorithm are merged into a single periodic process. 4884 Stabilization is implemented slightly differently because of the 4885 larger neighborhood, and fix_fingers is not as aggressive to 4886 reduce load, nor does it search for optimal matches of the finger 4887 table entries. 4888 o RELOAD allows for a 128 bit hash instead of a 160 bit hash, as 4889 RELOAD is not designed to be used in networks with close to or 4890 more than 2^128 nodes or objects (and it is hard to see how one 4891 would assemble such a network). 4892 o RELOAD uses randomized finger entries as described in 4893 Section 10.7.4.2. 4894 o This algorithm allows the use of either reactive or periodic 4895 recovery. The original Chord paper used periodic recovery. 4896 Reactive recovery provides better performance in small overlays, 4897 but is believed to be unstable in large (>1000) overlays with high 4898 levels of churn [handling-churn-usenix04]. The overlay 4899 configuration file specifies a "chord-reactive" element that 4900 indicates whether reactive recovery should be used. 4902 10.1. Overview 4904 The algorithm described here is a modified version of the Chord 4905 algorithm. In Chord (and in the algorithm described here), nodes are 4906 arranged in a ring with node n being adjacent to nodes n-1 and n+1, 4907 with all arithmetic being done modulo 2^{k}, where k is the length of 4908 the Node-Id in bits, so that node 2^{k} - 1 is directly before node 4909 0. 4911 Each peer keeps track of a finger table and a neighbor table. The 4912 neighbor table contains at least the three peers before and after 4913 this peer in the DHT ring. There may not be three entries in all 4914 cases such as small rings or while the ring topology is changing. 4915 The first entry in the finger table contains the peer half-way around 4916 the ring from this peer; the second entry contains the peer that is 4917 1/4 of the way around; the third entry contains the peer that is 4918 1/8th of the way around, and so on. Fundamentally, the chord DHT can 4919 be thought of a doubly-linked list formed by knowing the successors 4920 and predecessor peers in the neighbor table, sorted by the Node-ID. 4921 As long as the successor peers are correct, the DHT will return the 4922 correct result. The pointers to the prior peers are kept to enable 4923 the insertion of new peers into the list structure. Keeping multiple 4924 predecessor and successor pointers makes it possible to maintain the 4925 integrity of the data structure even when consecutive peers 4926 simultaneously fail. The finger table forms a skip list, so that 4927 entries in the linked list can be found in O(log(N)) time instead of 4928 the typical O(N) time that a linked list would provide where N 4929 represents the number of nodes in the DHT. 4931 The neighbor and finger table entries contain logical Node-IDs as 4932 values but the actual mapping of an IP level addressing information 4933 to reach that Node-ID is kept in the connection table. 4935 A peer, x, is responsible for a particular Resource-ID k if k is less 4936 than or equal to x and k is greater than p, where p is the Node-ID of 4937 the previous peer in the neighbor table. Care must be taken when 4938 computing to note that all math is modulo 2^128. 4940 10.2. Hash Function 4942 For this Chord based topology plugin, the size of the Resource-ID is 4943 128 bits. The hash of a Resource-ID MUST be computed using SHA-1 4944 [RFC3174]then truncating the SHA-1 result to the most significant 128 4945 bits. 4947 10.3. Routing 4949 The routing table is conceptually the union of the neighbor table and 4950 the finger table. 4952 If a peer is not responsible for a Resource-ID k, but is directly 4953 connected to a node with Node-ID k, then it MUST route the message to 4954 that node. Otherwise, it MUST route the request to the peer in the 4955 routing table that has the largest Node-ID that is in the interval 4956 between the peer and k. If no such node is found, it finds the 4957 smallest Node-Id that is greater than k and MUST route the message to 4958 that node. 4960 10.4. Redundancy 4962 When a peer receives a Store request for Resource-ID k, and it is 4963 responsible for Resource-ID k, it MUST store the data and returns a 4964 success response. It MUST then send a Store request to its successor 4965 in the neighbor table and to that peer's successor. Note that these 4966 Store requests are addressed to those specific peers, even though the 4967 Resource-ID they are being asked to store is outside the range that 4968 they are responsible for. The peers receiving these SHOULD check 4969 they came from an appropriate predecessor in their neighbor table and 4970 that they are in a range that this predecessor is responsible for, 4971 and then they MUST store the data. They do not themselves perform 4972 further Stores because they can determine that they are not 4973 responsible for the Resource-ID. 4975 Managing replicas as the overlay changes is described in 4976 Section 10.7.3. 4978 The sequential replicas used in this overlay algorithm protect 4979 against peer failure but not against malicious peers. Additional 4980 replication from the Usage is required to protect resources from such 4981 attacks, as discussed in Section 13.5.4. 4983 10.5. Joining 4985 The join process for a joining party (JP) with Node-ID n is as 4986 follows. 4988 1. JP MUST connect to its chosen bootstrap node. 4989 2. JP SHOULD send an Attach request to the admitting peer (AP) for 4990 Node-ID n. The "send_update" flag can be used to acquire the 4991 routing table for AP. 4993 3. JP SHOULD send Attach requests to initiate connections to each of 4994 the peers in the neighbor table as well as to the desired finger 4995 table entries. Note that this does not populate their routing 4996 tables, but only their connection tables, so JP will not get 4997 messages that it is expected to route to other nodes. 4998 4. JP MUST enter all the peers it has successfully contacted into 4999 its routing table. 5000 5. JP MUST send a Join to AP. The AP sends the response to the 5001 Join. 5002 6. AP MUST do a series of Store requests to JP to store the data 5003 that JP will be responsible for. 5004 7. AP MUST send JP an Update explicitly labeling JP as its 5005 predecessor. At this point, JP is part of the ring and 5006 responsible for a section of the overlay. AP MAY now forget any 5007 data which is assigned to JP and not AP. AP SHOULD not forget 5008 any data where AP is the replica set for the data. 5009 8. The AP MUST send an Update to all of its neighbors with the new 5010 values of its neighbor set (including JP). 5011 9. The JP MUST send Updates to all the peers in its neighbor table. 5013 If JP sends an Attach to AP with send_update, it immediately knows 5014 most of its expected neighbors from AP's routing table update and can 5015 directly connect to them. This is the RECOMMENDED procedure. 5017 If for some reason JP does not get AP's routing table, it can still 5018 populate its neighbor table incrementally. It sends a Ping directed 5019 at Resource-ID n+1 (directly after its own Resource-ID). This allows 5020 it to discover its own successor. Call that node p0. It then sends 5021 a ping to p0+1 to discover its successor (p1). This process can be 5022 repeated to discover as many successors as desired. The values for 5023 the two peers before p will be found at a later stage when n receives 5024 an Update. An alternate procedure is to send Attaches to those nodes 5025 rather than pings, which forms the connections immediately but may be 5026 slower if the nodes need to collect ICE candidates, thus reducing 5027 parallelism. 5029 In order to set up its i'th finger table entry, JP simply sends an 5030 Attach to peer n+2^(128-i). This will be routed to a peer in 5031 approximately the right location around the ring. (Note the first 5032 entry in the finger table has i=1 and not i=0 in this formulation). 5034 The joining peer MUST NOT send any Update message placing itself in 5035 the overlay until it has successfully completed an Attach with each 5036 peer that should be in its neighbor table. 5038 10.6. Routing Attaches 5040 When a peer needs to Attach to a new peer in its neighbor table, it 5041 MUST source-route the Attach request through the peer from which it 5042 learned the new peer's Node-ID. Source-routing these requests allows 5043 the overlay to recover from instability. 5045 All other Attach requests, such as those for new finger table 5046 entries, are routed conventionally through the overlay. 5048 10.7. Updates 5050 An Update for this DHT is defined as 5052 enum { reserved (0), 5053 peer_ready(1), neighbors(2), full(3), (255) } 5054 ChordUpdateType; 5056 struct { 5057 uint32 uptime; 5058 ChordUpdateType type; 5059 select(type){ 5060 case peer_ready: /* Empty */ 5061 ; 5063 case neighbors: 5064 NodeId predecessors<0..2^16-1>; 5065 NodeId successors<0..2^16-1>; 5067 case full: 5068 NodeId predecessors<0..2^16-1>; 5069 NodeId successors<0..2^16-1>; 5070 NodeId fingers<0..2^16-1>; 5071 }; 5072 } ChordUpdate; 5074 The "uptime" field contains the time this peer has been up in 5075 seconds. 5077 The "type" field contains the type of the update, which depends on 5078 the reason the update was sent. 5080 peer_ready: this peer is ready to receive messages. This message 5081 is used to indicate that a node which has Attached is a peer and 5082 can be routed through. It is also used as a connectivity check to 5083 non-neighbor peers. 5085 neighbors: this version is sent to members of the Chord neighbor 5086 table. 5088 full: this version is sent to peers which request an Update with a 5089 RouteQueryReq. 5091 If the message is of type "neighbors", then the contents of the 5092 message will be: 5094 predecessors 5095 The predecessor set of the Updating peer. 5097 successors 5098 The successor set of the Updating peer. 5100 If the message is of type "full", then the contents of the message 5101 will be: 5103 predecessors 5104 The predecessor set of the Updating peer. 5106 successors 5107 The successor set of the Updating peer. 5109 fingers 5110 The finger table of the Updating peer, in numerically ascending 5111 order. 5113 A peer MUST maintain an association (via Attach) to every member of 5114 its neighbor set. A peer MUST attempt to maintain at least three 5115 predecessors and three successors, even though this will not be 5116 possible if the ring is very small. It is RECOMMENDED that O(log(N)) 5117 predecessors and successors be maintained in the neighbor set. 5119 10.7.1. Handling Neighbor Failures 5121 Every time a connection to a peer in the neighbor table is lost (as 5122 determined by connectivity pings or the failure of some request), the 5123 peer MUST remove the entry from its neighbor table and replace it 5124 with the best match it has from the other peers in its routing table. 5125 If using reactive recovery, it then sends an immediate Update to all 5126 nodes in its Neighbor Table. The update will contain all the Node- 5127 IDs of the current entries of the table (after the failed one has 5128 been removed). Note that when replacing a successor the peer SHOULD 5129 delay the creation of new replicas for successor replacement hold- 5130 down time (30 seconds) after removing the failed entry from its 5131 neighbor table in order to allow a triggered update to inform it of a 5132 better match for its neighbor table. 5134 If the neighbor failure affects the peer's range of responsible IDs, 5135 then the Update MUST be sent to all nodes in its Connection Table. 5137 A peer MAY attempt to reestablish connectivity with a lost neighbor 5138 either by waiting additional time to see if connectivity returns or 5139 by actively routing a new Attach to the lost peer. Details for these 5140 procedures are beyond the scope of this document. In no event does 5141 an attempt to reestablish connectivity with a lost neighbor allow the 5142 peer to remain in the neighbor table. Such a peer is returned to the 5143 neighbor table once connectivity is reestablished. 5145 If connectivity is lost to all successor peers in the neighbor table, 5146 then this peer should behave as if it is joining the network and use 5147 Pings to find a peer and send it a Join. If connectivity is lost to 5148 all the peers in the finger table, this peer should assume that it 5149 has been disconnected from the rest of the network, and it should 5150 periodically try to join the DHT. 5152 10.7.2. Handling Finger Table Entry Failure 5154 If a finger table entry is found to have failed, all references to 5155 the failed peer are removed from the finger table and replaced with 5156 the closest preceding peer from the finger table or neighbor table. 5158 If using reactive recovery, the peer initiates a search for a new 5159 finger table entry as described below. 5161 10.7.3. Receiving Updates 5163 When a peer, x, receives an Update request, it examines the Node-IDs 5164 in the UpdateReq and at its neighbor table and decides if this 5165 UpdateReq would change its neighbor table. This is done by taking 5166 the set of peers currently in the neighbor table and comparing them 5167 to the peers in the update request. There are two major cases: 5169 o The UpdateReq contains peers that match x's neighbor table, so no 5170 change is needed to the neighbor set. 5171 o The UpdateReq contains peers x does not know about that should be 5172 in x's neighbor table, i.e. they are closer than entries in the 5173 neighbor table. 5175 In the first case, no change is needed. 5177 In the second case, x MUST attempt to Attach to the new peers and if 5178 it is successful it MUST adjust its neighbor set accordingly. Note 5179 that it can maintain the now inferior peers as neighbors, but it MUST 5180 remember the closer ones. 5182 After any Pings and Attaches are done, if the neighbor table changes 5183 and the peer is using reactive recovery, the peer sends an Update 5184 request to each member of its Connection Table. These Update 5185 requests are what end up filling in the predecessor/successor tables 5186 of peers that this peer is a neighbor to. A peer MUST NOT enter 5187 itself in its successor or predecessor table and instead should leave 5188 the entries empty. 5190 If peer x is responsible for a Resource-ID R, and x discovers that 5191 the replica set for R (the next two nodes in its successor set) has 5192 changed, it MUST send a Store for any data associated with R to any 5193 new node in the replica set. It SHOULD NOT delete data from peers 5194 which have left the replica set. 5196 When a peer x detects that it is no longer in the replica set for a 5197 resource R (i.e., there are three predecessors between x and R), it 5198 SHOULD delete all data associated with R from its local store. 5200 When a peer discovers that its range of responsible IDs have changed, 5201 it MUST send an Update to all entries in its connection table. 5203 10.7.4. Stabilization 5205 There are four components to stabilization: 5206 1. exchange Updates with all peers in its neighbor table to exchange 5207 state. 5208 2. search for better peers to place in its finger table. 5209 3. search to determine if the current finger table size is 5210 sufficiently large. 5211 4. search to determine if the overlay has partitioned and needs to 5212 recover. 5214 10.7.4.1. Updating neighbor table 5216 A peer MUST periodically send an Update request to every peer in its 5217 Connection Table. The purpose of this is to keep the predecessor and 5218 successor lists up to date and to detect failed peers. The default 5219 time is about every ten minutes, but the configuration server SHOULD 5220 set this in the configuration document using the "chord-update- 5221 interval" element (denominated in seconds.) A peer SHOULD randomly 5222 offset these Update requests so they do not occur all at once. 5224 10.7.4.2. Refreshing finger table 5226 A peer MUST periodically search for new peers to replace invalid 5227 entries in the finger table. For peer x, the i'th finger table entry 5228 is valid if it is in the range [ x+2^( 128-i ), x+2^( 128-(i-1) )-1 5229 ]. Invalid entries occur in the finger table when a previous finger 5230 table entry has failed or when no peer has been found in that range. 5232 A peer SHOULD NOT send Ping requests looking for new finger table 5233 entries more often than the configuration element "chord-ping- 5234 interval", which defaults to 3600 seconds (one per hour). 5236 Two possible methods for searching for new peers for the finger table 5237 entries are presented: 5239 Alternative 1: A peer selects one entry in the finger table from 5240 among the invalid entries. It pings for a new peer for that finger 5241 table entry. The selection SHOULD be exponentially weighted to 5242 attempt to replace earlier (lower i) entries in the finger table. A 5243 simple way to implement this selection is to search through the 5244 finger table entries from i=0 and each time an invalid entry is 5245 encountered, send a Ping to replace that entry with probability 0.5. 5247 Alternative 2: A peer monitors the Update messages received from its 5248 connections to observe when an Update indicates a peer that would be 5249 used to replace in invalid finger table entry, i, and flags that 5250 entry in the finger table. Every "chord-ping-interval" seconds, the 5251 peer selects from among those flagged candidates using an 5252 exponentially weighted probability as above. 5254 When searching for a better entry, the peer SHOULD send the Ping to a 5255 Node-ID selected randomly from that range. Random selection is 5256 preferred over a search for strictly spaced entries to minimize the 5257 effect of churn on overlay routing [minimizing-churn-sigcomm06]. An 5258 implementation or subsequent specification MAY choose a method for 5259 selecting finger table entries other than choosing randomly within 5260 the range. Any such alternate methods SHOULD be employed only on 5261 finger table stabilization and not for the selection of initial 5262 finger table entries unless the alternative method is faster and 5263 imposes less overhead on the overlay. 5265 A peer MAY choose to keep connections to multiple peers that can act 5266 for a given finger table entry. 5268 10.7.4.3. Adjusting finger table size 5270 If the finger table has less than 16 entries, the node SHOULD attempt 5271 to discover more fingers to grow the size of the table to 16. The 5272 value 16 was chosen to ensure high odds of a node maintaining 5273 connectivity to the overlay even with strange network partitions. 5275 For many overlays, 16 finger table entries will be enough, but as an 5276 overlay grows very large, more than 16 entries may be required in the 5277 finger table for efficient routing. An implementation SHOULD be 5278 capable of increasing the number of entries in the finger table to 5279 128 entries. 5281 Note to implementers: Although log(N) entries are all that are 5282 required for optimal performance, careful implementation of 5283 stabilization will result in no additional traffic being generated 5284 when maintaining a finger table larger than log(N) entries. 5285 Implementers are encouraged to make use of RouteQuery and algorithms 5286 for determining where new finger table entries may be found. 5287 Complete details of possible implementations are outside the scope of 5288 this specification. 5290 A simple approach to sizing the finger table is to ensure the finger 5291 table is large enough to contain at least the final successor in the 5292 peer's neighbor table. 5294 10.7.4.4. Detecting partitioning 5296 To detect that a partitioning has occurred and to heal the overlay, a 5297 peer P MUST periodically repeat the discovery process used in the 5298 initial join for the overlay to locate an appropriate bootstrap node, 5299 B. P should then send a Ping for its own Node-ID routed through B. If 5300 a response is received from a peer S', which is not P's successor, 5301 then the overlay is partitioned and P should send an Attach to S' 5302 routed through B, followed by an Update sent to S'. (Note that S' 5303 may not be in P's neighbor table once the overlay is healed, but the 5304 connection will allow S' to discover appropriate neighbor entries for 5305 itself via its own stabilization.) 5307 Future specifications may describe alternative mechanisms for 5308 determining when to repeat the discovery process. 5310 10.8. Route query 5312 For this topology plugin, the RouteQueryReq contains no additional 5313 information. The RouteQueryAns contains the single node ID of the 5314 next peer to which the responding peer would have routed the request 5315 message in recursive routing: 5317 struct { 5318 NodeId next_peer; 5320 } ChordRouteQueryAns; 5322 The contents of this structure are as follows: 5324 next_peer 5325 The peer to which the responding peer would route the message in 5326 order to deliver it to the destination listed in the request. 5328 If the requester has set the send_update flag, the responder SHOULD 5329 initiate an Update immediately after sending the RouteQueryAns. 5331 10.9. Leaving 5333 To support extensions, such as [I-D.ietf-p2psip-self-tuning], Peers 5334 SHOULD send a Leave request to all members of their neighbor table 5335 prior to exiting the Overlay Instance. The overlay_specific_data 5336 field MUST contain the ChordLeaveData structure defined below: 5338 enum { reserved (0), 5339 from_succ(1), from_pred(2), (255) } 5340 ChordLeaveType; 5342 struct { 5343 ChordLeaveType type; 5345 select(type) { 5346 case from_succ: 5347 NodeId successors<0..2^16-1>; 5348 case from_pred: 5349 NodeId predecessors<0..2^16-1>; 5350 }; 5351 } ChordLeaveData; 5353 The 'type' field indicates whether the Leave request was sent by a 5354 predecessor or a successor of the recipient: 5356 from_succ 5357 The Leave request was sent by a successor. 5359 from_pred 5360 The Leave request was sent by a predecessor. 5362 If the type of the request is 'from_succ', the contents will be: 5364 successors 5365 The sender's successor list. 5367 If the type of the request is 'from_pred', the contents will be: 5369 predecessors 5370 The sender's predecessor list. 5372 Any peer which receives a Leave for a peer n in its neighbor set 5373 follows procedures as if it had detected a peer failure as described 5374 in Section 10.7.1. 5376 11. Enrollment and Bootstrap 5378 The section defines the format of the configuration data as well the 5379 process to join a new overlay. 5381 11.1. Overlay Configuration 5383 This specification defines a new content type "application/ 5384 p2p-overlay+xml" for an MIME entity that contains overlay 5385 information. An example document is shown below. 5387 5388 5391 5393 CHORD-RELOAD 5394 16 5395 5396 MIIDJDCCAo2gAwIBAgIBADANBgkqhkiG9w0BAQUFADBwMQswCQYDVQQGEwJVUzET 5397 MBEGA1UECBMKQ2FsaWZvcm5pYTERMA8GA1UEBxMIU2FuIEpvc2UxDjAMBgNVBAoT 5398 BXNpcGl0MSkwJwYDVQQLEyBTaXBpdCBUZXN0IENlcnRpZmljYXRlIEF1dGhvcml0 5399 eTAeFw0wMzA3MTgxMjIxNTJaFw0xMzA3MTUxMjIxNTJaMHAxCzAJBgNVBAYTAlVT 5400 MRMwEQYDVQQIEwpDYWxpZm9ybmlhMREwDwYDVQQHEwhTYW4gSm9zZTEOMAwGA1UE 5401 ChMFc2lwaXQxKTAnBgNVBAsTIFNpcGl0IFRlc3QgQ2VydGlmaWNhdGUgQXV0aG9y 5402 aXR5MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDDIh6DkcUDLDyK9BEUxkud 5403 +nJ4xrCVGKfgjHm6XaSuHiEtnfELHM+9WymzkBNzZpJu30yzsxwfKoIKugdNUrD4 5404 N3viCicwcN35LgP/KnbN34cavXHr4ZlqxH+OdKB3hQTpQa38A7YXdaoz6goW2ft5 5405 Mi74z03GNKP/G9BoKOGd5QIDAQABo4HNMIHKMB0GA1UdDgQWBBRrRhcU6pR2JYBU 5406 bhNU2qHjVBShtjCBmgYDVR0jBIGSMIGPgBRrRhcU6pR2JYBUbhNU2qHjVBShtqF0 5407 pHIwcDELMAkGA1UEBhMCVVMxEzARBgNVBAgTCkNhbGlmb3JuaWExETAPBgNVBAcT 5408 CFNhbiBKb3NlMQ4wDAYDVQQKEwVzaXBpdDEpMCcGA1UECxMgU2lwaXQgVGVzdCBD 5409 ZXJ0aWZpY2F0ZSBBdXRob3JpdHmCAQAwDAYDVR0TBAUwAwEB/zANBgkqhkiG9w0B 5410 AQUFAAOBgQCWbRvv1ZGTRXxbH8/EqkdSCzSoUPrs+rQqR0xdQac9wNY/nlZbkR3O 5411 qAezG6Sfmklvf+DOg5RxQq/+Y6I03LRepc7KeVDpaplMFGnpfKsibETMipwzayNQ 5412 QgUf4cKBiF+65Ue7hZuDJa2EMv8qW4twEhGDYclpFU9YozyS1OhvUg== 5413 5414 YmFkIGNlcnQK 5415 https://example.org 5416 https://example.net 5417 false 5419 5420 5421 5422 20 5423 5424 5425 false 5426 false 5427 5428 400 5429 30 5430 true 5431 password 5432 4000 5433 30 5434 3000 5435 TLS 5436 47112162e84c69ba 5437 47112162e84c69ba 5438 6eba45d31a900c06 5439 6ebc45d31a900c06 5440 6ebc45d31a900ca6 5442 foo 5444 5445 urn:ietf:params:xml:ns:p2p:config-ext1 5447 5449 5450 5451 5452 SINGLE 5453 USER-MATCH 5454 1 5455 100 5456 5457 5458 VGhpcyBpcyBub3QgcmlnaHQhCg== 5459 5460 5461 5462 5463 ARRAY 5464 NODE-MULTIPLE 5465 3 5466 22 5467 4 5468 1 5469 5470 5471 5472 VGhpcyBpcyBub3QgcmlnaHQhCg== 5473 5474 5475 5476 5477 VGhpcyBpcyBub3QgcmlnaHQhCg== 5479 5480 5481 VGhpcyBpcyBub3QgcmlnaHQhCg== 5483 5485 The file MUST be a well formed XML document and it SHOULD contain an 5486 encoding declaration in the XML declaration. The file MUST use the 5487 UTF-8 character encoding. The namespace for the elements defined in 5488 this specification is urn:ietf:params:xml:ns:p2p:config-base and 5489 urn:ietf:params:xml:ns:p2p:config-chord". 5491 The file can contain multiple "configuration" elements where each one 5492 contains the configuration information for a different overlay. Each 5493 configuration element may be followed by signature elements that 5494 provides a signature over the preceding configuration element. Each 5495 configuration element has the following attributes: 5497 instance-name: name of the overlay 5498 expiration: time in the future at which this overlay configuration 5499 is no longer valid. The node SHOULD retrieve a new copy of the 5500 configuration at a randomly selected time that is before the 5501 expiration time. Note that if the certificates expire before a 5502 new configuration is retried, the node will not be able to 5503 validate the configuration file. All times MUST be in UTC. 5504 sequence: a monotonically increasing sequence number between 0 and 5505 2^16-2 5507 Inside each overlay element, the following elements can occur: 5509 topology-plugin This element defines the overlay algorithm being 5510 used. If missing the default is "CHORD-RELOAD". 5511 node-id-length This element contains the length of a NodeId 5512 (NodeIdLength) in bytes. This value MUST be between 16 (128 bits) 5513 and 20 (160 bits). If this element is not present, the default of 5514 16 is used. 5515 root-cert This element contains a base-64 encoded X.509v3 5516 certificate that is a root trust anchor used to sign all 5517 certificates in this overlay. There can be more than one root- 5518 cert element. 5519 enrollment-server This element contains the URL at which the 5520 enrollment server can be reached in a "url" element. This URL 5521 MUST be of type "https:". More than one enrollment-server element 5522 may be present. Note that there is no necessary relationship 5523 between the overlay name/configuration server name and the 5524 enrollment server name. 5525 self-signed-permitted This element indicates whether self-signed 5526 certificates are permitted. If it is set to "true", then self- 5527 signed certificates are allowed, in which case the enrollment- 5528 server and root-cert elements may be absent. Otherwise, it SHOULD 5529 be absent, but MAY be set to "false". This element also contains 5530 an attribute "digest" which indicates the digest to be used to 5531 compute the Node-ID. Valid values for this parameter are "sha1" 5532 and "sha256" representing SHA-1 [RFC3174] and SHA-256 [RFC6234] 5533 respectively. Implementations MUST support both of these 5534 algorithms. 5535 bootstrap-node This element represents the address of one of the 5536 bootstrap nodes. It has an attribute called "address" that 5537 represents the IP address (either IPv4 or IPv6, since they can be 5538 distinguished) and an optional attribute called "port" that 5539 represents the port and defaults to 6084. The IP address is in 5540 typical hexadecimal form using standard period and colon 5541 separators as specified in [RFC5952]. More than one bootstrap- 5542 peer element may be present. 5543 turn-density This element is a positive integer that represents the 5544 approximate reciprocal of density of nodes that can act as TURN 5545 servers. For example, if 5% of the nodes can act as TURN servers, 5546 this would be set to 20. If it is not present, the default value 5547 is 1. If there are no TURN servers in the overlay, it is set to 5548 zero. 5549 multicast-bootstrap This element represents the address of a 5550 multicast, broadcast, or anycast address and port that may be used 5551 for bootstrap. Nodes SHOULD listen on the address. It has an 5552 attributed called "address" that represents the IP address and an 5553 optional attribute called "port" that represents the port and 5554 defaults to 6084. More than one "multicast-bootstrap" element may 5555 be present. 5556 clients-permitted This element represents whether clients are 5557 permitted or whether all nodes must be peers. If it is set to 5558 "true" or absent, this indicates that clients are permitted. If 5559 it is set to "false" then nodes are not allowed to remain clients 5560 after the initial join. There is currently no way for the overlay 5561 to enforce this. 5562 no-ice This element represents whether nodes are required to use 5563 the "No-ICE" Overlay Link protocols in this overlay. If it is 5564 absent, it is treated as if it were set to "false". 5565 chord-update-interval The update frequency for the Chord-reload 5566 topology plugin (see Section 10). 5567 chord-ping-interval The ping frequency for the Chord-reload 5568 topology plugin (see Section 10). 5569 chord-reactive Whether reactive recovery should be used for this 5570 overlay. Set to "true" or "false". Default if missing is "true". 5571 (see Section 10). 5572 shared-secret If shared secret mode is used, this contains the 5573 shared secret. The security guarantee here is that any agent 5574 which is able to access the configuration document (presumably 5575 protected by some sort of HTTP access control or network topology) 5576 is able to recover the shared secret and hence join the overlay. 5577 max-message-size Maximum size in bytes of any message in the 5578 overlay. If this value is not present, the default is 5000. 5579 initial-ttl Initial default TTL (time to live, see Section 6.3.2) 5580 for messages. If this value is not present, the default is 100. 5581 overlay-reliability-timer Default value for the end-to-end 5582 retransmission timer for messages, in milliseconds. If not 5583 present, the default value is 3000. 5584 overlay-link-protocol Indicates a permissible overlay link protocol 5585 (see Section 6.6.1 for requirements for such protocols). An 5586 arbitrary number of these elements may appear. If none appear, 5587 then this implies the default value, "TLS", which refers to the 5588 use of TLS and DTLS. If one or more elements appear, then no 5589 default value applies. 5591 kind-signer This contains a single Node-ID in hexadecimal and 5592 indicates that the certificate with this Node-ID is allowed to 5593 sign Kinds. Identifying kind-signer by Node-ID instead of 5594 certificate allows the use of short lived certificates without 5595 constantly having to provide an updated configuration file. 5596 configuration-signer This contains a single Node-ID in hexadecimal 5597 and indicates that the certificate with this Node-ID is allowed to 5598 sign configurations for this instance-name. Identifying the 5599 signer by Node-ID instead of certificate allows the use of short 5600 lived certificates without constantly having to provide an updated 5601 configuration file. 5602 bad-node This contains a single Node-ID in hexadecimal and 5603 indicates that the certificate with this Node-ID MUST NOT be 5604 considered valid. This allows certificate revocation. An 5605 arbitrary number of these elements can be provided. Note that 5606 because certificates may expire, bad-node entries need only be 5607 present for the lifetime of the certificate. Technically 5608 speaking, bad node-ids may be reused once their certificates have 5609 expired, the requirement for node-ids to be pseudo randomly 5610 generated gives this event a vanishing probability. 5611 mandatory-extension This element contains the name of an XML 5612 namespace that a node joining the overlay MUST support. The 5613 presence of a mandatory-extension element does not require the 5614 extension to be used in the current configuration file, but can 5615 indicate that it may be used in the future. Note that the 5616 namespace is case-sensitive, as specified in [w3c-xml-namespaces] 5617 Section 2.3. More than one mandatory-extension element may be 5618 present. 5620 Inside each overlay element, the required-kinds elements can also 5621 occur. This element indicates the Kinds that members must support 5622 and contains multiple kind-block elements that each define a single 5623 Kind that MUST be supported by nodes in the overlay. Each kind-block 5624 consists of a single kind element and a kind-signature. The kind 5625 element defines the Kind. The kind-signature is the signature 5626 computed over the kind element. 5628 Each kind has either an id attribute or a name attribute. The name 5629 attribute is a string representing the Kind (the name registered to 5630 IANA) while the id is an integer Kind-ID allocated out of private 5631 space. 5633 In addition, the kind element contains the following elements: 5634 max-count: the maximum number of values which members of the overlay 5635 must support. 5637 data-model: the data model to be used. 5638 max-size: the maximum size of individual values. 5639 access-control: the access control model to be used. 5640 max-node-multiple: This is optional and only used when the access 5641 control is NODE-MULTIPLE. This indicates the maximum value for 5642 the i counter. This is an integer greater than 0. 5644 All of the non optional values MUST be provided. If the Kind is 5645 registered with IANA, the data-model and access-control elements MUST 5646 match those in the Kind registration, and clients MUST ignore them in 5647 favor of the IANA versions. Multiple required-kinds elements MAY be 5648 present. 5650 The kind-block element also MUST contain a "kind-signature" element. 5651 This signature is computed across the kind from the beginning of the 5652 first < of the kind to the end of the last > of the kind in the same 5653 way as the signature element described later in this section. 5655 The configuration file needs to be treated as a binary blob that 5656 cannot be changed - including any whitespace changes - or the 5657 signature will break. The signature is computed by taking each 5658 configuration element and starting from, and including, the first < 5659 at the start of up to and including the > in 5660 and treating this as a binary blob that is signed 5661 using the standard SecurityBlock defined in Section 6.3.4. The 5662 SecurityBlock is base 64 encoded using the base64 alphabet from 5663 RFC[RFC4648] and put in the signature element following the 5664 configuration object in the configuration file. Any configuration 5665 file through the overlay (as opposed to directly from the 5666 configuration server) MUST be signed by one of the configure-signers 5667 from the previous extant configuration. Recipients MUST verify the 5668 signature prior to accepting the configuration file. 5670 When a node receives a new configuration file, it MUST change its 5671 configuration to meet the new requirements. This may require the 5672 node to exit the DHT and re-join. If a node is not capable of 5673 supporting the new requirements, it MUST exit the overlay. If some 5674 information about a particular Kind changes from what the node 5675 previously knew about the Kind (for example the max size), the new 5676 information in the configuration files overrides any previously 5677 learned information. If any Kind data was signed by a node that is 5678 no longer allowed to sign kinds, that Kind MUST be discarded along 5679 with any stored information of that Kind. Note that forcing an 5680 avalanche restart of the overlay with a configuration change that 5681 requires re-joining the overlay may result in serious performance 5682 problems, including total collapse of the network if configuration 5683 parameters are not properly considered. Such an event may be 5684 necessary in case of a compromised CA or similar problem, but for 5685 large overlays should be avoided in almost all circumstances. 5687 11.1.1. Relax NG Grammar 5689 The grammar for the configuration data is: 5691 namespace chord = "urn:ietf:params:xml:ns:p2p:config-chord" 5692 namespace local = "" 5693 default namespace p2pcf = "urn:ietf:params:xml:ns:p2p:config-base" 5694 namespace rng = "http://relaxng.org/ns/structure/1.0" 5696 anything = 5697 (element * { anything } 5698 | attribute * { text } 5699 | text)* 5701 foreign-elements = element * - (p2pcf:* | local:* | chord:*) 5702 { anything }* 5703 foreign-attributes = attribute * - (p2pcf:*|local:*|chord:*) 5704 { text }* 5705 foreign-nodes = (foreign-attributes | foreign-elements)* 5707 start = element p2pcf:overlay { 5708 overlay-element 5709 } 5711 overlay-element &= element configuration { 5712 attribute instance-name { xsd:string }, 5713 attribute expiration { xsd:dateTime }?, 5714 attribute sequence { xsd:long }?, 5715 foreign-attributes*, 5716 parameter 5717 }+ 5718 overlay-element &= element signature { 5719 attribute algorithm { signature-algorithm-type }?, 5720 xsd:base64Binary 5721 }* 5723 signature-algorithm-type |= "rsa-sha1" 5724 signature-algorithm-type |= xsd:string # signature alg extensions 5726 parameter &= element topology-plugin { topology-plugin-type }? 5727 topology-plugin-type |= xsd:string # topo plugin extensions 5728 parameter &= element max-message-size { xsd:unsignedInt }? 5729 parameter &= element initial-ttl { xsd:int }? 5730 parameter &= element root-cert { xsd:base64Binary }* 5731 parameter &= element required-kinds { kind-block* }? 5732 parameter &= element enrollment-server { xsd:anyURI }* 5733 parameter &= element kind-signer { xsd:string }* 5734 parameter &= element configuration-signer { xsd:string }* 5735 parameter &= element bad-node { xsd:string }* 5736 parameter &= element no-ice { xsd:boolean }? 5737 parameter &= element shared-secret { xsd:string }? 5738 parameter &= element overlay-link-protocol { xsd:string }* 5739 parameter &= element clients-permitted { xsd:boolean }? 5740 parameter &= element turn-density { xsd:unsignedByte }? 5741 parameter &= element node-id-length { xsd:int }? 5742 parameter &= element mandatory-extension { xsd:string }* 5743 parameter &= foreign-elements* 5745 parameter &= 5746 element self-signed-permitted { 5747 attribute digest { self-signed-digest-type }, 5748 xsd:boolean 5749 }? 5750 self-signed-digest-type |= "sha1" 5751 self-signed-digest-type |= xsd:string # signature digest extensions 5753 parameter &= element bootstrap-node { 5754 attribute address { xsd:string }, 5755 attribute port { xsd:int }? 5756 }* 5758 parameter &= element multicast-bootstrap { 5759 attribute address { xsd:string }, 5760 attribute port { xsd:int }? 5761 }* 5763 kind-block = element kind-block { 5764 element kind { 5765 ( attribute name { kind-names } 5766 | attribute id { xsd:unsignedInt } ), 5767 kind-parameter 5768 } & 5769 element kind-signature { 5770 attribute algorithm { signature-algorithm-type }?, 5771 xsd:base64Binary 5772 }? 5773 } 5775 kind-parameter &= element max-count { xsd:int } 5776 kind-parameter &= element max-size { xsd:int } 5777 kind-parameter &= element max-node-multiple { xsd:int }? 5779 kind-parameter &= element data-model { data-model-type } 5780 data-model-type |= "SINGLE" 5781 data-model-type |= "ARRAY" 5782 data-model-type |= "DICTIONARY" 5783 data-model-type |= xsd:string # data model extensions 5785 kind-parameter &= element access-control { access-control-type } 5786 access-control-type |= "USER-MATCH" 5787 access-control-type |= "NODE-MATCH" 5788 access-control-type |= "USER-NODE-MATCH" 5789 access-control-type |= "NODE-MULTIPLE" 5790 access-control-type |= xsd:string # access control extensions 5792 kind-parameter &= foreign-elements* 5794 kind-names |= "TURN-SERVICE" 5795 kind-names |= "CERTIFICATE_BY_NODE" 5796 kind-names |= "CERTIFICATE_BY_USER" 5797 kind-names |= xsd:string # kind extensions 5799 # Chord specific parameters 5800 topology-plugin-type |= "CHORD-RELOAD" 5801 parameter &= element chord:chord-ping-interval { xsd:int }? 5802 parameter &= element chord:chord-update-interval { xsd:int }? 5803 parameter &= element chord:chord-reactive { xsd:boolean }? 5805 11.2. Discovery Through Configuration Server 5807 When a node first enrolls in a new overlay, it starts with a 5808 discovery process to find a configuration server. 5810 The node MAY start by determining the overlay name. This value is 5811 provided by the user or some other out of band provisioning 5812 mechanism. The out of band mechanisms MAY also provide an optional 5813 URL for the configuration server. If a URL for the configuration 5814 server is not provided, the node MUST do a DNS SRV query using a 5815 Service name of "p2psip-enroll" and a protocol of TCP to find a 5816 configuration server and form the URL by appending a path of "/.well- 5817 known/p2psip-enroll" to the overlay name. This uses the "well known 5818 URI" framework defined in [RFC5785]. For example, if the overlay 5819 name was example.com, the URL would be 5820 "https://example.com/.well-known/p2psip-enroll". 5822 Once an address and URL for the configuration server is determined, 5823 the peer MUST form an HTTPS connection to that IP address. The 5824 certificate MUST match the overlay name as described in [RFC2818]. 5825 Then the node MUST fetch a new copy of the configuration file. To do 5826 this, the peer performs a GET to the URL. The result of the HTTP GET 5827 is an XML configuration file described above, which MUST replace any 5828 previously learned configuration file for this overlay. 5830 For overlays that do not use a configuration server, nodes need to 5831 obtain the configuration information needed to join the overlay 5832 through some out of band approach such an XML configuration file sent 5833 over email. 5835 11.3. Credentials 5837 If the configuration document contains a enrollment-server element, 5838 credentials are required to join the Overlay Instance. A peer which 5839 does not yet have credentials MUST contact the enrollment server to 5840 acquire them. 5842 RELOAD defines its own trivial certificate request protocol. We 5843 would have liked to have used an existing protocol but were concerned 5844 about the implementation burden of even the simplest of those 5845 protocols, such as [RFC5272] and [RFC5273]. The objective was to 5846 have a protocol which could be easily implemented in a Web server 5847 which the operator did not control (e.g., in a hosted service) and 5848 was compatible with the existing certificate handling tooling as used 5849 with the Web certificate infrastructure. This means accepting bare 5850 PKCS#10 requests and returning a single bare X.509 certificate. 5851 Although the MIME types for these objects are defined, none of the 5852 existing protocols support exactly this model. 5854 The certificate request protocol is performed over HTTPS. The 5855 request is an HTTP POST with the parameter encodes as described in 5856 [RFC2388] and the following properties: 5858 o If authentication is required, there is an form parameter of 5859 "password" and "username" containing the user's name and password 5860 in the clear (hence the need for HTTPS) 5861 o If more than one Node-ID is required, there is an form parameter 5862 of "nodeids" containing the number of Node-IDs required. 5863 o There MUST be a form parameter of "csr" with a content type of 5864 "application/pkcs10", as defined in [RFC2311]. 5865 o The Accept header MUST contain the type "application/pkix-cert", 5866 indicating the type that is expected in the response. 5868 The enrollment server MUST authenticate the request using the 5869 provided user name and password. The reason for using the RFC 2388 5870 "multipart/form-data" encoding is so that the password parameter will 5871 not be encoded in the URL to reduce the chance of accidental leakage 5872 of the password. If the authentication succeeds and the requested 5873 user name is acceptable, the server generates and returns a 5874 certificate for the certificate signing request in the "csr" 5875 parameter of the request. The SubjectAltName field in the 5876 certificate contains the following values: 5878 o One or more Node-IDs which MUST be cryptographically random 5879 [RFC4086]. Each MUST be chosen by the enrollment server in such a 5880 way that they are unpredictable to the requesting user. E.g., the 5881 user MUST NOT be informed of potential (random) Node-IDs prior to 5882 authenticating. Each is placed in the subjectAltName using the 5883 uniformResourceIdentifier type and MUST contain RELOAD URIs as 5884 described in Section 14.15 and MUST contain a Destination list 5885 with a single entry of type "node_id". The enrollment server 5886 SHOULD maintain a mapping of users to node-ids and if the same 5887 user returns (e.g., to have their certificate re-issued) return 5888 the same Node-ID, thus avoiding the need for implementations to 5889 re-store all their data when their certificates expire. 5890 o A single name this user is allowed to use in the overlay, using 5891 type rfc822Name. Enrollment servers SHOULD take care to only 5892 allow legal characters in the name (e.g., no embedded NULs), 5893 rather than simply accepting any name provided by the user. 5895 The certificate is returned as type "application/pkix-cert" as 5896 defined in [RFC2585], with an HTTP status code of 200 OK. 5898 Certificate processing errors should result in a HTTP return code of 5899 403 "Forbidden" along with a body of type "text/plain" and body that 5900 consists of one of the tokens defined in the following list: 5902 failed_authentication The user name and password combination was not 5903 correct. 5905 username_not_available The requested userName for the certificate 5906 was not acceptable. 5908 Node-IDs_not_available The number of Node-IDs requested was not 5909 acceptable. 5911 bad_CSR There was a problem with the CSR. 5913 If the client receives an unknown token in the body, it SHOULD treat 5914 it as a failure for an unknown reasons. 5916 The client MUST check that the certificate returned chains back to 5917 one of the certificates received in the "root-cert" list of the 5918 overlay configuration data (including PKIX BasicConstraints checks.) 5919 The node then reads the certificate to find the Node-IDs it can use. 5921 11.3.1. Self-Generated Credentials 5923 If the "self-signed-permitted" element is present in the 5924 configuration and set to "true", then a node MUST generate its own 5925 self-signed certificate to join the overlay. The self-signed 5926 certificate MAY contain any user name of the users choice. 5928 The Node-ID MUST be computed by applying the digest specified in the 5929 self-signed-permitted element to the DER representation of the user's 5930 public key (more specifically the subjectPublicKeyInfo) and taking 5931 the high order bits. When accepting a self-signed certificate, nodes 5932 MUST check that the Node-ID and public keys match. This prevents 5933 Node-ID theft. 5935 Once the node has constructed a self-signed certificate, it MAY join 5936 the overlay. Before storing its certificate in the overlay 5937 (Section 8) it SHOULD look to see if the user name is already taken 5938 and if so choose another user name. Note that this only provides 5939 protection against accidental name collisions. Name theft is still 5940 possible. If protection against name theft is desired, then the 5941 enrollment service must be used. 5943 11.4. Searching for a Bootstrap Node 5945 If no cached bootstrap nodes are available and the configuration file 5946 has an multicast-bootstrap element, then the node SHOULD send a Ping 5947 request over UDP to the address and port found to each multicast- 5948 bootstrap element found in the configuration document. This MAY be a 5949 multicast, broadcast, or anycast address. The Ping should use the 5950 wildcard Node-ID as the destination Node-ID. 5952 The responder node that receives the Ping request SHOULD check that 5953 the overlay name is correct and that the requester peer sending the 5954 request has appropriate credentials for the overlay before responding 5955 to the Ping request even if the response is only an error. 5957 11.5. Contacting a Bootstrap Node 5959 In order to join the overlay, the joining node MUST contact a node in 5960 the overlay. Typically this means contacting the bootstrap nodes, 5961 since they are reachable by the local peer or have public IP 5962 addresses. If the joining node has cached a list of peers it has 5963 previously been connected with in this overlay, as an optimization it 5964 MAY attempt to use one or more of them as bootstrap nodes before 5965 falling back to the bootstrap nodes listed in the configuration file. 5967 When contacting a bootstrap node, the joining node MUST first form 5968 the DTLS or TLS connection to the bootstrap node and then sends an 5969 Attach request over this connection with the destination Node-ID set 5970 to the joining node's Node-ID. 5972 When the requester node finally does receive a response from some 5973 responding node, it can note the Node-ID in the response and use this 5974 Node-ID to start sending requests to join the Overlay Instance as 5975 described in Section 6.4. 5977 After a node has successfully joined the overlay network, it will 5978 have direct connections to several peers. Some MAY be added to the 5979 cached bootstrap nodes list and used in future boots. Peers that are 5980 not directly connected MUST NOT be cached. The suggested number of 5981 peers to cache is 10. Algorithms for determining which peers to 5982 cache are beyond the scope of this specification. 5984 12. Message Flow Example 5986 The following abbreviations are used in the message flow diagrams: 5987 JP = joining peer, AP = admitting peer, NP = next peer after the AP, 5988 NNP = next next peer which is the peer after NP, PP = previous peer 5989 before the AP, PPP = previous previous peer which is the peer before 5990 the PP, BP = bootstrap peer. 5992 In the following example, we assume that JP has formed a connection 5993 to one of the bootstrap nodes. JP then sends an Attach through that 5994 peer to a resource ID of itself (JP). It gets routed to the 5995 admitting peer (AP) because JP is not yet part of the overlay. When 5996 AP responds, JP and AP use ICE to set up a connection and then set up 5997 TLS. Once AP has connected to JP, AP sends to JP an Update to 5998 populate its Routing Table. The following example shows the Update 5999 happening after the TLS connection is formed but it could also happen 6000 before in which case the Update would often be routed through other 6001 nodes. 6003 JP PPP PP AP NP NNP BP 6004 | | | | | | | 6005 | | | | | | | 6006 | | | | | | | 6007 |Attach Dest=JP | | | | | 6008 |---------------------------------------------------------->| 6009 | | | | | | | 6010 | | | | | | | 6011 | | |Attach Dest=JP | | | 6012 | | |<--------------------------------------| 6013 | | | | | | | 6014 | | | | | | | 6015 | | |Attach Dest=JP | | | 6016 | | |-------->| | | | 6017 | | | | | | | 6018 | | | | | | | 6019 | | |AttachAns | | | 6020 | | |<--------| | | | 6021 | | | | | | | 6022 | | | | | | | 6023 | | |AttachAns | | | 6024 | | |-------------------------------------->| 6025 | | | | | | | 6026 | | | | | | | 6027 |AttachAns | | | | | 6028 |<----------------------------------------------------------| 6029 | | | | | | | 6030 | | | | | | | 6031 |TLS | | | | | | 6032 |.............................| | | | 6033 | | | | | | | 6034 | | | | | | | 6035 | | | | | | | 6036 |Update | | | | | | 6037 |<----------------------------| | | | 6038 | | | | | | | 6039 | | | | | | | 6040 |UpdateAns| | | | | | 6041 |---------------------------->| | | | 6042 | | | | | | | 6043 | | | | | | | 6044 | | | | | | | 6046 The JP then forms connections to the appropriate neighbors, such as 6047 NP, by sending an Attach which gets routed via other nodes. When NP 6048 responds, JP and NP use ICE and TLS to set up a connection. 6050 JP PPP PP AP NP NNP BP 6051 | | | | | | | 6052 | | | | | | | 6053 | | | | | | | 6054 |Attach NP | | | | | 6055 |---------------------------->| | | | 6056 | | | | | | | 6057 | | | | | | | 6058 | | | |Attach NP| | | 6059 | | | |-------->| | | 6060 | | | | | | | 6061 | | | | | | | 6062 | | | |AttachAns| | | 6063 | | | |<--------| | | 6064 | | | | | | | 6065 | | | | | | | 6066 |AttachAns | | | | | 6067 |<----------------------------| | | | 6068 | | | | | | | 6069 | | | | | | | 6070 |Attach | | | | | | 6071 |-------------------------------------->| | | 6072 | | | | | | | 6073 | | | | | | | 6074 |TLS | | | | | | 6075 |.......................................| | | 6076 | | | | | | | 6077 | | | | | | | 6078 | | | | | | | 6079 | | | | | | | 6081 JP also needs to populate its finger table (for the Chord based DHT). 6082 It issues an Attach to a variety of locations around the overlay. 6083 The diagram below shows it sending an Attach halfway around the Chord 6084 ring to the JP + 2^127. 6086 JP NP XX TP 6087 | | | | 6088 | | | | 6089 | | | | 6090 |Attach JP+2<<126 | | 6091 |-------->| | | 6092 | | | | 6093 | | | | 6094 | |Attach JP+2<<126 | 6095 | |-------->| | 6096 | | | | 6097 | | | | 6098 | | |Attach JP+2<<126 6099 | | |-------->| 6100 | | | | 6101 | | | | 6102 | | |AttachAns| 6103 | | |<--------| 6104 | | | | 6105 | | | | 6106 | |AttachAns| | 6107 | |<--------| | 6108 | | | | 6109 | | | | 6110 |AttachAns| | | 6111 |<--------| | | 6112 | | | | 6113 | | | | 6114 |TLS | | | 6115 |.............................| 6116 | | | | 6117 | | | | 6118 | | | | 6119 | | | | 6121 Once JP has a reasonable set of connections, it is ready to take its 6122 place in the DHT. It does this by sending a Join to AP. AP does a 6123 series of Store requests to JP to store the data that JP will be 6124 responsible for. AP then sends JP an Update explicitly labeling JP 6125 as its predecessor. At this point, JP is part of the ring and 6126 responsible for a section of the overlay. AP can now forget any data 6127 which is assigned to JP and not AP. 6129 JP PPP PP AP NP NNP BP 6130 | | | | | | | 6131 | | | | | | | 6132 | | | | | | | 6133 |JoinReq | | | | | | 6134 |---------------------------->| | | | 6135 | | | | | | | 6136 | | | | | | | 6137 |JoinAns | | | | | | 6138 |<----------------------------| | | | 6139 | | | | | | | 6140 | | | | | | | 6141 |StoreReq Data A | | | | | 6142 |<----------------------------| | | | 6143 | | | | | | | 6144 | | | | | | | 6145 |StoreAns | | | | | | 6146 |---------------------------->| | | | 6147 | | | | | | | 6148 | | | | | | | 6149 |StoreReq Data B | | | | | 6150 |<----------------------------| | | | 6151 | | | | | | | 6152 | | | | | | | 6153 |StoreAns | | | | | | 6154 |---------------------------->| | | | 6155 | | | | | | | 6156 | | | | | | | 6157 |UpdateReq| | | | | | 6158 |<----------------------------| | | | 6159 | | | | | | | 6160 | | | | | | | 6161 |UpdateAns| | | | | | 6162 |---------------------------->| | | | 6163 | | | | | | | 6164 | | | | | | | 6165 | | | | | | | 6166 | | | | | | | 6168 In Chord, JP's neighbor table needs to contain its own predecessors. 6169 It couldn't connect to them previously because it did not yet know 6170 their addresses. However, now that it has received an Update from 6171 AP, it has AP's predecessors, which are also its own, so it sends 6172 Attaches to them. Below it is shown connecting to AP's closest 6173 predecessor, PP. 6175 JP PPP PP AP NP NNP BP 6176 | | | | | | | 6177 | | | | | | | 6178 | | | | | | | 6179 |Attach Dest=PP | | | | | 6180 |---------------------------->| | | | 6181 | | | | | | | 6182 | | | | | | | 6183 | | |Attach Dest=PP | | | 6184 | | |<--------| | | | 6185 | | | | | | | 6186 | | | | | | | 6187 | | |AttachAns| | | | 6188 | | |-------->| | | | 6189 | | | | | | | 6190 | | | | | | | 6191 |AttachAns| | | | | | 6192 |<----------------------------| | | | 6193 | | | | | | | 6194 | | | | | | | 6195 |TLS | | | | | | 6196 |...................| | | | | 6197 | | | | | | | 6198 | | | | | | | 6199 |UpdateReq| | | | | | 6200 |------------------>| | | | | 6201 | | | | | | | 6202 | | | | | | | 6203 |UpdateAns| | | | | | 6204 |<------------------| | | | | 6205 | | | | | | | 6206 | | | | | | | 6207 |UpdateReq| | | | | | 6208 |---------------------------->| | | | 6209 | | | | | | | 6210 | | | | | | | 6211 |UpdateAns| | | | | | 6212 |<----------------------------| | | | 6213 | | | | | | | 6214 | | | | | | | 6215 |UpdateReq| | | | | | 6216 |-------------------------------------->| | | 6217 | | | | | | | 6218 | | | | | | | 6219 |UpdateAns| | | | | | 6220 |<--------------------------------------| | | 6221 | | | | | | | 6222 | | | | | | | 6224 Finally, now that JP has a copy of all the data and is ready to route 6225 messages and receive requests, it sends Updates to everyone in its 6226 Routing Table to tell them it is ready to go. Below, it is shown 6227 sending such an update to TP. 6229 JP NP XX TP 6230 | | | | 6231 | | | | 6232 | | | | 6233 |Update | | | 6234 |---------------------------->| 6235 | | | | 6236 | | | | 6237 |UpdateAns| | | 6238 |<----------------------------| 6239 | | | | 6240 | | | | 6241 | | | | 6242 | | | | 6244 13. Security Considerations 6246 13.1. Overview 6248 RELOAD provides a generic storage service, albeit one designed to be 6249 useful for P2PSIP. In this section we discuss security issues that 6250 are likely to be relevant to any usage of RELOAD. More background 6251 information can be found in [RFC5765]. 6253 In any Overlay Instance, any given user depends on a number of peers 6254 with which they have no well-defined relationship except that they 6255 are fellow members of the Overlay Instance. In practice, these other 6256 nodes may be friendly, lazy, curious, or outright malicious. No 6257 security system can provide complete protection in an environment 6258 where most nodes are malicious. The goal of security in RELOAD is to 6259 provide strong security guarantees of some properties even in the 6260 face of a large number of malicious nodes and to allow the overlay to 6261 function correctly in the face of a modest number of malicious nodes. 6263 P2PSIP deployments require the ability to authenticate both peers and 6264 resources (users) without the active presence of a trusted entity in 6265 the system. We describe two mechanisms. The first mechanism is 6266 based on public key certificates and is suitable for general 6267 deployments. The second is an admission control mechanism based on 6268 an overlay-wide shared symmetric key. 6270 13.2. Attacks on P2P Overlays 6272 The two basic functions provided by overlay nodes are storage and 6273 routing: some node is responsible for storing a peer's data and for 6274 allowing a third peer to fetch this stored data. Other nodes are 6275 responsible for routing messages to and from the storing nodes. Each 6276 of these issues is covered in the following sections. 6278 P2P overlays are subject to attacks by subversive nodes that may 6279 attempt to disrupt routing, corrupt or remove user registrations, or 6280 eavesdrop on signaling. The certificate-based security algorithms we 6281 describe in this specification are intended to protect overlay 6282 routing and user registration information in RELOAD messages. 6284 To protect the signaling from attackers pretending to be valid peers 6285 (or peers other than themselves), the first requirement is to ensure 6286 that all messages are received from authorized members of the 6287 overlay. For this reason, RELOAD transports all messages over a 6288 secure channel (TLS and DTLS are defined in this document) which 6289 provides message integrity and authentication of the directly 6290 communicating peer. In addition, messages and data are digitally 6291 signed with the sender's private key, providing end-to-end security 6292 for communications. 6294 13.3. Certificate-based Security 6296 This specification stores users' registrations and possibly other 6297 data in an overlay network. This requires a solution to securing 6298 this data as well as securing, as well as possible, the routing in 6299 the overlay. Both types of security are based on requiring that 6300 every entity in the system (whether user or peer) authenticate 6301 cryptographically using an asymmetric key pair tied to a certificate. 6303 When a user enrolls in the Overlay Instance, they request or are 6304 assigned a unique name, such as "alice@dht.example.net". These names 6305 are unique and are meant to be chosen and used by humans much like a 6306 SIP Address of Record (AOR) or an email address. The user is also 6307 assigned one or more Node-IDs by the central enrollment authority. 6308 Both the name and the Node-ID are placed in the certificate, along 6309 with the user's public key. 6311 Each certificate enables an entity to act in two sorts of roles: 6313 o As a user, storing data at specific Resource-IDs in the Overlay 6314 Instance corresponding to the user name. 6315 o As a overlay peer with the Node-ID(s) listed in the certificate. 6317 Note that since only users of this Overlay Instance need to validate 6318 a certificate, this usage does not require a global PKI. Instead, 6319 certificates are signed by a central enrollment authority which acts 6320 as the certificate authority for the Overlay Instance. This 6321 authority signs each peer's certificate. Because each peer possesses 6322 the CA's certificate (which they receive on enrollment) they can 6323 verify the certificates of the other entities in the overlay without 6324 further communication. Because the certificates contain the user/ 6325 peer's public key, communications from the user/peer can be verified 6326 in turn. 6328 If self-signed certificates are used, then the security provided is 6329 significantly decreased, since attackers can mount Sybil attacks. In 6330 addition, attackers cannot trust the user names in certificates 6331 (though they can trust the Node-IDs because they are 6332 cryptographically verifiable). This scheme may be appropriate for 6333 some small deployments, such as a small office or an ad hoc overlay 6334 set up among participants in a meeting where all hosts on the network 6335 are trusted. Some additional security can be provided by using the 6336 shared secret admission control scheme as well. 6338 Because all stored data is signed by the owner of the data the 6339 storing peer can verify that the storer is authorized to perform a 6340 store at that Resource-ID and also allow any consumer of the data to 6341 verify the provenance and integrity of the data when it retrieves it. 6343 Note that RELOAD does not itself provide a revocation/status 6344 mechanism (though certificates may of course include OCSP responder 6345 information). Thus, certificate lifetimes should be chosen to 6346 balance the compromise window versus the cost of certificate renewal. 6347 Because RELOAD is already designed to operate in the face of some 6348 fraction of malicious peers, this form of compromise is not fatal. 6350 All implementations MUST implement certificate-based security. 6352 13.4. Shared-Secret Security 6354 RELOAD also supports a shared secret admission control scheme that 6355 relies on a single key that is shared among all members of the 6356 overlay. It is appropriate for small groups that wish to form a 6357 private network without complexity. In shared secret mode, all the 6358 peers share a single symmetric key which is used to key TLS-PSK 6359 [RFC4279] or TLS-SRP [RFC5054] mode. A peer which does not know the 6360 key cannot form TLS connections with any other peer and therefore 6361 cannot join the overlay. 6363 One natural approach to a shared-secret scheme is to use a user- 6364 entered password as the key. The difficulty with this is that in 6365 TLS-PSK mode, such keys are very susceptible to dictionary attacks. 6367 If passwords are used as the source of shared-keys, then TLS-SRP is a 6368 superior choice because it is not subject to dictionary attacks. 6370 13.5. Storage Security 6372 When certificate-based security is used in RELOAD, any given 6373 Resource-ID/Kind-ID pair is bound to some small set of certificates. 6374 In order to write data, the writer must prove possession of the 6375 private key for one of those certificates. Moreover, all data is 6376 stored, signed with the same private key that was used to authorize 6377 the storage. This set of rules makes questions of authorization and 6378 data integrity - which have historically been thorny for overlays - 6379 relatively simple. 6381 13.5.1. Authorization 6383 When a client wants to store some value, it first digitally signs the 6384 value with its own private key. It then sends a Store request that 6385 contains both the value and the signature towards the storing peer 6386 (which is defined by the Resource Name construction algorithm for 6387 that particular Kind of value). 6389 When the storing peer receives the request, it must determine whether 6390 the storing client is authorized to store at this Resource-ID/Kind-ID 6391 pair. Determining this requires comparing the user's identity to the 6392 requirements of the access control model (see Section 7.3). If it 6393 satisfies those requirements the user is authorized to write, pending 6394 quota checks as described in the next section. 6396 For example, consider the certificate with the following properties: 6398 User name: alice@dht.example.com 6399 Node-ID: 013456789abcdef 6400 Serial: 1234 6402 If Alice wishes to Store a value of the "SIP Location" Kind, the 6403 Resource Name will be the SIP AOR "sip:alice@dht.example.com". The 6404 Resource-ID will be determined by hashing the Resource Name. Because 6405 SIP Location uses the USER-NODE-MATCH policy, it first verifies that 6406 the user name in the certificate hashes to the requested Resource-ID. 6407 It then verifies that the Node-Id in the certificate matches the 6408 dictionary key being used for the store. If both of these checks 6409 succeed, the Store is authorized. Note that because the access 6410 control model is different for different Kinds, the exact set of 6411 checks will vary. 6413 13.5.2. Distributed Quota 6415 Being a peer in an Overlay Instance carries with it the 6416 responsibility to store data for a given region of the Overlay 6417 Instance. However, allowing clients to store unlimited amounts of 6418 data would create unacceptable burdens on peers and would also enable 6419 trivial denial of service attacks. RELOAD addresses this issue by 6420 requiring configurations to define maximum sizes for each Kind of 6421 stored data. Attempts to store values exceeding this size MUST be 6422 rejected (if peers are inconsistent about this, then strange 6423 artifacts will happen when the zone of responsibility shifts and a 6424 different peer becomes responsible for overlarge data). Because each 6425 Resource-ID/Kind-ID pair is bound to a small set of certificates, 6426 these size restrictions also create a distributed quota mechanism, 6427 with the quotas administered by the central configuration server. 6429 Allowing different Kinds of data to have different size restrictions 6430 allows new usages the flexibility to define limits that fit their 6431 needs without requiring all usages to have expansive limits. 6433 13.5.3. Correctness 6435 Because each stored value is signed, it is trivial for any retrieving 6436 peer to verify the integrity of the stored value. Some more care 6437 needs to be taken to prevent version rollback attacks. Rollback 6438 attacks on storage are prevented by the use of store times and 6439 lifetime values in each store. A lifetime represents the latest time 6440 at which the data is valid and thus limits (though does not 6441 completely prevent) the ability of the storing node to perform a 6442 rollback attack on retrievers. In order to prevent a rollback attack 6443 at the time of the Store request, we require that storage times be 6444 monotonically increasing. Storing peers MUST reject Store requests 6445 with storage times smaller than or equal to those they are currently 6446 storing. In addition, a fetching node which receives a data value 6447 with a storage time older than the result of the previous fetch knows 6448 a rollback has occurred. 6450 13.5.4. Residual Attacks 6452 The mechanisms described here provides a high degree of security, but 6453 some attacks remain possible. Most simply, it is possible for 6454 storing nodes to refuse to store a value (i.e., reject any request). 6455 In addition, a storing node can deny knowledge of values which it has 6456 previously accepted. To some extent these attacks can be ameliorated 6457 by attempting to store to/retrieve from replicas, but a retrieving 6458 client does not know whether it should try this or not, since there 6459 is a cost to doing so. 6461 The certificate-based authentication scheme prevents a single peer 6462 from being able to forge data owned by other peers. Furthermore, 6463 although a subversive peer can refuse to return data resources for 6464 which it is responsible, it cannot return forged data because it 6465 cannot provide authentication for such registrations. Therefore 6466 parallel searches for redundant registrations can mitigate most of 6467 the effects of a compromised peer. The ultimate reliability of such 6468 an overlay is a statistical question based on the replication factor 6469 and the percentage of compromised peers. 6471 In addition, when a Kind is multivalued (e.g., an array data model), 6472 the storing node can return only some subset of the values, thus 6473 biasing its responses. This can be countered by using single values 6474 rather than sets, but that makes coordination between multiple 6475 storing agents much more difficult. This is a trade off that must be 6476 made when designing any usage. 6478 13.6. Routing Security 6480 Because the storage security system guarantees (within limits) the 6481 integrity of the stored data, routing security focuses on stopping 6482 the attacker from performing a DOS attack that misroutes requests in 6483 the overlay. There are a few obvious observations to make about 6484 this. First, it is easy to ensure that an attacker is at least a 6485 valid peer in the Overlay Instance. Second, this is a DOS attack 6486 only. Third, if a large percentage of the peers on the Overlay 6487 Instance are controlled by the attacker, it is probably impossible to 6488 perfectly secure against this. 6490 13.6.1. Background 6492 In general, attacks on DHT routing are mounted by the attacker 6493 arranging to route traffic through one or two nodes it controls. In 6494 the Eclipse attack [Eclipse] the attacker tampers with messages to 6495 and from nodes for which it is on-path with respect to a given victim 6496 node. This allows it to pretend to be all the nodes that are 6497 reachable through it. In the Sybil attack [Sybil], the attacker 6498 registers a large number of nodes and is therefore able to capture a 6499 large amount of the traffic through the DHT. 6501 Both the Eclipse and Sybil attacks require the attacker to be able to 6502 exercise control over her Node-IDs. The Sybil attack requires the 6503 creation of a large number of peers. The Eclipse attack requires 6504 that the attacker be able to impersonate specific peers. In both 6505 cases, these attacks are limited by the use of centralized, 6506 certificate-based admission control. 6508 13.6.2. Admissions Control 6510 Admission to a RELOAD Overlay Instance is controlled by requiring 6511 that each peer have a certificate containing its Node-Id. The 6512 requirement to have a certificate is enforced by using certificate- 6513 based mutual authentication on each connection. (Note: the 6514 following only applies when self-signed certificates are not used.) 6515 Whenever a peer connects to another peer, each side automatically 6516 checks that the other has a suitable certificate. These Node-Ids are 6517 randomly assigned by the central enrollment server. This has two 6518 benefits: 6520 o It allows the enrollment server to limit the number of Node-IDs 6521 issued to any individual user. 6522 o It prevents the attacker from choosing specific Node-Ids. 6524 The first property allows protection against Sybil attacks (provided 6525 the enrollment server uses strict rate limiting policies). The 6526 second property deters but does not completely prevent Eclipse 6527 attacks. Because an Eclipse attacker must impersonate peers on the 6528 other side of the attacker, he must have a certificate for suitable 6529 Node-Ids, which requires him to repeatedly query the enrollment 6530 server for new certificates, which will match only by chance. From 6531 the attacker's perspective, the difficulty is that if he only has a 6532 small number of certificates, the region of the Overlay Instance he 6533 is impersonating appears to be very sparsely populated by comparison 6534 to the victim's local region. 6536 13.6.3. Peer Identification and Authentication 6538 In general, whenever a peer engages in overlay activity that might 6539 affect the routing table it must establish its identity. This 6540 happens in two ways. First, whenever a peer establishes a direct 6541 connection to another peer it authenticates via certificate-based 6542 mutual authentication. All messages between peers are sent over this 6543 protected channel and therefore the peers can verify the data origin 6544 of the last hop peer for requests and responses without further 6545 cryptography. 6547 In some situations, however, it is desirable to be able to establish 6548 the identity of a peer with whom one is not directly connected. The 6549 most natural case is when a peer Updates its state. At this point, 6550 other peers may need to update their view of the overlay structure, 6551 but they need to verify that the Update message came from the actual 6552 peer rather than from an attacker. To prevent this, all overlay 6553 routing messages are signed by the peer that generated them. 6555 Replay is typically prevented for messages that impact the topology 6556 of the overlay by having the information come directly, or be 6557 verified by, the nodes that claimed to have generated the update. 6558 Data storage replay detection is done by signing time of the node 6559 that generated the signature on the store request thus providing a 6560 time based replay protection but the time synchronization is only 6561 needed between peers that can write to the same location. 6563 13.6.4. Protecting the Signaling 6565 The goal here is to stop an attacker from knowing who is signaling 6566 what to whom. An attacker is unlikely to be able to observe the 6567 activities of a specific individual given the randomization of IDs 6568 and routing based on the present peers discussed above. Furthermore, 6569 because messages can be routed using only the header information, the 6570 actual body of the RELOAD message can be encrypted during 6571 transmission. 6573 There are two lines of defense here. The first is the use of TLS or 6574 DTLS for each communications link between peers. This provides 6575 protection against attackers who are not members of the overlay. The 6576 second line of defense is to digitally sign each message. This 6577 prevents adversarial peers from modifying messages in flight, even if 6578 they are on the routing path. 6580 13.6.5. Routing Loops and Dos Attacks 6582 Source routing mechanisms are known to create the possibility for DoS 6583 amplification, especially by the induction of routing loops 6584 [RFC5095]. In order to limit amplification, the initial-ttl value in 6585 the configuration file SHOULD be set to a value slightly larger than 6586 the longest expected path through the network. For Chord, experience 6587 has shown that log(2) of the number of nodes in the network + 5 is a 6588 safe bound. Because nodes are required to enforce the initial-ttl as 6589 the maximum value, an attacker cannot achieve an amplification factor 6590 greater than initial-ttl, thus limiting the additional capabilities 6591 provided by source routing. 6593 In order to prevent the use of loops for targeted implementation 6594 attacks, implementations SHOULD check the destination list for 6595 duplicate entries and discard such records with an 6596 "Error_Invalid_Message" error. This does not completely prevent 6597 loops but does require that at least one attacker node be part of the 6598 loop. 6600 13.6.6. Residual Attacks 6602 The routing security mechanisms in RELOAD are designed to contain 6603 rather than eliminate attacks on routing. It is still possible for 6604 an attacker to mount a variety of attacks. In particular, if an 6605 attacker is able to take up a position on the overlay routing between 6606 A and B it can make it appear as if B does not exist or is 6607 disconnected. It can also advertise false network metrics in an 6608 attempt to reroute traffic. However, these are primarily DOS 6609 attacks. 6611 The certificate-based security scheme secures the namespace, but if 6612 an individual peer is compromised or if an attacker obtains a 6613 certificate from the CA, then a number of subversive peers can still 6614 appear in the overlay. While these peers cannot falsify responses to 6615 resource queries, they can respond with error messages, effecting a 6616 DoS attack on the resource registration. They can also subvert 6617 routing to other compromised peers. To defend against such attacks, 6618 a resource search must still consist of parallel searches for 6619 replicated registrations. 6621 14. IANA Considerations 6623 This section contains the new code points registered by this 6624 document. [NOTE TO IANA/RFC-EDITOR: Please replace RFC-AAAA with 6625 the RFC number for this specification in the following list.] 6627 14.1. Well-Known URI Registration 6629 IANA SHALL make the following "Well Known URI" registration as 6630 described in [RFC5785]: 6632 [[Note to RFC Editor - this paragraph can be removed before 6633 publication. ]] A review request was sent to 6634 wellknown-uri-review@ietf.org on October 12, 2010. 6636 +----------------------------+----------------------+ 6637 | URI suffix: | p2psip-enroll | 6638 | Change controller: | IETF | 6639 | Specification document(s): | [RFC-AAAA] | 6640 | Related information: | None | 6641 +----------------------------+----------------------+ 6643 14.2. Port Registrations 6645 [[Note to RFC Editor - this paragraph can be removed before 6646 publication. ]] IANA has already allocated a TCP port for the main 6647 peer to peer protocol. This port has the name p2p-sip and the port 6648 number of 6084. IANA needs to update this registration to be defined 6649 for UDP as well as TCP. 6651 IANA SHALL make the following port registration: 6653 +------------------------------+------------------------------------+ 6654 | Registration Technical | Cullen Jennings | 6655 | Contact | | 6656 | Registration Owner | IETF | 6657 | Transport Protocol | TCP & UDP | 6658 | Port Number | 6084 | 6659 | Service Name | p2psip-enroll | 6660 | Description | Peer to Peer Infrastructure | 6661 | | Enrollment | 6662 | Reference | [RFC-AAAA] | 6663 +------------------------------+------------------------------------+ 6665 14.3. Overlay Algorithm Types 6667 IANA SHALL create a "RELOAD Overlay Algorithm Type" Registry. 6668 Entries in this registry are strings denoting the names of overlay 6669 algorithms. The registration policy for this registry is RFC 5226 6670 IETF Review. The initial contents of this registry are: 6672 +----------------+----------+ 6673 | Algorithm Name | RFC | 6674 +----------------+----------+ 6675 | CHORD-RELOAD | RFC-AAAA | 6676 | EXP-OVERLAY | RFC-AAAA | 6677 +----------------+----------+ 6679 The value EXP-OVERLAY has been made available for the purposes of 6680 experimentation. This value is not meant for vendor specific use of 6681 any sort and it MUST NOT be used for operational deployments. 6683 14.4. Access Control Policies 6685 IANA SHALL create a "RELOAD Access Control Policy" Registry. Entries 6686 in this registry are strings denoting access control policies, as 6687 described in Section 7.3. New entries in this registry SHALL be 6688 registered via RFC 5226 Standards Action. The initial contents of 6689 this registry are: 6691 +-----------------+----------+ 6692 | Access Policy | RFC | 6693 +-----------------+----------+ 6694 | USER-MATCH | RFC-AAAA | 6695 | NODE-MATCH | RFC-AAAA | 6696 | USER-NODE-MATCH | RFC-AAAA | 6697 | NODE-MULTIPLE | RFC-AAAA | 6698 | EXP-MATCH | RFC-AAAA | 6699 +-----------------+----------+ 6701 The value EXP-MATCH has been made available for the purposes of 6702 experimentation. This value is not meant for vendor specific use of 6703 any sort and it MUST NOT be used for operational deployments. 6705 14.5. Application-ID 6707 IANA SHALL create a "RELOAD Application-ID" Registry. Entries in 6708 this registry are 16-bit integers denoting application Kinds. Code 6709 points in the range 0x0001 to 0x7fff SHALL be registered via RFC 5226 6710 Standards Action. Code points in the range 0x8000 to 0xf000 SHALL be 6711 registered via RFC 5226 Expert Review. Code points in the range 6712 0xf001 to 0xfffe are reserved for private use. The initial contents 6713 of this registry are: 6715 +-------------+----------------+-------------------------------+ 6716 | Application | Application-ID | Specification | 6717 +-------------+----------------+-------------------------------+ 6718 | INVALID | 0 | RFC-AAAA | 6719 | SIP | 5060 | Reserved for use by SIP Usage | 6720 | SIP | 5061 | Reserved for use by SIP Usage | 6721 | Reserved | 0xffff | RFC-AAAA | 6722 +-------------+----------------+-------------------------------+ 6724 14.6. Data Kind-ID 6726 IANA SHALL create a "RELOAD Data Kind-ID" Registry. Entries in this 6727 registry are 32-bit integers denoting data Kinds, as described in 6728 Section 5.2. Code points in the range 0x00000001 to 0x7fffffff SHALL 6729 be registered via RFC 5226 Standards Action. Code points in the 6730 range 0x8000000 to 0xf0000000 SHALL be registered via RFC 5226 Expert 6731 Review. Code points in the range 0xf0000001 to 0xfffffffe are 6732 reserved for private use via the Kind description mechanism described 6733 in Section 11. The initial contents of this registry are: 6735 +---------------------+------------+----------+ 6736 | Kind | Kind-ID | RFC | 6737 +---------------------+------------+----------+ 6738 | INVALID | 0 | RFC-AAAA | 6739 | TURN-SERVICE | 2 | RFC-AAAA | 6740 | CERTIFICATE_BY_NODE | 3 | RFC-AAAA | 6741 | CERTIFICATE_BY_USER | 16 | RFC-AAAA | 6742 | Reserved | 0x7fffffff | RFC-AAAA | 6743 | Reserved | 0xfffffffe | RFC-AAAA | 6744 +---------------------+------------+----------+ 6746 14.7. Data Model 6748 IANA SHALL create a "RELOAD Data Model" Registry. Entries in this 6749 registry denoting data models, as described in Section 7.2. Code 6750 points in this registry SHALL be registered via RFC 5226 Standards 6751 Action. The initial contents of this registry are: 6753 +------------+----------+ 6754 | Data Model | RFC | 6755 +------------+----------+ 6756 | INVALID | RFC-AAAA | 6757 | SINGLE | RFC-AAAA | 6758 | ARRAY | RFC-AAAA | 6759 | DICTIONARY | RFC-AAAA | 6760 | EXP-DATA | RFC-AAAA | 6761 | RESERVED | RFC-AAAA | 6762 +------------+----------+ 6764 The value EXP-DATA has been made available for the purposes of 6765 experimentation. This value is not meant for vendor specific use of 6766 any sort and it MUST NOT be used for operational deployments. 6768 14.8. Message Codes 6770 IANA SHALL create a "RELOAD Message Code" Registry. Entries in this 6771 registry are 16-bit integers denoting method codes as described in 6772 Section 6.3.3. These codes SHALL be registered via RFC 5226 6773 Standards Action. The initial contents of this registry are: 6775 +---------------------------------+----------------+----------+ 6776 | Message Code Name | Code Value | RFC | 6777 +---------------------------------+----------------+----------+ 6778 | invalid | 0 | RFC-AAAA | 6779 | probe_req | 1 | RFC-AAAA | 6780 | probe_ans | 2 | RFC-AAAA | 6781 | attach_req | 3 | RFC-AAAA | 6782 | attach_ans | 4 | RFC-AAAA | 6783 | unused | 5 | | 6784 | unused | 6 | | 6785 | store_req | 7 | RFC-AAAA | 6786 | store_ans | 8 | RFC-AAAA | 6787 | fetch_req | 9 | RFC-AAAA | 6788 | fetch_ans | 10 | RFC-AAAA | 6789 | unused (was remove_req) | 11 | RFC-AAAA | 6790 | unused (was remove_ans) | 12 | RFC-AAAA | 6791 | find_req | 13 | RFC-AAAA | 6792 | find_ans | 14 | RFC-AAAA | 6793 | join_req | 15 | RFC-AAAA | 6794 | join_ans | 16 | RFC-AAAA | 6795 | leave_req | 17 | RFC-AAAA | 6796 | leave_ans | 18 | RFC-AAAA | 6797 | update_req | 19 | RFC-AAAA | 6798 | update_ans | 20 | RFC-AAAA | 6799 | route_query_req | 21 | RFC-AAAA | 6800 | route_query_ans | 22 | RFC-AAAA | 6801 | ping_req | 23 | RFC-AAAA | 6802 | ping_ans | 24 | RFC-AAAA | 6803 | stat_req | 25 | RFC-AAAA | 6804 | stat_ans | 26 | RFC-AAAA | 6805 | unused (was attachlite_req) | 27 | RFC-AAAA | 6806 | unused (was attachlite_ans) | 28 | RFC-AAAA | 6807 | app_attach_req | 29 | RFC-AAAA | 6808 | app_attach_ans | 30 | RFC-AAAA | 6809 | unused (was app_attachlite_req) | 31 | RFC-AAAA | 6810 | unused (was app_attachlite_ans) | 32 | RFC-AAAA | 6811 | config_update_req | 33 | RFC-AAAA | 6812 | config_update_ans | 34 | RFC-AAAA | 6813 | exp_a_req | 35 | RFC-AAAA | 6814 | exp_a_ans | 36 | RFC-AAAA | 6815 | exp_b_req | 37 | RFC-AAAA | 6816 | exp_b_ans | 38 | RFC-AAAA | 6817 | reserved | 0x8000..0xfffe | RFC-AAAA | 6818 | error | 0xffff | RFC-AAAA | 6819 +---------------------------------+----------------+----------+ 6821 The values exp_a_req, exp_a_ans, exp_b_req, and exp_b_ans have been 6822 made available for the purposes of experimentation. These values are 6823 not meant for vendor specific use of any sort and MUST NOT be used 6824 for operational deployments. 6826 14.9. Error Codes 6828 IANA SHALL create a "RELOAD Error Code" Registry. Entries in this 6829 registry are 16-bit integers denoting error codes. New entries SHALL 6830 be defined via RFC 5226 Standards Action. The initial contents of 6831 this registry are: 6833 +-------------------------------------+----------------+----------+ 6834 | Error Code Name | Code Value | RFC | 6835 +-------------------------------------+----------------+----------+ 6836 | invalid | 0 | RFC-AAAA | 6837 | Unused | 1 | RFC-AAAA | 6838 | Error_Forbidden | 2 | RFC-AAAA | 6839 | Error_Not_Found | 3 | RFC-AAAA | 6840 | Error_Request_Timeout | 4 | RFC-AAAA | 6841 | Error_Generation_Counter_Too_Low | 5 | RFC-AAAA | 6842 | Error_Incompatible_with_Overlay | 6 | RFC-AAAA | 6843 | Error_Unsupported_Forwarding_Option | 7 | RFC-AAAA | 6844 | Error_Data_Too_Large | 8 | RFC-AAAA | 6845 | Error_Data_Too_Old | 9 | RFC-AAAA | 6846 | Error_TTL_Exceeded | 10 | RFC-AAAA | 6847 | Error_Message_Too_Large | 11 | RFC-AAAA | 6848 | Error_Unknown_Kind | 12 | RFC-AAAA | 6849 | Error_Unknown_Extension | 13 | RFC-AAAA | 6850 | Error_Response_Too_Large | 14 | RFC-AAAA | 6851 | Error_Config_Too_Old | 15 | RFC-AAAA | 6852 | Error_Config_Too_New | 16 | RFC-AAAA | 6853 | Error_In_Progress | 17 | RFC-AAAA | 6854 | Error_Exp_A | 18 | RFC-AAAA | 6855 | Error_Exp_B | 19 | RFC-AAAA | 6856 | Error_Invalid_Message | 20 | RFC-AAAA | 6857 | reserved | 0x8000..0xfffe | RFC-AAAA | 6858 +-------------------------------------+----------------+----------+ 6860 The values Error_Exp_A and Error_Exp_B have been made available for 6861 the purposes of experimentation. These values are not meant for 6862 vendor specific use of any sort and MUST NOT be used for operational 6863 deployments. 6865 14.10. Overlay Link Types 6867 IANA SHALL create a "RELOAD Overlay Link Registry". For more 6868 information on the link types defeind here, see Section 6.6. New 6869 entries SHALL be defined via RFC 5226 Standards Action. This 6870 registry SHALL be initially populated with the following values: 6872 +--------------------+------+---------------+ 6873 | Protocol | Code | Specification | 6874 +--------------------+------+---------------+ 6875 | reserved | 0 | RFC-AAAA | 6876 | DTLS-UDP-SR | 1 | RFC-AAAA | 6877 | DTLS-UDP-SR-NO-ICE | 3 | RFC-AAAA | 6878 | TLS-TCP-FH-NO-ICE | 4 | RFC-AAAA | 6879 | EXP-LINK | 5 | RFC-AAAA | 6880 | reserved | 255 | RFC-AAAA | 6881 +--------------------+------+---------------+ 6883 The value EXP-LINK has been made available for the purposes of 6884 experimentation. This value is not meant for vendor specific use of 6885 any sort and it MUST NOT be used for operational deployments. 6887 14.11. Overlay Link Protocols 6889 IANA SHALL create an "Overlay Link Protocol Registry". Entries in 6890 this registry SHALL be defined via RFC 5226 Standards Action. This 6891 registry SHALL be initially populated with the following valuse: 6893 +---------------+---------------+ 6894 | Link Protocol | Specification | 6895 +---------------+---------------+ 6896 | TLS | RFC-AAAA | 6897 | EXP-PROTOCOL | RFC-AAAA | 6898 +---------------+---------------+ 6900 The value EXP-PROTOCOL has been made available for the purposes of 6901 experimentation. This value is not meant for vendor specific use of 6902 any sort and it MUST NOT be used for operational deployments. 6904 14.12. Forwarding Options 6906 IANA SHALL create a "Forwarding Option Registry". Entries in this 6907 registry between 1 and 127 SHALL be defined via RFC 5226 Standards 6908 Action. Entries in this registry between 128 and 254 SHALL be 6909 defined via RFC 5226 Specification Required. This registry SHALL be 6910 initially populated with the following values: 6912 +-------------------+------+---------------+ 6913 | Forwarding Option | Code | Specification | 6914 +-------------------+------+---------------+ 6915 | invalid | 0 | RFC-AAAA | 6916 | exp-forward | 1 | RFC-AAAA | 6917 | reserved | 255 | RFC-AAAA | 6918 +-------------------+------+---------------+ 6920 The value exp-forward has been made available for the purposes of 6921 experimentation. This value is not meant for vendor specific use of 6922 any sort and it MUST NOT be used for operational deployments. 6924 14.13. Probe Information Types 6926 IANA SHALL create a "RELOAD Probe Information Type Registry". 6927 Entries in this registry SHALL be defined via RFC 5226 Standards 6928 Action. This registry SHALL be initially populated with the 6929 following values: 6931 +-----------------+------+---------------+ 6932 | Probe Option | Code | Specification | 6933 +-----------------+------+---------------+ 6934 | invalid | 0 | RFC-AAAA | 6935 | responsible_set | 1 | RFC-AAAA | 6936 | num_resources | 2 | RFC-AAAA | 6937 | uptime | 3 | RFC-AAAA | 6938 | exp-probe | 4 | RFC-AAAA | 6939 | reserved | 255 | RFC-AAAA | 6940 +-----------------+------+---------------+ 6942 The value exp-probe has been made available for the purposes of 6943 experimentation. This value is not meant for vendor specific use of 6944 any sort and it MUST NOT be used for operational deployments. 6946 14.14. Message Extensions 6948 IANA SHALL create a "RELOAD Extensions Registry". Entries in this 6949 registry SHALL be defined via RFC 5226 Specification Required. This 6950 registry SHALL be initially populated with the following values: 6952 +-----------------+--------+---------------+ 6953 | Extensions Name | Code | Specification | 6954 +-----------------+--------+---------------+ 6955 | invalid | 0 | RFC-AAAA | 6956 | exp-ext | 1 | RFC-AAAA | 6957 | reserved | 0xFFFF | RFC-AAAA | 6958 +-----------------+--------+---------------+ 6960 The value exp-ext has been made available for the purposes of 6961 experimentation. This value is not meant for vendor specific use of 6962 any sort and it MUST NOT be used for operational deployments. 6964 14.15. reload URI Scheme 6966 This section describes the scheme for a reload URI, which can be used 6967 to refer to either: 6969 o A peer. 6970 o A resource inside a peer. 6972 The reload URI is defined using a subset of the URI schema specified 6973 in Appendix A of RFC 3986 [RFC3986] and the associated URI Guidelines 6974 [RFC4395] per the following ABNF syntax: 6976 RELOAD-URI = "reload://" destination "@" overlay "/" 6977 [specifier] 6979 destination = 1 * HEXDIG 6980 overlay = reg-name 6981 specifier = 1*HEXDIG 6983 The definitions of these productions are as follows: 6985 destination: a hex-encoded Destination List object (i.e., multiple 6986 concatenated Destination objects with no length prefix prior to 6987 the object as a whole.) 6989 overlay: the name of the overlay. 6991 specifier : a hex-encoded StoredDataSpecifier indicating the data 6992 element. 6994 If no specifier is present then this URI addresses the peer which can 6995 be reached via the indicated destination list at the indicated 6996 overlay name. If a specifier is present, then the URI addresses the 6997 data value. 6999 14.15.1. URI Registration 7001 [[ Note to RFC Editor - please remove this paragraph before 7002 publication. ]] A review request was sent to uri-review@ietf.org on 7003 Oct 7, 2010. 7005 The following summarizes the information necessary to register the 7006 reload URI. 7008 URI Scheme Name: reload 7009 Status: permanent 7010 URI Scheme Syntax: see Section 14.15 of RFC-AAAA 7011 URI Scheme Semantics: The reload URI is intended to be used as a 7012 reference to a RELOAD peer or resource. 7014 Encoding Considerations: The reload URI is not intended to be human- 7015 readable text, so it is encoded entirely in US-ASCII. 7016 Applications/protocols that use this URI scheme: The RELOAD protocol 7017 described in RFC-AAAA. 7018 Interoperability considerations: See RFC-AAAA. 7019 Security considerations: See RFC-AAAA 7020 Contact: Cullen Jennings 7021 Author/Change controller: IESG 7022 References: RFC-AAAA 7024 14.16. Media Type Registration 7026 [[ Note to RFC Editor - please remove this paragraph before 7027 publication. ]] A review request was sent to ietf-types@iana.org on 7028 May 27, 2011. 7030 Type name: application 7032 Subtype name: p2p-overlay+xml 7034 Required parameters: none 7036 Optional parameters: none 7038 Encoding considerations: Must be binary encoded. 7040 Security considerations: This media type is typically not used to 7041 transport information that needs to be kept confidential, however 7042 there are cases where it is integrity of the information is 7043 important. For these cases using a digital signature is RECOMMENDED. 7044 One way of doing this is specified in RFC-AAAA. In the case when the 7045 media includes a "shared-secret" element, then the contents of the 7046 file MUST be kept confidential or else anyone that can see the 7047 shared-secret and effect the RELOAD overlay network. 7049 Interoperability considerations: No known interoperability 7050 consideration beyond those identified for application/xml in 7051 [RFC3023]. 7053 Published specification: RFC-AAAA 7055 Applications that use this media type: The type is used to configure 7056 the peer to peer overlay networks defined in RFC-AAAA. 7058 Additional information: The syntax for this media type is specified 7059 in Section 11.1 of RFC-AAAA. The contents MUST be valid XML 7060 compliant with the relax NG grammar specified in RFC-AAAA and use the 7061 UTF-8[RFC3629] character encoding. 7063 Magic number(s): none 7065 File extension(s): relo 7067 Macintosh file type code(s): none 7069 Person & email address to contact for further information: Cullen 7070 Jennings 7072 Intended usage: COMMON 7074 Restrictions on usage: None 7076 Author: Cullen Jennings 7078 Change controller: IESG 7080 14.17. XML Name Space Registration 7082 This document registers two URIs for the config and config-chord XML 7083 namespaces in the IETF XML registry defined in [RFC3688]. 7085 14.17.1. Config URL 7087 URI: urn:ietf:params:xml:ns:p2p:config-base 7089 Registrant Contact: The IESG. 7091 XML: N/A, the requested URIs are XML namespaces 7093 14.17.2. Config Chord URL 7095 URI: urn:ietf:params:xml:ns:p2p:config-chord 7097 Registrant Contact: The IESG. 7099 XML: N/A, the requested URIs are XML namespaces 7101 15. Acknowledgments 7103 This specification is a merge of the "REsource LOcation And Discovery 7104 (RELOAD)" draft by David A. Bryan, Marcia Zangrilli and Bruce B. 7105 Lowekamp, the "Address Settlement by Peer to Peer" draft by Cullen 7106 Jennings, Jonathan Rosenberg, and Eric Rescorla, the "Security 7107 Extensions for RELOAD" draft by Bruce B. Lowekamp and James Deverick, 7108 the "A Chord-based DHT for Resource Lookup in P2PSIP" by Marcia 7109 Zangrilli and David A. Bryan, and the Peer-to-Peer Protocol (P2PP) 7110 draft by Salman A. Baset, Henning Schulzrinne, and Marcin 7111 Matuszewski. Thanks to the authors of RFC 5389 for text included 7112 from that. Vidya Narayanan provided many comments and improvements. 7114 The ideas and text for the Chord specific extension data to the Leave 7115 mechanisms was provided by Jouni Maenpaa, Gonzalo Camarillo, and Jani 7116 Hautakorpi. 7118 Thanks to the many people who contributed including Ted Hardie, 7119 Michael Chen, Dan York, Das Saumitra, Lyndsay Campbell, Brian Rosen, 7120 David Bryan, Dave Craig, and Julian Cain. Extensive last call 7121 comments were provided by: Jouni Maenpaa, Roni Even, Gonzalo 7122 Camarillo, Ari Keranen, John Buford, Michael Chen, Frederic-Philippe 7123 Met, Mary Barnes, Roland Bless, and David Bryan. Special thanks to 7124 Marc Petit-Huguenin who provided an amazing amount of detailed 7125 review. 7127 16. References 7129 16.1. Normative References 7131 [RFC1918] Rekhter, Y., Moskowitz, R., Karrenberg, D., Groot, G., and 7132 E. Lear, "Address Allocation for Private Internets", 7133 BCP 5, RFC 1918, February 1996. 7135 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 7136 Requirement Levels", BCP 14, RFC 2119, March 1997. 7138 [RFC2388] Masinter, L., "Returning Values from Forms: multipart/ 7139 form-data", RFC 2388, August 1998. 7141 [RFC2585] Housley, R. and P. Hoffman, "Internet X.509 Public Key 7142 Infrastructure Operational Protocols: FTP and HTTP", 7143 RFC 2585, May 1999. 7145 [RFC2818] Rescorla, E., "HTTP Over TLS", RFC 2818, May 2000. 7147 [RFC3023] Murata, M., St. Laurent, S., and D. Kohn, "XML Media 7148 Types", RFC 3023, January 2001. 7150 [RFC3174] Eastlake, D. and P. Jones, "US Secure Hash Algorithm 1 7151 (SHA1)", RFC 3174, September 2001. 7153 [RFC3447] Jonsson, J. and B. Kaliski, "Public-Key Cryptography 7154 Standards (PKCS) #1: RSA Cryptography Specifications 7155 Version 2.1", RFC 3447, February 2003. 7157 [RFC3629] Yergeau, F., "UTF-8, a transformation format of ISO 7158 10646", STD 63, RFC 3629, November 2003. 7160 [RFC3986] Berners-Lee, T., Fielding, R., and L. Masinter, "Uniform 7161 Resource Identifier (URI): Generic Syntax", STD 66, 7162 RFC 3986, January 2005. 7164 [RFC4279] Eronen, P. and H. Tschofenig, "Pre-Shared Key Ciphersuites 7165 for Transport Layer Security (TLS)", RFC 4279, 7166 December 2005. 7168 [RFC4347] Rescorla, E. and N. Modadugu, "Datagram Transport Layer 7169 Security", RFC 4347, April 2006. 7171 [RFC4395] Hansen, T., Hardie, T., and L. Masinter, "Guidelines and 7172 Registration Procedures for New URI Schemes", BCP 35, 7173 RFC 4395, February 2006. 7175 [RFC4648] Josefsson, S., "The Base16, Base32, and Base64 Data 7176 Encodings", RFC 4648, October 2006. 7178 [RFC5245] Rosenberg, J., "Interactive Connectivity Establishment 7179 (ICE): A Protocol for Network Address Translator (NAT) 7180 Traversal for Offer/Answer Protocols", RFC 5245, 7181 April 2010. 7183 [RFC5246] Dierks, T. and E. Rescorla, "The Transport Layer Security 7184 (TLS) Protocol Version 1.2", RFC 5246, August 2008. 7186 [RFC5272] Schaad, J. and M. Myers, "Certificate Management over CMS 7187 (CMC)", RFC 5272, June 2008. 7189 [RFC5273] Schaad, J. and M. Myers, "Certificate Management over CMS 7190 (CMC): Transport Protocols", RFC 5273, June 2008. 7192 [RFC5389] Rosenberg, J., Mahy, R., Matthews, P., and D. Wing, 7193 "Session Traversal Utilities for NAT (STUN)", RFC 5389, 7194 October 2008. 7196 [RFC5405] Eggert, L. and G. Fairhurst, "Unicast UDP Usage Guidelines 7197 for Application Designers", BCP 145, RFC 5405, 7198 November 2008. 7200 [RFC5766] Mahy, R., Matthews, P., and J. Rosenberg, "Traversal Using 7201 Relays around NAT (TURN): Relay Extensions to Session 7202 Traversal Utilities for NAT (STUN)", RFC 5766, April 2010. 7204 [RFC5952] Kawamura, S. and M. Kawashima, "A Recommendation for IPv6 7205 Address Text Representation", RFC 5952, August 2010. 7207 [RFC6091] Mavrogiannopoulos, N. and D. Gillmor, "Using OpenPGP Keys 7208 for Transport Layer Security (TLS) Authentication", 7209 RFC 6091, February 2011. 7211 [RFC6234] Eastlake, D. and T. Hansen, "US Secure Hash Algorithms 7212 (SHA and SHA-based HMAC and HKDF)", RFC 6234, May 2011. 7214 [RFC6298] Paxson, V., Allman, M., Chu, J., and M. Sargent, 7215 "Computing TCP's Retransmission Timer", RFC 6298, 7216 June 2011. 7218 [w3c-xml-namespaces] 7219 Bray, T., Hollander, D., Layman, A., Tobin, R., and Henry 7220 S. , "Namespaces in XML 1.0 (Third Edition)". 7222 16.2. Informative References 7224 [Chord] Stoica, I., Morris, R., Liben-Nowell, D., Karger, D., 7225 Kaashoek, M., Dabek, F., and H. Balakrishnan, "Chord: A 7226 Scalable Peer-to-peer Lookup Protocol for Internet 7227 Applications", IEEE/ACM Transactions on Networking Volume 7228 11, Issue 1, 17-32, Feb 2003. 7230 [Eclipse] Singh, A., Ngan, T., Druschel, T., and D. Wallach, 7231 "Eclipse Attacks on Overlay Networks: Threats and 7232 Defenses", INFOCOM 2006, April 2006. 7234 [I-D.ietf-hip-reload-instance] 7235 Keranen, A., Camarillo, G., and J. Maenpaa, "Host Identity 7236 Protocol-Based Overlay Networking Environment (HIP BONE) 7237 Instance Specification for REsource LOcation And Discovery 7238 (RELOAD)", draft-ietf-hip-reload-instance-04 (work in 7239 progress), October 2011. 7241 [I-D.ietf-mmusic-ice-tcp] 7242 Rosenberg, J., Keranen, A., Lowekamp, B., and A. Roach, 7243 "TCP Candidates with Interactive Connectivity 7244 Establishment (ICE)", draft-ietf-mmusic-ice-tcp-16 (work 7245 in progress), November 2011. 7247 [I-D.ietf-p2psip-diagnostics] 7248 Bryan, D., Jiang, X., Even, R., and H. Song, "P2PSIP 7249 Overlay Diagnostics", draft-ietf-p2psip-diagnostics-08 7250 (work in progress), December 2011. 7252 [I-D.ietf-p2psip-self-tuning] 7253 Maenpaa, J., Camarillo, G., and J. Hautakorpi, "A Self- 7254 tuning Distributed Hash Table (DHT) for REsource LOcation 7255 And Discovery (RELOAD)", draft-ietf-p2psip-self-tuning-05 7256 (work in progress), January 2012. 7258 [I-D.ietf-p2psip-service-discovery] 7259 Maenpaa, J. and G. Camarillo, "Service Discovery Usage for 7260 REsource LOcation And Discovery (RELOAD)", 7261 draft-ietf-p2psip-service-discovery-04 (work in progress), 7262 January 2012. 7264 [I-D.ietf-p2psip-sip] 7265 Jennings, C., Lowekamp, B., Rescorla, E., Baset, S., and 7266 H. Schulzrinne, "A SIP Usage for RELOAD", 7267 draft-ietf-p2psip-sip-07 (work in progress), January 2012. 7269 [I-D.jiang-p2psip-relay] 7270 Jiang, X., Zong, N., Even, R., and Y. Zhang, "An extension 7271 to RELOAD to support Direct Response and Relay Peer 7272 routing", draft-jiang-p2psip-relay-05 (work in progress), 7273 March 2011. 7275 [RFC1122] Braden, R., "Requirements for Internet Hosts - 7276 Communication Layers", STD 3, RFC 1122, October 1989. 7278 [RFC2311] Dusse, S., Hoffman, P., Ramsdell, B., Lundblade, L., and 7279 L. Repka, "S/MIME Version 2 Message Specification", 7280 RFC 2311, March 1998. 7282 [RFC3688] Mealling, M., "The IETF XML Registry", BCP 81, RFC 3688, 7283 January 2004. 7285 [RFC4086] Eastlake, D., Schiller, J., and S. Crocker, "Randomness 7286 Requirements for Security", BCP 106, RFC 4086, June 2005. 7288 [RFC4145] Yon, D. and G. Camarillo, "TCP-Based Media Transport in 7289 the Session Description Protocol (SDP)", RFC 4145, 7290 September 2005. 7292 [RFC4787] Audet, F. and C. Jennings, "Network Address Translation 7293 (NAT) Behavioral Requirements for Unicast UDP", BCP 127, 7294 RFC 4787, January 2007. 7296 [RFC5054] Taylor, D., Wu, T., Mavrogiannopoulos, N., and T. Perrin, 7297 "Using the Secure Remote Password (SRP) Protocol for TLS 7298 Authentication", RFC 5054, November 2007. 7300 [RFC5095] Abley, J., Savola, P., and G. Neville-Neil, "Deprecation 7301 of Type 0 Routing Headers in IPv6", RFC 5095, 7302 December 2007. 7304 [RFC5201] Moskowitz, R., Nikander, P., Jokela, P., and T. Henderson, 7305 "Host Identity Protocol", RFC 5201, April 2008. 7307 [RFC5280] Cooper, D., Santesson, S., Farrell, S., Boeyen, S., 7308 Housley, R., and W. Polk, "Internet X.509 Public Key 7309 Infrastructure Certificate and Certificate Revocation List 7310 (CRL) Profile", RFC 5280, May 2008. 7312 [RFC5694] Camarillo, G. and IAB, "Peer-to-Peer (P2P) Architecture: 7313 Definition, Taxonomies, Examples, and Applicability", 7314 RFC 5694, November 2009. 7316 [RFC5765] Schulzrinne, H., Marocco, E., and E. Ivov, "Security 7317 Issues and Solutions in Peer-to-Peer Systems for Realtime 7318 Communications", RFC 5765, February 2010. 7320 [RFC5785] Nottingham, M. and E. Hammer-Lahav, "Defining Well-Known 7321 Uniform Resource Identifiers (URIs)", RFC 5785, 7322 April 2010. 7324 [RFC6079] Camarillo, G., Nikander, P., Hautakorpi, J., Keranen, A., 7325 and A. Johnston, "HIP BONE: Host Identity Protocol (HIP) 7326 Based Overlay Networking Environment (BONE)", RFC 6079, 7327 January 2011. 7329 [Sybil] Douceur, J., "The Sybil Attack", IPTPS 02, March 2002. 7331 [UnixTime] 7332 Wikipedia, "Unix Time", . 7335 [bryan-design-hotp2p08] 7336 Bryan, D., Lowekamp, B., and M. Zangrilli, "The Design of 7337 a Versatile, Secure P2PSIP Communications Architecture for 7338 the Public Internet", Hot-P2P'08. 7340 [handling-churn-usenix04] 7341 Rhea, S., Geels, D., Roscoe, T., and J. Kubiatowicz, 7342 "Handling Churn in a DHT", In Proc. of the USENIX Annual 7343 Technical Conference June 2004 USENIX 2004. 7345 [lookups-churn-p2p06] 7346 Wu, D., Tian, Y., and K. Ng, "Analytical Study on 7347 Improving DHT Lookup Performance under Churn", IEEE 7348 P2P'06. 7350 [minimizing-churn-sigcomm06] 7351 Godfrey, P., Shenker, S., and I. Stoica, "Minimizing Churn 7352 in Distributed Systems", SIGCOMM 2006. 7354 [non-transitive-dhts-worlds05] 7355 Freedman, M., Lakshminarayanan, K., Rhea, S., and I. 7356 Stoica, "Non-Transitive Connectivity and DHTs", 7357 WORLDS'05. 7359 [opendht-sigcomm05] 7360 Rhea, S., Godfrey, B., Karp, B., Kubiatowicz, J., 7361 Ratnasamy, S., Shenker, S., Stoica, I., and H. Yu, 7362 "OpenDHT: A Public DHT and its Uses", SIGCOMM'05. 7364 [vulnerabilities-acsac04] 7365 Srivatsa, M. and L. Liu, "Vulnerabilities and Security 7366 Threats in Structured Peer-to-Peer Systems: A Quantitative 7367 Analysis", ACSAC 2004. 7369 [wikiChord] 7370 Wikipedia, "Chord (peer-to-peer)", 7371 . 7373 Appendix A. Routing Alternatives 7375 Significant discussion has been focused on the selection of a routing 7376 algorithm for P2PSIP. This section discusses the motivations for 7377 selecting symmetric recursive routing for RELOAD and describes the 7378 extensions that would be required to support additional routing 7379 algorithms. 7381 A.1. Iterative vs Recursive 7383 Iterative routing has a number of advantages. It is easier to debug, 7384 consumes fewer resources on intermediate peers, and allows the 7385 querying peer to identify and route around misbehaving peers 7386 [non-transitive-dhts-worlds05]. However, in the presence of NATs, 7387 iterative routing is intolerably expensive because a new connection 7388 must be established for each hop (using ICE) [bryan-design-hotp2p08]. 7390 Iterative routing is supported through the RouteQuery mechanism and 7391 is primarily intended for debugging. It also allows the querying 7392 peer to evaluate the routing decisions made by the peers at each hop, 7393 consider alternatives, and perhaps detect at what point the 7394 forwarding path fails. 7396 A.2. Symmetric vs Forward response 7398 An alternative to the symmetric recursive routing method used by 7399 RELOAD is Forward-Only routing, where the response is routed to the 7400 requester as if it were a new message initiated by the responder (in 7401 the previous example, Z sends the response to A as if it were sending 7402 a request). Forward-only routing requires no state in either the 7403 message or intermediate peers. 7405 The drawback of forward-only routing is that it does not work when 7406 the overlay is unstable. For example, if A is in the process of 7407 joining the overlay and is sending a Join request to Z, it is not yet 7408 reachable via forward routing. Even if it is established in the 7409 overlay, if network failures produce temporary instability, A may not 7410 be reachable (and may be trying to stabilize its network connectivity 7411 via Attach messages). 7413 Furthermore, forward-only responses are less likely to reach the 7414 querying peer than symmetric recursive ones are, because the forward 7415 path is more likely to have a failed peer than is the request path 7416 (which was just tested to route the request) 7417 [non-transitive-dhts-worlds05]. 7419 An extension to RELOAD that supports forward-only routing but relies 7420 on symmetric responses as a fallback would be possible, but due to 7421 the complexities of determining when to use forward-only and when to 7422 fallback to symmetric, we have chosen not to include it as an option 7423 at this point. 7425 A.3. Direct Response 7427 Another routing option is Direct Response routing, in which the 7428 response is returned directly to the querying node. In the previous 7429 example, if A encodes its IP address in the request, then Z can 7430 simply deliver the response directly to A. In the absence of NATs or 7431 other connectivity issues, this is the optimal routing technique. 7433 The challenge of implementing direct response is the presence of 7434 NATs. There are a number of complexities that must be addressed. In 7435 this discussion, we will continue our assumption that A issued the 7436 request and Z is generating the response. 7438 o The IP address listed by A may be unreachable, either due to NAT 7439 or firewall rules. Therefore, a direct response technique must 7440 fallback to symmetric response [non-transitive-dhts-worlds05]. 7441 The hop-by-hop ACKs used by RELOAD allow Z to determine when A has 7442 received the message (and the TLS negotiation will provide earlier 7443 confirmation that A is reachable), but this fallback requires a 7444 timeout that will increase the response latency whenever A is not 7445 reachable from Z. 7446 o Whenever A is behind a NAT it will have multiple candidate IP 7447 addresses, each of which must be advertised to ensure 7448 connectivity; therefore Z will need to attempt multiple 7449 connections to deliver the response. 7450 o One (or all) of A's candidate addresses may route from Z to a 7451 different device on the Internet. In the worst case these nodes 7452 may actually be running RELOAD on the same port. Therefore, it is 7453 absolutely necessary to establish a secure connection to 7454 authenticate A before delivering the response. This step 7455 diminishes the efficiency of direct response because multiple 7456 roundtrips are required before the message can be delivered. 7457 o If A is behind a NAT and does not have a connection already 7458 established with Z, there are only two ways the direct response 7459 will work. The first is that A and Z both be behind the same NAT, 7460 in which case the NAT is not involved. In the more common case, 7461 when Z is outside A's NAT, the response will only be received if 7462 A's NAT implements endpoint-independent filtering. As the choice 7463 of filtering mode conflates application transparency with security 7464 [RFC4787], and no clear recommendation is available, the 7465 prevalence of this feature in future devices remains unclear. 7467 An extension to RELOAD that supports direct response routing but 7468 relies on symmetric responses as a fallback would be possible, but 7469 due to the complexities of determining when to use direct response 7470 and when to fallback to symmetric, and the reduced performance for 7471 responses to peers behind restrictive NATs, we have chosen not to 7472 include it as an option at this point. 7474 A.4. Relay Peers 7476 [I-D.jiang-p2psip-relay] has proposed implementing a form of direct 7477 response by having A identify a peer, Q, that will be directly 7478 reachable by any other peer. A uses Attach to establish a connection 7479 with Q and advertises Q's IP address in the request sent to Z. Z 7480 sends the response to Q, which relays it to A. This then reduces the 7481 latency to two hops, plus Z negotiating a secure connection to Q. 7483 This technique relies on the relative population of nodes such as A 7484 that require relay peers and peers such as Q that are capable of 7485 serving as a relay peer. It also requires nodes to be able to 7486 identify which category they are in. This identification problem has 7487 turned out to be hard to solve and is still an open area of 7488 exploration. 7490 An extension to RELOAD that supports relay peers is possible, but due 7491 to the complexities of implementing such an alternative, we have not 7492 added such a feature to RELOAD at this point. 7494 A concept similar to relay peers, essentially choosing a relay peer 7495 at random, has previously been suggested to solve problems of 7496 pairwise non-transitivity [non-transitive-dhts-worlds05], but 7497 deterministic filtering provided by NATs makes random relay peers no 7498 more likely to work than the responding peer. 7500 A.5. Symmetric Route Stability 7502 A common concern about symmetric recursive routing has been that one 7503 or more peers along the request path may fail before the response is 7504 received. The significance of this problem essentially depends on 7505 the response latency of the overlay. An overlay that produces slow 7506 responses will be vulnerable to churn, whereas responses that are 7507 delivered very quickly are vulnerable only to failures that occur 7508 over that small interval. 7510 The other aspect of this issue is whether the request itself can be 7511 successfully delivered. Assuming typical connection maintenance 7512 intervals, the time period between the last maintenance and the 7513 request being sent will be orders of magnitude greater than the delay 7514 between the request being forwarded and the response being received. 7515 Therefore, if the path was stable enough to be available to route the 7516 request, it is almost certainly going to remain available to route 7517 the response. 7519 An overlay that is unstable enough to suffer this type of failure 7520 frequently is unlikely to be able to support reliable functionality 7521 regardless of the routing mechanism. However, regardless of the 7522 stability of the return path, studies show that in the event of high 7523 churn, iterative routing is a better solution to ensure request 7524 completion [lookups-churn-p2p06] [non-transitive-dhts-worlds05] 7526 Finally, because RELOAD retries the end-to-end request, that retry 7527 will address the issues of churn that remain. 7529 Appendix B. Why Clients? 7531 There are a wide variety of reasons a node may act as a client rather 7532 than as a peer. This section outlines some of those scenarios and 7533 how the client's behavior changes based on its capabilities. 7535 B.1. Why Not Only Peers? 7537 For a number of reasons, a particular node may be forced to act as a 7538 client even though it is willing to act as a peer. These include: 7540 o The node does not have appropriate network connectivity, typically 7541 because it has a low-bandwidth network connection. 7542 o The node may not have sufficient resources, such as computing 7543 power, storage space, or battery power. 7544 o The overlay algorithm may dictate specific requirements for peer 7545 selection. These may include participating in the overlay to 7546 determine trustworthiness; controlling the number of peers in the 7547 overlay to reduce overly-long routing paths; or ensuring minimum 7548 application uptime before a node can join as a peer. 7550 The ultimate criteria for a node to become a peer are determined by 7551 the overlay algorithm and specific deployment. A node acting as a 7552 client that has a full implementation of RELOAD and the appropriate 7553 overlay algorithm is capable of locating its responsible peer in the 7554 overlay and using Attach to establish a direct connection to that 7555 peer. In that way, it may elect to be reachable under either of the 7556 routing approaches listed above. Particularly for overlay algorithms 7557 that elect nodes to serve as peers based on trustworthiness or 7558 population, the overlay algorithm may require such a client to locate 7559 itself at a particular place in the overlay. 7561 B.2. Clients as Application-Level Agents 7563 SIP defines an extensive protocol for registration and security 7564 between a client and its registrar/proxy server(s). Any SIP device 7565 can act as a client of a RELOAD-based P2PSIP overlay if it contacts a 7566 peer that implements the server-side functionality required by the 7567 SIP protocol. In this case, the peer would be acting as if it were 7568 the user's peer, and would need the appropriate credentials for that 7569 user. 7571 Application-level support for clients is defined by a usage. A usage 7572 offering support for application-level clients should specify how the 7573 security of the system is maintained when the data is moved between 7574 the application and RELOAD layers. 7576 Authors' Addresses 7578 Cullen Jennings 7579 Cisco 7580 170 West Tasman Drive 7581 MS: SJC-21/2 7582 San Jose, CA 95134 7583 USA 7585 Phone: +1 408 421-9990 7586 Email: fluffy@cisco.com 7588 Bruce B. Lowekamp (editor) 7589 Skype 7590 Palo Alto, CA 7591 USA 7593 Email: bbl@lowekamp.net 7595 Eric Rescorla 7596 RTFM, Inc. 7597 2064 Edgewood Drive 7598 Palo Alto, CA 94303 7599 USA 7601 Phone: +1 650 678 2350 7602 Email: ekr@rtfm.com 7604 Salman A. Baset 7605 Columbia University 7606 1214 Amsterdam Avenue 7607 New York, NY 7608 USA 7610 Email: salman@cs.columbia.edu 7612 Henning Schulzrinne 7613 Columbia University 7614 1214 Amsterdam Avenue 7615 New York, NY 7616 USA 7618 Email: hgs@cs.columbia.edu