101-dir-voting.txt 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284
  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.2.0.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.0. Versioning
  72. All documents generated here have version "3" given in their
  73. network-status-version entries.
  74. 2.1. Vote specifications
  75. Votes in v3 are similar to v2 network status documents. We add these
  76. fields to the preamble:
  77. "vote-status" -- the word "vote".
  78. "valid-until" -- the time when this authority expects to publish its
  79. next vote.
  80. "known-flags" -- a space-separated list of flags that will sometimes
  81. be included on "s" lines later in the vote.
  82. "dir-source" -- as before, except the "hostname" part MUST be the
  83. authority's nickname, which MUST be unique among authorities, and
  84. MUST match the nickname in the "directory-signature" entry.
  85. Authorities SHOULD cache their most recently generated votes so they
  86. can persist them across restarts. Authorities SHOULD NOT generate
  87. another document until valid-until has passed.
  88. Router entries in the vote MUST be sorted in ascending order by router
  89. identity digest. The flags in "s" lines MUST appear in alphabetical
  90. order.
  91. Votes SHOULD be synchronized to half-hour publication intervals (one
  92. hour? XXX say more; be more precise.)
  93. XXXX some way to request older networkstatus docs?
  94. 2.2. Consensus directory specifications
  95. Consensuses are like v3 votes, except for the following fields:
  96. "vote-status" -- the word "consensus".
  97. "published" is the latest of all the published times on the votes.
  98. "valid-until" is the earliest of all the valid-until times on the
  99. votes.
  100. "dir-source" and "fingerprint" and "dir-signing-key" and "contact"
  101. are included for each authority that contributed to the vote.
  102. "vote-digest" for each authority that contributed to the vote,
  103. calculated as for the digest in the signature on the vote. [XXX
  104. re-English this sentence]
  105. "client-versions" and "server-versions" are sorted in ascending
  106. order based on version-spec.txt.
  107. "dir-options" and "known-flags" are not included.
  108. [XXX really? why not list the ones that are used in the consensus?
  109. For example, right now BadExit is in use, but no servers would be
  110. labelled BadExit, and it's still worth knowing that it was considered
  111. by the authorities. -RD]
  112. The fields MUST occur in the following order:
  113. "network-status-version"
  114. "vote-status"
  115. "published"
  116. "valid-until"
  117. For each authority, sorted in ascending order of nickname, case-
  118. insensitively:
  119. "dir-source", "fingerprint", "contact", "dir-signing-key",
  120. "vote-digest".
  121. "client-versions"
  122. "server-versions"
  123. The signatures at the end of the document appear as multiple instances
  124. of directory-signature, sorted in ascending order by nickname,
  125. case-insensitively.
  126. A router entry should be included in the result if it is included by more
  127. than half of the authorities (total authorities, not just those whose votes
  128. we have). A router entry has a flag set if it is included by more than
  129. half of the authorities who care about that flag. [XXXX this creates an
  130. incentive for attackers to DOS authorities whose votes they don't like.
  131. Can we remember what flags people set the last time we saw them? -NM]
  132. [Which 'we' are we talking here? The end-users never learn which
  133. authority sets which flags. So you're thinking the authorities
  134. should record the last vote they saw from each authority and if it's
  135. within a week or so, count all the flags that it advertised as 'no'
  136. votes? Plausible. -RD]
  137. The signature hash covers from the "network-status-version" line through
  138. the characters "directory-signature" in the first "directory-signature"
  139. line.
  140. Consensus directories SHOULD be rejected if they are not signed by more
  141. than half of the known authorities.
  142. 2.2.1. Detached signatures
  143. Assuming full connectivity, every authority should compute and sign the
  144. same consensus directory in each period. Therefore, it isn't necessary to
  145. download the consensus computed by each authority; instead, the authorities
  146. only push/fetch each others' signatures. A "detached signature" document
  147. contains a single "consensus-digest" entry and one or more
  148. directory-signature entries. [XXXX specify more.]
  149. 2.3. URLs and timelines
  150. 2.3.1. URLs and timeline used for agreement
  151. An authority SHOULD publish its vote immediately at the start of each voting
  152. period. It does this by making it available at
  153. http://<hostname>/tor/status-vote/current/authority.z
  154. and sending it in an HTTP POST request to each other authority at the URL
  155. http://<hostname>/tor/post/vote
  156. If, N minutes after the voting period has begun, an authority does not have
  157. a current statement from another authority, the first authority retrieves
  158. the other's statement.
  159. Once an authority has a vote from another authority, it makes it available
  160. at
  161. http://<hostname>/tor/status-vote/current/<fp>.z
  162. where <fp> is the fingerprint of the other authority's identity key.
  163. The consensus network status, along with as many signatures as the server
  164. currently knows, should be available at
  165. http://<hostname>/tor/status-vote/current/consensus.z
  166. All of the detached signatures it knows for consensus status should be
  167. available at:
  168. http://<hostname>/tor/status-vote/current/consensus-signatures.z
  169. Once an authority has computed and signed a consensus network status, it
  170. should send its detached signature to each other authority in an HTTP POST
  171. request to the URL:
  172. http://<hostname>/tor/post/consensus-signature
  173. [XXXX Store votes to disk.]
  174. 2.3.2. Serving a consensus directory
  175. Once the authority is done getting signatures on the consensus directory,
  176. it should serve it from:
  177. http://<hostname>/tor/status/consensus.z
  178. Caches SHOULD download consensus directories from an authority and serve
  179. them from the same URL.
  180. 2.3.3. Timeline and synchronization
  181. [XXXX]
  182. 2.4. Distributing routerdescs between authorities
  183. Consensus will be more meaningful if authorities take steps to make sure
  184. that they all have the same set of descriptors _before_ the voting
  185. starts. This is safe, since all descriptors are self-certified and
  186. timestamped: it's always okay to replace a signed descriptor with a more
  187. recent one signed by the same identity.
  188. In the long run, we might want some kind of sophisticated process here.
  189. For now, since authorities already download one another's networkstatus
  190. documents and use them to determine what descriptors to download from one
  191. another, we can rely on this existing mechanism to keep authorities up to
  192. date.
  193. [We should do a thorough read-through of dir-spec again to make sure
  194. that the authorities converge on which descriptor to "prefer" for
  195. each router. Right now the decision happens at the client, which is
  196. no longer the right place for it. -RD]
  197. 3. Questions and concerns
  198. 3.1. Push or pull?
  199. The URLs above define a push mechanism for publishing votes and consensus
  200. signatures via HTTP POST requests, and a pull mechanism for downloading
  201. these documents via HTTP GET requests. As specified, every authority will
  202. post to every other. The "download if no copy has been received" mechanism
  203. exists only as a fallback.
  204. 4. Migration
  205. * It would be cool if caches could get ready to download consensus
  206. status docs, verify enough signatures, and serve them now. That way
  207. once stuff works all we need to do is upgrade the authorities. Caches
  208. don't need to verify the correctness of the format so long as it's
  209. signed (or maybe multisigned?). We need to make sure that caches back
  210. off very quickly from downloading consensus docs until they're
  211. actually implemented.