[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [tor-dev] How to distribute Tor with other software



> You could use one of the controller libraries (stem if you want
> synchronous, txtorcon if async/Twisted) to do this; they don't have to
> modify the torrc directly, just manipulate configuration via GETCONF and
> SETCONF. For Tails, this probably won't work unless you're root until
> #11291 is fixed + merged.

I'm not saying that this would be appropriate for your python app...
but there are definitely ways for Twisted to interoperate with blocking APIs.
Laurens Van Houtven gave a pretty good talk about this at PyCon 2014:
https://www.youtube.com/watch?v=A_NnHC2LcaE

>    d = serverFromString("onion:80:hiddenServiceDir=/foo/bar").listen(...)

This Twisted endpoints plugin system allows us to keep our Twisted
apps endpoint agnostic...
but requires that the appropriate Twisted endpoint parser is installed.

Tahoe-LAFS in particular gets a big win from this native Tor
integration because Foolscap (the wire protocol library used)
gets to be endpoint agnostic while Tahoe-LAFS can take care of some
Tor specific features.

> (For the other way, David has a pull-request into txsocksx so that
> things like "clientFromString('tor:blarg.onion')" will work via SOCKS to
> 9050 or 9150).

In my latest branch I wrote a DeferredDispatcher class
( which will be replaced by core Twisted api once twisted trac ticket
#6365 is resolved: https://twistedmatrix.com/trac/ticket/6365 ).
which can be used to coordinate multiple Tor client and server Twisted
endpoints with a single Tor process (per python process).
Work in progress in this branch here:

https://github.com/david415/txsocksx/tree/tor_deferred_dispatcher

Here's an example program that uses Tor client and server endpoints.
It sets up a simple webserver listening to the hidden service endpoint,
retrieves the new onion and then uses the Tor client endpoint to connect
and query the webserver.

https://github.com/david415/txsocksx/blob/tor_deferred_dispatcher/examples/tor-dispatch-onion.py

Eventually (soon maybe?) I'm going to write extensive documentation
and example code for assisting
Python developers to write apps with native Tor integration and
Tor-friendly features. The native Tor integration for
Tahoe-LAFS will serve as an excellent example case.


Cheers!

David
_______________________________________________
tor-dev mailing list
tor-dev@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-dev