From 79756c088e6ace4ad1d95d1db8c4e81a3aa288ac Mon Sep 17 00:00:00 2001 From: meejah Date: Sun, 28 Jan 2018 22:48:18 -0700 Subject: [PATCH] split client, introducer READMEs --- src/allmydata/client.py | 12 ++++++++++++ src/allmydata/introducer/server.py | 18 ++++++++++++++++-- src/allmydata/node.py | 4 +--- 3 files changed, 29 insertions(+), 5 deletions(-) diff --git a/src/allmydata/client.py b/src/allmydata/client.py index 390327345..02e869e03 100644 --- a/src/allmydata/client.py +++ b/src/allmydata/client.py @@ -96,6 +96,15 @@ def _valid_config_sections(): }) return cfg +# this is put into README in new node-directories +CLIENT_README = """ +This directory contains files which contain private data for the Tahoe node, +such as private keys. On Unix-like systems, the permissions on this directory +are set to disallow users other than its owner from reading the contents of +the files. See the 'configuration.rst' documentation file for details. +""" + + def _make_secret(): return base32.b2a(os.urandom(hashutil.CRYPTO_VAL_SIZE)) + "\n" @@ -158,7 +167,10 @@ class Terminator(service.Service): #@defer.inlineCallbacks def create_client(basedir=u"."): + # load configuration config = read_config(basedir, u"client.port", _valid_config_sections=_valid_config_sections) + config.write_private_config("README", CLIENT_README) + #defer.returnValue( return _Client( config, diff --git a/src/allmydata/introducer/server.py b/src/allmydata/introducer/server.py index 5886c991e..bb49a1df6 100644 --- a/src/allmydata/introducer/server.py +++ b/src/allmydata/introducer/server.py @@ -11,6 +11,15 @@ from allmydata.introducer.interfaces import \ from allmydata.introducer.common import unsign_from_foolscap, \ SubscriberDescriptor, AnnouncementDescriptor +# this is put into README in new node-directories +INTRODUCER_README = """ +This directory contains files which contain private data for the Tahoe node, +such as private keys. On Unix-like systems, the permissions on this directory +are set to disallow users other than its owner from reading the contents of +the files. See the 'configuration.rst' documentation file for details. +""" + + def _valid_config_sections(): return node._common_config_sections() @@ -21,8 +30,13 @@ class FurlFileConflictError(Exception): #@defer.inlineCallbacks def create_introducer(basedir=u"."): from allmydata.node import read_config - config = read_config(basedir, u"client.port", generated_files=["introducer.furl"]) - config.validate(_valid_config_sections()) + + config = read_config( + basedir, u"client.port", + generated_files=["introducer.furl"], + _valid_config_secionts=_valid_config_sections, + ) + config.write_private_config("README", INTRODUCER_README) #defer.returnValue( return _IntroducerNode( config, diff --git a/src/allmydata/node.py b/src/allmydata/node.py index 98244bd74..b8b968b12 100644 --- a/src/allmydata/node.py +++ b/src/allmydata/node.py @@ -94,7 +94,7 @@ such as private keys. On Unix-like systems, the permissions on this directory are set to disallow users other than its owner from reading the contents of the files. See the 'configuration.rst' documentation file for details.""" -class _None(object): +class _None(object): # used as a marker in get_config() """ This class is to be used as a marker in get_config() """ @@ -375,8 +375,6 @@ class Node(service.MultiService): is the current directory by default. """ service.MultiService.__init__(self) - with open(os.path.join(config._basedir, "private", "README"), "w") as f: - f.write(PRIV_README) self.config = config self.get_config = config.get_config # XXX stopgap