|
|
@ -202,6 +202,20 @@ WALLET_ENCRYPTION_PWD = os.getenv('WALLET_ENCRYPTION_PWD', '') |
|
|
|
|
|
|
|
|
|
|
|
use_tor_proxy: bool = False |
|
|
|
use_tor_proxy: bool = False |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
monerod_proxy_config = [ |
|
|
|
|
|
|
|
f'proxy={TOR_PROXY_HOST}:{TOR_PROXY_PORT}', |
|
|
|
|
|
|
|
'proxy-allow-dns-leaks=0', |
|
|
|
|
|
|
|
'no-igd=1', # Disable UPnP port mapping |
|
|
|
|
|
|
|
'hide-my-port=1', # Don't share the p2p port |
|
|
|
|
|
|
|
'p2p-bind-ip=127.0.0.1', # Don't broadcast ip |
|
|
|
|
|
|
|
'in-peers=0', # Changes "error" in log to "incoming connections disabled" |
|
|
|
|
|
|
|
] |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
monero_wallet_rpc_proxy_config = [ |
|
|
|
|
|
|
|
'daemon-ssl-allow-any-cert=1', |
|
|
|
|
|
|
|
] |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
default_socket = socket.socket |
|
|
|
default_socket = socket.socket |
|
|
|
default_socket_timeout = socket.getdefaulttimeout() |
|
|
|
default_socket_timeout = socket.getdefaulttimeout() |
|
|
|
default_socket_getaddrinfo = socket.getaddrinfo |
|
|
|
default_socket_getaddrinfo = socket.getaddrinfo |
|
|
@ -814,8 +828,8 @@ def prepareDataDir(coin, settings, chain, particl_mnemonic, extra_opts={}): |
|
|
|
fp.write('prune-blockchain=1\n') |
|
|
|
fp.write('prune-blockchain=1\n') |
|
|
|
|
|
|
|
|
|
|
|
if tor_control_password is not None: |
|
|
|
if tor_control_password is not None: |
|
|
|
fp.write('proxy-allow-dns-leaks=0\n') |
|
|
|
for opt_line in monerod_proxy_config: |
|
|
|
fp.write('no-igd=1\n') |
|
|
|
fp.write(opt_line + '\n') |
|
|
|
|
|
|
|
|
|
|
|
if XMR_RPC_USER != '': |
|
|
|
if XMR_RPC_USER != '': |
|
|
|
fp.write(f'rpc-login={XMR_RPC_USER}:{XMR_RPC_PWD}\n') |
|
|
|
fp.write(f'rpc-login={XMR_RPC_USER}:{XMR_RPC_PWD}\n') |
|
|
@ -846,7 +860,8 @@ def prepareDataDir(coin, settings, chain, particl_mnemonic, extra_opts={}): |
|
|
|
|
|
|
|
|
|
|
|
if tor_control_password is not None: |
|
|
|
if tor_control_password is not None: |
|
|
|
if not core_settings['manage_daemon']: |
|
|
|
if not core_settings['manage_daemon']: |
|
|
|
fp.write(f'proxy={TOR_PROXY_HOST}:{TOR_PROXY_PORT}\n') |
|
|
|
for opt_line in monero_wallet_rpc_proxy_config: |
|
|
|
|
|
|
|
fp.write(opt_line + '\n') |
|
|
|
return |
|
|
|
return |
|
|
|
|
|
|
|
|
|
|
|
core_conf_path = os.path.join(data_dir, coin + '.conf') |
|
|
|
core_conf_path = os.path.join(data_dir, coin + '.conf') |
|
|
@ -989,30 +1004,29 @@ def modify_tor_config(settings, coin, tor_control_password=None, enable=False, e |
|
|
|
shutil.copyfile(core_conf_path, core_conf_path + '.last') |
|
|
|
shutil.copyfile(core_conf_path, core_conf_path + '.last') |
|
|
|
shutil.copyfile(wallet_conf_path, wallet_conf_path + '.last') |
|
|
|
shutil.copyfile(wallet_conf_path, wallet_conf_path + '.last') |
|
|
|
|
|
|
|
|
|
|
|
daemon_tor_settings = ('proxy=', 'proxy-allow-dns-leaks=', 'no-igd=') |
|
|
|
|
|
|
|
with open(core_conf_path, 'w') as fp: |
|
|
|
with open(core_conf_path, 'w') as fp: |
|
|
|
with open(core_conf_path + '.last') as fp_in: |
|
|
|
with open(core_conf_path + '.last') as fp_in: |
|
|
|
# Disable tor first |
|
|
|
# Disable tor first |
|
|
|
for line in fp_in: |
|
|
|
for line in fp_in: |
|
|
|
skip_line = False |
|
|
|
skip_line: bool = False |
|
|
|
for setting in daemon_tor_settings: |
|
|
|
for opt_line in monerod_proxy_config: |
|
|
|
|
|
|
|
setting: str = opt_line[0: opt_line.find('=') + 1] |
|
|
|
if line.startswith(setting): |
|
|
|
if line.startswith(setting): |
|
|
|
skip_line = True |
|
|
|
skip_line = True |
|
|
|
break |
|
|
|
break |
|
|
|
if not skip_line: |
|
|
|
if not skip_line: |
|
|
|
fp.write(line) |
|
|
|
fp.write(line) |
|
|
|
if enable: |
|
|
|
if enable: |
|
|
|
fp.write(f'proxy={TOR_PROXY_HOST}:{TOR_PROXY_PORT}\n') |
|
|
|
for opt_line in monerod_proxy_config: |
|
|
|
fp.write('proxy-allow-dns-leaks=0\n') |
|
|
|
fp.write(opt_line + '\n') |
|
|
|
fp.write('no-igd=1\n') |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
wallet_tor_settings = ('proxy=', 'daemon-ssl-allow-any-cert=',) |
|
|
|
|
|
|
|
with open(wallet_conf_path, 'w') as fp: |
|
|
|
with open(wallet_conf_path, 'w') as fp: |
|
|
|
with open(wallet_conf_path + '.last') as fp_in: |
|
|
|
with open(wallet_conf_path + '.last') as fp_in: |
|
|
|
# Disable tor first |
|
|
|
# Disable tor first |
|
|
|
for line in fp_in: |
|
|
|
for line in fp_in: |
|
|
|
skip_line = False |
|
|
|
skip_line = False |
|
|
|
for setting in wallet_tor_settings: |
|
|
|
for opt_line in monero_wallet_rpc_proxy_config + ['proxy=',]: |
|
|
|
|
|
|
|
setting: str = opt_line[0: opt_line.find('=') + 1] |
|
|
|
if line.startswith(setting): |
|
|
|
if line.startswith(setting): |
|
|
|
skip_line = True |
|
|
|
skip_line = True |
|
|
|
break |
|
|
|
break |
|
|
@ -1020,8 +1034,8 @@ def modify_tor_config(settings, coin, tor_control_password=None, enable=False, e |
|
|
|
fp.write(line) |
|
|
|
fp.write(line) |
|
|
|
if enable: |
|
|
|
if enable: |
|
|
|
if not coin_settings['manage_daemon']: |
|
|
|
if not coin_settings['manage_daemon']: |
|
|
|
fp.write(f'proxy={TOR_PROXY_HOST}:{TOR_PROXY_PORT}\n') |
|
|
|
for opt_line in monero_wallet_rpc_proxy_config: |
|
|
|
fp.write('daemon-ssl-allow-any-cert=1\n') |
|
|
|
fp.write(opt_line + '\n') |
|
|
|
|
|
|
|
|
|
|
|
coin_settings['trusted_daemon'] = extra_opts.get('trust_remote_node', 'auto') |
|
|
|
coin_settings['trusted_daemon'] = extra_opts.get('trust_remote_node', 'auto') |
|
|
|
return |
|
|
|
return |
|
|
|