From b5d28eb5cd535ef3a79f86bf4b4ab557f838f00a Mon Sep 17 00:00:00 2001 From: "Josh M. McKee" Date: Thu, 1 Jun 2017 21:39:26 +0000 Subject: [PATCH 1/3] Remove -- from new switch --- misc/install.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/misc/install.sh b/misc/install.sh index 915d3355..466653d5 100755 --- a/misc/install.sh +++ b/misc/install.sh @@ -104,7 +104,7 @@ enigma_footer() { If this is the first time you've installed ENiGMA½, you now need to generate a minimal configuration. To do so, run the following commands: cd ${ENIGMA_INSTALL_DIR} - ./oputil.js config --new + ./oputil.js config new Additionally, the following support binaires are recommended: 7zip: Archive support @@ -133,4 +133,4 @@ download_enigma_source install_node_packages enigma_footer -} # this ensures the entire script is downloaded before execution \ No newline at end of file +} # this ensures the entire script is downloaded before execution From 3b877ec7639d7ddf41e6643a8b87eafeec43224b Mon Sep 17 00:00:00 2001 From: "Josh M. McKee" Date: Thu, 1 Jun 2017 21:40:32 +0000 Subject: [PATCH 2/3] Add note about node path --- misc/install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/misc/install.sh b/misc/install.sh index 466653d5..44554da1 100755 --- a/misc/install.sh +++ b/misc/install.sh @@ -101,7 +101,7 @@ enigma_footer() { log "ENiGMA½ installation complete!" echo -e "\e[33m" cat << EndOfMessage -If this is the first time you've installed ENiGMA½, you now need to generate a minimal configuration. To do so, run the following commands: +If this is the first time you've installed ENiGMA½, you now need to generate a minimal configuration. To do so, run the following commands (note: if you did not already have node.js installed, you may need to log out/back in to refresh your path): cd ${ENIGMA_INSTALL_DIR} ./oputil.js config new From ab8cb77f81fa85e1a0c221c9d198b294f82f7e6e Mon Sep 17 00:00:00 2001 From: Bryan Ashby Date: Thu, 1 Jun 2017 18:48:14 -0600 Subject: [PATCH 3/3] * secureProxy -> proxied in webSocket config * Add support for X-Forwarded-For and X-Real-IP in WebSocket for remoteAddr --- core/servers/login/websocket.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/core/servers/login/websocket.js b/core/servers/login/websocket.js index 41a3e838..1a9a1ed1 100644 --- a/core/servers/login/websocket.js +++ b/core/servers/login/websocket.js @@ -25,7 +25,7 @@ const ModuleInfo = exports.moduleInfo = { function WebSocketClient(ws, req, serverType) { Object.defineProperty(this, 'isSecure', { - get : () => ('secure' === serverType || true === this.secureProxyConnection) ? true : false, + get : () => ('secure' === serverType || true === this.proxied) ? true : false, }); // @@ -47,7 +47,8 @@ function WebSocketClient(ws, req, serverType) { } get remoteAddress() { - return req.connection.remoteAddress; + // Support X-Forwarded-For and X-Real-IP headers for proxied connections + return (this.proxied && (req.headers['x-forwarded-for'] || req.headers['x-real-ip'])) || req.connection.remoteAddress; } }(ws); @@ -75,11 +76,11 @@ function WebSocketClient(ws, req, serverType) { // If the config allows it, look for 'x-forwarded-proto' as "https" // to override |isSecure| // - if(true === _.get(Config, 'loginServers.webSocket.secureProxy') && + if(true === _.get(Config, 'loginServers.webSocket.proxied') && 'https' === req.headers['x-forwarded-proto']) { - Log.debug(`Assuming secure connection due to X-Forwarded-Proto of ${req.headers['x-forwarded-proto']}`); - this.secureProxyConnection = true; + Log.debug(`Assuming secure connection due to X-Forwarded-Proto of "${req.headers['x-forwarded-proto']}"`); + this.proxied = true; } // start handshake process