From 8c1454e57225a0c24a8a0be4e18687edbae9fde0 Mon Sep 17 00:00:00 2001 From: Lee Miller Date: Thu, 26 Oct 2023 03:32:55 +0300 Subject: [PATCH] Conform tor setup to the restrictions for incoming and outgoing connections --- minode/main.py | 18 +++++++++--------- minode/tor.py | 3 +++ 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/minode/main.py b/minode/main.py index 750c24c..66fac81 100644 --- a/minode/main.py +++ b/minode/main.py @@ -271,21 +271,21 @@ def main(): 'Error while creating data directory in: %s', shared.data_directory, exc_info=True) - if shared.socks_proxy: + if shared.socks_proxy and shared.send_outgoing_connections: try: socks.PROXY_TYPES[shared.socks_proxy.scheme.upper()] except KeyError: logging.error('Unsupported proxy schema!') return - if shared.tor: - try: - from . import tor - except ImportError: - logging.info('Failed to import tor module.', exc_info=True) - else: - if not tor.start_tor_service(): - logging.warning('Failed to start tor service.') + if shared.tor: + try: + from . import tor + except ImportError: + logging.info('Failed to import tor module.', exc_info=True) + else: + if not tor.start_tor_service(): + logging.warning('Failed to start tor service.') if shared.ip_enabled and not shared.trusted_peer and not shared.tor: bootstrap_from_dns() diff --git a/minode/tor.py b/minode/tor.py index 3e5ec1c..28e5b76 100644 --- a/minode/tor.py +++ b/minode/tor.py @@ -75,6 +75,9 @@ def start_tor_service(): logging.debug('Failed to start tor.') return + if not shared.listen_for_connections: + return True + try: controller = stem.control.Controller.from_socket_file(control_socket) controller.authenticate()