xxx-pluggable-transport.txt 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306
  1. Filename: xxx-pluggable-transport.txt
  2. Title: Pluggable transports for circumvention
  3. Author: Jacob Appelbaum, Nick Mathewson
  4. Created: 15-Oct-2010
  5. Status: Draft
  6. Overview
  7. This proposal describes a way to decouple protocol-level obfuscation
  8. from the core Tor protocol in order to better resist client-bridge
  9. censorship. Our approach is to specify a means to add pluggable
  10. transport implementations to Tor clients and bridges so that they can
  11. negotiate a superencipherment for the Tor protocol.
  12. Scope
  13. This is a document about transport plugins; it does not cover
  14. discovery improvements, or bridgedb improvements. While these
  15. requirements might be solved by a program that also functions as a
  16. transport plugin, this proposal only covers the requirements and
  17. operation of transport plugins.
  18. Motivation
  19. Frequently, people want to try a novel circumvention method to help
  20. users connect to Tor bridges. Some of these methods are already
  21. pretty easy to deploy: if the user knows an unblocked VPN or open
  22. SOCKS proxy, they can just use that with the Tor client today.
  23. Less easy to deploy are methods that require participation by both the
  24. client and the bridge. In order of increasing sophistication, we
  25. might want to support:
  26. 1. A protocol obfuscation tool that transforms the output of a TLS
  27. connection into something that looks like HTTP as it leaves the
  28. client, and back to TLS as it arrives at the bridge.
  29. 2. An additional authentication step that a client would need to
  30. perform for a given bridge before being allowed to connect.
  31. 3. An information passing system that uses a side-channel in some
  32. existing protocol to convey traffic between a client and a bridge
  33. without the two of them ever communicating directly.
  34. 4. A set of clients to tunnel client->bridge traffic over an existing
  35. large p2p network, such that the bridge is known by an identifier
  36. in that network rather than by an IP address.
  37. We could in theory support these almost fine with Tor as it stands
  38. today: every Tor client can take a SOCKS proxy to use for its outgoing
  39. traffic, so a suitable client proxy could handle the client's traffic
  40. and connections on its behalf, while a corresponding program on the
  41. bridge side could handle the bridge's side of the protocol
  42. transformation. Nevertheless, there are some reasons to add support
  43. for transportation plugins to Tor itself:
  44. 1. It would be good for bridges to have a standard way to advertise
  45. which transports they support, so that clients can have multiple
  46. local transport proxies, and automatically use the right one for
  47. the right bridge.
  48. 2. There are some changes to our architecture that we'll need for a
  49. system like this to work. For testing purposes, if a bridge blocks
  50. off its regular ORPort and instead has an obfuscated ORPort, the
  51. bridge authority has no way to test it. Also, unless the bridge
  52. has some way to tell that the bridge-side proxy at 127.0.0.1 is not
  53. the origin of all the connections it is relaying, it might decide
  54. that there are too many connections from 127.0.0.1, and start
  55. paring them down to avoid a DoS.
  56. 3. Censorship and anticensorship techniques often evolve faster than
  57. the typical Tor release cycle. As such, it's a good idea to
  58. provide ways to test out new anticensorship mechanisms on a more
  59. rapid basis.
  60. 4. Transport obfuscation is a relatively distinct problem
  61. from the other privacy problems that Tor tries to solve, and it
  62. requires a fairly distinct skill-set from hacking the rest of Tor.
  63. By decoupling transport obfuscation from the Tor core, we hope to
  64. encourage people working on transport obfuscation who would
  65. otherwise not be interested in hacking Tor.
  66. 5. Finally, we hope that defining a generic transport obfuscation plugin
  67. mechanism will be useful to other anticensorship projects.
  68. Non-Goals
  69. We're not going to talk about automatic verification of plugin
  70. correctness and safety via sandboxing, proof-carrying code, or
  71. whatever.
  72. We need to do more with discovery and distribution, but that's not
  73. what this proposal is about. We're pretty convinced that the problems
  74. are sufficiently orthogonal that we should be fine so long as we don't
  75. preclude a single program from implementing both transport and
  76. discovery extensions.
  77. This proposal is not about what transport plugins are the best ones
  78. for people to write. We do, however, make some general
  79. recommendations for plugin authors in an appendix.
  80. We've considered issues involved with completely replacing Tor's TLS
  81. with another encryption layer, rather than layering it inside the
  82. obfuscation layer. We describe how to do this in an appendix to the
  83. current proposal, though we are not currently sure whether it's a good
  84. idea to implement.
  85. We deliberately reject any design that would involve linking more code
  86. into Tor's process space.
  87. Design overview
  88. To write a new transport protocol, an implementer must provide two
  89. pieces: a "Client Proxy" to run at the initiator side, and a "Server
  90. Proxy" to run a the server side. These two pieces may or may not be
  91. implemented by the same program.
  92. Each client may run any number of Client Proxies. Each one acts like
  93. a SOCKS proxy that accepts accept connections on localhost. Each one
  94. runs on a different port, and implements one or more transport
  95. methods. If the protocol has any parameters, they passed from Tor
  96. inside the regular username/password parts of the SOCKS protocol.
  97. Bridges (and maybe relays) may run any number of Server Proxies: these
  98. programs provide an interface like stunnel-server (or whatever the
  99. option is): they get connections from the network (typically by
  100. listening for connections on the network) and relay them to the
  101. Bridge's real ORPort.
  102. To configure one of these programs, it should be sufficient simply to
  103. list it in your torrc. The program tells Tor which transports it
  104. provides.
  105. Bridges (and maybe relays) report in their descriptors which transport
  106. protocols they support. This information can be copied into bridge
  107. lines. Bridges using a transport protocol may have multiple bridge
  108. lines.
  109. Any methods that are wildly successful, we can bake into Tor.
  110. Specifications: Client behavior
  111. Bridge lines can now follow the extended format "bridge method
  112. address:port [[keyid=]id-fingerprint] [k=v] [k=v] [k=v]". To connect
  113. to such a bridge, a client must open a local connection to the SOCKS
  114. proxy for "method", and ask it to connect to address:port. If
  115. [id-fingerprint] is provided, it should expect the public identity key
  116. on the TLS connection to match the digest provided in
  117. [id-fingerprint]. If any [k=v] items are provided, they are
  118. configuration parameters for the proxy: Tor should separate them with
  119. NUL bytes and put them user and password fields of the request,
  120. splitting them across the fields as necessary. The "id-fingerprint"
  121. field is always provided in a field named "keyid", if it was given.
  122. Example: if the bridge line is "bridge trebuchet www.example.com:3333
  123. rocks=20 height=5.6m" AND if the Tor client knows that the
  124. 'trebuchet' method is provided by a SOCKS5 proxy on
  125. 127.0.0.1:19999, the client should connect to that proxy, ask it to
  126. connect to www.example.com, and provide the string
  127. "rocks=20\0height=5.6m" as the username, the password, or split
  128. across the username and password.
  129. There are two ways to tell Tor clients about protocol proxies:
  130. external proxies and managed proxies. An external proxy is configured
  131. with "ClientTransportPlugin trebuchet socks5 127.0.0.1:9999". This
  132. tells Tor that another program is already running to handle
  133. 'trubuchet' connections, and Tor doesn't need to worry about it. A
  134. managed proxy is configured with "ClientTransportPlugin trebuchet
  135. /usr/libexec/tor-proxies/trebuchet [options]", and tells Tor to launch
  136. an external program on-demand to provide a socks proxy for 'trebuchet'
  137. connections. The Tor client only launches one instance of each
  138. external program, even if the same executable is listed for more than
  139. one method.
  140. The same program can implement a managed or an external proxy: it just
  141. needs to take an argument saying which one to be.
  142. Client proxy behavior
  143. When launched from the command-line by a Tor client, a transport
  144. proxy needs to tell Tor which methods and ports it supports. It does
  145. this by printing one or more CMETHOD: lines to its stdout. These look
  146. like
  147. CMETHOD: trebuchet SOCKS5 127.0.0.1:19999 ARGS:rocks,height \
  148. OPT-ARGS:tensile-strength
  149. The ARGS field lists mandatory parameters that must appear in every
  150. bridge line for this method. The OPT-ARGS field lists optional
  151. parameters. If no ARGS or OPT-ARGS field is provided, Tor should not
  152. check the parameters in bridge lines for this method.
  153. The proxy should print a single "METHODS:DONE" line after it is
  154. finished telling Tor about the methods it provides.
  155. The transport proxy MUST exit cleanly when it receives a SIGTERM from
  156. Tor.
  157. The Tor client MUST ignore lines beginning with a keyword and a colon
  158. if it does not recognize the keyword.
  159. In the future, if we need a control mechanism, we can use the
  160. stdin/stdout from Tor to the transport proxy.
  161. A transport proxy MUST handle SOCKS connect requests using the SOCKS
  162. version it advertises.
  163. Tor clients SHOULD NOT use any method from a client proxy unless it
  164. is both listed as a possible method for that proxy in torrc, and it
  165. is listed by the proxy as a method it supports.
  166. [XXXX say something about versioning.]
  167. Server behavior
  168. Server proxies are configured similarly to client proxies.
  169. Server proxy behavior
  170. [so, we can have this work like client proxies, where the bridge
  171. launches some programs, and they tell the bridge, "I am giving you
  172. method X with parameters Y"? Do you have to take all the methods? If
  173. not, which do you specify?]
  174. [Do we allow programs that get started independently?]
  175. [We'll need to figure out how this works with port forwarding. Is
  176. port forwarding the bridge's problem, the proxy's problem, or some
  177. combination of the two?]
  178. [If we're using the bridge authority/bridgedb system for distributing
  179. bridge info, the right place to advertise bridge lines is probably
  180. the extrainfo document. We also need a way to tell the bridge
  181. authority "don't give out a default bridge line for me"]
  182. Server behavior
  183. Bridge authority behavior
  184. Implementation plan
  185. Turn this into a draft proposal
  186. Circulate and discuss on or-dev.
  187. We should ship a couple of null plugin implementations in one or two
  188. popular, portable languages so that people get an idea of how to
  189. write the stuff.
  190. 1. We should have one that's just a proof of concept that does
  191. nothing but transfer bytes back and forth.
  192. 1. We should not do a rot13 one.
  193. 2. We should implement a basic proxy that does not transform the bytes at all
  194. 1. We should implement DNS or HTTP using other software (as goodell
  195. did years ago with DNS) as an example of wrapping existing code into
  196. our plugin model.
  197. 2. The obfuscated-ssh superencipherment is pretty trivial and pretty
  198. useful. It makes the protocol stringwise unfingerprintable.
  199. 1. Nick needs to be told firmly not to bikeshed the obfuscated-ssh
  200. superencipherment too badly
  201. 1. Go ahead, bikeshed my day
  202. 1. If we do a raw-traffic proxy, openssh tunnels would be the logical choice.
  203. Appendix: recommendations for transports
  204. Be free/open-source software. Also, if you think your code might
  205. someday do so well at circumvention that it should be implemented
  206. inside Tor, it should use the same license as Tor.
  207. Use libraries that Tor already requires. (You can rely on openssl and
  208. libevent being present if current Tor is present.)
  209. Be portable: most Tor users are on Windows, and most Tor developers
  210. are not, so designing your code for just one of these platforms will
  211. make it either get a small userbase, or poor auditing.
  212. Think secure: if your code is in a C-like language, and it's hard to
  213. read it and become convinced it's safe then, it's probably not safe.
  214. Think small: we want to minimize the bytes that a Windows user needs
  215. to download for a transport client.
  216. Specify: if you can't come up with a good explanation
  217. Avoid security-through-obscurity if possible. Specify.
  218. Resist trivial fingerprinting: There should be no good string or regex
  219. to search for to distinguish your protocol from protocols permitted by
  220. censors.
  221. Imitate a real profile: There are many ways to implement most
  222. protocols -- and in many cases, most possible variants of a given
  223. protocol won't actually exist in the wild.
  224. Appendix: Raw-traffic transports
  225. This section describes an optional extension to the proposal above.
  226. We are not sure whether it is a good idea.