<div dir="ltr">Tim: <div>Thank you for the detailed email. I've also included tor-dev on CC. Anyone is welcome to comment.</div><div><br></div><div>To reply to your concerns: </div><div><ol><li>All the documentation we have is basically in email correspondences as well as in the generic simple-quic codebase here:<span style="color:rgb(80,0,80);font-size:12.8px"> </span><a href="https://github.com/kku1993/simple-quic" rel="noreferrer" target="_blank" style="font-size:12.8px">https://github.com/kku1993/simple-quic</a>. The <span style="font-size:12.8px">quicksock_t interface is in the above repo under /quicsock. </span>There isn't much documentation because: a) our designs are still under test and large portions are not stable yet, b) we haven't gotten much time to properly document designs and changes to the Tor codebase. But the emails should be somewhat clear on some key design aspects.  </li><li>About providing an alternative for QUIC connections: </li><ul><li>Great idea about keeping both type of sockets in connection. I think this will give us a cleaner design. </li><li>Exit relay will speak normal TCP. This is part of our design from the start but we haven't gotten around to look into the exit connection code. </li><li>Connections to the directory authorities should be normal TCP. </li><li>While compatibility with the current system is very important, our main goal is to compare performances of the OR connections with TCP vs. QUIC. So we haven't spent much effort making things beautiful yet. After all, it is possible that QUIC is a bad idea for Tor.. </li></ul><li>I was looking at chutney the other day but I couldn't find much documentation on how it works. I will play with it more and then I might ask for more help. </li></ol><div>If anyone else is expert on the SSL part of the codebase, please provide some insights about the security aspect of the design, specifically: "<span style="font-size:12.8px">About SSL, we want to adopt the design where QUIC handles SSL by not using the ssl_buffer in TOR code. Any concerns at all?" (not using read_to_buf_tls() and other similar ssl functions)</span></div></div><div><br></div><div>Another concern is the assumption on TOR_SOCKET_T in the Tor codebase. In particular, there are many call sites of fcntl, getsockname, setsockopt etc made directly on this object, assuming that it is a UNIX socket. For compatibility, after replacing UNIX socket with quicsock_t, we would use "qs_get_fd" for all those low-level calls. Note that quicsock_t holds a UDP socket internally. Without the testing system ready, we don't know the effect of these calls on a UDP socket instead of the normal TCP socket. </div><div><br></div><div>Any other feedback also welcomed! </div><div>Li. </div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Apr 4, 2016 at 10:43 PM, Tim Wilson-Brown - teor <span dir="ltr"><<a href="mailto:teor2345@gmail.com" target="_blank">teor2345@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Li,<br>
<br>
If you're ok with emailing the tor-dev mailing list, you will likely get better answers to some of these questions there.<br>
All of these questions could benefit from the wider Tor developer community.<br>
When I know I can't fully answer a question, I'll say so below.<br>
<br>
Please feel free to forward my response to tor-dev.<br>
<span class=""><br>
> On 5 Apr 2016, at 05:38, Xiaofan Li <<a href="mailto:xli2@andrew.cmu.edu">xli2@andrew.cmu.edu</a>> wrote:<br>
><br>
> Hi Tim:<br>
> I think maybe now is a good time to bother you again. In the following email, we outlined some current progress on the TOR+QUIC project. This weekend we booted up our first TOR node running QUIC (then of course it failed to contact the directory authorities and hanged). We hope to move on to testing our design while clean up some uncertain "loose-ends" in the integration process, with your help. In particular:<br>
>       • We decided to implement a QUIC interface similar to the UNIX socket interface. We have replaced TOR_SOCKET_T with our quicksock_t. Any issues about this design?<br>
<br>
</span>I'm not particularly familiar with this part of the tor codebase, you might get better answers from tor-dev.<br>
Also, without knowing the definition of quicksock_t, I can't say much more.<br>
<br>
Overall, I think your design has two major flaws:<br>
* you need to provide QUIC as an alternative, not a replacement, because Exits need to speak TCP, and so might Clients and Onion Services<br>
* you've chosen to modify all tor sockets to speak QUIC, rather than replacing SSL over TCP with QUIC<br>
<br>
Why not put your quicksock_t in connection_t (in or.h), and then choose whether to use QUIC or a plain socket based on whether you're using an OR connection (or_connection_t) or not?<br>
You'd also need some logic in OR listener connections (listener_connection_t) that creates a QUIC or plain socket from the listener depending on whether it's an OR listener or not.<br>
<br>
See "Kinds of Connections" in <a href="https://gitweb.torproject.org/user/nickm/torguts.git/tree/02-dataflow.md" rel="noreferrer" target="_blank">https://gitweb.torproject.org/user/nickm/torguts.git/tree/02-dataflow.md</a><br>
And <a href="https://gitweb.torproject.org/user/nickm/torguts.git/plain/diagrams/02/02-connection-types.png" rel="noreferrer" target="_blank">https://gitweb.torproject.org/user/nickm/torguts.git/plain/diagrams/02/02-connection-types.png</a><br>
And maybe <a href="https://gitweb.torproject.org/user/nickm/torguts.git/plain/diagrams/02/02-dataflow.png" rel="noreferrer" target="_blank">https://gitweb.torproject.org/user/nickm/torguts.git/plain/diagrams/02/02-dataflow.png</a><br>
<br>
Here are my concerns in detail:<br>
<br>
I think you need a design that enables QUIC over UDP as an alternative to SSL over TCP sockets, like the way Tor's IPv6 support provides IPv6 as an alternative to IPv4. (Of course, IPv6 is not the same level of the protocol stack as QUIC.)<br>
<br>
If you completely replace TCP with QUIC, then Exits will also speak QUIC to sites on the wider Internet. (As you describe below.)<br>
Also, relays with speak QUIC to the directory authorities when downloading descriptors, rather than using HTTP over TCP.<br>
And you'll force the browser and Tor controllers to speak QUIC to the Tor Client.<br>
And Tor Onion Services to speak QUIC to the backend servers they connect to.<br>
(I think some parts of Tor's DNS might also be affected, but it depends on the level of abstraction they're at.)<br>
<br>
This is unlikely to be what you want. And there could also be other impacts on connections that should stay TCP.<br>
<br>
>       • About SSL, we want to adopt the design where QUIC handles SSL by not using the ssl_buffer in TOR code. Any concerns at all?<br>
<br>
You'll need to ask tor-dev for this one, I'm not familiar with this code at all.<br>
<br>
>       • During integration, I found many instances where TOR assumes TOR_SOCKET_T is INT. Why can TOR make this assumption? Is the type TOR_SOCKET_T only created to accommodate windows dev?<br>
<br>
I think the assumption was already there when Windows support was added.<br>
It would appear that tor_socket_t exists for Windows compatibility.<br>
<br>
>From the definition of tor_socket_t in compat.h:<br>
<br>
/* XXX Actually, this should arguably be SOCKET; we use intptr_t here so that<br>
 * any inadvertent checks for the socket being <= 0 or > 0 will probably<br>
 * still work. */<br>
<br>
>       • For testing, what's the most correct (and easy enough to do in a few weeks) way to simulate the TOR network? Right now I'm thinking using the microdesc cache to avoid contacting any directory authorities. I will create a cluster of about 5 nodes in server mode, all of which only know the other nodes running QUIC. Do you think this will work?<br>
<br>
Tor has a TestingTorNetwork config option, which modifies a significant number of settings to enable local testing.<br>
If you define your own authorities, they can provide a consensus to your clients.<br>
This could be much more reliable than using the microdesc cache.<br>
(Please read the TestingTorNetwork entry in the tor manual for more details.)<br>
<br>
You may find this easiest to set up using chutney, which is how we test a full tor network on a local machine.<br>
Chutney will configure authorities, relays, and clients for you, then launch the network.<br>
The easiest way to set it up is to:<br>
1. Clone <a href="https://gitweb.torproject.org/chutney.git" rel="noreferrer" target="_blank">https://gitweb.torproject.org/chutney.git</a><br>
2. Clone your tor repository next to the chutney clone<br>
3. Run tor's ./configure<br>
4. Run tor's make test-network<br>
<br>
If this doesn't work, you might find it easiest to start with the chutney "basic" template:<br>
5. Run src/test/test-network.sh --flavor basic<br>
<br>
If you start by running chutney on tor master, you'll get an idea of how it works.<br>
Then you can see what breaks when you try it with your QUIC-based tor.<br>
<br>
>       • Anything else bad about the implementation?<br>
<br>
I haven't seen the implementation.<br>
Have you sent me a link, or did you want me to give advice based on the design issues you describe in the email you forwarded?<br>
<br>
As far as I can see, your major issues are getting a Tor test network running (I strongly recommend chutney), and dealing with Exits needing QUIC, TCP, and DNS/UDP. If you want interoperability with non-QUIC browsers and servers, you'll need to work out similar issues with Clients and Onion Services as well.<br>
<span class="HOEnZb"><font color="#888888"><br>
Tim<br>
</font></span><div class="HOEnZb"><div class="h5"><br>
> Thank you!<br>
> Li.<br>
><br>
><br>
><br>
><br>
> ---------- Forwarded message ----------<br>
> From: Xiaofan Li <<a href="mailto:xli2@andrew.cmu.edu">xli2@andrew.cmu.edu</a>><br>
> Date: Mon, Apr 4, 2016 at 3:20 PM<br>
> Subject: [TOR+QUIC] Progress Update<br>
> To: Mashael AlSabah <<a href="mailto:malsabah@gmail.com">malsabah@gmail.com</a>><br>
> Cc: Srinivasan Seshan <<a href="mailto:srini@cs.cmu.edu">srini@cs.cmu.edu</a>>, Kevin Ku <<a href="mailto:kku@andrew.cmu.edu">kku@andrew.cmu.edu</a>><br>
><br>
><br>
> Hi all,<br>
> Before the project meetings, we want to debrief you on the recent progress of the project so that our discussions can be more efficient. In general, this week we made reasonable progress and now we are in the debugging/testing phase. Particularly, we:<br>
>       • Designed and implemented the interaction between QUIC and the libevent system inside TOR.<br>
>               • Integrating QUIC with TOR causes mismatches of abstractions (see below). We worked hard to come up with a clean design while not blocking development.<br>
>               • We have to pass the event_base to QUIC for it to register an alarm callback that is required by QUIC.<br>
>               • libevent -> TOR-register callbacks -> QUIC interface -> data -> QUIC processing -> only application data gets passed up to TOR<br>
>               • Minimum code change in TOR: we still use all the callback mechanisms (timer + signal + async) in TOR but we modify those callbacks.<br>
>       • Modified code paths inside TOR to accommodate QUIC.<br>
>               • We turned off Tor's SSL code path in the read/write callbacks. We should probably also turn off the handshake inside TOR as well.<br>
>               • TOR has a lot of implementation shortcut that make assumptions about the TOR_SOCKET_T type. We cleaned this up.<br>
>               • Some remaining issues about direct low-level calls on the socket (e.g. fcntl or setsockopt). The effects of these issues are unclear right now.<br>
>       • Small hacks to make sure things ran.<br>
>               • We hardcoded the certificate and private key used by QUIC.<br>
>               • QUIC is compiled into a shared library and it seems to be working well. (Don't know about the SSL things right now.)<br>
>       • Tweaked the our QUIC interface to allow generality and smooth integration with TOR.<br>
> Some challenging problems we encountered:<br>
>       • Mismatched abstractions: This is obviously the most challenging implementation problem. We hope our experience can perhaps suggestion some designs for the ongoing QUIC interface design:<br>
>               • SSL/TLS: Fundamentally, QUIC is providing TLS security on a lower level than what TOR is expecting and this is causing problems. We should take away the TOR's SSL/TLS code to achieve the benefits of QUIC.<br>
>               • Other Implementations: Compared to the UNIX socket type, our QUIC "socket" provides different interface and functionalities and it is possible that there are assumptions made by TOR about the socket interface. For example, the fact that QUIC requires an alarm system is destroying the abstraction separation between TOR and QUIC. The alarms are used for path discovery, handshakes, retransmission etc. We believe that those should be internal to the lower level transport and thus hidden by QUIC. We are unable to hide them right now because QUIC does not have the necessary OS support to do so. The performance implication is unclear.<br>
>       • Testing: We are in the phase of testing. We are investigating various testing methods. The key problem is that we have to basically scrap all the systems that TOR already provides because we speak a different protocol. Particularly, we need to:<br>
>               • Replace or disable the directory authorities. Disabling is easier because we can hardcode the bootstrapping process and make the OP contact our QUIC node, but this way we might not have the most accurate (and comparable) data on the bootstrapping process.<br>
>               • We need to set up some number of circuits and differentiate normal nodes from exit nodes. Right now the exit nodes will also speak QUIC which is not good.<br>
>               • We will probably need 3-5 machines at least. (Some Amazon AWS credit maybe??)<br>
> Right now, our simple_quic interface is relatively stable and it is located at: <a href="https://github.com/kku1993/simple-quic" rel="noreferrer" target="_blank">https://github.com/kku1993/simple-quic</a> . It offers a purely generic interface that does not specifically tie to TOR. Feel free to take a look! We are thinking about giving it to the QUIC people at Google after we polish and document it better.<br>
> Kevin, feel free to add anything.<br>
><br>
> Looking forward to the meetings!<br>
> Li.<br>
<br>
</div></div></blockquote></div><br></div>