]> git.rkrishnan.org Git - tahoe-lafs/tahoe-lafs.git/blob - docs/configuration.rst
docs: convert all .txt docs to .rst thanks to Ravi Pinjala
[tahoe-lafs/tahoe-lafs.git] / docs / configuration.rst
1 ========================
2 Configuring a Tahoe node
3 ========================
4
5 1.  `Overall Node Configuration`_
6 2.  `Client Configuration`_
7 3.  `Storage Server Configuration`_
8 4.  `Running A Helper`_
9 5.  `Running An Introducer`_
10 6.  `Other Files in BASEDIR`_
11 7.  `Other files`_
12 8.  `Backwards Compatibility Files`_
13 9.  `Example`_
14
15 A Tahoe node is configured by writing to files in its base directory. These
16 files are read by the node when it starts, so each time you change them, you
17 need to restart the node.
18
19 The node also writes state to its base directory, so it will create files on
20 its own.
21
22 This document contains a complete list of the config files that are examined
23 by the client node, as well as the state files that you'll observe in its
24 base directory.
25
26 The main file is named 'tahoe.cfg', which is an ".INI"-style configuration
27 file (parsed by the Python stdlib 'ConfigParser' module: "[name]" section
28 markers, lines with "key.subkey: value", rfc822-style continuations). There
29 are other files that contain information which does not easily fit into this
30 format. The 'tahoe create-node' or 'tahoe create-client' command will create
31 an initial tahoe.cfg file for you. After creation, the node will never modify
32 the 'tahoe.cfg' file: all persistent state is put in other files.
33
34 The item descriptions below use the following types:
35
36 boolean
37     one of (True, yes, on, 1, False, off, no, 0), case-insensitive
38
39 strports string
40     a Twisted listening-port specification string, like "tcp:80"
41     or "tcp:3456:interface=127.0.0.1". For a full description of
42     the format, see
43     http://twistedmatrix.com/documents/current/api/twisted.application.strports.html
44
45 FURL string
46     a Foolscap endpoint identifier, like
47     pb://soklj4y7eok5c3xkmjeqpw@192.168.69.247:44801/eqpwqtzm
48
49
50 Overall Node Configuration
51 ==========================
52
53 This section controls the network behavior of the node overall: which ports
54 and IP addresses are used, when connections are timed out, etc. This
55 configuration is independent of the services that the node is offering: the
56 same controls are used for client and introducer nodes.
57
58 If your node is behind a firewall or NAT device and you want other clients to
59 connect to it, you'll need to open a port in the firewall or NAT, and specify
60 that port number in the tub.port option. If behind a NAT, you *may* need to
61 set the tub.location option described below.
62
63 ::
64
65   [node]
66
67   nickname = (UTF-8 string, optional)
68
69     This value will be displayed in management tools as this node's "nickname".
70     If not provided, the nickname will be set to "<unspecified>". This string
71     shall be a UTF-8 encoded unicode string.
72
73   web.port = (strports string, optional)
74
75     This controls where the node's webserver should listen, providing filesystem
76     access and node status as defined in webapi.txt . This file contains a
77     Twisted "strports" specification such as "3456" or
78     "tcp:3456:interface=127.0.0.1". The 'tahoe create-node' or 'tahoe create-client'
79     commands set the web.port to "tcp:3456:interface=127.0.0.1" by default; this
80     is overridable by the "--webport" option. You can make it use SSL by writing
81     "ssl:3456:privateKey=mykey.pem:certKey=cert.pem" instead.
82    
83     If this is not provided, the node will not run a web server.
84
85   web.static = (string, optional)
86
87     This controls where the /static portion of the URL space is served. The
88     value is a directory name (~username is allowed, and non-absolute names are
89     interpreted relative to the node's basedir) which can contain HTML and other
90     files. This can be used to serve a javascript-based frontend to the Tahoe
91     node, or other services.
92    
93     The default value is "public_html", which will serve $BASEDIR/public_html .
94     With the default settings, http://127.0.0.1:3456/static/foo.html will serve
95     the contents of $BASEDIR/public_html/foo.html .
96
97   tub.port = (integer, optional)
98
99     This controls which port the node uses to accept Foolscap connections from
100     other nodes. If not provided, the node will ask the kernel for any available
101     port. The port will be written to a separate file (named client.port or
102     introducer.port), so that subsequent runs will re-use the same port.
103
104   tub.location = (string, optional)
105
106     In addition to running as a client, each Tahoe node also runs as a server,
107     listening for connections from other Tahoe clients. The node announces its
108     location by publishing a "FURL" (a string with some connection hints) to the
109     Introducer. The string it publishes can be found in
110     $BASEDIR/private/storage.furl . The "tub.location" configuration controls
111     what location is published in this announcement.
112    
113     If you don't provide tub.location, the node will try to figure out a useful
114     one by itself, by using tools like 'ifconfig' to determine the set of IP
115     addresses on which it can be reached from nodes both near and far. It will
116     also include the TCP port number on which it is listening (either the one
117     specified by tub.port, or whichever port was assigned by the kernel when
118     tub.port is left unspecified).
119    
120     You might want to override this value if your node lives behind a firewall
121     that is doing inbound port forwarding, or if you are using other proxies
122     such that the local IP address or port number is not the same one that
123     remote clients should use to connect. You might also want to control this
124     when using a Tor proxy to avoid revealing your actual IP address through the
125     Introducer announcement.
126    
127     The value is a comma-separated string of host:port location hints, like
128     this:
129
130       123.45.67.89:8098,tahoe.example.com:8098,127.0.0.1:8098
131
132     A few examples:
133
134       Emulate default behavior, assuming your host has IP address 123.45.67.89
135       and the kernel-allocated port number was 8098:
136     
137         tub.port = 8098
138         tub.location = 123.45.67.89:8098,127.0.0.1:8098
139     
140       Use a DNS name so you can change the IP address more easily:
141     
142         tub.port = 8098
143         tub.location = tahoe.example.com:8098
144     
145       Run a node behind a firewall (which has an external IP address) that has
146       been configured to forward port 7912 to our internal node's port 8098:
147     
148         tub.port = 8098
149         tub.location = external-firewall.example.com:7912
150     
151       Run a node behind a Tor proxy (perhaps via torsocks), in client-only mode
152       (i.e. we can make outbound connections, but other nodes will not be able to
153       connect to us). The literal 'unreachable.example.org' will not resolve, but
154       will serve as a reminder to human observers that this node cannot be
155       reached. "Don't call us.. we'll call you":
156     
157         tub.port = 8098
158         tub.location = unreachable.example.org:0
159     
160       Run a node behind a Tor proxy, and make the server available as a Tor
161       "hidden service". (this assumes that other clients are running their node
162       with torsocks, such that they are prepared to connect to a .onion address).
163       The hidden service must first be configured in Tor, by giving it a local
164       port number and then obtaining a .onion name, using something in the torrc
165       file like:
166     
167         HiddenServiceDir /var/lib/tor/hidden_services/tahoe
168         HiddenServicePort 29212 127.0.0.1:8098
169     
170       once Tor is restarted, the .onion hostname will be in
171       /var/lib/tor/hidden_services/tahoe/hostname . Then set up your tahoe.cfg
172       like:
173     
174         tub.port = 8098
175         tub.location = ualhejtq2p7ohfbb.onion:29212
176    
177     Most users will not need to set tub.location .
178    
179     Note that the old 'advertised_ip_addresses' file from earlier releases is no
180     longer supported. Tahoe 1.3.0 and later will ignore this file.
181
182   log_gatherer.furl = (FURL, optional)
183
184     If provided, this contains a single FURL string which is used to contact a
185     'log gatherer', which will be granted access to the logport. This can be
186     used by centralized storage meshes to gather operational logs in a single
187     place. Note that when an old-style BASEDIR/log_gatherer.furl file exists
188     (see 'Backwards Compatibility Files', below), both are used. (for most other
189     items, the separate config file overrides the entry in tahoe.cfg)
190
191   timeout.keepalive = (integer in seconds, optional)
192   timeout.disconnect = (integer in seconds, optional)
193
194     If timeout.keepalive is provided, it is treated as an integral number of
195     seconds, and sets the Foolscap "keepalive timer" to that value. For each
196     connection to another node, if nothing has been heard for a while, we will
197     attempt to provoke the other end into saying something. The duration of
198     silence that passes before sending the PING will be between KT and 2*KT.
199     This is mainly intended to keep NAT boxes from expiring idle TCP sessions,
200     but also gives TCP's long-duration keepalive/disconnect timers some traffic
201     to work with. The default value is 240 (i.e. 4 minutes).
202    
203     If timeout.disconnect is provided, this is treated as an integral number of
204     seconds, and sets the Foolscap "disconnect timer" to that value. For each
205     connection to another node, if nothing has been heard for a while, we will
206     drop the connection. The duration of silence that passes before dropping the
207     connection will be between DT-2*KT and 2*DT+2*KT (please see ticket #521 for
208     more details). If we are sending a large amount of data to the other end
209     (which takes more than DT-2*KT to deliver), we might incorrectly drop the
210     connection. The default behavior (when this value is not provided) is to
211     disable the disconnect timer.
212    
213     See ticket #521 for a discussion of how to pick these timeout values. Using
214     30 minutes means we'll disconnect after 22 to 68 minutes of inactivity.
215     Receiving data will reset this timeout, however if we have more than 22min
216     of data in the outbound queue (such as 800kB in two pipelined segments of 10
217     shares each) and the far end has no need to contact us, our ping might be
218     delayed, so we may disconnect them by accident.
219
220   ssh.port = (strports string, optional)
221   ssh.authorized_keys_file = (filename, optional)
222
223     This enables an SSH-based interactive Python shell, which can be used to
224     inspect the internal state of the node, for debugging. To cause the node to
225     accept SSH connections on port 8022 from the same keys as the rest of your
226     account, use:
227    
228       [tub]
229       ssh.port = 8022
230       ssh.authorized_keys_file = ~/.ssh/authorized_keys
231
232   tempdir = (string, optional)
233
234     This specifies a temporary directory for the webapi server to use, for
235     holding large files while they are being uploaded. If a webapi client
236     attempts to upload a 10GB file, this tempdir will need to have at least 10GB
237     available for the upload to complete.
238    
239     The default value is the "tmp" directory in the node's base directory (i.e.
240     $NODEDIR/tmp), but it can be placed elsewhere. This directory is used for
241     files that usually (on a unix system) go into /tmp . The string will be
242     interpreted relative to the node's base directory.
243
244 Client Configuration
245 ====================
246
247 ::
248
249   [client]
250   introducer.furl = (FURL string, mandatory)
251   
252     This FURL tells the client how to connect to the introducer. Each Tahoe grid
253     is defined by an introducer. The introducer's furl is created by the
254     introducer node and written into its base directory when it starts,
255     whereupon it should be published to everyone who wishes to attach a client
256     to that grid
257   
258   helper.furl = (FURL string, optional)
259   
260     If provided, the node will attempt to connect to and use the given helper
261     for uploads. See docs/helper.txt for details.
262   
263   key_generator.furl = (FURL string, optional)
264   
265     If provided, the node will attempt to connect to and use the given
266     key-generator service, using RSA keys from the external process rather than
267     generating its own.
268   
269   stats_gatherer.furl = (FURL string, optional)
270   
271     If provided, the node will connect to the given stats gatherer and provide
272     it with operational statistics.
273   
274   shares.needed = (int, optional) aka "k", default 3
275   shares.total = (int, optional) aka "N", N >= k, default 10
276   shares.happy = (int, optional) 1 <= happy <= N, default 7
277   
278     These three values set the default encoding parameters. Each time a new file
279     is uploaded, erasure-coding is used to break the ciphertext into separate
280     pieces. There will be "N" (i.e. shares.total) pieces created, and the file
281     will be recoverable if any "k" (i.e. shares.needed) pieces are retrieved.
282     The default values are 3-of-10 (i.e. shares.needed = 3, shares.total = 10).
283     Setting k to 1 is equivalent to simple replication (uploading N copies of
284     the file).
285   
286     These values control the tradeoff between storage overhead, performance, and
287     reliability. To a first approximation, a 1MB file will use (1MB*N/k) of
288     backend storage space (the actual value will be a bit more, because of other
289     forms of overhead). Up to N-k shares can be lost before the file becomes
290     unrecoverable, so assuming there are at least N servers, up to N-k servers
291     can be offline without losing the file. So large N/k ratios are more
292     reliable, and small N/k ratios use less disk space. Clearly, k must never be
293     smaller than N.
294    
295     Large values of N will slow down upload operations slightly, since more
296     servers must be involved, and will slightly increase storage overhead due to
297     the hash trees that are created. Large values of k will cause downloads to
298     be marginally slower, because more servers must be involved. N cannot be
299     larger than 256, because of the 8-bit erasure-coding algorithm that Tahoe
300     uses.
301    
302     shares.happy allows you control over the distribution of your immutable file.
303     For a successful upload, shares are guaranteed to be initially placed on
304     at least 'shares.happy' distinct servers, the correct functioning of any
305     k of which is sufficient to guarantee the availability of the uploaded file.
306     This value should not be larger than the number of servers on your grid.
307    
308     A value of shares.happy <= k is allowed, but does not provide any redundancy
309     if some servers fail or lose shares.
310    
311     (Mutable files use a different share placement algorithm that does not 
312     consider this parameter.)
313
314
315 Storage Server Configuration
316 ============================
317
318 ::
319
320   [storage]
321   enabled = (boolean, optional)
322   
323     If this is True, the node will run a storage server, offering space to other
324     clients. If it is False, the node will not run a storage server, meaning
325     that no shares will be stored on this node. Use False this for clients who
326     do not wish to provide storage service. The default value is True.
327   
328   readonly = (boolean, optional)
329   
330     If True, the node will run a storage server but will not accept any shares,
331     making it effectively read-only. Use this for storage servers which are
332     being decommissioned: the storage/ directory could be mounted read-only,
333     while shares are moved to other servers. Note that this currently only
334     affects immutable shares. Mutable shares (used for directories) will be
335     written and modified anyway. See ticket #390 for the current status of this
336     bug. The default value is False.
337   
338   reserved_space = (str, optional)
339   
340     If provided, this value defines how much disk space is reserved: the storage
341     server will not accept any share which causes the amount of free disk space
342     to drop below this value. (The free space is measured by a call to statvfs(2)
343     on Unix, or GetDiskFreeSpaceEx on Windows, and is the space available to the
344     user account under which the storage server runs.)
345    
346     This string contains a number, with an optional case-insensitive scale
347     suffix like "K" or "M" or "G", and an optional "B" or "iB" suffix. So
348     "100MB", "100M", "100000000B", "100000000", and "100000kb" all mean the same
349     thing. Likewise, "1MiB", "1024KiB", and "1048576B" all mean the same thing.
350   
351   expire.enabled =
352   expire.mode =
353   expire.override_lease_duration =
354   expire.cutoff_date =
355   expire.immutable =
356   expire.mutable =
357   
358     These settings control garbage-collection, in which the server will delete
359     shares that no longer have an up-to-date lease on them. Please see the
360     neighboring "garbage-collection.txt" document for full details.
361
362
363 Running A Helper
364 ================
365
366 A "helper" is a regular client node that also offers the "upload helper"
367 service.
368
369 ::
370
371   [helper]
372   enabled = (boolean, optional)
373   
374     If True, the node will run a helper (see docs/helper.txt for details). The
375     helper's contact FURL will be placed in private/helper.furl, from which it
376     can be copied to any clients which wish to use it. Clearly nodes should not
377     both run a helper and attempt to use one: do not create both helper.furl and
378     run_helper in the same node. The default is False.
379
380
381 Running An Introducer
382 =====================
383
384 The introducer node uses a different '.tac' file (named introducer.tac), and
385 pays attention to the "[node]" section, but not the others.
386
387 The Introducer node maintains some different state than regular client
388 nodes.
389
390 BASEDIR/introducer.furl : This is generated the first time the introducer
391 node is started, and used again on subsequent runs, to give the introduction
392 service a persistent long-term identity. This file should be published and
393 copied into new client nodes before they are started for the first time.
394
395
396 Other Files in BASEDIR
397 ======================
398
399 Some configuration is not kept in tahoe.cfg, for the following reasons:
400
401 * it is generated by the node at startup, e.g. encryption keys. The node
402   never writes to tahoe.cfg
403 * it is generated by user action, e.g. the 'tahoe create-alias' command
404
405 In addition, non-configuration persistent state is kept in the node's base
406 directory, next to the configuration knobs.
407
408 This section describes these other files.
409
410 private/node.pem
411   This contains an SSL private-key certificate. The node
412   generates this the first time it is started, and re-uses it on subsequent
413   runs. This certificate allows the node to have a cryptographically-strong
414   identifier (the Foolscap "TubID"), and to establish secure connections to
415   other nodes.
416
417 storage/
418   Nodes which host StorageServers will create this directory to hold
419   shares of files on behalf of other clients. There will be a directory
420   underneath it for each StorageIndex for which this node is holding shares.
421   There is also an "incoming" directory where partially-completed shares are
422   held while they are being received.
423
424 client.tac
425   this file defines the client, by constructing the actual Client
426   instance each time the node is started. It is used by the 'twistd'
427   daemonization program (in the "-y" mode), which is run internally by the
428   "tahoe start" command. This file is created by the "tahoe create-node" or
429   "tahoe create-client" commands.
430
431 private/control.furl
432   this file contains a FURL that provides access to a
433   control port on the client node, from which files can be uploaded and
434   downloaded. This file is created with permissions that prevent anyone else
435   from reading it (on operating systems that support such a concept), to insure
436   that only the owner of the client node can use this feature. This port is
437   intended for debugging and testing use.
438
439 private/logport.furl
440   this file contains a FURL that provides access to a
441   'log port' on the client node, from which operational logs can be retrieved.
442   Do not grant logport access to strangers, because occasionally secret
443   information may be placed in the logs.
444
445 private/helper.furl
446   if the node is running a helper (for use by other
447   clients), its contact FURL will be placed here. See docs/helper.txt for more
448   details.
449
450 private/root_dir.cap (optional)
451   The command-line tools will read a directory
452   cap out of this file and use it, if you don't specify a '--dir-cap' option or
453   if you specify '--dir-cap=root'.
454
455 private/convergence (automatically generated)
456   An added secret for encrypting
457   immutable files. Everyone who has this same string in their
458   private/convergence file encrypts their immutable files in the same way when
459   uploading them. This causes identical files to "converge" -- to share the
460   same storage space since they have identical ciphertext -- which conserves
461   space and optimizes upload time, but it also exposes files to the possibility
462   of a brute-force attack by people who know that string. In this attack, if
463   the attacker can guess most of the contents of a file, then they can use
464   brute-force to learn the remaining contents.
465
466 So the set of people who know your private/convergence string is the set of
467 people who converge their storage space with you when you and they upload
468 identical immutable files, and it is also the set of people who could mount
469 such an attack.
470
471 The content of the private/convergence file is a base-32 encoded string. If
472 the file doesn't exist, then when the Tahoe client starts up it will generate
473 a random 256-bit string and write the base-32 encoding of this string into
474 the file. If you want to converge your immutable files with as many people as
475 possible, put the empty string (so that private/convergence is a zero-length
476 file).
477
478 Other files
479 ===========
480
481 logs/
482   Each Tahoe node creates a directory to hold the log messages produced
483   as the node runs. These logfiles are created and rotated by the "twistd"
484   daemonization program, so logs/twistd.log will contain the most recent
485   messages, logs/twistd.log.1 will contain the previous ones, logs/twistd.log.2
486   will be older still, and so on. twistd rotates logfiles after they grow
487   beyond 1MB in size. If the space consumed by logfiles becomes troublesome,
488   they should be pruned: a cron job to delete all files that were created more
489   than a month ago in this logs/ directory should be sufficient.
490
491 my_nodeid
492   this is written by all nodes after startup, and contains a
493   base32-encoded (i.e. human-readable) NodeID that identifies this specific
494   node. This NodeID is the same string that gets displayed on the web page (in
495   the "which peers am I connected to" list), and the shortened form (the first
496   characters) is recorded in various log messages.
497
498 Backwards Compatibility Files
499 =============================
500
501 Tahoe releases before 1.3.0 had no 'tahoe.cfg' file, and used distinct files
502 for each item listed below. For each configuration knob, if the distinct file
503 exists, it will take precedence over the corresponding item in tahoe.cfg.
504
505 ===========================  ===============================  =================
506 Config setting               File                             Comment
507 ===========================  ===============================  =================
508 [node]nickname               BASEDIR/nickname
509 [node]web.port               BASEDIR/webport
510 [node]tub.port               BASEDIR/client.port              (for Clients, not Introducers)
511 [node]tub.port               BASEDIR/introducer.port          (for Introducers, not Clients) (note that, unlike other keys, tahoe.cfg overrides this file)
512 [node]tub.location           BASEDIR/advertised_ip_addresses
513 [node]log_gatherer.furl      BASEDIR/log_gatherer.furl        (one per line)
514 [node]timeout.keepalive      BASEDIR/keepalive_timeout
515 [node]timeout.disconnect     BASEDIR/disconnect_timeout
516 [client]introducer.furl      BASEDIR/introducer.furl
517 [client]helper.furl          BASEDIR/helper.furl
518 [client]key_generator.furl   BASEDIR/key_generator.furl
519 [client]stats_gatherer.furl  BASEDIR/stats_gatherer.furl
520 [storage]enabled             BASEDIR/no_storage               (False if no_storage exists)
521 [storage]readonly            BASEDIR/readonly_storage         (True if readonly_storage exists)
522 [storage]sizelimit           BASEDIR/sizelimit
523 [storage]debug_discard       BASEDIR/debug_discard_storage
524 [helper]enabled              BASEDIR/run_helper               (True if run_helper exists)
525 ===========================  ===============================  =================
526
527 Note: the functionality of [node]ssh.port and [node]ssh.authorized_keys_file
528 were previously combined, controlled by the presence of a
529 BASEDIR/authorized_keys.SSHPORT file, in which the suffix of the filename
530 indicated which port the ssh server should listen on, and the contents of the
531 file provided the ssh public keys to accept. Support for these files has been
532 removed completely. To ssh into your Tahoe node, add [node]ssh.port and
533 [node].ssh_authorized_keys_file statements to your tahoe.cfg.
534
535 Likewise, the functionality of [node]tub.location is a variant of the
536 now-unsupported BASEDIR/advertised_ip_addresses . The old file was additive
537 (the addresses specified in advertised_ip_addresses were used in addition to
538 any that were automatically discovered), whereas the new tahoe.cfg directive
539 is not (tub.location is used verbatim).
540
541
542 Example
543 =======
544
545 The following is a sample tahoe.cfg file, containing values for all keys
546 described above. Note that this is not a recommended configuration (most of
547 these are not the default values), merely a legal one.
548
549 ::
550
551   [node]
552   nickname = Bob's Tahoe Node
553   tub.port = 34912
554   tub.location = 123.45.67.89:8098,44.55.66.77:8098
555   web.port = 3456
556   log_gatherer.furl = pb://soklj4y7eok5c3xkmjeqpw@192.168.69.247:44801/eqpwqtzm
557   timeout.keepalive = 240
558   timeout.disconnect = 1800
559   ssh.port = 8022
560   ssh.authorized_keys_file = ~/.ssh/authorized_keys
561   
562   [client]
563   introducer.furl = pb://ok45ssoklj4y7eok5c3xkmj@tahoe.example:44801/ii3uumo
564   helper.furl = pb://ggti5ssoklj4y7eok5c3xkmj@helper.tahoe.example:7054/kk8lhr
565   
566   [storage]
567   enabled = True
568   readonly_storage = True
569   sizelimit = 10000000000
570   
571   [helper]
572   run_helper = True