Added Intel AMT TLS 1.1/1.2 support.
Ylian Saint-Hilaire committed
Dec 19, 2017 at 09:54 UTC
69268dcd4a8c992bbd0981c2f034f540766d625d
4 files changed
+177
-37
public/commander.htm
+158
-32
@@ -628,7 +628,7 @@ th {
628
<div id="d24dLockResetButton"><input type="checkbox" id="d24LockResetButton" onchange="showAdvPowerDlgChange()">Lock reset button<br></div>
629
<div id="d24dLockSleepButton"><input type="checkbox" id="d24LockSleepButton" onchange="showAdvPowerDlgChange()">Lock sleep button<br></div>
630
<div id="d24dLockKeyboard"><input type="checkbox" id="d24LockKeyboard" onchange="showAdvPowerDlgChange()">Lock keyboard<br></div>
631
- <div id="d24dUserPasswordBypass"><input type="checkbox" id="d24UserPasswordBypass" onchange="showAdvPowerDlgChange()">User power bypass<br></div>
631
+ <div id="d24dUserPasswordBypass"><input type="checkbox" id="d24UserPasswordBypass" onchange="showAdvPowerDlgChange()">BIOS password bypass<br></div>
632
<div id="d24dReflashBios"><input type="checkbox" id="d24ReflashBios" onchange="showAdvPowerDlgChange()">Reflash BIOS<br></div>
633
<div id="d24dSafeMode"><input type="checkbox" id="d24SafeMode" onchange="showAdvPowerDlgChange()">Safe mode<br></div>
634
<div id="d24dUseIDER"><input type="checkbox" id="d24UseIDER" onchange="showAdvPowerDlgChange()">Use IDER<br></div>
@@ -637,6 +637,16 @@ th {
637
</div>
638
<div>Boot Settings</div>
639
</div>
640
+ <div style="height:26px">
641
+ <select id="idx_d24ForceBootDevice" style="float:right;width:200px" onchange="showAdvPowerDlgChange()">
642
+ <option value="0">None
643
+ <option value="1">Force CD/DVD Boot
644
+ <option value="2">Force PXE Boot
645
+ <option value="3">Force Hard Disk Boot
646
+ <option value="4">Force Diagnostic Boot
647
+ </select>
648
+ <div>Boot Source</div>
649
+ </div>
650
<div style="height:26px">
651
<select id="idx_d24BootMediaIndex" style="float:right;width:200px" onchange="showAdvPowerDlgChange()">
652
<option value="0">None
@@ -647,7 +657,7 @@ th {
657
</select>
658
<div>Boot Media Index</div>
659
</div>
650
- <div style="height:26px">
660
+ <div style="height:26px" id="idd_d24IDERBootDevice">
661
<select id="idx_d24IDERBootDevice" style="float:right;width:200px" onchange="showAdvPowerDlgChange()">
662
<option value="0">Boot to floppy
663
<option value="1">Boot to CDROM
@@ -834,7 +844,9 @@ var CreateWsmanComm = function (host, port, user, pass, tls) {
844
obj.user = user;
845
obj.pass = pass;
846
obj.tls = tls;
847
+ obj.tlsv1only = 0;
848
obj.cnonce = Math.random().toString(36).substring(7); // Generate a random client nonce
849
+ obj.inDataCount = 0;
850
851
// Private method
852
//obj.Debug = function (msg) { console.log(msg); }
@@ -921,8 +933,9 @@ var CreateWsmanComm = function (host, port, user, pass, tls) {
933
// Websocket relay specific private method
934
obj.xxConnectHttpSocket = function () {
935
//obj.Debug("xxConnectHttpSocket");
936
+ obj.inDataCount = 0;
937
obj.socketState = 1;
925
- obj.socket = new WebSocket(window.location.protocol.replace("http", "ws") + "//" + window.location.host + window.location.pathname.substring(0, window.location.pathname.lastIndexOf('/')) + "/webrelay.ashx?p=1&host=" + obj.host + "&port=" + obj.port + "&tls=" + obj.tls + ((user == '*') ? "&serverauth=1" : "") + ((typeof pass === "undefined") ? ("&serverauth=1&user=" + user) : "")); // The "p=1" indicates to the relay that this is a WSMAN session
938
+ obj.socket = new WebSocket(window.location.protocol.replace("http", "ws") + "//" + window.location.host + window.location.pathname.substring(0, window.location.pathname.lastIndexOf('/')) + "/webrelay.ashx?p=1&host=" + obj.host + "&port=" + obj.port + "&tls=" + obj.tls + "&tls1only=" + obj.tlsv1only + ((user == '*') ? "&serverauth=1" : "") + ((typeof pass === "undefined") ? ("&serverauth=1&user=" + user) : "")); // The "p=1" indicates to the relay that this is a WSMAN session
939
obj.socket.onopen = _OnSocketConnected;
940
obj.socket.onmessage = _OnMessage;
941
obj.socket.onclose = _OnSocketClosed;
@@ -940,6 +953,7 @@ var CreateWsmanComm = function (host, port, user, pass, tls) {
953
}
954
955
function _OnMessage(e) {
956
+ obj.inDataCount++;
957
if (typeof e.data == 'object') {
958
var f = new FileReader();
959
if (f.readAsBinaryString) {
@@ -1056,6 +1070,7 @@ var CreateWsmanComm = function (host, port, user, pass, tls) {
1070
// Websocket relay specific private method
1071
function _OnSocketClosed(data) {
1072
//console.log("_OnSocketClosed");
1073
+ if (obj.inDataCount == 0) { obj.tlsv1only = (1 - obj.tlsv1only); }
1074
obj.socketState = 0;
1075
if (obj.socket != null) { obj.socket.close(); obj.socket = null; }
1076
if (obj.pendingAjaxCall.length > 0) {
@@ -1118,6 +1133,8 @@ var CreateAmtRedirect = function (module) {
1133
obj.user = null;
1134
obj.pass = null;
1135
obj.authuri = "/RedirectionService";
1136
+ obj.tlsv1only = 0;
1137
+ obj.inDataCount = 0;
1138
obj.connectstate = 0;
1139
obj.protocol = module.protocol; // 1 = SOL, 2 = KVM, 3 = IDER
1140
@@ -1137,7 +1154,9 @@ var CreateAmtRedirect = function (module) {
1154
obj.user = user;
1155
obj.pass = pass;
1156
obj.connectstate = 0;
1140
- obj.socket = new WebSocket(window.location.protocol.replace("http", "ws") + "//" + window.location.host + window.location.pathname.substring(0, window.location.pathname.lastIndexOf('/')) + "/webrelay.ashx?p=2&host=" + host + "&port=" + port + "&tls=" + tls + ((user == '*') ? "&serverauth=1" : "") + ((typeof pass === "undefined") ? ("&serverauth=1&user=" + user) : "")); // The "p=2" indicates to the relay that this is a REDIRECTION session
1157
+ obj.inDataCount = 0;
1158
+ console.log('obj.tlsv1onlyx', obj.tlsv1only);
1159
+ obj.socket = new WebSocket(window.location.protocol.replace("http", "ws") + "//" + window.location.host + window.location.pathname.substring(0, window.location.pathname.lastIndexOf('/')) + "/webrelay.ashx?p=2&host=" + host + "&port=" + port + "&tls=" + tls + "&tls1only=" + obj.tlsv1only + ((user == '*') ? "&serverauth=1" : "") + ((typeof pass === "undefined") ? ("&serverauth=1&user=" + user) : "")); // The "p=2" indicates to the relay that this is a REDIRECTION session
1160
obj.socket.onopen = obj.xxOnSocketConnected;
1161
obj.socket.onmessage = obj.xxOnMessage;
1162
obj.socket.onclose = obj.xxOnSocketClosed;
@@ -1154,7 +1173,9 @@ var CreateAmtRedirect = function (module) {
1173
}
1174
1175
obj.xxOnMessage = function (e) {
1157
- if (typeof e.data == 'object') {
1176
+
1177
+ obj.inDataCount++;
1178
+ if (typeof e.data == 'object') {
1179
var f = new FileReader();
1180
if (f.readAsBinaryString) {
1181
// Chrome & Firefox (Draft)
@@ -1368,8 +1389,18 @@ var CreateAmtRedirect = function (module) {
1389
1390
obj.xxOnSocketClosed = function () {
1391
//obj.Debug("Redir Socket Closed");
1371
- obj.Stop();
1372
- }
1392
+
1393
+ console.log('obj.tlsv1only', obj.tlsv1only);
1394
+ if ((obj.inDataCount == 0) && (obj.tlsv1only == 0)) {
1395
+ obj.tlsv1only = 1;
1396
+ obj.socket = new WebSocket(window.location.protocol.replace("http", "ws") + "//" + window.location.host + window.location.pathname.substring(0, window.location.pathname.lastIndexOf('/')) + "/webrelay.ashx?p=2&host=" + host + "&port=" + port + "&tls=" + tls + "&tls1only=" + obj.tlsv1only + ((user == '*') ? "&serverauth=1" : "") + ((typeof pass === "undefined") ? ("&serverauth=1&user=" + user) : "")); // The "p=2" indicates to the relay that this is a REDIRECTION session
1397
+ obj.socket.onopen = obj.xxOnSocketConnected;
1398
+ obj.socket.onmessage = obj.xxOnMessage;
1399
+ obj.socket.onclose = obj.xxOnSocketClosed;
1400
+ } else {
1401
+ obj.Stop();
1402
+ }
1403
+ }
1404
1405
obj.xxStateChange = function(newstate) {
1406
if (obj.State == newstate) return;
@@ -1408,7 +1439,7 @@ var WsmanStackCreateService = function (host, port, user, pass, tls, extra) {
1439
obj.comm = CreateWsmanComm(host, port, user, pass, tls, extra);
1440
1441
obj.PerformAjax = function (postdata, callback, tag, pri, namespaces) {
1411
- if (namespaces == undefined) namespaces = '';
1442
+ if (namespaces == null) namespaces = '';
1443
obj.comm.PerformAjax('<?xml version=\"1.0\" encoding=\"utf-8\"?><Envelope xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:a="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:w="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd" xmlns=\"http://www.w3.org/2003/05/soap-envelope\" ' + namespaces + '><Header><a:Action>' + postdata, function (data, status, tag) {
1444
if (status != 200) { callback(obj, null, { Header: { HttpError: status } }, status, tag); return; }
1445
var wsresponse = obj.ParseWsman(data);
@@ -1431,8 +1462,8 @@ var WsmanStackCreateService = function (host, port, user, pass, tls, extra) {
1462
// Perform a WSMAN Subscribe operation
1463
obj.ExecSubscribe = function (resuri, delivery, url, callback, tag, pri, selectors, opaque, user, pass) {
1464
var digest = "", digest2 = "", opaque = "";
1434
- if (user != undefined && pass != undefined) { digest = '<t:IssuedTokens xmlns:t="http://schemas.xmlsoap.org/ws/2005/02/trust" xmlns:se="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"><t:RequestSecurityTokenResponse><t:TokenType>http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#UsernameToken</t:TokenType><t:RequestedSecurityToken><se:UsernameToken><se:Username>' + user + '</se:Username><se:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd#PasswordText">' + pass + '</se:Password></se:UsernameToken></t:RequestedSecurityToken></t:RequestSecurityTokenResponse></t:IssuedTokens>'; digest2 = '<w:Auth Profile="http://schemas.dmtf.org/wbem/wsman/1/wsman/secprofile/http/digest"/>'; }
1435
- if (opaque != undefined && opaque != null) { opaque = '<a:ReferenceParameters><m:arg>' + opaque + '</m:arg></a:ReferenceParameters>'; }
1465
+ if (user != null && pass != null) { digest = '<t:IssuedTokens xmlns:t="http://schemas.xmlsoap.org/ws/2005/02/trust" xmlns:se="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"><t:RequestSecurityTokenResponse><t:TokenType>http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#UsernameToken</t:TokenType><t:RequestedSecurityToken><se:UsernameToken><se:Username>' + user + '</se:Username><se:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd#PasswordText">' + pass + '</se:Password></se:UsernameToken></t:RequestedSecurityToken></t:RequestSecurityTokenResponse></t:IssuedTokens>'; digest2 = '<w:Auth Profile="http://schemas.dmtf.org/wbem/wsman/1/wsman/secprofile/http/digest"/>'; }
1466
+ if (opaque != null) { opaque = '<a:ReferenceParameters><m:arg>' + opaque + '</m:arg></a:ReferenceParameters>'; }
1467
if (delivery == 'PushWithAck') { delivery = 'dmtf.org/wbem/wsman/1/wsman/PushWithAck'; } else if (delivery == 'Push') { delivery = 'xmlsoap.org/ws/2004/08/eventing/DeliveryModes/Push'; }
1468
var data = "http://schemas.xmlsoap.org/ws/2004/08/eventing/Subscribe</a:Action><a:To>" + obj.Address + "</a:To><w:ResourceURI>" + resuri + "</w:ResourceURI><a:MessageID>" + (obj.NextMessageId++) + "</a:MessageID><a:ReplyTo><a:Address>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:Address></a:ReplyTo>" + _PutObjToSelectorsXml(selectors) + digest + '</Header><Body><e:Subscribe><e:Delivery Mode="http://schemas.' + delivery + '"><e:NotifyTo><a:Address>' + url + '</a:Address>' + opaque + '</e:NotifyTo>' + digest2 + '</e:Delivery></e:Subscribe>';
1469
obj.PerformAjax(data + "</Body></Envelope>", callback, tag, pri, 'xmlns:e="http://schemas.xmlsoap.org/ws/2004/08/eventing" xmlns:m="http://x.com"');
@@ -1523,13 +1554,13 @@ var WsmanStackCreateService = function (host, port, user, pass, tls, extra) {
1554
var data, r = {};
1555
for (var i = 0; i < node.childNodes.length; i++) {
1556
var child = node.childNodes[i];
1526
- if ((child.childElementCount === undefined) || (child.childElementCount == 0)) { data = child.textContent; } else { data = _ParseWsmanRec(child); }
1557
+ if ((child.childElementCount == null) || (child.childElementCount == 0)) { data = child.textContent; } else { data = _ParseWsmanRec(child); }
1558
if (data == 'true') data = true; // Convert 'true' into true
1559
if (data == 'false') data = false; // Convert 'false' into false
1560
if ((parseInt(data) + '') === data) data = parseInt(data); // Convert integers
1561
1562
var childObj = data;
1532
- if ((child.attributes !== null) && (child.attributes.length > 0)) {
1563
+ if ((child.attributes != null) && (child.attributes.length > 0)) {
1564
childObj = { 'Value': data };
1565
for(var j = 0; j < child.attributes.length; j++) {
1566
childObj['@' + child.attributes[j].name] = child.attributes[j].value;
@@ -1537,20 +1568,20 @@ var WsmanStackCreateService = function (host, port, user, pass, tls, extra) {
1568
}
1569
1570
if (r[child.localName] instanceof Array) { r[child.localName].push(childObj); }
1540
- else if (r[child.localName] == undefined) { r[child.localName] = childObj; }
1571
+ else if (r[child.localName] == null) { r[child.localName] = childObj; }
1572
else { r[child.localName] = [r[child.localName], childObj]; }
1573
}
1574
return r;
1575
}
1576
1577
function _PutObjToBodyXml(resuri, putObj) {
1547
- if(!resuri || putObj === undefined || putObj === null) return '';
1578
+ if (!resuri || putObj == null) return '';
1579
var objname = obj.GetNameFromUrl(resuri);
1580
var result = '<r:' + objname + ' xmlns:r="' + resuri + '">';
1581
1582
for (var prop in putObj) {
1583
if (!putObj.hasOwnProperty(prop) || prop.indexOf('__') === 0 || prop.indexOf('@') === 0) continue;
1553
- if (putObj[prop] === undefined || putObj[prop] === null || typeof putObj[prop] === 'function') continue;
1584
+ if (putObj[prop] == null || typeof putObj[prop] === 'function') continue;
1585
if (typeof putObj[prop] === 'object' && putObj[prop]['ReferenceParameters']) {
1586
result += '<r:' + prop + '><a:Address>' + putObj[prop].Address + '</a:Address><a:ReferenceParameters><w:ResourceURI>' + putObj[prop]['ReferenceParameters']["ResourceURI"] + '</w:ResourceURI><w:SelectorSet>';
1587
var selectorArray = putObj[prop]['ReferenceParameters']['SelectorSet']['Selector'];
@@ -1638,6 +1669,88 @@ var WsmanStackCreateService = function (host, port, user, pass, tls, extra) {
1669
}
1670
}
1671
1672
+ /*
1673
+ // This is a drop-in replacement to _turnToXml() that works without xml parser dependency.
1674
+ Object.defineProperty(Array.prototype, "peek", { value: function () { return (this.length > 0 ? this[this.length - 1] : null); } });
1675
+ function _treeBuilder() {
1676
+ this.tree = [];
1677
+ this.push = function (element) { this.tree.push(element); };
1678
+ this.pop = function () { var element = this.tree.pop(); if (this.tree.length > 0) { var x = this.tree.peek(); x.childNodes.push(element); x.childElementCount = x.childNodes.length; } return (element); };
1679
+ this.peek = function () { return (this.tree.peek()); }
1680
+ this.addNamespace = function (prefix, namespace) { this.tree.peek().nsTable[prefix] = namespace; if (this.tree.peek().attributes.length > 0) { for (var i = 0; i < this.tree.peek().attributes; ++i) { var a = this.tree.peek().attributes[i]; if (prefix == '*' && a.name == a.localName) { a.namespace = namespace; } else if (prefix != '*' && a.name != a.localName) { var pfx = a.name.split(':')[0]; if (pfx == prefix) { a.namespace = namespace; } } } } }
1681
+ this.getNamespace = function (prefix) { for (var i = this.tree.length - 1; i >= 0; --i) { if (this.tree[i].nsTable[prefix] != null) { return (this.tree[i].nsTable[prefix]); } } return null; }
1682
+ }
1683
+ function _turnToXml(text) { if (text == null) return null; return ({ childNodes: [_turnToXmlRec(text)], getElementsByTagName: _getElementsByTagName, getChildElementsByTagName: _getChildElementsByTagName, getElementsByTagNameNS: _getElementsByTagNameNS }); }
1684
+ function _getElementsByTagNameNS(ns, name) { var ret = []; _xmlTraverseAllRec(this.childNodes, function (node) { if (node.localName == name && (node.namespace == ns || ns == '*')) { ret.push(node); } }); return ret; }
1685
+ function _getElementsByTagName(name) { var ret = []; _xmlTraverseAllRec(this.childNodes, function (node) { if (node.localName == name) { ret.push(node); } }); return ret; }
1686
+ function _getChildElementsByTagName(name) { var ret = []; if (this.childNodes != null) { for (var node in this.childNodes) { if (this.childNodes[node].localName == name) { ret.push(this.childNodes[node]); } } } return (ret); }
1687
+ function _getChildElementsByTagNameNS(ns, name) { var ret = []; if (this.childNodes != null) { for (var node in this.childNodes) { if (this.childNodes[node].localName == name && (ns == '*' || this.childNodes[node].namespace == ns)) { ret.push(this.childNodes[node]); } } } return (ret); }
1688
+ function _xmlTraverseAllRec(nodes, func) { for (var i in nodes) { func(nodes[i]); if (nodes[i].childNodes) { _xmlTraverseAllRec(nodes[i].childNodes, func); } } }
1689
+ function _turnToXmlRec(text) {
1690
+ var elementStack = new _treeBuilder(), lastElement = null, x1 = text.split('<'), ret = [], element = null, currentElementName = null;
1691
+ for (var i in x1) {
1692
+ var x2 = x1[i].split('>'), x3 = x2[0].split(' '), elementName = x3[0];
1693
+ if ((elementName.length > 0) && (elementName[0] != '?')) {
1694
+ if (elementName[0] != '/') {
1695
+ var attributes = [], localName, localname2 = elementName.split(' ')[0].split(':'), localName = (localname2.length > 1) ? localname2[1] : localname2[0];
1696
+ Object.defineProperty(attributes, "get",
1697
+ {
1698
+ value: function () {
1699
+ if (arguments.length == 1) {
1700
+ for (var a in this) { if (this[a].name == arguments[0]) { return (this[a]); } }
1701
+ }
1702
+ else if (arguments.length == 2) {
1703
+ for (var a in this) { if (this[a].name == arguments[1] && (arguments[0] == '*' || this[a].namespace == arguments[0])) { return (this[a]); } }
1704
+ }
1705
+ else {
1706
+ throw ('attributes.get(): Invalid number of parameters');
1707
+ }
1708
+ }
1709
+ });
1710
+ elementStack.push({ name: elementName, localName: localName, getChildElementsByTagName: _getChildElementsByTagName, getElementsByTagNameNS: _getElementsByTagNameNS, getChildElementsByTagNameNS: _getChildElementsByTagNameNS, attributes: attributes, childNodes: [], nsTable: {} });
1711
+ // Parse Attributes
1712
+ if (x3.length > 0) {
1713
+ var skip = false;
1714
+ for (var j in x3) {
1715
+ if (x3[j] == '/') {
1716
+ // This is an empty Element
1717
+ elementStack.peek().namespace = elementStack.peek().name == elementStack.peek().localName ? elementStack.getNamespace('*') : elementStack.getNamespace(elementStack.peek().name.substring(0, elementStack.peek().name.indexOf(':')));
1718
+ elementStack.peek().textContent = '';
1719
+ lastElement = elementStack.pop();
1720
+ skip = true;
1721
+ break;
1722
+ }
1723
+ var k = x3[j].indexOf('=');
1724
+ if (k > 0) {
1725
+ var attrName = x3[j].substring(0, k);
1726
+ var attrValue = x3[j].substring(k + 2, x3[j].length - 1);
1727
+ var attrNS = elementStack.getNamespace('*');
1728
+
1729
+ if (attrName == 'xmlns') {
1730
+ elementStack.addNamespace('*', attrValue);
1731
+ attrNS = attrValue;
1732
+ } else if (attrName.startsWith('xmlns:')) {
1733
+ elementStack.addNamespace(attrName.substring(6), attrValue);
1734
+ } else {
1735
+ var ax = attrName.split(':');
1736
+ if (ax.length == 2) { attrName = ax[1]; attrNS = elementStack.getNamespace(ax[0]); }
1737
+ }
1738
+ var x = { name: attrName, value: attrValue }
1739
+ if (attrNS != null) x.namespace = attrNS;
1740
+ elementStack.peek().attributes.push(x);
1741
+ }
1742
+ }
1743
+ if (skip) { continue; }
1744
+ }
1745
+ elementStack.peek().namespace = elementStack.peek().name == elementStack.peek().localName ? elementStack.getNamespace('*') : elementStack.getNamespace(elementStack.peek().name.substring(0, elementStack.peek().name.indexOf(':')));
1746
+ if (x2[1]) { elementStack.peek().textContent = x2[1]; }
1747
+ } else { lastElement = elementStack.pop(); }
1748
+ }
1749
+ }
1750
+ return lastElement;
1751
+ }
1752
+ */
1753
+
1754
return obj;
1755
}
1756
/**
@@ -32302,7 +32415,7 @@ script_functionTable2 = ['encodeuri', 'decodeuri', 'passwordcheck', 'atob', 'bto
32415
script_functionTableX2 = [encodeURI, decodeURI, passwordcheck, window.atob.bind(window), window.btoa.bind(window), hex2rstr, rstr2hex, random, rstr_md5, MakeToArray, ReadShort, ReadShortX, ReadInt, ReadSInt, ReadIntX, ShortToStr, ShortToStrX, IntToStr, IntToStrX];
32416
32417
// Optional functions of type ARG1 = func(ARG2, ARG3, ARG4, ARG5, ARG6)
32305
-script_functionTable3 = ['pullsystemstatus', 'pulleventlog', 'pullauditlog', 'pullcertificates', 'pullwatchdog', 'pullsystemdefense', 'pullhardware', 'pulluserinfo', 'pullremoteaccess', 'highlightblock', 'disconnect', 'getsidstring', 'getsidbytearray'];
32418
+script_functionTable3 = ['pullsystemstatus', 'pulleventlog', 'pullauditlog', 'pullcertificates', 'pullwatchdog', 'pullsystemdefense', 'pullhardware', 'pulluserinfo', 'pullremoteaccess', 'highlightblock', 'disconnect', 'getsidstring', 'getsidbytearray', 'pulleventsubscriptions'];
32419
32420
// Optional functions of type ARG1 = func(ARG2, ARG3, ARG4, ARG5, ARG6)
32421
script_functionTableX3 = [
@@ -32338,7 +32451,10 @@ script_functionTableX3 = [
32451
function (runner, x) { return GetSidString(x); }
32452
,
32453
function (runner, x) { return GetSidByteArray(x); }
32341
-];
32454
+ ,
32455
+
32456
+ PullEventSubscriptions
32457
+ ];
32458
32459
// Setup the script state
32460
function script_setup(binary, startvars) {
@@ -32960,7 +33076,7 @@ if (typeof module !== "undefined" && module.exports) {
33076
});
33077
}
33078
32963
- var version = '0.5.3';
33079
+ var version = '0.5.7';
33080
var urlvars = null;
33081
var amtstack;
33082
var wsstack = null;
@@ -33076,14 +33192,17 @@ if (typeof module !== "undefined" && module.exports) {
33192
}
33193
33194
function handleKeyUp(e) {
33195
+ //console.log('handleKeyUp', e);
33196
if (xxdialogMode) return;
33197
}
33198
33199
function handleKeyDown(e) {
33200
+ //console.log('handleKeyDown', e);
33201
if (xxdialogMode) return;
33202
}
33203
33204
function handleKeyPress(e) {
33205
+ //console.log('handleKeyPress', e);
33206
if (xxdialogMode) return;
33207
}
33208
@@ -33200,6 +33319,7 @@ if (typeof module !== "undefined" && module.exports) {
33319
if (amtstack) {
33320
amtstack.onProcessChanged = null; // Un-hook progress indicator
33321
amtstack.CancelAllQueries(999); // Fail all pending WSMAN calls. Set to 999 to indicate not to call back any of the pending calls with errors.
33322
+ amtstack = null;
33323
}
33324
cleanup();
33325
wsstack = null;
@@ -36227,6 +36347,8 @@ if (typeof module !== "undefined" && module.exports) {
36347
if (amtPowerBootCapabilities["SecureErase"] == true) {
36348
addOption('d5actionSelect', "Reset to Secure Erase", 104);
36349
}
36350
+ addOption('d5actionSelect', 'Reset to PXE', 400);
36351
+ addOption('d5actionSelect', 'Power on to PXE', 401);
36352
36353
addOption('d5actionSelect', 'Custom action...', 999);
36354
if (amtversion > 5) { addOption('d5actionSelect', 'User consent...', 998); } // On AMT 5 and higher, offer the option of doing user consent alone.
@@ -36251,7 +36373,7 @@ if (typeof module !== "undefined" && module.exports) {
36373
if (action == 998) { amtstack.Get("IPS_OptInService", powerActionResponse0, 0, 1); return; }
36374
36375
// Some actions will not work if KVM/SOL/IDER are connected. If we perform these, disconnect now.
36254
- if (action < 10) {
36376
+ if ((action < 10) && (action > 2)) {
36377
}
36378
36379
statusbox("Power Action", "Checking state...");
@@ -36300,7 +36422,7 @@ if (typeof module !== "undefined" && module.exports) {
36422
showAdvPowerDlgChange();
36423
}
36424
36303
- function showAdvPowerDlgChange() { }
36425
+ function showAdvPowerDlgChange() { QV('idd_d24IDERBootDevice', Q('d24UseIDER').checked); }
36426
36427
function showAdvPowerDlgOk() {
36428
// Fetch all of the user data
@@ -36454,12 +36576,12 @@ if (typeof module !== "undefined" && module.exports) {
36576
//if (action == 104 && !r["SecureErase"]) { /*console.log("This Intel® AMT does not support Secure Erase");*/ cleanup(); return; }
36577
//console.log("Setting Boot Settings: " + ObjectToString2(r), action);
36578
statusbox("Power Action", "Setting boot settings...");
36457
- amtstack.Put("AMT_BootSettingData", r, powerActionResponse2, 0, 1);
36579
+ amtstack.Put("AMT_BootSettingData", r, powerActionResponse2, r, 1);
36580
}
36581
36460
- function powerActionResponse2(stack, name, response, status) {
36582
+ function powerActionResponse2(stack, name, response, status, tag) {
36583
//console.log("powerActionResponse2(" + name + "," + response + "," + status + ")");
36462
- if (status != 200) { messagebox("Power Action", "Error #" + status); return; }
36584
+ if (status != 200) { messagebox("Power Action", "PUT AMT_BootSettingData, Error #" + status); console.log(tag); return; }
36585
//if (status == 408) { messagebox("Power Action", "Access denied."); return; }
36586
//if (errcheck(status, stack)) return;
36587
//console.log("Setup next boot...");
@@ -36469,9 +36591,16 @@ if (typeof module !== "undefined" && module.exports) {
36591
36592
function powerActionResponse3x(stack, name, response, status) {
36593
//console.log("powerActionResponse3x(" + name + "," + response + "," + status + ")");
36472
- var action = d5actionSelect.value;
36473
- var bootSource = null;
36474
- if (action == 300 || action == 301) { bootSource = '<Address xmlns="http://schemas.xmlsoap.org/ws/2004/08/addressing">http://schemas.xmlsoap.org/ws/2004/08/addressing</Address><ReferenceParameters xmlns="http://schemas.xmlsoap.org/ws/2004/08/addressing"><ResourceURI xmlns="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd">http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_BootSourceSetting</ResourceURI><SelectorSet xmlns="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd"><Selector Name="InstanceID">Intel(r) AMT: Force Diagnostic Boot</Selector></SelectorSet></ReferenceParameters>'; }
36594
+ var action = d5actionSelect.value, bootSource = null;
36595
+
36596
+ if (action == 999) {
36597
+ if (idx_d24ForceBootDevice.value > 0) { bootSource = ['Force CD/DVD Boot', 'Force PXE Boot', 'Force Hard-drive Boot', 'Force Diagnostic Boot'][idx_d24ForceBootDevice.value - 1]; }
36598
+ } else {
36599
+ if (action == 300 || action == 301) { bootSource = 'Force Diagnostic Boot'; }
36600
+ if (action == 400 || action == 401) { bootSource = 'Force PXE Boot'; }
36601
+
36602
+ }
36603
+ if (bootSource != null) { bootSource = '<Address xmlns="http://schemas.xmlsoap.org/ws/2004/08/addressing">http://schemas.xmlsoap.org/ws/2004/08/addressing</Address><ReferenceParameters xmlns="http://schemas.xmlsoap.org/ws/2004/08/addressing"><ResourceURI xmlns="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd">http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_BootSourceSetting</ResourceURI><SelectorSet xmlns="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd"><Selector Name="InstanceID">Intel(r) AMT: ' + bootSource + '</Selector></SelectorSet></ReferenceParameters>'; }
36604
amtstack.CIM_BootConfigSetting_ChangeBootOrder(bootSource, powerActionResponse3);
36605
}
36606
@@ -36482,8 +36611,8 @@ if (typeof module !== "undefined" && module.exports) {
36611
//console.log("Performing Power State Change...");
36612
statusbox("Power Action", "Performing power action...");
36613
var action = d5actionSelect.value;
36485
- if (action == 100 || action == 201 || action == 203 || action == 300) action = 2; // Power up
36486
- if (action == 101 || action == 200 || action == 202 || action == 301) action = 10; // Reset
36614
+ if (action == 100 || action == 201 || action == 203 || action == 300 || action == 401) action = 2; // Power up
36615
+ if (action == 101 || action == 200 || action == 202 || action == 301 || action == 400) action = 10; // Reset
36616
if (action == 104) action = 10; // Reset with Remote Secure Erase
36617
36618
if (action == 999) action = AvdPowerDlg.Action;
@@ -37033,7 +37162,7 @@ if (typeof module !== "undefined" && module.exports) {
37162
// Success
37163
var x;
37164
try { x = JSON.parse(request.responseText); } catch (e) {}
37036
- if (x['blocks']) { script_StartingBuildingBlocks = x['blocks']; script_setBuildBlocks(script_StartingBuildingBlocks); }
37165
+ if ((x) && (x['blocks'])) { script_StartingBuildingBlocks = x['blocks']; script_setBuildBlocks(script_StartingBuildingBlocks); }
37166
}
37167
};
37168
request.onerror = function() { console.log('Failed to get script blocks'); };
@@ -37571,9 +37700,6 @@ if (typeof module !== "undefined" && module.exports) {
37700
if (s == 401) { QH('id_messageviewstr', 'Authentication Error<br /><br /><input type=button value="Set new credentials" onclick=meshcentral2credCallback(true)></input>'); }
37701
go(100);
37702
QS('id_progressbar').width = 0;
37574
-// ###BEGIN###{Mode-ComputerSelector}
37575
- Q('id_messageviewbutton').focus();
37576
-// ###END###{Mode-ComputerSelector}
37703
37704
}
37705
return (s != 200);
public/scripts/amt-redir-ws-0.1.0.js
+13
-1
@@ -17,6 +17,8 @@ var CreateAmtRedirect = function (module) {
17
obj.user = null;
18
obj.pass = null;
19
obj.authuri = "/RedirectionService";
20
+ obj.tlsv1only = 0;
21
+ obj.inDataCount = 0;
22
// ###END###{!Mode-Firmware}
23
obj.connectstate = 0;
24
obj.protocol = module.protocol; // 1 = SOL, 2 = KVM, 3 = IDER
@@ -36,6 +38,7 @@ var CreateAmtRedirect = function (module) {
38
obj.user = user;
39
obj.pass = pass;
40
obj.connectstate = 0;
41
+ obj.inDataCount = 0;
42
obj.socket = new WebSocket(window.location.protocol.replace("http", "ws") + "//" + window.location.host + window.location.pathname.substring(0, window.location.pathname.lastIndexOf('/')) + "/webrelay.ashx?p=2&host=" + host + "&port=" + port + "&tls=" + tls + ((user == '*') ? "&serverauth=1" : "") + ((typeof pass === "undefined") ? ("&serverauth=1&user=" + user) : "")); // The "p=2" indicates to the relay that this is a REDIRECTION session
43
obj.socket.onopen = obj.xxOnSocketConnected;
44
obj.socket.onmessage = obj.xxOnMessage;
@@ -52,6 +55,7 @@ var CreateAmtRedirect = function (module) {
55
}
56
57
obj.xxOnMessage = function (e) {
58
+ obj.inDataCount++;
59
if (typeof e.data == 'object') {
60
var f = new FileReader();
61
if (f.readAsBinaryString) {
@@ -264,7 +268,15 @@ var CreateAmtRedirect = function (module) {
268
269
obj.xxOnSocketClosed = function () {
270
//obj.Debug("Redir Socket Closed");
267
- obj.Stop();
271
+ if ((obj.inDataCount == 0) && (obj.tlsv1only == 0)) {
272
+ obj.tlsv1only = 1;
273
+ obj.socket = new WebSocket(window.location.protocol.replace("http", "ws") + "//" + window.location.host + window.location.pathname.substring(0, window.location.pathname.lastIndexOf('/')) + "/webrelay.ashx?p=2&host=" + obj.host + "&port=" + obj.port + "&tls=" + obj.tls + "&tls1only=1" + ((obj.user == '*') ? "&serverauth=1" : "") + ((typeof pass === "undefined") ? ("&serverauth=1&user=" + obj.user) : "")); // The "p=2" indicates to the relay that this is a REDIRECTION session
274
+ obj.socket.onopen = obj.xxOnSocketConnected;
275
+ obj.socket.onmessage = obj.xxOnMessage;
276
+ obj.socket.onclose = obj.xxOnSocketClosed;
277
+ } else {
278
+ obj.Stop();
279
+ }
280
}
281
282
obj.xxStateChange = function(newstate) {
public/scripts/amt-wsman-ws-0.2.0.js
+3
-1
@@ -21,6 +21,7 @@ var CreateWsmanComm = function (host, port, user, pass, tls) {
21
obj.user = user;
22
obj.pass = pass;
23
obj.tls = tls;
24
+ obj.tlsv1only = 1;
25
obj.cnonce = Math.random().toString(36).substring(7); // Generate a random client nonce
26
27
// Private method
@@ -115,7 +116,8 @@ var CreateWsmanComm = function (host, port, user, pass, tls) {
116
obj.socketData = '';
117
obj.socketState = 1;
118
118
- obj.socket = new WebSocket(window.location.protocol.replace("http", "ws") + "//" + window.location.host + window.location.pathname.substring(0, window.location.pathname.lastIndexOf('/')) + "/webrelay.ashx?p=1&host=" + obj.host + "&port=" + obj.port + "&tls=" + obj.tls + ((user == '*') ? "&serverauth=1" : "") + ((typeof pass === "undefined") ? ("&serverauth=1&user=" + user) : "")); // The "p=1" indicates to the relay that this is a WSMAN session
119
+ console.log(obj.tlsv1only);
120
+ obj.socket = new WebSocket(window.location.protocol.replace("http", "ws") + "//" + window.location.host + window.location.pathname.substring(0, window.location.pathname.lastIndexOf('/')) + "/webrelay.ashx?p=1&host=" + obj.host + "&port=" + obj.port + "&tls=" + obj.tls + "&tlsv1only=" + obj.tlsv1only + ((user == '*') ? "&serverauth=1" : "") + ((typeof pass === "undefined") ? ("&serverauth=1&user=" + user) : "")); // The "p=1" indicates to the relay that this is a WSMAN session
121
obj.socket.onopen = _OnSocketConnected;
122
obj.socket.onmessage = _OnMessage;
123
obj.socket.onclose = _OnSocketClosed;
webserver.js
+3
-3
@@ -1001,8 +1001,8 @@ module.exports.CreateWebServer = function (parent, db, args, secret, certificate
1001
1002
// TLSSocket to encapsulate TLS communication, which then tunneled via SerialTunnel an then wrapped through CIRA APF
1003
var TLSSocket = require('tls').TLSSocket;
1004
- var tlsoptions = { secureProtocol: 'TLSv1_method', ciphers: 'ECDH+AESGCM:DH+AESGCM:ECDH+AES256:DH+AES256:ECDH+AES128:DH+AES:RSA+AES:!aNULL:!MD5:!DSS', secureOptions: obj.constants.SSL_OP_NO_SSLv2 | obj.constants.SSL_OP_NO_SSLv3 | obj.constants.SSL_OP_NO_COMPRESSION | obj.constants.SSL_OP_CIPHER_SERVER_PREFERENCE, rejectUnauthorized: false, cert: obj.certificates.console.cert, key: obj.certificates.console.key };
1005
- var tlsock = new TLSSocket(ser, tlsoptions); // 'TLSv1_2_method' or 'SSLv23_method'
1004
+ var tlsoptions = { secureProtocol: ((req.query.tls1only == 1) ? 'TLSv1_method' : 'SSLv23_method'), ciphers: 'RSA+AES:!aNULL:!MD5:!DSS', secureOptions: obj.constants.SSL_OP_NO_SSLv2 | obj.constants.SSL_OP_NO_SSLv3 | obj.constants.SSL_OP_NO_COMPRESSION | obj.constants.SSL_OP_CIPHER_SERVER_PREFERENCE, rejectUnauthorized: false, cert: obj.certificates.console.cert, key: obj.certificates.console.key };
1005
+ var tlsock = new TLSSocket(ser, tlsoptions);
1006
tlsock.on('error', function (err) { Debug(1, "CIRA TLS Connection Error ", err); });
1007
tlsock.on('secureConnect', function () { Debug(2, "CIRA Secure TLS Connection"); ws.resume(); });
1008
@@ -1108,7 +1108,7 @@ module.exports.CreateWebServer = function (parent, db, args, secret, certificate
1108
ws.resume();
1109
} else {
1110
// If TLS is going to be used, setup a TLS socket
1111
- var tlsoptions = { secureProtocol: 'TLSv1_method', ciphers: 'ECDH+AESGCM:DH+AESGCM:ECDH+AES256:DH+AES256:ECDH+AES128:DH+AES:RSA+AES:!aNULL:!MD5:!DSS', secureOptions: obj.constants.SSL_OP_NO_SSLv2 | obj.constants.SSL_OP_NO_SSLv3 | obj.constants.SSL_OP_NO_COMPRESSION | obj.constants.SSL_OP_CIPHER_SERVER_PREFERENCE, rejectUnauthorized: false, cert: obj.certificates.console.cert, key: obj.certificates.console.key };
1111
+ var tlsoptions = { secureProtocol: ((req.query.tls1only == 1) ? 'TLSv1_method' : 'SSLv23_method'), ciphers: 'RSA+AES:!aNULL:!MD5:!DSS', secureOptions: obj.constants.SSL_OP_NO_SSLv2 | obj.constants.SSL_OP_NO_SSLv3 | obj.constants.SSL_OP_NO_COMPRESSION | obj.constants.SSL_OP_CIPHER_SERVER_PREFERENCE, rejectUnauthorized: false, cert: obj.certificates.console.cert, key: obj.certificates.console.key };
1112
ws.forwardclient = obj.tls.connect(port, node.host, tlsoptions, function () {
1113
// The TLS connection method is the same as TCP, but located a bit differently.
1114
Debug(2, 'TLS connected to ' + node.host + ':' + port + '.');