aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorChristopher Baines <cbaines8@gmail.com>2013-11-29 21:56:54 +0000
committerChristopher Baines <cbaines8@gmail.com>2013-11-29 21:56:54 +0000
commit1a229ce58496deb5336943bd53919b6b66bcbed2 (patch)
treeef9f496839d719cb60706838d31c9a96ff5472fd /lib
parentfad78679d34e4f345b13942e9bbdc0ddbbb52e13 (diff)
downloadchutney-1a229ce58496deb5336943bd53919b6b66bcbed2.tar
chutney-1a229ce58496deb5336943bd53919b6b66bcbed2.tar.gz
Add some things
Diffstat (limited to 'lib')
-rw-r--r--lib/chutney/TorNet.py20
1 files changed, 20 insertions, 0 deletions
diff --git a/lib/chutney/TorNet.py b/lib/chutney/TorNet.py
index 57b8632..8e3df89 100644
--- a/lib/chutney/TorNet.py
+++ b/lib/chutney/TorNet.py
@@ -237,6 +237,8 @@ class LocalNodeBuilder(NodeBuilder):
self._genAuthorityKey()
if self._env['relay']:
self._genRouterKey()
+ if self._env['hiddenservice']:
+ self._genHiddenServiceKey()
def config(self, net):
"""Called to configure a node: creates a torrc file for it."""
@@ -303,6 +305,21 @@ class LocalNodeBuilder(NodeBuilder):
assert re.match(r'^[A-F0-9]{40}$', fingerprint)
self._env['fingerprint'] = fingerprint
+ def _genHiddenServiceKey(self):
+ """Generate an identity key for this router, unless we already have,
+ and set up the 'fingerprint' entry in the Environ.
+ """
+ datadir = self._env['dir']
+ cmdline = [
+ "cp", "-r",
+ "/".join(datadir.split("/")[:-3]) + "/hs",
+ datadir + "/hidden_service" ]
+ p = subprocess.Popen(cmdline, stdout=subprocess.PIPE)
+ #stdout, stderr = p.communicate()
+ #print("creating hidden service key")
+ #print(stdout)
+ #print("FInished")
+
def _getAltAuthLines(self, hasbridgeauth):
"""Return a combination of AlternateDirAuthority,
AlternateHSAuthority and AlternateBridgeAuthority lines for
@@ -505,6 +522,9 @@ DEFAULTS = {
'hasbridgeauth' : False,
'relay' : False,
'bridge' : False,
+ 'hiddenservice' : False,
+ 'hiddenserviceport' : 80,
+ 'hiddenservicetarget' : '127.0.0.1',
'connlimit' : 60,
'net_base_dir' : 'net',
'tor' : 'tor',