aboutsummaryrefslogtreecommitdiff
path: root/doc/tips/peer_to_peer_network_with_tor.mdwn
diff options
context:
space:
mode:
authorGravatar Joey Hess <joeyh@joeyh.name>2016-12-18 16:50:58 -0400
committerGravatar Joey Hess <joeyh@joeyh.name>2016-12-18 16:51:41 -0400
commit09e3fc83f8e9a006cea239fabcff81692e938ddc (patch)
treec53b9058560e1c77c5888020233f294a5103e3b1 /doc/tips/peer_to_peer_network_with_tor.mdwn
parent32e2008eef8ed2cfbfc6e70db9b18bcff1d5fdf1 (diff)
p2p --pair with magic wormhole (untested)
It builds. I have not tried to run it yet. :) This commit was sponsored by Jake Vosloo on Patreon.
Diffstat (limited to 'doc/tips/peer_to_peer_network_with_tor.mdwn')
-rw-r--r--doc/tips/peer_to_peer_network_with_tor.mdwn95
1 files changed, 48 insertions, 47 deletions
diff --git a/doc/tips/peer_to_peer_network_with_tor.mdwn b/doc/tips/peer_to_peer_network_with_tor.mdwn
index 9c97735e4..b6aafa534 100644
--- a/doc/tips/peer_to_peer_network_with_tor.mdwn
+++ b/doc/tips/peer_to_peer_network_with_tor.mdwn
@@ -1,69 +1,56 @@
git-annex has recently gotten support for running as a
[Tor](https://torproject.org/) hidden service. This is a nice secure
-and easy to use way to connect repositories between peers in different
-locations, without needing any central server.
+and easy to use way to connect repositories in different
+locations. No account on a central server is needed; it's peer-to-peer.
-## setting up the first peer
+## dependencies
-First, you need to get Tor installed and running. See
+To use this, you need to get Tor installed and running. See
[their website](https://torproject.org/), or try a command like:
sudo apt-get install tor
-To make git-annex use Tor, run these commands in your git-annex repository:
+You also need to install [Magic Wormhole](https://github.com/warner/magic-wormhole).
- sudo git annex enable-tor $(id -u)
- git annex remotedaemon
- git annex p2p --gen-addresses
-
-The p2p command will output a long address, such as:
-
- tor-annex::eeaytkuhaupbarfi.onion:4412:7f53c5b65b8957ef626fd461ceaae8056e3dbc459ae715e4
+ sudo apt-get install magic-wormhole
-At this point, git-annex is running as a tor hidden service, but
-it will only talk to peers who know that address.
+## pairing two repositories
-## adding additional peers
-
-To add a peer, get tor installed and running on it.
-
- sudo apt-get install tor
+You have two git-annex repositories on different computers, and want to
+connect them together over Tor so they share their contents. Or, you and a
+friend want to connect your repositories together. Pairing is an easy way
+to accomplish this.
-You need a git-annex repository on the new peer. It's fine to start
-with a new empty repository:
-
- git init annex
- cd annex
- git annex init
-
-And make git-annex use Tor, by running these commands in the git-annex
-repository:
+In each git-annex repository, run these commands:
sudo git annex enable-tor $(id -u)
git annex remotedaemon
-Now, tell the new peer about the address of the first peer.
-This will make a git remote named "peer1", which connects,
-through Tor, to the repository on the other peer.
+Now git-annex is running as a Tor hidden service, but
+it will only talk to peers after pairing with them.
+
+In both repositories, run this command:
- git annex p2p --link --name peer1
+ git annex p2p --pair
-That command will prompt for an address; paste in the address that was
-generated on the first peer, and then press Enter.
+This will print out a code phrase, like "11-incredible-tumeric",
+and prompt for you to enter the other repository's code phrase.
-Now you can run any commands you normally would to sync with the
-peer1 remote:
+Once the code phrases are exchanged, the two repositories will be securely
+connected to one-another via Tor. Each will have a git remote, with a name
+like "peer1", which connects to the other repository.
- git annex sync --content peer1
+Then, you can run commands like `git annex sync peer1 --content` to sync
+with the paired repository.
-You can also generate an address for this new peer, by running `git annex
-p2p --gen-addresses`, and link other peers to that address using `git annex
-p2p --link`. It's often useful to link peers up in both directions,
-so peer1 is a remote of peer2 and peer2 is a remote of peer1.
+The Magic Wormhole code phrases used during pairing will no longer be
+useful for anything afterwards.
-Any number of peers can be connected this way, within reason.
+Pairing connects just two repositories, but you can repeat the process to
+pair with as many other repositories as you like, in order to build up
+larger networks of repositories.
-## starting git-annex remotedaemon
+## starting git-annex remotedaemon on boot
Notice the `git annex remotedaemon` being run in the above examples.
That command runs the Tor hidden service so that other peers
@@ -72,7 +59,7 @@ can connect to your repository over Tor.
So, you may want to arrange for the remotedaemon to be started on boot.
You can do that with a simple cron job:
- @reboot cd myannexrepo && git annex remotedaemon
+ @reboot cd ~/myannexrepo && git annex remotedaemon
If you use the git-annex assistant, and have it auto-starting on boot, it
will take care of starting the remotedaemon for you.
@@ -84,9 +71,9 @@ bandwidth to go around. So, distributing large quantities (gigabytes)
of data over Tor may be slow, and should probably be avoided.
One way to avoid sending much data over tor is to set up an encrypted
-[[special_remote|special_remotes]]. git-annex knows that Tor is rather
-expensive to use, so if a file is available on a special remote as well as
-over Tor, it will download it from the special remote.
+[[special_remote|special_remotes]] someplace. git-annex knows that Tor is
+rather expensive to use, so if a file is available on a special remote as
+well as over Tor, it will download it from the special remote.
You can contribute to the Tor network by
[running a Tor relay or bridge](https://www.torproject.org/getinvolved/relays.html.en).
@@ -115,6 +102,9 @@ When you run `git annex peer --link`, it sets up a git remote using
the onion address, and it stashes the authentication data away in a file in
`.git/annex/creds/`
+When you pair repositories, these addresses are exchanged using
+[Magic Wormhole](https://github.com/warner/magic-wormhole).
+
## security
Tor hidden services can be quite secure. But this doesn't mean that using
@@ -144,3 +134,14 @@ to consider:
* An attacker who can connect to the git-annex Tor hidden service, even
without authenticating, can try to perform denial of service attacks.
+
+* Magic wormhole is pretty secure, but the code phrase could be guessed
+ (unlikely) or intercepted. An attacker gets just one chance to try to enter
+ the correct code phrase, before pairing finishes. If the attacker
+ successfully guesses/intercepts both code phrases, they can MITM the
+ pairing process.
+
+ If you don't want to use magic wormhole, you can instead manually generate
+ addresses with `git annex p2p --gen-addresses` and send them over an
+ authenticated, encrypted channel (such as OTR) to a friend to add with
+ `git annex p2p --link`. This may be more secure, if you get it right.