dir-voting.txt 15 KB

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