From 4b72317260c73b844ed0784cf739571b4156a78e Mon Sep 17 00:00:00 2001 From: jash Date: Thu, 6 Dec 2018 19:37:08 +0100 Subject: [PATCH] localhost and 127.0.0.1 are always added to the gatekeeper cert, the current hostname will be set as default hostname, which can be changed during configuraion --- dist/setup.sh | 1 + install/generator-cyphernode/generators/app/index.js | 2 +- install/generator-cyphernode/generators/app/lib/cert.js | 6 ++++-- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/dist/setup.sh b/dist/setup.sh index 9550e66..945dd1d 100755 --- a/dist/setup.sh +++ b/dist/setup.sh @@ -177,6 +177,7 @@ configure() { # configure features of cyphernode docker run -v $current_path:/data \ -e DEFAULT_USER=$USER \ + -e DEFAULT_CERT_HOSTNAME=$(hostname) \ --log-driver=none$pw_env \ --network none \ --rm$interactive cyphernode/cyphernodeconf:cyphernode-0.05 $(id -u):$(id -g) yo --no-insight cyphernode$gen_options $recreate diff --git a/install/generator-cyphernode/generators/app/index.js b/install/generator-cyphernode/generators/app/index.js index 74d0f3c..5507666 100644 --- a/install/generator-cyphernode/generators/app/index.js +++ b/install/generator-cyphernode/generators/app/index.js @@ -364,7 +364,7 @@ module.exports = class extends Generator { gatekeeper_keys: { configEntries: [], clientInformation: [] }, gatekeeper_sslcert: '', gatekeeper_sslkey: '', - gatekeeper_cns: '', + gatekeeper_cns: process.env['DEFAULT_CERT_HOSTNAME'] || '', proxy_datapath: '', lightning_implementation: 'c-lightning', lightning_datapath: '', diff --git a/install/generator-cyphernode/generators/app/lib/cert.js b/install/generator-cyphernode/generators/app/lib/cert.js index 01fdde4..8f2986f 100644 --- a/install/generator-cyphernode/generators/app/lib/cert.js +++ b/install/generator-cyphernode/generators/app/lib/cert.js @@ -64,6 +64,8 @@ module.exports = class Cert { async create( cns ) { cns = cns || []; + cns = cns.concat(['127.0.0.1','localhost']); + let args = defaultArgs.slice(); const certFileTmp = tmp.fileSync(); @@ -84,9 +86,9 @@ module.exports = class Cert { const conf = this.buildConfig( cns ); fs.writeFileSync( confFileTmp.name, conf ); - + const openssl = spawn('openssl', args, { stdio: ['ignore', 'ignore', 'ignore'] } ); - + let code = await new Promise( function(resolve, reject) { openssl.on('exit', (code) => { resolve(code);