143-distributed-storage-improvements.txt 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195
  1. Filename: 143-distributed-storage-improvements.txt
  2. Title: Improvements of Distributed Storage for Tor Hidden Service Descriptors
  3. Version: $Revision$
  4. Last-Modified: $Date$
  5. Author: Karsten Loesing
  6. Created: 28-Jun-2008
  7. Status: Open
  8. Change history:
  9. 28-Jun-2008 Initial proposal for or-dev
  10. Overview:
  11. An evaluation of the distributed storage for Tor hidden service
  12. descriptors and subsequent discussions have brought up a few improvements
  13. to proposal 114. All improvements are backwards compatible to the
  14. implementation of proposal 114.
  15. Design:
  16. 1. Report Bad Directory Nodes
  17. Bad hidden service directory nodes could deny existence of previously
  18. stored descriptors. A bad directory node that does this with all stored
  19. descriptors causes harm to the distributed storage in general, but
  20. replication will cope with this problem in most cases. However, an
  21. adversary that attempts to make a specific hidden service unavailable by
  22. running relays that become responsible for all of a service's
  23. descriptors poses a more serious threat. The distributed storage needs to
  24. defend against this attack by detecting and removing bad directory nodes.
  25. As a countermeasure hidden services try to download their descriptors
  26. every hour at random times from the hidden service directories that are
  27. responsible for storing it. If a directory node replies with 404 (Not
  28. found), the hidden service reports the supposedly bad directory node to
  29. a random selection of half of the directory authorities (with version
  30. numbers equal to or higher than the first version that implements this
  31. proposal). The hidden service posts a complaint message using HTTP 'POST'
  32. to a URL "/tor/rendezvous/complain" with the following message format:
  33. "hidden-service-directory-complaint" identifier NL
  34. [At start, exactly once]
  35. The identifier of the hidden service directory node to be
  36. investigated.
  37. "rendezvous-service-descriptor" descriptor NL
  38. [At end, Excatly once]
  39. The hidden service descriptor that the supposedly bad directory node
  40. does not serve.
  41. The directory authority checks if the descriptor is valid and the hidden
  42. service directory responsible for storing it. It waits for a random time
  43. of up to 30 minutes before posting the descriptor to the hidden service
  44. directory. If the publication is acknowledged, the directory authority
  45. waits another random time of up to 30 minutes before attempting to
  46. request the descriptor that it has posted. If the directory node replies
  47. with 404 (Not found), it will be blacklisted for being a hidden service
  48. directory node for the next 48 hours.
  49. A blacklisted hidden service directory is assigned the new flag BadHSDir
  50. instead of the HSDir flag in the vote that a directory authority creates.
  51. In a consensus a relay is only assigned a HSDir flag if the majority of
  52. votes contains a HSDir flag and no more than one third of votes contains
  53. a BadHSDir flag. As a result, clients do not have to learn about the
  54. BadHSDir flag. A blacklisted directory node will simply not be assigned
  55. the HSDir flag in the consensus.
  56. In order to prevent an attacker from setting up new nodes as replacement
  57. for blacklisted directory nodes, all directory nodes in the same /24
  58. subnet are blacklisted, too. Furthermore, if two or more directory nodes
  59. are blacklisted in the same /16 subnet concurrently, all other directory
  60. nodes in that /16 subnet are blacklisted, too. Blacklisting holds for at
  61. most 48 hours.
  62. 2. Publish Fewer Replicas
  63. The evaluation has shown that the probability of a directory node to
  64. serve a previously stored descriptor is 85.7% (more precisely, this is
  65. the 0.001-quantile of the empirical distribution with the rationale that
  66. it holds for 99.9% of all empirical cases). If descriptors are replicated
  67. to x directory nodes, the probability of at least one of the replicas to
  68. be available for clients is 1 - (1 - 85.7%) ^ x. In order to achieve an
  69. overall availability of 99.9%, x = 3.55 replicas need to be stored. From
  70. this follows that 4 replicas are sufficient, rather than the currently
  71. stored 6 replicas.
  72. Further, the current design stores 2 sets of descriptors on 3 directory
  73. nodes with consecutive identities. Originally, this was meant to
  74. facilitate replication between directory nodes, which has not been and
  75. will not be implemented (the selection criterion of 24 hours uptime does
  76. not make it necessary). As a result, storing descriptors on directory
  77. nodes with consecutive identities is not required. In fact it should be
  78. avoided to enable an attacker to create "black holes" in the identifier
  79. ring.
  80. Hidden services should store their descriptors on 4 non-consecutive
  81. directory nodes, and clients should request descriptors from these
  82. directory nodes only. For compatibility reasons, hidden services also
  83. store their descriptors on 2 consecutive directory nodes. Hence, 0.2.0.x
  84. clients will be able to retrieve 4 out of 6 descriptors, but will fail
  85. for the remaining 2 descriptors, which is sufficient for reliability. As
  86. soon as 0.2.0.x is deprecated, hidden services can stop publishing the
  87. additional 2 replicas.
  88. 3. Change Default Value of Being Hidden Service Directory
  89. The requirements for becoming a hidden service directory node are an open
  90. directory port and an uptime of at least 24 hours. The evaluation has
  91. shown that there are 300 hidden service directory candidates in the mean,
  92. but only 6 of them are configured to act as hidden service directories.
  93. This is bad, because those 6 nodes need to serve a large share of all
  94. hidden service descriptors. Optimally, there should be hundreds of hidden
  95. service directories. Having a large number of 0.2.1.x directory nodes
  96. also has a positive effect on 0.2.0.x hidden services and clients.
  97. Therefore, the new default of HidServDirectoryV2 should be 1, so that a
  98. Tor relay that has an open directory port automatically accepts and
  99. serves v2 hidden service descriptors. A relay operator can still opt-out
  100. running a hidden service directory by changing HidServDirectoryV2 to 0.
  101. The additional bandwidth requirements for running a hidden service
  102. directory node in addition to being a directory cache are negligible.
  103. 4. Make Descriptors Persistent on Directory Nodes
  104. Hidden service directories that are restarted by their operators or after
  105. a failure will not be selected as hidden service directories within the
  106. next 24 hours. However, some clients might still think that these nodes
  107. are responsible for certain descriptors, because they work on the basis
  108. of network consensuses that are up to three hours old. The directory
  109. nodes should be able to serve the previously received descriptors to
  110. these clients. Therefore, directory nodes make all received descriptors
  111. persistent and load previously received descriptors on startup.
  112. 5. Store and Serve Descriptors Regardless of Responsibility
  113. Currently, directory nodes only accept descriptors for which they think
  114. they are responsible. This may lead to problems when a directory node
  115. uses an older or newer network consensus than hidden service or client
  116. or when a directory node has been restarted recently. In fact, there are
  117. no security issues in storing or serving descriptors for which a
  118. directory node thinks it is not responsible. To the contrary, doing so
  119. may improve reliability in border cases. As a result, a directory node
  120. does not pay attention to responsibilty when receiving a publication or
  121. fetch request, but stores or serves the requested descriptor. Likewise,
  122. the directory node does not remove descriptors when it thinks it is not
  123. responsible for them any more.
  124. 6. Avoid Periodic Descriptor Re-Publication
  125. In the current implementation a hidden service re-publishes its
  126. descriptor either when its content changes or an hour elapses. However,
  127. the evaluation has shown that failures of hidden service directory nodes,
  128. i.e. of nodes that have not failed within the last 24 hours, are very
  129. rare. Together with making descriptors persistent on directory nodes,
  130. there is no necessity to re-publish descriptors hourly.
  131. The only two events leading to descriptor re-publication should be a
  132. change of the descriptor content and a new directory node becoming
  133. responsible for the descriptor. Hidden services should therefore consider
  134. re-publication every time they learn about a new network consensus
  135. instead of hourly.
  136. 7. Discard Expired Descriptors
  137. The current implementation lets directory nodes keep a descriptor for two
  138. days before discarding it. However, with the v2 design, descriptors are
  139. only valid for at most one day. Directory nodes should determine the
  140. validity of stored descriptors and discard them one hour after they have
  141. expired (to compensate wrong clocks on clients).
  142. 8. Shorten Client-Side Descriptor Fetch History
  143. When clients try to download a hidden service descriptor, they memorize
  144. fetch requests to directory nodes for up to 15 minutes. This allows them
  145. to request all replicas of a descriptor to avoid bad or failing directory
  146. nodes, but without querying the same directory node twice.
  147. The downside is that a client that has requested a descriptor without
  148. success, will not be able to find a hidden service that has been started
  149. during the following 15 minutes after the client's last request.
  150. This can be improved by shortening the fetch history to only 5 minutes.
  151. This time should be sufficient to complete requests for all replicas of a
  152. descriptor, but without ending in an infinite request loop.
  153. Compatibility:
  154. All proposed improvements are compatible to the currently implemented
  155. design as described in proposal 114.