117-ipv6-exits.txt 14 KB

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