From 919894d7f62dee29eb6d850e9f544838bd705e4a Mon Sep 17 00:00:00 2001 From: Ylian Saint-Hilaire Date: Tue, 8 Jun 2021 12:14:20 -0700 Subject: [PATCH] Fixed SSH2 dependency on NodeJS 10.4. --- meshcentral.js | 10 ++++------ package.json | 14 +++++++++++++- 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/meshcentral.js b/meshcentral.js index 40d57361..ca33d22f 100644 --- a/meshcentral.js +++ b/meshcentral.js @@ -14,9 +14,6 @@ /*jshint esversion: 6 */ "use strict"; -// If running NodeJS less than version 8, try to polyfill promisify -try { if (Number(process.version.match(/^v(\d+\.\d+)/)[1]) < 8) { require('util.promisify').shim(); } } catch (ex) { } - // If app metrics is available if (process.argv[2] == '--launch') { try { require('appmetrics-dash').monitor({ url: '/', title: 'MeshCentral', port: 88, host: '127.0.0.1' }); } catch (e) { } } @@ -3131,7 +3128,8 @@ function mainStart() { for (var i in config.domains) { if (typeof config.domains[i].auth == 'string') { config.domains[i].auth = config.domains[i].auth.toLowerCase(); } } // Get the current node version - var nodeVersion = Number(process.version.match(/^v(\d+\.\d+)/)[1]); + const verSplit = process.version.substring(1).split('.'); + var nodeVersion = parseInt(verSplit[0]) + (parseInt(verSplit[1]) / 100); // Check if Windows SSPI, LDAP, Passport and YubiKey OTP will be used var sspi = false; @@ -3155,7 +3153,7 @@ function mainStart() { if (config.domains[i].yubikey != null) { yubikey = true; } if (config.domains[i].auth == 'ldap') { ldap = true; } if (config.domains[i].mstsc === true) { mstsc = true; } - if (config.domains[i].ssh === true) { ssh = true; } + if (config.domains[i].ssh === true) { if (nodeVersion < 10.04) { config.domains[i].ssh = false; } ssh = true; } if ((typeof config.domains[i].authstrategies == 'object')) { if (passport == null) { passport = ['passport']; } if ((typeof config.domains[i].authstrategies.twitter == 'object') && (typeof config.domains[i].authstrategies.twitter.clientid == 'string') && (typeof config.domains[i].authstrategies.twitter.clientsecret == 'string') && (passport.indexOf('passport-twitter') == -1)) { passport.push('passport-twitter'); } @@ -3174,7 +3172,7 @@ function mainStart() { if (require('os').platform() == 'win32') { modules.push('node-windows'); modules.push('loadavg-windows'); if (sspi == true) { modules.push('node-sspi'); } } // Add Windows modules if (ldap == true) { modules.push('ldapauth-fork'); } if (mstsc == true) { modules.push('node-rdpjs-2'); } - if (ssh == true) { modules.push('ssh2'); } + if (ssh == true) { if (nodeVersion < 10.04) { addServerWarning('MeshCentral SSH support required NodeJS 10.4 or higher.'); } else { modules.push('ssh2'); } } if (passport != null) { modules.push(...passport); } if (sessionRecording == true) { modules.push('image-size'); } // Need to get the remote desktop JPEG sizes to index the recodring file. if (config.letsencrypt != null) { modules.push('acme-client'); } // Add acme-client module diff --git a/package.json b/package.json index 152ec079..54476110 100644 --- a/package.json +++ b/package.json @@ -36,6 +36,8 @@ "sample-config-advanced.json" ], "dependencies": { + "archiver": "^4.0.2", + "archiver-zip-encrypted": "^1.0.9", "body-parser": "^1.19.0", "cbor": "~5.2.0", "compression": "^1.7.4", @@ -43,14 +45,24 @@ "express": "^4.17.0", "express-handlebars": "^3.1.0", "express-ws": "^5.0.1", + "image-size": "^1.0.0", "ipcheck": "^0.1.0", + "loadavg-windows": "^1.1.1", "minimist": "^1.2.0", + "mongodb": "^3.6.9", "multiparty": "^4.2.2", "nedb": "^1.8.0", "node-forge": "^0.10.0", + "node-rdpjs-2": "^0.3.5", + "node-windows": "^1.0.0-beta.5", + "otplib": "^10.2.3", + "saslprep": "^1.0.3", + "ssh2": "^1.1.0", + "web-push": "^3.4.4", "ws": "^7.4.6", "xmldom": "^0.5.0", - "yauzl": "^2.10.0" + "yauzl": "^2.10.0", + "yubikeyotp": "^0.2.0" }, "repository": { "type": "git",