Added SMTP connection options.

Ylian Saint-Hilaire committed Sep 16, 2019 at 10:49 UTC e6fdc3be33cfb2d90ed0130c8474eb93252a7d57
8 files changed +14 -27
agents/meshcmd.js
+1 -1
@@ -47,7 +47,7 @@ var amtMeiTmpState = null;
47 var SMBiosTables = null;
48 var globalDebugFlags = 0; // 1 = IDER Debug
49 var pendingAmtConfigActions = 0;
50 -const RCSMessageProtocolVersion = 1; // RCS Message Protocol Version. Needs to be less than or equal to RCS server Message Protocol Version
50 +var RCSMessageProtocolVersion = 1; // RCS Message Protocol Version. Needs to be less than or equal to RCS server Message Protocol Version
51
52 // MeshCommander for Firmware (GZIP'ed, Base64) v0.7.8
53 var Large_IntelAmtWebApp_etag = "zVObfGF4CXPIxvxSUu+3";
agents/meshcmd.min.js
+1 -1
@@ -47,7 +47,7 @@ var amtMeiTmpState = null;
47 var SMBiosTables = null;
48 var globalDebugFlags = 0; // 1 = IDER Debug
49 var pendingAmtConfigActions = 0;
50 -const RCSMessageProtocolVersion = 1; // RCS Message Protocol Version. Needs to be less than or equal to RCS server Message Protocol Version
50 +var RCSMessageProtocolVersion = 1; // RCS Message Protocol Version. Needs to be less than or equal to RCS server Message Protocol Version
51
52 // MeshCommander for Firmware (GZIP'ed, Base64) v0.7.8
53 var Large_IntelAmtWebApp_etag = "zVObfGF4CXPIxvxSUu+3";
agents/meshcore.js
-10
@@ -1671,16 +1671,6 @@ function createMeshCore(agent)
1671 break;
1672 }
1673 /*
1674 - case 'npm': {
1675 - var child = require('child_process').execFile('C:\\Program Files\\nodejs\\node.exe', ['node.exe', '-v']);
1676 - child.stdout.str = '';
1677 - child.stdout.on('data', function (chunk) { this.str += chunk.toString(); });
1678 - child.waitExit();
1679 - response = 'Response: ' + child.stdout.str;
1680 - break;
1681 - }
1682 - */
1683 - /*
1674 case 'border':
1675 {
1676 if ((args['_'].length == 1) && (args['_'][0] == 'on')) {
agents/meshcore.min.js
-10
@@ -1671,16 +1671,6 @@ function createMeshCore(agent)
1671 break;
1672 }
1673 /*
1674 - case 'npm': {
1675 - var child = require('child_process').execFile('C:\\Program Files\\nodejs\\node.exe', ['node.exe', '-v']);
1676 - child.stdout.str = '';
1677 - child.stdout.on('data', function (chunk) { this.str += chunk.toString(); });
1678 - child.waitExit();
1679 - response = 'Response: ' + child.stdout.str;
1680 - break;
1681 - }
1682 - */
1683 - /*
1674 case 'border':
1675 {
1676 if ((args['_'].length == 1) && (args['_'][0] == 'on')) {
meshmail.js
+3 -1
@@ -32,9 +32,11 @@ module.exports.CreateMeshMail = function (parent) {
32 //function EscapeHtmlBreaks(x) { if (typeof x == "string") return x.replace(/&/g, '&amp;').replace(/>/g, '&gt;').replace(/</g, '&lt;').replace(/"/g, '&quot;').replace(/'/g, '&apos;').replace(/\r/g, '<br />').replace(/\n/g, '').replace(/\t/g, '&nbsp;&nbsp;'); if (typeof x == "boolean") return x; if (typeof x == "number") return x; }
33
34 // Setup mail server
35 - var options = { host: parent.config.smtp.host, secure: (parent.config.smtp.tls == true) };
35 + var options = { host: parent.config.smtp.host, secure: (parent.config.smtp.tls == true), tls: { } };
36 //var options = { host: parent.config.smtp.host, secure: (parent.config.smtp.tls == true), tls: { secureProtocol: 'SSLv23_method', ciphers: 'RSA+AES:!aNULL:!MD5:!DSS', secureOptions: constants.SSL_OP_NO_SSLv2 | constants.SSL_OP_NO_SSLv3 | constants.SSL_OP_NO_COMPRESSION | constants.SSL_OP_CIPHER_SERVER_PREFERENCE, rejectUnauthorized: false } };
37 if (parent.config.smtp.port != null) { options.port = parent.config.smtp.port; }
38 + if (parent.config.smtp.tlscertcheck === false) { options.tls.rejectUnauthorized = false; }
39 + if (parent.config.smtp.tlsstrict === true) { options.tls.secureProtocol = 'SSLv23_method'; options.tls.ciphers = 'RSA+AES:!aNULL:!MD5:!DSS'; options.tls.secureOptions = constants.SSL_OP_NO_SSLv2 | constants.SSL_OP_NO_SSLv3 | constants.SSL_OP_NO_COMPRESSION | constants.SSL_OP_CIPHER_SERVER_PREFERENCE; }
40 if ((parent.config.smtp.user != null) && (parent.config.smtp.pass != null)) { options.auth = { user: parent.config.smtp.user, pass: parent.config.smtp.pass }; }
41 obj.smtpServer = nodemailer.createTransport(options);
42
package.json
+1 -1
@@ -1,6 +1,6 @@
1 {
2 "name": "meshcentral",
3 - "version": "0.4.0-v",
3 + "version": "0.4.0-w",
4 "keywords": [
5 "Remote Management",
6 "Intel AMT",
sample-config.json
+6 -1
@@ -145,6 +145,11 @@
145 "host": "smtp.myserver.com",
146 "port": 25,
147 "from": "myemail@myserver.com",
148 - "tls": false
148 + "__tls__": "When 'tls' is set to true, TLS is used immidiatly when connecting. For SMTP servers that use TLSSTART, set this to 'false' and TLS will still be used.",
149 + "tls": false,
150 + "___tlscertcheck__": "When set to false, the TLS certificate of the SMTP server is not checked.",
151 + "_tlscertcheck": false,
152 + "__tlsstrict__": "When set to true, TLS cypher setup is more limited, SSLv2 and SSLv3 are not allowed.",
153 + "_tlsstrict": true
154 }
155 }
webserver.js
+2 -2
@@ -1514,8 +1514,8 @@ module.exports.CreateWebServer = function (parent, db, args, certificates) {
1514 if ((!obj.args.user) && (obj.args.nousers != true) && (nologout == false)) { logoutcontrol += ' <a href=' + domain.url + 'logout?' + Math.random() + ' style=color:white>Logout</a>'; } // If a default user is in use or no user mode, don't display the logout button
1515 var httpsPort = ((obj.args.aliasport == null) ? obj.args.port : obj.args.aliasport); // Use HTTPS alias port is specified
1516
1517 - // Clean up the U2F challenge is needed
1518 - //if (req.session.u2fchallenge) { delete req.session.u2fchallenge; };
1517 + // Clean up the U2F challenge if needed
1518 + if (req.session.u2fchallenge) { delete req.session.u2fchallenge; };
1519
1520 // Fetch the web state
1521 parent.debug('web', 'handleRootRequestEx: success.');