dir-voting.txt 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343
  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. "directory-signature" -- [XXXX this should be tagged with the nickname
  69. or identity somehow.]
  70. Authorities SHOULD cache their most recently generated votes so they
  71. can persist them across restarts. Authorities SHOULD NOT generate
  72. another document until valid-until has passed.
  73. Router entries in the vote MUST be sorted in ascending order by router
  74. identity digest. The flags in "s" lines MUST appear in alphabetical
  75. order.
  76. Votes SHOULD be synchronized to half-hour publication intervals (one
  77. hour? XXX say more; be more precise.)
  78. XXXX some way to request older networkstatus docs?
  79. 2.2. Consensus directory specifications
  80. Consensuses are like v2.1 votes, except for the following fields:
  81. "vote-status" -- the word "consensus".
  82. "published" is the latest of all the published times on the votes.
  83. "valid-until" is the earliest of all the valid-until times on the
  84. votes.
  85. "dir-source" and "fingerprint" and "dir-signing-key" and "contact"
  86. are included for each authority that contributed to the vote.
  87. "vote-digest" for each authority that contributed to the vote,
  88. calculated as for the digest in the signature on the vote. [XXX
  89. re-English this sentence]
  90. "client-versions" and "server-versions" are sorted in ascending
  91. order.
  92. "dir-options" and "known-flags" are not included.
  93. The fields MUST occur in the following order:
  94. "network-status-version"
  95. "vote-status"
  96. "published"
  97. "valid-until"
  98. For each authority, sorted in ascending order of nickname, case-
  99. insensitively:
  100. "dir-source", "fingerprint", "contact", "dir-signing-key",
  101. "vote-digest".
  102. "client-versions"
  103. "server-versions"
  104. The signatures at the end of the document appear as multiple instances
  105. directory-signature, sorted in ascending order by nickname,
  106. case-insensitively.
  107. A router entry should be included in the result if it is included by more
  108. than half of the authorities (total authorities, not just those whose votes
  109. we have). A router entry has a flag set if it is included by more than
  110. half of the authorities who care about that flag. [XXXX this creates an
  111. incentive for attackers to DOS authorities whose votes they don't like.
  112. Can we remember what flags people set the last time we saw them?]
  113. The signature hash covers from the "network-status-version" line through
  114. the characters "directory-signature" in the first "directory-signature"
  115. line.
  116. Consensus directories SHOULD be rejected if they are not signed by more
  117. than half of the known authorities.
  118. 2.2.1. Detached signatures
  119. Assuming full connectivity, every authority should compute and sign the
  120. same consensus directory in each period. Therefore, it isn't necessary to
  121. download the consensus computed by each authority; instead, the authorities
  122. only push/fetch each others' signatures. A "detached signature" document
  123. contains a single "consensus-digest" entry and one or more
  124. directory-signature entries. [XXXX specify more.]
  125. 2.3. URLs and timelines
  126. 2.3.1. URLs and timeline used for agreement
  127. A router SHOULD publish its vote immediately at the start of each voting
  128. period. It does this by making it available at
  129. http://<hostname>/tor/status-vote/current/authority.z
  130. and posting it to each other authority at the URL
  131. http://<hostname>/tor/post/vote
  132. If, N minutes after the voting period has begun, an authority does not have
  133. a current statement from another authority, the first authority retrieves
  134. the other's statement.
  135. Once an authority has a vote from another authority, it makes it available
  136. at
  137. http://<hostname>/tor/status-vote/current/<fp>.z
  138. where <fp> is the fingerprint of the other authority's identity key.
  139. The consensus network status, along with as many signatures as the server
  140. currently knows, should be available at
  141. http://<hostname>/tor/status-vote/current/consensus.z
  142. All of the detached signatures it knows for consensus status should be
  143. available at:
  144. http://<hostname>/tor/status-vote/current/consensus-signatures.z
  145. Once an authority has computed and signed a consensus network status, it
  146. should send its detached signature to each other authority at the URL
  147. http://<hostname>/tor/post/consensus-signature
  148. [XXXX Store votes to disk.]
  149. 2.3.2. Serving a consensus directory
  150. Once the authority is done getting signatures on the consensus directory,
  151. it should serve it from:
  152. http://<hostname>/tor/status/consensus.z
  153. Caches SHOULD download consensus directories from an authority and serve
  154. them from the same URL.
  155. 2.3.3. Timeline and synchronization
  156. [XXXX]
  157. 2.4. Distributing routerdescs between authorities
  158. Consensus will be more meaningful if authorities take steps to make sure
  159. that they all have the same set of descriptors _before_ the voting
  160. starts. This is safe, since all descriptors are self-certified and
  161. timestamped: it's always okay to replace a signed descriptor with a more
  162. recent one signed by the same identity.
  163. In the long run, we might want some kind of sophisticated process here.
  164. For now, since authorities already download one another's networkstatus
  165. documents and use them to determine what descriptors to download from one
  166. another, we can rely on this existing mechanism to keep authorities up to
  167. date.
  168. 3. Questions and concerns
  169. 3.1. Push or pull?
  170. [XXXX]
  171. 3.2. Dropping "opt".
  172. The "opt" keyword in Tor's directory formats was originally intended to
  173. mean, "it is okay to ignore this entry if you don't understand it"; the
  174. default behavior has been "discard a routerdesc if it contains entries you
  175. don't recognize."
  176. But so far, every new flag we have added has been marked 'opt'. It would
  177. probably make sense to change the default behavior to "ignore unrecognized
  178. fields", and add the statement that clients SHOULD ignore fields they don't
  179. recognize. As a meta-principle, we should say that clients and servers
  180. MUST NOT have to understand new fields in order to use directory documents
  181. correctly.
  182. Of course, this will make it impossible to say, "The format has changed a
  183. lot; discard this quietly if you don't understand it." We could do that by
  184. adding a version field.
  185. 3.3. Multilevel keys.
  186. Replacing a directory authority's identity key in the event of a compromise
  187. would be tremendously annoying. We'd need to tell every client to switch
  188. their configuration, or update to a new version with an uploaded list. So
  189. long as some weren't upgraded, they'd be at risk from whoever had
  190. compromised the key.
  191. With this in mind, it's a shame that our current protocol forces us to
  192. store identity keys unencrypted in RAM. We need some kind of signing key
  193. stored unencrypted, since we need to generate new descriptors/directories
  194. and rotate link and onion keys regularly. (And since, of course, we can't
  195. ask server operators to be on-hand to enter a passphrase every time we
  196. want to rotate keys or sign a descriptor.)
  197. The obvious solution seems to be to have a signing-only key that lives
  198. indefinitely (months or longer) and signs descriptors and link keys, and a
  199. separate identity key that's used to sign the signing key. Tor servers
  200. could run in one of several modes:
  201. 1. Identity key stored encrypted. You need to pick a passphrase when
  202. you enable this mode, and re-enter this passphrase every time you
  203. rotate the signing key.
  204. 1'. Identity key stored separate. You save your identity key to a
  205. floppy, and use the floppy when you need to rotate the signing key.
  206. 2. All keys stored unencrypted. In this case, we might not want to even
  207. *have* a separate signing key. (We'll need to support no-separate-
  208. signing-key mode anyway to keep old servers working.)
  209. 3. All keys stored encrypted. You need to enter a passphrase to start
  210. Tor.
  211. (Of course, we might not want to implement all of these.)
  212. Case 1 is probably most usable and secure, if we assume that people don't
  213. forget their passphrases or lose their floppies. We could mitigate this a
  214. bit by encouraging people to PGP-encrypt their passphrases to themselves,
  215. or keep a cleartext copy of their secret key secret-split into a few
  216. pieces, or something like that.
  217. Migration presents another difficulty, especially with the authorities. If
  218. we use the current set of identity keys as the new identity keys, we're in
  219. the position of having sensitive keys that have been stored on
  220. media-of-dubious-encryption up to now. Also, we need to keep old clients
  221. (who will expect descriptors to be signed by the identity keys they know
  222. and love, and who will not understand signing keys) happy.
  223. I'd enumerate designs here, but I'm hoping that somebody will come up with
  224. a better one, so I'll try not to prejudice them with more ideas yet.
  225. Oh, and of course, we'll want to make sure that the keys are
  226. cross-certified. :)
  227. Ideas? -NM
  228. 3.4. Long and short descriptors
  229. Some of the costliest fields in the current directory protocol are ones
  230. that no client actually uses. In particular, the "read-history" and
  231. "write-history" fields are used only by the authorities for monitoring the
  232. status of the network. If we took them out, the size of a compressed list
  233. of all the routers would fall by about 60%. (No other disposable field
  234. would save more than 2%.)
  235. One possible solution here is that routers should generate and upload a
  236. short-form and long-form descriptor. Only the short-form descriptor should
  237. ever be used by anybody for routing. The long-form descriptor should be
  238. used only for analytics and other tools. (If we allowed people to route with
  239. long descriptors, we'd have to ensure that they stayed in sync with the
  240. short ones somehow.)
  241. Another possible solution would be to drop these fields from descriptors,
  242. and have them uploaded as a part of a separate "bandwidth report" to the
  243. authorities. This could help prevent the mistake of using long descriptors
  244. in the place of short ones.
  245. Thoughts? -NM
  246. 4. Migration
  247. For directory voting:
  248. * It would be cool if caches could get ready to download these, verify
  249. enough signatures, and serve them now. That way once stuff works all
  250. we need to do is upgrade the authorities. Caches don't need to verify
  251. the correctness of the format so long as it's signed.
  252. For dropping the "opt" requirement:
  253. * stop requiring it as of 0.1.2.x. Stop generating it once earlier
  254. formats are obsolete.
  255. For multilevel keys:
  256. * no idea