xxx-bootstrap-phases.txt 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175
  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, both when everything is going correctly and when Tor detects
  18. a problem and issues a bootstrap warning.
  19. 2. Controller event syntax.
  20. The generic status event is:
  21. "650" SP StatusType SP StatusSeverity SP StatusAction
  22. [SP StatusArguments] CRLF
  23. So in this case we send
  24. 650 STATUS_CLIENT NOTICE/WARN BOOTSTRAP \
  25. PROGRESS=num TAG=string SUMMARY=string WARNING=string
  26. "Progress" gives a number between 0 and 100 for how far through
  27. the bootstrapping process we are. "Summary" is a string that can be
  28. displayed to the user to describe the *next* task that Tor will tackle,
  29. i.e., the task it is working on after sending the status event. "Tag"
  30. is an optional string that controllers can use to recognize bootstrap
  31. phases from Section 3, if they want to do something smarter than just
  32. blindly displaying the summary string.
  33. The severity describes whether this is a normal bootstrap phase
  34. (severity notice) or an indication of a bootstrapping problem
  35. (severity warn). If severity warn, it should also include a "warning"
  36. argument with any hints Tor has to offer about why it's having troubles
  37. bootstrapping.
  38. It is suggested that controllers start out in phase 0 ("starting"), and
  39. then watch for either a bootstrap status event (meaning the Tor they're
  40. using is sufficiently new to produce them) or a circuit_established
  41. status event (meaning bootstrapping is finished).
  42. 3. The bootstrap phases.
  43. This section describes the various phases currently reported by
  44. Tor. Controllers should not assume that the percentages and tags listed
  45. here will continue to match up, or even that the tags will stay in
  46. the same order. Some phases might also be skipped (not reported) if the
  47. associated bootstrap step is already complete.
  48. Phase 0:
  49. tag=starting summary="starting"
  50. Tor starts out in this phase. It doesn't actually send a status event
  51. to say so.
  52. Phase 5:
  53. tag=conn_dir summary="Connecting to directory mirror"
  54. Tor sends this event as soon as Tor has chosen a directory mirror ---
  55. one of the authorities if bootstrapping for the first time or after
  56. a long downtime, or one of the relays listed in its cached directory
  57. information otherwise.
  58. Tor will stay at this phase until it has successfully established
  59. a TCP connection with some directory mirror. Problems in this phase
  60. generally happen because Tor doesn't have a network connection, or
  61. because the local firewall is dropping SYN packets.
  62. Phase 10
  63. tag=handshake_dir summary="Finishing handshake with directory mirror"
  64. This event occurs when Tor establishes a TCP connection with a relay
  65. (or its https proxy if it's using one). Tor remains in this phase until
  66. the TLS handshake with the relay is finished.
  67. Problems in this phase generally happen because Tor's firewall is
  68. doing more sophisticated MITM attacks on it, or doing packet-level
  69. keyword recognition of Tor's handshake.
  70. Phase 15:
  71. tag=onehop_create summary="Establishing one-hop circuit for dir info"
  72. Once TLS is finished with a relay, Tor will send a CREATE_FAST cell
  73. to establish a one-hop circuit for retrieving directory information.
  74. It will remain in this phase until it receives the CREATED_FAST cell
  75. back, indicating that the circuit is ready.
  76. Phase 20:
  77. tag=requesting_status summary="Asking for networkstatus consensus"
  78. Once we've finished our one-hop circuit, we will start a new stream
  79. for fetching the networkstatus consensus. We'll stay in this phase
  80. until we get the 'connected' relay cell back, indicating that we've
  81. established a directory connection.
  82. Phase 25:
  83. tag=loading_status summary="Loading networkstatus consensus"
  84. Once we've established a directory connection, we will start fetching
  85. the networkstatus consensus document. This could take a while; this
  86. phase is a good opportunity for using the "progress" keyword to indicate
  87. partial progress.
  88. This phase could stall if the directory mirror we picked doesn't
  89. have a copy of the networkstatus consensus so we have to ask another,
  90. or it does give us a copy but we don't find it valid.
  91. Phase 40:
  92. tag=loading_keys summary="Loading authority key certs"
  93. Sometimes when we've finished loading the networkstatus consensus,
  94. we find that we don't have all the authority key certificates for the
  95. keys that signed the consensus. At that point we put the consensus we
  96. fetched on hold and fetch the keys so we can verify the signatures.
  97. Phase 45
  98. tag=requesting_descriptors summary="Asking for relay descriptors"
  99. Once we have a valid networkstatus consensus and we've checked all
  100. its signatures, we start asking for relay descriptors. We stay in this
  101. phase until we have received a 'connected' relay cell in response to
  102. a request for descriptors.
  103. Phase 50:
  104. tag=loading_descriptors summary="Loading relay descriptors"
  105. We will ask for relay descriptors from several different locations,
  106. so this step will probably make up the bulk of the bootstrapping,
  107. especially for users with slow connections. We stay in this phase until
  108. we have descriptors for at least 1/4 of the usable relays listed in
  109. the networkstatus consensus. This phase is also a good opportunity to
  110. use the "progress" keyword to indicate partial steps.
  111. Phase 80:
  112. tag=conn_or summary="Connecting to entry guard"
  113. Once we have a valid consensus and enough relay descriptors, we choose
  114. some entry guards and start trying to build some circuits. This step
  115. is similar to the "conn_dir" phase above; the only difference is
  116. the context.
  117. If a Tor starts with enough recent cached directory information,
  118. its first bootstrap status event will be for the conn_or phase.
  119. Phase 85:
  120. tag=handshake_or summary="Finishing handshake with entry guard"
  121. This phase is similar to the "handshake_dir" phase, but it gets reached
  122. if we finish a TCP connection to a Tor relay and we have already reached
  123. the "conn_or" phase. We'll stay in this phase until we complete a TLS
  124. handshake with a Tor relay.
  125. Phase 90:
  126. tag=circuit_create "Establishing circuits"
  127. Once we've finished our TLS handshake with an entry guard, we will
  128. set about trying to make some 3-hop circuits in case we need them soon.
  129. Phase 100:
  130. tag=done summary="Done"
  131. A full 3-hop circuit has been established. Tor is ready to handle
  132. application connections now.