162-consensus-flavors.txt 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186
  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 , authorities serve
  58. another consensus of each flavor "F" from the location
  59. /tor/status-vote/(current|next)/F/consensus.z.
  60. When caches serve these documents, they do so from the same
  61. locations.
  62. 2. Document format: generic consensus.
  63. The format of a flavored consensus is as-yet-unspecified, except
  64. that the first line is:
  65. "network-status-version" SP version SP flavor NL
  66. where version is 3 or higher, and the flavor is a string
  67. consisting of alphanumeric characters and dashes, matching the
  68. corresponding flavor listed in the unflavored consensus.
  69. 3. Document format: detached signatures.
  70. We amend the detached signature format to include more than one
  71. consensus-digest line, and more than one set of signatures.
  72. After the consensus-digest line, we allow more lines of the form:
  73. "additional-digest" SP flavor SP algname SP digest NL
  74. Before the directory-signature lines, we allow more entries of the form:
  75. "additional-signature" SP flavor SP algname SP identity SP
  76. signing-key-digest NL signature.
  77. [We do not use "consensus-digest" or "directory-signature" for flavored
  78. consensuses, since this could confuse older Tors.]
  79. The consensus-signatures URL should contain the signatures
  80. for _all_ flavors of consensus.
  81. 4. The consensus index:
  82. Authorities additionally generate and serve a consensus-index
  83. document. Its format is:
  84. Header ValidAfter ValidUntil Documents Signatures
  85. Header = "consensus-index" SP version NL
  86. ValidAfter = as in a consensus
  87. ValidUntil = as in a consensus
  88. Documents = Document*
  89. Document = "document" SP flavor SP SignedLength
  90. 1*(SP AlgorithmName "=" Digest) NL
  91. Signatures = Signature*
  92. Signature = "directory-signature" SP algname SP identity
  93. SP signing-key-digest NL signature
  94. There must be one Document line for each generated consensus flavor.
  95. Each Document line describes the length of the signed portion of
  96. a consensus (the signatures themselves are not included), along
  97. with one or more digests of that signed portion. Digests are
  98. given in hex. The algorithm "sha256" MUST be included; others
  99. are allowed.
  100. The algname part of a signature describes what algorithm was
  101. used to hash the identity and signing keys, and to compute the
  102. signature. The algorithm "sha256" MUST be recognized;
  103. signatures with unrecognized algorithms MUST be ignored.
  104. (See below).
  105. The consensus index is made available at
  106. /tor/status-vote/(current|next)/consensus-index.z.
  107. Caches should fetch this document so they can check the
  108. correctness of the different consensus documents they fetch.
  109. They do not need to check anything about an unrecognized
  110. consensus document beyond its digest and length.
  111. 4.1. The "sha256" signature format.
  112. The 'SHA256' signature format for directory objects is defined as
  113. the RSA signature of the OAEP+-padded SHA256 digest of the item to
  114. be signed. When checking signatures, the signature MUST be treated
  115. as valid if the signature material begins with SHA256(document);
  116. this allows us to add other data later.
  117. Considerations:
  118. - We should not create a new flavor of consensus when adding a
  119. field instead wouldn't be too onerous.
  120. - We should not proliferate flavors lightly: clients will be
  121. distinguishable based on which flavor they download.
  122. Migration:
  123. - Stage one: authorities begin generating and serving
  124. consensus-index files.
  125. - Stage two: Caches begin downloading consensus-index files,
  126. validating them, and using them to decide what flavors of
  127. consensus documents to cache. They download all listed
  128. documents, and compare them to the digests given in the
  129. consensus.
  130. - Stage three: Once we want to make a significant change to the
  131. consensus format, we deploy another flavor of consensus at the
  132. authorities. This will immediately start getting cached by the
  133. caches, and clients can start fetching the new flavor without
  134. waiting a version or two for enough caches to begin supporting
  135. it.
  136. Acknowledgements:
  137. Aspects of this design and its applications to hash migration were
  138. heavily influenced by IRC conversations with Marian.