141-jit-sd-downloads.txt 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242
  1. Filename: 141-jit-sd-downloads.txt
  2. Title: Download server descriptors on demand
  3. Version: $Revision$
  4. Last-Modified: $Date$
  5. Author: Peter Palfrader
  6. Created: 15-Jun-2008
  7. Status: Draft
  8. 1. Overview
  9. Downloading all server descriptors is the most expensive part
  10. of bootstrapping a Tor client. These server descriptors currently
  11. amount to about 1.5 Megabytes of data, and this size will grow
  12. linearly with network size.
  13. Fetching all these server descriptors takes a long while for people
  14. behind slow network connections. It is also a considerable load on
  15. our network of directory mirrors.
  16. This document describes proposed changes to the Tor network and
  17. directory protocol so that clients will no longer need to download
  18. all server descriptors.
  19. These changes consist of moving load balancing information into
  20. network status documents, implementing a means to download server
  21. descriptors on demand in an anonymity-preserving way, and dealing
  22. with exit node selection.
  23. 2. What is in a server descriptor
  24. When a Tor client starts the first thing it will try to get is a
  25. current network status document, a consensus signed by a majority
  26. of directory authorities. This document is currently about 100
  27. Kilobytes in size, tho it will grow linearly with network size.
  28. This document lists all servers currently running on the network.
  29. The Tor client will then try to get a server descriptor for each
  30. of the running servers. All server descriptors currently amount
  31. to about 1.5 Megabytes of downloads.
  32. A Tor client learns several things about a server from its descriptor.
  33. Some of these it already learned from the network status document
  34. published by the authorities, but the server descriptor contains it
  35. again in a single statement signed by the server itself, not just by
  36. the directory authorities.
  37. Tor clients use the information from server descriptors for
  38. different purposes, which are considered in the following sections.
  39. #three ways: One, to determine if a server will be able to handle
  40. #this client's request; two, to actually communicate or use the server;
  41. #three, for load balancing decisions.
  42. #
  43. #These three points are considered in the following subsections.
  44. 2.1 Load balancing
  45. The Tor load balancing mechanism is quite complex in its details, but
  46. it has a simple goal: The more traffic a server can handle the more
  47. traffic it should get. That means the more traffic a server can
  48. handle the more likely a client will use it.
  49. For this purpose each server descriptor has bandwidth information
  50. which tries to convey a server's capacity to clients.
  51. Currently we weigh servers differently for different purposes. There
  52. is a weigh for when we use a server as a guard node (our entry to the
  53. Tor network), there is one weigh we assign servers for exit duties,
  54. and a third for when we need intermediate (middle) nodes.
  55. 2.2 Exit information
  56. When a Tor wants to exit to some resource on the internet it will
  57. build a circuit to an exit node that allows access to that resource's
  58. IP address and TCP Port.
  59. When building that circuit the client can make sure that the circuit
  60. ends at a server that will be able to fulfill the request because the
  61. client already learned of all the servers' exit policies from their
  62. descriptors.
  63. 2.3 Capability information
  64. Server descriptors contain information about the specific version or
  65. the Tor protocol they understand [proposal 105].
  66. Furthermore the server descriptor also contains the exact version of
  67. the Tor software that the server is running and some decisions are
  68. made based on the server version number (for instance a Tor client
  69. will only make conditional consensus requests [proposal from 13 Apr
  70. 2008 that never got a number] when talking to Tor servers version
  71. 0.2.1.1-alpha or later).
  72. 2.4 Contact/key information
  73. A server descriptor lists a server's IP address and TCP ports on which
  74. it accepts onion and directory connections. Furthermore it contains
  75. the onion key, a short lived RSA key to which clients encrypt CREATE
  76. cells.
  77. 2.5 Identity information
  78. A Tor client learns the digest of a server's key from the network
  79. status document. Once it has a server descriptor this descriptor
  80. contains the full RSA identity key of the server. Clients verify
  81. that 1) the digest of the identity key matches the expected digest
  82. it got from the consensus, and 2) that the signature on the descriptor
  83. from that key is valid.
  84. 3. No longer require clients to have copies of all SDs
  85. 3.1 Load balancing info in consensus documents
  86. One of the reasons why clients download all server descriptors is for
  87. doing load proper load balancing as described in 2.1. In order for
  88. clients to not require all server descriptors this information will
  89. have to move into the network status document.
  90. Consensus documents will have a new line per router similar
  91. to the "r", "s", and "v" lines that already exist. This line
  92. will convey weight information to clients.
  93. "w Exit=41 Guard=94 Middle=543 ..."
  94. It starts with the letter w and then contains any number of Key=Value
  95. pairs. Values will be non-negative integers. Clients will pick
  96. routers with a propability proportional to the number for the intended
  97. purpose.
  98. Clients MUST accept sums of all weights for a given purpose over all
  99. routers in a consensus up to UINT64_max.
  100. [XXX how do we arrive at a consensus weight?
  101. option a) Perhaps the vote could contain the node's bandwidth, and
  102. this could be used to calculate the weights? It's
  103. necessary that the consensus remain a deterministic
  104. function of the votes.
  105. option b) Every voter assigns weights for each of the purposes
  106. (Exit, Guard, ..) so that their total sum is some constant
  107. X. When building a consensus we take the median for each
  108. purpose for each router.
  109. Option a has the disadvantage that if we want to tweak the weighting
  110. we have to make a new consensus-method]
  111. 3.2 Fetching descriptors on demand
  112. As described in 2.4 a descriptor lists IP address, OR- and Dir-Port,
  113. and the onion key for a server.
  114. A client already knows the IP address and the ports from the consensus
  115. documents, but without the onion key it will not be able to send
  116. CREATE/EXTEND cells for that server. Since the client needs the onion
  117. key it needs the descriptor.
  118. If a client only downloaded a few descriptors in an observable manner
  119. then that would leak which nodes it was going to use.
  120. This proposal suggests the following:
  121. 1) when connecting to a guard node for which the client does not
  122. yet have a cached descriptor it requests the descriptor it
  123. expects by hash. (The consensus document that the client holds
  124. has a hash for the descriptor of this server. We want exactly
  125. that descriptor, not a different one.)
  126. It does that by sending a RELAY_REQUEST_SD cell.
  127. A client MAY cache the descriptor of the guard node so that it does
  128. not need to request it every single time it contacts the guard.
  129. 2) when a client wants to extend a circuit that currently ends in
  130. server B to a new next server C, the client will send a
  131. RELAY_REQUEST_SD cell to server B. This cell contains in its
  132. payload the hash of a server descriptor the client would like
  133. to obtain (C's server descriptor). The server sends back the
  134. descriptor and the client can now form a valid EXTEND/CREATE cell
  135. encrypted to C's onion key.
  136. Clients MUST NOT cache such descriptors. If they did they might
  137. leak that they already extended to that server at least once
  138. before.
  139. Replies to RELAY_REQUEST_SD requests need to be padded to some
  140. constant upper limit in order to conceal a client's destination
  141. from anybody who might be counting cells/bytes.
  142. RELAY_REQUEST_SD cells contain the following information:
  143. - hash of the server descriptor requested
  144. - hash of the identity digest of the server for which we want the SD
  145. - IP address and OR-port or the server for which we want the SD
  146. - padding factor - the number of cells we want the answer
  147. padded to.
  148. [XXX this just occured to me and it might be smart. or it might
  149. be stupid. clients would learn the padding factor they want
  150. to use from the consensus document. This allows us to grow
  151. the replies later on should SDs become larger.]
  152. [XXX: figure out a decent padding size]
  153. 3.3 Protocol versions
  154. [XXX: find out where we need "opt protocols Link 1 2 Circuit 1"
  155. information described in 2.3 above. If we need it, it might have
  156. to go into the consensus document.]
  157. [XXX: Similarly find out where we need the version number of a
  158. remote tor server. This information is in the consensus, but
  159. maybe we use it in some place where having it signed by the
  160. server in question is really important?]
  161. 3.4 Exit selection
  162. Currently finding an appropriate exit node for a user's request is
  163. easy for a client because it has complete knowledge of all the exit
  164. policies of all servers on the network.
  165. [XXX: I have no finished ideas here yet.
  166. - if clients only rely on the current exit flag they will
  167. a) never use servers for exit purposes that don't have it,
  168. b) will have a hard time finding a suitable exit node for
  169. their weird port that only a few servers allow.
  170. - the authorities could create a new summary document that
  171. lists all the exit policies and their nodes (by fingerprint).
  172. I need to find out how large that document would be.
  173. - can we make the "Exit" flag more useful? can we come
  174. up with some "standard policies" and have operators pick
  175. one of the standards?
  176. ]
  177. 4. Future possibilities
  178. This proposal still requires that all servers have the descriptors of
  179. every other node in the network in order to answer RELAY_REQUEST_SD
  180. cells. These cells are sent when a circuit is extended from ending at
  181. node B to a new node C. In that case B would have to answer a
  182. RELAY_REQUEST_SD cell that asks for C's server descriptor (by SD digest).
  183. In order to answer that request B obviously needs a copy of C's server
  184. descriptor. The RELAY_REQUEST_SD cell already has all the info that
  185. B needs to contact C so it can ask about the descriptor before passing it
  186. back to the client.