Added TORification info on components for info.json / welcome app

This commit is contained in:
kexkey
2019-12-09 15:59:40 -05:00
committed by kexkey
parent 987d767655
commit 20b6f22e19
8 changed files with 60 additions and 23 deletions

View File

@@ -427,7 +427,9 @@ module.exports = class App {
prune: this.config.data.bitcoin_prune,
prune_size: this.config.data.bitcoin_prune_size,
expose: this.config.data.bitcoin_expose,
uacomment: this.config.data.bitcoin_uacomment
uacomment: this.config.data.bitcoin_uacomment,
torified: this.torifyables.find(data => data.value === 'tor_bitcoinnode').checked,
clearnet: this.isChecked('clearnet', 'clearnet_bitcoinnode')
}
},
{
@@ -446,7 +448,12 @@ module.exports = class App {
label: 'proxy',
host: 'proxy',
networks: ['cyphernodenet'],
docker: 'cyphernode/proxy:'+this.config.docker_versions['cyphernode/proxy']
docker: 'cyphernode/proxy:'+this.config.docker_versions['cyphernode/proxy'],
extra: {
torified_addr_watch_webhooks: this.torifyables.find(data => data.value === 'tor_addrwatcheswebhooks').checked,
torified_txid_watch_webhooks: this.torifyables.find(data => data.value === 'tor_txidwatcheswebhooks').checked,
torified_ots_watch_webhooks: this.torifyables.find(data => data.value === 'tor_otswebhooks').checked
}
},
{
name: 'Proxy cron',
@@ -491,7 +498,11 @@ module.exports = class App {
},
otsclient: {
networks: ['cyphernodenet'],
docker: "cyphernode/otsclient:" + this.config.docker_versions['cyphernode/otsclient']
docker: "cyphernode/otsclient:" + this.config.docker_versions['cyphernode/otsclient'],
extra: {
torified: this.torifyables.find(data => data.value === 'tor_otsoperations').checked,
torified_webhooks: this.torifyables.find(data => data.value === 'tor_otswebhooks').checked
}
},
lightning: {
networks: ['cyphernodenet'],
@@ -501,7 +512,9 @@ module.exports = class App {
nodecolor: this.config.data.lightning_nodecolor,
expose: this.config.data.lightning_expose,
external_ip: this.config.data.lightning_external_ip,
implementation: this.config.data.lightning_implementation
implementation: this.config.data.lightning_implementation,
torified: this.torifyables.find(data => data.value === 'tor_lnnode').checked,
clearnet: this.isChecked('clearnet', 'clearnet_lnnode')
}
}
}

View File

@@ -10,8 +10,6 @@ module.exports = class TorGen {
}
async generateTorFiles() {
// console.log(chalk.green( 'TOR datapath=' + this.path ));
if( !fs.existsSync(this.path) ) {
console.log(chalk.green( 'Creating TOR Hidden Service directory...' ));
fs.mkdirSync(this.path, { recursive: true });
@@ -19,7 +17,7 @@ module.exports = class TorGen {
if( !fs.existsSync(this.path + '/hostname') ) {
console.log(chalk.bold.green( 'Generating TOR Hidden Service secret key, public key and hostname...' ));
console.log(chalk.green( 'Generating TOR Hidden Service secret key, public key and hostname...' ));
const torgenbin = spawn('./torgen/torgen', [this.path]);
try {
@@ -29,14 +27,13 @@ module.exports = class TorGen {
return "";
}
// console.log(chalk.bold.green( 'Generated TOR Hidden Service secret key, public key and hostname.' ));
} else {
console.log(chalk.red('TOR config files already exist, skipping generation') );
console.log(chalk.green('TOR config files already exist, skipping TOR generation.') );
}
try {
var data = fs.readFileSync(this.path + '/hostname', 'utf8');
// Remove the LF at the end of the host name
return data.slice(0, -1);
} catch (err) {
console.log(chalk.bold.red('Error: ' + err) );

View File

@@ -33,7 +33,7 @@ module.exports = {
type: 'checkbox',
name: 'clearnet',
default: utils.getDefault( 'clearnet' ),
message: prefix()+'What features do you want to allow using clearnet?'+utils.getHelp('clearnet'),
message: prefix()+'What features do you want to also allow using clearnet?'+utils.getHelp('clearnet'),
choices: [{
name: "Bitcoin Node",
value: "clearnet_bitcoinnode"

View File

@@ -321,7 +321,7 @@
"compose"
],
"title": "How to run the containers",
"default": "compose",
"default": "swarm",
"examples": [
"compose"
]

View File

@@ -17,7 +17,7 @@ zmqpubrawtx=tcp://0.0.0.0:18502
listen=1
<% if ( features.indexOf('tor_bitcoinnode') !== -1 ) { %>
<% if ( torifyables.indexOf('tor_bitcoinnode') !== -1 ) { %>
#tor
proxy=tor:9050
<% if ( clearnet.indexOf('clearnet_bitcoinnode') == -1 ) { %>

View File

@@ -26,7 +26,7 @@ always-use-proxy=true
#disable-dns
<% if (lightning_announce) { %>
# Announcing TOR address
announce-addr=<%= locals.tor_hostname %>:1234
announce-addr=<%= locals.tor_hostname %>:9735
<% if ( clearnet.indexOf('clearnet_lnnode') !== -1 ) { %>
<% if( locals.lightning_external_ip ) { %>
# Announcing clearnet address

View File

@@ -3,8 +3,11 @@ HiddenServiceDir /tor/hidden_service/
HiddenServiceVersion 3
HiddenServicePort 80 traefik:80
HiddenServicePort 443 traefik:443
<% if ( features.indexOf('lightning') !== -1 ) { %>
HiddenServicePort 1234 lightning:9735
<% if ( torifyables.indexOf('tor_lnnode') !== -1 && lightning_expose ) { %>
HiddenServicePort 9735 lightning:9735
<% } %>
<% if ( torifyables.indexOf('tor_bitcoinnode') !== -1 && bitcoin_expose) { %>
HiddenServicePort 8333 bitcoin:8333
<% } %>
<% } %>

View File

@@ -83,9 +83,17 @@ func main() {
fileBytes.Write(bytes.Repeat([]byte{0x00}, 3))
fileBytes.Write(h[:])
prvFile, _ := os.Create(path + "/hs_ed25519_secret_key")
fileBytes.WriteTo(prvFile)
prvFile.Close()
prvFile, err := os.Create(path + "/hs_ed25519_secret_key")
if err != nil {
fmt.Println(err)
os.Exit(1)
}
_, err = fileBytes.WriteTo(prvFile)
if err != nil {
fmt.Println(err)
os.Exit(1)
}
err = prvFile.Close()
// Create the Tor Hidden Service public key file
fmt.Println("Creating public file...")
@@ -94,8 +102,16 @@ func main() {
fileBytes.Write(bytes.Repeat([]byte{0x00}, 3))
fileBytes.Write([]byte(publicKey))
pubFile, _ := os.Create(path + "/hs_ed25519_public_key")
fileBytes.WriteTo(pubFile)
pubFile, err := os.Create(path + "/hs_ed25519_public_key")
if err != nil {
fmt.Println(err)
os.Exit(1)
}
_, err = fileBytes.WriteTo(pubFile)
if err != nil {
fmt.Println(err)
os.Exit(1)
}
pubFile.Close()
// From https://github.com/rdkr/oniongen-go
@@ -116,8 +132,16 @@ func main() {
// Create the Tor Hidden Service hostname file
fmt.Println("Creating onion address file...")
nameFile, _ := os.Create(path + "/hostname")
nameFile.WriteString(strings.ToLower(onionAddress) + ".onion\n")
nameFile, err := os.Create(path + "/hostname")
if err != nil {
fmt.Println(err)
os.Exit(1)
}
_, err = nameFile.WriteString(strings.ToLower(onionAddress) + ".onion\n")
if err != nil {
fmt.Println(err)
os.Exit(1)
}
nameFile.Close()
fmt.Println("Done!")