163-detecting-clients.txt 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. Filename: 163-detecting-clients.txt
  2. Title: Detecting whether a connection comes from a client
  3. Author: Nick Mathewson
  4. Created: 22-May-2009
  5. Target: 0.2.2
  6. Status: Open
  7. Overview:
  8. Some aspects of Tor's design require relays to distinguish
  9. connections from clients from connections that come from relays.
  10. The existing means for doing this is easy to spoof. We propose
  11. a better approach.
  12. Motivation:
  13. There are at least two reasons for which Tor servers want to tell
  14. which connections come from clients and which come from other
  15. servers:
  16. 1) Some exits, proposal 152 notwithstanding, want to disallow
  17. their use as single-hop proxies.
  18. 2) Some performance-related proposals involve prioritizing
  19. traffic from relays, or limiting traffic per client (but not
  20. per relay).
  21. Right now, we detect client vs server status based on how the
  22. client opens circuits. (Check out the code that implements the
  23. AllowSingleHopExits option if you want all the details.) This
  24. method is depressingly easy to fake, though. This document
  25. proposes better means.
  26. Goals:
  27. To make grabbing relay privileges at least as difficult as just
  28. running a relay.
  29. In the analysis below, "using server privileges" means taking any
  30. action that only servers are supposed to do, like delivering a
  31. BEGIN cell to an exit node that doesn't allow single hop exits,
  32. or claiming server-like amounts of bandwidth.
  33. Passive detection:
  34. A connection is definitely a client connection if it takes one of
  35. the TLS methods during setup that does not establish an identity
  36. key.
  37. A circuit is definitely a client circuit if it is initiated with
  38. a CREATE_FAST cell, though the node could be a client or a server.
  39. A node that's listed in a recent consensus is probably a server.
  40. A node to which we have successfully extended circuits from
  41. multiple origins is probably a server.
  42. Active detection:
  43. If a node doesn't try to use server privileges at all, we never
  44. need to care whether it's a server.
  45. When a node or circuit tries to use server privileges, if it is
  46. "definitely a client" as per above, we can refuse it immediately.
  47. If it's "probably a server" as per above, we can accept it.
  48. Otherwise, we have either a client, or a server that is neither
  49. listed in any consensus or used by any other clients -- in other
  50. words, a new or private server.
  51. For these servers, we should attempt to build one or more test
  52. circuits through them. If enough of the circuits succeed, the
  53. node is a real relay. If not, it is probably a client.
  54. While we are waiting for the test circuits to succeed, we should
  55. allow a short grace period in which server privileges are
  56. permitted. When a test is done, we should remember its outcome
  57. for a while, so we don't need to do it again.
  58. Why it's hard to do good testing:
  59. Doing a test circuit starting with an unlisted router requires
  60. only that we have an open connection for it. Doing a test
  61. circuit starting elsewhere _through_ an unlisted router--though
  62. more reliable-- would require that we have a known address, port,
  63. identity key, and onion key for the router. Only the address and
  64. identity key are easily available via the current Tor protocol in
  65. all cases.
  66. We could fix this part by requiring that all servers support
  67. BEGIN_DIR and support downloading at least a current descriptor
  68. for themselves.
  69. Open questions:
  70. What are the thresholds for the needed numbers of circuits
  71. for us to decide that a node is a relay?
  72. [Suggested answer: two circuits from two distinct hosts.]
  73. How do we pick grace periods? How long do we remember the
  74. outcome of a test?
  75. [Suggested answer: 10 minute grace period; 48 hour memory of
  76. test outcomes.]
  77. If we can build circuits starting at a suspect node, but we don't
  78. have enough information to try extending circuits elsewhere
  79. through the node, should we conclude that the node is
  80. "server-like" or not?
  81. [Suggested answer: for now, just try making circuits through
  82. the node. Extend this to extending circuits as needed.]