More TOR configurations

This commit is contained in:
kexkey
2019-12-09 11:08:35 -05:00
committed by kexkey
parent 51cb4a2e9a
commit d0afa09181
12 changed files with 56 additions and 40 deletions

17
.vscode/launch.json vendored
View File

@@ -1,17 +0,0 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Launch",
"type": "go",
"request": "launch",
"mode": "auto",
"program": "${fileDirname}",
"env": {},
"args": []
}
]
}

View File

@@ -75,3 +75,17 @@ module.exports = {
//
// What is your public IP address?
// TOR
// - HS
// - torrc
// - hostname, secret, public
// - Bitcoin Node
// - bitcoin.conf:
// - LN Node
// - config
// - OTS
// - OTS webhooks
// - Address Watch webhooks
// - TXID Watch webhooks
// - Clearnet Bitcoin Node
// - Clearnet LN Node

View File

@@ -53,8 +53,11 @@ module.exports = {
default: utils.getDefault( 'lightning_announce' ),
message: prefix()+'Do you want to announce your lightning node?'+utils.getHelp('lightning_announce'),
},
/*
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 },
when: (props) => { return featureCondition(props) && props.lightning_announce && (props.torifyables.indexOf('tor_lnnode') == -1 || props.clearnet.indexOf('clearnet_lnnode') != -1) },
type: 'input',
name: 'lightning_external_ip',
default: utils.getDefault( 'lightning_external_ip' ),

View File

@@ -15,13 +15,14 @@ txindex=1
zmqpubrawblock=tcp://0.0.0.0:18501
zmqpubrawtx=tcp://0.0.0.0:18502
listen=1
<% if ( features.indexOf('tor_bitcoinnode') !== -1 ) { %>
#tor
proxy=tor:9050
<% if ( features.indexOf('clearnet_bitcoinnode') == -1 ) { %>
<% if ( clearnet.indexOf('clearnet_bitcoinnode') == -1 ) { %>
onlynet=onion
<% } %>
listen=1
<% } %>
maxmempool=64
@@ -38,20 +39,17 @@ server=1
test.wallet=watching01.dat
test.wallet=xpubwatching01.dat
test.wallet=spending01.dat
test.wallet=ln01.dat
test.rpcbind=0.0.0.0
<% } else if ( net === 'regtest' ) { %>
regtest.wallet=watching01.dat
regtest.wallet=xpubwatching01.dat
regtest.wallet=spending01.dat
regtest.wallet=ln01.dat
regtest.rpcbind=0.0.0.0
regtest.rpcport=18443
<% } else { %>
main.wallet=watching01.dat
main.wallet=xpubwatching01.dat
main.wallet=spending01.dat
main.wallet=ln01.dat
main.rpcbind=0.0.0.0
<% } %>

View File

@@ -10,6 +10,9 @@ TRAEFIK_DATAPATH=<%= traefik_datapath %>
FEATURE_TOR=<%= (features.indexOf('tor') != -1)?'true':'false' %>
<% if ( features.indexOf('tor') !== -1 ) { %>
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' %>
<% } %>
DOCKER_MODE=<%= docker_mode %>
RUN_AS_USER=<%= run_as_different_user?username:'' %>

View File

@@ -224,7 +224,7 @@ services:
<% if (net === 'testnet') { %>
- "TESTNET=1"
<% } %>
<% if ( features.indexOf('tor') !== -1 ) { %>
<% if ( torifyables.indexOf('tor_otsoperations') !== -1 ) { %>
- "TOR_HOST=tor"
- "TOR_PORT=9050"
<% } %>

View File

@@ -17,23 +17,28 @@ rgb=<%= lightning_nodecolor %>
addr=0.0.0.0:9735
<% if ( torifyables.indexOf('tor_lnnode') !== -1 ) { %>
#tor
# TOR
proxy=tor:9050
<% if ( clearnet.indexOf('clearnet_lnnode') == -1 ) { %>
# TOR only, no clearnet
always-use-proxy=true
<% } %>
#disable-dns
<% } else { %>
<% if (lightning_announce) { %>
# Announcing TOR address
announce-addr=<%= locals.tor_hostname %>:1234
<% if ( clearnet.indexOf('clearnet_lnnode') !== -1 ) { %>
<% if( locals.lightning_external_ip ) { %>
# Announcing clearnet address
announce-addr=<%= locals.lightning_external_ip %>:9735
<% } %>
<% } %>
<% } %>
<% } else { %>
<% if (lightning_announce) { %>
<% if( locals.lightning_external_ip ) { %>
# Announcing clearnet address
announce-addr=<%= locals.lightning_external_ip %>:9735
<% } %>
<% } %>
<% if (lightning_announce) { %>
<% if ( torifyables.indexOf('tor_lnnode') !== -1 ) { %>
announce-addr=<%= locals.lightning_external_ip %>:1234
<% if ( clearnet.indexOf('clearnet_lnnode') == -1 ) { %>
announce-addr=<%= locals.tor_hostname %>:9735
<% } %>
<% } %>
<% } %>

4
dist/setup.sh vendored
View File

@@ -407,7 +407,9 @@ install_docker() {
fi
copy_file $cyphernodeconf_filepath/tor/torrc $TOR_DATAPATH/torrc 1 $SUDO_REQUIRED
copy_file $cyphernodeconf_filepath/tor/hidden_service/* $TOR_DATAPATH/hidden_service/ 1 $SUDO_REQUIRED
copy_file $cyphernodeconf_filepath/tor/hidden_service/hs_ed25519_secret_key $TOR_DATAPATH/hidden_service/hs_ed25519_secret_key 1 $SUDO_REQUIRED
copy_file $cyphernodeconf_filepath/tor/hidden_service/hs_ed25519_public_key $TOR_DATAPATH/hidden_service/hs_ed25519_public_key 1 $SUDO_REQUIRED
copy_file $cyphernodeconf_filepath/tor/hidden_service/hostname $TOR_DATAPATH/hidden_service/hostname 1 $SUDO_REQUIRED
fi

View File

@@ -249,7 +249,7 @@ curl_callback() {
local returncode
notify_web "${1}" "${2}"
notify_web "${1}" "${2}" ${TOR_ADDR_WATCH_WEBHOOKS}
returncode=$?
trace_rc ${returncode}

View File

@@ -115,7 +115,7 @@ curl_callback_txid() {
local returncode
notify_web "${1}" "${2}"
notify_web "${1}" "${2}" ${TOR_TXID_WATCH_WEBHOOKS}
returncode=$?
trace_rc ${returncode}

View File

@@ -6,6 +6,7 @@ notify_web() {
trace "Entering notify_web()..."
local url=${1}
local torbypass=${3}
# Let's encode the body to base64 so we won't have to escape the special chars...
local body=$(echo "${2}" | base64 | tr -d '\n')
@@ -14,10 +15,17 @@ notify_web() {
local response
local http_code
local curl_code
local msg
if [ -n "${torbypass}" ]; then
msg="{\"response-topic\":\"response/$$\",\"cmd\":\"web\",\"url\":\"${url}\",\"body\":\"${body}\",\"torbypass\":${torbypass}}"
else
msg="{\"response-topic\":\"response/$$\",\"cmd\":\"web\",\"url\":\"${url}\",\"body\":\"${body}\"}"
fi
# We use the pid as the response-topic, so there's no conflict in responses.
trace "[notify_web] mosquitto_rr -h broker -W 21 -t notifier -e \"response/$$\" -m \"{\"response-topic\":\"response/$$\",\"cmd\":\"web\",\"url\":\"${url}\",\"body\":\"${body}\"}\""
response=$(mosquitto_rr -h broker -W 21 -t notifier -e "response/$$" -m "{\"response-topic\":\"response/$$\",\"cmd\":\"web\",\"url\":\"${url}\",\"body\":\"${body}\"}")
trace "[notify_web] mosquitto_rr -h broker -W 21 -t notifier -e \"response/$$\" -m \"${msg}\""
response=$(mosquitto_rr -h broker -W 21 -t notifier -e "response/$$" -m ${msg})
returncode=$?
trace_rc ${returncode}

View File

@@ -213,7 +213,7 @@ serve_ots_backoffice() {
if [ -n ${url} ]; then
trace "[serve_ots_backoffice] url is not empty, now trying to call it!"
notify_web "${url}"
notify_web "${url}" ${TOR_OTS_WEBHOOKS}
returncode=$?
trace_rc ${returncode}