162-consensus-flavors.txt 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188
  1. Filename: 162-consensus-flavors.txt
  2. Title: Publish the consensus in multiple flavors
  3. Author: Nick Mathewson
  4. Created: 14-May-2009
  5. Target: 0.2.2
  6. Status: Open
  7. Overview:
  8. This proposal describes a way to publish each consensus in
  9. multiple simultaneous formats, or "flavors". This will reduce the
  10. amount of time needed to deploy new consensus-like documents, and
  11. reduce the size of consensus documents in the long term.
  12. Motivation:
  13. In the future, we will almost surely want different fields and
  14. data in the network-status document. Examples include:
  15. - Publishing hashes of microdescriptors instead of hashes of
  16. full descriptors (Proposal 158).
  17. - Including different digests of descriptors, instead of the
  18. perhaps-soon-to-be-totally-broken SHA1.
  19. Note that in both cases, from the client's point of view, this
  20. information _replaces_ older information. If we're using a
  21. SHA256 hash, we don't need to see the SHA1. If clients only want
  22. microdescriptors, they don't (necessarily) need to see hashes of
  23. other things.
  24. Our past approach to cases like this has been to shovel all of
  25. the data into the consensus document. But this is rather poor
  26. for bandwidth. Adding a single SHA256 hash to a consensus for
  27. each router increases the compressed consensus size by 47%. In
  28. comparison, replacing a single SHA1 hash with a SHA256 hash for
  29. each listed router increases the consensus size by only 18%.
  30. Design in brief:
  31. Let the voting process remain as it is, until a consensus is
  32. generated. With future versions of the voting algorithm, instead
  33. of just a single consensus being generated, multiple consensus
  34. "flavors" are produced.
  35. Consensuses (all of them) include a list of which flavors are
  36. being generated. Caches fetch and serve all flavors of consensus
  37. that are listed, regardless of whether they can parse or validate
  38. them, and serve them to clients. Thus, once this design is in
  39. place, we won't need to deploy more cache changes in order to get
  40. new flavors of consensus to be cached.
  41. Clients download only the consensus flavor they want.
  42. A note on hashes:
  43. Everything in this document is specified to use SHA256, and to be
  44. upgradeable to use better hashes in the future.
  45. Spec modifications:
  46. 1. URLs and changes to the current consensus format.
  47. Every consensus flavor has a name consisting of a sequence of one
  48. or more alphanumeric characters and dashes. For compatibility
  49. current descriptor flavor is called "ns".
  50. The supported consensus flavors are defined as part of the
  51. authorities' consensus method.
  52. For each supported flavor, every authority calculates another
  53. consensus document of as-yet-unspecified format, and exchanges
  54. detached signatures for these documents as in the current consensus
  55. design.
  56. In addition to the consensus currently served at
  57. /tor/status-vote/(current|next)/consensus.z and
  58. /tor/status-vote/(current|next)/consensus/<FP1>+<FP2>+<FP3>+....z ,
  59. authorities serve another consensus of each flavor "F" from the
  60. locations /tor/status-vote/(current|next)/consensus-F.z. and
  61. /tor/status-vote/(current|next)/consensus-F/<FP1>+....z.
  62. When caches serve these documents, they do so from the same
  63. locations.
  64. 2. Document format: generic consensus.
  65. The format of a flavored consensus is as-yet-unspecified, except
  66. that the first line is:
  67. "network-status-version" SP version SP flavor NL
  68. where version is 3 or higher, and the flavor is a string
  69. consisting of alphanumeric characters and dashes, matching the
  70. corresponding flavor listed in the unflavored consensus.
  71. 3. Document format: detached signatures.
  72. We amend the detached signature format to include more than one
  73. consensus-digest line, and more than one set of signatures.
  74. After the consensus-digest line, we allow more lines of the form:
  75. "additional-digest" SP flavor SP algname SP digest NL
  76. Before the directory-signature lines, we allow more entries of the form:
  77. "additional-signature" SP flavor SP algname SP identity SP
  78. signing-key-digest NL signature.
  79. [We do not use "consensus-digest" or "directory-signature" for flavored
  80. consensuses, since this could confuse older Tors.]
  81. The consensus-signatures URL should contain the signatures
  82. for _all_ flavors of consensus.
  83. 4. The consensus index:
  84. Authorities additionally generate and serve a consensus-index
  85. document. Its format is:
  86. Header ValidAfter ValidUntil Documents Signatures
  87. Header = "consensus-index" SP version NL
  88. ValidAfter = as in a consensus
  89. ValidUntil = as in a consensus
  90. Documents = Document*
  91. Document = "document" SP flavor SP SignedLength
  92. 1*(SP AlgorithmName "=" Digest) NL
  93. Signatures = Signature*
  94. Signature = "directory-signature" SP algname SP identity
  95. SP signing-key-digest NL signature
  96. There must be one Document line for each generated consensus flavor.
  97. Each Document line describes the length of the signed portion of
  98. a consensus (the signatures themselves are not included), along
  99. with one or more digests of that signed portion. Digests are
  100. given in hex. The algorithm "sha256" MUST be included; others
  101. are allowed.
  102. The algname part of a signature describes what algorithm was
  103. used to hash the identity and signing keys, and to compute the
  104. signature. The algorithm "sha256" MUST be recognized;
  105. signatures with unrecognized algorithms MUST be ignored.
  106. (See below).
  107. The consensus index is made available at
  108. /tor/status-vote/(current|next)/consensus-index.z.
  109. Caches should fetch this document so they can check the
  110. correctness of the different consensus documents they fetch.
  111. They do not need to check anything about an unrecognized
  112. consensus document beyond its digest and length.
  113. 4.1. The "sha256" signature format.
  114. The 'SHA256' signature format for directory objects is defined as
  115. the RSA signature of the OAEP+-padded SHA256 digest of the item to
  116. be signed. When checking signatures, the signature MUST be treated
  117. as valid if the signature material begins with SHA256(document);
  118. this allows us to add other data later.
  119. Considerations:
  120. - We should not create a new flavor of consensus when adding a
  121. field instead wouldn't be too onerous.
  122. - We should not proliferate flavors lightly: clients will be
  123. distinguishable based on which flavor they download.
  124. Migration:
  125. - Stage one: authorities begin generating and serving
  126. consensus-index files.
  127. - Stage two: Caches begin downloading consensus-index files,
  128. validating them, and using them to decide what flavors of
  129. consensus documents to cache. They download all listed
  130. documents, and compare them to the digests given in the
  131. consensus.
  132. - Stage three: Once we want to make a significant change to the
  133. consensus format, we deploy another flavor of consensus at the
  134. authorities. This will immediately start getting cached by the
  135. caches, and clients can start fetching the new flavor without
  136. waiting a version or two for enough caches to begin supporting
  137. it.
  138. Acknowledgements:
  139. Aspects of this design and its applications to hash migration were
  140. heavily influenced by IRC conversations with Marian.