137-bootstrap-phases.txt 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216
  1. Filename: xxx-bootstrap-phases.txt
  2. Title: Keep controllers informed as Tor bootstraps
  3. Version: $Revision$
  4. Last-Modified: $Date$
  5. Author: Roger Dingledine
  6. Created: 07-Jun-2008
  7. Status: Open
  8. 1. Overview.
  9. Tor has many steps to bootstrapping directory information and
  10. initial circuits, but from the controller's perspective we just have
  11. a coarse-grained "CIRCUIT_ESTABLISHED" status event. Tor users with
  12. slow connections or with connectivity problems can wait a long time
  13. staring at the yellow onion, wondering if it will ever change color.
  14. This proposal describes a new client status event so Tor can give
  15. more details to the controller. Section 2 describes the changes to the
  16. controller protocol; Section 3 describes Tor's internal bootstrapping
  17. phases when everything is going correctly; Section 4 describes when
  18. Tor detects a problem and issues a bootstrap warning; Section 5 covers
  19. suggestions for how controllers should display the results.
  20. 2. Controller event syntax.
  21. The generic status event is:
  22. "650" SP StatusType SP StatusSeverity SP StatusAction
  23. [SP StatusArguments] CRLF
  24. So in this case we send
  25. 650 STATUS_CLIENT NOTICE/WARN BOOTSTRAP \
  26. PROGRESS=num TAG=string SUMMARY=string WARNING=string REASON=string
  27. "Progress" gives a number between 0 and 100 for how far through
  28. the bootstrapping process we are. "Summary" is a string that can be
  29. displayed to the user to describe the *next* task that Tor will tackle,
  30. i.e., the task it is working on after sending the status event. "Tag"
  31. is an optional string that controllers can use to recognize bootstrap
  32. phases from Section 3, if they want to do something smarter than just
  33. blindly displaying the summary string.
  34. The severity describes whether this is a normal bootstrap phase
  35. (severity notice) or an indication of a bootstrapping problem
  36. (severity warn). If severity warn, it should also include a "warning"
  37. argument string with any hints Tor has to offer about why it's having
  38. troubles bootstrapping, and a "reason" string that lists of the reasons
  39. allowed in the ORConn event.
  40. 3. The bootstrap phases.
  41. This section describes the various phases currently reported by
  42. Tor. Controllers should not assume that the percentages and tags listed
  43. here will continue to match up, or even that the tags will stay in
  44. the same order. Some phases might also be skipped (not reported) if the
  45. associated bootstrap step is already complete.
  46. Phase 0:
  47. tag=starting summary="starting"
  48. Tor starts out in this phase. It doesn't actually send a status event
  49. to say so.
  50. Phase 5:
  51. tag=conn_dir summary="Connecting to directory mirror"
  52. Tor sends this event as soon as Tor has chosen a directory mirror ---
  53. one of the authorities if bootstrapping for the first time or after
  54. a long downtime, or one of the relays listed in its cached directory
  55. information otherwise.
  56. Tor will stay at this phase until it has successfully established
  57. a TCP connection with some directory mirror. Problems in this phase
  58. generally happen because Tor doesn't have a network connection, or
  59. because the local firewall is dropping SYN packets.
  60. Phase 10
  61. tag=handshake_dir summary="Finishing handshake with directory mirror"
  62. This event occurs when Tor establishes a TCP connection with a relay
  63. (or its https proxy if it's using one). Tor remains in this phase until
  64. the TLS handshake with the relay is finished.
  65. Problems in this phase generally happen because Tor's firewall is
  66. doing more sophisticated MITM attacks on it, or doing packet-level
  67. keyword recognition of Tor's handshake.
  68. Phase 15:
  69. tag=onehop_create summary="Establishing one-hop circuit for dir info"
  70. Once TLS is finished with a relay, Tor will send a CREATE_FAST cell
  71. to establish a one-hop circuit for retrieving directory information.
  72. It will remain in this phase until it receives the CREATED_FAST cell
  73. back, indicating that the circuit is ready.
  74. Phase 20:
  75. tag=requesting_status summary="Asking for networkstatus consensus"
  76. Once we've finished our one-hop circuit, we will start a new stream
  77. for fetching the networkstatus consensus. We'll stay in this phase
  78. until we get the 'connected' relay cell back, indicating that we've
  79. established a directory connection.
  80. Phase 25:
  81. tag=loading_status summary="Loading networkstatus consensus"
  82. Once we've established a directory connection, we will start fetching
  83. the networkstatus consensus document. This could take a while; this
  84. phase is a good opportunity for using the "progress" keyword to indicate
  85. partial progress.
  86. This phase could stall if the directory mirror we picked doesn't
  87. have a copy of the networkstatus consensus so we have to ask another,
  88. or it does give us a copy but we don't find it valid.
  89. Phase 40:
  90. tag=loading_keys summary="Loading authority key certs"
  91. Sometimes when we've finished loading the networkstatus consensus,
  92. we find that we don't have all the authority key certificates for the
  93. keys that signed the consensus. At that point we put the consensus we
  94. fetched on hold and fetch the keys so we can verify the signatures.
  95. Phase 45
  96. tag=requesting_descriptors summary="Asking for relay descriptors"
  97. Once we have a valid networkstatus consensus and we've checked all
  98. its signatures, we start asking for relay descriptors. We stay in this
  99. phase until we have received a 'connected' relay cell in response to
  100. a request for descriptors.
  101. Phase 50:
  102. tag=loading_descriptors summary="Loading relay descriptors"
  103. We will ask for relay descriptors from several different locations,
  104. so this step will probably make up the bulk of the bootstrapping,
  105. especially for users with slow connections. We stay in this phase until
  106. we have descriptors for at least 1/4 of the usable relays listed in
  107. the networkstatus consensus. This phase is also a good opportunity to
  108. use the "progress" keyword to indicate partial steps.
  109. Phase 80:
  110. tag=conn_or summary="Connecting to entry guard"
  111. Once we have a valid consensus and enough relay descriptors, we choose
  112. some entry guards and start trying to build some circuits. This step
  113. is similar to the "conn_dir" phase above; the only difference is
  114. the context.
  115. If a Tor starts with enough recent cached directory information,
  116. its first bootstrap status event will be for the conn_or phase.
  117. Phase 85:
  118. tag=handshake_or summary="Finishing handshake with entry guard"
  119. This phase is similar to the "handshake_dir" phase, but it gets reached
  120. if we finish a TCP connection to a Tor relay and we have already reached
  121. the "conn_or" phase. We'll stay in this phase until we complete a TLS
  122. handshake with a Tor relay.
  123. Phase 90:
  124. tag=circuit_create "Establishing circuits"
  125. Once we've finished our TLS handshake with an entry guard, we will
  126. set about trying to make some 3-hop circuits in case we need them soon.
  127. Phase 100:
  128. tag=done summary="Done"
  129. A full 3-hop circuit has been established. Tor is ready to handle
  130. application connections now.
  131. 4. Bootstrap problem events.
  132. When an OR Conn fails, we send a "bootstrap problem" status event, which
  133. is like the standard bootstrap status event except with severity warn.
  134. We include the same progress, tag, and summary values as we would for
  135. a normal bootstrap event, but we also include 'warning' and 'reason'
  136. strings.
  137. The reason string is the same argument as the reason string for ORCONN
  138. failure events; the controller can recognize the various reasons
  139. and help the user accordingly. The warning string currently tries to
  140. provide the equivalent of strerror() -- this isn't very useful if the
  141. controller can recognize reason tags and be smarter, but for a very
  142. simple controller it should be better than nothing.
  143. Currently Tor ignores the first nine bootstrap problem reports for
  144. a given phase, reports the tenth to the controller, and then ignores
  145. further problems at that phase. Hopefully this is a good balance between
  146. tolerating occasional errors and reporting serious problems quickly. (We
  147. will want to revisit this approach if there are many different 'reason'
  148. values being reported among the first ten problem reports, since in
  149. this case the controller will only hear one of them.)
  150. 5. Suggested controller behavior.
  151. Controllers should start out with a yellow onion or the equivalent
  152. ("starting"), and then watch for either a bootstrap status event
  153. (meaning the Tor they're using is sufficiently new to produce them,
  154. and they should load up the progress bar or whatever they plan to use
  155. to indicate progress) or a circuit_established status event (meaning
  156. bootstrapping is finished).
  157. In addition to a progress bar in the display, controllers should also
  158. have some way to indicate progress even when no controller window is
  159. open. For example, folks using Tor Browser Bundle in hostile Internet
  160. cafes don't want a big splashy screen up. One way to let the user keep
  161. informed of progress in a more subtle way is to change the task tray
  162. icon and/or tooltip string as more bootstrap events come in.
  163. Controllers should also have some mechanism to alert their user when
  164. bootstrapping problems are reported. Perhaps we should gather a set of
  165. help texts and the controller can send the user to the right anchor in a
  166. "bootstrapping problems" help page?