From 8a82e76182d45e3daa64c6d5cff00bc176730470 Mon Sep 17 00:00:00 2001 From: Kevin Froman Date: Sun, 2 Feb 2020 03:23:59 -0600 Subject: [PATCH] fix tor dir being too open --- src/netcontroller/torcontrol/__init__.py | 1 + src/onionrcommands/daemonlaunch/__init__.py | 4 ++++ src/utils/createdirs.py | 3 +-- tests/runtime-result.txt | 2 +- 4 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/netcontroller/torcontrol/__init__.py b/src/netcontroller/torcontrol/__init__.py index dc7ff370..6fca8809 100644 --- a/src/netcontroller/torcontrol/__init__.py +++ b/src/netcontroller/torcontrol/__init__.py @@ -13,6 +13,7 @@ import platform # For windows sigkill workaround from onionrtypes import BooleanSuccessState import logger +import filepaths from .. import getopenport from .. import watchdog from . import customtorrc diff --git a/src/onionrcommands/daemonlaunch/__init__.py b/src/onionrcommands/daemonlaunch/__init__.py index 1a34cac5..20f31ff2 100755 --- a/src/onionrcommands/daemonlaunch/__init__.py +++ b/src/onionrcommands/daemonlaunch/__init__.py @@ -114,6 +114,10 @@ def daemon(): if not offline_mode: if use_existing_tor: + try: + os.mkdir(filepaths.tor_hs_loc) + except FileExistsError: + pass net.socksPort = config.get('tor.existing_socks_port') try: net.myID = create_onion_service( diff --git a/src/utils/createdirs.py b/src/utils/createdirs.py index d76f4842..2df87aa3 100644 --- a/src/utils/createdirs.py +++ b/src/utils/createdirs.py @@ -28,8 +28,7 @@ def create_dirs(): order of the hardcoded list below, then trigger creation of DBs""" gen_dirs = [home, filepaths.block_data_location, - filepaths.contacts_location, filepaths.export_location, - filepaths.tor_hs_loc] + filepaths.contacts_location, filepaths.export_location] for path in gen_dirs: if not os.path.exists(path): os.mkdir(path) diff --git a/tests/runtime-result.txt b/tests/runtime-result.txt index 5b70d092..b9ca3db8 100644 --- a/tests/runtime-result.txt +++ b/tests/runtime-result.txt @@ -1 +1 @@ -1580633234 \ No newline at end of file +1580635315 \ No newline at end of file