[tor-dev] Stem ORPort protocol support

Damian Johnson atagar at torproject.org
Wed Feb 7 20:23:49 UTC 2018


Hi all. Over the last few months Tim and I have been collaborating on
Python support for the ORPort protocol. With it you can download
descriptors without a DirPort, and possibly fancier things in the
future like full circuit construction.

Tim put together a wonderful proof of concept called Endosome...

  https://github.com/teor2345/endosome

... and I just finished integrating it into Stem...

  https://gitweb.torproject.org/stem.git/tree/stem/client/__init__.py

With stem.client you can now download descriptors...

  import stem.client

  with stem.client.Relay.connect('127.0.0.1', 12345, [3]) as relay:
    circ = relay.create_circuit()
    circ.send('RELAY_BEGIN_DIR', stream_id = 1)
    desc = circ.send('RELAY_DATA', 'GET /tor/server/authority
HTTP/1.0\r\n\r\n', stream_id = 1).data
    circ.close()

    print(desc)

When run this looks like...

  % python demo.py
  HTTP/1.0 200 OK
  Date: Wed, 07 Feb 2018 18:42:41 GMT
  Content-Type: text/plain
  Content-Encoding: identity
  Expires: Fri, 09 Feb 2018 18:42:41 GMT

  router Unnamed 97.113.177.53 12345 0 23456
  identity-ed25519
  -----BEGIN ED25519 CERT-----
  AQQABm/qAazUltT1iUUbIMw8VNNhGb50FDHKJz6S94FLQNxL0LObAQAgBAAapbO9
  iLFD0l9SEiEMFQWIT2VnbLyCZKvbrxTs5ULC1l1hQPoui6Y/lEd3yjrQhIs/vl6R
  1S6FbwSFDmiXOzq47mFrse4C71ht3TpLOD0F3wiyjWtsqU1k7iPmmpejUgs=
  -----END ED25519 CERT-----
  master-key-ed25519 GqWzvYixQ9JfUhIhDBUFiE

I'd like to emphasize this is still very alpha. The API isn't set in
stone and there's no doubt quite a few rough edges. However, I wanted
the list to be aware just in case anyone would care to build on it. I
plan to draw a line at 'download descriptors through ORPorts' but I'd
be delighted to help others if there's more ambitious directions
they'd care to go (potentially all the way up to a Python Tor client,
similar to Orchid).

Now that we've reached this milestone I'm taking a break to focus on
Stem support for v3 Onion Services for a bit. However, when I come
back the next things on my dance card are...

  a. Support ORPort downloads in the stem.descriptor.remote module.
  b. More integ tests so Stem can be used as a tool for testing tor's ORPort.
  c. Give more thought to the API we'd like to vend.
  d. Brainstorm a GSoC project idea that expands these capabilities.

Cheers! -Damian


More information about the tor-dev mailing list