From 9e83dc4d66417b127fa46caf101fbc5c23d77400 Mon Sep 17 00:00:00 2001 From: kexkey Date: Mon, 27 Jan 2020 14:42:15 -0500 Subject: [PATCH] More fixes for tor --- cyphernodeconf_docker/lib/app.js | 8 ++++---- cyphernodeconf_docker/prompters/100_lightning.js | 2 +- cyphernodeconf_docker/templates/bitcoin/bitcoin.conf | 2 +- .../templates/installer/docker/docker-compose.yaml | 4 ++-- .../templates/installer/testdeployment.sh | 2 +- .../templates/lightning/c-lightning/config | 2 +- .../templates/lightning/c-lightning/entrypoint.sh | 2 +- 7 files changed, 11 insertions(+), 11 deletions(-) diff --git a/cyphernodeconf_docker/lib/app.js b/cyphernodeconf_docker/lib/app.js index 42f13de..05e2301 100644 --- a/cyphernodeconf_docker/lib/app.js +++ b/cyphernodeconf_docker/lib/app.js @@ -230,7 +230,7 @@ module.exports = class App { } for( let torifyable of this.torifyables ) { - torifyable.checked = this.isChecked( 'torifyables', torifyable.value ); + torifyable.checked = this.isChecked('features', 'tor') && this.isChecked( 'torifyables', torifyable.value ); } } @@ -421,7 +421,7 @@ module.exports = class App { } for( let torifyable of this.torifyables ) { - torifyable.checked = this.isChecked( 'torifyables', torifyable.value ); + torifyable.checked = this.isChecked('features', 'tor') && this.isChecked( 'torifyables', torifyable.value ); } const cert = new Cert(); @@ -440,7 +440,7 @@ module.exports = class App { expose: this.config.data.bitcoin_expose, uacomment: this.config.data.bitcoin_uacomment, torified: this.torifyables.find(data => data.value === 'tor_bitcoin').checked, - clearnet: this.isChecked('clearnet', 'clearnet_bitcoin'), + clearnet: !this.isChecked('features', 'tor') || this.isChecked('clearnet', 'clearnet_bitcoin'), tor_hostname: this.sessionData.tor_bitcoin_hostname } }, @@ -538,7 +538,7 @@ module.exports = class App { external_ip: this.config.data.lightning_external_ip, implementation: this.config.data.lightning_implementation, torified: this.torifyables.find(data => data.value === 'tor_lightning').checked, - clearnet: this.isChecked('clearnet', 'clearnet_lightning'), + clearnet: !this.isChecked('features', 'tor') || this.isChecked('clearnet', 'clearnet_lightning'), tor_hostname: this.sessionData.tor_lightning_hostname } } diff --git a/cyphernodeconf_docker/prompters/100_lightning.js b/cyphernodeconf_docker/prompters/100_lightning.js index d0efaf4..bfba0ef 100644 --- a/cyphernodeconf_docker/prompters/100_lightning.js +++ b/cyphernodeconf_docker/prompters/100_lightning.js @@ -57,7 +57,7 @@ module.exports = { Next question is asked when lightning_annouce is YES and (not Tor or (Tor and LN clearnet)). */ { - when: (props) => { return featureCondition(props) && props.lightning_announce && ((!props.torifyables || props.torifyables.indexOf('tor_lightning') === -1) || (props.clearnet && props.clearnet.indexOf('clearnet_lightning') !== -1)) }, + when: (props) => { return featureCondition(props) && props.lightning_announce && (props.features.indexOf('tor') === -1 || props.features.indexOf('tor') !== -1 && ((!props.torifyables || props.torifyables.indexOf('tor_lightning') === -1) || (props.clearnet && props.clearnet.indexOf('clearnet_lightning') !== -1))) }, type: 'input', name: 'lightning_external_ip', default: utils.getDefault( 'lightning_external_ip' ), diff --git a/cyphernodeconf_docker/templates/bitcoin/bitcoin.conf b/cyphernodeconf_docker/templates/bitcoin/bitcoin.conf index 503716d..4b662c1 100644 --- a/cyphernodeconf_docker/templates/bitcoin/bitcoin.conf +++ b/cyphernodeconf_docker/templates/bitcoin/bitcoin.conf @@ -17,7 +17,7 @@ zmqpubrawtx=tcp://0.0.0.0:18502 listen=1 -<% if ( torifyables && torifyables.indexOf('tor_bitcoin') !== -1 ) { %> +<% if ( features.indexOf('tor') !== -1 && torifyables && torifyables.indexOf('tor_bitcoin') !== -1 ) { %> #tor proxy=tor:9050 <% if ( !clearnet || clearnet.indexOf('clearnet_bitcoin') === -1 ) { %> diff --git a/cyphernodeconf_docker/templates/installer/docker/docker-compose.yaml b/cyphernodeconf_docker/templates/installer/docker/docker-compose.yaml index 7fd1420..51228f1 100644 --- a/cyphernodeconf_docker/templates/installer/docker/docker-compose.yaml +++ b/cyphernodeconf_docker/templates/installer/docker/docker-compose.yaml @@ -68,7 +68,7 @@ services: bitcoin: image: cyphernode/bitcoin:<%= bitcoin_version %> - <% if ( torifyables && torifyables.indexOf('tor_bitcoin') !== -1 ) { %> + <% if ( features.indexOf('tor') !== -1 && torifyables && torifyables.indexOf('tor_bitcoin') !== -1 ) { %> command: $USER sh -c 'rm -f /container_monitor/bitcoin_ready ; while [ ! -f "/container_monitor/tor_ready" ]; do echo "tor not ready" ; sleep 10 ; done ; echo "tor ready" ; bitcoind' <% } else { %> command: $USER sh -c 'rm -f /container_monitor/bitcoin_ready ; bitcoind' @@ -239,7 +239,7 @@ services: <% if (net === 'testnet') { %> - "TESTNET=1" <% } %> - <% if ( torifyables && torifyables.indexOf('tor_otsoperations') !== -1 ) { %> + <% if ( features.indexOf('tor') !== -1 && torifyables && torifyables.indexOf('tor_otsoperations') !== -1 ) { %> - "TOR_HOST=tor" - "TOR_PORT=9050" <% } %> diff --git a/cyphernodeconf_docker/templates/installer/testdeployment.sh b/cyphernodeconf_docker/templates/installer/testdeployment.sh index 06f1cdc..8b15eb2 100644 --- a/cyphernodeconf_docker/templates/installer/testdeployment.sh +++ b/cyphernodeconf_docker/templates/installer/testdeployment.sh @@ -79,7 +79,7 @@ fi printf "\r\n\033[0;92mDepending on your current location and DNS settings, point your favorite browser to one of the following URLs to access Cyphernode's status page:\r\n" printf "\r\n" printf "\033[0;95m<% cns.forEach(cn => { %><%= ('https://' + cn + ':' + traefik_https_port + '/welcome\\r\\n') %><% }) %>\033[0m\r\n" -<% if ( torifyables && torifyables.indexOf('tor_traefik') !== -1 ) { %> +<% if ( features.indexOf('tor') !== -1 && torifyables && torifyables.indexOf('tor_traefik') !== -1 ) { %> printf "\033[0;92mYou can also use Tor Browser and navigate to your onion address:\r\n" printf "\033[0;95mhttps://${TOR_TRAEFIK_HOSTNAME}:<%= traefik_https_port %>/welcome\033[0m\r\n\r\n" <% } %> diff --git a/cyphernodeconf_docker/templates/lightning/c-lightning/config b/cyphernodeconf_docker/templates/lightning/c-lightning/config index 98322b6..5e7bf1b 100644 --- a/cyphernodeconf_docker/templates/lightning/c-lightning/config +++ b/cyphernodeconf_docker/templates/lightning/c-lightning/config @@ -16,7 +16,7 @@ rgb=<%= lightning_nodecolor %> addr=0.0.0.0:9735 -<% if ( torifyables && torifyables.indexOf('tor_lightning') !== -1 ) { %> +<% if ( features.indexOf('tor') !== -1 && torifyables && torifyables.indexOf('tor_lightning') !== -1 ) { %> # Tor # proxy=tor:9050 this has to be made at execution time because of getaddrinfo and alpine not being friends, see entrypoint.sh <% if ( !clearnet || clearnet.indexOf('clearnet_lightning') === -1 ) { %> diff --git a/cyphernodeconf_docker/templates/lightning/c-lightning/entrypoint.sh b/cyphernodeconf_docker/templates/lightning/c-lightning/entrypoint.sh index 030ca9d..4b0817a 100755 --- a/cyphernodeconf_docker/templates/lightning/c-lightning/entrypoint.sh +++ b/cyphernodeconf_docker/templates/lightning/c-lightning/entrypoint.sh @@ -6,7 +6,7 @@ while [ ! -f "/container_monitor/bitcoin_ready" ]; do echo "bitcoin not ready" ; echo "bitcoin ready" -<% if ( torifyables && torifyables.indexOf('tor_lightning') !== -1 ) { %> +<% if ( features.indexOf('tor') !== -1 && torifyables && torifyables.indexOf('tor_lightning') !== -1 ) { %> #while [ ! -f "/container_monitor/tor_ready" ]; do echo "tor not ready" ; sleep 10 ; done while [ -z "${TORIP}" ]; do echo "tor not ready" ; TORIP=$(getent hosts tor | awk '{ print $1 }') ; sleep 10 ; done