The Tin Hat
Tahoe-LAFS Tutorial (Part 2) | Running Tahoe-LAFS on I2P

Tahoe-LAFS Tutorial (Part 2) | Running Tahoe-LAFS on I2P

Category: cloud
A 4 Minute Read

Modified Image By Jason Baker




In part one of this three-part series, we learned what Tahoe-LAFS is and how it works. In this article, part two, we will go over the steps necessary to set up Tahoe-LAFS such that we can back up our files anonymously to a free storage grid hosted on I2P. The final part of the series, which will be published next week, will go a step further, describing how to set up a Tahoe-LAFS server on I2P to contribute to the network!

Before we begin, I should note that I ran into some problems getting Tahoe-LAFS running on I2P using Debian Jessie. As a result, this tutorial was researched and tested using a fresh installation of Ubuntu Mate 16.04, running in a VirtualBox VM, which worked flawlessly.

Prep Work

The first thing that you’ll need to do, if you haven’t already, is install I2p. To do this, check out my tutorial that describes every step you need to get it up and running. Afterwards, report back here.

If you do already have I2P installed, then open your browser and head over to 127.0.0.1:7657/configclients. This will bring you to the Clients page, where you will need to find the SAM application bridge, click the Start button, check off the box to automatically start it when I2P starts, and finally, save the configuration. The SAM application bridge is what Tahoe-LAFS interfaces with in order to connect to the I2P network.

Installing Tahoe-LAFS

With I2P and SAM up and running, it’s time to install some dependencies. Open a terminal and enter the following command:

sudo apt-get install build-essential python-dev libffi-dev libssl-dev python-virtualenv python-pip

We’re using pip rather than our distro’s package manager because we need a special version of Tahoe-LAFS that supports I2P. But first, we need to make sure pip and a few packages are upgraded before we can install Tahoe:


pip install --upgrade pip
pip install --upgrade --user cryptography pyopenssl

Finally, we can install Tahoe-LAFS. Because this will download python code from the internet and execute it, we don’t want to do it using sudo (root). Instead, we will use the --user flag (you could use a virtual environment, but this route is easier):


pip install --user tahoe-lafs[i2p]

Configuration

With Tahoe-LAFS installed, we can begin configuring our client. Issuing the following command will create a folder called .tahoe with everything we need to begin:


tahoe create-client

Time to edit the configuration file. Open it up by typing nano ~/.tahoe/tahoe.cfg. We’re going to need to edit a few lines of this file. Each edit is listed below.


nickname = [INSERT A NICKNAME FOR YOUR NODE HERE]
reveal-IP-address = false
introducer.furl = pb://exupps5kk3amc5iq4q6f5ahggkm4s5fl@i2p:oj7cffq5fnk46iw3i3h2sdgncxrqbxm7wh6i4h2cbpmqsydygkcq.b32.i2p/introducer

We’re also going to add the following lines to the bottom that tell Tahoe-LAFS to use I2P:


[i2p]
enabled = true
sam.port =
[connections]
tcp = disabled

This is enough to get going with Tahoe-LAFS, but this configuration only uses one introducer. If that introducer were to go offline, we wouldn’t be able to connect to the grid. Therefore, we’re going to add another file that will tell Tahoe-LAFS where it can find additional introducers. Once again, we will resort to nano: nano ~/.tahoe/private/introducers.yaml. Next, just add the following text, save, and quit:


introducers:
  str4d:
    furl: pb://exupps5kk3amc5iq4q6f5ahggkm4s5fl@i2p:oj7cffq5fnk46iw3i3h2sdgncxrqbxm7wh6i4h2cbpmqsydygkcq.b32.i2p/introducer
  zoidberg:
    furl: pb://cys5w43lvx3oi5lbgk6liet6rbguekuo@i2p:sagljtwlctcoktizkmyv3nyjsuygty6tpkn5riwxlruh3f2oze2q.b32.i2p/introducer
  lazygravy:
    furl: pb://5geuzjy6ixwz6nt2awnpcz5yf2xjqqbq@i2p:mmvnzrrj4l5d3iokrsmip5ibkbam7mrcqstjnjrjtpadkh3vbeqq.b32.i2p/twtijyid5sr5cz6punnc3nq6cc6qvzyl

Using Tahoe-LAFS

With all the pieces in place, we’re ready to begin using Tahoe-LAFS. To start the program simply type tahoe start into your terminal.

Next, go back to your browser and open the Tahoe-LAFS web interface at 127.0.0.1:3456. This page tells you, among other things, all the introducers and storage nodes that are online and available, as well as how much storage they have to offer. At first, there might not be any nodes available. If this is the case, simply wait for a few minutes to allow Tahoe-LAFS to find them.

Once you have at least ten storage nodes listed as online (the more the better), go ahead and create what is known as an alias by typing: tahoe create-alias tahoe.

An alias is essentially the root of your file system; every file and folder you transfer to the grid will be stored in that alias (root), which in our case we have called tahoe.

To move your first file over to the grid, you will use standard Linux commands preceded by the command tahoe. For example, tahoe cp myfile.txt tahoe:myfile.txt. To clarify, the second tahoe in that command (the tahoe:myfile.txt) refers to the alias we just created. You can also use tahoe ls tahoe: to list your files, and tahoe rm tahoe:myfile.txt to delete your file.

Depending on the file size, you may quickly realize that this process is slow. The reason for this is that Tahoe-LAFS, by default, will upload that file to at least seven different servers, if not ten. This, combined with the slow speeds of I2P, will make you rethink trying to upload movies to the grid. Indeed, this works best for small files. If you want faster speed, you can either set up, or buy into a grid on the clearnet, but this will mean you won’t get the anonymity that I2P provides, nor will you get its free storage space.

To make Tahoe-LAFS run a bit faster, it helps to make sure that your I2P client is well integrated into the network by contributing a moderate level of bandwidth in the settings at 127.0.0.1:7657/config. Moreover, you can reduce the number of hops and increase the number of tunnels in the SAM application bridge’s tunnel settings by going to 127.0.0.1:7657/configtunnels. Fewer hops translates to faster speeds with lower levels of anonymity, while more tunnels result in higher bandwidth but increased CPU load.

Maintenance

As described in part 1, eventually servers will go offline, and those that remain will begin to clean out old data. Because of this, we need to make sure that we do some active maintenance on our files on a regular basis.

Fortunately, we can do almost everything with a single command:

tahoe deep-check --repair --add-lease tahoe:

This command will check every file and folder in the tahoe alias to make sure that there are enough shares, will repair them if there are too few shares, and will add 31 days of lease duration to every remaining share.

To run this every Sunday at midnight automatically, we’re going to use crontab -e, and add the following line:

0 0 *  * 0 tahoe deep-check --repair --add-lease tahoe:

For now, that’s enough to get started. Definitely play around with it a bit before relying on it in any way. In part 3, we’ll be setting up our own Tahoe-LAFS storage node on I2P.

Share, Follow & Comment