bridges-spec.txt 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249
  1. Tor bridges specification
  2. 0. Preface
  3. This document describes the design decisions around support for bridge
  4. users, bridge relays, and bridge authorities. It acts as an overview
  5. of the bridge design and deployment for developers, and it also tries
  6. to point out limitations in the current design and implementation.
  7. For more details on what all of these mean, look at blocking.tex in
  8. /doc/design-paper/
  9. 1. Bridge relays
  10. Bridge relays are just like normal Tor relays except they don't publish
  11. their server descriptors to the main directory authorities.
  12. 1.1. PublishServerDescriptor
  13. To configure your relay to be a bridge relay, just add
  14. BridgeRelay 1
  15. PublishServerDescriptor bridge
  16. to your torrc. This will cause your relay to publish its descriptor
  17. to the bridge authorities rather than to the default authorities.
  18. Alternatively, you can say
  19. BridgeRelay 1
  20. PublishServerDescriptor 0
  21. which will cause your relay to not publish anywhere. This could be
  22. useful for private bridges.
  23. 1.2. Recommendations.
  24. Bridge relays should use an exit policy of "reject *:*". This is
  25. because they only need to relay traffic between the bridge users
  26. and the rest of the Tor network, so there's no need to let people
  27. exit directly from them.
  28. We invented the RelayBandwidth* options for this situation: Tor clients
  29. who want to allow relaying too. See proposal 111 for details. Relay
  30. operators should feel free to rate-limit their relayed traffic.
  31. 1.3. Implementation note.
  32. Vidalia 0.0.15 has turned its "Relay" settings page into a tri-state
  33. "Don't relay" / "Relay for the Tor network" / "Help censored users".
  34. If you click the third choice, it forces your exit policy to reject *:*.
  35. If all the bridges end up on port 9001, that's not so good. On the
  36. other hand, putting the bridges on a low-numbered port in the Unix
  37. world requires jumping through extra hoops. The current compromise is
  38. that Vidalia makes the ORPort default to 443 on Windows, and 9001 on
  39. other platforms.
  40. At the bottom of the relay config settings window, Vidalia displays
  41. the bridge identifier to the operator (see Section 3.1) so he can pass
  42. it on to bridge users.
  43. 2. Bridge authorities.
  44. Bridge authorities are like normal v3 directory authorities, except
  45. they don't create their own network-status documents or votes. So if
  46. you ask a bridge authority for a network-status document or consensus,
  47. they behave like a directory mirror: they give you one from one of
  48. the main authorities. But if you ask the bridge authority for the
  49. descriptor corresponding to a particular identity fingerprint, it will
  50. happily give you the latest descriptor for that fingerprint.
  51. To become a bridge authority, add these lines to your torrc:
  52. AuthoritativeDirectory 1
  53. BridgeAuthoritativeDir 1
  54. Right now there's one bridge authority, running on the Tonga relay.
  55. 2.1. Exporting bridge-purpose descriptors
  56. We've added a new purpose for server descriptors: the "bridge"
  57. purpose. With the new router-descriptors file format that includes
  58. annotations, it's easy to look through it and find the bridge-purpose
  59. descriptors.
  60. Currently we export the bridge descriptors from Tonga to the
  61. BridgeDB server, so it can give them out according to the policies
  62. in blocking.pdf.
  63. 2.2. Reachability/uptime testing
  64. Right now the bridge authorities do active reachability testing of
  65. bridges, so we know which ones to recommend for users.
  66. But in the design document, we suggested that bridges should publish
  67. anonymously (i.e. via Tor) to the bridge authority, so somebody watching
  68. the bridge authority can't just enumerate all the bridges. But if we're
  69. doing active measurement, the game is up. Perhaps we should back off on
  70. this goal, or perhaps we should do our active measurement anonymously?
  71. Answering this issue is scheduled for 0.2.1.x.
  72. 2.3. Future work: migrating to multiple bridge authorities
  73. Having only one bridge authority is both a trust bottleneck (if you
  74. break into one place you learn about every single bridge we've got)
  75. and a robustness bottleneck (when it's down, bridge users become sad).
  76. Right now if we put up a second bridge authority, all the bridges would
  77. publish to it, and (assuming the code works) bridge users would query
  78. a random bridge authority. This resolves the robustness bottleneck,
  79. but makes the trust bottleneck even worse.
  80. In 0.2.2.x and later we should think about better ways to have multiple
  81. bridge authorities.
  82. 3. Bridge users.
  83. Bridge users are like ordinary Tor users except they use encrypted
  84. directory connections by default, and they use bridge relays as both
  85. entry guards (their first hop) and directory guards (the source of
  86. all their directory information).
  87. To become a bridge user, add the following line to your torrc:
  88. UseBridges 1
  89. and then add at least one "Bridge" line to your torrc based on the
  90. format below.
  91. 3.1. Format of the bridge identifier.
  92. The canonical format for a bridge identifier contains an IP address,
  93. an ORPort, and an identity fingerprint:
  94. bridge 128.31.0.34:9009 4C17 FB53 2E20 B2A8 AC19 9441 ECD2 B017 7B39 E4B1
  95. However, the identity fingerprint can be left out, in which case the
  96. bridge user will connect to that relay and use it as a bridge regardless
  97. of what identity key it presents:
  98. bridge 128.31.0.34:9009
  99. This might be useful for cases where only short bridge identifiers
  100. can be communicated to bridge users.
  101. In a future version we may also support bridge identifiers that are
  102. only a key fingerprint:
  103. bridge 4C17 FB53 2E20 B2A8 AC19 9441 ECD2 B017 7B39 E4B1
  104. and the bridge user can fetch the latest descriptor from the bridge
  105. authority (see Section 3.4).
  106. 3.2. Bridges as entry guards
  107. For now, bridge users add their bridge relays to their list of "entry
  108. guards" (see path-spec.txt for background on entry guards). They are
  109. managed by the entry guard algorithms exactly as if they were a normal
  110. entry guard -- their keys and timing get cached in the "state" file,
  111. etc. This means that when the Tor user starts up with "UseBridges"
  112. disabled, he will skip past the bridge entries since they won't be
  113. listed as up and usable in his networkstatus consensus. But to be clear,
  114. the "entry_guards" list doesn't currently distinguish guards by purpose.
  115. Internally, each bridge user keeps a smartlist of "bridge_info_t"
  116. that reflects the "bridge" lines from his torrc along with a download
  117. schedule (see Section 3.5 below). When he starts Tor, he attempts
  118. to fetch a descriptor for each configured bridge (see Section 3.4
  119. below). When he succeeds at getting a descriptor for one of the bridges
  120. in his list, he adds it directly to the entry guard list using the
  121. normal add_an_entry_guard() interface. Once a bridge descriptor has
  122. been added, should_delay_dir_fetches() will stop delaying further
  123. directory fetches, and the user begins to bootstrap his directory
  124. information from that bridge (see Section 3.3).
  125. Currently bridge users cache their bridge descriptors to the
  126. "cached-descriptors" file (annotated with purpose "bridge"), but
  127. they don't make any attempt to reuse descriptors they find in this
  128. file. The theory is that either the bridge is available now, in which
  129. case you can get a fresh descriptor, or it's not, in which case an
  130. old descriptor won't do you much good.
  131. We could disable writing out the bridge lines to the state file, if
  132. we think this is a problem.
  133. As an exception, if we get an application request when we have one
  134. or more bridge descriptors but we believe none of them are running,
  135. we mark them all as running again. This is similar to the exception
  136. already in place to help long-idle Tor clients realize they should
  137. fetch fresh directory information rather than just refuse requests.
  138. 3.3. Bridges as directory guards
  139. In addition to using bridges as the first hop in their circuits, bridge
  140. users also use them to fetch directory updates. Other than initial
  141. bootstrapping to find a working bridge descriptor (see Section 3.4
  142. below), all further non-anonymized directory fetches will be redirected
  143. to the bridge.
  144. This means that bridge relays need to have cached answers for all
  145. questions the bridge user might ask. This makes the upgrade path
  146. tricky --- for example, if we migrate to a v4 directory design, the
  147. bridge user would need to keep using v3 so long as his bridge relays
  148. only knew how to answer v3 queries.
  149. In a future design, for cases where the user has enough information
  150. to build circuits yet the chosen bridge doesn't know how to answer a
  151. given query, we might teach bridge users to make an anonymized request
  152. to a more suitable directory server.
  153. 3.4. How bridge users get their bridge descriptor
  154. Bridge users can fetch bridge descriptors in two ways: by going directly
  155. to the bridge and asking for "/tor/server/authority", or by going to
  156. the bridge authority and asking for "/tor/server/fp/ID". By default,
  157. they will only try the direct queries. If the user sets
  158. UpdateBridgesFromAuthority 1
  159. in his config file, then he will try querying the bridge authority
  160. first for bridges where he knows a digest (if he only knows an IP
  161. address and ORPort, then his only option is a direct query).
  162. If the user has at least one working bridge, then he will do further
  163. queries to the bridge authority through a full three-hop Tor circuit.
  164. But when bootstrapping, he will make a direct begin_dir-style connection
  165. to the bridge authority.
  166. As of Tor 0.2.0.10-alpha, if the user attempts to fetch a descriptor
  167. from the bridge authority and it returns a 404 not found, the user
  168. will automatically fall back to trying a direct query. Therefore it is
  169. recommended that bridge users always set UpdateBridgesFromAuthority,
  170. since at worst it will delay their fetches a little bit and notify
  171. the bridge authority of the identity fingerprint (but not location)
  172. of their intended bridges.
  173. 3.5. Bridge descriptor retry schedule
  174. Bridge users try to fetch a descriptor for each bridge (using the
  175. steps in Section 3.4 above) on startup. Whenever they receive a
  176. bridge descriptor, they reschedule a new descriptor download for 1
  177. hour from then.
  178. If on the other hand it fails, they try again after 15 minutes for the
  179. first attempt, after 15 minutes for the second attempt, and after 60
  180. minutes for subsequent attempts.
  181. In 0.2.2.x we should come up with some smarter retry schedules.
  182. 3.6. Implementation note.
  183. Vidalia 0.1.0 has a new checkbox in its Network config window called
  184. "My ISP blocks connections to the Tor network." Users who click that
  185. box change their configuration to:
  186. UseBridges 1
  187. UpdateBridgesFromAuthority 1
  188. and should add at least one bridge identifier.