158-microdescriptors.txt 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205
  1. Filename: 158-microdescriptors.txt
  2. Title: Clients download consensus + microdescriptors
  3. Author: Roger Dingledine
  4. Created: 17-Jan-2009
  5. Status: Open
  6. 1. Overview
  7. This proposal replaces section 3.2 of proposal 141, which was
  8. called "Fetching descriptors on demand". Rather than modifying the
  9. circuit-building protocol to fetch a server descriptor inline at each
  10. circuit extend, we instead put all of the information that clients need
  11. either into the consensus itself, or into a new set of data about each
  12. relay called a microdescriptor. The microdescriptor is a direct
  13. transform from the relay descriptor, so relays don't even need to know
  14. this is happening.
  15. Descriptor elements that are small and frequently changing should go
  16. in the consensus itself, and descriptor elements that are small and
  17. relatively static should go in the microdescriptor. If we ever end up
  18. with descriptor elements that aren't small yet clients need to know
  19. them, we'll need to resume considering some design like the one in
  20. proposal 141.
  21. 2. Motivation
  22. See
  23. http://archives.seul.org/or/dev/Nov-2008/msg00000.html and
  24. http://archives.seul.org/or/dev/Nov-2008/msg00001.html and especially
  25. http://archives.seul.org/or/dev/Nov-2008/msg00007.html
  26. for a discussion of the options and why this is currently the best
  27. approach.
  28. 3. Design
  29. There are three pieces to the proposal. First, authorities will list in
  30. their votes (and thus in the consensus) what relay descriptor elements
  31. are included in the microdescriptor, and also list the expected hash
  32. of microdescriptor for each relay. Second, directory mirrors will serve
  33. microdescriptors. Third, clients will ask for them and cache them.
  34. 3.1. Consensus changes
  35. V3 votes should include a new line:
  36. microdescriptor-elements bar baz foo
  37. listing each descriptor element (sorted alphabetically) that authority
  38. included when it calculated its expected microdescriptor hashes.
  39. We also need to include the hash of each expected microdescriptor in
  40. the routerstatus section. I suggest a new "m" line for each stanza,
  41. with the base64 of the hash of the elements that the authority voted
  42. for above.
  43. The consensus microdescriptor-elements and "m" lines are then computed
  44. as described in Section 3.1.2 below.
  45. I believe that means we need a new consensus-method "6" that knows
  46. how to compute the microdescriptor-elements and add "m" lines.
  47. 3.1.1. Descriptor elements to include for now
  48. To start, the element list that authorities suggest should be
  49. family onion-key
  50. (Note that the or-dev posts above only mention onion-key, but if
  51. we don't also include family then clients will never learn it. It
  52. seemed like it should be relatively static, so putting it in the
  53. microdescriptor is smarter than trying to fit it into the consensus.)
  54. We could imagine a config option "family,onion-key" so authorities
  55. could change their voted preferences without needing to upgrade.
  56. 3.1.2. Computing consensus for microdescriptor-elements and "m" lines
  57. One approach is for the consensus microdescriptor-elements line to
  58. include every element listed by a majority of authorities, sorted. The
  59. problem here is that it will no longer be deterministic what the correct
  60. hash for the "m" line should be. We could imagine telling the authority
  61. to go look in its descriptor and produce the right hash itself, but
  62. we don't want consensus calculation to be based on external data like
  63. that. (Plus, the authority may not have the descriptor that everybody
  64. else voted to use.)
  65. The better approach is to take the exact set that has the most votes
  66. (breaking ties by the set that has the most elements, and breaking
  67. ties after that by whichever is alphabetically first). That will
  68. increase the odds that we actually get a microdescriptor hash that
  69. is both a) for the descriptor we're putting in the consensus, and b)
  70. over the elements that we're declaring it should be for.
  71. Then the "m" line for a given relay is the one that gets the most votes
  72. from authorities that both a) voted for the microdescriptor-elements
  73. line we're using, and b) voted for the descriptor we're using.
  74. (If there's a tie, use the smaller hash. But really, if there are
  75. multiple such votes and they differ about a microdescriptor, we caught
  76. one of them lying or being buggy. We should log it to track down why.)
  77. If there are no such votes, then we leave out the "m" line for that
  78. relay. That means clients should avoid it for this time period. (As
  79. an extension it could instead mean that clients should fetch the
  80. descriptor and figure out its microdescriptor themselves. But let's
  81. not get ahead of ourselves.)
  82. It would be nice to have a more foolproof way to agree on what
  83. microdescriptor hash each authority should vote for, so we can avoid
  84. missing "m" lines. Just switching to a new consensus-method each time
  85. we change the set of microdescriptor-elements won't help though, since
  86. each authority will still have to decide what hash to vote for before
  87. knowing what consensus-method will be used.
  88. Here's one way we could do it. Each vote / consensus includes
  89. the microdescriptor-elements that were used to compute the hashes,
  90. and also a preferred-microdescriptor-elements set. If an authority
  91. has a consensus from the previous period, then it should use the
  92. consensus preferred-microdescriptor-elements when computing its votes
  93. for microdescriptor-elements and the appropriate hashes in the upcoming
  94. period. (If it has no previous consensus, then it just writes its
  95. own preferences in both lines.)
  96. 3.2. Directory mirrors serve microdescriptors
  97. Directory mirrors should then read the microdescriptor-elements line
  98. from the consensus, and learn how to answer requests. (Directory mirrors
  99. continue to serve normal relay descriptors too, a) to serve old clients
  100. and b) to be able to construct microdescriptors on the fly.)
  101. The microdescriptors with hashes <D1>,<D2>,<D3> should be available at:
  102. http://<hostname>/tor/micro/d/<D1>+<D2>+<D3>.z
  103. All the microdescriptors from the current consensus should also be
  104. available at:
  105. http://<hostname>/tor/micro/all.z
  106. so a client that's bootstrapping doesn't need to send a 70KB URL just
  107. to name every microdescriptor it's looking for.
  108. The format of a microdescriptor is the header line
  109. "microdescriptor-header"
  110. followed by each element (keyword and body), alphabetically. There's
  111. no need to mention what hash it's for, since it's self-identifying:
  112. you can hash the elements to learn this.
  113. (Do we need a footer line to show that it's over, or is the next
  114. microdescriptor line or EOF enough of a hint? A footer line wouldn't
  115. hurt much. Also, no fair voting for the microdescriptor-element
  116. "microdescriptor-header".)
  117. The hash of the microdescriptor is simply the hash of the concatenated
  118. elements -- not counting the header line or hypothetical footer line.
  119. Unless you prefer that?
  120. Is there a reasonable way to version these things? We could say that
  121. the microdescriptor-header line can contain arguments which clients
  122. must ignore if they don't understand them. Any better ways?
  123. Directory mirrors should check to make sure that the microdescriptors
  124. they're about to serve match the right hashes (either the hashes from
  125. the fetch URL or the hashes from the consensus, respectively).
  126. We will probably want to consider some sort of smart data structure to
  127. be able to quickly convert microdescriptor hashes into the appropriate
  128. microdescriptor. Clients will want this anyway when they load their
  129. microdescriptor cache and want to match it up with the consensus to
  130. see what's missing.
  131. 3.3. Clients fetch them and cache them
  132. When a client gets a new consensus, it looks to see if there are any
  133. microdescriptors it needs to learn. If it needs to learn more than
  134. some threshold of the microdescriptors (half?), it requests 'all',
  135. else it requests only the missing ones.
  136. Clients maintain a cache of microdescriptors along with metadata like
  137. when it was last referenced by a consensus. They keep a microdescriptor
  138. until it hasn't been mentioned in any consensus for a week. Future
  139. clients might cache them for longer or shorter times.
  140. 3.3.1. Information leaks from clients
  141. If a client asks you for a set of microdescs, then you know she didn't
  142. have them cached before. How much does that leak? What about when
  143. we're all using our entry guards as directory guards, and we've seen
  144. that user make a bunch of circuits already?
  145. Fetching "all" when you need at least half is a good first order fix,
  146. but might not be all there is to it.
  147. Another future option would be to fetch some of the microdescriptors
  148. anonymously (via a Tor circuit).
  149. 4. Transition and deployment
  150. Phase one, the directory authorities should start voting on
  151. microdescriptors and microdescriptor elements, and putting them in the
  152. consensus. This should happen during the 0.2.1.x series, and should
  153. be relatively easy to do.
  154. Phase two, directory mirrors should learn how to serve them, and learn
  155. how to read the consensus to find out what they should be serving. This
  156. phase could be done either in 0.2.1.x or early in 0.2.2.x, depending
  157. on how messy it turns out to be and how quickly we get around to it.
  158. Phase three, clients should start fetching and caching them instead
  159. of normal descriptors. This should happen post 0.2.1.x.