Repository navigation
Two changes: a listener now makes every connection's proof single-use, and
-home says where BitBang keeps its files. 0.5.3 command lines keep working,
and 0.5.3 and 0.5.4 connect to each other in either direction.
Every connection's proof is good for that connection only
When you open a device, the browser (or bitbang connect) proves it has the
access code by encrypting it to the device's key, with the connection's DTLS
fingerprint. Nothing in that proof came from the device, so one captured proof
could be replayed for a later connection -- it was as good as the code.
A listener now sends a fresh 16-byte challenge with every offer and accepts a
proof only if it names that challenge, once, with a fingerprint that matches
the answer. bitbang connect answers the challenge when the offer has one.
Proofs in the older form are still accepted, and logged as replayable, so an
installed 0.5.3 connect keeps working. A later
release will require the challenge.
-home: one directory, chosen deliberately
-home <dir> and BITBANG_HOME set the directory BitBang keeps its own files
in: the identity keypair, the link table, the device table connect and cp
read, and share state. The flag is on every command. First match wins:
| Set | Directory used |
|---|---|
-home <dir> |
exactly that |
$BITBANG_HOME |
exactly that |
$STATE_DIRECTORY |
exactly that -- systemd sets it from StateDirectory= |
$XDG_STATE_HOME |
$XDG_STATE_HOME/bitbang |
$HOME |
$HOME/.bitbang |
| none of them | an error |
A listener prints the directory once at startup:
Home: /home/you/.bitbang
Home: /var/lib/bitbang (STATE_DIRECTORY)
This fixes a quiet fallback: started without HOME, as an init script may be,
0.5.3 wrote its private key under the directory it started in -- /.bitbang
on @lars18th's OpenWRT listener. 0.5.4 refuses instead and says what to pass.
If a listener of yours has its identity there, start it with
-home /.bitbang (or move the directory) to keep the same device URL.
Closes #41.
gorilla/websocket
The WebSocket library is now at d67f418, past its latest tag, v1.5.3, which
made each frame's mask key from a weak random generator (GO-2026-6278).
BitBang's WebSocket connections are over TLS or to a local target, where the
mask key protects nothing, so this is housekeeping rather than a fix you need.