torbl-design.txt 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  1. Design For A Tor RBL {DRAFT}
  2. Status:
  3. This is a suggested design for a DNSBL for Tor exit nodes. It hasn't been
  4. implemented.
  5. Why?
  6. It's useful for third parties to be able to tell when a given connection
  7. is coming from a Tor exit node. Potential applications range from
  8. "anonymous user" cloaks on IRC networks like oftc, to networks like
  9. Freenode that apply special authentication rules to users from these
  10. IPs, to systems like Wikipedia that may want to make a priority of
  11. _unblocking_ shared IPs more liberally than non-shared IPs, since shared
  12. IPs presumably have non-abusive users as well as abusive ones.
  13. Since Tor provides exit policies, not every Tor server will connect to
  14. every address:port combination on the Internet. Unless you're trying to
  15. penalize hosts for supporting anonymity, it makes more sense to answer
  16. the fine-grained question "which Tor servers will connect to _me_?" than
  17. the coarse-grained question "which Tor servers exist?" The fine-grained
  18. approach also helps Tor server ops who share an IP with their Tor
  19. server: if they want to access a site that blocks Tor users, they
  20. can exclude that site from their exit policy, and the site can learn
  21. that they won't send it anonymous connections.
  22. Tor already ships with a tool (the "contrib/exitlist" script) to
  23. identify which Tor nodes might open anonymous connections to any given
  24. exit address. But this is a bit tricky to set up, so only sites like
  25. Freenode and OFTC that are dedicated to privacy use it.
  26. Conversely, providers of some DNSBL implementations are providing
  27. coarse-grained lists of Tor hosts -- sometimes even listing servers that
  28. permit no exit connections at all. This is rather a problem, since
  29. support for DNSBL is pretty ubiquitous.
  30. How?
  31. Keep a running Tor instance, and parse the cached-routers and
  32. cached-routers.new files as new routers arrive. To tell whether a given
  33. server allows connections to a certain address:port combo, look at the
  34. definitions in dir-spec.txt or follow the logic of the current exitlist
  35. script. If bug 405 is still open when you work on this
  36. (http://bugs.noreply.org/flyspray/index.php?do=details&id=405), you'll
  37. probably want to extend it to look at only the newest descriptor for
  38. each server, so you don't use obsolete exit policy data.
  39. FetchUselessDescriptors would probably be a good torrc option to enable.
  40. If you're also running a directory cache, you get extra-fresh
  41. information.
  42. The DNS interface
  43. DNSBL, if I understand right, looks like this: There's some host at
  44. foo.example.com. You want to know if 1.2.3.4 is in the list, so you
  45. query for an A record for 4.3.2.1.foo.example.com. If the record
  46. exists, 1.2.3.4 is in the list. If you get an NXDOMAIN error, 1.2.3.4
  47. is not in the list.
  48. Assume that the DNSBL sits at some host, torhosts.example.com. Below
  49. are some queries that could be supported, though some of them are
  50. possibly a bad idea.
  51. Query type 1: "General IP:Port"
  52. Format:
  53. {IP1}.{port}.{IP2}.ip-port.torhosts.example.com
  54. Rule:
  55. Iff {IP1} is a Tor server that permits connections to {port} on
  56. {IP2}, then there should be an A record.
  57. Example:
  58. "1.0.0.10.80.4.3.2.1.ip-port.torhosts.example.com" should exist
  59. if and only if there is a Tor server at 10.0.0.1 that allows
  60. connections to port 80 on 1.2.3.4.
  61. Example use:
  62. I'm running an IRC server at w.x.y.z:9999, and I want to tell
  63. whether an incoming connection is from a Tor server. I set
  64. up my IRC server to give a special mask to any user coming from
  65. an IP listed in 9999.z.y.x.w.ip-port.torhosts.example.com.
  66. Later, when I get a connection from a.b.c.d, my ircd looks up
  67. "d.c.b.a.9999.z.y.x.w.ip-port.torhosts.example.com" to see
  68. if it's a Tor server that allows connections to my ircd.
  69. Query type 2: "IP-port group"
  70. Format:
  71. {IP}.{listname}.list.torhosts.example.com
  72. Rule:
  73. Iff this Tor server is configured with an IP:Port list named
  74. {listname}, and {IP} is a Tor server that permits connections to
  75. any member of {listname}, then there exists an A record.
  76. Example:
  77. Suppose torhosts.example.com has a list of IP:Port called "foo".
  78. There is an A record for 4.3.2.1.foo.list.torhosts.example.com
  79. if and only if 1.2.3.4 is a Tor server that permits connections
  80. to one of the addresses in list "foo".
  81. Example use:
  82. Suppose torhosts.example.com has a list of hosts in "examplenet",
  83. a popular IRC network. Rather than having them each set up to
  84. query the appropriate "ip-port" list, they could instead all be
  85. set to query a central examplenet.list.torhosts.example.com.
  86. Problems:
  87. We'd be better off if each individual server queried about hosts
  88. that allowed connections to itself. That way, if I wanted to
  89. allow anonymous connections to foonet, but I wanted to be able to
  90. connect to foonet from my own IP without being marked, I could add
  91. just a few foonet addresses to my exit policy.
  92. Query type 3: "My IP, with port"
  93. Format:
  94. {IP}.{port}.me.torhosts.example.com
  95. Rule:
  96. An A record exists iff there is a tor server at {IP} that permits
  97. connections to {port} on the host that requested the lookup.
  98. Example:
  99. "4.3.2.1.80.me.torhosts.example.com" should have an A record if
  100. and only if there is a Tor server at 1.2.3.4 that allows
  101. connections to port 80 of the querying host.
  102. Example use:
  103. Somebody wants to set up a quick-and-dirty Tor detector for a
  104. single webserver: just point them at 80.me.torhosts.example.com.
  105. Problem:
  106. This would be easiest to use, but DNS gets in the way. If you
  107. create DNS records that give different results depending on who is
  108. asking, you mess up caching. There could be a fix here, but might
  109. not.
  110. RECOMMENDATION: Just build ip-port for now, and see what demand is
  111. like. There's no point in building mechanisms nobody wants.
  112. Web interface:
  113. Should provide the same data as the dns interface.
  114. Other issues:
  115. 30-60 minutes is not an unreasonable TTL.
  116. There could be some demand for address masks and port lists. Address
  117. masks wider than /8 make me nervous here, as do port ranges.
  118. We need an answer for what to do about hosts which exit from different
  119. IPs than their advertised IP. One approach would be for the DNSBL
  120. to launch periodic requests to itself through all exit servers whose
  121. policies allow it -- and then see where the requests actually come from.