Commit Graph

74 Commits

Author SHA1 Message Date
Brian Warner
e0cc32af9d add ChannelMonitor to track unclosed channels with weakrefs, not __del__ 2015-10-06 19:12:41 -07:00
Brian Warner
fc30fa6cd4 rename channel-id to channelid. changes DB schema. 2015-10-06 19:12:41 -07:00
Brian Warner
f24e05d4cb new Wormhole API: separate send_data()/get_data() calls 2015-10-03 22:03:27 -07:00
Brian Warner
7a28400586 split transcribe.py into two layers: comms and crypto 2015-10-03 17:51:35 -07:00
Brian Warner
617bb03ad5 rewrite server API
This removes "side" and "msgnum" from the URLs, and puts them in a JSON
request body instead. The server now maintains a simple set of messages
for each channel-id, and isn't responsible for removing duplicates.

The client now fetches all messages, and just ignores everything it sent
itself. This removes the "reflection attack".

Deallocate now returns JSON, for consistency. DB and API use "phase" and
"body" instead of msgnum/message.

This changes the DB schema, so delete the DB before upgrading the server.
2015-10-03 17:38:31 -07:00
Brian Warner
bc3b0f03b9 blocking/transit.py: hush a transient failure
Not entirely sure what's going on here, but this is probably safe.
2015-10-03 16:53:08 -07:00
Brian Warner
540fceb795 add py3.4 compatibility
The "bytes % bytes" syntax only appeared on py3.5, so don't use it.

Updated travis to expect py3.4 works.

The twisted side is probably even more broken for py3.4 than it is for
py3.5.
2015-09-28 16:15:55 -07:00
Brian Warner
b5d470fcda make blocking/send-file work on py3
* declare transit records and handshake keys are bytes, not str
* declare transit connection hints to be str
* use six.moves.socketserver, six.moves.input for Verifier query
* argparse "--version" writes to stderr on py2, stdout on py3
* avoid xrange(), use subprocess.Popen(universal_newlines=True)
2015-09-28 00:24:36 -07:00
Brian Warner
8fe41e135d make blocking/send-text work on py3, add dependency on 'six'
* use modern/portable "next(iter)" instead of "iter.next()"
* use six.moves.input() instead of raw_input()
* tell requests' Response.iter_lines that we want str, not bytes
2015-09-28 00:24:36 -07:00
Brian Warner
a7213d9c9a enforce bytes-vs-str in the API
The main wormhole code is str (unicode in py3, bytes in py2). Most
everything else must be passed as bytes in both py2/py3.

Keep the internal "side" string as a str, to make it easier to merge
with other URL pieces.
2015-09-28 00:24:36 -07:00
Brian Warner
5d93dccb88 appid and derive_key(purpose=) must be bytes, not unicode 2015-09-28 00:24:00 -07:00
Brian Warner
532aa0811c update idSymmetric= to match SPAKE2-0.3 2015-09-22 01:07:46 -07:00
Brian Warner
88dab265de test blocking code, using twisted+deferToThread
Unfortunately Twisted still requires python2, so we can't use this to
test the intended python3-compatibility of the blocking code.
2015-09-21 23:21:40 -07:00
Brian Warner
46f1fd2cd0 factor error classes into a common file 2015-09-21 23:21:26 -07:00
Brian Warner
d8ca850d1a blocking: finish alignment 2015-07-24 17:28:55 -07:00
Brian Warner
2ad65e13fe blocking: more alignment with twisted/transcribe.py 2015-07-24 17:22:02 -07:00
Brian Warner
2e44181e6d blocking: introduce _post_message()/_post_json() 2015-07-24 17:16:33 -07:00
Brian Warner
5951015f79 rearrange twisted+blocking to look roughly the same 2015-07-24 17:02:32 -07:00
Brian Warner
77b80495c9 improve typechecking, nacl.utils.EncryptedMessage is not a bytestring
but it derives from one
2015-07-24 16:45:20 -07:00
Brian Warner
5e1690cad8 rearrange slightly 2015-07-24 16:26:01 -07:00
Brian Warner
e5fcc6a8c8 rename some methods to make them more private 2015-07-24 16:18:03 -07:00
Brian Warner
effbd27047 minor rearrangement 2015-07-24 16:00:13 -07:00
Brian Warner
cfe51f73c1 replace base asserts with UsageError 2015-07-24 15:55:42 -07:00
Brian Warner
056cf107fc replace blocking Initiator/Receiver with just symmetric Wormhole
first pass, seems to work
2015-07-17 17:23:07 -07:00
Brian Warner
bc54a0bbca move blocking/eventsource out to a separate file 2015-07-17 16:55:29 -07:00
Brian Warner
790ae9a0dc change channel-allocation web API (incompatibly)
This will make it easier to manage channel allocation later, when we
switch to a database.
2015-04-10 22:03:08 -05:00
Brian Warner
5e593509b4 allow pre-generated (human-offline-created) codes
Just make up a code like NUMBER-STUFF, and add --code= to the
send-text/send-file command. Also don't use tab-completion on the
codewords part of the receiving side, unless you stuck to the even/odd
PGP wordlist. (tab still works for the channel-id).
2015-04-09 22:50:07 -05:00
Brian Warner
ecc04ff675 display message-of-the-day, if the server offers one 2015-04-09 12:45:12 -07:00
Brian Warner
5ff59c92e0 display current-version-is-different even when erroring out 2015-04-09 12:35:07 -07:00
Brian Warner
e881d169a6 error out if server gives a "sorry we're closed" error 2015-04-09 12:29:26 -07:00
Brian Warner
6da9f3ec3a warn (to stderr) if the client version differs from the server's
This is a proxy for the other client's version, and encourages both
sides to upgrade to the current version each time the server is
upgraded (which will be once per release).
2015-04-09 11:46:23 -07:00
Brian Warner
782214813b server+client: fix SSE alternate-event-type handling
I think the server needs to put blank lines after *every* field, not
just the data: fields.
2015-04-09 11:37:50 -07:00
Brian Warner
106991fe0d require caller to provide transit relay too 2015-03-25 13:07:17 -07:00
Brian Warner
fae14ebe6a Add --verify (display/check key-verifier). Not entirely usable yet.
To be useful, both sides must add -v. If the sender uses -v but the
receiver doesn't, the receiver won't show the verification string, so
the sender can't compare it to anything (and must either abort the
transfer or accept it blindly). Maybe the receiver should show the
verification string unconditionally. Maybe the sender should
indicate (in unprotected plaintext, along with the PAKE message) whether
the receiver should show it or not.
2015-03-24 00:28:02 -07:00
Brian Warner
ed1809d521 change API to support upcoming --verify flag 2015-03-24 00:03:10 -07:00
Brian Warner
af1e3c51ec add --code-length, to configure the size of the PAKE code (in bytes/words) 2015-03-23 23:53:28 -07:00
Brian Warner
7c5cb058a2 require caller to provide relay, no more default
Applications should feel free to pass wormhole.const.RENDEZVOUS_RELAY
here, but I figure it should be clear that you're using a public service
that's hosted *somewhere* external.
2015-03-22 11:53:48 -07:00
Brian Warner
fd3e4f3508 change relay URL scheme, allow arbitrary relay-phase messages 2015-03-22 11:45:16 -07:00
Brian Warner
cc37d2dc2f add CLI args to override the relay hosts (rendezvous and transit) 2015-03-20 17:45:03 -07:00
Brian Warner
12414fd8be code-completer: re-fetch channelids upon TAB, if necessary
This fixes the situation where you start the receiver first, then start
the sender, then you hit TAB on the receiver.

This somewhat improves the situation where you start the receiver first,
hit TAB (getting nothing), then start the sender, then hit TAB on the
receiver again. The second TAB will list the channel-ids, but won't
insert the only one as it's supposed to. You must type something (which
you can erase) and then hit TAB again to get a unique channel-id
inserted. But at least you can tell which one to type.

The first TAB runs the completer with readline.get_completion_type()
equal to 9=TAB=try-to-insert. The second (and subsequent) TABs use
63=?=list-matches, and it won't go back to 9 until you type something.
2015-03-13 01:50:21 -07:00
Brian Warner
315d7c5614 make rendezvous happen in real-time: replace polling with EventSource 2015-03-12 23:07:47 -07:00
Brian Warner
a8b6cad827 transcribe: refactor in anticipation of EventSource client 2015-03-12 23:03:57 -07:00
Brian Warner
fcf3b080f9 transit: don't complain about the relay connection failing or being dropped 2015-03-12 18:38:42 -07:00
Brian Warner
fcd2678dfd transit: provide encrypted record-pipe, use it for file-xfer 2015-03-12 18:14:42 -07:00
Brian Warner
cedd04a2fb transit.py: add debug prints, disabled 2015-03-12 16:03:00 -07:00
Brian Warner
35630661a5 increase establish_connection() timeout to let relay work
If all the direct hints resulted in timeouts (e.g. they were to bad IP
addresses where connections just hang), the relay connection would fail.
The establish_connection() function had the same TIMEOUT as the
direct-hint connector, so it would give up just before the relay
connection was initiated.
2015-03-12 15:52:11 -07:00
Brian Warner
b5ff8a5d4a format inbound-hint better 2015-03-12 15:24:34 -07:00
Brian Warner
b27cbd19b6 change hint format to "tcp:HOST:PORT" 2015-03-12 15:20:06 -07:00
Brian Warner
d71c8492c1 transit: describe the connection 2015-03-12 14:50:40 -07:00
Brian Warner
5682ddff8e fix transit relay
stop using web setup for now
2015-03-02 00:09:17 -08:00