catch and log when cannot reach non-managed tor
This commit is contained in:
parent
8d54519771
commit
39650a4ca0
@ -2,9 +2,13 @@
|
|||||||
|
|
||||||
Create an ephemeral onion service
|
Create an ephemeral onion service
|
||||||
"""
|
"""
|
||||||
|
import stem
|
||||||
|
|
||||||
from .torcontroller import get_controller
|
from .torcontroller import get_controller
|
||||||
|
|
||||||
from filepaths import ephemeral_services_file
|
from filepaths import ephemeral_services_file
|
||||||
|
|
||||||
|
import logger
|
||||||
"""
|
"""
|
||||||
This program is free software: you can redistribute it and/or modify
|
This program is free software: you can redistribute it and/or modify
|
||||||
it under the terms of the GNU General Public License as published by
|
it under the terms of the GNU General Public License as published by
|
||||||
@ -22,7 +26,11 @@ from filepaths import ephemeral_services_file
|
|||||||
|
|
||||||
|
|
||||||
def create_onion_service(port=80, record_to_service_removal_file=True):
|
def create_onion_service(port=80, record_to_service_removal_file=True):
|
||||||
|
try:
|
||||||
controller = get_controller()
|
controller = get_controller()
|
||||||
|
except stem.SocketError:
|
||||||
|
logger.error("Could not connect to Tor control")
|
||||||
|
raise
|
||||||
hs = controller.create_ephemeral_hidden_service(
|
hs = controller.create_ephemeral_hidden_service(
|
||||||
{80: port},
|
{80: port},
|
||||||
key_type='NEW',
|
key_type='NEW',
|
||||||
|
@ -8,6 +8,7 @@ import platform
|
|||||||
from threading import Thread
|
from threading import Thread
|
||||||
|
|
||||||
from stem.connection import IncorrectPassword
|
from stem.connection import IncorrectPassword
|
||||||
|
import stem
|
||||||
import toomanyobjs
|
import toomanyobjs
|
||||||
import filenuke
|
import filenuke
|
||||||
from deadsimplekv import DeadSimpleKV
|
from deadsimplekv import DeadSimpleKV
|
||||||
@ -73,7 +74,9 @@ def _show_info_messages():
|
|||||||
(logger.colors.underline +
|
(logger.colors.underline +
|
||||||
getourkeypair.get_keypair()[0][:52]))
|
getourkeypair.get_keypair()[0][:52]))
|
||||||
|
|
||||||
def _setup_online_mode(use_existing_tor: bool,
|
|
||||||
|
def _setup_online_mode(
|
||||||
|
use_existing_tor: bool,
|
||||||
net: NetController,
|
net: NetController,
|
||||||
security_level: int):
|
security_level: int):
|
||||||
if config.get('transports.tor', True):
|
if config.get('transports.tor', True):
|
||||||
@ -89,6 +92,12 @@ def _setup_online_mode(use_existing_tor: bool,
|
|||||||
try:
|
try:
|
||||||
net.myID = create_onion_service(
|
net.myID = create_onion_service(
|
||||||
port=net.apiServerIP + ':' + str(net.hsPort))[0]
|
port=net.apiServerIP + ':' + str(net.hsPort))[0]
|
||||||
|
except stem.SocketError:
|
||||||
|
logger.error(
|
||||||
|
"Could not connect to existing Tor service", terminal=True)
|
||||||
|
localcommand.local_command('shutdown')
|
||||||
|
cleanup.delete_run_files()
|
||||||
|
sys.exit(1)
|
||||||
except IncorrectPassword:
|
except IncorrectPassword:
|
||||||
# Exit if we cannot connect to the existing Tor instance
|
# Exit if we cannot connect to the existing Tor instance
|
||||||
logger.error('Invalid Tor control password', terminal=True)
|
logger.error('Invalid Tor control password', terminal=True)
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
"disk": 1073741824
|
"disk": 1073741824
|
||||||
},
|
},
|
||||||
"general": {
|
"general": {
|
||||||
|
"allow_public_api_dns_rebinding": false,
|
||||||
"announce_node": true,
|
"announce_node": true,
|
||||||
"dev_mode": false,
|
"dev_mode": false,
|
||||||
"display_header": true,
|
"display_header": true,
|
||||||
|
Loading…
Reference in New Issue
Block a user