117-ipv6-exits.txt 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387
  1. Proposal : IPv6 exit
  2. Overview
  3. Extend Tor for TCP exit via IPv6 transport and DNS resolution of IPv6
  4. addresses. This proposal does not imply any IPv6 support for OR
  5. traffic, only exit and name resolution.
  6. Contents
  7. 0. Motivation
  8. As the IPv4 address space becomes more scarce there is increasing
  9. effort to provide Internet services via the IPv6 protocol. Many
  10. hosts are available at IPv6 endpoints which are currently
  11. inaccessible for Tor users.
  12. Extending Tor to support IPv6 exit streams and IPv6 DNS name
  13. resolution will allow users of the Tor network to access these hosts.
  14. This capability would be present for those who do not currently have
  15. IPv6 access, thus increasing the utility of Tor and furthering
  16. adoption of IPv6.
  17. 1. Design
  18. 1.1. General design overview
  19. There are three main components to this proposal. The first is a
  20. method for routers to advertise their ability to exit IPv6 traffic.
  21. The second is the manner in which routers resolve names to IPv6
  22. addresses. Last but not least is the method in which clients
  23. communicate with Tor to resolve and connect to IPv6 endpoints
  24. anonymously.
  25. 1.2. Router IPv6 exit support
  26. In order to specify exit policies and IPv6 capability new directives
  27. in the Tor configuration will be needed. If a router advertises IPv6
  28. exit policies in its descriptor this will signal the ability to
  29. provide IPv6 exit. There are a number of additional default deny
  30. rules associated with this new address space which are detailed in
  31. the addendum.
  32. When Tor is started on a host it should check for the presence of a
  33. global unicast IPv6 address and if present include the default IPv6
  34. exit policies and any user specified IPv6 exit policies.
  35. If a user provides IPv6 exit policies but no global unicast IPv6
  36. address is available Tor should generate a warning and not publish the
  37. IPv6 policies in the router descriptor.
  38. It should be noted that IPv4 mapped IPv6 addresses are not valid exit
  39. destinations. This mechanism is mainly used to interoperate with
  40. both IPv4 and IPv6 clients on the same socket. Any attempts to use
  41. an IPv4 mapped IPv6 address, perhaps to circumvent exit policy for
  42. IPv4, must be refused.
  43. 1.3. DNS name resolution of IPv6 addresses (AAAA records)
  44. In addition to exit support for IPv6 TCP connections, a method to
  45. resolve domain names to their respective IPv6 addresses is also
  46. needed. This is accomplished in the existing DNS system via AAAA
  47. records. Routers will perform both A and AAAA requests when
  48. resolving a name so that the client can utilize an IPv6 endpoint when
  49. available or preferred.
  50. To avoid potential problems with caching DNS servers that behave
  51. poorly all NXDOMAIN responses to AAAA requests should be ignored if a
  52. successful response is received for an A request. This implies that
  53. both AAAA and A requests will always be performed for each name
  54. resolution.
  55. For reverse lookups on IPv6 addresses, like that used for
  56. RESOLVE_PTR, Tor will perform the necessary PTR requests via
  57. IP6.ARPA.
  58. All routers which perform DNS resolution on behalf of clients
  59. (RELAY_RESOLVE) should perform and respond with both A and AAAA
  60. resources.
  61. 1.4. Client interaction with IPv6 exit capability
  62. 1.4.1. Usability goals
  63. There are a number of behaviors which Tor can provide when
  64. interacting with clients that will improve the usability of IPv6 exit
  65. capability. These behaviors are designed to make it simple for
  66. clients to express a preference for IPv6 transport and utilize IPv6
  67. host services.
  68. 1.4.2. SOCKSv5 IPv6 client behavior
  69. The SOCKS version 5 protocol supports IPv6 connections. When using
  70. SOCKSv5 with hostnames it is difficult to determine if a client
  71. wishes to use an IPv4 or IPv6 address to connect to the desired host
  72. if it resolves to both address types.
  73. In order to make this more intuitive the SOCKSv5 protocol can be
  74. supported on a local IPv6 endpoint, [::1] port 9050 for example.
  75. When a client requests a connection to the desired host via an IPv6
  76. SOCKS connection Tor will prefer IPv6 addresses when resolving the
  77. host name and connecting to the host.
  78. Likewise, RESOLVE and RESOLVE_PTR requests from an IPv6 SOCKS
  79. connection will return IPv6 addresses when available, and fall back
  80. to IPv4 addresses if not.
  81. 1.4.3. MAPADDRESS behavior
  82. The MAPADDRESS capability supports clients that may not be able to
  83. use the SOCKSv4a or SOCKSv5 hostname support to resolve names via
  84. Tor. This ability should be extended to IPv6 addresses in SOCKSv5 as
  85. well.
  86. When a client requests an address mapping from the wildcard IPv6
  87. address, [::0], the server will respond with a unique local IPv6
  88. address on success. It is important to note that there may be two
  89. mappings for the same name if both an IPv4 and IPv6 address are
  90. associated with the host. In this case a CONNECT to a mapped IPv6
  91. address should prefer IPv6 for the connection to the host, if
  92. available, while CONNECT to a mapped IPv4 address will prefer IPv4.
  93. It should be noted that IPv6 does not provide the concept of a host
  94. local subnet, like 127.0.0.0/8 in IPv4. For this reason integration
  95. of Tor with IPv6 clients should consider a firewall or filter rule to
  96. drop unique local addresses to or from the network when possible.
  97. These packets should not be routed, however, keeping them off the
  98. subnet entirely is worthwhile.
  99. 1.4.3.1. Generating unique local IPv6 addresses
  100. The usual manner of generating a unique local IPv6 address is to
  101. select a Global ID part randomly, along with a Subnet ID, and sharing
  102. this prefix among the communicating parties who each have their own
  103. distinct Interface ID. In this style a given Tor instance might
  104. select a random Global and Subnet ID and provide MAPADDRESS
  105. assignments with a random Interface ID as needed. This has the
  106. potential to associate unique Global/Subnet identifiers with a given
  107. Tor instance and may expose attacks against the anonymity of Tor
  108. users.
  109. Tor avoid this potential problem entirely MAPADDRESS must always
  110. generate the Global, Subnet, and Interface IDs randomly for each
  111. request. It is also highly suggested that explicitly specifying an
  112. IPv6 source address instead of the wildcard address not be supported
  113. to ensure that a good random address is used.
  114. 1.4.4. DNSProxy IPv6 client behavior
  115. A new capability in recent Tor versions is the transparent DNS proxy.
  116. This feature will need to return both A and AAAA resource records
  117. when responding to client name resolution requests.
  118. The transparent DNS proxy should also support reverse lookups for
  119. IPv6 addresses. It is suggested that any such requests to the
  120. deprecated IP6.INT domain should be translated to IP6.ARPA instead.
  121. This translation is not likely to be used and is of low priority.
  122. It would be nice to support DNS over IPv6 transport as well, however,
  123. this is not likely to be used and is of low priority.
  124. 1.4.5. TransPort IPv6 client behavior
  125. Tor also provides transparent TCP proxy support via the Trans*
  126. directives in the configuration. The TransListenAddress directive
  127. should accept an IPv6 address in addition to IPv4 so that IPv6 TCP
  128. connections can be transparently proxied.
  129. 1.5. Additional changes
  130. The RedirectExit option should be deprecated rather than extending
  131. this feature to IPv6.
  132. 2. Spec changes
  133. 2.1. Tor specification
  134. In '6.2. Opening streams and transferring data' the following should
  135. be changed to indicate IPv6 exit capability:
  136. "No version of Tor currently generates the IPv6 format."
  137. In '6.4. Remote hostname lookup' the following should be updated to
  138. reflect use of ip6.arpa in addition to in-addr.arpa.
  139. "For a reverse lookup, the OP sends a RELAY_RESOLVE cell containing an
  140. in-addr.arpa address."
  141. In 'A.1. Differences between spec and implementation' the following
  142. should be updated to indicate IPv6 exit capability:
  143. "The current codebase has no IPv6 support at all."
  144. 2.2. Directory specification
  145. In '2.1. Router descriptor format' a new set of directives is needed
  146. for IPv6 exit policy. The existing accept/reject directives should
  147. be clarified to indicate IPv4 or wildcard address relevance. The new
  148. IPv6 directives will be in the form of:
  149. "accept6" exitpattern NL
  150. "reject6" exitpattern NL
  151. The section describing accept6/reject6 should explain that the
  152. presence of accept6 or reject6 exit policies in a router descriptor
  153. signals the ability of that router to exit IPv6 traffic (according to
  154. IPv6 exit policies).
  155. The "[::]/0" notation is used to represent "all IPv6 addresses".
  156. "[::0]/0" may also be used for this representation.
  157. If a user specifies a 'reject6 [::]/0:*' policy in the Tor
  158. configuration this will be interpreted as forcing no IPv6 exit
  159. support and no accept6/reject6 policies will be included in the
  160. published descriptor. This will prevent IPv6 exit if the router host
  161. has a global unicast IPv6 address present.
  162. It is important to note that a wildcard address in an accept or
  163. reject policy applies to both IPv4 and IPv6 addresses.
  164. 2.3. Control specification
  165. In '3.8. MAPADDRESS' the potential to have to addresses for a given
  166. name should be explained. The method for generating unique local
  167. addresses for IPv6 mappings needs explanation as described above.
  168. When IPv6 addresses are used in this document they should include the
  169. brackets for consistency. For example, the null IPv6 address should
  170. be written as "[::0]" and not "::0". The control commands will
  171. expect the same syntax as well.
  172. In '3.9. GETINFO' the "address" command should return both public
  173. IPv4 and IPv6 addresses if present. These addresses should be
  174. separated via \r\n.
  175. 2.4. Tor SOCKS extensions
  176. In '2. Name lookup' a description of IPv6 address resolution is
  177. needed for SOCKSv5 as described above. IPv6 addresses should be
  178. supported in both the RESOLVE and RESOLVE_PTR extensions.
  179. A new section describing the ability to accept SOCKSv5 clients on a
  180. local IPv6 address to indicate a preference for IPv6 transport as
  181. described above is also needed. The behavior of Tor SOCKSv5 proxy
  182. with an IPv6 preference should be explained, for example, preferring
  183. IPv6 transport to a named host with both IPv4 and IPv6 addresses
  184. available (A and AAAA records).
  185. 3. Questions and concerns
  186. 3.1. DNS A6 records
  187. A6 is explicitly avoided in this document. There are potential
  188. reasons for implementing this, however, the inherent complexity of
  189. the protocol and resolvers make this unappealing. Is there a
  190. compelling reason to consider A6 as part of IPv6 exit support?
  191. 3.2. IPv4 and IPv6 preference
  192. The design above tries to infer a preference for IPv4 or IPv6
  193. transport based on client interactions with Tor. It might be useful
  194. to provide more explicit control over this preference. For example,
  195. an IPv4 SOCKSv5 client may want to use IPv6 transport to named hosts
  196. in CONNECT requests while the current implementation would assume an
  197. IPv4 preference. Should more explicit control be available, through
  198. either configuration directives or control commands?
  199. Many applications support a inet6-only or prefer-family type option
  200. that provides the user manual control over address preference. This
  201. could be provided as a Tor configuration option.
  202. An explicit preference is still possible by resolving names and then
  203. CONNECTing to an IPv4 or IPv6 address as desired, however, not all
  204. client applications may have this option available.
  205. 3.3. Support for IPv6 only transparent proxy clients
  206. It may be useful to support IPv6 only transparent proxy clients using
  207. IPv4 mapped IPv6 like addresses. This would require transparent DNS
  208. proxy using IPv6 transport and the ability to map A record responses
  209. into IPv4 mapped IPv6 like addresses in the manner described in the
  210. "NAT-PT" RFC for a traditional Basic-NAT-PT with DNS-ALG. The
  211. transparent TCP proxy would thus need to detect these mapped addresses
  212. and connect to the desired IPv4 host.
  213. The IPv6 prefix used for this purpose must not be the actual IPv4
  214. mapped IPv6 address prefix, though the manner in which IPv4 addresses
  215. are embedded in IPv6 addresses would be the same.
  216. The lack of any IPv6 only hosts which would use this transparent proxy
  217. method makes this a lot of work for very little gain. Is there a
  218. compelling reason to support this NAT-PT like capability?
  219. 3.4. IPv6 DNS and older Tor routers
  220. It is expected that many routers will continue to run with older
  221. versions of Tor when the IPv6 exit capability is released. Clients
  222. who wish to use IPv6 will need to route RELAY_RESOLVE requests to the
  223. newer routers which will respond with both A and AAAA resource
  224. records when possible.
  225. One way to do this is to route RELAY_RESOLVE requests to routers with
  226. IPv6 exit policies published, however, this would not utilize current
  227. routers that can resolve IPv6 addresses even if they can't exit such
  228. traffic.
  229. There was also concern expressed about the ability of existing clients
  230. to cope with new RELAY_RESOLVE responses that contain IPv6 addresses.
  231. If this breaks backward compatibility, a new request type may be
  232. necessary, like RELAY_RESOLVE6, or some other mechanism of indicating
  233. the ability to parse IPv6 responses when making the request.
  234. 3.5. IPv4 and IPv6 bindings in MAPADDRESS
  235. It may be troublesome to try and support two distinct address mappings
  236. for the same name in the existing MAPADDRESS implementation. If this
  237. cannot be accommodated then the behavior should replace existing
  238. mappings with the new address regardless of family. A warning when
  239. this occurs would be useful to assist clients who encounter problems
  240. when both an IPv4 and IPv6 application are using MAPADDRESS for the
  241. same names concurrently, causing lost connections for one of them.
  242. 4. Addendum
  243. 4.1. Sample IPv6 default exit policy
  244. reject 0.0.0.0/8
  245. reject 169.254.0.0/16
  246. reject 127.0.0.0/8
  247. reject 192.168.0.0/16
  248. reject 10.0.0.0/8
  249. reject 172.16.0.0/12
  250. reject6 [0000::]/8
  251. reject6 [0100::]/8
  252. reject6 [0200::]/7
  253. reject6 [0400::]/6
  254. reject6 [0800::]/5
  255. reject6 [1000::]/4
  256. reject6 [4000::]/3
  257. reject6 [6000::]/3
  258. reject6 [8000::]/3
  259. reject6 [A000::]/3
  260. reject6 [C000::]/3
  261. reject6 [E000::]/4
  262. reject6 [F000::]/5
  263. reject6 [F800::]/6
  264. reject6 [FC00::]/7
  265. reject6 [FE00::]/9
  266. reject6 [FE80::]/10
  267. reject6 [FEC0::]/10
  268. reject6 [FF00::]/8
  269. reject *:25
  270. reject *:119
  271. reject *:135-139
  272. reject *:445
  273. reject *:1214
  274. reject *:4661-4666
  275. reject *:6346-6429
  276. reject *:6699
  277. reject *:6881-6999
  278. accept *:*
  279. # accept6 [2000::]/3:* is implied
  280. 4.2. Additional resources
  281. 'DNS Extensions to Support IP Version 6'
  282. http://www.ietf.org/rfc/rfc3596.txt
  283. 'DNS Extensions to Support IPv6 Address Aggregation and Renumbering'
  284. http://www.ietf.org/rfc/rfc2874.txt
  285. 'SOCKS Protocol Version 5'
  286. http://www.ietf.org/rfc/rfc1928.txt
  287. 'Unique Local IPv6 Unicast Addresses'
  288. http://www.ietf.org/rfc/rfc4193.txt
  289. 'INTERNET PROTOCOL VERSION 6 ADDRESS SPACE'
  290. http://www.iana.org/assignments/ipv6-address-space
  291. 'Network Address Translation - Protocol Translation (NAT-PT)'
  292. http://www.ietf.org/rfc/rfc2766.txt