source: trunk/docs/nodekeys.rst

Last change on this file was 82579ce, checked in by Zooko Wilcox-O'Hearn <zooko@…>, at 2013-11-08T21:08:05Z

magic first line tells emacs to use utf8+bom

Add ".. -*- coding: utf-8-with-signature -*-" to the first line of each .rst
file. This tells emacs to treat the file contents as utf-8, and also to prepend
a so-called utf-8 "bom" marker at the beginning of the file. This patch also
prepends those markers to each of those files.

  • Property mode set to 100644
File size: 6.5 KB
Line 
1.. -*- coding: utf-8-with-signature -*-
2
3=======================
4Node Keys in Tahoe-LAFS
5=======================
6
7"Node Keys" are cryptographic signing/verifying keypairs used to
8identify Tahoe-LAFS nodes (client-only and client+server). The private
9signing key is stored in NODEDIR/private/node.privkey , and is used to
10sign the announcements that are distributed to all nodes by the
11Introducer. The public verifying key is used to identify the sending
12node from those other systems: it is displayed as a "Node ID" that looks
13like "v0-abc234xyz567..", which ends with a long base32-encoded string.
14
15These node keys were introduced in the 1.10 release (April 2013), as
16part of ticket #466. In previous releases, announcements were unsigned,
17and nodes were identified by their Foolscap "Tub ID" (a somewhat shorter
18base32 string, with no "v0-" prefix).
19
20Why Announcements Are Signed
21----------------------------
22
23All nodes (both client-only and client+server) publish announcements to
24the Introducer, which then relays them to all other nodes. These
25announcements contain information about the publishing node's nickname,
26how to reach the node, what services it offers, and what version of code
27it is running.
28
29The new private node key is used to sign these announcements, preventing
30the Introducer from modifying their contents en-route. This will enable
31future versions of Tahoe-LAFS to use other forms of introduction
32(gossip, multiple introducers) without weakening the security model.
33
34The Node ID is useful as a handle with which to talk about a node. For
35example, when clients eventually gain the ability to control which
36storage servers they are willing to use (#467), the configuration file
37might simply include a list of Node IDs for the approved servers.
38
39TubIDs are currently also suitable for this job, but they depend upon
40having a Foolscap connection to the server. Since our goal is to move
41away from Foolscap towards a simpler (faster and more portable)
42protocol, we want to reduce our dependence upon TubIDs. Node IDs and
43Ed25519 signatures can be used for non-Foolscap non-SSL based protocols.
44
45How The Node ID Is Computed
46---------------------------
47
48The long-form Node ID is the Ed25519 public verifying key, 256 bits (32
49bytes) long, base32-encoded, with a "v0-" prefix appended, and the
50trailing "=" padding removed, like so:
51
52  v0-rlj3jnxqv4ee5rtpyngvzbhmhuikjfenjve7j5mzmfcxytwmyf6q
53
54The Node ID is displayed in this long form on the node's front Welcome
55page, and on the Introducer's status page. In most other places
56(share-placement lists, file health displays), the "short form" is used
57instead. This is simply the first 8 characters of the base32 portion,
58frequently enclosed in square brackets, like this:
59
60  [rlj3jnxq]
61
62In contrast, old-style TubIDs are usually displayed with just 6 base32
63characters.
64
65Version Compatibility, Fallbacks For Old Versions
66-------------------------------------------------
67
68Since Tahoe-LAFS 1.9 does not know about signed announcements, 1.10
69includes backwards-compatibility code to allow old and new versions to
70interoperate. There are three relevant participants: the node publishing
71an announcement, the Introducer which relays them, and the node
72receiving the (possibly signed) announcement.
73
74When a 1.10 node connects to an old Introducer (version 1.9 or earlier),
75it sends downgraded non-signed announcements. It likewise accepts
76non-signed announcements from the Introducer. The non-signed
77announcements use TubIDs to identify the sending node. The new 1.10
78Introducer, when it connects to an old node, downgrades any signed
79announcements to non-signed ones before delivery.
80
81As a result, the only way to receive signed announcements is for all
82three systems to be running the new 1.10 code. In a grid with a mixture
83of old and new nodes, if the Introducer is old, then all nodes will see
84unsigned TubIDs. If the Introducer is new, then nodes will see signed
85Node IDs whenever possible.
86
87Share Placement
88---------------
89
90Tahoe-LAFS uses a "permuted ring" algorithm to decide where to place
91shares for any given file. For each potential server, it uses that
92server's "permutation seed" to compute a pseudo-random but deterministic
93location on a ring, then walks the ring in clockwise order, asking each
94server in turn to hold a share until all are placed. When downloading a
95file, the servers are accessed in the same order. This minimizes the
96number of queries that must be done to download a file, and tolerates
97"churn" (nodes being added and removed from the grid) fairly well.
98
99This property depends upon server nodes having a stable permutation
100seed. If a server's permutation seed were to change, it would
101effectively wind up at a randomly selected place on the permuted ring.
102Downloads would still complete, but clients would spend more time asking
103other servers before querying the correct one.
104
105In the old 1.9 code, the permutation-seed was always equal to the TubID.
106In 1.10, servers include their permutation-seed as part of their
107announcement. To improve stability for existing grids, if an old server
108(one with existing shares) is upgraded to run the 1.10 codebase, it will
109use its old TubID as its permutation-seed. When a new empty server runs
110the 1.10 code, it will use its Node ID instead. In both cases, once the
111node has picked a permutation-seed, it will continue using that value
112forever.
113
114To be specific, when a node wakes up running the 1.10 code, it will look
115for a recorded NODEDIR/permutation-seed file, and use its contents if
116present. If that file does not exist, it creates it (with the TubID if
117it has any shares, otherwise with the Node ID), and uses the contents as
118the permutation-seed.
119
120There is one unfortunate consequence of this pattern. If new 1.10 server
121is created in a grid that has an old client, or has a new client but an
122old Introducer, then that client will see downgraded non-signed
123announcements, and thus will first upload shares with the TubID-based
124permutation-seed. Later, when the client and/or Introducer is upgraded,
125the client will start seeing signed announcements with the NodeID-based
126permutation-seed, and will then look for shares in the wrong place. This
127will hurt performance in a large grid, but should not affect
128reliability. This effect shouldn't even be noticeable in grids for which
129the number of servers is close to the "N" shares.total number (e.g.
130where num-servers < 3*N). And the as-yet-unimplemented "share
131rebalancing" feature should repair the misplacement.
132
133If you wish to avoid this effect, try to upgrade both Introducers and
134clients at about the same time. (Upgrading servers does not matter: they
135will continue to use the old permutation-seed).
Note: See TracBrowser for help on using the repository browser.