2FA fixes.

This commit is contained in:
Ylian Saint-Hilaire 2021-02-21 10:35:37 -08:00
parent d97aecab90
commit 6e1ba774aa
5 changed files with 880 additions and 910 deletions

View File

@ -621,11 +621,14 @@
<Folder Include="typings\" />
<Folder Include="typings\globals\" />
<Folder Include="typings\globals\ajv\" />
<Folder Include="typings\globals\axios\" />
<Folder Include="typings\globals\connect-redis\" />
<Folder Include="typings\globals\cookie-session\" />
<Folder Include="typings\globals\express-handlebars\" />
<Folder Include="typings\globals\express-session\" />
<Folder Include="typings\globals\handlebars\" />
<Folder Include="typings\globals\jsbn\" />
<Folder Include="typings\globals\moment\" />
<Folder Include="typings\globals\node-forge\" />
<Folder Include="typings\globals\nodemailer\" />
<Folder Include="typings\globals\node\" />
@ -635,11 +638,14 @@
</ItemGroup>
<ItemGroup>
<TypeScriptCompile Include="typings\globals\ajv\index.d.ts" />
<TypeScriptCompile Include="typings\globals\axios\index.d.ts" />
<TypeScriptCompile Include="typings\globals\connect-redis\index.d.ts" />
<TypeScriptCompile Include="typings\globals\cookie-session\index.d.ts" />
<TypeScriptCompile Include="typings\globals\express-handlebars\index.d.ts" />
<TypeScriptCompile Include="typings\globals\express-session\index.d.ts" />
<TypeScriptCompile Include="typings\globals\handlebars\index.d.ts" />
<TypeScriptCompile Include="typings\globals\jsbn\index.d.ts" />
<TypeScriptCompile Include="typings\globals\moment\index.d.ts" />
<TypeScriptCompile Include="typings\globals\node-forge\index.d.ts" />
<TypeScriptCompile Include="typings\globals\nodemailer\index.d.ts" />
<TypeScriptCompile Include="typings\globals\node\index.d.ts" />

View File

@ -2695,7 +2695,7 @@ function CreateMeshCentralServer(config, args) {
// Decode a cookie back into an object using a key using AES256-GCM or AES128-CBC/HMAC-SHA384. Return null if it's not a valid cookie. (key must be 32 bytes or more)
obj.decodeCookie = function (cookie, key, timeout) {
if ((cookie == null) || (key == null)) return null;
if (cookie == null) return null;
var r = obj.decodeCookieAESGCM(cookie, key, timeout);
if (r == null) { r = obj.decodeCookieAESSHA(cookie, key, timeout); }
if ((r == null) && (obj.args.cookieencoding == null) && (cookie.length != 64) && ((cookie == cookie.toLowerCase()) || (cookie == cookie.toUpperCase()))) {
@ -3126,7 +3126,10 @@ function mainStart() {
if (config.settings.desktopmultiplex === true) { modules.push('image-size'); }
// SMS support
if ((config.sms != null) && (config.sms.provider == 'twilio')) { modules.push('twilio'); }
if ((config.sms != null) && (config.sms.provider == 'twilio')) {
const NodeJSVer = Number(process.version.match(/^v(\d+\.\d+)/)[1]);
if (NodeJSVer < 8) { console.log("SMS Twilio support requires Node v8 or above, current version is " + process.version + "."); } else { modules.push('twilio'); }
}
if ((config.sms != null) && (config.sms.provider == 'plivo')) {
const NodeJSVer = Number(process.version.match(/^v(\d+\.\d+)/)[1]);
if (NodeJSVer < 8) { console.log("SMS Plivo support requires Node v8 or above, current version is " + process.version + "."); } else { modules.push('plivo'); }

View File

@ -2700,10 +2700,12 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use
if (command.resetNextLogin === true) { chguser.passchange = -1; } else { chguser.passchange = Math.floor(Date.now() / 1000); }
delete chguser.passtype; // Remove the password type if one was present.
if (command.removeMultiFactor == true) {
if (chguser.otpekey) { delete chguser.otpekey; }
if (chguser.otpsecret) { delete chguser.otpsecret; }
if (chguser.otphkeys) { delete chguser.otphkeys; }
if (chguser.otpkeys) { delete chguser.otpkeys; }
if (chguser.otpekey != null) { delete chguser.otpekey; }
if (chguser.otpsecret != null) { delete chguser.otpsecret; }
if (chguser.otphkeys != null) { delete chguser.otphkeys; }
if (chguser.otpkeys != null) { delete chguser.otpkeys; }
if ((chguser.otpekey != null) && (((typeof domain.passwordrequirements != 'object') || (domain.passwordrequirements.email2factor != false)) && (domain.mailserver != null))) { delete chguser.otpekey; }
if ((chguser.phone != null) && (parent.parent.smsserver != null)) { delete chguser.phone; }
}
db.SetUser(chguser);

View File

@ -36,6 +36,9 @@
"sample-config-advanced.json"
],
"dependencies": {
"@sendgrid/mail": "^7.4.2",
"archiver": "^4.0.2",
"archiver-zip-encrypted": "^1.0.8",
"body-parser": "^1.19.0",
"cbor": "~5.2.0",
"compression": "^1.7.4",
@ -44,14 +47,23 @@
"express": "^4.17.0",
"express-handlebars": "^3.1.0",
"express-ws": "^4.0.0",
"image-size": "^0.9.3",
"ipcheck": "^0.1.0",
"minimist": "^1.2.0",
"mongodb": "^3.6.4",
"multiparty": "^4.2.1",
"nedb": "^1.8.0",
"node-forge": "^0.10.0",
"node-rdpjs-2": "^0.3.5",
"node-windows": "^0.1.14",
"otplib": "^10.2.3",
"saslprep": "^1.0.3",
"twilio": "^3.56.0",
"web-push": "^3.4.4",
"ws": "^6.2.1",
"xmldom": "^0.1.27",
"yauzl": "^2.10.0"
"yauzl": "^2.10.0",
"yubikeyotp": "^0.2.0"
},
"repository": {
"type": "git",

File diff suppressed because one or more lines are too long