dir-voting.txt 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278
  1. $Id: /tor/branches/eventdns/doc/dir-spec.txt 9469 2006-11-01T23:56:30.179423Z nickm $
  2. Voting on the Tor Directory System
  3. 0. Scope and preliminaries
  4. This document describes a consensus voting scheme for Tor directories.
  5. Once it's accepted, it should be merged with dir-spec.txt. Some
  6. preliminaries for authority and caching support should be done during
  7. the 0.1.2.x series; the main deployment should come during the 0.1.3.x
  8. series.
  9. 0.1. Goals and motivation: voting.
  10. The current directory system relies on clients downloading separate
  11. network status statements from the caches signed by each directory.
  12. Clients download a new statement every 30 minutes or so, choosing to
  13. replace the oldest statement they currently have.
  14. This creates a partitioning problem: different clients have different
  15. "most recent" networkstatus sources, and different versions of each
  16. (since authorities change their statements often). Also, it is very
  17. redundant: most of the downloaded networkstatus are probably quite
  18. similar.
  19. So if we have clients only download a single multiply signed consensus
  20. network status statement, we can:
  21. - Save bandwidth.
  22. - Reduce client partitioning
  23. - Reduce client-side and cache-side storage
  24. - Simplify client-side voting code (by moving voting away from the
  25. client)
  26. We should try to do this without:
  27. - Assuming that client-side or cache-side clocks are more correct
  28. than we assume now.
  29. - Assuming that authority clocks are perfectly correct.
  30. - Degrading badly if an authority dies or is offline for a bit.
  31. We do not have to perform well if:
  32. - No clique of more than half the authorities can agree about who
  33. the authorities are.
  34. 1. The idea.
  35. Instead of publishing a network status whenever something changes,
  36. each authority instead publishes a fresh network status only once per
  37. "period" (say, 60 minutes). Authorities either upload this network
  38. status (or "vote") to every other authority, or download every other
  39. authority's "vote" (see 3.1 below for discussion on push vs pull).
  40. After an authority has (or has become convinced that it won't be able to
  41. get) every other authority's vote, it deterministically computes a
  42. consensus networkstatus, and signs it. Authorities download (or are
  43. uploaded; see 3.1) one another's signatures, and form a multiply signed
  44. consensus. This multiply-signed consensus is what caches cache and what
  45. clients download.
  46. If an authority is down, authorities vote based on what they *can*
  47. download/get uploaded.
  48. If an authority is "a little" down and only some authorities can reach
  49. it, authorities try to get its info from other authorities.
  50. If an authority computes the vote wrong, its signature isn't included on
  51. the consensus.
  52. Clients use a consensus if it is signed by more than half the
  53. authorities they recognize. If they can't find any such consensus,
  54. clients either use an older version, or beg the user to adapt the list
  55. of authorities.
  56. 2. Details.
  57. 2.1. Vote specifications
  58. Votes in v2.1 are just like v2 network status documents. We add these
  59. fields to the preamble:
  60. "vote-status" -- the word "vote".
  61. "valid-until" -- the time when this authority expects to publish its
  62. next vote.
  63. "known-flags" -- a space-separated list of flags that will sometimes
  64. be included on "s" lines later in the vote.
  65. "dir-source" -- as before, except the "hostname" part MUST be the
  66. authority's nickname, which MUST be unique among authorities, and
  67. MUST match the nickname in the "directory-signature" entry.
  68. Authorities SHOULD cache their most recently generated votes so they
  69. can persist them across restarts. Authorities SHOULD NOT generate
  70. another document until valid-until has passed.
  71. Router entries in the vote MUST be sorted in ascending order by router
  72. identity digest. The flags in "s" lines MUST appear in alphabetical
  73. order.
  74. Votes SHOULD be synchronized to half-hour publication intervals (one
  75. hour? XXX say more; be more precise.)
  76. XXXX some way to request older networkstatus docs?
  77. 2.2. Consensus directory specifications
  78. Consensuses are like v2.1 votes, except for the following fields:
  79. "vote-status" -- the word "consensus".
  80. "published" is the latest of all the published times on the votes.
  81. "valid-until" is the earliest of all the valid-until times on the
  82. votes.
  83. "dir-source" and "fingerprint" and "dir-signing-key" and "contact"
  84. are included for each authority that contributed to the vote.
  85. "vote-digest" for each authority that contributed to the vote,
  86. calculated as for the digest in the signature on the vote. [XXX
  87. re-English this sentence]
  88. "client-versions" and "server-versions" are sorted in ascending
  89. order.
  90. "dir-options" and "known-flags" are not included.
  91. The fields MUST occur in the following order:
  92. "network-status-version"
  93. "vote-status"
  94. "published"
  95. "valid-until"
  96. For each authority, sorted in ascending order of nickname, case-
  97. insensitively:
  98. "dir-source", "fingerprint", "contact", "dir-signing-key",
  99. "vote-digest".
  100. "client-versions"
  101. "server-versions"
  102. The signatures at the end of the document appear as multiple instances
  103. directory-signature, sorted in ascending order by nickname,
  104. case-insensitively.
  105. A router entry should be included in the result if it is included by
  106. more than half of the authorities (total authorities, not just those
  107. whose votes we have). A router entry has a flag set if it is included
  108. by more than half of the authorities who care about that flag. [XXXX
  109. this creates a DOS incentive. Can we remember what flags people set the
  110. last time we saw them?]
  111. [What does the signature hash cover ? XXX]
  112. 2.3. Agreement and timeline
  113. [XXXX publish signed vote summaries.]
  114. [XXXX URL list: vote, other people's votes, directory.]
  115. [XXXX in-progress URL vs done URL]
  116. [XXXX Store votes to disk.]
  117. 2.4. Distributing routerdescs between authorities
  118. Consensus will be more meaningful if authorities take steps to make sure
  119. that they all have the same set of descriptors _before_ the voting
  120. starts. This is safe, since all descriptors are self-certified and
  121. timestamped: it's always okay to replace a signed descriptor with a more
  122. recent one signed by the same identity.
  123. In the long run, we might want some kind of sophisticated process here.
  124. For now, since authorities already download one another's networkstatus
  125. documents and use them to determine what descriptors to download from one
  126. another, we can rely on this existing mechanism to keep authorities up to
  127. date.
  128. 3. Questions and concerns
  129. 3.1. Push or pull?
  130. [XXXX]
  131. 3.2. Dropping "opt".
  132. The "opt" keyword in Tor's directory formats was originally intended to
  133. mean, "it is okay to ignore this entry if you don't understand it"; the
  134. default behavior has been "discard a routerdesc if it contains entries you
  135. don't recognize."
  136. But so far, every new flag we have added has been marked 'opt'. It would
  137. probably make sense to change the default behavior to "ignore unrecognized
  138. fields", and add the statement that clients SHOULD ignore fields they don't
  139. recognize. As a meta-principle, we should say that clients and servers
  140. MUST NOT have to understand new fields in order to use directory documents
  141. correctly.
  142. Of course, this will make it impossible to say, "The format has changed a
  143. lot; discard this quietly if you don't understand it." We could do that by
  144. adding a version field.
  145. 3.3. Multilevel keys.
  146. Replacing a directory authority's identity key in the event of a compromise
  147. would be tremendously annoying. We'd need to tell every client to switch
  148. their configuration, or update to a new version with an uploaded list. So
  149. long as some weren't upgraded, they'd be at risk from whoever had
  150. compromised the key.
  151. With this in mind, it's a shame that our current protocol forces us to
  152. store identity keys unencrypted in RAM. We need some kind of signing key
  153. stored unencrypted, since we need to generate new descriptors/directories
  154. and rotate link and onion keys regularly. (And since, of course, we can't
  155. ask server operators to be on-hand to enter a passphrase every time we
  156. want to rotate keys or sign a descriptor.)
  157. The obvious solution seems to be to have a signing-only key that lives
  158. indefinitely (months or longer) and signs descriptors and link keys, and a
  159. separate identity key that's used to sign the signing key. Tor servers
  160. could run in one of several modes:
  161. 1. Identity key stored encrypted. You need to pick a passphrase when
  162. you enable this mode, and re-enter this passphrase every time you
  163. rotate the signing key.
  164. 1'. Identity key stored separate. You save your identity key to a
  165. floppy, and use the floppy when you need to rotate the signing key.
  166. 2. All keys stored unencrypted. In this case, we might not want to even
  167. *have* a separate signing key. (We'll need to support no-separate-
  168. signing-key mode anyway to keep old servers working.)
  169. 3. All keys stored encrypted. You need to enter a passphrase to start
  170. Tor.
  171. (Of course, we might not want to implement all of these.)
  172. Case 1 is probably most usable and secure, if we assume that people don't
  173. forget their passphrases or lose their floppies. We could mitigate this a
  174. bit by encouraging people to PGP-encrypt their passphrases to themselves,
  175. or keep a cleartext copy of their secret key secret-split into a few
  176. pieces, or something like that.
  177. Migration presents another difficulty, especially with the authorities. If
  178. we use the current set of identity keys as the new identity keys, we're in
  179. the position of having sensitive keys that have been stored on
  180. media-of-dubious-encryption up to now. Also, we need to keep old clients
  181. (who will expect descriptors to be signed by the identity keys they know
  182. and love, and who will not understand signing keys) happy.
  183. I'd enumerate designs here, but I'm hoping that somebody will come up with
  184. a better one, so I'll try not to prejudice them with more ideas yet.
  185. Oh, and of course, we'll want to make sure that the keys are
  186. cross-certified. :)
  187. Ideas? -NM
  188. 3.4. Long and short descriptors
  189. Some of the costliest fields in the current directory protocol are ones
  190. that no client actually uses. In particular, the "read-history" and
  191. "write-history" fields are used only by the authorities for monitoring the
  192. status of the network. If we took them out, the size of a compressed list
  193. of all the routers would fall by about 60%. (No other disposable field
  194. would save more than 2%.)
  195. One possible solution here is that routers should generate and upload a
  196. short-form and long-form descriptor. Only the short-form descriptor should
  197. ever be used by anybody for routing. The long-form descriptor should be
  198. used only for analytics and other tools. (If we allowed people to route with
  199. long descriptors, we'd have to ensure that they stayed in sync with the
  200. short ones somehow.)
  201. Another possible solution would be to drop these fields from descriptors,
  202. and have them uploaded as a part of a separate "bandwidth report" to the
  203. authorities. This could help prevent the mistake of using long descriptors
  204. in the place of short ones.
  205. Thoughts? -NM
  206. 4. Migration
  207. For directory voting, ...
  208. caches need to start caching consensuses and accepting multisigned documents.