source: trunk/docs/configuration.rst

Last change on this file was 411827a, checked in by Itamar Turner-Trauring <itamar@…>, at 2023-07-26T17:44:21Z

Update docs.

  • Property mode set to 100644
File size: 50.7 KB
Line 
1.. -*- coding: utf-8-with-signature -*-
2
3=============================
4Configuring a Tahoe-LAFS node
5=============================
6
7#.  `Node Types`_
8#.  `Overall Node Configuration`_
9#.  `Connection Management`_
10#.  `Client Configuration`_
11#.  `Storage Server Configuration`_
12#.  `Storage Server Plugin Configuration`_
13#.  `Frontend Configuration`_
14#.  `Running A Helper`_
15#.  `Running An Introducer`_
16#.  `Other Files in BASEDIR`_
17#. `Static Server Definitions`_
18#. `Other files`_
19#. `Example`_
20
21A Tahoe-LAFS node is configured by writing to files in its base directory.
22These files are read by the node when it starts, so each time you change
23them, you need to restart the node.
24
25The node also writes state to its base directory, so it will create files on
26its own.
27
28This document contains a complete list of the config files that are examined
29by the client node, as well as the state files that you'll observe in its
30base directory.
31
32The main file is named "``tahoe.cfg``", and is an "`.INI`_"-style configuration
33file (parsed by the Python stdlib `ConfigParser`_ module: "``[name]``" section
34markers, lines with "``key.subkey: value``", `RFC822-style`_
35continuations). There are also other files containing information that does
36not easily fit into this format. The "``tahoe create-node``" or "``tahoe
37create-client``" command will create an initial ``tahoe.cfg`` file for
38you. After creation, the node will never modify the ``tahoe.cfg`` file: all
39persistent state is put in other files.
40
41The item descriptions below use the following types:
42
43``boolean``
44
45    one of (True, yes, on, 1, False, off, no, 0), case-insensitive
46
47``strports string``
48
49    a Twisted listening-port specification string, like "``tcp:80``" or
50    "``tcp:3456:interface=127.0.0.1``". For a full description of the format,
51    see `the Twisted strports documentation`_.  Please note, if interface= is
52    not specified, Tahoe-LAFS will attempt to bind the port specified on all
53    interfaces.
54
55``endpoint specification string``
56
57    a Twisted Endpoint specification string, like "``tcp:80``" or
58    "``tcp:3456:interface=127.0.0.1``". These are replacing strports strings.
59    For a full description of the format, see `the Twisted Endpoints
60    documentation`_. Please note, if interface= is not specified, Tahoe-LAFS
61    will attempt to bind the port specified on all interfaces. Also note that
62    ``tub.port`` only works with TCP endpoints right now.
63
64``FURL string``
65
66    a Foolscap endpoint identifier, like
67    ``pb://soklj4y7eok5c3xkmjeqpw@192.168.69.247:44801/eqpwqtzm``
68
69.. _.INI: https://en.wikipedia.org/wiki/INI_file
70.. _ConfigParser: https://docs.python.org/2/library/configparser.html
71.. _RFC822-style: https://www.ietf.org/rfc/rfc0822
72.. _the Twisted strports documentation: https://twistedmatrix.com/documents/current/api/twisted.application.strports.html
73.. _the Twisted Endpoints documentation: http://twistedmatrix.com/documents/current/core/howto/endpoints.html#endpoint-types-included-with-twisted
74
75Node Types
76==========
77
78A node can be a client/server or an introducer.
79
80Client/server nodes provide one or more of the following services:
81
82* web-API service
83* SFTP service
84* helper service
85* storage service.
86
87A client/server that provides storage service (i.e. storing shares for
88clients) is called a "storage server". If it provides any of the other
89services, it is a "storage client" (a node can be both a storage server and a
90storage client). A client/server node that provides web-API service is called
91a "gateway".
92
93
94Overall Node Configuration
95==========================
96
97This section controls the network behavior of the node overall: which ports
98and IP addresses are used, when connections are timed out, etc. This
99configuration applies to all node types and is independent of the services
100that the node is offering.
101
102If your node is behind a firewall or NAT device and you want other clients to
103connect to it, you'll need to open a port in the firewall or NAT, and specify
104that port number in the tub.port option. If behind a NAT, you *may* need to
105set the ``tub.location`` option described below.
106
107``[node]``
108
109``nickname = (UTF-8 string, optional)``
110
111    This value will be displayed in management tools as this node's
112    "nickname". If not provided, the nickname will be set to "<unspecified>".
113    This string shall be a UTF-8 encoded Unicode string.
114
115``web.port = (strports string, optional)``
116
117    This controls where the node's web server should listen, providing node
118    status and, if the node is a client/server, providing web-API service as
119    defined in :doc:`frontends/webapi`.
120
121    This file contains a Twisted "strports" specification such as "``3456``"
122    or "``tcp:3456:interface=127.0.0.1``". The "``tahoe create-node``" or
123    "``tahoe create-client``" commands set the ``web.port`` to
124    "``tcp:3456:interface=127.0.0.1``" by default; this is overridable by the
125    ``--webport`` option. You can make it use SSL by writing
126    "``ssl:3456:privateKey=mykey.pem:certKey=cert.pem``" instead.
127
128    If this is not provided, the node will not run a web server.
129
130``web.static = (string, optional)``
131
132    This controls where the ``/static`` portion of the URL space is
133    served. The value is a directory name (``~username`` is allowed, and
134    non-absolute names are interpreted relative to the node's basedir), which
135    can contain HTML and other files. This can be used to serve a
136    Javascript-based frontend to the Tahoe-LAFS node, or other services.
137
138    The default value is "``public_html``", which will serve
139    ``BASEDIR/public_html`` .  With the default settings,
140    ``http://127.0.0.1:3456/static/foo.html`` will serve the contents of
141    ``BASEDIR/public_html/foo.html`` .
142
143``tub.port = (endpoint specification strings or "disabled", optional)``
144
145    This controls which port the node uses to accept Foolscap connections
146    from other nodes. It is parsed as a comma-separated list of Twisted
147    "server endpoint descriptor" strings, each of which is a value like
148    ``tcp:12345`` and ``tcp:23456:interface=127.0.0.1``.
149
150    To listen on multiple ports at once (e.g. both TCP-on-IPv4 and TCP-on-IPv6),
151    use something like ``tcp6:interface=2600\:3c01\:f03c\:91ff\:fe93\:d272:3456,tcp:interface=8.8.8.8:3456``.
152    Lists of endpoint descriptor strings like the following ``tcp:12345,tcp6:12345``
153    are known to not work because an ``Address already in use.`` error.
154
155    If any descriptor begins with ``listen:tor``, or ``listen:i2p``, the
156    corresponding tor/i2p Provider object will construct additional endpoints
157    for the Tub to listen on. This allows the ``[tor]`` or ``[i2p]`` sections
158    in ``tahoe.cfg`` to customize the endpoint; e.g. to add I2CP control
159    options. If you use ``listen:i2p``, you should not also have an
160    ``i2p:..`` endpoint in ``tub.port``, as that would result in multiple
161    I2P-based listeners.
162
163    If ``tub.port`` is the string ``disabled``, the node will not listen at
164    all, and thus cannot accept connections from other nodes. If ``[storage]
165    enabled = true``, or ``[helper] enabled = true``, or the node is an
166    Introducer, then it is an error to have ``tub.port`` be empty. If
167    ``tub.port`` is disabled, then ``tub.location`` must also be disabled,
168    and vice versa.
169
170    For backwards compatibility, if this contains a simple integer, it will
171    be used as a TCP port number, like ``tcp:%d`` (which will accept
172    connections on all interfaces). However ``tub.port`` cannot be ``0`` or
173    ``tcp:0`` (older versions accepted this, but the node is no longer
174    willing to ask Twisted to allocate port numbers in this way). If
175    ``tub.port`` is present, it may not be empty.
176
177    If the ``tub.port`` config key is not provided (e.g. ``tub.port`` appears
178    nowhere in the ``[node]`` section, or is commented out), the node will
179    look in ``BASEDIR/client.port`` (or ``BASEDIR/introducer.port``, for
180    introducers) for the descriptor that was used last time.
181
182    If neither ``tub.port`` nor the port file is available, the node will ask
183    the kernel to allocate any available port (the moral equivalent of
184    ``tcp:0``). The allocated port number will be written into a descriptor
185    string in ``BASEDIR/client.port`` (or ``introducer.port``), so that
186    subsequent runs will re-use the same port.
187
188``tub.location = (hint string or "disabled", optional)``
189
190    In addition to running as a client, each Tahoe-LAFS node can also run as
191    a server, listening for connections from other Tahoe-LAFS clients. The
192    node announces its location by publishing a "FURL" (a string with some
193    connection hints) to the Introducer. The string it publishes can be found
194    in ``BASEDIR/private/storage.furl`` . The ``tub.location`` configuration
195    controls what location is published in this announcement.
196
197    If your node is meant to run as a server, you should fill this in, using
198    a hostname or IP address that is reachable from your intended clients.
199
200    If ``tub.port`` is set to ``disabled``, then ``tub.location`` must also
201    be ``disabled``.
202
203    If you don't provide ``tub.location``, the node will try to figure out a
204    useful one by itself, by using tools like "``ifconfig``" to determine the
205    set of IP addresses on which it can be reached from nodes both near and
206    far. It will also include the TCP port number on which it is listening
207    (either the one specified by ``tub.port``, or whichever port was assigned
208    by the kernel when ``tub.port`` is left unspecified). However this
209    automatic address-detection is discouraged, and will probably be removed
210    from a future release. It will include the ``127.0.0.1`` "localhost"
211    address (which is only useful to clients running on the same computer),
212    and RFC1918 private-network addresses like ``10.*.*.*`` and
213    ``192.168.*.*`` (which are only useful to clients on the local LAN). In
214    general, the automatically-detected IP addresses will only be useful if
215    the node has a public IP address, such as a VPS or colo-hosted server.
216
217    You will certainly need to set ``tub.location`` if your node lives behind
218    a firewall that is doing inbound port forwarding, or if you are using
219    other proxies such that the local IP address or port number is not the
220    same one that remote clients should use to connect. You might also want
221    to control this when using a Tor proxy to avoid revealing your actual IP
222    address through the Introducer announcement.
223
224    If ``tub.location`` is specified, by default it entirely replaces the
225    automatically determined set of IP addresses. To include the automatically
226    determined addresses as well as the specified ones, include the uppercase
227    string "``AUTO``" in the list.
228
229    The value is a comma-separated string of method:host:port location hints,
230    like this::
231
232      tcp:123.45.67.89:8098,tcp:tahoe.example.com:8098,tcp:127.0.0.1:8098
233
234    A few examples:
235
236    * Don't listen at all (client-only mode)::
237
238        tub.port = disabled
239        tub.location = disabled
240
241    * Use a DNS name so you can change the IP address more easily::
242
243        tub.port = tcp:8098
244        tub.location = tcp:tahoe.example.com:8098
245
246    * Run a node behind a firewall (which has an external IP address) that
247      has been configured to forward external port 7912 to our internal
248      node's port 8098::
249
250        tub.port = tcp:8098
251        tub.location = tcp:external-firewall.example.com:7912
252
253    * Emulate default behavior, assuming your host has public IP address of
254      123.45.67.89, and the kernel-allocated port number was 8098::
255
256        tub.port = tcp:8098
257        tub.location = tcp:123.45.67.89:8098,tcp:127.0.0.1:8098
258
259    * Use a DNS name but also include the default set of addresses::
260
261        tub.port = tcp:8098
262        tub.location = tcp:tahoe.example.com:8098,AUTO
263
264    * Run a node behind a Tor proxy (perhaps via ``torsocks``), in
265      client-only mode (i.e. we can make outbound connections, but other
266      nodes will not be able to connect to us). The literal
267      '``unreachable.example.org``' will not resolve, but will serve as a
268      reminder to human observers that this node cannot be reached. "Don't
269      call us.. we'll call you"::
270
271        tub.port = tcp:8098
272        tub.location = tcp:unreachable.example.org:0
273
274    * Run a node behind a Tor proxy, and make the server available as a Tor
275      "hidden service". (This assumes that other clients are running their
276      node with ``torsocks``, such that they are prepared to connect to a
277      ``.onion`` address.) The hidden service must first be configured in
278      Tor, by giving it a local port number and then obtaining a ``.onion``
279      name, using something in the ``torrc`` file like::
280
281        HiddenServiceDir /var/lib/tor/hidden_services/tahoe
282        HiddenServicePort 29212 127.0.0.1:8098
283
284      once Tor is restarted, the ``.onion`` hostname will be in
285      ``/var/lib/tor/hidden_services/tahoe/hostname``. Then set up your
286      ``tahoe.cfg`` like::
287
288        tub.port = tcp:8098
289        tub.location = tor:ualhejtq2p7ohfbb.onion:29212
290
291``log_gatherer.furl = (FURL, optional)``
292
293    If provided, this contains a single FURL string that is used to contact a
294    "log gatherer", which will be granted access to the logport. This can be
295    used to gather operational logs in a single place. Note that in previous
296    releases of Tahoe-LAFS, if an old-style ``BASEDIR/log_gatherer.furl``
297    file existed it would also be used in addition to this value, allowing
298    multiple log gatherers to be used at once. As of Tahoe-LAFS v1.9.0, an
299    old-style file is ignored and a warning will be emitted if one is
300    detected. This means that as of Tahoe-LAFS v1.9.0 you can have at most
301    one log gatherer per node. See ticket `#1423`_ about lifting this
302    restriction and letting you have multiple log gatherers.
303
304    .. _`#1423`: https://tahoe-lafs.org/trac/tahoe-lafs/ticket/1423
305
306``timeout.keepalive = (integer in seconds, optional)``
307
308``timeout.disconnect = (integer in seconds, optional)``
309
310    If ``timeout.keepalive`` is provided, it is treated as an integral number
311    of seconds, and sets the Foolscap "keepalive timer" to that value. For
312    each connection to another node, if nothing has been heard for a while,
313    we will attempt to provoke the other end into saying something. The
314    duration of silence that passes before sending the PING will be between
315    KT and 2*KT. This is mainly intended to keep NAT boxes from expiring idle
316    TCP sessions, but also gives TCP's long-duration keepalive/disconnect
317    timers some traffic to work with. The default value is 240 (i.e. 4
318    minutes).
319
320    If timeout.disconnect is provided, this is treated as an integral number
321    of seconds, and sets the Foolscap "disconnect timer" to that value. For
322    each connection to another node, if nothing has been heard for a while,
323    we will drop the connection. The duration of silence that passes before
324    dropping the connection will be between DT-2*KT and 2*DT+2*KT (please see
325    ticket `#521`_ for more details). If we are sending a large amount of
326    data to the other end (which takes more than DT-2*KT to deliver), we
327    might incorrectly drop the connection. The default behavior (when this
328    value is not provided) is to disable the disconnect timer.
329
330    See ticket `#521`_ for a discussion of how to pick these timeout values.
331    Using 30 minutes means we'll disconnect after 22 to 68 minutes of
332    inactivity. Receiving data will reset this timeout, however if we have
333    more than 22min of data in the outbound queue (such as 800kB in two
334    pipelined segments of 10 shares each) and the far end has no need to
335    contact us, our ping might be delayed, so we may disconnect them by
336    accident.
337
338    .. _`#521`: https://tahoe-lafs.org/trac/tahoe-lafs/ticket/521
339
340``tempdir = (string, optional)``
341
342    This specifies a temporary directory for the web-API server to use, for
343    holding large files while they are being uploaded. If a web-API client
344    attempts to upload a 10GB file, this tempdir will need to have at least
345    10GB available for the upload to complete.
346
347    The default value is the ``tmp`` directory in the node's base directory
348    (i.e. ``BASEDIR/tmp``), but it can be placed elsewhere. This directory is
349    used for files that usually (on a Unix system) go into ``/tmp``. The
350    string will be interpreted relative to the node's base directory.
351
352``reveal-IP-address = (boolean, optional, defaults to True)``
353
354    This is a safety flag. When set to False (aka "private mode"), the node
355    will refuse to start if any of the other configuration options would
356    reveal the node's IP address to servers or the external network. This
357    flag does not directly affect the node's behavior: its only power is to
358    veto node startup when something looks unsafe.
359
360    The default is True (non-private mode), because setting it to False
361    requires the installation of additional libraries (use ``pip install
362    tahoe-lafs[tor]`` and/or ``pip install tahoe-lafs[i2p]`` to get them) as
363    well as additional non-python software (Tor/I2P daemons). Performance is
364    also generally reduced when operating in private mode.
365
366    When False, any of the following configuration problems will cause
367    ``tahoe run`` to throw a PrivacyError instead of starting the node:
368
369    * ``[node] tub.location`` contains any ``tcp:`` hints
370
371    * ``[node] tub.location`` uses ``AUTO``, or is missing/empty (because
372      that defaults to AUTO)
373
374    * ``[connections] tcp =`` is set to ``tcp`` (or left as the default),
375      rather than being set to ``tor`` or ``disabled``
376
377
378.. _Connection Management:
379
380Connection Management
381=====================
382
383Three sections (``[tor]``, ``[i2p]``, and ``[connections]``) control how the
384Tahoe node makes outbound connections. Tor and I2P are configured here. This
385also controls when Tor and I2P are used: for all TCP connections (to hide
386your IP address), or only when necessary (just for servers which declare that
387they need Tor, because they use ``.onion`` addresses).
388
389Note that if you want to protect your node's IP address, you should set
390``[node] reveal-IP-address = False``, which will refuse to launch the node if
391any of the other configuration settings might violate this privacy property.
392
393``[connections]``
394-----------------
395
396This section controls *when* Tor and I2P are used. The ``[tor]`` and
397``[i2p]`` sections (described later) control *how* Tor/I2P connections are
398managed.
399
400All Tahoe nodes need to make a connection to the Introducer; the
401``private/introducers.yaml`` file (described below) configures where one or more
402Introducers live. Tahoe client nodes must also make connections to storage
403servers: these targets are specified in announcements that come from the
404Introducer.  Both are expressed as FURLs (a Foolscap URL), which include a
405list of "connection hints". Each connection hint describes one (of perhaps
406many) network endpoints where the service might live.
407
408Connection hints include a type, and look like:
409
410* ``tcp:tahoe.example.org:12345``
411* ``tor:u33m4y7klhz3b.onion:1000``
412* ``i2p:c2ng2pbrmxmlwpijn``
413
414``tor`` hints are always handled by the ``tor`` handler (configured in the
415``[tor]`` section, described below). Likewise, ``i2p`` hints are always
416routed to the ``i2p`` handler. But either will be ignored if Tahoe was not
417installed with the necessary Tor/I2P support libraries, or if the Tor/I2P
418daemon is unreachable.
419
420The ``[connections]`` section lets you control how ``tcp`` hints are handled.
421By default, they use the normal TCP handler, which just makes direct
422connections (revealing your node's IP address to both the target server and
423the intermediate network). The node behaves this way if the ``[connections]``
424section is missing entirely, or if it looks like this::
425
426  [connections]
427   tcp = tcp
428
429To hide the Tahoe node's IP address from the servers that it uses, set the
430``[connections]`` section to use Tor for TCP hints::
431
432  [connections]
433   tcp = tor
434
435You can also disable TCP hints entirely, which would be appropriate when
436running an I2P-only node::
437
438  [connections]
439   tcp = disabled
440
441(Note that I2P does not support connections to normal TCP ports, so
442``[connections] tcp = i2p`` is invalid)
443
444In the future, Tahoe services may be changed to live on HTTP/HTTPS URLs
445instead of Foolscap. In that case, connections will be made using whatever
446handler is configured for ``tcp`` hints. So the same ``tcp = tor``
447configuration will work.
448
449``[tor]``
450---------
451
452This controls how Tor connections are made. The defaults (all empty) mean
453that, when Tor is needed, the node will try to connect to a Tor daemon's
454SOCKS proxy on localhost port 9050 or 9150. Port 9050 is the default Tor
455SOCKS port, so it should be available under any system Tor instance (e.g. the
456one launched at boot time when the standard Debian ``tor`` package is
457installed). Port 9150 is the SOCKS port for the Tor Browser Bundle, so it
458will be available any time the TBB is running.
459
460You can set ``launch = True`` to cause the Tahoe node to launch a new Tor
461daemon when it starts up (and kill it at shutdown), if you don't have a
462system-wide instance available. Note that it takes 30-60 seconds for Tor to
463get running, so using a long-running Tor process may enable a faster startup.
464If your Tor executable doesn't live on ``$PATH``, use ``tor.executable=`` to
465specify it.
466
467``[tor]``
468
469``enabled = (boolean, optional, defaults to True)``
470
471    If False, this will disable the use of Tor entirely. The default of True
472    means the node will use Tor, if necessary, and if possible.
473
474``socks.port = (string, optional, endpoint specification string, defaults to empty)``
475
476    This tells the node that Tor connections should be routed to a SOCKS
477    proxy listening on the given endpoint. The default (of an empty value)
478    will cause the node to first try localhost port 9050, then if that fails,
479    try localhost port 9150. These are the default listening ports of the
480    standard Tor daemon, and the Tor Browser Bundle, respectively.
481
482    While this nominally accepts an arbitrary endpoint string, internal
483    limitations prevent it from accepting anything but ``tcp:HOST:PORT``
484    (unfortunately, unix-domain sockets are not yet supported). See ticket
485    #2813 for details. Also note that using a HOST of anything other than
486    localhost is discouraged, because you would be revealing your IP address
487    to external (and possibly hostile) machines.
488
489``control.port = (string, optional, endpoint specification string)``
490
491    This tells the node to connect to a pre-existing Tor daemon on the given
492    control port (which is typically ``unix://var/run/tor/control`` or
493    ``tcp:localhost:9051``). The node will then ask Tor what SOCKS port it is
494    using, and route Tor connections to that.
495
496``launch = (bool, optional, defaults to False)``
497
498    If True, the node will spawn a new (private) copy of Tor at startup, and
499    will kill it at shutdown. The new Tor will be given a persistent state
500    directory under ``NODEDIR/private/``, where Tor's microdescriptors will
501    be cached, to speed up subsequent startup.
502
503``tor.executable = (string, optional, defaults to empty)``
504
505    This controls which Tor executable is used when ``launch = True``. If
506    empty, the first executable program named ``tor`` found on ``$PATH`` will
507    be used.
508
509There are 5 valid combinations of these configuration settings:
510
511* 1: ``(empty)``: use SOCKS on port 9050/9150
512* 2: ``launch = true``: launch a new Tor
513* 3: ``socks.port = tcp:HOST:PORT``: use an existing Tor on the given SOCKS port
514* 4: ``control.port = ENDPOINT``: use an existing Tor at the given control port
515* 5: ``enabled = false``: no Tor at all
516
5171 is the default, and should work for any Linux host with the system Tor
518package installed. 2 should work on any box with Tor installed into $PATH,
519but will take an extra 30-60 seconds at startup. 3 and 4 can be used for
520specialized installations, where Tor is already running, but not listening on
521the default port. 5 should be used in environments where Tor is installed,
522but should not be used (perhaps due to a site-wide policy).
523
524Note that Tor support depends upon some additional Python libraries. To
525install Tahoe with Tor support, use ``pip install tahoe-lafs[tor]``.
526
527``[i2p]``
528---------
529
530This controls how I2P connections are made. Like with Tor, the all-empty
531defaults will cause I2P connections to be routed to a pre-existing I2P daemon
532on port 7656. This is the default SAM port for the ``i2p`` daemon.
533
534
535``[i2p]``
536
537``enabled = (boolean, optional, defaults to True)``
538
539    If False, this will disable the use of I2P entirely. The default of True
540    means the node will use I2P, if necessary, and if possible.
541
542``sam.port = (string, optional, endpoint descriptor, defaults to empty)``
543
544    This tells the node that I2P connections should be made via the SAM
545    protocol on the given port. The default (of an empty value) will cause
546    the node to try localhost port 7656. This is the default listening port
547    of the standard I2P daemon.
548
549``launch = (bool, optional, defaults to False)``
550
551    If True, the node will spawn a new (private) copy of I2P at startup, and
552    will kill it at shutdown. The new I2P will be given a persistent state
553    directory under ``NODEDIR/private/``, where I2P's microdescriptors will
554    be cached, to speed up subsequent startup. The daemon will allocate its
555    own SAM port, which will be queried from the config directory.
556
557``i2p.configdir = (string, optional, directory)``
558
559    This tells the node to parse an I2P config file in the given directory,
560    and use the SAM port it finds there. If ``launch = True``, the new I2P
561    daemon will be told to use the given directory (which can be
562    pre-populated with a suitable config file). If ``launch = False``, we
563    assume there is a pre-running I2P daemon running from this directory, and
564    can again parse the config file for the SAM port.
565
566``i2p.executable = (string, optional, defaults to empty)``
567
568    This controls which I2P executable is used when ``launch = True``. If
569    empty, the first executable program named ``i2p`` found on ``$PATH`` will
570    be used.
571
572
573.. _Client Configuration:
574
575Client Configuration
576====================
577
578``[client]``
579
580``introducer.furl = (FURL string, mandatory)``
581
582    DEPRECATED.  See :ref:`introducer-definitions`.
583
584    This FURL tells the client how to connect to the introducer. Each
585    Tahoe-LAFS grid is defined by an introducer. The introducer's FURL is
586    created by the introducer node and written into its private base
587    directory when it starts, whereupon it should be published to everyone
588    who wishes to attach a client to that grid
589
590``helper.furl = (FURL string, optional)``
591
592    If provided, the node will attempt to connect to and use the given helper
593    for uploads. See :doc:`helper` for details.
594
595``shares.needed = (int, optional) aka "k", default 3``
596
597``shares.total = (int, optional) aka "N", N >= k, default 10``
598
599``shares.happy = (int, optional) 1 <= happy <= N, default 7``
600
601    These three values set the default encoding parameters. Each time a new
602    file is uploaded, erasure-coding is used to break the ciphertext into
603    separate shares. There will be ``N`` (i.e. ``shares.total``) shares
604    created, and the file will be recoverable if any ``k``
605    (i.e. ``shares.needed``) shares are retrieved. The default values are
606    3-of-10 (i.e.  ``shares.needed = 3``, ``shares.total = 10``). Setting
607    ``k`` to 1 is equivalent to simple replication (uploading ``N`` copies of
608    the file).
609
610    These values control the tradeoff between storage overhead and
611    reliability. To a first approximation, a 1MB file will use (1MB *
612    ``N``/``k``) of backend storage space (the actual value will be a bit
613    more, because of other forms of overhead). Up to ``N``-``k`` shares can
614    be lost before the file becomes unrecoverable.  So large ``N``/``k``
615    ratios are more reliable, and small ``N``/``k`` ratios use less disk
616    space. ``N`` cannot be larger than 256, because of the 8-bit
617    erasure-coding algorithm that Tahoe-LAFS uses. ``k`` can not be greater
618    than ``N``. See :doc:`performance` for more details.
619
620    ``shares.happy`` allows you control over how well to "spread out" the
621    shares of an immutable file. For a successful upload, shares are
622    guaranteed to be initially placed on at least ``shares.happy`` distinct
623    servers, the correct functioning of any ``k`` of which is sufficient to
624    guarantee the availability of the uploaded file. This value should not be
625    larger than the number of servers on your grid.
626
627    A value of ``shares.happy`` <= ``k`` is allowed, but this is not
628    guaranteed to provide any redundancy if some servers fail or lose shares.
629    It may still provide redundancy in practice if ``N`` is greater than
630    the number of connected servers, because in that case there will typically
631    be more than one share on at least some storage nodes. However, since a
632    successful upload only guarantees that at least ``shares.happy`` shares
633    have been stored, the worst case is still that there is no redundancy.
634
635    (Mutable files use a different share placement algorithm that does not
636    currently consider this parameter.)
637
638``mutable.format = sdmf or mdmf``
639
640    This value tells Tahoe-LAFS what the default mutable file format should
641    be. If ``mutable.format=sdmf``, then newly created mutable files will be
642    in the old SDMF format. This is desirable for clients that operate on
643    grids where some peers run older versions of Tahoe-LAFS, as these older
644    versions cannot read the new MDMF mutable file format. If
645    ``mutable.format`` is ``mdmf``, then newly created mutable files will use
646    the new MDMF format, which supports efficient in-place modification and
647    streaming downloads. You can overwrite this value using a special
648    mutable-type parameter in the webapi. If you do not specify a value here,
649    Tahoe-LAFS will use SDMF for all newly-created mutable files.
650
651    Note that this parameter applies only to files, not to directories.
652    Mutable directories, which are stored in mutable files, are not
653    controlled by this parameter and will always use SDMF. We may revisit
654    this decision in future versions of Tahoe-LAFS.
655
656    See :doc:`specifications/mutable` for details about mutable file formats.
657
658``peers.preferred = (string, optional)``
659
660    This is an optional comma-separated list of Node IDs of servers that will
661    be tried first when selecting storage servers for reading or writing.
662
663    Servers should be identified here by their Node ID as it appears in the web
664    ui, underneath the server's nickname. For storage servers running tahoe
665    versions >=1.10 (if the introducer is also running tahoe >=1.10) this will
666    be a "Node Key" (which is prefixed with 'v0-'). For older nodes, it will be
667    a TubID instead. When a preferred server (and/or the introducer) is
668    upgraded to 1.10 or later, clients must adjust their configs accordingly.
669
670    Every node selected for upload, whether preferred or not, will still
671    receive the same number of shares (one, if there are ``N`` or more servers
672    accepting uploads). Preferred nodes are simply moved to the front of the
673    server selection lists computed for each file.
674
675    This is useful if a subset of your nodes have different availability or
676    connectivity characteristics than the rest of the grid. For instance, if
677    there are more than ``N`` servers on the grid, and ``K`` or more of them
678    are at a single physical location, it would make sense for clients at that
679    location to prefer their local servers so that they can maintain access to
680    all of their uploads without using the internet.
681
682``force_foolscap = (boolean, optional)``
683
684    If this is ``True``, the client will only connect to storage servers via
685    Foolscap, regardless of whether they support HTTPS. If this is ``False``,
686    the client will prefer HTTPS when it is available on the server. The default
687    value is ``False``.
688
689In addition,
690see :doc:`accepting-donations` for a convention for donating to storage server operators.
691
692Frontend Configuration
693======================
694
695The Tahoe-LAFS client process can run a variety of frontend file access
696protocols. You will use these to create and retrieve files from the
697Tahoe-LAFS file store. Configuration details for each are documented in
698the following protocol-specific guides:
699
700HTTP
701
702    Tahoe runs a webserver by default on port 3456. This interface provides a
703    human-oriented "WUI", with pages to create, modify, and browse
704    directories and files, as well as a number of pages to check on the
705    status of your Tahoe node. It also provides a machine-oriented "WAPI",
706    with a REST-ful HTTP interface that can be used by other programs
707    (including the CLI tools). Please see :doc:`frontends/webapi` for full
708    details, and the ``web.port`` and ``web.static`` config variables above.
709    :doc:`frontends/download-status` also describes a few WUI status pages.
710
711CLI
712
713    The main ``tahoe`` executable includes subcommands for manipulating the
714    file store, uploading/downloading files, and creating/running Tahoe
715    nodes. See :doc:`frontends/CLI` for details.
716
717SFTP
718
719    Tahoe can also run SFTP servers, and map a username/password
720    pair to a top-level Tahoe directory. See :doc:`frontends/FTP-and-SFTP`
721    for instructions on configuring this service, and the ``[sftpd]``
722    section of ``tahoe.cfg``.
723
724
725Storage Server Configuration
726============================
727
728``[storage]``
729
730``enabled = (boolean, optional)``
731
732    If this is ``True``, the node will run a storage server, offering space
733    to other clients. If it is ``False``, the node will not run a storage
734    server, meaning that no shares will be stored on this node. Use ``False``
735    for clients who do not wish to provide storage service. The default value
736    is ``True``.
737
738``anonymous = (boolean, optional)``
739
740    If this is ``True``, the node will expose the storage server via Foolscap
741    without any additional authentication or authorization.  The capability to
742    use all storage services is conferred by knowledge of the Foolscap fURL
743    for the storage server which will be included in the storage server's
744    announcement.  If it is ``False``, the node will not expose this and
745    storage must be exposed using the storage server plugin system (see
746    `Storage Server Plugin Configuration`_ for details).  The default value is
747    ``True``.
748
749``readonly = (boolean, optional)``
750
751    If ``True``, the node will run a storage server but will not accept any
752    shares, making it effectively read-only. Use this for storage servers
753    that are being decommissioned: the ``storage/`` directory could be
754    mounted read-only, while shares are moved to other servers. Note that
755    this currently only affects immutable shares. Mutable shares (used for
756    directories) will be written and modified anyway. See ticket `#390`_ for
757    the current status of this bug. The default value is ``False``.
758
759``reserved_space = (str, optional)``
760
761    If provided, this value defines how much disk space is reserved: the
762    storage server will not accept any share that causes the amount of free
763    disk space to drop below this value. (The free space is measured by a
764    call to ``statvfs(2)`` on Unix, or ``GetDiskFreeSpaceEx`` on Windows, and
765    is the space available to the user account under which the storage server
766    runs.)
767
768    This string contains a number, with an optional case-insensitive scale
769    suffix, optionally followed by "B" or "iB". The supported scale suffixes
770    are "K", "M", "G", "T", "P" and "E", and a following "i" indicates to use
771    powers of 1024 rather than 1000. So "100MB", "100 M", "100000000B",
772    "100000000", and "100000kb" all mean the same thing. Likewise, "1MiB",
773    "1024KiB", "1024 Ki", and "1048576 B" all mean the same thing.
774
775    "``tahoe create-node``" generates a tahoe.cfg with
776    "``reserved_space=1G``", but you may wish to raise, lower, or remove the
777    reservation to suit your needs.
778
779``expire.enabled =``
780
781``expire.mode =``
782
783``expire.override_lease_duration =``
784
785``expire.cutoff_date =``
786
787``expire.immutable =``
788
789``expire.mutable =``
790
791    These settings control garbage collection, in which the server will
792    delete shares that no longer have an up-to-date lease on them. Please see
793    :doc:`garbage-collection` for full details.
794
795.. _#390: https://tahoe-lafs.org/trac/tahoe-lafs/ticket/390
796
797``storage_dir = (string, optional)``
798
799    This specifies a directory where share files and other state pertaining to
800    storage servers will be kept.
801
802    The default value is the ``storage`` directory in the node's base directory
803    (i.e. ``BASEDIR/storage``), but it can be placed elsewhere. Relative paths
804    will be interpreted relative to the node's base directory.
805
806``force_foolscap = (boolean, optional)``
807
808    If this is ``True``, the node will expose the storage server via Foolscap
809    only, with no support for HTTPS. If this is ``False``, the server will
810    support both Foolscap and HTTPS on the same port. The default value is
811    ``False``.
812
813In addition,
814see :doc:`accepting-donations` for a convention encouraging donations to storage server operators.
815
816
817Storage Server Plugin Configuration
818===================================
819
820In addition to the built-in storage server,
821it is also possible to load and configure storage server plugins into Tahoe-LAFS.
822
823Plugins to load are specified in the ``[storage]`` section.
824
825``plugins = (string, optional)``
826
827    This gives a comma-separated list of plugin names.
828    Plugins named here will be loaded and offered to clients.
829    The default is for no such plugins to be loaded.
830
831Each plugin can also be configured in a dedicated section.
832The section for each plugin is named after the plugin itself::
833
834  [storageserver.plugins.<plugin name>]
835
836For example,
837the configuration section for a plugin named ``acme-foo-v1`` is ``[storageserver.plugins.acme-foo-v1]``.
838
839The contents of such sections are defined by the plugins themselves.
840Refer to the documentation provided with those plugins.
841
842
843Running A Helper
844================
845
846A "helper" is a regular client node that also offers the "upload helper"
847service.
848
849``[helper]``
850
851``enabled = (boolean, optional)``
852
853    If ``True``, the node will run a helper (see :doc:`helper` for details).
854    The helper's contact FURL will be placed in ``private/helper.furl``, from
855    which it can be copied to any clients that wish to use it. Clearly nodes
856    should not both run a helper and attempt to use one: do not create
857    ``helper.furl`` and also define ``[helper]enabled`` in the same node. The
858    default is ``False``.
859
860
861Running An Introducer
862=====================
863
864The introducer node uses a different ``.tac`` file (named
865"``introducer.tac``"), and pays attention to the ``[node]`` section, but not
866the others.
867
868The Introducer node maintains some different state than regular client nodes.
869
870``BASEDIR/private/introducer.furl``
871
872  This is generated the first time the introducer node is started, and used
873  again on subsequent runs, to give the introduction service a persistent
874  long-term identity. This file should be published and copied into new
875  client nodes before they are started for the first time.
876
877
878Other Files in BASEDIR
879======================
880
881Some configuration is not kept in ``tahoe.cfg``, for the following reasons:
882
883* it doesn't fit into the INI format of ``tahoe.cfg`` (e.g.
884  ``private/servers.yaml``)
885* it is generated by the node at startup, e.g. encryption keys. The node
886  never writes to ``tahoe.cfg``.
887* it is generated by user action, e.g. the "``tahoe create-alias``" command.
888
889In addition, non-configuration persistent state is kept in the node's base
890directory, next to the configuration knobs.
891
892This section describes these other files.
893
894``private/node.pem``
895
896  This contains an SSL private-key certificate. The node generates this the
897  first time it is started, and re-uses it on subsequent runs. This
898  certificate allows the node to have a cryptographically-strong identifier
899  (the Foolscap "TubID"), and to establish secure connections to other nodes.
900
901``storage/``
902
903  Nodes that host StorageServers will create this directory to hold shares of
904  files on behalf of other clients. There will be a directory underneath it
905  for each StorageIndex for which this node is holding shares. There is also
906  an "incoming" directory where partially-completed shares are held while
907  they are being received.  This location may be overridden in ``tahoe.cfg``.
908
909``tahoe-client.tac``
910
911  This file defines the client, by constructing the actual Client instance
912  each time the node is started. It is used by the "``twistd``" daemonization
913  program (in the ``-y`` mode), which is run internally by the "``tahoe
914  start``" command. This file is created by the "``tahoe create-node``" or
915  "``tahoe create-client``" commands.
916
917``tahoe-introducer.tac``
918
919  This file is used to construct an introducer, and is created by the
920  "``tahoe create-introducer``" command.
921
922``private/control.furl``
923
924  This file contains a FURL that provides access to a control port on the
925  client node, from which files can be uploaded and downloaded. This file is
926  created with permissions that prevent anyone else from reading it (on
927  operating systems that support such a concept), to insure that only the
928  owner of the client node can use this feature. This port is intended for
929  debugging and testing use.
930
931``private/logport.furl``
932
933  This file contains a FURL that provides access to a 'log port' on the
934  client node, from which operational logs can be retrieved. Do not grant
935  logport access to strangers, because occasionally secret information may be
936  placed in the logs.
937
938``private/helper.furl``
939
940  If the node is running a helper (for use by other clients), its contact
941  FURL will be placed here. See :doc:`helper` for more details.
942
943``private/root_dir.cap`` (optional)
944
945  The command-line tools will read a directory cap out of this file and use
946  it, if you don't specify a '--dir-cap' option or if you specify
947  '--dir-cap=root'.
948
949``private/convergence`` (automatically generated)
950
951  An added secret for encrypting immutable files. Everyone who has this same
952  string in their ``private/convergence`` file encrypts their immutable files
953  in the same way when uploading them. This causes identical files to
954  "converge" -- to share the same storage space since they have identical
955  ciphertext -- which conserves space and optimizes upload time, but it also
956  exposes file contents to the possibility of a brute-force attack by people
957  who know that string. In this attack, if the attacker can guess most of the
958  contents of a file, then they can use brute-force to learn the remaining
959  contents.
960
961  So the set of people who know your ``private/convergence`` string is the
962  set of people who converge their storage space with you when you and they
963  upload identical immutable files, and it is also the set of people who
964  could mount such an attack.
965
966  The content of the ``private/convergence`` file is a base-32 encoded
967  string.  If the file doesn't exist, then when the Tahoe-LAFS client starts
968  up it will generate a random 256-bit string and write the base-32 encoding
969  of this string into the file. If you want to converge your immutable files
970  with as many people as possible, put the empty string (so that
971  ``private/convergence`` is a zero-length file).
972
973.. _introducer-definitions:
974
975Introducer Definitions
976======================
977
978The ``private/introducers.yaml`` file defines Introducers.
979Choose a locally-unique "petname" for each one then define their FURLs in ``private/introducers.yaml`` like this::
980
981  introducers:
982    petname2:
983      furl: "FURL2"
984    petname3:
985      furl: "FURL3"
986
987Servers will announce themselves to all configured introducers. Clients will
988merge the announcements they receive from all introducers. Nothing will
989re-broadcast an announcement (i.e. telling introducer 2 about something you
990heard from introducer 1).
991
992If you omit the introducer definitions from ``introducers.yaml``,
993the node will not use an Introducer at all.
994Such "introducerless" clients must be configured with static servers (described
995below), or they will not be able to upload and download files.
996
997
998.. _server_list:
999
1000Static Server Definitions
1001=========================
1002
1003The ``private/servers.yaml`` file defines "static servers": those which are
1004not announced through the Introducer. This can also control how we connect to
1005those servers.
1006
1007Most clients do not need this file. It is only necessary if you want to use
1008servers which are (for some specialized reason) not announced through the
1009Introducer, or to connect to those servers in different ways. You might do
1010this to "freeze" the server list: use the Introducer for a while, then copy
1011all announcements into ``servers.yaml``, then stop using the Introducer
1012entirely. Or you might have a private server that you don't want other users
1013to learn about (via the Introducer). Or you might run a local server which is
1014announced to everyone else as a Tor onion address, but which you can connect
1015to directly (via TCP).
1016
1017The file syntax is `YAML`_, with a top-level dictionary named ``storage``.
1018Other items may be added in the future.
1019
1020The ``storage`` dictionary takes keys which are server-ids, and values which
1021are dictionaries with two keys: ``ann`` and ``connections``. The ``ann``
1022value is a dictionary which will be used in lieu of the introducer
1023announcement, so it can be populated by copying the ``ann`` dictionary from
1024``NODEDIR/introducer_cache.yaml``.
1025
1026The server-id can be any string, but ideally you should use the public key as
1027published by the server. Each server displays this as "Node ID:" in the
1028top-right corner of its "WUI" web welcome page. It can also be obtained from
1029other client nodes, which record it as ``key_s:`` in their
1030``introducer_cache.yaml`` file. The format is "v0-" followed by 52 base32
1031characters like so::
1032
1033  v0-c2ng2pbrmxmlwpijn3mr72ckk5fmzk6uxf6nhowyosaubrt6y5mq
1034
1035The ``ann`` dictionary really only needs one key:
1036
1037* ``anonymous-storage-FURL``: how we connect to the server
1038
1039(note that other important keys may be added in the future, as Accounting and
1040HTTP-based servers are implemented)
1041
1042Optional keys include:
1043
1044* ``nickname``: the name of this server, as displayed on the Welcome page
1045  server list
1046* ``permutation-seed-base32``: this controls how shares are mapped to
1047  servers. This is normally computed from the server-ID, but can be
1048  overridden to maintain the mapping for older servers which used to use
1049  Foolscap TubIDs as server-IDs. If your selected server-ID cannot be parsed
1050  as a public key, it will be hashed to compute the permutation seed. This is
1051  fine as long as all clients use the same thing, but if they don't, then
1052  your client will disagree with the other clients about which servers should
1053  hold each share. This will slow downloads for everybody, and may cause
1054  additional work or consume extra storage when repair operations don't
1055  converge.
1056* anything else from the ``introducer_cache.yaml`` announcement, like
1057  ``my-version``, which is displayed on the Welcome page server list
1058
1059For example, a private static server could be defined with a
1060``private/servers.yaml`` file like this::
1061
1062  storage:
1063    v0-4uazse3xb6uu5qpkb7tel2bm6bpea4jhuigdhqcuvvse7hugtsia:
1064      ann:
1065        nickname: my-server-1
1066        anonymous-storage-FURL: pb://u33m4y7klhz3bypswqkozwetvabelhxt@tcp:8.8.8.8:51298/eiu2i7p6d6mm4ihmss7ieou5hac3wn6b
1067
1068Or, if you're feeling really lazy::
1069
1070  storage:
1071    my-serverid-1:
1072      ann:
1073        anonymous-storage-FURL: pb://u33m4y7klhz3bypswqkozwetvabelhxt@tcp:8.8.8.8:51298/eiu2i7p6d6mm4ihmss7ieou5hac3wn6b
1074
1075.. _YAML: http://yaml.org/
1076
1077Overriding Connection-Handlers for Static Servers
1078-------------------------------------------------
1079
1080A ``connections`` entry will override the default connection-handler mapping
1081(as established by ``tahoe.cfg [connections]``). This can be used to build a
1082"Tor-mostly client": one which is restricted to use Tor for all connections,
1083except for a few private servers to which normal TCP connections will be
1084made. To override the published announcement (and thus avoid connecting twice
1085to the same server), the server ID must exactly match.
1086
1087``tahoe.cfg``::
1088
1089  [connections]
1090   # this forces the use of Tor for all "tcp" hints
1091   tcp = tor
1092
1093``private/servers.yaml``::
1094
1095  storage:
1096    v0-c2ng2pbrmxmlwpijn3mr72ckk5fmzk6uxf6nhowyosaubrt6y5mq:
1097      ann:
1098        nickname: my-server-1
1099        anonymous-storage-FURL: pb://u33m4y7klhz3bypswqkozwetvabelhxt@tcp:10.1.2.3:51298/eiu2i7p6d6mm4ihmss7ieou5hac3wn6b
1100      connections:
1101        # this overrides the tcp=tor from tahoe.cfg, for just this server
1102        tcp: tcp
1103
1104The ``connections`` table is needed to override the ``tcp = tor`` mapping
1105that comes from ``tahoe.cfg``. Without it, the client would attempt to use
1106Tor to connect to ``10.1.2.3``, which would fail because it is a
1107local/non-routeable (RFC1918) address.
1108
1109
1110Other files
1111===========
1112
1113``logs/``
1114
1115  Each Tahoe-LAFS node creates a directory to hold the log messages produced
1116  as the node runs. These logfiles are created and rotated by the
1117  "``twistd``" daemonization program, so ``logs/twistd.log`` will contain the
1118  most recent messages, ``logs/twistd.log.1`` will contain the previous ones,
1119  ``logs/twistd.log.2`` will be older still, and so on. ``twistd`` rotates
1120  logfiles after they grow beyond 1MB in size. If the space consumed by
1121  logfiles becomes troublesome, they should be pruned: a cron job to delete
1122  all files that were created more than a month ago in this ``logs/``
1123  directory should be sufficient.
1124
1125``my_nodeid``
1126
1127  this is written by all nodes after startup, and contains a base32-encoded
1128  (i.e. human-readable) NodeID that identifies this specific node. This
1129  NodeID is the same string that gets displayed on the web page (in the
1130  "which peers am I connected to" list), and the shortened form (the first
1131  few characters) is recorded in various log messages.
1132
1133``access.blacklist``
1134
1135  Gateway nodes may find it necessary to prohibit access to certain
1136  files. The web-API has a facility to block access to filecaps by their
1137  storage index, returning a 403 "Forbidden" error instead of the original
1138  file. For more details, see the "Access Blacklist" section of
1139  :doc:`frontends/webapi`.
1140
1141
1142Example
1143=======
1144
1145The following is a sample ``tahoe.cfg`` file, containing values for some of
1146the keys described in the previous section. Note that this is not a
1147recommended configuration (most of these are not the default values), merely
1148a legal one.
1149
1150::
1151
1152  [node]
1153  nickname = Bob's Tahoe-LAFS Node
1154  tub.port = tcp:34912
1155  tub.location = tcp:123.45.67.89:8098,tcp:44.55.66.77:8098
1156  web.port = tcp:3456
1157  log_gatherer.furl = pb://soklj4y7eok5c3xkmjeqpw@192.168.69.247:44801/eqpwqtzm
1158  timeout.keepalive = 240
1159  timeout.disconnect = 1800
1160
1161  [client]
1162  helper.furl = pb://ggti5ssoklj4y7eok5c3xkmj@tcp:helper.tahoe.example:7054/kk8lhr
1163
1164  [storage]
1165  enabled = True
1166  readonly = True
1167  reserved_space = 10000000000
1168
1169  [helper]
1170  enabled = True
1171
1172To be introduced to storage servers, here is a sample ``private/introducers.yaml`` which can be used in conjunction::
1173
1174  introducers:
1175    examplegrid:
1176      furl: "pb://ok45ssoklj4y7eok5c3xkmj@tcp:tahoe.example:44801/ii3uumo"
1177
1178Old Configuration Files
1179=======================
1180
1181Tahoe-LAFS releases before v1.3.0 had no ``tahoe.cfg`` file, and used
1182distinct files for each item. This is no longer supported and if you have
1183configuration in the old format you must manually convert it to the new
1184format for Tahoe-LAFS to detect it. See :doc:`historical/configuration`.
Note: See TracBrowser for help on using the repository browser.