diff --git a/cyphernodeconf_docker/lib/app.js b/cyphernodeconf_docker/lib/app.js index 60ab3be..1ba1331 100644 --- a/cyphernodeconf_docker/lib/app.js +++ b/cyphernodeconf_docker/lib/app.js @@ -275,9 +275,16 @@ module.exports = class App { // Tor... if( this.isChecked( 'features', 'tor' ) ) { const torgen = new TorGen(); - this.sessionData.tor_traefik_hostname = await torgen.generateTorFiles(this.destinationPath( path.join( destinationDirName, 'tor/traefik/hidden_service' ) )); - this.sessionData.tor_ln_hostname = await torgen.generateTorFiles(this.destinationPath( path.join( destinationDirName, 'tor/ln/hidden_service' ) )); - this.sessionData.tor_bitcoin_hostname = await torgen.generateTorFiles(this.destinationPath( path.join( destinationDirName, 'tor/bitcoin/hidden_service' ) )); + + if (this.isChecked('torifyables', 'tor_traefik')) { + this.sessionData.tor_traefik_hostname = await torgen.generateTorFiles(this.destinationPath( path.join( destinationDirName, 'tor/traefik/hidden_service' ) )); + } + if (this.isChecked('torifyables', 'tor_ln')) { + this.sessionData.tor_ln_hostname = await torgen.generateTorFiles(this.destinationPath( path.join( destinationDirName, 'tor/ln/hidden_service' ) )); + } + if (this.isChecked('torifyables', 'tor_bitcoin')) { + this.sessionData.tor_bitcoin_hostname = await torgen.generateTorFiles(this.destinationPath( path.join( destinationDirName, 'tor/bitcoin/hidden_service' ) )); + } } // creates keys if they don't exist or we say so. diff --git a/cyphernodeconf_docker/schema/config-v0.2.3.json b/cyphernodeconf_docker/schema/config-v0.2.3.json index 28589ec..f3dd6b8 100644 --- a/cyphernodeconf_docker/schema/config-v0.2.3.json +++ b/cyphernodeconf_docker/schema/config-v0.2.3.json @@ -204,7 +204,7 @@ "$id": "#/properties/torifyables/items", "type": "string", "enum": [ - "tor_hiddenservice", + "tor_traefik", "tor_bitcoin", "tor_ln", "tor_otsoperations", @@ -215,7 +215,7 @@ "title": "The Torified feature", "default": "", "examples": [ - "tor_hiddenservice", + "tor_traefik", "tor_bitcoin", "tor_l", "tor_otsoperations", diff --git a/cyphernodeconf_docker/templates/installer/config.sh b/cyphernodeconf_docker/templates/installer/config.sh index 66865df..cdabfe0 100644 --- a/cyphernodeconf_docker/templates/installer/config.sh +++ b/cyphernodeconf_docker/templates/installer/config.sh @@ -13,6 +13,7 @@ TOR_DATAPATH=<%= tor_datapath %> TOR_OTS_WEBHOOKS=<%= (torifyables.indexOf('tor_otswebhooks') != -1)?'true':'false' %> TOR_ADDR_WATCH_WEBHOOKS=<%= (torifyables.indexOf('tor_addrwatcheswebhooks') != -1)?'true':'false' %> TOR_TXID_WATCH_WEBHOOKS=<%= (torifyables.indexOf('tor_txidwatcheswebhooks') != -1)?'true':'false' %> +TOR_TRAEFIK=<%= (torifyables.indexOf('tor_traefik') != -1)?'true':'false' %> TOR_BITCOIN=<%= (torifyables.indexOf('tor_bitcoin') != -1)?'true':'false' %> TOR_LN=<%= (torifyables.indexOf('tor_ln') != -1)?'true':'false' %> <% } %> diff --git a/cyphernodeconf_docker/templates/installer/testdeployment.sh b/cyphernodeconf_docker/templates/installer/testdeployment.sh index 5f47102..8d00d56 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 ( features.indexOf('tor') !== -1 ) { %> +<% if ( 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/tor/torrc b/cyphernodeconf_docker/templates/tor/torrc index 1912775..8fa3630 100644 --- a/cyphernodeconf_docker/templates/tor/torrc +++ b/cyphernodeconf_docker/templates/tor/torrc @@ -1,21 +1,21 @@ -<% if ( torifyables.indexOf('tor_hiddenservice') !== -1 ) { %> +<% if ( torifyables.indexOf('tor_traefik') !== -1 ) { %> HiddenServiceDir /tor/traefik/hidden_service/ HiddenServiceVersion 3 HiddenServicePort <%= traefik_http_port %> traefik:<%= traefik_http_port %> HiddenServicePort <%= traefik_https_port %> traefik:<%= traefik_https_port %> -<% if ( torifyables.indexOf('tor_ln') !== -1 && lightning_expose ) { %> +<% } %> +<% if ( torifyables.indexOf('tor_ln') !== -1 && lightning_expose ) { %> HiddenServiceDir /tor/ln/hidden_service/ HiddenServiceVersion 3 HiddenServicePort 9735 lightning:9735 <% } %> -<% if ( torifyables.indexOf('tor_bitcoin') !== -1 && bitcoin_expose) { %> +<% if ( torifyables.indexOf('tor_bitcoin') !== -1 && bitcoin_expose) { %> HiddenServiceDir /tor/bitcoin/hidden_service/ HiddenServiceVersion 3 HiddenServicePort 8333 bitcoin:8333 <% } %> -<% } %> SocksPort 0.0.0.0:9050 ExitPolicy reject *:* # no exits allowed diff --git a/cyphernodeconf_docker/torifyables.json b/cyphernodeconf_docker/torifyables.json index b6eefc2..6e61073 100644 --- a/cyphernodeconf_docker/torifyables.json +++ b/cyphernodeconf_docker/torifyables.json @@ -1,7 +1,7 @@ [ { - "name": "Cyphernode as Hidden Service", - "value": "tor_hiddenservice" + "name": "Traefik web proxy", + "value": "tor_traefik" }, { "name": "Bitcoin Node", diff --git a/dist/setup.sh b/dist/setup.sh index c54331a..a630328 100755 --- a/dist/setup.sh +++ b/dist/setup.sh @@ -405,11 +405,13 @@ install_docker() { sudo_if_required chmod 700 $TOR_DATAPATH next fi - if [ ! -d $TOR_DATAPATH/traefik ]; then - step " create $TOR_DATAPATH/traefik" - sudo_if_required mkdir -p $TOR_DATAPATH/traefik/hidden_service - sudo_if_required chmod 700 $TOR_DATAPATH/traefik/hidden_service - next + if [[ $TOR_TRAEFIK == true ]]; then + if [ ! -d $TOR_DATAPATH/traefik ]; then + step " create $TOR_DATAPATH/traefik" + sudo_if_required mkdir -p $TOR_DATAPATH/traefik/hidden_service + sudo_if_required chmod 700 $TOR_DATAPATH/traefik/hidden_service + next + fi fi if [[ $TOR_LN == true ]]; then if [ ! -d $TOR_DATAPATH/ln ]; then