xxx-pluggable-transport.txt 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310
  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. semicolons and put them user and password fields of the request,
  120. splitting them across the fields as necessary. If a key or value
  121. value must contain a semicolon or a backslash, it is escaped with a
  122. backslash.
  123. The "id-fingerprint" field is always provided in a field named
  124. "keyid", if it was given. Method names must be C identifiers.
  125. Example: if the bridge line is "bridge trebuchet www.example.com:3333
  126. rocks=20 height=5.6m" AND if the Tor client knows that the
  127. 'trebuchet' method is provided by a SOCKS5 proxy on
  128. 127.0.0.1:19999, the client should connect to that proxy, ask it to
  129. connect to www.example.com, and provide the string
  130. "rocks=20;height=5.6m" as the username, the password, or split
  131. across the username and password.
  132. There are two ways to tell Tor clients about protocol proxies:
  133. external proxies and managed proxies. An external proxy is configured
  134. with "ClientTransportPlugin trebuchet socks5 127.0.0.1:9999". This
  135. tells Tor that another program is already running to handle
  136. 'trubuchet' connections, and Tor doesn't need to worry about it. A
  137. managed proxy is configured with "ClientTransportPlugin trebuchet
  138. exec /usr/libexec/tor-proxies/trebuchet [options]", and tells Tor to launch
  139. an external program on-demand to provide a socks proxy for 'trebuchet'
  140. connections. The Tor client only launches one instance of each
  141. external program, even if the same executable is listed for more than
  142. one method.
  143. The same program can implement a managed or an external proxy: it just
  144. needs to take an argument saying which one to be.
  145. Client proxy behavior
  146. When launched from the command-line by a Tor client, a transport
  147. proxy needs to tell Tor which methods and ports it supports. It does
  148. this by printing one or more CMETHOD: lines to its stdout. These look
  149. like
  150. CMETHOD: trebuchet SOCKS5 127.0.0.1:19999 ARGS:rocks,height \
  151. OPT-ARGS:tensile-strength
  152. The ARGS field lists mandatory parameters that must appear in every
  153. bridge line for this method. The OPT-ARGS field lists optional
  154. parameters. If no ARGS or OPT-ARGS field is provided, Tor should not
  155. check the parameters in bridge lines for this method.
  156. The proxy should print a single "METHODS: DONE" line after it is
  157. finished telling Tor about the methods it provides.
  158. The transport proxy MUST exit cleanly when it receives a SIGTERM from
  159. Tor.
  160. The Tor client MUST ignore lines beginning with a keyword and a colon
  161. if it does not recognize the keyword.
  162. In the future, if we need a control mechanism, we can use the
  163. stdin/stdout from Tor to the transport proxy.
  164. A transport proxy MUST handle SOCKS connect requests using the SOCKS
  165. version it advertises.
  166. Tor clients SHOULD NOT use any method from a client proxy unless it
  167. is both listed as a possible method for that proxy in torrc, and it
  168. is listed by the proxy as a method it supports.
  169. [XXXX say something about versioning.]
  170. Server behavior
  171. Server proxies are configured similarly to client proxies.
  172. Server proxy behavior
  173. [so, we can have this work like client proxies, where the bridge
  174. launches some programs, and they tell the bridge, "I am giving you
  175. method X with parameters Y"? Do you have to take all the methods? If
  176. not, which do you specify?]
  177. [Do we allow programs that get started independently?]
  178. [We'll need to figure out how this works with port forwarding. Is
  179. port forwarding the bridge's problem, the proxy's problem, or some
  180. combination of the two?]
  181. [If we're using the bridge authority/bridgedb system for distributing
  182. bridge info, the right place to advertise bridge lines is probably
  183. the extrainfo document. We also need a way to tell the bridge
  184. authority "don't give out a default bridge line for me"]
  185. Server behavior
  186. Bridge authority behavior
  187. Implementation plan
  188. Turn this into a draft proposal
  189. Circulate and discuss on or-dev.
  190. We should ship a couple of null plugin implementations in one or two
  191. popular, portable languages so that people get an idea of how to
  192. write the stuff.
  193. 1. We should have one that's just a proof of concept that does
  194. nothing but transfer bytes back and forth.
  195. 1. We should not do a rot13 one.
  196. 2. We should implement a basic proxy that does not transform the bytes at all
  197. 1. We should implement DNS or HTTP using other software (as goodell
  198. did years ago with DNS) as an example of wrapping existing code into
  199. our plugin model.
  200. 2. The obfuscated-ssh superencipherment is pretty trivial and pretty
  201. useful. It makes the protocol stringwise unfingerprintable.
  202. 1. Nick needs to be told firmly not to bikeshed the obfuscated-ssh
  203. superencipherment too badly
  204. 1. Go ahead, bikeshed my day
  205. 1. If we do a raw-traffic proxy, openssh tunnels would be the logical choice.
  206. Appendix: recommendations for transports
  207. Be free/open-source software. Also, if you think your code might
  208. someday do so well at circumvention that it should be implemented
  209. inside Tor, it should use the same license as Tor.
  210. Use libraries that Tor already requires. (You can rely on openssl and
  211. libevent being present if current Tor is present.)
  212. Be portable: most Tor users are on Windows, and most Tor developers
  213. are not, so designing your code for just one of these platforms will
  214. make it either get a small userbase, or poor auditing.
  215. Think secure: if your code is in a C-like language, and it's hard to
  216. read it and become convinced it's safe then, it's probably not safe.
  217. Think small: we want to minimize the bytes that a Windows user needs
  218. to download for a transport client.
  219. Specify: if you can't come up with a good explanation
  220. Avoid security-through-obscurity if possible. Specify.
  221. Resist trivial fingerprinting: There should be no good string or regex
  222. to search for to distinguish your protocol from protocols permitted by
  223. censors.
  224. Imitate a real profile: There are many ways to implement most
  225. protocols -- and in many cases, most possible variants of a given
  226. protocol won't actually exist in the wild.
  227. Appendix: Raw-traffic transports
  228. This section describes an optional extension to the proposal above.
  229. We are not sure whether it is a good idea.