Commit Graph

120 Commits

Author SHA1 Message Date
Brian Warner
cac99569e9 factor out "Tub maker"
This adds Node._create_tub(), which knows how to make a Tub with all the
right options and connection handlers that were specified in
tahoe.cfg (the connection handlers are disabled for now, but they'll get
implemented soon).

The new Node.create_main_tub() calls it. This main Tub is used:

* to connect to the Introducer
* to host the Helper (if enabled)
* to host the Storage Server (if enabled)

Node._create_tub() is also passed into the StorageFarmBroker, which
passes it into each NativeStorageServer, to create the (separate) Tub
for each server connection. _create_tub knows about the options, and
NativeStorageServer can override the connection handlers. This way we
don't need to pass tub options or default handlers into Client,
StorageFarmBroker, or NativeStorageServer.

A number of tests create NativeStorageServer objects: these were updated
to match the new arguments. test_storage_client was simplified because
we no longer need to mock out the Tub() constructor.
2016-08-27 17:36:55 -07:00
David Stainton
61eb839843 Add tub_handlers arg to NativeStorageServer constructor
Here we also define tub_handlers as a node attribute and pass it all the way
down to the NativeStorageServer via the Client and StorageFarmBroker
2016-08-22 09:15:25 -07:00
Brian Warner
af1e2a1e2f node.py: advise twistd.log readers about flogtool 2016-08-09 15:27:33 -04:00
Brian Warner
7d692d0afd Split control and log to two separate tubs, remove control knobs.
This also removes the tahoe.cfg keys that would have configured the
control-port. And it deletes the logport.furl file before asking the Tub
to re-create it, because we're now using an ephemeral Tub (so we're not
persisting the private key, so the tubid will change each time).

closes ticket:2794
2016-07-06 21:09:35 -07:00
David Stainton
e5ffbdbcdf Move control/logging to a separate Tub 2016-07-06 21:09:35 -07:00
Brian Warner
b9edccbeaa set the same options on all Tubs 2016-05-03 11:38:20 -07:00
Brian Warner
96c625920c Teach tub to start synchronously even with ip autodetect
* remove when_tub_ready() from all code
* synchronous-ify all node/client/introducer startup code

refs ticket:2491
2016-04-26 21:54:45 -07:00
Brian Warner
ffc2f48cfe compute tub location before creating Tub
This can be done synchronously because we now know the port number
earlier. This still uses get_local_addresses_sync() (not _async) to do
automatic IP-address detection if the config file didn't set
tub.location or used the special word "AUTO" in it.

The new implementation slightly changes the mapping from tub.location to
the assigned location string. The old code removed all instances of
"AUTO" from the location and then extended the hints with the local
ones (so "hint1:AUTO:hint2" turns into "hint1:hint2:auto1:auto2"). The
new code exactly replaces each "AUTO" with the local hints (so that
example turns into "hint1:auto1:auto2:hint2", and a silly
"hint1:AUTO:AUTO" would turn into "hint1:auto1:auto2:auto1:auto2"). This
is unlikely to affect anybody.
2016-04-26 18:39:47 -07:00
Brian Warner
cf5b02b487 clean up tub.port processing, reject tcp:0
This is the first step towards making node startup be synchronous: the
tub.port is entirely determined (including any TCP port allocation that
might be necessary) before creating the Tub, so the portnumber part of
FURLs can be determined earlier.
2016-04-26 18:39:47 -07:00
meejah
308bb8c41f match get_or_create_private_config API (closes ticket:2775) 2016-04-12 12:58:42 -06:00
Brian Warner
8279d919f3 remove "manhole" (ssh-accessible REPL)
This little-used debugging feature allowed you to SSH or Telnet "into" a
Tahoe node, and get an interactive Read-Eval-Print-Loop (REPL) that
executed inside the context of the running process. The SSH
authentication code used a deprecated feature of Twisted, this code had
no unit-test coverage, and I haven't personally used it in at least 6
years (despite writing it in the first place). Time to go.

Also experiment with a Twisted-style "topfiles/" directory of NEWS
fragments. The idea is that we require all user-visible changes to
include a file or two (named as $TICKETNUM.$TYPE), and then run a script
to generate NEWS during the release process, instead of having a human
scan the commit logs and summarize the changes long after they landed.

Closes ticket:2367
2016-04-06 13:40:06 -10:00
Daira Hopwood
58841cab38 Refactor tahoe.cfg handling to configutil.
Author: David Stainton <david@leastauthority.com>
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2015-12-28 19:36:19 +00:00
Daira Hopwood
913082230c Disable bridging of foolscap logging to the Twisted log, and remove docs for it. fixes ticket:2567
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2015-11-03 17:35:21 +00:00
Daira Hopwood
0b24756cc7 Allow multiple occurrences of AUTO. refs #754
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2015-02-10 17:31:10 +00:00
Daira Hopwood
ca3c7abe3a Only get the local addresses if they are actually used. refs #754
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2015-02-10 17:12:43 +00:00
Daira Hopwood
c9a56eae2b Allow combining autodetected and statically configured locations. fixes #754
Replaces the location 'AUTO' with the autodetected IP/port combination.

Author: Chris Kerr <debdepba@dasganma.tk>
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2015-02-09 19:18:58 +00:00
Daira Hopwood
14f783086f Change uses of os.path.expanduser and os.path.abspath. refs #2235
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2015-01-30 00:50:18 +00:00
Zooko Wilcox-O'Hearn
617f667769 remove obsolete comment 2014-08-05 16:36:59 +00:00
Daira Hopwood
efc223ad1f Improve error reporting for '#' characters in config entries. refs #2128
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2014-05-05 23:14:48 +01:00
Daira Hopwood
883dd9795b Error if a .furl config entry contains an unescaped '#'. fixes #2128
Author: Andrew Miller <amiller@dappervision.com>
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2014-05-05 22:55:50 +01:00
Brian Warner
ff64a0fef5 fileutil.write: accept mode=, and use it in Node.write_config
I want mode="w" (i.e. text, with newline conversion) for code that
writes newline-terminated strings (which should also be human readable)
to files. I like to use things like "cat .tahoe/permutation-seed"
without seeing the seed jammed together with the next command prompt.
2013-03-18 17:34:57 -07:00
Brian Warner
26d3869076 node.py: add get_private_config()
Also add tests for this and the pre-existing private-config methods.
2012-06-10 17:46:38 -07:00
Brian Warner
3ba77925d9 node.py: stop stripping whitespace in write_private_config()
It's nice to add newlines to the saved file, so 'cat' is easy to use. We
still strip on the input side, in get_or_create_private_config().
2012-05-30 00:17:55 -07:00
Brian Warner
c4d7b7b109 write node.url and portnum files atomically, to fix race in test_runner
Previously, test_runner sometimes fails because the _node_has_started()
poller fires after the portnum file has been opened, but before it has
actually been filled, allowing the test process to observe an empty file,
which flunks the test.

This adds a new fileutil.write_atomically() function (using the usual
write-to-.tmp-then-rename approach), and uses it for both node.url and
client.port . These files are written a bit before the node is really up and
running, but they're late enough for test_runner's purposes, which is to know
when it's safe to read client.port and use 'tahoe restart' (and therefore
SIGINT) to restart the node.

The current node/client code doesn't offer any better "are you really done
with startup" indicator.. the ideal approach would be to either watch the
logfile, or connect to its flogport, but both are a hassle. Changing the node
to write out a new "all done" file would be intrusive for regular
operations.
2012-05-14 15:03:14 -07:00
david-sarah
a555336910 Make sure that foolscap.logging.log.setLogDir is called with a str (not unicode) path, v2. Includes test. fixes #1725 2012-04-29 02:28:44 +00:00
david-sarah
ba0df23927 node.py: tolerate a UTF-8 BOM at the start of tahoe.cfg. fixes #1470 2011-08-08 18:02:04 +00:00
Brian Warner
bc21726dfd new introducer: signed extensible dictionary-based messages! refs #466
This introduces new client and server halves to the Introducer (renaming the
old one with a _V1 suffix). Both have fallbacks to accomodate talking to a
different version: the publishing client switches on whether the server's
.get_version() advertises V2 support, the server switches on which
subscription method was invoked by the subscribing client.

The V2 protocol sends a three-tuple of (serialized announcement dictionary,
signature, pubkey) for each announcement. The V2 server dispatches messages
to subscribers according to the service-name, and throws errors for invalid
signatures, but does not otherwise examine the messages. The V2 receiver's
subscription callback will receive a (serverid, ann_dict) pair. The
'serverid' will be equal to the pubkey if all of the following are true:

  the originating client is V2, and was told a privkey to use
  the announcement went through a V2 server
  the signature is valid

If not, 'serverid' will be equal to the tubid portion of the announced FURL,
as was the case for V1 receivers.

Servers will create a keypair if one does not exist yet, stored in
private/server.privkey .

The signed announcement dictionary puts the server FURL in a key named
"anonymous-storage-FURL", which anticipates upcoming Accounting-related
changes in the server advertisements. It also provides a key named
"permutation-seed-base32" to tell clients what permutation seed to use. This
is computed at startup, using tubid if there are existing shares, otherwise
the pubkey, to retain share-order compatibility for existing servers.
2012-03-13 18:24:32 -07:00
david-sarah
7f8bbcc155 Use a private/drop_upload_dircap file instead of the [drop_upload]upload.dircap option in tahoe.cfg. Fail if the upload.dircap option is used, or options are missing. Also updates tests and docs. fixes #1593 2011-11-20 23:24:26 +00:00
david-sarah
05684b9251 node.py: ensure that client and introducer nodes record their port number and use that port on the next restart, fixing a regression caused by #1385. fixes #1469. 2011-08-06 15:19:34 -07:00
david-sarah
1967233f49 node.py: fix the error path for a missing config option so that it works for a Unicode base directory. 2011-08-06 15:10:07 -07:00
david-sarah
80300ea7a3 Further improve error message about old config files. refs #1385 2011-08-03 10:45:46 -07:00
david-sarah
f45bfeb3df Slightly improve error message about old config files (avoid unnecessary Unicode escaping). refs #1385 2011-08-03 09:38:48 -07:00
david-sarah
2d16a16ee3 Fix the bug that prevents an introducer from starting when introducer.furl already exists. Also remove some dead code that used to read old config files, and rename 'warn_about_old_config_files' to reflect that it's not a warning. refs #1385 2011-08-02 18:32:12 -07:00
Zooko O'Whielacronx
e5c4e83f4c reject old-style (pre-Tahoe-LAFS-v1.3) configuration files
Check for the existence of any of them and if any are found raise exception which will abort the startup of the node.
This is a backwards-incompatible change for anyone who is still using old-style configuration files.
fixes #1385
2011-08-01 16:24:23 -07:00
Zooko O'Whielacronx
420e3aa293 whitespace-cleanup 2011-07-24 18:55:46 -07:00
david-sarah
d7bdf476b9 Change a doc reference from .txt to .rst in a text string. 2010-11-28 09:34:44 -08:00
david-sarah
f036dfaa4b Fix test failures due to Unicode basedir patches. 2010-07-24 18:03:18 -07:00
david-sarah
618db4867c Replace uses of os.path.abspath with abspath_expanduser_unicode where necessary. This makes basedir paths consistently represented as Unicode. 2010-07-21 17:14:18 -07:00
Brian Warner
acd211765c node.py/interfaces.py: minor docs fixes 2009-12-29 15:04:09 -08:00
Brian Warner
7950fc0f2e node.py: record pid in twisted log at startup. Closes #476. 2009-07-15 00:29:29 -07:00
Brian Warner
8df15e9f30 big rework of introducer client: change local API, split division of responsibilites better, remove old-code testing, improve error logging 2009-06-22 19:10:47 -07:00
Brian Warner
1863aee0aa switch to using RemoteException instead of 'wrapped' RemoteReferences. Should fix #653, the rref-EQ problem 2009-05-21 17:46:32 -07:00
Brian Warner
c9803d5217 switch all foolscap imports to use foolscap.api or foolscap.logging 2009-05-21 17:38:23 -07:00
Brian Warner
26ca53fa3d node.py: use NODEDIR/tmp for the 'tempfile' module's temporary directory, so webapi upload tempfiles are put there instead of /tmp . You can set it to something else by setting [node]tempdir in tahoe.cfg 2009-01-14 20:00:15 -07:00
Brian Warner
9976bd439a tahoe.cfg: add tub.location, to override the location hints we include in our FURL. This replaces advertised_ip_addresses, which doesn't remain useful enough to retain it. Helps with #517 (Tor). 2008-11-12 18:44:58 -07:00
Brian Warner
67ae5c1b2f node.py: remove unused old_log() function 2008-10-28 21:35:58 -07:00
Brian Warner
ba26239879 node.py: remove support for the old BASEDIR/authorized_keys.PORT file 2008-10-28 21:34:20 -07:00
Brian Warner
cd26f58305 #518: replace various BASEDIR/* config files with a single BASEDIR/tahoe.cfg, with backwards-compatibility of course 2008-09-30 16:21:49 -07:00
robk-tahoe
90e3f37173 manhole: be more tolerant of authorized_keys. files in .tahoe
both peter and I independently tried to do the same thing to eliminate the
authorized_keys file which was causing problems with the broken mac build
(c.f. #522) namely mv authorized_keys.8223{,.bak}  but the node is, ahem,
let's say 'intolerant' of the trailing .bak - rather than disable the
manhole as one might expect, it instead causes the node to explode on
startup.  this patch makes it skip over anything that doesn't pass the
'parse this trailing stuff as an int' test.
2008-09-24 20:11:49 -07:00
Brian Warner
dd9171eb72 node.py: add BASEDIR/keepalive_timeout and BASEDIR/disconnect_timeout, to set/enable the foolscap timers, for #521 2008-09-24 10:51:12 -07:00