Commit graph

314 commits

Author SHA1 Message Date
Joey Hess
4e48f5e6d6 fixed the multicast socket fd leak
Turns out sClose was working fine.. but it was not being run on every
opened socket. The upstream bug is that multicastSender can crash
on an invalid (or ipv6) address and when this happens it's already
opened a socket, which just goes missing with no way to close it.
A simple fix to the library can avoid this, as I describe here:
https://github.com/audreyt/network-multicast/issues/2

In the meantime, just skipping ipv6 addresses will fix the fd leak.
2012-09-12 01:18:52 -04:00
Richard Hartmann
af657b10fd Remove trailing whitespace 2012-09-11 16:17:26 -04:00
Joey Hess
4d592aaec2 fixed all pairing alert issues 2012-09-11 16:11:28 -04:00
Joey Hess
ade511f6e3 keep webapp snappy by generating ssh keypair in the background 2012-09-11 15:51:27 -04:00
Joey Hess
99d52f26bc fix combining of pairing alerts 2012-09-11 15:43:33 -04:00
Joey Hess
2c1ceeeaf9 pairing works!!
Finally.

Last bug fixes here: Send PairResp with same UUID in the PairReq.
Fix off-by-one in code that filters out our own pairing messages.

Also reworked the pairing alerts, which are still slightly buggy.
2012-09-11 15:09:00 -04:00
Joey Hess
aace44454a keep track of the stage we're at in pairing
This avoids us responding to our own pairing messages, as well
as ignoring any out of order messages that might be received somehow.
2012-09-11 12:58:00 -04:00
Joey Hess
16d27e9c02 work around a bug in Yesod
The PathPiece instance for Text results in a 404 for T.empty.
2012-09-11 12:26:42 -04:00
Joey Hess
084dc188c7 additional security sanity checks on pairing messages 2012-09-11 11:48:50 -04:00
Joey Hess
0208d6aa82 add a UUID to pair requests
Pair requests the the same UUID are part of the same pairing session,
which allows us to detect attempts to brute force the shared secret,
as that will result in pair requests with the same UUID that are
not verified with the right secret.
2012-09-11 03:16:00 -04:00
Joey Hess
9ace0afdfe handle stale PairAcks 2012-09-11 01:00:42 -04:00
Joey Hess
675621d903 clean up authorized_keys handling
Including rollback of adding the key when a pairing response
gets canceled by the user.
2012-09-11 00:23:34 -04:00
Joey Hess
d19bbd29d8 pairing probably works now (untested) 2012-09-10 21:55:59 -04:00
Joey Hess
a41255723c check that ssh public key received over the wire is sane 2012-09-10 18:18:55 -04:00
Joey Hess
c20d6f4189 responding to pair requests *almost* works 2012-09-10 17:53:51 -04:00
Joey Hess
b573d91aa2 broke out fairly generic ssh stuff to Assistant.Ssh so pairing can use it too
I'd rather Utility.Ssh, but the SshData type is not sufficiently clean and
generic for Utility.
2012-09-10 15:21:34 -04:00
Joey Hess
34a0e09d4b split up ssh key generation and setup steps 2012-09-10 14:55:15 -04:00
Joey Hess
16cefae7f2 add an alert while a locally initiated pairing request is in progress
Has a button to cancel the request.
2012-09-09 16:24:34 -04:00
Joey Hess
ded8517545 pair request alert tweaks 2012-09-09 15:16:17 -04:00
Joey Hess
690b424cad unify bootstrap icon names in a data type 2012-09-09 15:09:22 -04:00
Joey Hess
1e41c0d85e update pair request alert when button is pressed 2012-09-09 01:02:44 -04:00
Joey Hess
f62cc48482 reorg templates 2012-09-08 23:32:08 -04:00
Joey Hess
6e60b08060 moved the PairStage inside the Verifiable data 2012-09-08 21:06:10 -04:00
Joey Hess
1ab3ce352b add a PairDone message 2012-09-08 20:44:54 -04:00
Joey Hess
7c70c89ee7 render webapp staitc file url using yesod 2012-09-08 20:04:44 -04:00
Joey Hess
e59b0a1c88 first pass at alert buttons
They work fine. But I had to go to a lot of trouble to get Yesod to render
routes in a pure function. It may instead make more sense to have each
alert have an assocated IO action, and a single route that runs the IO
action of a given alert id. I just wish I'd realized that before the past
several hours of struggling with something Yesod really doesn't want to
allow.
2012-09-08 19:57:15 -04:00
Joey Hess
317ab14da2 add remote directory to pair request 2012-09-08 15:40:47 -04:00
Joey Hess
5401b9f249 filter out our own pairing requests
Due to being multicast, requests sent by one thread are received by the
listener in another thread.
2012-09-08 15:30:04 -04:00
Joey Hess
61ee1e1660 fix build without pairing support 2012-09-08 15:21:34 -04:00
Joey Hess
0f0c7f8d70 added pair listener thread 2012-09-08 15:07:44 -04:00
Joey Hess
3e070b947a don't pass .local hostname over the wire
The remote computer may not support mDNS. Instead, pass over the uname -a
hostname, and the IP address, and leave best hostname calculation to the
remote side.
2012-09-08 14:23:35 -04:00
Joey Hess
92b1f42730 fix fd leak
also, tested on ipv6.. doesn't work
2012-09-08 13:34:50 -04:00
Joey Hess
3dd4b4058f implement pair request broadcasts
Pair requests are sent on all network interfaces, and contain the best
available hostname to use to contact the host on that interface.

Added a pairing in progress page.

Revert "reduce some boilerplate using ghc extensions", because it caused
overlapping instances for Text.
2012-09-08 13:04:19 -04:00
Joey Hess
0c01348b65 pairing passphrase entry form, validation, etc
Actually 3 forms in one, this handles the initial passphrase entry, and the
confirmation, and also varys wording if the same user or a different user
is confirming.
2012-09-08 02:02:39 -04:00
Joey Hess
3bee6b3c74 yesod skelton and routes for pairing
yet more changes to pairing message data types
2012-09-08 00:27:27 -04:00
Joey Hess
92df8250fa broke out Verifiable to a utility library, and added a quickcheck test 2012-09-07 23:23:52 -04:00
Joey Hess
c12caf0a4e massively simplified the pairing protocol
Only 2 messages are needed to do pairing.

And added a nice Verifiable data type.
2012-09-07 22:58:14 -04:00
Joey Hess
c28b54c469 high-level pairing implementation
Roughed out a data type that models the whole pairing conversation,
and can be serialized to implement it. And a state machine to run
that conversation. Not yet hooked up to any transport such as multicast
UDP.
2012-09-07 18:04:06 -04:00
Joey Hess
a00f1d26bc display errors when any named thread crashes 2012-09-06 14:56:04 -04:00
Joey Hess
d11ded822c display alert for inotify/kqueue errors 2012-09-06 13:56:23 -04:00
Joey Hess
8a796cfa64 improve syncing support for special remotes
Avoid trying to git push/pull to special remotes, but still do transfer
scans of them, after git pull from any other remotes, so we know about
any values that have been placed on them.
2012-09-04 15:56:37 -04:00
Joey Hess
46fd6b54c7 rsync.net configurator tested and 100% working 2012-09-04 15:27:06 -04:00
Joey Hess
b584d96c13 rsync.net configurator display
Doesn't set up the repo yet.
2012-09-03 00:39:55 -04:00
Joey Hess
b6a91d7a4d defer setting up ssh public key until after confirmation 2012-09-02 20:43:32 -04:00
Joey Hess
014974a7da allow making encrypted rsync special remotes
wow, that was easy!
2012-09-02 17:32:24 -04:00
Joey Hess
9f403113dd make bare repo on server
I think this makes sense.. Unless the assistant is running on the server,
the repo won't be updated, so it might as well be bare.

Non-bare repos will be handled by the pairing configurator, later.
2012-09-02 15:30:32 -04:00
Joey Hess
97ce4d24cb adding ssh remote working
Rsync remote still needs work
2012-09-02 15:27:00 -04:00
Joey Hess
6623a51cf9 run sync in background 2012-09-02 15:20:03 -04:00
Joey Hess
e6f61e5ab9 factored out repository creation code and made more generic
for use by other configurators.. probably should be moved to a utility
module somewhere
2012-09-02 15:06:27 -04:00
Joey Hess
93f29997a9 reduce some boilerplate using ghc extensions 2012-09-02 02:07:15 -04:00