101-dir-voting.txt 11 KB

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