Fixed SSH2 dependency on NodeJS 10.4.
Ylian Saint-Hilaire committed
Jun 8, 2021 at 12:14 UTC
919894d7f62dee29eb6d850e9f544838bd705e4a
2 files changed
+17
-7
meshcentral.js
+4
-6
@@ -14,9 +14,6 @@
14
/*jshint esversion: 6 */
15
"use strict";
16
17
-// If running NodeJS less than version 8, try to polyfill promisify
18
-try { if (Number(process.version.match(/^v(\d+\.\d+)/)[1]) < 8) { require('util.promisify').shim(); } } catch (ex) { }
19
-
17
// If app metrics is available
18
if (process.argv[2] == '--launch') { try { require('appmetrics-dash').monitor({ url: '/', title: 'MeshCentral', port: 88, host: '127.0.0.1' }); } catch (e) { } }
19
@@ -3131,7 +3128,8 @@ function mainStart() {
3128
for (var i in config.domains) { if (typeof config.domains[i].auth == 'string') { config.domains[i].auth = config.domains[i].auth.toLowerCase(); } }
3129
3130
// Get the current node version
3134
- var nodeVersion = Number(process.version.match(/^v(\d+\.\d+)/)[1]);
3131
+ const verSplit = process.version.substring(1).split('.');
3132
+ var nodeVersion = parseInt(verSplit[0]) + (parseInt(verSplit[1]) / 100);
3133
3134
// Check if Windows SSPI, LDAP, Passport and YubiKey OTP will be used
3135
var sspi = false;
@@ -3155,7 +3153,7 @@ function mainStart() {
3153
if (config.domains[i].yubikey != null) { yubikey = true; }
3154
if (config.domains[i].auth == 'ldap') { ldap = true; }
3155
if (config.domains[i].mstsc === true) { mstsc = true; }
3158
- if (config.domains[i].ssh === true) { ssh = true; }
3156
+ if (config.domains[i].ssh === true) { if (nodeVersion < 10.04) { config.domains[i].ssh = false; } ssh = true; }
3157
if ((typeof config.domains[i].authstrategies == 'object')) {
3158
if (passport == null) { passport = ['passport']; }
3159
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() {
3172
if (require('os').platform() == 'win32') { modules.push('node-windows'); modules.push('loadavg-windows'); if (sspi == true) { modules.push('node-sspi'); } } // Add Windows modules
3173
if (ldap == true) { modules.push('ldapauth-fork'); }
3174
if (mstsc == true) { modules.push('node-rdpjs-2'); }
3177
- if (ssh == true) { modules.push('ssh2'); }
3175
+ if (ssh == true) { if (nodeVersion < 10.04) { addServerWarning('MeshCentral SSH support required NodeJS 10.4 or higher.'); } else { modules.push('ssh2'); } }
3176
if (passport != null) { modules.push(...passport); }
3177
if (sessionRecording == true) { modules.push('image-size'); } // Need to get the remote desktop JPEG sizes to index the recodring file.
3178
if (config.letsencrypt != null) { modules.push('acme-client'); } // Add acme-client module
package.json
+13
-1
@@ -36,6 +36,8 @@
36
"sample-config-advanced.json"
37
],
38
"dependencies": {
39
+ "archiver": "^4.0.2",
40
+ "archiver-zip-encrypted": "^1.0.9",
41
"body-parser": "^1.19.0",
42
"cbor": "~5.2.0",
43
"compression": "^1.7.4",
@@ -43,14 +45,24 @@
45
"express": "^4.17.0",
46
"express-handlebars": "^3.1.0",
47
"express-ws": "^5.0.1",
48
+ "image-size": "^1.0.0",
49
"ipcheck": "^0.1.0",
50
+ "loadavg-windows": "^1.1.1",
51
"minimist": "^1.2.0",
52
+ "mongodb": "^3.6.9",
53
"multiparty": "^4.2.2",
54
"nedb": "^1.8.0",
55
"node-forge": "^0.10.0",
56
+ "node-rdpjs-2": "^0.3.5",
57
+ "node-windows": "^1.0.0-beta.5",
58
+ "otplib": "^10.2.3",
59
+ "saslprep": "^1.0.3",
60
+ "ssh2": "^1.1.0",
61
+ "web-push": "^3.4.4",
62
"ws": "^7.4.6",
63
"xmldom": "^0.5.0",
53
- "yauzl": "^2.10.0"
64
+ "yauzl": "^2.10.0",
65
+ "yubikeyotp": "^0.2.0"
66
},
67
"repository": {
68
"type": "git",