101-dir-voting.txt 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279
  1. Filename: 101-dir-voting.txt
  2. Title: Voting on the Tor Directory System
  3. Version: $Revision$
  4. Last-Modified: $Date$
  5. Author: Nick Mathewson
  6. Created:
  7. Status: Open
  8. Overview
  9. This document describes a consensus voting scheme for Tor directories;
  10. instead of publishing different network statuses, directories would vote on
  11. and publish a single "consensus" network status document.
  12. This is an open proposal.
  13. Proposal:
  14. 0. Scope and preliminaries
  15. This document describes a consensus voting scheme for Tor directories.
  16. Once it's accepted, it should be merged with dir-spec.txt. Some
  17. preliminaries for authority and caching support should be done during
  18. the 0.1.2.x series; the main deployment should come during the 0.1.3.x
  19. series.
  20. 0.1. Goals and motivation: voting.
  21. The current directory system relies on clients downloading separate
  22. network status statements from the caches signed by each directory.
  23. Clients download a new statement every 30 minutes or so, choosing to
  24. replace the oldest statement they currently have.
  25. This creates a partitioning problem: different clients have different
  26. "most recent" networkstatus sources, and different versions of each
  27. (since authorities change their statements often).
  28. It also creates a scaling problem: most of the downloaded networkstatus
  29. are probably quite similar, and the redundancy grows as we add more
  30. authorities.
  31. So if we have clients only download a single multiply signed consensus
  32. network status statement, we can:
  33. - Save bandwidth.
  34. - Reduce client partitioning
  35. - Reduce client-side and cache-side storage
  36. - Simplify client-side voting code (by moving voting away from the
  37. client)
  38. We should try to do this without:
  39. - Assuming that client-side or cache-side clocks are more correct
  40. than we assume now.
  41. - Assuming that authority clocks are perfectly correct.
  42. - Degrading badly if a few authorities die or are offline for a bit.
  43. We do not have to perform well if:
  44. - No clique of more than half the authorities can agree about who
  45. the authorities are.
  46. 1. The idea.
  47. Instead of publishing a network status whenever something changes,
  48. each authority instead publishes a fresh network status only once per
  49. "period" (say, 60 minutes). Authorities either upload this network
  50. status (or "vote") to every other authority, or download every other
  51. authority's "vote" (see 3.1 below for discussion on push vs pull).
  52. After an authority has (or has become convinced that it won't be able to
  53. get) every other authority's vote, it deterministically computes a
  54. consensus networkstatus, and signs it. Authorities download (or are
  55. uploaded; see 3.1) one another's signatures, and form a multiply signed
  56. consensus. This multiply-signed consensus is what caches cache and what
  57. clients download.
  58. If an authority is down, authorities vote based on what they *can*
  59. download/get uploaded.
  60. If an authority is "a little" down and only some authorities can reach
  61. it, authorities try to get its info from other authorities.
  62. If an authority computes the vote wrong, its signature isn't included on
  63. the consensus.
  64. Clients use a consensus if it is "trusted": signed by more than half the
  65. authorities they recognize. If clients can't find any such consensus,
  66. they use the most recent trusted consensus they have. If they don't
  67. have any trusted consensus, they warn the user and refuse to operate
  68. (and if DirServers is not the default, beg the user to adapt the list
  69. of authorities).
  70. 2. Details.
  71. 2.1. Vote specifications
  72. Votes in v2.1 are similar to v2 network status documents. We add these
  73. fields to the preamble:
  74. "vote-status" -- the word "vote".
  75. "valid-until" -- the time when this authority expects to publish its
  76. next vote.
  77. "known-flags" -- a space-separated list of flags that will sometimes
  78. be included on "s" lines later in the vote.
  79. "dir-source" -- as before, except the "hostname" part MUST be the
  80. authority's nickname, which MUST be unique among authorities, and
  81. MUST match the nickname in the "directory-signature" entry.
  82. Authorities SHOULD cache their most recently generated votes so they
  83. can persist them across restarts. Authorities SHOULD NOT generate
  84. another document until valid-until has passed.
  85. Router entries in the vote MUST be sorted in ascending order by router
  86. identity digest. The flags in "s" lines MUST appear in alphabetical
  87. order.
  88. Votes SHOULD be synchronized to half-hour publication intervals (one
  89. hour? XXX say more; be more precise.)
  90. XXXX some way to request older networkstatus docs?
  91. 2.2. Consensus directory specifications
  92. Consensuses are like v2.1 votes, except for the following fields:
  93. "vote-status" -- the word "consensus".
  94. "published" is the latest of all the published times on the votes.
  95. "valid-until" is the earliest of all the valid-until times on the
  96. votes.
  97. "dir-source" and "fingerprint" and "dir-signing-key" and "contact"
  98. are included for each authority that contributed to the vote.
  99. "vote-digest" for each authority that contributed to the vote,
  100. calculated as for the digest in the signature on the vote. [XXX
  101. re-English this sentence]
  102. "client-versions" and "server-versions" are sorted in ascending
  103. order based on version-spec.txt.
  104. "dir-options" and "known-flags" are not included.
  105. [XXX really? why not list the ones that are used in the consensus?
  106. For example, right now BadExit is in use, but no servers would be
  107. labelled BadExit, and it's still worth knowing that it was considered
  108. by the authorities. -RD]
  109. The fields MUST occur in the following order:
  110. "network-status-version"
  111. "vote-status"
  112. "published"
  113. "valid-until"
  114. For each authority, sorted in ascending order of nickname, case-
  115. insensitively:
  116. "dir-source", "fingerprint", "contact", "dir-signing-key",
  117. "vote-digest".
  118. "client-versions"
  119. "server-versions"
  120. The signatures at the end of the document appear as multiple instances
  121. of directory-signature, sorted in ascending order by nickname,
  122. case-insensitively.
  123. A router entry should be included in the result if it is included by more
  124. than half of the authorities (total authorities, not just those whose votes
  125. we have). A router entry has a flag set if it is included by more than
  126. half of the authorities who care about that flag. [XXXX this creates an
  127. incentive for attackers to DOS authorities whose votes they don't like.
  128. Can we remember what flags people set the last time we saw them? -NM]
  129. [Which 'we' are we talking here? The end-users never learn which
  130. authority sets which flags. So you're thinking the authorities
  131. should record the last vote they saw from each authority and if it's
  132. within a week or so, count all the flags that it advertised as 'no'
  133. votes? Plausible. -RD]
  134. The signature hash covers from the "network-status-version" line through
  135. the characters "directory-signature" in the first "directory-signature"
  136. line.
  137. Consensus directories SHOULD be rejected if they are not signed by more
  138. than half of the known authorities.
  139. 2.2.1. Detached signatures
  140. Assuming full connectivity, every authority should compute and sign the
  141. same consensus directory in each period. Therefore, it isn't necessary to
  142. download the consensus computed by each authority; instead, the authorities
  143. only push/fetch each others' signatures. A "detached signature" document
  144. contains a single "consensus-digest" entry and one or more
  145. directory-signature entries. [XXXX specify more.]
  146. 2.3. URLs and timelines
  147. 2.3.1. URLs and timeline used for agreement
  148. An authority SHOULD publish its vote immediately at the start of each voting
  149. period. It does this by making it available at
  150. http://<hostname>/tor/status-vote/current/authority.z
  151. and sending it in an HTTP POST request to each other authority at the URL
  152. http://<hostname>/tor/post/vote
  153. If, N minutes after the voting period has begun, an authority does not have
  154. a current statement from another authority, the first authority retrieves
  155. the other's statement.
  156. Once an authority has a vote from another authority, it makes it available
  157. at
  158. http://<hostname>/tor/status-vote/current/<fp>.z
  159. where <fp> is the fingerprint of the other authority's identity key.
  160. The consensus network status, along with as many signatures as the server
  161. currently knows, should be available at
  162. http://<hostname>/tor/status-vote/current/consensus.z
  163. All of the detached signatures it knows for consensus status should be
  164. available at:
  165. http://<hostname>/tor/status-vote/current/consensus-signatures.z
  166. Once an authority has computed and signed a consensus network status, it
  167. should send its detached signature to each other authority in an HTTP POST
  168. request to the URL:
  169. http://<hostname>/tor/post/consensus-signature
  170. [XXXX Store votes to disk.]
  171. 2.3.2. Serving a consensus directory
  172. Once the authority is done getting signatures on the consensus directory,
  173. it should serve it from:
  174. http://<hostname>/tor/status/consensus.z
  175. Caches SHOULD download consensus directories from an authority and serve
  176. them from the same URL.
  177. 2.3.3. Timeline and synchronization
  178. [XXXX]
  179. 2.4. Distributing routerdescs between authorities
  180. Consensus will be more meaningful if authorities take steps to make sure
  181. that they all have the same set of descriptors _before_ the voting
  182. starts. This is safe, since all descriptors are self-certified and
  183. timestamped: it's always okay to replace a signed descriptor with a more
  184. recent one signed by the same identity.
  185. In the long run, we might want some kind of sophisticated process here.
  186. For now, since authorities already download one another's networkstatus
  187. documents and use them to determine what descriptors to download from one
  188. another, we can rely on this existing mechanism to keep authorities up to
  189. date.
  190. [We should do a thorough read-through of dir-spec again to make sure
  191. that the authorities converge on which descriptor to "prefer" for
  192. each router. Right now the decision happens at the client, which is
  193. no longer the right place for it. -RD]
  194. 3. Questions and concerns
  195. 3.1. Push or pull?
  196. The URLs above define a push mechanism for publishing votes and consensus
  197. signatures via HTTP POST requests, and a pull mechanism for downloading
  198. these documents via HTTP GET requests. As specified, every authority will
  199. post to every other. The "download if no copy has been received" mechanism
  200. exists only as a fallback.
  201. 4. Migration
  202. * It would be cool if caches could get ready to download consensus
  203. status docs, verify enough signatures, and serve them now. That way
  204. once stuff works all we need to do is upgrade the authorities. Caches
  205. don't need to verify the correctness of the format so long as it's
  206. signed (or maybe multisigned?). We need to make sure that caches back
  207. off very quickly from downloading consensus docs until they're
  208. actually implemented.