add some informal performance statements
[tor.git] / doc / rendezvous.txt
blobf006da7257b26a8ab11784c7b2a1bc62475eed79
1                    How to make rendezvous points work
3 0. Overview
5    Rendezvous points are an implementation of location-hidden services
6    (server anonymity) in the onion routing network. Location-hidden
7    services means Bob can offer a tcp service (say, a webserver) via the
8    onion routing network, without revealing the IP of that service.
10    The basic idea is to provide censorship resistance for Bob by allowing
11    him to advertise a variety of onion routers as his public location
12    (nodes known as his Introduction Points, see Section 1). Alice,
13    the client, chooses a node known as a Meeting Point (see Section
14    2). This extra level of indirection is needed so Bob doesn't serve
15    files directly from his public locations (so these nodes don't open
16    themselves up to abuse, eg from serving Nazi propaganda in France). The
17    extra level of indirection also allows Bob to choose which requests
18    to respond to, and which to ignore.
20    We provide the necessary glue code so that Alice can view webpages
21    on a location-hidden webserver, and Bob can run a location-hidden
22    server, with minimal invasive changes (see Section 3). Both Alice
23    and Bob must run local onion proxies (OPs) -- software that knows
24    how to talk to the onion routing network.
26    The big picture follows. We direct the reader to the rest of the
27    document for more details and explanation.
29    1) Bob chooses some Introduction Points, and advertises them on a
30       Distributed Hash Table (DHT).
31    2) Bob establishes onion routing connections to each of his
32       Introduction Points, and waits.
33    3) Alice learns about Bob's service out of band (perhaps Bob gave her
34       a pointer, or she found it on a website). She looks up the details
35       of Bob's service from the DHT.
36    4) Alice chooses and establishes a Meeting Point for this transaction.
37    5) Alice goes to one of Bob's Introduction Points, and gives it a blob
38       (encrypted for Bob) which tells him about herself and the Meeting
39       Point she chose. The Introduction Point sends the blob to Bob.
40    6) Bob chooses whether to ignore the blob, or to onion route to MP.
41       Let's assume the latter.
42    7) MP plugs together Alice and Bob. Note that MP doesn't know (or care)
43       who Alice is, or who Bob is; and it can't read anything they
44       transmit either, because they share a session key.
45    8) Alice sends a 'begin' cell along the circuit. It makes its way
46       to Bob's onion proxy. Bob's onion proxy connects to Bob's webserver.
47    9) Data goes back and forth as usual.
49 1. Introduction service
51    Bob wants to learn about client requests for communication, but
52    wants to avoid responding unnecessarily to unauthorized clients.
53    Bob's proxy opens a circuit, and tells some onion router on that
54    circuit to expect incoming connections, and notify Bob of them.
56    When establishing such an introduction point, Bob provides the onion
57    router with a public "introduction" key.  The hash of this public
58    key identifies a unique Bob, and (since Bob is required to sign his
59    messages) prevents anybody else from usurping Bob's introduction
60    point in the future.  Additionally, Bob can use the same public key
61    to establish an introduction point on another onion router (OR),
62    and Alice can still be confident that Bob is the same server.
64    (The set-up-an-introduction-point command should come via a
65    RELAY_BIND_INTRODUCTION cell. This cell creates a new stream on the
66    circuit from Bob to the introduction point.)
68    ORs that support introduction run an introduction service on a
69    separate port.  When Alice wants to notify Bob of a meeting point,
70    she connects (directly or via Tor) to the introduction port, and
71    sends the following:
73      MEETING REQUEST
74         RSA-OAEP encrypted with server's public key:
75 [20 bytes] Hash of Bob's public key (identifies which Bob to notify)
76 [ 0 bytes] Initial authentication [optional]
77         RSA encrypted with Bob's public key:
78 [16 bytes] Symmetric key for encrypting blob past RSA
79 [ 6 bytes] Meeting point (IP/port)
80 [ 8 bytes] Meeting cookie
81 [ 0 bytes] End-to-end authentication [optional]
82 [98 bytes] g^x part 1 (inside the RSA)
83 [30 bytes] g^x part 2 (symmetrically encrypted)
85    The meeting point and meeting cookie allow Bob to contact Alice and
86    prove his identity; the end-to-end authentication enables Bob to
87    decide whether to talk to Alice; the initial authentication enables
88    the introduction point to pre-screen introduction requests before
89    sending them to Bob. (See Section 2 for a discussion of meeting
90    points; see Section 1.1 for an example authentication mechanism.)
92    The authentication steps are the appropriate places for the
93    introduction server or Bob to do replay prevention, if desired.
95    When the introduction point receives a valid meeting request, it
96    sends the portion intended for Bob along the stream
97    created by Bob's RELAY_BIND_INTRODUCTION.  Bob then, at his
98    discretion, connects to Alice's meeting point.
100 1.1. An example authentication scheme for introduction services
102    Bob makes two short-term secrets SB and SN, and tells the
103    introduction point about SN.  Bob gives Alice a cookie consisting
104    of A,B,C such that H(A|SB)=B and H(A|SN)=C.  Alice's initial
105    authentication is <A,C>; Alice's end-to-end authentication is <A,B>.
107    [Maybe] Bob keeps a replay cache of A values, and doesn't allow any
108    value to be used twice.  Over time, Bob rotates SB and SN.
110    [Maybe] Each 'A' has an expiration time built in to it.
112    In reality, we'll want to pick a scheme that (a) wasn't invented from
113    scratch in an evening, and (b) doesn't require Alice to remember this
114    many bits (see section 3.2).
116 2. Meeting points
118    For Bob to actually reply to Alice, Alice first establishes a
119    circuit to an onion router R, and sends a RELAY_BIND_MEETING cell
120    to that onion router.  The RELAY_BIND_MEETING cell contains a
121    'Meeting cookie' (MC) that Bob can use to authenticate to R.  R
122    remembers the cookie and associates it with Alice.
124    Later, Bob also routes to R and sends R a RELAY_JOIN_MEETING cell with
125    the meeting cookie MC.  After this point, R routes all traffic from
126    Bob's circuit or Alice's circuit as if the two circuits were joined:
127    any RELAY cells that are not for a recognized topic are passed down
128    Alice or Bob's circuit.  Bob's first cell to Alice contains g^y.
130    To prevent R from reading their traffic, Alice and Bob derive two
131    end-to-end keys from g^{xy}, and they each treat R as just another
132    hop on the circuit.  (These keys are used in addition to the series
133    of encryption keys already in use on Alice and Bob's circuits.)
135    Bob's OP accepts RELAY_BEGIN, RELAY_DATA, RELAY_END, and
136    RELAY_SENDME cells from Alice.  Alice's OP accepts RELAY_DATA,
137    RELAY_END, and RELAY_SENDME cells from Bob.  All RELAY_BEGIN cells
138    to Bob must have target IP and port of zero; Bob's OP will redirect
139    them to the actual target IP and port of Bob's server.
141    Alice and Bob's OPs disallow CREATE or RELAY_EXTEND cells as usual.
143 3. Application interface
145 3.1. Application interface: server side
147    Bob has a service that he wants to offer to the world but keep its
148    location hidden.  He configures his local OP to know about this
149    service, including the following data:
151      Local IP and port of the service
152      Strategy for choosing introduction points
153        (for now, just randomly pick among the ORs offering it)
154      Strategy for user authentication
155        (for now, just accept all users)
156      Public (RSA) key (one for each service Bob offers)
158    Bob chooses a set of N Introduction servers on which to advertise
159    his service.
161    We assume the existence of a robust decentralized efficient lookup
162    system (call it "DHT" for distributed hash table -- note that the
163    onion routers can run nodes). Bob publishes
164      * Bob's Public Key for that service
165      * Expiration date ("don't use after")
166      * Introduction server 0 ... Introduction server N
167      (All signed by Bob's Public Key)
168    into DHT, indexed by the hash of Bob's Public Key. Bob should
169    periodically republish his introduction information with a new
170    expiration date (and possibly with new/different introduction servers
171    if he wants), so Alice can trust that DHT is giving her an up-to-date
172    version. The Chord CFS paper describes a sample DHT that allows
173    authenticated updating.
175 3.2. Application interface: client side
177    We require that the client interface remain a SOCKS proxy, and we
178    require that Alice shouldn't have to modify her applications. Thus
179    we encode all of the necessary information into the hostname (more
180    correctly, fqdn) that Alice uses, eg when clicking on a url in her
181    browser.
183    To establish a connection to Bob, Alice needs to know an Introduction
184    point, Bob's PK, and some authentication cookie. Because encoding this
185    information into the hostname will be too long for a typical hostname,
186    we instead use a layer of indirection. We encode a hash of Bob's PK
187    (10 bytes is sufficient since we're not worrying about collisions),
188    and also the authentication token (empty for now). Location-hidden
189    services use the special top level domain called '.onion': thus
190    hostnames take the form x.y.onion where x is the hash of PK, and y
191    is the authentication cookie. If no cookie is required, the hostname
192    can simply be of the form x.onion. Assuming only case insensitive
193    alphanumeric and hyphen, we get a bit more than 6 bits encoded
194    per character, meaning the x part of the hostname will be about
195    13 characters.
197    Alice's onion proxy examines hostnames and recognizes when they're
198    destined for a hidden server. If so, it decodes the PK and performs
199    the steps in Section 0 above.