From b4db66f339a2069d9685bb172c1ec3fb0f4c916a Mon Sep 17 00:00:00 2001 From: flechaig Date: Thu, 7 Jul 2022 17:05:47 +0200 Subject: [PATCH 1/2] Allow specifying a host on which to listen even with SSL Allow specifying a host on which to listen even with SSL Grab the IP address from the HOST environment variable and use it to bind the SSL server. Default to 0.0.0.0 IPv6 compliant. --- services/ssl-server.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/services/ssl-server.js b/services/ssl-server.js index c63b7db3..805434ef 100644 --- a/services/ssl-server.js +++ b/services/ssl-server.js @@ -1,3 +1,5 @@ +const host = process.env.HOST || '0.0.0.0'; + const fs = require('fs'); const util = require('util'); const https = require('https'); @@ -38,7 +40,7 @@ const startSSLServer = (app) => { key: fs.readFileSync(httpsCerts.private), cert: fs.readFileSync(httpsCerts.public), }, app); - httpsServer.listen(SSLPort, () => { printSuccess(); }); + httpsServer.listen(SSLPort, host, () => { printSuccess(); }); } }); }; From bd759d63fd5275becf191fd2226bdcee488514b9 Mon Sep 17 00:00:00 2001 From: Alicia Sykes Date: Thu, 7 Jul 2022 18:05:34 +0100 Subject: [PATCH 2/2] =?UTF-8?q?=E2=9A=A1=EF=B8=8F=20Moves=20host=20variabl?= =?UTF-8?q?e=20below=20imports?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- services/ssl-server.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/services/ssl-server.js b/services/ssl-server.js index 805434ef..aee7c284 100644 --- a/services/ssl-server.js +++ b/services/ssl-server.js @@ -1,5 +1,3 @@ -const host = process.env.HOST || '0.0.0.0'; - const fs = require('fs'); const util = require('util'); const https = require('https'); @@ -7,6 +5,8 @@ const https = require('https'); const promise = util.promisify; const stat = promise(fs.stat); +const host = process.env.HOST || '0.0.0.0'; + const httpsCerts = { private: process.env.SSL_PRIV_KEY_PATH || '/etc/ssl/certs/dashy-priv.key', public: process.env.SSL_PUB_KEY_PATH || '/etc/ssl/certs/dashy-pub.pem',