rendezvous.txt 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167
  1. How to make rendezvous points work
  2. 1-11Jun2003
  3. 0. Overview
  4. Rendezvous points are an implementation of server anonymity /
  5. location-hidden servers in the onion routing network. There are
  6. three components needed for rendezvous points:
  7. A) A means for the client ("Alice") to tell a server ("Bob") where
  8. to contact her in order to establish a connection. (Introduction)
  9. B) A means for Bob to contact Alice to actually establish the
  10. connection, and for them to communicate later. (Meeting)
  11. C) Necessary glue code so that Alice can view webpages on a
  12. location-hidden webserver, and Bob can run a location-hidden
  13. server with minimal invasive changes. (Application)
  14. We'll tackle these in order. In all cases, we'll assume that both
  15. Alice and Bob run local OPs.
  16. 1. Introduction service
  17. Bob wants to learn about client requests for communication, but
  18. wants to avoid responding unnecessarily to unauthorized clients.
  19. Bob's proxy opens a circuit, and tells some onion router on that
  20. circuit to expect incoming connections, and notify Bob of them.
  21. When establishing such an introduction point, Bob provides the onion
  22. router with a public "introduction" key. The hash of this public
  23. key uniquely identifies Bob, and prevents anybody else from
  24. usurping Bob's introduction point in the future. Additionally, Bob
  25. can use the same public key to establish an introduction point on
  26. another OR, and Alice can still be confident that Bob is the same
  27. server.
  28. (The set-up-an-introduction-point command should come via a
  29. RELAY_BIND_INTRODUCTION cell. This cell creates a new stream on the
  30. circuit from Bob to the introduction point.)
  31. ORs that support introduction run an introduction service on a
  32. separate port. When Alice wants to notify Bob of a meeting point,
  33. she connects (directly or via Tor) to the introduction port, and
  34. sends the following:
  35. MEETING REQUEST
  36. RSA-OAEP encrypted with server's public key:
  37. [20 bytes] Hash of Bob's public key (identifies which Bob to notify)
  38. [ 0 bytes] Initial authentication [optional]
  39. RSA encrypted with Bob's public key:
  40. [16 bytes] Symmetric key for encrypting blob past RSA
  41. [ 6 bytes] Meeting point (IP/port)
  42. [ 8 bytes] Meeting cookie
  43. [ 0 bytes] End-to-end authentication [optional]
  44. [98 bytes] g^x part 1 (inside the RSA)
  45. [30 bytes] g^x part 2 (symmetrically encrypted)
  46. The meeting point and meeting cookie allow Bob to contact Alice and
  47. prove his identity; the end-to-end authentication enables Bob to
  48. decide whether to talk to Alice; the initial authentication enables
  49. the meeting point to pre-screen introduction requests before
  50. sending them to Bob. (See 3 for a discussion of meeting points;
  51. see 2.1 for a proposed authentication mechanism.)
  52. The authentication steps are the appropriate places for the
  53. introduction server or Bob to do replay prevention, if desired.
  54. When the introduction point receives a valid meeting request, it
  55. sends the portion intended for Bob along the stream
  56. created by Bob's RELAY_BIND_INTRODUCTION. Bob then, at his
  57. discretion, connects to Alice's meeting point.
  58. 1.1. An example authentication scheme for introduction services
  59. Bob makes two short-term secrets SB and SN, and tells the
  60. introduction point about SN. Bob gives Alice a cookie consisting
  61. of A,B,C such that H(A|SB)=B and H(A|SN)=C. Alice's initial
  62. authentication is <A,C>; Alice's end-to-end authentication is <A,B>.
  63. [Maybe] Bob keeps a replay cache of A values, and doesn't allow any
  64. value to be used twice. Over time, Bob rotates SB and SN.
  65. [Maybe] Each 'A' has an expiration time built in to it.
  66. 2. Meeting points
  67. For Bob to actually reply to Alice, Alice first establishes a
  68. circuit to an onion router R, and sends a RELAY_BIND_MEETING cell
  69. to that onion router. The RELAY_BIND_MEETING cell contains a
  70. 'Meeting cookie' (MC) that Bob can use to authenticate to R. R
  71. remembers the cookie and associates it with Alice.
  72. Later, Bob also routes to R and sends R a RELAY_JOIN_MEETING cell with
  73. the meeting cookie MC. After this point, R routes all traffic from
  74. Bob's circuit or Alice's circuit as if the two circuits were joined:
  75. any RELAY cells that are not for a recognized topic are passed down
  76. Alice or Bob's circuit. Bob's first cell to Alice contains g^y.
  77. To prevent R from reading their traffic, Alice and Bob derive two
  78. end-to-end keys from g^{xy}, and they each treat R as just another
  79. hop on the circuit. (These keys are used in addition to the series
  80. of encryption keys already in use on Alice and Bob's circuits.)
  81. Bob's OP accepts RELAY_BEGIN, RELAY_DATA, RELAY_END, and
  82. RELAY_SENDME cells from Alice. Alice's OP accepts RELAY_DATA,
  83. RELAY_END, and RELAY_SENDME cells from Bob. All RELAY_BEGIN cells
  84. to Bob must have target IP and port of zero; Bob's OP will redirect
  85. them to the actual target IP and port of Bob's server.
  86. Alice and Bob's OPs disallow CREATE or RELAY_EXTEND cells as usual.
  87. 3. Application interface
  88. 3.1. Application interface: server side
  89. Bob has a service that he wants to offer to the world but keep its
  90. location hidden. He configures his local OP to know about this
  91. service, including the following data:
  92. Local IP and port of the service
  93. Strategy for choosing introduction points
  94. (for now, just randomly pick among the ORs offering it)
  95. Strategy for user authentication
  96. (for now, just accept all users)
  97. Public (RSA) key (one for each service Bob offers)
  98. Bob chooses a set of N Introduction servers on which to advertise
  99. his service.
  100. We assume the existence of a robust decentralized efficient lookup
  101. system (call it "DHT"). Bob publishes
  102. * Bob's Public Key for that service
  103. * Timestamp
  104. * Introduction server 0 ... Introduction server N
  105. (All signed by Bob's Public Key)
  106. into DHT, indexed by the hash of Bob's Public Key. Bob should
  107. periodically republish his introduction information with a new
  108. timestamp (and possibly with new/different introduction servers if
  109. he wants), so Alice can trust that DHT is giving her an up-to-date
  110. version.
  111. 3.2. Application interface: client side
  112. We require that the client interface remain a SOCKS proxy, and we
  113. require that Alice shouldn't have to modify her applications. Thus
  114. we encode all of the necessary information into the hostname that
  115. Alice uses (eg when clicking on a url in her browser, etc).
  116. To establish a connection to Bob, Alice needs to know an Introduction
  117. point, Bob's PK, and some authentication cookie. Because encoding this
  118. information into the hostname will be too long for a typical hostname,
  119. we instead use a layer of indirection. We encode a hash of Bob's PK
  120. (10 bytes is sufficient since we're not worrying about collisions),
  121. and also the authentication token (empty for now). Location-hidden
  122. services use the special top level domain called '.onion': thus
  123. hostnames take the form x.y.onion where x is the hash of PK, and y
  124. is the authentication cookie. If no cookie is required, the hostname
  125. can simply be of the form x.onion. Assuming only case insensitive
  126. alphanumeric and hyphen, we get a bit more than 6 bits encoded
  127. per character, meaning the x part of the hostname will be about
  128. 13 characters.
  129. Alice's onion proxy examines hostnames and recognizes when they're
  130. destined for a hidden server. If so, it decodes the PK, looks it up in
  131. the DHT, chooses and connects to a meeting place, chooses and connects
  132. to one of Bob's introduction servers, and then waits to hear from Bob.